source: configure.ac @ 25a9b5a

aaron-thesisarm-ehcleanup-dtorsdeferred_resndemanglerjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprno_listpersistent-indexer
Last change on this file since 25a9b5a was 25a9b5a, checked in by Thierry Delisle <tdelisle@…>, 3 years ago

Added defines for prelude path in tree

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