1 | # -*- Autoconf -*- |
---|
2 | # Process this file with autoconf to produce a configure script. |
---|
3 | |
---|
4 | AC_PREREQ([2.68]) |
---|
5 | AC_INIT([cfa-cc],[1.0.0.0],[cforall@plg.uwaterloo.ca]) |
---|
6 | AC_CONFIG_AUX_DIR([automake]) |
---|
7 | #AC_CONFIG_SRCDIR([src/main.cc]) |
---|
8 | AC_CONFIG_HEADERS([config.h:src/config.h.in]) |
---|
9 | AM_SILENT_RULES([no]) |
---|
10 | |
---|
11 | AM_INIT_AUTOMAKE([subdir-objects]) |
---|
12 | |
---|
13 | # Allow program name tansformation |
---|
14 | # will fill program_transform_name with appropriate sed regex |
---|
15 | AC_ARG_PROGRAM |
---|
16 | |
---|
17 | #============================================================================== |
---|
18 | #Trasforming cc1 will break compilation |
---|
19 | if test "${program_transform_name}" = ""; then |
---|
20 | AC_MSG_ERROR([Program transform not supported. |
---|
21 | Use --with-cfa-name='[[Desired name here]]' instead]) |
---|
22 | fi |
---|
23 | |
---|
24 | #Define the new name of the installed command |
---|
25 | AC_ARG_WITH(cfa-name, |
---|
26 | [ --with-cfa-name=NAME NAME too which cfa will be installed], |
---|
27 | cfa_name=$withval, cfa_name="cfa") |
---|
28 | |
---|
29 | AC_SUBST(CFA_NAME, ${cfa_name}) |
---|
30 | |
---|
31 | #============================================================================== |
---|
32 | # handle the list of hosts to build for |
---|
33 | for var in $ac_configure_args |
---|
34 | do |
---|
35 | #strip quotes surrouding values |
---|
36 | var=$(echo $var | sed s/\'//g) |
---|
37 | case $var in |
---|
38 | # skip cross compilation related arguments |
---|
39 | --host=*) ;; host_alias=*) ;; --build=*) ;; build_alias=*) ;; --target=*) ;; target_alias=*) ;; |
---|
40 | |
---|
41 | # append all other arguments to the sub configure arguments |
---|
42 | *) LIBCFA_GENERAL_ARGS="${LIBCFA_GENERAL_ARGS} $var";; |
---|
43 | esac |
---|
44 | done |
---|
45 | |
---|
46 | echo $LIBCFA_GENERAL_ARGS |
---|
47 | |
---|
48 | #============================================================================== |
---|
49 | # handle the list of hosts to build for |
---|
50 | AC_CANONICAL_BUILD |
---|
51 | AC_CANONICAL_HOST |
---|
52 | |
---|
53 | default_target="${host_cpu}:debug, ${host_cpu}:nodebug" |
---|
54 | AC_ARG_WITH(target-hosts, |
---|
55 | [ --with-target-hosts=HOSTS HOSTS comma seperated list of hosts to build for, format ARCH:[debug|nodebug|nolib]], |
---|
56 | target_hosts=$withval, target_hosts=${default_target}) |
---|
57 | |
---|
58 | AC_SUBST(TARGET_HOSTS, ${target_hosts}) |
---|
59 | |
---|
60 | for i in $(echo $target_hosts | sed "s/,/ /g") |
---|
61 | do |
---|
62 | # call your procedure/other scripts here below |
---|
63 | lib_arch=$(echo $i | sed -r "s/:(.*)//g") |
---|
64 | lib_config=$(echo $i | sed -r "s/(.*)://g") |
---|
65 | lib_dir="libcfa-${lib_arch}-${lib_config}" |
---|
66 | |
---|
67 | LIBCFA_TARGET_DIRS="${LIBCFA_TARGET_DIRS} ${lib_dir}" |
---|
68 | LIBCFA_TARGET_MAKEFILES="${LIBCFA_TARGET_MAKEFILES} ${lib_dir}/Makefile" |
---|
69 | |
---|
70 | mkdir -p libcfa-${lib_arch}-${lib_config} |
---|
71 | echo -n "${LIBCFA_GENERAL_ARGS} " > libcfa-${lib_arch}-${lib_config}/config.data |
---|
72 | echo -n "--host=${lib_arch} " >> libcfa-${lib_arch}-${lib_config}/config.data |
---|
73 | echo -n "CONFIGURATION=${lib_config}" >> libcfa-${lib_arch}-${lib_config}/config.data |
---|
74 | done |
---|
75 | |
---|
76 | AC_SUBST(LIBCFA_TARGET_DIRS) |
---|
77 | AC_SUBST(LIBCFA_TARGET_MAKEFILES) |
---|
78 | |
---|
79 | |
---|
80 | #============================================================================== |
---|
81 | # version information |
---|
82 | |
---|
83 | rm -f version |
---|
84 | echo ${PACKAGE_VERSION} > version # file containing version number for other tools |
---|
85 | chmod ugo-w version |
---|
86 | ver_major=`cut -d '.' -f1 version` # subdivide version number into components at periods |
---|
87 | ver_minor=`cut -d '.' -f2 version` |
---|
88 | ver_patch=`cut -d '.' -f3 version` |
---|
89 | ver_build=`cut -d '.' -f4 version` |
---|
90 | |
---|
91 | # AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/version']) |
---|
92 | AC_DEFINE_UNQUOTED(CFA_VERSION_MAJOR, ${ver_major}, [Major version number.]) |
---|
93 | AC_DEFINE_UNQUOTED(CFA_VERSION_MINOR, ${ver_minor}, [Minor version number.]) |
---|
94 | AC_DEFINE_UNQUOTED(CFA_VERSION_PATCH, ${ver_patch}, [Patch version number.]) |
---|
95 | AC_DEFINE_UNQUOTED(CFA_VERSION_BUILD, ${ver_build}, [Build version number.]) |
---|
96 | AC_DEFINE_UNQUOTED(CFA_VERSION_SHORT, ["${ver_major}"], [Major]) |
---|
97 | AC_DEFINE_UNQUOTED(CFA_VERSION, ["${ver_major}.${ver_minor}"], [Major.Minor]) |
---|
98 | AC_DEFINE_UNQUOTED(CFA_VERSION_LONG, ["${ver_major}.${ver_minor}.${ver_patch}"], [Major.Minor.Patch]) |
---|
99 | AC_DEFINE_UNQUOTED(CFA_VERSION_FULL, ["${ver_major}.${ver_minor}.${ver_patch}.${ver_build}"], [Major.Minor.Patch.Build]) |
---|
100 | |
---|
101 | #============================================================================== |
---|
102 | # HACK to be able to use conditionnals inside makefiles |
---|
103 | DOifskipcompile='ifeq ($(skipcompile),yes) |
---|
104 | else' |
---|
105 | AC_SUBST([DOifskipcompile]) |
---|
106 | AM_SUBST_NOTMAKE([DOifskipcompile]) |
---|
107 | |
---|
108 | DOendif='endif' |
---|
109 | AC_SUBST([DOendif]) |
---|
110 | AM_SUBST_NOTMAKE([DOendif]) |
---|
111 | |
---|
112 | #============================================================================== |
---|
113 | # backend compiler implementation |
---|
114 | AC_ARG_WITH(backend-compiler, |
---|
115 | [ --with-backend-compiler=PROGRAM PROGRAM that performs the final code compilation (must be gcc-compatible) ], |
---|
116 | backendcompiler=$withval, backendcompiler="") |
---|
117 | if test "x$backendcompiler" != "x"; then |
---|
118 | BACKEND_CC=${backendcompiler} |
---|
119 | else |
---|
120 | AC_PATH_PROG(BACKEND_CC, gcc, []) # check gcc installed |
---|
121 | if test "x$BACKEND_CC" = "x"; then |
---|
122 | AC_MSG_ERROR(some version of gcc is needed. Get it at ftp://ftp.gnu.org) |
---|
123 | exit 1 |
---|
124 | fi |
---|
125 | fi |
---|
126 | AC_DEFINE_UNQUOTED(CFA_BACKEND_CC, "${BACKEND_CC}", [Location of include files.]) |
---|
127 | AC_SUBST(CFA_BACKEND_CC) |
---|
128 | |
---|
129 | #============================================================================== |
---|
130 | # Installation paths |
---|
131 | if test "x$prefix" = "xNONE"; then |
---|
132 | cfa_prefix=${ac_default_prefix} |
---|
133 | else |
---|
134 | cfa_prefix=${prefix} |
---|
135 | fi |
---|
136 | AC_DEFINE_UNQUOTED(CFA_PREFIX, "${cfa_prefix}", [Location of cfa install.]) |
---|
137 | AC_SUBST(CFA_PREFIX, ${cfa_prefix}) |
---|
138 | |
---|
139 | if test "$includedir" = '${prefix}/include'; then |
---|
140 | cfa_incdir="${cfa_prefix}/include/${cfa_name}" |
---|
141 | else |
---|
142 | cfa_incdir=${includedir} |
---|
143 | fi |
---|
144 | AC_DEFINE_UNQUOTED(CFA_INCDIR, "${cfa_incdir}", [Location of include files.]) |
---|
145 | AC_SUBST(CFA_INCDIR, ${cfa_incdir}) |
---|
146 | |
---|
147 | if test "$bindir" = '${exec_prefix}/bin'; then |
---|
148 | cfa_bindir="${cfa_prefix}/bin" |
---|
149 | else |
---|
150 | cfa_bindir=${bindir} |
---|
151 | fi |
---|
152 | AC_DEFINE_UNQUOTED(CFA_BINDIR, "${cfa_bindir}", [Location of cfa command.]) |
---|
153 | AC_SUBST(CFA_BINDIR, ${cfa_bindir}) |
---|
154 | |
---|
155 | if test "$libdir" = '${exec_prefix}/lib'; then |
---|
156 | cfa_libdir="${cfa_prefix}/lib/${cfa_name}" |
---|
157 | else |
---|
158 | cfa_libdir=${libdir} |
---|
159 | fi |
---|
160 | AC_DEFINE_UNQUOTED(CFA_LIBDIR, "${cfa_libdir}", [Location of cc1 and cfa-cpp commands.]) |
---|
161 | AC_SUBST(CFA_LIBDIR, ${cfa_libdir}) |
---|
162 | |
---|
163 | #============================================================================== |
---|
164 | # Create variables for commonly used targets |
---|
165 | DRIVER_DIR='$(top_builddir)/driver' |
---|
166 | CFACC=${DRIVER_DIR}/cfa |
---|
167 | CFACPP=${DRIVER_DIR}/cfa-cpp |
---|
168 | AC_SUBST(DRIVER_DIR) |
---|
169 | AC_SUBST(CFACC) |
---|
170 | AC_SUBST(CFACPP) |
---|
171 | AC_DEFINE_UNQUOTED(TOP_SRCDIR, "$ac_pwd/$ac_confdir/", [Top src directory]) |
---|
172 | AC_DEFINE_UNQUOTED(TOP_BUILDDIR, "$ac_pwd/", [Top build directory]) |
---|
173 | AC_DEFINE_UNQUOTED(PRELUDE_BUILDDIR, "$ac_pwd/libcfa/prelude/", [Directory where the prelude files are built]) |
---|
174 | |
---|
175 | #============================================================================== |
---|
176 | # Flag variables needed to build in tree |
---|
177 | LIBCFA_SRC='$(top_srcdir)/libcfa/src' |
---|
178 | LIBCFA_BUILD='$(top_builddir)/libcfa/src' |
---|
179 | BUILD_IN_TREE_FLAGS_NOLIB="-XCFA -t -B${DRIVER_DIR}" |
---|
180 | BUILD_IN_TREE_FLAGS="${BUILD_IN_TREE_FLAGS_NOLIB} -L${LIBCFA_BUILD} -I${LIBCFA_SRC} -I${LIBCFA_SRC}/containers -I${LIBCFA_SRC}/concurrency -I${LIBCFA_SRC}/stdhdr" |
---|
181 | AC_SUBST(BUILD_IN_TREE_FLAGS_NOLIB) |
---|
182 | AC_SUBST(BUILD_IN_TREE_FLAGS) |
---|
183 | |
---|
184 | #============================================================================== |
---|
185 | # CAFLAGS |
---|
186 | AC_DEFINE_UNQUOTED(CFA_FLAGS, "${CFAFLAGS}", [compilation flags for cfa libraries and test programs.]) |
---|
187 | AC_SUBST(CFA_FLAGS, ${CFAFLAGS}) |
---|
188 | |
---|
189 | #============================================================================== |
---|
190 | # Checks for programs. |
---|
191 | AC_PROG_CXX |
---|
192 | AC_PROG_CC |
---|
193 | AM_PROG_AS |
---|
194 | AM_PROG_CC_C_O # deprecated |
---|
195 | # These are often not installed and people miss seeing the "no", so stop the configure. |
---|
196 | AC_PROG_YACC |
---|
197 | if test "${YACC}" = "yacc" ; then echo "Error: bison required." ; exit 1 ; fi |
---|
198 | AC_PROG_LEX |
---|
199 | if test "${LEX}" = "lex" ; then echo "Error: flex required." ; exit 1 ; fi |
---|
200 | AC_PROG_INSTALL |
---|
201 | AC_PROG_MAKE_SET |
---|
202 | AC_PROG_RANLIB |
---|
203 | |
---|
204 | # Checks for libraries. |
---|
205 | |
---|
206 | # Checks for header files. |
---|
207 | AC_FUNC_ALLOCA |
---|
208 | AC_CHECK_HEADERS([fenv.h float.h inttypes.h libintl.h limits.h malloc.h stddef.h stdlib.h string.h unistd.h]) |
---|
209 | |
---|
210 | # Checks for typedefs, structures, and compiler characteristics. |
---|
211 | AC_HEADER_STDBOOL |
---|
212 | AC_C_INLINE |
---|
213 | AC_TYPE_INT16_T |
---|
214 | AC_TYPE_INT32_T |
---|
215 | AC_TYPE_INT8_T |
---|
216 | AC_C_RESTRICT |
---|
217 | AC_TYPE_SIZE_T |
---|
218 | AC_TYPE_UINT16_T |
---|
219 | AC_TYPE_UINT32_T |
---|
220 | AC_TYPE_UINT8_T |
---|
221 | |
---|
222 | # Checks for library functions. |
---|
223 | AC_CHECK_FUNCS([memset putenv strchr strtol]) |
---|
224 | |
---|
225 | #============================================================================== |
---|
226 | AC_CONFIG_FILES([ |
---|
227 | Makefile |
---|
228 | driver/Makefile |
---|
229 | src/Makefile |
---|
230 | benchmark/Makefile |
---|
231 | tests/Makefile |
---|
232 | tests/preempt_longrun/Makefile |
---|
233 | tools/Makefile |
---|
234 | tools/prettyprinter/Makefile |
---|
235 | ]) |
---|
236 | |
---|
237 | AC_CONFIG_LINKS([tests/test.py:tests/test.py]) |
---|
238 | |
---|
239 | AC_OUTPUT(tests/config.py) |
---|
240 | |
---|
241 | # Final text |
---|
242 | AC_MSG_RESULT(Cforall configuraton completed. Type "make -j 8 install".) |
---|