source: configure.ac@ 2f9a722

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors deferred_resn demangler enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new with_gc
Last change on this file since 2f9a722 was eb0951d0, checked in by Thierry Delisle <tdelisle@…>, 8 years ago

Refacted some of the CXXFLAGS and added c++14 and Werror

  • Property mode set to 100644
File size: 7.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])
9AM_SILENT_RULES([no])
10
11AM_INIT_AUTOMAKE
12AM_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
16AC_ARG_PROGRAM
17
18#Trasforming cc1 will break compilation
19if test "${program_transform_name}" = ""; then
20 AC_MSG_ERROR([Program transform not supported.
21 Use --with-cfa-name='[[Desired name here]]' instead])
22fi
23
24AC_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
29AC_SUBST(CFA_NAME, ${cfa_name})
30
31rm -f version
32echo ${PACKAGE_VERSION} > version # file containing version number for other tools
33chmod ugo-w version
34ver_major=`cut -d '.' -f1 version` # subdivide version number into components at periods
35ver_minor=`cut -d '.' -f2 version`
36ver_patch=`cut -d '.' -f3 version`
37ver_build=`cut -d '.' -f4 version`
38
39# AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/version'])
40AC_DEFINE_UNQUOTED(CFA_VERSION_MAJOR, ${ver_major}, [Major version number.])
41AC_DEFINE_UNQUOTED(CFA_VERSION_MINOR, ${ver_minor}, [Minor version number.])
42AC_DEFINE_UNQUOTED(CFA_VERSION_PATCH, ${ver_patch}, [Patch version number.])
43AC_DEFINE_UNQUOTED(CFA_VERSION_BUILD, ${ver_build}, [Build version number.])
44AC_DEFINE_UNQUOTED(CFA_VERSION_SHORT, ["${ver_major}"], [Major])
45AC_DEFINE_UNQUOTED(CFA_VERSION, ["${ver_major}.${ver_minor}"], [Major.Minor])
46AC_DEFINE_UNQUOTED(CFA_VERSION_LONG, ["${ver_major}.${ver_minor}.${ver_patch}"], [Major.Minor.Patch])
47AC_DEFINE_UNQUOTED(CFA_VERSION_FULL, ["${ver_major}.${ver_minor}.${ver_patch}.${ver_build}"], [Major.Minor.Patch.Build])
48
49# Installation paths
50
51AC_ARG_WITH(backend-compiler,
52 [ --with-backend-compiler=PROGRAM PROGRAM that performs the final code compilation (must be gcc-compatible) ],
53 backendcompiler=$withval, backendcompiler="")
54if test "x$backendcompiler" != "x"; then
55 BACKEND_CC=${backendcompiler}
56else
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
62fi
63AC_DEFINE_UNQUOTED(CFA_BACKEND_CC, "${BACKEND_CC}", [Location of include files.])
64AC_SUBST(CFA_BACKEND_CC)
65
66
67
68AC_ARG_ENABLE(target-release, AS_HELP_STRING([--enable-target-release], [Build and install the release target]))
69AC_ARG_ENABLE(target-debug, AS_HELP_STRING([--enable-target-debug], [Build and install the debug target]))
70AC_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]) ;;
75esac],[build_threading="yes"])
76
77case "$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 ;;
126esac
127
128AM_CONDITIONAL([BUILD_RELEASE], [test "x$build_release" = "xyes"])
129AM_CONDITIONAL([BUILD_DEBUG], [test "x$build_debug" = "xyes"])
130AM_CONDITIONAL([BUILD_NO_LIB], [test "x$build_release$build_debug" = "xnono"])
131AM_CONDITIONAL([BUILD_CONCURRENCY], [test "x$build_threading" = "xyes"])
132
133if test "x$prefix" = "xNONE"; then
134 cfa_prefix=${ac_default_prefix}
135else
136 cfa_prefix=${prefix}
137fi
138AC_DEFINE_UNQUOTED(CFA_PREFIX, "${cfa_prefix}", [Location of cfa install.])
139AC_SUBST(CFA_PREFIX, ${cfa_prefix})
140
141if test "$includedir" = '${prefix}/include'; then
142 cfa_incdir="${cfa_prefix}/include/${cfa_name}"
143else
144 cfa_incdir=${includedir}
145fi
146AC_DEFINE_UNQUOTED(CFA_INCDIR, "${cfa_incdir}", [Location of include files.])
147AC_SUBST(CFA_INCDIR, ${cfa_incdir})
148
149if test "$bindir" = '${exec_prefix}/bin'; then
150 cfa_bindir="${cfa_prefix}/bin"
151else
152 cfa_bindir=${bindir}
153fi
154AC_DEFINE_UNQUOTED(CFA_BINDIR, "${cfa_bindir}", [Location of cfa command.])
155AC_SUBST(CFA_BINDIR, ${cfa_bindir})
156
157if test "$libdir" = '${exec_prefix}/lib'; then
158 cfa_libdir="${cfa_prefix}/lib/${cfa_name}"
159else
160 cfa_libdir=${libdir}
161fi
162AC_DEFINE_UNQUOTED(CFA_LIBDIR, "${cfa_libdir}", [Location of cc1 and cfa-cpp commands.])
163AC_SUBST(CFA_LIBDIR, ${cfa_libdir})
164
165AC_CANONICAL_BUILD
166AC_CANONICAL_HOST
167AC_SUBST([MACHINE_TYPE],[$host_cpu])
168
169if ! test "$host_cpu" = "$build_cpu"; then
170 case $host_cpu in
171 i386)
172 CFLAGS+="-m32"
173 CXXFLAGS+="-m32"
174 CFAFLAGS+="-m32"
175 LDFLAGS+="-m32"
176 ;;
177 i686)
178 CFLAGS+="-m32"
179 CXXFLAGS+="-m32"
180 CFAFLAGS+="-m32"
181 LDFLAGS+="-m32"
182 ;;
183 x86_64)
184 CFLAGS+="-m64"
185 CXXFLAGS+="-m64"
186 CFAFLAGS+="-m64"
187 LDFLAGS+="-m64"
188 ;;
189 esac
190fi
191
192AC_DEFINE_UNQUOTED(CFA_FLAGS, "${CFAFLAGS}", [compilation flags for cfa libraries and test programs.])
193AC_SUBST(CFA_FLAGS, ${CFAFLAGS})
194
195# Checks for programs.
196AC_PROG_CXX
197AC_PROG_CC
198AM_PROG_AS
199AM_PROG_CC_C_O # deprecated
200# These are often not installed and people miss seeing the "no", so stop the configure.
201AC_PROG_YACC
202if test "${YACC}" = "yacc" ; then echo "Error: bison required." ; exit 1 ; fi
203AC_PROG_LEX
204if test "${LEX}" = "lex" ; then echo "Error: flex required." ; exit 1 ; fi
205AC_PROG_INSTALL
206AC_PROG_MAKE_SET
207AC_PROG_RANLIB
208
209# Checks for libraries.
210
211# Checks for header files.
212AC_FUNC_ALLOCA
213AC_CHECK_HEADERS([fenv.h float.h inttypes.h libintl.h limits.h malloc.h stddef.h stdlib.h string.h unistd.h])
214
215# Checks for typedefs, structures, and compiler characteristics.
216AC_HEADER_STDBOOL
217AC_C_INLINE
218AC_TYPE_INT16_T
219AC_TYPE_INT32_T
220AC_TYPE_INT8_T
221AC_C_RESTRICT
222AC_TYPE_SIZE_T
223AC_TYPE_UINT16_T
224AC_TYPE_UINT32_T
225AC_TYPE_UINT8_T
226
227# Checks for library functions.
228AC_CHECK_FUNCS([memset putenv strchr strtol])
229
230AC_CONFIG_FILES([
231 Makefile
232 src/driver/Makefile
233 src/Makefile
234 src/benchmark/Makefile
235 src/examples/Makefile
236 src/tests/Makefile
237 src/prelude/Makefile
238 src/libcfa/Makefile
239 ])
240
241AC_OUTPUT
242
243AM_COND_IF([BUILD_RELEASE],
244 [AM_COND_IF([BUILD_DEBUG],
245 [AC_MSG_NOTICE(Building libcfa for target: release & debug)],
246 [AC_MSG_NOTICE(Building libcfa for target: release)])],
247 [AM_COND_IF([BUILD_DEBUG],
248 [AC_MSG_NOTICE(Building libcfa for target: debug)],
249 [AC_MSG_NOTICE(Running cfa without libcfa)])])
250
251# Final text
252AC_MSG_RESULT(Cforall configuraton completed. Type "make -j 8 install".)
Note: See TracBrowser for help on using the repository browser.