source: configure.ac @ d3bc0ad

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since d3bc0ad was df47e2f, checked in by Thierry Delisle <tdelisle@…>, 8 years ago

Added partial support for renaming cfa through autoconf (using --program-transform-name)

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