[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]) |
---|
[a5c722b] | 8 | AC_CONFIG_HEADERS([config.h:src/config.h.in]) |
---|
[ef7d253] | 9 | AM_SILENT_RULES([no]) |
---|
[5d6ce1f] | 10 | |
---|
[44f44617] | 11 | AM_INIT_AUTOMAKE([subdir-objects]) |
---|
[00cc023] | 12 | |
---|
[df47e2f] | 13 | # Allow program name tansformation |
---|
[6363ad1] | 14 | # will fill program_transform_name with appropriate sed regex |
---|
[df47e2f] | 15 | AC_ARG_PROGRAM |
---|
| 16 | |
---|
| 17 | #Trasforming cc1 will break compilation |
---|
[65e9bc1] | 18 | if test "${program_transform_name}" = ""; then |
---|
[6363ad1] | 19 | AC_MSG_ERROR([Program transform not supported. |
---|
| 20 | Use --with-cfa-name='[[Desired name here]]' instead]) |
---|
[df47e2f] | 21 | fi |
---|
| 22 | |
---|
[796cea3] | 23 | AC_ARG_WITH(cfa-name, |
---|
| 24 | [ --with-cfa-name=NAME NAME too which cfa will be installed], |
---|
| 25 | cfa_name=$withval, cfa_name="cfa") |
---|
| 26 | |
---|
[df47e2f] | 27 | #Define the new name of the installed command |
---|
| 28 | AC_SUBST(CFA_NAME, ${cfa_name}) |
---|
| 29 | |
---|
[65c61ec] | 30 | rm -f version |
---|
[2042d41] | 31 | echo ${PACKAGE_VERSION} > version # file containing version number for other tools |
---|
[65c61ec] | 32 | chmod ugo-w version |
---|
[2042d41] | 33 | ver_major=`cut -d '.' -f1 version` # subdivide version number into components at periods |
---|
| 34 | ver_minor=`cut -d '.' -f2 version` |
---|
| 35 | ver_patch=`cut -d '.' -f3 version` |
---|
| 36 | ver_build=`cut -d '.' -f4 version` |
---|
[47a8d17] | 37 | |
---|
[4b1afb6] | 38 | # AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/version']) |
---|
[47a8d17] | 39 | AC_DEFINE_UNQUOTED(CFA_VERSION_MAJOR, ${ver_major}, [Major version number.]) |
---|
| 40 | AC_DEFINE_UNQUOTED(CFA_VERSION_MINOR, ${ver_minor}, [Minor version number.]) |
---|
| 41 | AC_DEFINE_UNQUOTED(CFA_VERSION_PATCH, ${ver_patch}, [Patch version number.]) |
---|
| 42 | AC_DEFINE_UNQUOTED(CFA_VERSION_BUILD, ${ver_build}, [Build version number.]) |
---|
[4b1afb6] | 43 | AC_DEFINE_UNQUOTED(CFA_VERSION_SHORT, ["${ver_major}"], [Major]) |
---|
| 44 | AC_DEFINE_UNQUOTED(CFA_VERSION, ["${ver_major}.${ver_minor}"], [Major.Minor]) |
---|
| 45 | AC_DEFINE_UNQUOTED(CFA_VERSION_LONG, ["${ver_major}.${ver_minor}.${ver_patch}"], [Major.Minor.Patch]) |
---|
| 46 | AC_DEFINE_UNQUOTED(CFA_VERSION_FULL, ["${ver_major}.${ver_minor}.${ver_patch}.${ver_build}"], [Major.Minor.Patch.Build]) |
---|
[ec129c4] | 47 | |
---|
[5d6ce1f] | 48 | # Installation paths |
---|
| 49 | |
---|
[ef7d253] | 50 | AC_ARG_WITH(backend-compiler, |
---|
| 51 | [ --with-backend-compiler=PROGRAM PROGRAM that performs the final code compilation (must be gcc-compatible) ], |
---|
[e24f13a] | 52 | backendcompiler=$withval, backendcompiler="") |
---|
[6e4b913] | 53 | if test "x$backendcompiler" != "x"; then |
---|
[e24f13a] | 54 | BACKEND_CC=${backendcompiler} |
---|
| 55 | else |
---|
[6e4b913] | 56 | AC_PATH_PROG(BACKEND_CC, gcc, []) # check gcc installed |
---|
[e24f13a] | 57 | if test "x$BACKEND_CC" = "x"; then |
---|
[00cc023] | 58 | AC_MSG_ERROR(some version of gcc is needed. Get it at ftp://ftp.gnu.org) |
---|
| 59 | exit 1 |
---|
| 60 | fi |
---|
[e24f13a] | 61 | fi |
---|
| 62 | AC_DEFINE_UNQUOTED(CFA_BACKEND_CC, "${BACKEND_CC}", [Location of include files.]) |
---|
| 63 | AC_SUBST(CFA_BACKEND_CC) |
---|
[5d6ce1f] | 64 | |
---|
[9def87a] | 65 | |
---|
| 66 | |
---|
| 67 | AC_ARG_ENABLE(target-release, AS_HELP_STRING([--enable-target-release], [Build and install the release target])) |
---|
| 68 | AC_ARG_ENABLE(target-debug, AS_HELP_STRING([--enable-target-debug], [Build and install the debug target])) |
---|
[facc44f] | 69 | AC_ARG_ENABLE(threading, AS_HELP_STRING([--enable-threading], [Build and install libcfa with threading support (Enabled by default)]), |
---|
| 70 | [case "${enableval}" in |
---|
[a62cbb3] | 71 | yes) build_threading="yes" ;; |
---|
[facc44f] | 72 | no) build_threading="no" ;; |
---|
| 73 | *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;; |
---|
| 74 | esac],[build_threading="yes"]) |
---|
[9def87a] | 75 | |
---|
| 76 | case "$enable_target_release" in |
---|
| 77 | yes) |
---|
| 78 | case "$enable_target_debug" in |
---|
| 79 | yes) |
---|
| 80 | build_release="yes" |
---|
| 81 | build_debug="yes" |
---|
| 82 | ;; |
---|
| 83 | no) |
---|
| 84 | build_release="yes" |
---|
| 85 | build_debug="no" |
---|
| 86 | ;; |
---|
| 87 | *) |
---|
| 88 | build_release="yes" |
---|
| 89 | build_debug="no" |
---|
| 90 | ;; |
---|
| 91 | esac |
---|
| 92 | ;; |
---|
| 93 | no) |
---|
| 94 | case "$enable_target_debug" in |
---|
| 95 | yes) |
---|
| 96 | build_release="no" |
---|
| 97 | build_debug="yes" |
---|
| 98 | ;; |
---|
| 99 | no) |
---|
[24f4671] | 100 | build_release="no" |
---|
| 101 | build_debug="no" |
---|
[9def87a] | 102 | ;; |
---|
| 103 | *) |
---|
| 104 | build_release="no" |
---|
| 105 | build_debug="yes" |
---|
| 106 | ;; |
---|
| 107 | esac |
---|
| 108 | ;; |
---|
| 109 | *) |
---|
| 110 | case "$enable_target_debug" in |
---|
| 111 | yes) |
---|
| 112 | build_release="no" |
---|
| 113 | build_debug="yes" |
---|
| 114 | ;; |
---|
| 115 | no) |
---|
| 116 | build_release="yes" |
---|
| 117 | build_debug="no" |
---|
| 118 | ;; |
---|
| 119 | *) |
---|
| 120 | build_release="yes" |
---|
| 121 | build_debug="yes" |
---|
| 122 | ;; |
---|
| 123 | esac |
---|
| 124 | ;; |
---|
| 125 | esac |
---|
| 126 | |
---|
| 127 | AM_CONDITIONAL([BUILD_RELEASE], [test "x$build_release" = "xyes"]) |
---|
| 128 | AM_CONDITIONAL([BUILD_DEBUG], [test "x$build_debug" = "xyes"]) |
---|
[24f4671] | 129 | AM_CONDITIONAL([BUILD_NO_LIB], [test "x$build_release$build_debug" = "xnono"]) |
---|
[facc44f] | 130 | AM_CONDITIONAL([BUILD_CONCURRENCY], [test "x$build_threading" = "xyes"]) |
---|
[9def87a] | 131 | |
---|
[05f4b85] | 132 | DOifskipcompile='ifeq ($(skipcompile),yes) |
---|
| 133 | else' |
---|
| 134 | AC_SUBST([DOifskipcompile]) |
---|
| 135 | AM_SUBST_NOTMAKE([DOifskipcompile]) |
---|
| 136 | |
---|
| 137 | DOendif='endif' |
---|
| 138 | AC_SUBST([DOendif]) |
---|
| 139 | AM_SUBST_NOTMAKE([DOendif]) |
---|
| 140 | |
---|
[5d6ce1f] | 141 | if test "x$prefix" = "xNONE"; then |
---|
[00cc023] | 142 | cfa_prefix=${ac_default_prefix} |
---|
[5d6ce1f] | 143 | else |
---|
[00cc023] | 144 | cfa_prefix=${prefix} |
---|
[ef7d253] | 145 | fi |
---|
[d3b7937] | 146 | AC_DEFINE_UNQUOTED(CFA_PREFIX, "${cfa_prefix}", [Location of cfa install.]) |
---|
[00cc023] | 147 | AC_SUBST(CFA_PREFIX, ${cfa_prefix}) |
---|
[5d6ce1f] | 148 | |
---|
| 149 | if test "$includedir" = '${prefix}/include'; then |
---|
[df47e2f] | 150 | cfa_incdir="${cfa_prefix}/include/${cfa_name}" |
---|
[5d6ce1f] | 151 | else |
---|
[faf8857] | 152 | cfa_incdir=${includedir} |
---|
[ef7d253] | 153 | fi |
---|
[5d6ce1f] | 154 | AC_DEFINE_UNQUOTED(CFA_INCDIR, "${cfa_incdir}", [Location of include files.]) |
---|
[00cc023] | 155 | AC_SUBST(CFA_INCDIR, ${cfa_incdir}) |
---|
[5d6ce1f] | 156 | |
---|
| 157 | if test "$bindir" = '${exec_prefix}/bin'; then |
---|
| 158 | cfa_bindir="${cfa_prefix}/bin" |
---|
| 159 | else |
---|
| 160 | cfa_bindir=${bindir} |
---|
[ef7d253] | 161 | fi |
---|
[5d6ce1f] | 162 | AC_DEFINE_UNQUOTED(CFA_BINDIR, "${cfa_bindir}", [Location of cfa command.]) |
---|
[00cc023] | 163 | AC_SUBST(CFA_BINDIR, ${cfa_bindir}) |
---|
[5d6ce1f] | 164 | |
---|
| 165 | if test "$libdir" = '${exec_prefix}/lib'; then |
---|
[df47e2f] | 166 | cfa_libdir="${cfa_prefix}/lib/${cfa_name}" |
---|
[5d6ce1f] | 167 | else |
---|
| 168 | cfa_libdir=${libdir} |
---|
[ef7d253] | 169 | fi |
---|
[5d6ce1f] | 170 | AC_DEFINE_UNQUOTED(CFA_LIBDIR, "${cfa_libdir}", [Location of cc1 and cfa-cpp commands.]) |
---|
[00cc023] | 171 | AC_SUBST(CFA_LIBDIR, ${cfa_libdir}) |
---|
[5d6ce1f] | 172 | |
---|
[3f414ef] | 173 | AC_CANONICAL_BUILD |
---|
[e4745d7a] | 174 | AC_CANONICAL_HOST |
---|
| 175 | AC_SUBST([MACHINE_TYPE],[$host_cpu]) |
---|
| 176 | |
---|
[4ec769c] | 177 | if ! test "$host_cpu" = "$build_cpu"; then |
---|
[3f414ef] | 178 | case $host_cpu in |
---|
| 179 | i386) |
---|
[4ec769c] | 180 | CFLAGS+=" -m32 " |
---|
| 181 | CXXFLAGS+=" -m32 " |
---|
| 182 | CFAFLAGS+=" -m32 " |
---|
| 183 | LDFLAGS+=" -m32 " |
---|
[3f414ef] | 184 | ;; |
---|
| 185 | i686) |
---|
[4ec769c] | 186 | CFLAGS+=" -m32 " |
---|
| 187 | CXXFLAGS+=" -m32 " |
---|
| 188 | CFAFLAGS+=" -m32 " |
---|
| 189 | LDFLAGS+=" -m32 " |
---|
[3f414ef] | 190 | ;; |
---|
| 191 | x86_64) |
---|
[4ec769c] | 192 | CFLAGS+=" -m64 " |
---|
| 193 | CXXFLAGS+=" -m64 " |
---|
| 194 | CFAFLAGS+=" -m64 " |
---|
| 195 | LDFLAGS+=" -m64 " |
---|
[3f414ef] | 196 | ;; |
---|
| 197 | esac |
---|
| 198 | fi |
---|
| 199 | |
---|
| 200 | AC_DEFINE_UNQUOTED(CFA_FLAGS, "${CFAFLAGS}", [compilation flags for cfa libraries and test programs.]) |
---|
| 201 | AC_SUBST(CFA_FLAGS, ${CFAFLAGS}) |
---|
| 202 | |
---|
[5d6ce1f] | 203 | # Checks for programs. |
---|
| 204 | AC_PROG_CXX |
---|
| 205 | AC_PROG_CC |
---|
[8e5724e] | 206 | AM_PROG_AS |
---|
[00cc023] | 207 | AM_PROG_CC_C_O # deprecated |
---|
[c3a4385] | 208 | # These are often not installed and people miss seeing the "no", so stop the configure. |
---|
[56c3935] | 209 | AC_PROG_YACC |
---|
[c3a4385] | 210 | if test "${YACC}" = "yacc" ; then echo "Error: bison required." ; exit 1 ; fi |
---|
[56c3935] | 211 | AC_PROG_LEX |
---|
[c3a4385] | 212 | if test "${LEX}" = "lex" ; then echo "Error: flex required." ; exit 1 ; fi |
---|
[5d6ce1f] | 213 | AC_PROG_INSTALL |
---|
| 214 | AC_PROG_MAKE_SET |
---|
[00cc023] | 215 | AC_PROG_RANLIB |
---|
[5d6ce1f] | 216 | |
---|
| 217 | # Checks for libraries. |
---|
| 218 | |
---|
| 219 | # Checks for header files. |
---|
| 220 | AC_FUNC_ALLOCA |
---|
| 221 | AC_CHECK_HEADERS([fenv.h float.h inttypes.h libintl.h limits.h malloc.h stddef.h stdlib.h string.h unistd.h]) |
---|
| 222 | |
---|
| 223 | # Checks for typedefs, structures, and compiler characteristics. |
---|
| 224 | AC_HEADER_STDBOOL |
---|
| 225 | AC_C_INLINE |
---|
| 226 | AC_TYPE_INT16_T |
---|
| 227 | AC_TYPE_INT32_T |
---|
| 228 | AC_TYPE_INT8_T |
---|
| 229 | AC_C_RESTRICT |
---|
| 230 | AC_TYPE_SIZE_T |
---|
| 231 | AC_TYPE_UINT16_T |
---|
| 232 | AC_TYPE_UINT32_T |
---|
| 233 | AC_TYPE_UINT8_T |
---|
| 234 | |
---|
| 235 | # Checks for library functions. |
---|
| 236 | AC_CHECK_FUNCS([memset putenv strchr strtol]) |
---|
| 237 | |
---|
[00cc023] | 238 | AC_CONFIG_FILES([ |
---|
| 239 | Makefile |
---|
[6e7e2b36] | 240 | src/driver/Makefile |
---|
[00cc023] | 241 | src/Makefile |
---|
[ac93b228] | 242 | src/benchmark/Makefile |
---|
[00cc023] | 243 | src/examples/Makefile |
---|
[ef7d253] | 244 | src/tests/Makefile |
---|
[cc3e4d0] | 245 | src/tests/preempt_longrun/Makefile |
---|
[375a068] | 246 | src/prelude/Makefile |
---|
[6e7e2b36] | 247 | src/libcfa/Makefile |
---|
[4149d9d] | 248 | tools/Makefile |
---|
[2b7afbd] | 249 | tools/prettyprinter/Makefile |
---|
[00cc023] | 250 | ]) |
---|
[5d6ce1f] | 251 | |
---|
[56de5932] | 252 | AC_CONFIG_LINKS([src/tests/test.py:src/tests/test.py]) |
---|
| 253 | |
---|
[3a8cc12] | 254 | AC_OUTPUT(src/tests/config.py) |
---|
[7e91d4f] | 255 | |
---|
[9def87a] | 256 | AM_COND_IF([BUILD_RELEASE], |
---|
| 257 | [AM_COND_IF([BUILD_DEBUG], |
---|
| 258 | [AC_MSG_NOTICE(Building libcfa for target: release & debug)], |
---|
| 259 | [AC_MSG_NOTICE(Building libcfa for target: release)])], |
---|
[24f4671] | 260 | [AM_COND_IF([BUILD_DEBUG], |
---|
| 261 | [AC_MSG_NOTICE(Building libcfa for target: debug)], |
---|
| 262 | [AC_MSG_NOTICE(Running cfa without libcfa)])]) |
---|
[9def87a] | 263 | |
---|
[5d6ce1f] | 264 | # Final text |
---|
| 265 | AC_MSG_RESULT(Cforall configuraton completed. Type "make -j 8 install".) |
---|