[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 | |
---|
[7c6b262] | 33 | AC_ARG_WITH(bwlimit, |
---|
| 34 | [ --with-bwlimit=RATE RATE the maximum rate at which rsync will be limited when using distributed builds], |
---|
| 35 | DIST_BWLIMIT=$withval, DIST_BWLIMIT=0) |
---|
| 36 | |
---|
[bbfd0e0] | 37 | echo -n "checking for distributated build... " |
---|
| 38 | if test x$enable_distcc = xno; then |
---|
| 39 | CFACC=${DRIVER_DIR}cfa |
---|
| 40 | echo "no" |
---|
| 41 | else |
---|
[d65f92c] | 42 | tools="$(readlink -m $ac_confdir/)/../tools/build" |
---|
| 43 | config=$(basename $(readlink -f .)) |
---|
| 44 | echo "$tools/distcc_hash $config" |
---|
| 45 | CFADIR_HASH=$($tools/distcc_hash $config) |
---|
[14347ac] | 46 | CFACC="distcc ~/.cfadistcc/${CFADIR_HASH}/cfa" |
---|
[bbfd0e0] | 47 | echo "yes (hash=${CFADIR_HASH})" |
---|
| 48 | fi |
---|
[14347ac] | 49 | CFACPP=${DRIVER_DIR}cfa-cpp |
---|
[bbfd0e0] | 50 | LOCAL_CFACC=${DRIVER_DIR}cfa |
---|
[81e60f7] | 51 | LOCAL_CC1=${DRIVER_DIR}cc1 |
---|
[bbfd0e0] | 52 | |
---|
| 53 | AM_CONDITIONAL([ENABLE_DISTCC], [test x$enable_distcc = xyes]) |
---|
| 54 | |
---|
[ff1e0f38] | 55 | AC_SUBST(CFACC) |
---|
| 56 | AC_SUBST(CFACPP) |
---|
[bbfd0e0] | 57 | AC_SUBST(LOCAL_CFACC) |
---|
[81e60f7] | 58 | AC_SUBST(LOCAL_CC1) |
---|
[bbfd0e0] | 59 | AC_SUBST(CFADIR_HASH) |
---|
[c6bbcdb] | 60 | AC_SUBST(CFA_VERSION) |
---|
[7c6b262] | 61 | AC_SUBST(DIST_BWLIMIT) |
---|
[ff1e0f38] | 62 | |
---|
[575a6e5] | 63 | #============================================================================== |
---|
| 64 | #Handle specific flags |
---|
[37fe352] | 65 | case $ARCHITECTURE in |
---|
| 66 | "x64" ) ARCH_FLAGS="-m64";; |
---|
| 67 | "x86" ) ARCH_FLAGS="-m32";; |
---|
| 68 | "arm" ) ARCH_FLAGS="";; |
---|
| 69 | esac |
---|
[ff1e0f38] | 70 | |
---|
[37fe352] | 71 | AC_SUBST(ARCH_FLAGS) |
---|
[ff1e0f38] | 72 | |
---|
[575a6e5] | 73 | case $CONFIGURATION in |
---|
| 74 | "debug" ) |
---|
[c8c0c7c5] | 75 | CONFIG_CFLAGS="-O0 -g" |
---|
[575a6e5] | 76 | CONFIG_CFAFLAGS="-debug" |
---|
[e523b07] | 77 | CONFIG_BUILDLIB="yes" |
---|
[575a6e5] | 78 | ;; |
---|
| 79 | "nodebug" ) |
---|
[3fcbdca1] | 80 | CONFIG_CFLAGS="-O3 -s" |
---|
[575a6e5] | 81 | CONFIG_CFAFLAGS="-nodebug" |
---|
[e523b07] | 82 | CONFIG_BUILDLIB="yes" |
---|
[575a6e5] | 83 | ;; |
---|
| 84 | "nolib" ) |
---|
[3fcbdca1] | 85 | CONFIG_CFLAGS="-O3 -s" |
---|
[c9e640e] | 86 | CONFIG_CFAFLAGS="-nolib" |
---|
[e523b07] | 87 | CONFIG_BUILDLIB="no" |
---|
[575a6e5] | 88 | ;; |
---|
[3fcbdca1] | 89 | "profile" ) |
---|
| 90 | CONFIG_CFLAGS="-O3 -g -fno-omit-frame-pointer" |
---|
| 91 | CONFIG_CFAFLAGS="-nodebug" |
---|
| 92 | CONFIG_BUILDLIB="yes" |
---|
| 93 | ;; |
---|
[d119b984] | 94 | *) |
---|
| 95 | AC_MSG_ERROR('Invalid value $CONFIGURATION for \$CONFIGURATION') |
---|
| 96 | ;; |
---|
[575a6e5] | 97 | esac |
---|
| 98 | |
---|
[13363f4] | 99 | CONFIG_CFAFLAGS="${CONFIG_CFAFLAGS} ${CFAFLAGS}" |
---|
| 100 | |
---|
[575a6e5] | 101 | AC_SUBST(CONFIG_CFLAGS) |
---|
| 102 | AC_SUBST(CONFIG_CFAFLAGS) |
---|
[e523b07] | 103 | AC_SUBST(CONFIG_BUILDLIB) |
---|
| 104 | |
---|
| 105 | AM_CONDITIONAL([BUILDLIB], [test "x${CONFIG_BUILDLIB}" = "xyes"]) |
---|
[575a6e5] | 106 | |
---|
[37fe352] | 107 | #============================================================================== |
---|
| 108 | #Trasforming cc1 will break compilation |
---|
| 109 | M4CFA_PROGRAM_NAME |
---|
[ff1e0f38] | 110 | |
---|
[37fe352] | 111 | #============================================================================== |
---|
| 112 | # Installation paths |
---|
| 113 | M4CFA_PARSE_PREFIX |
---|
[c59712e] | 114 | |
---|
| 115 | # Checks for programs. |
---|
[04bc1c0] | 116 | LT_INIT([disable-static]) |
---|
[38d12e7] | 117 | |
---|
[c59712e] | 118 | AC_PROG_CXX |
---|
| 119 | AC_PROG_CC |
---|
| 120 | AM_PROG_AS |
---|
[107b01a] | 121 | AC_PROG_LIBTOOL |
---|
[c59712e] | 122 | AC_PROG_INSTALL |
---|
| 123 | AC_PROG_MAKE_SET |
---|
| 124 | |
---|
[72828a8] | 125 | AC_CHECK_HEADERS([linux/io_uring.h]) |
---|
[08a994e] | 126 | AC_CHECK_FUNCS([preadv2 pwritev2]) |
---|
[27273f9] | 127 | |
---|
[c59712e] | 128 | AC_CONFIG_FILES([ |
---|
| 129 | Makefile |
---|
| 130 | src/Makefile |
---|
| 131 | prelude/Makefile |
---|
| 132 | ]) |
---|
| 133 | |
---|
[c680a4b] | 134 | AC_CONFIG_HEADERS(prelude/defines.hfa) |
---|
| 135 | |
---|
[c59712e] | 136 | AC_OUTPUT() |
---|
| 137 | |
---|
| 138 | # Final text |
---|
[27273f9] | 139 | AC_MSG_RESULT(Cforall library configuraton completed. Type "make -j 8 install".) |
---|