[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]) |
---|
| 9 | |
---|
[90c3b1c] | 10 | if test "x${CXXFLAGS}" = "x"; then |
---|
| 11 | export CXXFLAGS="-std=c++11 -g -O2 ${CXXFLAGS}" |
---|
| 12 | else |
---|
| 13 | export CXXFLAGS="-std=c++11 ${CXXFLAGS}" |
---|
| 14 | fi |
---|
| 15 | |
---|
[00cc023] | 16 | AM_INIT_AUTOMAKE |
---|
[a61fea9a] | 17 | AM_MAINTAINER_MODE(enable) # may require auto* software to be installed |
---|
[00cc023] | 18 | |
---|
[5d6ce1f] | 19 | # Installation paths |
---|
| 20 | |
---|
| 21 | AC_ARG_WITH(backend-compiler, |
---|
| 22 | [ --with-backend-compiler=PROGRAM PROGRAM that performs the final code compilation (must be gcc-compatible) ], |
---|
| 23 | backcompiler=$withval, backcompiler="") |
---|
| 24 | if test x$backcompiler != x; then |
---|
[00cc023] | 25 | AC_DEFINE_UNQUOTED(GCC_PATH, "${backcompiler}") |
---|
| 26 | BACKEND_CC=${backcompiler} |
---|
[5d6ce1f] | 27 | else |
---|
[00cc023] | 28 | AC_PATH_PROG(GCC_PATH, gcc, N/A) |
---|
| 29 | if test "$GCC_PATH" = "N/A"; then |
---|
| 30 | AC_MSG_ERROR(some version of gcc is needed. Get it at ftp://ftp.gnu.org) |
---|
| 31 | exit 1 |
---|
| 32 | fi |
---|
| 33 | AC_DEFINE_UNQUOTED(GCC_PATH, "${GCC_PATH}", [Path/name of C compiler.]) |
---|
| 34 | BACKEND_CC=${GCC_PATH} |
---|
[5d6ce1f] | 35 | fi |
---|
| 36 | AC_SUBST(BACKEND_CC) |
---|
| 37 | |
---|
| 38 | if test "x$prefix" = "xNONE"; then |
---|
[00cc023] | 39 | cfa_prefix=${ac_default_prefix} |
---|
[5d6ce1f] | 40 | else |
---|
[00cc023] | 41 | cfa_prefix=${prefix} |
---|
[5d6ce1f] | 42 | fi |
---|
[d3b7937] | 43 | AC_DEFINE_UNQUOTED(CFA_PREFIX, "${cfa_prefix}", [Location of cfa install.]) |
---|
[00cc023] | 44 | AC_SUBST(CFA_PREFIX, ${cfa_prefix}) |
---|
[5d6ce1f] | 45 | |
---|
| 46 | if test "$includedir" = '${prefix}/include'; then |
---|
| 47 | cfa_incdir="${cfa_prefix}/include" |
---|
| 48 | else |
---|
[faf8857] | 49 | cfa_incdir=${includedir} |
---|
[5d6ce1f] | 50 | fi |
---|
| 51 | AC_DEFINE_UNQUOTED(CFA_INCDIR, "${cfa_incdir}", [Location of include files.]) |
---|
[00cc023] | 52 | AC_SUBST(CFA_INCDIR, ${cfa_incdir}) |
---|
[5d6ce1f] | 53 | |
---|
| 54 | if test "$bindir" = '${exec_prefix}/bin'; then |
---|
| 55 | cfa_bindir="${cfa_prefix}/bin" |
---|
| 56 | else |
---|
| 57 | cfa_bindir=${bindir} |
---|
| 58 | fi |
---|
| 59 | AC_DEFINE_UNQUOTED(CFA_BINDIR, "${cfa_bindir}", [Location of cfa command.]) |
---|
[00cc023] | 60 | AC_SUBST(CFA_BINDIR, ${cfa_bindir}) |
---|
[5d6ce1f] | 61 | |
---|
| 62 | if test "$libdir" = '${exec_prefix}/lib'; then |
---|
| 63 | cfa_libdir=${cfa_prefix}/lib |
---|
| 64 | else |
---|
| 65 | cfa_libdir=${libdir} |
---|
| 66 | fi |
---|
| 67 | AC_DEFINE_UNQUOTED(CFA_LIBDIR, "${cfa_libdir}", [Location of cc1 and cfa-cpp commands.]) |
---|
[00cc023] | 68 | AC_SUBST(CFA_LIBDIR, ${cfa_libdir}) |
---|
[5d6ce1f] | 69 | |
---|
| 70 | # Checks for programs. |
---|
| 71 | AC_PROG_CXX |
---|
| 72 | AC_PROG_CC |
---|
[00cc023] | 73 | AM_PROG_CC_C_O # deprecated |
---|
[c3a4385] | 74 | # These are often not installed and people miss seeing the "no", so stop the configure. |
---|
[56c3935] | 75 | AC_PROG_YACC |
---|
[c3a4385] | 76 | if test "${YACC}" = "yacc" ; then echo "Error: bison required." ; exit 1 ; fi |
---|
[56c3935] | 77 | AC_PROG_LEX |
---|
[c3a4385] | 78 | if test "${LEX}" = "lex" ; then echo "Error: flex required." ; exit 1 ; fi |
---|
[5d6ce1f] | 79 | AC_PROG_INSTALL |
---|
| 80 | AC_PROG_MAKE_SET |
---|
[00cc023] | 81 | AC_PROG_RANLIB |
---|
[5d6ce1f] | 82 | |
---|
| 83 | # Checks for libraries. |
---|
| 84 | |
---|
| 85 | # Checks for header files. |
---|
| 86 | AC_FUNC_ALLOCA |
---|
| 87 | AC_CHECK_HEADERS([fenv.h float.h inttypes.h libintl.h limits.h malloc.h stddef.h stdlib.h string.h unistd.h]) |
---|
| 88 | |
---|
| 89 | # Checks for typedefs, structures, and compiler characteristics. |
---|
| 90 | AC_HEADER_STDBOOL |
---|
| 91 | AC_C_INLINE |
---|
| 92 | AC_TYPE_INT16_T |
---|
| 93 | AC_TYPE_INT32_T |
---|
| 94 | AC_TYPE_INT8_T |
---|
| 95 | AC_C_RESTRICT |
---|
| 96 | AC_TYPE_SIZE_T |
---|
| 97 | AC_TYPE_UINT16_T |
---|
| 98 | AC_TYPE_UINT32_T |
---|
| 99 | AC_TYPE_UINT8_T |
---|
| 100 | |
---|
| 101 | # Checks for library functions. |
---|
| 102 | AC_CHECK_FUNCS([memset putenv strchr strtol]) |
---|
| 103 | |
---|
[00cc023] | 104 | AC_CONFIG_FILES([ |
---|
| 105 | Makefile |
---|
[6e7e2b36] | 106 | src/driver/Makefile |
---|
[00cc023] | 107 | src/Makefile |
---|
| 108 | src/examples/Makefile |
---|
[6e7e2b36] | 109 | src/libcfa/Makefile |
---|
[00cc023] | 110 | ]) |
---|
[5d6ce1f] | 111 | |
---|
| 112 | AC_OUTPUT |
---|
[7e91d4f] | 113 | |
---|
[5d6ce1f] | 114 | # Final text |
---|
| 115 | AC_MSG_RESULT(Cforall configuraton completed. Type "make -j 8 install".) |
---|