[c59712e] | 1 | # -*- Autoconf -*- |
---|
| 2 | # Process this file with autoconf to produce a configure script. |
---|
| 3 | |
---|
| 4 | AC_PREREQ([2.68]) |
---|
| 5 | AC_INIT([cfa-cc],[1.0.0.0],[cforall@plg.uwaterloo.ca]) |
---|
[38d12e7] | 6 | AC_CONFIG_AUX_DIR([automake]) |
---|
| 7 | AC_CONFIG_MACRO_DIRS([automake]) |
---|
[575a6e5] | 8 | AM_SILENT_RULES([yes]) |
---|
[c59712e] | 9 | |
---|
[37fe352] | 10 | m4_include([../automake/cfa.m4]) |
---|
| 11 | |
---|
[c59712e] | 12 | AM_INIT_AUTOMAKE([subdir-objects]) |
---|
| 13 | |
---|
[575a6e5] | 14 | # don't use the default CFLAGS as they unconditonnaly add -O2 |
---|
| 15 | : ${CFLAGS=""} |
---|
| 16 | |
---|
[2b3d6ff] | 17 | # define this to override |
---|
| 18 | AR_FLAGS="cr" |
---|
| 19 | |
---|
[c59712e] | 20 | # Allow program name tansformation |
---|
| 21 | # will fill program_transform_name with appropriate sed regex |
---|
| 22 | AC_ARG_PROGRAM |
---|
| 23 | |
---|
[37fe352] | 24 | AC_ARG_VAR(ARCHITECTURE, [The architecture to use when building libcfa]) |
---|
[c59712e] | 25 | AC_ARG_VAR(CONFIGURATION, [The configuration to use when building libcfa, options are: deubg, nodebug, nolib (prelude-only)]) |
---|
[ff1e0f38] | 26 | AC_ARG_VAR(DRIVER_DIR, [The path to the cforall driver directory]) |
---|
[c6bbcdb] | 27 | AC_ARG_VAR(CFA_VERSION, [The long version of cfa]) |
---|
[ff1e0f38] | 28 | |
---|
[bbfd0e0] | 29 | AC_ARG_ENABLE(distcc, |
---|
| 30 | [ --enable-distcc whether or not to enable distributed compilation], |
---|
| 31 | enable_distcc=$enableval, enable_distcc=no) |
---|
| 32 | |
---|
| 33 | echo -n "checking for distributated build... " |
---|
| 34 | if test x$enable_distcc = xno; then |
---|
| 35 | CFACC=${DRIVER_DIR}cfa |
---|
| 36 | echo "no" |
---|
| 37 | else |
---|
[d65f92c] | 38 | tools="$(readlink -m $ac_confdir/)/../tools/build" |
---|
| 39 | config=$(basename $(readlink -f .)) |
---|
| 40 | echo "$tools/distcc_hash $config" |
---|
| 41 | CFADIR_HASH=$($tools/distcc_hash $config) |
---|
[14347ac] | 42 | CFACC="distcc ~/.cfadistcc/${CFADIR_HASH}/cfa" |
---|
[bbfd0e0] | 43 | echo "yes (hash=${CFADIR_HASH})" |
---|
| 44 | fi |
---|
[14347ac] | 45 | CFACPP=${DRIVER_DIR}cfa-cpp |
---|
[bbfd0e0] | 46 | LOCAL_CFACC=${DRIVER_DIR}cfa |
---|
[81e60f7] | 47 | LOCAL_CC1=${DRIVER_DIR}cc1 |
---|
[bbfd0e0] | 48 | |
---|
| 49 | AM_CONDITIONAL([ENABLE_DISTCC], [test x$enable_distcc = xyes]) |
---|
| 50 | |
---|
[ff1e0f38] | 51 | AC_SUBST(CFACC) |
---|
| 52 | AC_SUBST(CFACPP) |
---|
[bbfd0e0] | 53 | AC_SUBST(LOCAL_CFACC) |
---|
[81e60f7] | 54 | AC_SUBST(LOCAL_CC1) |
---|
[bbfd0e0] | 55 | AC_SUBST(CFADIR_HASH) |
---|
[c6bbcdb] | 56 | AC_SUBST(CFA_VERSION) |
---|
[ff1e0f38] | 57 | |
---|
[575a6e5] | 58 | #============================================================================== |
---|
| 59 | #Handle specific flags |
---|
[37fe352] | 60 | case $ARCHITECTURE in |
---|
| 61 | "x64" ) ARCH_FLAGS="-m64";; |
---|
| 62 | "x86" ) ARCH_FLAGS="-m32";; |
---|
| 63 | "arm" ) ARCH_FLAGS="";; |
---|
| 64 | esac |
---|
[ff1e0f38] | 65 | |
---|
[37fe352] | 66 | AC_SUBST(ARCH_FLAGS) |
---|
[ff1e0f38] | 67 | |
---|
[575a6e5] | 68 | case $CONFIGURATION in |
---|
| 69 | "debug" ) |
---|
[c8c0c7c5] | 70 | CONFIG_CFLAGS="-O0 -g" |
---|
[575a6e5] | 71 | CONFIG_CFAFLAGS="-debug" |
---|
[e523b07] | 72 | CONFIG_BUILDLIB="yes" |
---|
[575a6e5] | 73 | ;; |
---|
| 74 | "nodebug" ) |
---|
[3fcbdca1] | 75 | CONFIG_CFLAGS="-O3 -s" |
---|
[575a6e5] | 76 | CONFIG_CFAFLAGS="-nodebug" |
---|
[e523b07] | 77 | CONFIG_BUILDLIB="yes" |
---|
[575a6e5] | 78 | ;; |
---|
| 79 | "nolib" ) |
---|
[3fcbdca1] | 80 | CONFIG_CFLAGS="-O3 -s" |
---|
[c9e640e] | 81 | CONFIG_CFAFLAGS="-nolib" |
---|
[e523b07] | 82 | CONFIG_BUILDLIB="no" |
---|
[575a6e5] | 83 | ;; |
---|
[3fcbdca1] | 84 | "profile" ) |
---|
| 85 | CONFIG_CFLAGS="-O3 -g -fno-omit-frame-pointer" |
---|
| 86 | CONFIG_CFAFLAGS="-nodebug" |
---|
| 87 | CONFIG_BUILDLIB="yes" |
---|
| 88 | ;; |
---|
[d119b984] | 89 | *) |
---|
| 90 | AC_MSG_ERROR('Invalid value $CONFIGURATION for \$CONFIGURATION') |
---|
| 91 | ;; |
---|
[575a6e5] | 92 | esac |
---|
| 93 | |
---|
[13363f4] | 94 | CONFIG_CFAFLAGS="${CONFIG_CFAFLAGS} ${CFAFLAGS}" |
---|
| 95 | |
---|
[575a6e5] | 96 | AC_SUBST(CONFIG_CFLAGS) |
---|
| 97 | AC_SUBST(CONFIG_CFAFLAGS) |
---|
[e523b07] | 98 | AC_SUBST(CONFIG_BUILDLIB) |
---|
| 99 | |
---|
| 100 | AM_CONDITIONAL([BUILDLIB], [test "x${CONFIG_BUILDLIB}" = "xyes"]) |
---|
[575a6e5] | 101 | |
---|
[37fe352] | 102 | #============================================================================== |
---|
| 103 | #Trasforming cc1 will break compilation |
---|
| 104 | M4CFA_PROGRAM_NAME |
---|
[ff1e0f38] | 105 | |
---|
[37fe352] | 106 | #============================================================================== |
---|
| 107 | # Installation paths |
---|
| 108 | M4CFA_PARSE_PREFIX |
---|
[c59712e] | 109 | |
---|
| 110 | # Checks for programs. |
---|
[04bc1c0] | 111 | LT_INIT([disable-static]) |
---|
[38d12e7] | 112 | |
---|
[c59712e] | 113 | AC_PROG_CXX |
---|
| 114 | AC_PROG_CC |
---|
| 115 | AM_PROG_AS |
---|
[107b01a] | 116 | AC_PROG_LIBTOOL |
---|
[c59712e] | 117 | AC_PROG_INSTALL |
---|
| 118 | AC_PROG_MAKE_SET |
---|
| 119 | |
---|
[72828a8] | 120 | AC_CHECK_HEADERS([linux/io_uring.h]) |
---|
[08a994e] | 121 | AC_CHECK_FUNCS([preadv2 pwritev2]) |
---|
[27273f9] | 122 | |
---|
[c59712e] | 123 | AC_CONFIG_FILES([ |
---|
| 124 | Makefile |
---|
| 125 | src/Makefile |
---|
| 126 | prelude/Makefile |
---|
| 127 | ]) |
---|
| 128 | |
---|
[c680a4b] | 129 | AC_CONFIG_HEADERS(prelude/defines.hfa) |
---|
| 130 | |
---|
[c59712e] | 131 | AC_OUTPUT() |
---|
| 132 | |
---|
| 133 | # Final text |
---|
[27273f9] | 134 | AC_MSG_RESULT(Cforall library configuraton completed. Type "make -j 8 install".) |
---|