source: configure.ac @ 796cea3

aaron-thesisarm-ehcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since 796cea3 was 796cea3, checked in by Thierry Delisle <tdelisle@…>, 6 years ago

Added proper argument to rename cfa

  • Property mode set to 100644
File size: 7.5 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
11if test "x${CXXFLAGS}" = "x"; then
12   export CXXFLAGS="-std=c++11 -g ${CXXFLAGS}"  # defaults, no -O2 for debugging and failures
13else
14   export CXXFLAGS="-std=c++11 ${CXXFLAGS}"     # flags from configure command
15fi
16
17AM_INIT_AUTOMAKE
18AM_MAINTAINER_MODE(enable)                      # may require auto* software to be installed
19
20# Allow program name tansformation
21# will fille program_transform_name with appropriate sed regex
22AC_ARG_PROGRAM
23#autoconf escapes $ and \ since automake wiill un-escape them.
24#Since we need to use the sed transform in autoconf we need to manualy un-escape these characters
25name_transform=`echo ${program_transform_name} | sed 's/\\$\\$/\\$/g' | sed 's/\\\\\\\/\\\/g'`
26cfa_name=`echo cfa | sed ${name_transform}`
27cc1_name=`echo cc1 | sed ${name_transform}`
28cpp_name=`echo cfa-cpp | sed ${name_transform}`
29
30#Trasforming cc1 will break compilation
31if ! test "${cc1_name}" = "cc1"; then
32    AC_MSG_ERROR([Program transform must not modify cc1.
33                --program-sufix and --program-prefix not supported.
34                Use -program-transform-name='s/cfa$/[[Desired name here]]/' instead])
35fi
36#We could support transforming cfa-cpp but since it is located in a unique subfolder we don't need to
37if ! test "${cpp_name}" = "cfa-cpp"; then
38    AC_MSG_ERROR([Program transform must not modify cfa-cpp.
39                --program-sufix and --program-prefix not supported.
40                Use -program-transform-name='s/cfa$/[[Desired name here]]/' instead])
41fi
42
43AC_ARG_WITH(cfa-name,
44        [  --with-cfa-name=NAME     NAME too which cfa will be installed],
45        cfa_name=$withval, cfa_name="cfa")
46
47#Define the new name of the installed command
48AC_SUBST(CFA_NAME, ${cfa_name})
49
50rm -f version
51echo ${PACKAGE_VERSION} > version               # file containing version number for other tools
52chmod ugo-w version
53ver_major=`cut -d '.' -f1 version`              # subdivide version number into components at periods
54ver_minor=`cut -d '.' -f2 version`
55ver_patch=`cut -d '.' -f3 version`
56ver_build=`cut -d '.' -f4 version`
57
58# AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/version'])
59AC_DEFINE_UNQUOTED(CFA_VERSION_MAJOR, ${ver_major}, [Major version number.])
60AC_DEFINE_UNQUOTED(CFA_VERSION_MINOR, ${ver_minor}, [Minor version number.])
61AC_DEFINE_UNQUOTED(CFA_VERSION_PATCH, ${ver_patch}, [Patch version number.])
62AC_DEFINE_UNQUOTED(CFA_VERSION_BUILD, ${ver_build}, [Build version number.])
63AC_DEFINE_UNQUOTED(CFA_VERSION_SHORT, ["${ver_major}"], [Major])
64AC_DEFINE_UNQUOTED(CFA_VERSION, ["${ver_major}.${ver_minor}"], [Major.Minor])
65AC_DEFINE_UNQUOTED(CFA_VERSION_LONG, ["${ver_major}.${ver_minor}.${ver_patch}"], [Major.Minor.Patch])
66AC_DEFINE_UNQUOTED(CFA_VERSION_FULL, ["${ver_major}.${ver_minor}.${ver_patch}.${ver_build}"], [Major.Minor.Patch.Build])
67
68# Installation paths
69
70AC_ARG_WITH(backend-compiler,
71        [  --with-backend-compiler=PROGRAM     PROGRAM that performs the final code compilation (must be gcc-compatible) ],
72        backendcompiler=$withval, backendcompiler="")
73if test "x$backendcompiler" != "x"; then
74        BACKEND_CC=${backendcompiler}
75else
76        AC_PATH_PROG(BACKEND_CC, gcc, [])       # check gcc installed
77        if test "x$BACKEND_CC" = "x"; then
78                AC_MSG_ERROR(some version of gcc is needed. Get it at ftp://ftp.gnu.org)
79                exit 1
80        fi
81fi
82AC_DEFINE_UNQUOTED(CFA_BACKEND_CC, "${BACKEND_CC}", [Location of include files.])
83AC_SUBST(CFA_BACKEND_CC)
84
85
86
87AC_ARG_ENABLE(target-release, AS_HELP_STRING([--enable-target-release], [Build and install the release target]))
88AC_ARG_ENABLE(target-debug, AS_HELP_STRING([--enable-target-debug], [Build and install the debug target]))
89AC_ARG_ENABLE(threading, AS_HELP_STRING([--enable-threading], [Build and install libcfa with threading support (Enabled by default)]),
90[case "${enableval}" in
91  yes) build_threading="yes" ;;
92  no)  build_threading="no" ;;
93  *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
94esac],[build_threading="yes"])
95
96case "$enable_target_release" in
97        yes)
98                case "$enable_target_debug" in
99                        yes)
100                                build_release="yes"
101                                build_debug="yes"
102                                ;;
103                        no)
104                                build_release="yes"
105                                build_debug="no"
106                                ;;
107                        *)
108                                build_release="yes"
109                                build_debug="no"
110                                ;;
111                esac
112                ;;
113        no)
114                case "$enable_target_debug" in
115                        yes)
116                                build_release="no"
117                                build_debug="yes"
118                                ;;
119                        no)
120                                build_release="no"
121                                build_debug="no"
122                                ;;
123                        *)
124                                build_release="no"
125                                build_debug="yes"
126                                ;;
127                esac
128                ;;
129        *)
130                case "$enable_target_debug" in
131                        yes)
132                                build_release="no"
133                                build_debug="yes"
134                                ;;
135                        no)
136                                build_release="yes"
137                                build_debug="no"
138                                ;;
139                        *)
140                                build_release="yes"
141                                build_debug="yes"
142                                ;;
143                esac
144                ;;
145esac
146
147AM_CONDITIONAL([BUILD_RELEASE], [test "x$build_release" = "xyes"])
148AM_CONDITIONAL([BUILD_DEBUG], [test "x$build_debug" = "xyes"])
149AM_CONDITIONAL([BUILD_NO_LIB], [test "x$build_release$build_debug" = "xnono"])
150AM_CONDITIONAL([BUILD_CONCURRENCY], [test "x$build_threading" = "xyes"])
151
152if test "x$prefix" = "xNONE"; then
153        cfa_prefix=${ac_default_prefix}
154else
155        cfa_prefix=${prefix}
156fi
157AC_DEFINE_UNQUOTED(CFA_PREFIX, "${cfa_prefix}", [Location of cfa install.])
158AC_SUBST(CFA_PREFIX, ${cfa_prefix})
159
160if test "$includedir" = '${prefix}/include'; then
161        cfa_incdir="${cfa_prefix}/include/${cfa_name}"
162else
163        cfa_incdir=${includedir}
164fi
165AC_DEFINE_UNQUOTED(CFA_INCDIR, "${cfa_incdir}", [Location of include files.])
166AC_SUBST(CFA_INCDIR, ${cfa_incdir})
167
168if test "$bindir" = '${exec_prefix}/bin'; then
169        cfa_bindir="${cfa_prefix}/bin"
170else
171        cfa_bindir=${bindir}
172fi
173AC_DEFINE_UNQUOTED(CFA_BINDIR, "${cfa_bindir}", [Location of cfa command.])
174AC_SUBST(CFA_BINDIR, ${cfa_bindir})
175
176if test "$libdir" = '${exec_prefix}/lib'; then
177        cfa_libdir="${cfa_prefix}/lib/${cfa_name}"
178else
179        cfa_libdir=${libdir}
180fi
181AC_DEFINE_UNQUOTED(CFA_LIBDIR, "${cfa_libdir}", [Location of cc1 and cfa-cpp commands.])
182AC_SUBST(CFA_LIBDIR, ${cfa_libdir})
183
184AC_DEFINE_UNQUOTED(CFA_FLAGS, "${CFAFLAGS}", [compilation flags for cfa libraries and test programs.])
185AC_SUBST(CFA_FLAGS, ${CFAFLAGS})
186
187AC_CANONICAL_HOST
188AC_SUBST([MACHINE_TYPE],[$host_cpu])
189
190# Checks for programs.
191AC_PROG_CXX
192AC_PROG_CC
193AM_PROG_AS
194AM_PROG_CC_C_O  # deprecated
195# These are often not installed and people miss seeing the "no", so stop the configure.
196AC_PROG_YACC
197if test "${YACC}" = "yacc" ; then echo "Error: bison required." ; exit 1 ; fi
198AC_PROG_LEX
199if test "${LEX}" = "lex" ; then echo "Error: flex required." ; exit 1 ; fi
200AC_PROG_INSTALL
201AC_PROG_MAKE_SET
202AC_PROG_RANLIB
203
204# Checks for libraries.
205
206# Checks for header files.
207AC_FUNC_ALLOCA
208AC_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.
211AC_HEADER_STDBOOL
212AC_C_INLINE
213AC_TYPE_INT16_T
214AC_TYPE_INT32_T
215AC_TYPE_INT8_T
216AC_C_RESTRICT
217AC_TYPE_SIZE_T
218AC_TYPE_UINT16_T
219AC_TYPE_UINT32_T
220AC_TYPE_UINT8_T
221
222# Checks for library functions.
223AC_CHECK_FUNCS([memset putenv strchr strtol])
224
225AC_CONFIG_FILES([
226        Makefile
227        src/driver/Makefile
228        src/Makefile
229        src/benchmark/Makefile
230        src/examples/Makefile
231        src/tests/Makefile
232        src/prelude/Makefile
233        src/libcfa/Makefile
234        ])
235
236AC_OUTPUT
237
238AM_COND_IF([BUILD_RELEASE],
239        [AM_COND_IF([BUILD_DEBUG],
240                [AC_MSG_NOTICE(Building libcfa for target: release & debug)],
241                [AC_MSG_NOTICE(Building libcfa for target: release)])],
242        [AM_COND_IF([BUILD_DEBUG],
243                [AC_MSG_NOTICE(Building libcfa for target: debug)],
244                [AC_MSG_NOTICE(Running cfa without libcfa)])])
245
246# Final text
247AC_MSG_RESULT(Cforall configuraton completed. Type "make -j 8 install".)
Note: See TracBrowser for help on using the repository browser.