[5d6ce1f] | 1 | # -*- Autoconf -*- |
---|
| 2 | # Process this file with autoconf to produce a configure script. |
---|
| 3 | |
---|
| 4 | AC_PREREQ([2.68]) |
---|
[42336618] | 5 | AC_INIT([cfa-cc],[1.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 | |
---|
[ec129c4] | 20 | AC_DEFINE(CFA_VERSION_MAJOR, "1", [Major version number.]) |
---|
| 21 | AC_DEFINE(CFA_VERSION_MINOR, "0", [Minor version number.]) |
---|
| 22 | AC_DEFINE(CFA_VERSION_PATCH, "0", [Patch version number.]) |
---|
| 23 | |
---|
[5d6ce1f] | 24 | # Installation paths |
---|
| 25 | |
---|
[ef7d253] | 26 | AC_ARG_WITH(backend-compiler, |
---|
| 27 | [ --with-backend-compiler=PROGRAM PROGRAM that performs the final code compilation (must be gcc-compatible) ], |
---|
[e24f13a] | 28 | backendcompiler=$withval, backendcompiler="") |
---|
[6e4b913] | 29 | if test "x$backendcompiler" != "x"; then |
---|
[e24f13a] | 30 | BACKEND_CC=${backendcompiler} |
---|
| 31 | else |
---|
[6e4b913] | 32 | AC_PATH_PROG(BACKEND_CC, gcc, []) # check gcc installed |
---|
[e24f13a] | 33 | if test "x$BACKEND_CC" = "x"; then |
---|
[00cc023] | 34 | AC_MSG_ERROR(some version of gcc is needed. Get it at ftp://ftp.gnu.org) |
---|
| 35 | exit 1 |
---|
| 36 | fi |
---|
[e24f13a] | 37 | fi |
---|
| 38 | AC_DEFINE_UNQUOTED(CFA_BACKEND_CC, "${BACKEND_CC}", [Location of include files.]) |
---|
| 39 | AC_SUBST(CFA_BACKEND_CC) |
---|
[5d6ce1f] | 40 | |
---|
| 41 | if test "x$prefix" = "xNONE"; then |
---|
[00cc023] | 42 | cfa_prefix=${ac_default_prefix} |
---|
[5d6ce1f] | 43 | else |
---|
[00cc023] | 44 | cfa_prefix=${prefix} |
---|
[ef7d253] | 45 | fi |
---|
[d3b7937] | 46 | AC_DEFINE_UNQUOTED(CFA_PREFIX, "${cfa_prefix}", [Location of cfa install.]) |
---|
[00cc023] | 47 | AC_SUBST(CFA_PREFIX, ${cfa_prefix}) |
---|
[5d6ce1f] | 48 | |
---|
| 49 | if test "$includedir" = '${prefix}/include'; then |
---|
| 50 | cfa_incdir="${cfa_prefix}/include" |
---|
| 51 | else |
---|
[faf8857] | 52 | cfa_incdir=${includedir} |
---|
[ef7d253] | 53 | fi |
---|
[5d6ce1f] | 54 | AC_DEFINE_UNQUOTED(CFA_INCDIR, "${cfa_incdir}", [Location of include files.]) |
---|
[00cc023] | 55 | AC_SUBST(CFA_INCDIR, ${cfa_incdir}) |
---|
[5d6ce1f] | 56 | |
---|
| 57 | if test "$bindir" = '${exec_prefix}/bin'; then |
---|
| 58 | cfa_bindir="${cfa_prefix}/bin" |
---|
| 59 | else |
---|
| 60 | cfa_bindir=${bindir} |
---|
[ef7d253] | 61 | fi |
---|
[5d6ce1f] | 62 | AC_DEFINE_UNQUOTED(CFA_BINDIR, "${cfa_bindir}", [Location of cfa command.]) |
---|
[00cc023] | 63 | AC_SUBST(CFA_BINDIR, ${cfa_bindir}) |
---|
[5d6ce1f] | 64 | |
---|
| 65 | if test "$libdir" = '${exec_prefix}/lib'; then |
---|
| 66 | cfa_libdir=${cfa_prefix}/lib |
---|
| 67 | else |
---|
| 68 | cfa_libdir=${libdir} |
---|
[ef7d253] | 69 | fi |
---|
[5d6ce1f] | 70 | AC_DEFINE_UNQUOTED(CFA_LIBDIR, "${cfa_libdir}", [Location of cc1 and cfa-cpp commands.]) |
---|
[00cc023] | 71 | AC_SUBST(CFA_LIBDIR, ${cfa_libdir}) |
---|
[5d6ce1f] | 72 | |
---|
[6e4b913] | 73 | AC_DEFINE_UNQUOTED(CFA_FLAGS, "${CFAFLAGS}", [compilation flags for cfa libraries and test programs.]) |
---|
| 74 | AC_SUBST(CFA_FLAGS, ${CFAFLAGS}) |
---|
| 75 | |
---|
[5d6ce1f] | 76 | # Checks for programs. |
---|
| 77 | AC_PROG_CXX |
---|
| 78 | AC_PROG_CC |
---|
[00cc023] | 79 | AM_PROG_CC_C_O # deprecated |
---|
[c3a4385] | 80 | # These are often not installed and people miss seeing the "no", so stop the configure. |
---|
[56c3935] | 81 | AC_PROG_YACC |
---|
[c3a4385] | 82 | if test "${YACC}" = "yacc" ; then echo "Error: bison required." ; exit 1 ; fi |
---|
[56c3935] | 83 | AC_PROG_LEX |
---|
[c3a4385] | 84 | if test "${LEX}" = "lex" ; then echo "Error: flex required." ; exit 1 ; fi |
---|
[5d6ce1f] | 85 | AC_PROG_INSTALL |
---|
| 86 | AC_PROG_MAKE_SET |
---|
[00cc023] | 87 | AC_PROG_RANLIB |
---|
[5d6ce1f] | 88 | |
---|
| 89 | # Checks for libraries. |
---|
| 90 | |
---|
| 91 | # Checks for header files. |
---|
| 92 | AC_FUNC_ALLOCA |
---|
| 93 | AC_CHECK_HEADERS([fenv.h float.h inttypes.h libintl.h limits.h malloc.h stddef.h stdlib.h string.h unistd.h]) |
---|
| 94 | |
---|
| 95 | # Checks for typedefs, structures, and compiler characteristics. |
---|
| 96 | AC_HEADER_STDBOOL |
---|
| 97 | AC_C_INLINE |
---|
| 98 | AC_TYPE_INT16_T |
---|
| 99 | AC_TYPE_INT32_T |
---|
| 100 | AC_TYPE_INT8_T |
---|
| 101 | AC_C_RESTRICT |
---|
| 102 | AC_TYPE_SIZE_T |
---|
| 103 | AC_TYPE_UINT16_T |
---|
| 104 | AC_TYPE_UINT32_T |
---|
| 105 | AC_TYPE_UINT8_T |
---|
| 106 | |
---|
| 107 | # Checks for library functions. |
---|
| 108 | AC_CHECK_FUNCS([memset putenv strchr strtol]) |
---|
| 109 | |
---|
[00cc023] | 110 | AC_CONFIG_FILES([ |
---|
| 111 | Makefile |
---|
[6e7e2b36] | 112 | src/driver/Makefile |
---|
[00cc023] | 113 | src/Makefile |
---|
| 114 | src/examples/Makefile |
---|
[ef7d253] | 115 | src/tests/Makefile |
---|
[6e7e2b36] | 116 | src/libcfa/Makefile |
---|
[00cc023] | 117 | ]) |
---|
[5d6ce1f] | 118 | |
---|
| 119 | AC_OUTPUT |
---|
[7e91d4f] | 120 | |
---|
[5d6ce1f] | 121 | # Final text |
---|
| 122 | AC_MSG_RESULT(Cforall configuraton completed. Type "make -j 8 install".) |
---|