blob: a5962029ba34c701e617b5393244b5dbeebef6bc [file] [log] [blame]
Ahmed Ghazy6dc7ebf2020-07-29 16:52:14 +02001AC_INIT([open_pdks], [1.0], [github.com/RTimothyEdwards/open_pdks])
2
3# detect PDKs based on directories that include Makefile.in files
4m4_define([M4_GET_TECHS], [m4_normalize(m4_esyscmd(cd .. && find * -mindepth 1 -name "Makefile.in" -exec dirname {} \; | tr "\n" " "))])
5
Tim Edwards7cbaaba2020-08-05 12:19:18 -04006# check for the source and install paths for each PDK.
7AC_DEFUN([M4_GEN_WITH_PDK_ARGS],
Ahmed Ghazy6dc7ebf2020-07-29 16:52:14 +02008[
9 # --with-pdk-source=PDK_SOURCE_PATH
10 m4_foreach_w(pdk, $1, [
Tim Edwards7cbaaba2020-08-05 12:19:18 -040011 m4_define([pdkvar], [m4_normalize(m4_esyscmd(echo pdk | tr "a-z" "A-Z"))])
Tim Edwards5ef03972020-08-08 12:23:27 -040012 pdkvar[]_SOURCE_PATH_=""
Ahmed Ghazy6dc7ebf2020-07-29 16:52:14 +020013 AC_ARG_WITH(pdk-source,
14 [AS_HELP_STRING([--with-pdk-source=/path/to/pdk/source], "location of the source files for pdk")],
Tim Edwards5ef03972020-08-08 12:23:27 -040015 [pdkvar[]_SOURCE_PATH_=$withval]
Ahmed Ghazy6dc7ebf2020-07-29 16:52:14 +020016 )
Tim Edwards7cbaaba2020-08-05 12:19:18 -040017
18 # Require this argument
19 AC_MSG_NOTICE([Checking whether source path is specified for 'pdk'])
Tim Edwards5ef03972020-08-08 12:23:27 -040020 if test "x$[]pdkvar[]_SOURCE_PATH_" == "x" ; then
Tim Edwards7cbaaba2020-08-05 12:19:18 -040021 AC_MSG_ERROR([Option --with-pdk-source=<path> not specified!])
22 fi
23
Tim Edwards5ef03972020-08-08 12:23:27 -040024 pdkvar[]_SOURCE_PATH=`readlink -f $[]pdkvar[]_SOURCE_PATH_`
Tim Edwards7cbaaba2020-08-05 12:19:18 -040025
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 Ghazy6dc7ebf2020-07-29 16:52:14 +020085 ])
86])
87
88AC_MSG_NOTICE([Found technology directories: M4_GET_TECHS()])
89
Tim Edwards7cbaaba2020-08-05 12:19:18 -040090M4_GEN_WITH_PDK_ARGS(M4_GET_TECHS())
Ahmed Ghazy6dc7ebf2020-07-29 16:52:14 +020091
92# Checking if (some) prerequisites are satisfied
93AM_PATH_PYTHON([3.4])
Tim Edwards7cbaaba2020-08-05 12:19:18 -040094AX_PYTHON_MODULE([distutils],[])
Ahmed Ghazy6dc7ebf2020-07-29 16:52:14 +020095
96AC_PATH_PROG(MAGIC, magic)
97if test -z "$MAGIC"; then
98 AC_MSG_ERROR([You need 'magic' to generate the needed various cell views])
99fi
100
Tim Edwards7cbaaba2020-08-05 12:19:18 -0400101# Check for "--with-ef-style"
102EF_STYLE=0
103AC_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 Ghazy6dc7ebf2020-07-29 16:52:14 +0200112
Tim Edwards7cbaaba2020-08-05 12:19:18 -0400113AC_SUBST(EF_STYLE)
Ahmed Ghazy6dc7ebf2020-07-29 16:52:14 +0200114
115MAKEFILES=$(find .. -name "Makefile.in" | sed 's/\(.*\)\.in/\1/g')
116AC_CONFIG_FILES($MAKEFILES)
117
118AC_OUTPUT
119
120AC_MSG_RESULT(Build configured successfully)