Ahmed Ghazy | 6dc7ebf | 2020-07-29 16:52:14 +0200 | [diff] [blame] | 1 | AC_INIT([open_pdks], [1.0], [github.com/RTimothyEdwards/open_pdks]) |
| 2 | |
| 3 | # detect PDKs based on directories that include Makefile.in files |
| 4 | m4_define([M4_GET_TECHS], [m4_normalize(m4_esyscmd(cd .. && find * -mindepth 1 -name "Makefile.in" -exec dirname {} \; | tr "\n" " "))]) |
| 5 | |
Tim Edwards | 7cbaaba | 2020-08-05 12:19:18 -0400 | [diff] [blame] | 6 | # check for the source and install paths for each PDK. |
| 7 | AC_DEFUN([M4_GEN_WITH_PDK_ARGS], |
Ahmed Ghazy | 6dc7ebf | 2020-07-29 16:52:14 +0200 | [diff] [blame] | 8 | [ |
| 9 | # --with-pdk-source=PDK_SOURCE_PATH |
| 10 | m4_foreach_w(pdk, $1, [ |
Tim Edwards | 7cbaaba | 2020-08-05 12:19:18 -0400 | [diff] [blame] | 11 | m4_define([pdkvar], [m4_normalize(m4_esyscmd(echo pdk | tr "a-z" "A-Z"))]) |
Tim Edwards | 5ef0397 | 2020-08-08 12:23:27 -0400 | [diff] [blame] | 12 | pdkvar[]_SOURCE_PATH_="" |
Ahmed Ghazy | 6dc7ebf | 2020-07-29 16:52:14 +0200 | [diff] [blame] | 13 | AC_ARG_WITH(pdk-source, |
| 14 | [AS_HELP_STRING([--with-pdk-source=/path/to/pdk/source], "location of the source files for pdk")], |
Tim Edwards | 5ef0397 | 2020-08-08 12:23:27 -0400 | [diff] [blame] | 15 | [pdkvar[]_SOURCE_PATH_=$withval] |
Ahmed Ghazy | 6dc7ebf | 2020-07-29 16:52:14 +0200 | [diff] [blame] | 16 | ) |
Tim Edwards | 7cbaaba | 2020-08-05 12:19:18 -0400 | [diff] [blame] | 17 | |
| 18 | # Require this argument |
| 19 | AC_MSG_NOTICE([Checking whether source path is specified for 'pdk']) |
Tim Edwards | 5ef0397 | 2020-08-08 12:23:27 -0400 | [diff] [blame] | 20 | if test "x$[]pdkvar[]_SOURCE_PATH_" == "x" ; then |
Tim Edwards | 7cbaaba | 2020-08-05 12:19:18 -0400 | [diff] [blame] | 21 | AC_MSG_ERROR([Option --with-pdk-source=<path> not specified!]) |
| 22 | fi |
| 23 | |
Tim Edwards | 5ef0397 | 2020-08-08 12:23:27 -0400 | [diff] [blame] | 24 | pdkvar[]_SOURCE_PATH=`readlink -f $[]pdkvar[]_SOURCE_PATH_` |
Tim Edwards | 7cbaaba | 2020-08-05 12:19:18 -0400 | [diff] [blame] | 25 | |
| 26 | # basic check that the PDK exists there (the path must exist in any case) |
| 27 | AC_MSG_NOTICE([Checking specified path for 'pdk' at $[]pdkvar[]_SOURCE_PATH]) |
| 28 | AC_CHECK_FILE($[]pdkvar[]_SOURCE_PATH, |
| 29 | [ |
| 30 | AC_MSG_NOTICE(['pdk' source path found at $[]pdkvar[]_SOURCE_PATH]) |
| 31 | ], |
| 32 | [ |
| 33 | AC_MSG_ERROR([Specified path for 'pdk' at $[]pdkvar[]_SOURCE_PATH not found]) |
| 34 | ]) |
| 35 | AC_SUBST([]pdkvar[]_SOURCE_PATH) |
| 36 | ]) |
| 37 | |
| 38 | |
| 39 | # --with-pdk-local-path=PDK_LOCAL_PATH |
| 40 | m4_foreach_w(pdk, $1, [ |
| 41 | m4_define([pdkvar], [m4_normalize(m4_esyscmd(echo pdk | tr "a-z" "A-Z"))]) |
| 42 | pdkvar[]_LOCAL_PATH="" |
| 43 | AC_ARG_WITH(pdk-local-path, |
| 44 | [AS_HELP_STRING([--with-pdk-local-path=/path/to/install/pdks], "run-time location of the PDKs")], |
| 45 | [pdkvar[]_LOCAL_PATH=$withval] |
| 46 | ) |
| 47 | # Require this argument |
| 48 | AC_MSG_NOTICE([Checking whether local path is specified for 'pdk']) |
| 49 | if test "x$[]pdkvar[]_LOCAL_PATH" == "x" ; then |
| 50 | AC_MSG_ERROR([Option --with-pdk-local-path=<path> not specified!]) |
| 51 | fi |
| 52 | pdkvar[]_LOCAL_PATH=$(readlink -f $[]pdkvar[]_LOCAL_PATH) |
| 53 | AC_SUBST([]pdkvar[]_LOCAL_PATH) |
| 54 | ]) |
| 55 | |
| 56 | # --with-pdk-dist-path=PDK_DIST_PATH |
| 57 | m4_foreach_w(pdk, $1, [ |
| 58 | m4_define([pdkvar], [m4_normalize(m4_esyscmd(echo pdk | tr "a-z" "A-Z"))]) |
| 59 | pdkvar[]_DIST_PATH="" |
| 60 | AC_ARG_WITH(pdk-dist-path, |
| 61 | [AS_HELP_STRING([--with-pdk-dist-path=/path/to/install/pdks], "staging location to install the PDKs for distribution (optional)")], |
| 62 | [[]pdkvar[]_DIST_PATH=$withval] |
| 63 | ) |
| 64 | # Require this argument |
| 65 | AC_MSG_NOTICE([Checking whether distribution path is specified for 'pdk']) |
| 66 | if test "x$[]pdkvar[]_DIST_PATH" == "x" ; then |
| 67 | AC_MSG_NOTICE([Option --with-pdk-dist-path=<path> not specified. Local install only."]) |
| 68 | fi |
| 69 | pdkvar[]_DIST_PATH=$(readlink -f $[]pdkvar[]_DIST_PATH) |
| 70 | AC_SUBST([]pdkvar[]_DIST_PATH) |
| 71 | ]) |
| 72 | |
| 73 | # --with-pdk-link-targets=PDK_LINK_TARGETS |
| 74 | m4_foreach_w(pdk, $1, [ |
| 75 | m4_define([pdkvar], [m4_normalize(m4_esyscmd(echo pdk | tr "a-z" "A-Z"))]) |
| 76 | # Default link_targets = "none" |
| 77 | pdkvar[]_LINK_TARGETS="none" |
| 78 | |
| 79 | AC_ARG_WITH(pdk-link-targets, |
| 80 | [AS_HELP_STRING([--with-pdk-link-targets=none|source], "make symbolic links to existing files @<:@default=none@:>@")], |
| 81 | [[]pdkvar[]_LINK_TARGETS=$with_[]pdk[]_link_targets] |
| 82 | ) |
| 83 | AC_SUBST([]pdkvar[]_LINK_TARGETS) |
| 84 | AC_MSG_NOTICE([Link targets set to $[]pdkvar[]_LINK_TARGETS]) |
Ahmed Ghazy | 6dc7ebf | 2020-07-29 16:52:14 +0200 | [diff] [blame] | 85 | ]) |
| 86 | ]) |
| 87 | |
| 88 | AC_MSG_NOTICE([Found technology directories: M4_GET_TECHS()]) |
| 89 | |
Tim Edwards | 7cbaaba | 2020-08-05 12:19:18 -0400 | [diff] [blame] | 90 | M4_GEN_WITH_PDK_ARGS(M4_GET_TECHS()) |
Ahmed Ghazy | 6dc7ebf | 2020-07-29 16:52:14 +0200 | [diff] [blame] | 91 | |
| 92 | # Checking if (some) prerequisites are satisfied |
| 93 | AM_PATH_PYTHON([3.4]) |
Tim Edwards | 7cbaaba | 2020-08-05 12:19:18 -0400 | [diff] [blame] | 94 | AX_PYTHON_MODULE([distutils],[]) |
Ahmed Ghazy | 6dc7ebf | 2020-07-29 16:52:14 +0200 | [diff] [blame] | 95 | |
| 96 | AC_PATH_PROG(MAGIC, magic) |
| 97 | if test -z "$MAGIC"; then |
| 98 | AC_MSG_ERROR([You need 'magic' to generate the needed various cell views]) |
| 99 | fi |
| 100 | |
Tim Edwards | 7cbaaba | 2020-08-05 12:19:18 -0400 | [diff] [blame] | 101 | # Check for "--with-ef-style" |
| 102 | EF_STYLE=0 |
| 103 | AC_ARG_WITH([ef-style], |
| 104 | [AS_HELP_STRING([--with-ef-style], |
| 105 | [Use efabless style file system structure @<:@default=no@:>@])], |
| 106 | [ |
| 107 | pdks_ef_style=$withval |
| 108 | if test "$withval" == "yes" -o "$withval" == "YES"; then |
| 109 | EF_STYLE=1 |
| 110 | fi |
| 111 | ], ) |
Ahmed Ghazy | 6dc7ebf | 2020-07-29 16:52:14 +0200 | [diff] [blame] | 112 | |
Tim Edwards | 7cbaaba | 2020-08-05 12:19:18 -0400 | [diff] [blame] | 113 | AC_SUBST(EF_STYLE) |
Ahmed Ghazy | 6dc7ebf | 2020-07-29 16:52:14 +0200 | [diff] [blame] | 114 | |
| 115 | MAKEFILES=$(find .. -name "Makefile.in" | sed 's/\(.*\)\.in/\1/g') |
| 116 | AC_CONFIG_FILES($MAKEFILES) |
| 117 | |
| 118 | AC_OUTPUT |
| 119 | |
| 120 | AC_MSG_RESULT(Build configured successfully) |