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]) |
---|
9 | AM_SILENT_RULES([no]) |
---|
10 | |
---|
11 | AM_INIT_AUTOMAKE([subdir-objects]) |
---|
12 | AM_MAINTAINER_MODE(enable) # may require auto* software to be installed |
---|
13 | |
---|
14 | # Allow program name tansformation |
---|
15 | # will fill program_transform_name with appropriate sed regex |
---|
16 | AC_ARG_PROGRAM |
---|
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 | AC_ARG_WITH(cfa-name, |
---|
25 | [ --with-cfa-name=NAME NAME too which cfa will be installed], |
---|
26 | cfa_name=$withval, cfa_name="cfa") |
---|
27 | |
---|
28 | #Define the new name of the installed command |
---|
29 | AC_SUBST(CFA_NAME, ${cfa_name}) |
---|
30 | |
---|
31 | rm -f version |
---|
32 | echo ${PACKAGE_VERSION} > version # file containing version number for other tools |
---|
33 | chmod ugo-w version |
---|
34 | ver_major=`cut -d '.' -f1 version` # subdivide version number into components at periods |
---|
35 | ver_minor=`cut -d '.' -f2 version` |
---|
36 | ver_patch=`cut -d '.' -f3 version` |
---|
37 | ver_build=`cut -d '.' -f4 version` |
---|
38 | |
---|
39 | # AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/version']) |
---|
40 | AC_DEFINE_UNQUOTED(CFA_VERSION_MAJOR, ${ver_major}, [Major version number.]) |
---|
41 | AC_DEFINE_UNQUOTED(CFA_VERSION_MINOR, ${ver_minor}, [Minor version number.]) |
---|
42 | AC_DEFINE_UNQUOTED(CFA_VERSION_PATCH, ${ver_patch}, [Patch version number.]) |
---|
43 | AC_DEFINE_UNQUOTED(CFA_VERSION_BUILD, ${ver_build}, [Build version number.]) |
---|
44 | AC_DEFINE_UNQUOTED(CFA_VERSION_SHORT, ["${ver_major}"], [Major]) |
---|
45 | AC_DEFINE_UNQUOTED(CFA_VERSION, ["${ver_major}.${ver_minor}"], [Major.Minor]) |
---|
46 | AC_DEFINE_UNQUOTED(CFA_VERSION_LONG, ["${ver_major}.${ver_minor}.${ver_patch}"], [Major.Minor.Patch]) |
---|
47 | AC_DEFINE_UNQUOTED(CFA_VERSION_FULL, ["${ver_major}.${ver_minor}.${ver_patch}.${ver_build}"], [Major.Minor.Patch.Build]) |
---|
48 | |
---|
49 | # Installation paths |
---|
50 | |
---|
51 | AC_ARG_WITH(backend-compiler, |
---|
52 | [ --with-backend-compiler=PROGRAM PROGRAM that performs the final code compilation (must be gcc-compatible) ], |
---|
53 | backendcompiler=$withval, backendcompiler="") |
---|
54 | if test "x$backendcompiler" != "x"; then |
---|
55 | BACKEND_CC=${backendcompiler} |
---|
56 | else |
---|
57 | AC_PATH_PROG(BACKEND_CC, gcc, []) # check gcc installed |
---|
58 | if test "x$BACKEND_CC" = "x"; then |
---|
59 | AC_MSG_ERROR(some version of gcc is needed. Get it at ftp://ftp.gnu.org) |
---|
60 | exit 1 |
---|
61 | fi |
---|
62 | fi |
---|
63 | AC_DEFINE_UNQUOTED(CFA_BACKEND_CC, "${BACKEND_CC}", [Location of include files.]) |
---|
64 | AC_SUBST(CFA_BACKEND_CC) |
---|
65 | |
---|
66 | |
---|
67 | |
---|
68 | AC_ARG_ENABLE(target-release, AS_HELP_STRING([--enable-target-release], [Build and install the release target])) |
---|
69 | AC_ARG_ENABLE(target-debug, AS_HELP_STRING([--enable-target-debug], [Build and install the debug target])) |
---|
70 | AC_ARG_ENABLE(threading, AS_HELP_STRING([--enable-threading], [Build and install libcfa with threading support (Enabled by default)]), |
---|
71 | [case "${enableval}" in |
---|
72 | yes) build_threading="yes" ;; |
---|
73 | no) build_threading="no" ;; |
---|
74 | *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;; |
---|
75 | esac],[build_threading="yes"]) |
---|
76 | |
---|
77 | case "$enable_target_release" in |
---|
78 | yes) |
---|
79 | case "$enable_target_debug" in |
---|
80 | yes) |
---|
81 | build_release="yes" |
---|
82 | build_debug="yes" |
---|
83 | ;; |
---|
84 | no) |
---|
85 | build_release="yes" |
---|
86 | build_debug="no" |
---|
87 | ;; |
---|
88 | *) |
---|
89 | build_release="yes" |
---|
90 | build_debug="no" |
---|
91 | ;; |
---|
92 | esac |
---|
93 | ;; |
---|
94 | no) |
---|
95 | case "$enable_target_debug" in |
---|
96 | yes) |
---|
97 | build_release="no" |
---|
98 | build_debug="yes" |
---|
99 | ;; |
---|
100 | no) |
---|
101 | build_release="no" |
---|
102 | build_debug="no" |
---|
103 | ;; |
---|
104 | *) |
---|
105 | build_release="no" |
---|
106 | build_debug="yes" |
---|
107 | ;; |
---|
108 | esac |
---|
109 | ;; |
---|
110 | *) |
---|
111 | case "$enable_target_debug" in |
---|
112 | yes) |
---|
113 | build_release="no" |
---|
114 | build_debug="yes" |
---|
115 | ;; |
---|
116 | no) |
---|
117 | build_release="yes" |
---|
118 | build_debug="no" |
---|
119 | ;; |
---|
120 | *) |
---|
121 | build_release="yes" |
---|
122 | build_debug="yes" |
---|
123 | ;; |
---|
124 | esac |
---|
125 | ;; |
---|
126 | esac |
---|
127 | |
---|
128 | AM_CONDITIONAL([BUILD_RELEASE], [test "x$build_release" = "xyes"]) |
---|
129 | AM_CONDITIONAL([BUILD_DEBUG], [test "x$build_debug" = "xyes"]) |
---|
130 | AM_CONDITIONAL([BUILD_NO_LIB], [test "x$build_release$build_debug" = "xnono"]) |
---|
131 | AM_CONDITIONAL([BUILD_CONCURRENCY], [test "x$build_threading" = "xyes"]) |
---|
132 | |
---|
133 | DOifskipcompile='ifeq ($(skipcompile),yes) |
---|
134 | else' |
---|
135 | AC_SUBST([DOifskipcompile]) |
---|
136 | AM_SUBST_NOTMAKE([DOifskipcompile]) |
---|
137 | |
---|
138 | DOendif='endif' |
---|
139 | AC_SUBST([DOendif]) |
---|
140 | AM_SUBST_NOTMAKE([DOendif]) |
---|
141 | |
---|
142 | if test "x$prefix" = "xNONE"; then |
---|
143 | cfa_prefix=${ac_default_prefix} |
---|
144 | else |
---|
145 | cfa_prefix=${prefix} |
---|
146 | fi |
---|
147 | AC_DEFINE_UNQUOTED(CFA_PREFIX, "${cfa_prefix}", [Location of cfa install.]) |
---|
148 | AC_SUBST(CFA_PREFIX, ${cfa_prefix}) |
---|
149 | |
---|
150 | if test "$includedir" = '${prefix}/include'; then |
---|
151 | cfa_incdir="${cfa_prefix}/include/${cfa_name}" |
---|
152 | else |
---|
153 | cfa_incdir=${includedir} |
---|
154 | fi |
---|
155 | AC_DEFINE_UNQUOTED(CFA_INCDIR, "${cfa_incdir}", [Location of include files.]) |
---|
156 | AC_SUBST(CFA_INCDIR, ${cfa_incdir}) |
---|
157 | |
---|
158 | if test "$bindir" = '${exec_prefix}/bin'; then |
---|
159 | cfa_bindir="${cfa_prefix}/bin" |
---|
160 | else |
---|
161 | cfa_bindir=${bindir} |
---|
162 | fi |
---|
163 | AC_DEFINE_UNQUOTED(CFA_BINDIR, "${cfa_bindir}", [Location of cfa command.]) |
---|
164 | AC_SUBST(CFA_BINDIR, ${cfa_bindir}) |
---|
165 | |
---|
166 | if test "$libdir" = '${exec_prefix}/lib'; then |
---|
167 | cfa_libdir="${cfa_prefix}/lib/${cfa_name}" |
---|
168 | else |
---|
169 | cfa_libdir=${libdir} |
---|
170 | fi |
---|
171 | AC_DEFINE_UNQUOTED(CFA_LIBDIR, "${cfa_libdir}", [Location of cc1 and cfa-cpp commands.]) |
---|
172 | AC_SUBST(CFA_LIBDIR, ${cfa_libdir}) |
---|
173 | |
---|
174 | AC_CANONICAL_BUILD |
---|
175 | AC_CANONICAL_HOST |
---|
176 | AC_SUBST([MACHINE_TYPE],[$host_cpu]) |
---|
177 | |
---|
178 | if ! test "$host_cpu" = "$build_cpu"; then |
---|
179 | case $host_cpu in |
---|
180 | i386) |
---|
181 | CFLAGS+=" -m32 " |
---|
182 | CXXFLAGS+=" -m32 " |
---|
183 | CFAFLAGS+=" -m32 " |
---|
184 | LDFLAGS+=" -m32 " |
---|
185 | ;; |
---|
186 | i686) |
---|
187 | CFLAGS+=" -m32 " |
---|
188 | CXXFLAGS+=" -m32 " |
---|
189 | CFAFLAGS+=" -m32 " |
---|
190 | LDFLAGS+=" -m32 " |
---|
191 | ;; |
---|
192 | x86_64) |
---|
193 | CFLAGS+=" -m64 " |
---|
194 | CXXFLAGS+=" -m64 " |
---|
195 | CFAFLAGS+=" -m64 " |
---|
196 | LDFLAGS+=" -m64 " |
---|
197 | ;; |
---|
198 | esac |
---|
199 | fi |
---|
200 | |
---|
201 | AC_DEFINE_UNQUOTED(CFA_FLAGS, "${CFAFLAGS}", [compilation flags for cfa libraries and test programs.]) |
---|
202 | AC_SUBST(CFA_FLAGS, ${CFAFLAGS}) |
---|
203 | |
---|
204 | # Checks for programs. |
---|
205 | AC_PROG_CXX |
---|
206 | AC_PROG_CC |
---|
207 | AM_PROG_AS |
---|
208 | AM_PROG_CC_C_O # deprecated |
---|
209 | # These are often not installed and people miss seeing the "no", so stop the configure. |
---|
210 | AC_PROG_YACC |
---|
211 | if test "${YACC}" = "yacc" ; then echo "Error: bison required." ; exit 1 ; fi |
---|
212 | AC_PROG_LEX |
---|
213 | if test "${LEX}" = "lex" ; then echo "Error: flex required." ; exit 1 ; fi |
---|
214 | AC_PROG_INSTALL |
---|
215 | AC_PROG_MAKE_SET |
---|
216 | AC_PROG_RANLIB |
---|
217 | |
---|
218 | # Checks for libraries. |
---|
219 | |
---|
220 | # Checks for header files. |
---|
221 | AC_FUNC_ALLOCA |
---|
222 | AC_CHECK_HEADERS([fenv.h float.h inttypes.h libintl.h limits.h malloc.h stddef.h stdlib.h string.h unistd.h]) |
---|
223 | |
---|
224 | # Checks for typedefs, structures, and compiler characteristics. |
---|
225 | AC_HEADER_STDBOOL |
---|
226 | AC_C_INLINE |
---|
227 | AC_TYPE_INT16_T |
---|
228 | AC_TYPE_INT32_T |
---|
229 | AC_TYPE_INT8_T |
---|
230 | AC_C_RESTRICT |
---|
231 | AC_TYPE_SIZE_T |
---|
232 | AC_TYPE_UINT16_T |
---|
233 | AC_TYPE_UINT32_T |
---|
234 | AC_TYPE_UINT8_T |
---|
235 | |
---|
236 | # Checks for library functions. |
---|
237 | AC_CHECK_FUNCS([memset putenv strchr strtol]) |
---|
238 | |
---|
239 | AC_CONFIG_FILES([ |
---|
240 | Makefile |
---|
241 | src/driver/Makefile |
---|
242 | src/Makefile |
---|
243 | src/benchmark/Makefile |
---|
244 | src/examples/Makefile |
---|
245 | src/tests/Makefile |
---|
246 | src/tests/preempt_longrun/Makefile |
---|
247 | src/prelude/Makefile |
---|
248 | src/libcfa/Makefile |
---|
249 | tools/Makefile |
---|
250 | tools/prettyprinter/Makefile |
---|
251 | ]) |
---|
252 | |
---|
253 | AC_OUTPUT |
---|
254 | |
---|
255 | AM_COND_IF([BUILD_RELEASE], |
---|
256 | [AM_COND_IF([BUILD_DEBUG], |
---|
257 | [AC_MSG_NOTICE(Building libcfa for target: release & debug)], |
---|
258 | [AC_MSG_NOTICE(Building libcfa for target: release)])], |
---|
259 | [AM_COND_IF([BUILD_DEBUG], |
---|
260 | [AC_MSG_NOTICE(Building libcfa for target: debug)], |
---|
261 | [AC_MSG_NOTICE(Running cfa without libcfa)])]) |
---|
262 | |
---|
263 | # Final text |
---|
264 | AC_MSG_RESULT(Cforall configuraton completed. Type "make -j 8 install".) |
---|