[5d6ce1f] | 1 | # -*- Autoconf -*- |
---|
| 2 | # Process this file with autoconf to produce a configure script. |
---|
| 3 | |
---|
| 4 | AC_PREREQ([2.68]) |
---|
[4b1afb6] | 5 | AC_INIT([cfa-cc],[1.0.0.0],[cforall@plg.uwaterloo.ca]) |
---|
[00cc023] | 6 | AC_CONFIG_AUX_DIR([automake]) |
---|
[d3b7937] | 7 | #AC_CONFIG_SRCDIR([src/main.cc]) |
---|
[5d6ce1f] | 8 | AC_CONFIG_HEADERS([config.h]) |
---|
[ef7d253] | 9 | AM_SILENT_RULES([no]) |
---|
[5d6ce1f] | 10 | |
---|
[90c3b1c] | 11 | if test "x${CXXFLAGS}" = "x"; then |
---|
[6e4b913] | 12 | export CXXFLAGS="-std=c++11 -g ${CXXFLAGS}" # defaults, no -O2 for debugging and failures |
---|
[90c3b1c] | 13 | else |
---|
[6e4b913] | 14 | export CXXFLAGS="-std=c++11 ${CXXFLAGS}" # flags from configure command |
---|
[90c3b1c] | 15 | fi |
---|
| 16 | |
---|
[00cc023] | 17 | AM_INIT_AUTOMAKE |
---|
[6e4b913] | 18 | AM_MAINTAINER_MODE(enable) # may require auto* software to be installed |
---|
[00cc023] | 19 | |
---|
[65c61ec] | 20 | rm -f version |
---|
[2042d41] | 21 | echo ${PACKAGE_VERSION} > version # file containing version number for other tools |
---|
[65c61ec] | 22 | chmod ugo-w version |
---|
[2042d41] | 23 | ver_major=`cut -d '.' -f1 version` # subdivide version number into components at periods |
---|
| 24 | ver_minor=`cut -d '.' -f2 version` |
---|
| 25 | ver_patch=`cut -d '.' -f3 version` |
---|
| 26 | ver_build=`cut -d '.' -f4 version` |
---|
[47a8d17] | 27 | |
---|
[4b1afb6] | 28 | # AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/version']) |
---|
[47a8d17] | 29 | AC_DEFINE_UNQUOTED(CFA_VERSION_MAJOR, ${ver_major}, [Major version number.]) |
---|
| 30 | AC_DEFINE_UNQUOTED(CFA_VERSION_MINOR, ${ver_minor}, [Minor version number.]) |
---|
| 31 | AC_DEFINE_UNQUOTED(CFA_VERSION_PATCH, ${ver_patch}, [Patch version number.]) |
---|
| 32 | AC_DEFINE_UNQUOTED(CFA_VERSION_BUILD, ${ver_build}, [Build version number.]) |
---|
[4b1afb6] | 33 | AC_DEFINE_UNQUOTED(CFA_VERSION_SHORT, ["${ver_major}"], [Major]) |
---|
| 34 | AC_DEFINE_UNQUOTED(CFA_VERSION, ["${ver_major}.${ver_minor}"], [Major.Minor]) |
---|
| 35 | AC_DEFINE_UNQUOTED(CFA_VERSION_LONG, ["${ver_major}.${ver_minor}.${ver_patch}"], [Major.Minor.Patch]) |
---|
| 36 | AC_DEFINE_UNQUOTED(CFA_VERSION_FULL, ["${ver_major}.${ver_minor}.${ver_patch}.${ver_build}"], [Major.Minor.Patch.Build]) |
---|
[ec129c4] | 37 | |
---|
[5d6ce1f] | 38 | # Installation paths |
---|
| 39 | |
---|
[ef7d253] | 40 | AC_ARG_WITH(backend-compiler, |
---|
| 41 | [ --with-backend-compiler=PROGRAM PROGRAM that performs the final code compilation (must be gcc-compatible) ], |
---|
[e24f13a] | 42 | backendcompiler=$withval, backendcompiler="") |
---|
[6e4b913] | 43 | if test "x$backendcompiler" != "x"; then |
---|
[e24f13a] | 44 | BACKEND_CC=${backendcompiler} |
---|
| 45 | else |
---|
[6e4b913] | 46 | AC_PATH_PROG(BACKEND_CC, gcc, []) # check gcc installed |
---|
[e24f13a] | 47 | if test "x$BACKEND_CC" = "x"; then |
---|
[00cc023] | 48 | AC_MSG_ERROR(some version of gcc is needed. Get it at ftp://ftp.gnu.org) |
---|
| 49 | exit 1 |
---|
| 50 | fi |
---|
[e24f13a] | 51 | fi |
---|
| 52 | AC_DEFINE_UNQUOTED(CFA_BACKEND_CC, "${BACKEND_CC}", [Location of include files.]) |
---|
| 53 | AC_SUBST(CFA_BACKEND_CC) |
---|
[5d6ce1f] | 54 | |
---|
[9def87a] | 55 | |
---|
| 56 | |
---|
| 57 | AC_ARG_ENABLE(target-release, AS_HELP_STRING([--enable-target-release], [Build and install the release target])) |
---|
| 58 | AC_ARG_ENABLE(target-debug, AS_HELP_STRING([--enable-target-debug], [Build and install the debug target])) |
---|
[facc44f] | 59 | AC_ARG_ENABLE(threading, AS_HELP_STRING([--enable-threading], [Build and install libcfa with threading support (Enabled by default)]), |
---|
| 60 | [case "${enableval}" in |
---|
| 61 | yes) build_threading-"yes" ;; |
---|
| 62 | no) build_threading="no" ;; |
---|
| 63 | *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;; |
---|
| 64 | esac],[build_threading="yes"]) |
---|
[9def87a] | 65 | |
---|
| 66 | case "$enable_target_release" in |
---|
| 67 | yes) |
---|
| 68 | case "$enable_target_debug" in |
---|
| 69 | yes) |
---|
| 70 | build_release="yes" |
---|
| 71 | build_debug="yes" |
---|
| 72 | ;; |
---|
| 73 | no) |
---|
| 74 | build_release="yes" |
---|
| 75 | build_debug="no" |
---|
| 76 | ;; |
---|
| 77 | *) |
---|
| 78 | build_release="yes" |
---|
| 79 | build_debug="no" |
---|
| 80 | ;; |
---|
| 81 | esac |
---|
| 82 | ;; |
---|
| 83 | no) |
---|
| 84 | case "$enable_target_debug" in |
---|
| 85 | yes) |
---|
| 86 | build_release="no" |
---|
| 87 | build_debug="yes" |
---|
| 88 | ;; |
---|
| 89 | no) |
---|
[24f4671] | 90 | build_release="no" |
---|
| 91 | build_debug="no" |
---|
[9def87a] | 92 | ;; |
---|
| 93 | *) |
---|
| 94 | build_release="no" |
---|
| 95 | build_debug="yes" |
---|
| 96 | ;; |
---|
| 97 | esac |
---|
| 98 | ;; |
---|
| 99 | *) |
---|
| 100 | case "$enable_target_debug" in |
---|
| 101 | yes) |
---|
| 102 | build_release="no" |
---|
| 103 | build_debug="yes" |
---|
| 104 | ;; |
---|
| 105 | no) |
---|
| 106 | build_release="yes" |
---|
| 107 | build_debug="no" |
---|
| 108 | ;; |
---|
| 109 | *) |
---|
| 110 | build_release="yes" |
---|
| 111 | build_debug="yes" |
---|
| 112 | ;; |
---|
| 113 | esac |
---|
| 114 | ;; |
---|
| 115 | esac |
---|
| 116 | |
---|
| 117 | AM_CONDITIONAL([BUILD_RELEASE], [test "x$build_release" = "xyes"]) |
---|
| 118 | AM_CONDITIONAL([BUILD_DEBUG], [test "x$build_debug" = "xyes"]) |
---|
[24f4671] | 119 | AM_CONDITIONAL([BUILD_NO_LIB], [test "x$build_release$build_debug" = "xnono"]) |
---|
[facc44f] | 120 | AM_CONDITIONAL([BUILD_CONCURRENCY], [test "x$build_threading" = "xyes"]) |
---|
[9def87a] | 121 | |
---|
[5d6ce1f] | 122 | if test "x$prefix" = "xNONE"; then |
---|
[00cc023] | 123 | cfa_prefix=${ac_default_prefix} |
---|
[5d6ce1f] | 124 | else |
---|
[00cc023] | 125 | cfa_prefix=${prefix} |
---|
[ef7d253] | 126 | fi |
---|
[d3b7937] | 127 | AC_DEFINE_UNQUOTED(CFA_PREFIX, "${cfa_prefix}", [Location of cfa install.]) |
---|
[00cc023] | 128 | AC_SUBST(CFA_PREFIX, ${cfa_prefix}) |
---|
[5d6ce1f] | 129 | |
---|
| 130 | if test "$includedir" = '${prefix}/include'; then |
---|
[ff2d7341] | 131 | cfa_incdir="${cfa_prefix}/include/cfa" |
---|
[5d6ce1f] | 132 | else |
---|
[faf8857] | 133 | cfa_incdir=${includedir} |
---|
[ef7d253] | 134 | fi |
---|
[5d6ce1f] | 135 | AC_DEFINE_UNQUOTED(CFA_INCDIR, "${cfa_incdir}", [Location of include files.]) |
---|
[00cc023] | 136 | AC_SUBST(CFA_INCDIR, ${cfa_incdir}) |
---|
[5d6ce1f] | 137 | |
---|
| 138 | if test "$bindir" = '${exec_prefix}/bin'; then |
---|
| 139 | cfa_bindir="${cfa_prefix}/bin" |
---|
| 140 | else |
---|
| 141 | cfa_bindir=${bindir} |
---|
[ef7d253] | 142 | fi |
---|
[5d6ce1f] | 143 | AC_DEFINE_UNQUOTED(CFA_BINDIR, "${cfa_bindir}", [Location of cfa command.]) |
---|
[00cc023] | 144 | AC_SUBST(CFA_BINDIR, ${cfa_bindir}) |
---|
[5d6ce1f] | 145 | |
---|
| 146 | if test "$libdir" = '${exec_prefix}/lib'; then |
---|
| 147 | cfa_libdir=${cfa_prefix}/lib |
---|
| 148 | else |
---|
| 149 | cfa_libdir=${libdir} |
---|
[ef7d253] | 150 | fi |
---|
[5d6ce1f] | 151 | AC_DEFINE_UNQUOTED(CFA_LIBDIR, "${cfa_libdir}", [Location of cc1 and cfa-cpp commands.]) |
---|
[00cc023] | 152 | AC_SUBST(CFA_LIBDIR, ${cfa_libdir}) |
---|
[5d6ce1f] | 153 | |
---|
[6e4b913] | 154 | AC_DEFINE_UNQUOTED(CFA_FLAGS, "${CFAFLAGS}", [compilation flags for cfa libraries and test programs.]) |
---|
| 155 | AC_SUBST(CFA_FLAGS, ${CFAFLAGS}) |
---|
| 156 | |
---|
[e4745d7a] | 157 | AC_CANONICAL_HOST |
---|
| 158 | AC_SUBST([MACHINE_TYPE],[$host_cpu]) |
---|
| 159 | |
---|
[5d6ce1f] | 160 | # Checks for programs. |
---|
| 161 | AC_PROG_CXX |
---|
| 162 | AC_PROG_CC |
---|
[8e5724e] | 163 | AM_PROG_AS |
---|
[00cc023] | 164 | AM_PROG_CC_C_O # deprecated |
---|
[c3a4385] | 165 | # These are often not installed and people miss seeing the "no", so stop the configure. |
---|
[56c3935] | 166 | AC_PROG_YACC |
---|
[c3a4385] | 167 | if test "${YACC}" = "yacc" ; then echo "Error: bison required." ; exit 1 ; fi |
---|
[56c3935] | 168 | AC_PROG_LEX |
---|
[c3a4385] | 169 | if test "${LEX}" = "lex" ; then echo "Error: flex required." ; exit 1 ; fi |
---|
[5d6ce1f] | 170 | AC_PROG_INSTALL |
---|
| 171 | AC_PROG_MAKE_SET |
---|
[00cc023] | 172 | AC_PROG_RANLIB |
---|
[5d6ce1f] | 173 | |
---|
| 174 | # Checks for libraries. |
---|
| 175 | |
---|
| 176 | # Checks for header files. |
---|
| 177 | AC_FUNC_ALLOCA |
---|
| 178 | AC_CHECK_HEADERS([fenv.h float.h inttypes.h libintl.h limits.h malloc.h stddef.h stdlib.h string.h unistd.h]) |
---|
| 179 | |
---|
| 180 | # Checks for typedefs, structures, and compiler characteristics. |
---|
| 181 | AC_HEADER_STDBOOL |
---|
| 182 | AC_C_INLINE |
---|
| 183 | AC_TYPE_INT16_T |
---|
| 184 | AC_TYPE_INT32_T |
---|
| 185 | AC_TYPE_INT8_T |
---|
| 186 | AC_C_RESTRICT |
---|
| 187 | AC_TYPE_SIZE_T |
---|
| 188 | AC_TYPE_UINT16_T |
---|
| 189 | AC_TYPE_UINT32_T |
---|
| 190 | AC_TYPE_UINT8_T |
---|
| 191 | |
---|
| 192 | # Checks for library functions. |
---|
| 193 | AC_CHECK_FUNCS([memset putenv strchr strtol]) |
---|
| 194 | |
---|
[00cc023] | 195 | AC_CONFIG_FILES([ |
---|
| 196 | Makefile |
---|
[6e7e2b36] | 197 | src/driver/Makefile |
---|
[00cc023] | 198 | src/Makefile |
---|
[ac93b228] | 199 | src/benchmark/Makefile |
---|
[00cc023] | 200 | src/examples/Makefile |
---|
[ef7d253] | 201 | src/tests/Makefile |
---|
[375a068] | 202 | src/prelude/Makefile |
---|
[6e7e2b36] | 203 | src/libcfa/Makefile |
---|
[00cc023] | 204 | ]) |
---|
[5d6ce1f] | 205 | |
---|
| 206 | AC_OUTPUT |
---|
[7e91d4f] | 207 | |
---|
[9def87a] | 208 | AM_COND_IF([BUILD_RELEASE], |
---|
| 209 | [AM_COND_IF([BUILD_DEBUG], |
---|
| 210 | [AC_MSG_NOTICE(Building libcfa for target: release & debug)], |
---|
| 211 | [AC_MSG_NOTICE(Building libcfa for target: release)])], |
---|
[24f4671] | 212 | [AM_COND_IF([BUILD_DEBUG], |
---|
| 213 | [AC_MSG_NOTICE(Building libcfa for target: debug)], |
---|
| 214 | [AC_MSG_NOTICE(Running cfa without libcfa)])]) |
---|
[9def87a] | 215 | |
---|
[5d6ce1f] | 216 | # Final text |
---|
| 217 | AC_MSG_RESULT(Cforall configuraton completed. Type "make -j 8 install".) |
---|