source: configure.ac @ a7c90d4

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 a7c90d4 was df47e2f, checked in by Thierry Delisle <tdelisle@…>, 7 years ago

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

  • Property mode set to 100644
File size: 7.4 KB
RevLine 
[5d6ce1f]1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ([2.68])
[4b1afb6]5AC_INIT([cfa-cc],[1.0.0.0],[cforall@plg.uwaterloo.ca])
[00cc023]6AC_CONFIG_AUX_DIR([automake])
[d3b7937]7#AC_CONFIG_SRCDIR([src/main.cc])
[5d6ce1f]8AC_CONFIG_HEADERS([config.h])
[ef7d253]9AM_SILENT_RULES([no])
[5d6ce1f]10
[90c3b1c]11if test "x${CXXFLAGS}" = "x"; then
[6e4b913]12   export CXXFLAGS="-std=c++11 -g ${CXXFLAGS}"  # defaults, no -O2 for debugging and failures
[90c3b1c]13else
[6e4b913]14   export CXXFLAGS="-std=c++11 ${CXXFLAGS}"     # flags from configure command
[90c3b1c]15fi
16
[00cc023]17AM_INIT_AUTOMAKE
[6e4b913]18AM_MAINTAINER_MODE(enable)                      # may require auto* software to be installed
[00cc023]19
[df47e2f]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
[65c61ec]46rm -f version
[2042d41]47echo ${PACKAGE_VERSION} > version               # file containing version number for other tools
[65c61ec]48chmod ugo-w version
[2042d41]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`
[47a8d17]53
[4b1afb6]54# AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/version'])
[47a8d17]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.])
[4b1afb6]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])
[ec129c4]63
[5d6ce1f]64# Installation paths
65
[ef7d253]66AC_ARG_WITH(backend-compiler,
67        [  --with-backend-compiler=PROGRAM     PROGRAM that performs the final code compilation (must be gcc-compatible) ],
[e24f13a]68        backendcompiler=$withval, backendcompiler="")
[6e4b913]69if test "x$backendcompiler" != "x"; then
[e24f13a]70        BACKEND_CC=${backendcompiler}
71else
[6e4b913]72        AC_PATH_PROG(BACKEND_CC, gcc, [])       # check gcc installed
[e24f13a]73        if test "x$BACKEND_CC" = "x"; then
[00cc023]74                AC_MSG_ERROR(some version of gcc is needed. Get it at ftp://ftp.gnu.org)
75                exit 1
76        fi
[e24f13a]77fi
78AC_DEFINE_UNQUOTED(CFA_BACKEND_CC, "${BACKEND_CC}", [Location of include files.])
79AC_SUBST(CFA_BACKEND_CC)
[5d6ce1f]80
[9def87a]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]))
[facc44f]85AC_ARG_ENABLE(threading, AS_HELP_STRING([--enable-threading], [Build and install libcfa with threading support (Enabled by default)]),
86[case "${enableval}" in
[a62cbb3]87  yes) build_threading="yes" ;;
[facc44f]88  no)  build_threading="no" ;;
89  *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
90esac],[build_threading="yes"])
[9def87a]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)
[24f4671]116                                build_release="no"
117                                build_debug="no"
[9def87a]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"])
[24f4671]145AM_CONDITIONAL([BUILD_NO_LIB], [test "x$build_release$build_debug" = "xnono"])
[facc44f]146AM_CONDITIONAL([BUILD_CONCURRENCY], [test "x$build_threading" = "xyes"])
[9def87a]147
[5d6ce1f]148if test "x$prefix" = "xNONE"; then
[00cc023]149        cfa_prefix=${ac_default_prefix}
[5d6ce1f]150else
[00cc023]151        cfa_prefix=${prefix}
[ef7d253]152fi
[d3b7937]153AC_DEFINE_UNQUOTED(CFA_PREFIX, "${cfa_prefix}", [Location of cfa install.])
[00cc023]154AC_SUBST(CFA_PREFIX, ${cfa_prefix})
[5d6ce1f]155
156if test "$includedir" = '${prefix}/include'; then
[df47e2f]157        cfa_incdir="${cfa_prefix}/include/${cfa_name}"
[5d6ce1f]158else
[faf8857]159        cfa_incdir=${includedir}
[ef7d253]160fi
[5d6ce1f]161AC_DEFINE_UNQUOTED(CFA_INCDIR, "${cfa_incdir}", [Location of include files.])
[00cc023]162AC_SUBST(CFA_INCDIR, ${cfa_incdir})
[5d6ce1f]163
164if test "$bindir" = '${exec_prefix}/bin'; then
165        cfa_bindir="${cfa_prefix}/bin"
166else
167        cfa_bindir=${bindir}
[ef7d253]168fi
[5d6ce1f]169AC_DEFINE_UNQUOTED(CFA_BINDIR, "${cfa_bindir}", [Location of cfa command.])
[00cc023]170AC_SUBST(CFA_BINDIR, ${cfa_bindir})
[5d6ce1f]171
172if test "$libdir" = '${exec_prefix}/lib'; then
[df47e2f]173        cfa_libdir="${cfa_prefix}/lib/${cfa_name}"
[5d6ce1f]174else
175        cfa_libdir=${libdir}
[ef7d253]176fi
[5d6ce1f]177AC_DEFINE_UNQUOTED(CFA_LIBDIR, "${cfa_libdir}", [Location of cc1 and cfa-cpp commands.])
[00cc023]178AC_SUBST(CFA_LIBDIR, ${cfa_libdir})
[5d6ce1f]179
[6e4b913]180AC_DEFINE_UNQUOTED(CFA_FLAGS, "${CFAFLAGS}", [compilation flags for cfa libraries and test programs.])
181AC_SUBST(CFA_FLAGS, ${CFAFLAGS})
182
[e4745d7a]183AC_CANONICAL_HOST
184AC_SUBST([MACHINE_TYPE],[$host_cpu])
185
[5d6ce1f]186# Checks for programs.
187AC_PROG_CXX
188AC_PROG_CC
[8e5724e]189AM_PROG_AS
[00cc023]190AM_PROG_CC_C_O  # deprecated
[c3a4385]191# These are often not installed and people miss seeing the "no", so stop the configure.
[56c3935]192AC_PROG_YACC
[c3a4385]193if test "${YACC}" = "yacc" ; then echo "Error: bison required." ; exit 1 ; fi
[56c3935]194AC_PROG_LEX
[c3a4385]195if test "${LEX}" = "lex" ; then echo "Error: flex required." ; exit 1 ; fi
[5d6ce1f]196AC_PROG_INSTALL
197AC_PROG_MAKE_SET
[00cc023]198AC_PROG_RANLIB
[5d6ce1f]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
[00cc023]221AC_CONFIG_FILES([
222        Makefile
[6e7e2b36]223        src/driver/Makefile
[00cc023]224        src/Makefile
[ac93b228]225        src/benchmark/Makefile
[00cc023]226        src/examples/Makefile
[ef7d253]227        src/tests/Makefile
[375a068]228        src/prelude/Makefile
[6e7e2b36]229        src/libcfa/Makefile
[00cc023]230        ])
[5d6ce1f]231
232AC_OUTPUT
[7e91d4f]233
[9def87a]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)])],
[24f4671]238        [AM_COND_IF([BUILD_DEBUG],
239                [AC_MSG_NOTICE(Building libcfa for target: debug)],
240                [AC_MSG_NOTICE(Running cfa without libcfa)])])
[9def87a]241
[5d6ce1f]242# Final text
243AC_MSG_RESULT(Cforall configuraton completed. Type "make -j 8 install".)
Note: See TracBrowser for help on using the repository browser.