| 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])
|
|---|
| 6 | AC_CONFIG_AUX_DIR([automake])
|
|---|
| 7 | AC_CONFIG_MACRO_DIRS([automake])
|
|---|
| 8 | AM_SILENT_RULES([yes])
|
|---|
| 9 |
|
|---|
| 10 | m4_include([../automake/cfa.m4])
|
|---|
| 11 |
|
|---|
| 12 | AM_INIT_AUTOMAKE([subdir-objects])
|
|---|
| 13 |
|
|---|
| 14 | # don't use the default CFLAGS as they unconditonnaly add -O2
|
|---|
| 15 | : ${CFLAGS=""}
|
|---|
| 16 |
|
|---|
| 17 | # define this to override
|
|---|
| 18 | AR_FLAGS="cr"
|
|---|
| 19 |
|
|---|
| 20 | # Allow program name tansformation
|
|---|
| 21 | # will fill program_transform_name with appropriate sed regex
|
|---|
| 22 | AC_ARG_PROGRAM
|
|---|
| 23 |
|
|---|
| 24 | AC_ARG_VAR(ARCHITECTURE, [The architecture to use when building libcfa])
|
|---|
| 25 | AC_ARG_VAR(CONFIGURATION, [The configuration to use when building libcfa, options are: deubg, nodebug, nolib (prelude-only)])
|
|---|
| 26 | AC_ARG_VAR(DRIVER_DIR, [The path to the cforall driver directory])
|
|---|
| 27 | AC_ARG_VAR(CFA_VERSION, [The long version of cfa])
|
|---|
| 28 |
|
|---|
| 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 | CFACPP=${DRIVER_DIR}cfa-cpp
|
|---|
| 37 | PRELUDEFLAG='-in-tree'
|
|---|
| 38 | echo "no"
|
|---|
| 39 | else
|
|---|
| 40 | path=$(readlink -f .)
|
|---|
| 41 | CFADIR_HASH=$(openssl dgst -sha256 <<< $path)
|
|---|
| 42 | CFADIR_HASH="${CFADIR_HASH: -10}"
|
|---|
| 43 | CFACC="/home/tdelisle/workspace/master-cforall/main/tools/build/distcc ~/.cfadistcc/${CFADIR_HASH}/g++"
|
|---|
| 44 | CFACPP="/home/tdelisle/workspace/master-cforall/main/tools/build/distcc ~/.cfadistcc/${CFADIR_HASH}/cfa-cpp"
|
|---|
| 45 | PRELUDEFLAG='-dist-tree'
|
|---|
| 46 | echo "yes (hash=${CFADIR_HASH})"
|
|---|
| 47 | fi
|
|---|
| 48 | LOCAL_CFACC=${DRIVER_DIR}cfa
|
|---|
| 49 | LOCAL_CFACPP=${DRIVER_DIR}cfa-cpp
|
|---|
| 50 |
|
|---|
| 51 | AM_CONDITIONAL([ENABLE_DISTCC], [test x$enable_distcc = xyes])
|
|---|
| 52 |
|
|---|
| 53 | AC_SUBST(CFACC)
|
|---|
| 54 | AC_SUBST(CFACPP)
|
|---|
| 55 | AC_SUBST(LOCAL_CFACC)
|
|---|
| 56 | AC_SUBST(LOCAL_CFACPP)
|
|---|
| 57 | AC_SUBST(CFADIR_HASH)
|
|---|
| 58 | AC_SUBST(CFA_VERSION)
|
|---|
| 59 | AC_SUBST(PRELUDEFLAG)
|
|---|
| 60 |
|
|---|
| 61 | #==============================================================================
|
|---|
| 62 | #Handle specific flags
|
|---|
| 63 | case $ARCHITECTURE in
|
|---|
| 64 | "x64" ) ARCH_FLAGS="-m64";;
|
|---|
| 65 | "x86" ) ARCH_FLAGS="-m32";;
|
|---|
| 66 | "arm" ) ARCH_FLAGS="";;
|
|---|
| 67 | esac
|
|---|
| 68 |
|
|---|
| 69 | AC_SUBST(ARCH_FLAGS)
|
|---|
| 70 |
|
|---|
| 71 | case $CONFIGURATION in
|
|---|
| 72 | "debug" )
|
|---|
| 73 | CONFIG_CFLAGS="-Og -g"
|
|---|
| 74 | CONFIG_CFAFLAGS="-debug"
|
|---|
| 75 | CONFIG_BUILDLIB="yes"
|
|---|
| 76 | ;;
|
|---|
| 77 | "nodebug" )
|
|---|
| 78 | CONFIG_CFLAGS="-O3 -s"
|
|---|
| 79 | CONFIG_CFAFLAGS="-nodebug"
|
|---|
| 80 | CONFIG_BUILDLIB="yes"
|
|---|
| 81 | ;;
|
|---|
| 82 | "nolib" )
|
|---|
| 83 | CONFIG_CFLAGS="-O3 -s"
|
|---|
| 84 | CONFIG_CFAFLAGS="-nolib"
|
|---|
| 85 | CONFIG_BUILDLIB="no"
|
|---|
| 86 | ;;
|
|---|
| 87 | "profile" )
|
|---|
| 88 | CONFIG_CFLAGS="-O3 -g -fno-omit-frame-pointer"
|
|---|
| 89 | CONFIG_CFAFLAGS="-nodebug"
|
|---|
| 90 | CONFIG_BUILDLIB="yes"
|
|---|
| 91 | ;;
|
|---|
| 92 | *)
|
|---|
| 93 | AC_MSG_ERROR('Invalid value $CONFIGURATION for \$CONFIGURATION')
|
|---|
| 94 | ;;
|
|---|
| 95 | esac
|
|---|
| 96 |
|
|---|
| 97 | CONFIG_CFAFLAGS="${CONFIG_CFAFLAGS} ${CFAFLAGS}"
|
|---|
| 98 |
|
|---|
| 99 | AC_SUBST(CONFIG_CFLAGS)
|
|---|
| 100 | AC_SUBST(CONFIG_CFAFLAGS)
|
|---|
| 101 | AC_SUBST(CONFIG_BUILDLIB)
|
|---|
| 102 |
|
|---|
| 103 | AM_CONDITIONAL([BUILDLIB], [test "x${CONFIG_BUILDLIB}" = "xyes"])
|
|---|
| 104 |
|
|---|
| 105 | #==============================================================================
|
|---|
| 106 | #Trasforming cc1 will break compilation
|
|---|
| 107 | M4CFA_PROGRAM_NAME
|
|---|
| 108 |
|
|---|
| 109 | #==============================================================================
|
|---|
| 110 | # Installation paths
|
|---|
| 111 | M4CFA_PARSE_PREFIX
|
|---|
| 112 |
|
|---|
| 113 | # Checks for programs.
|
|---|
| 114 | LT_INIT
|
|---|
| 115 |
|
|---|
| 116 | AC_PROG_CXX
|
|---|
| 117 | AC_PROG_CC
|
|---|
| 118 | AM_PROG_AS
|
|---|
| 119 | AC_PROG_LIBTOOL
|
|---|
| 120 | AC_PROG_INSTALL
|
|---|
| 121 | AC_PROG_MAKE_SET
|
|---|
| 122 |
|
|---|
| 123 | AC_CONFIG_FILES([
|
|---|
| 124 | Makefile
|
|---|
| 125 | src/Makefile
|
|---|
| 126 | prelude/Makefile
|
|---|
| 127 | ])
|
|---|
| 128 |
|
|---|
| 129 | AC_OUTPUT()
|
|---|
| 130 |
|
|---|
| 131 | # Final text
|
|---|
| 132 | AC_MSG_RESULT(Cforall library configuraton completed. Type "make -j 8 install".) |
|---|