Changeset 455a7d5 for configure.ac


Ignore:
Timestamp:
Aug 9, 2018, 6:35:02 PM (8 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, stuck-waitfor-destruct
Children:
ea5b7d6
Parents:
fb975a50 (diff), 0c827019 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into jenkins-sandbox

File:
1 edited

Legend:

Unmodified
Added
Removed
  • configure.ac

    rfb975a50 r455a7d5  
    77#AC_CONFIG_SRCDIR([src/main.cc])
    88AC_CONFIG_HEADERS([config.h:src/config.h.in])
    9 AM_SILENT_RULES([no])
     9AM_SILENT_RULES([yes])
     10
     11m4_include([automake/cfa.m4])
     12
     13# don't use the default CFLAGS as they unconditonnaly add -O2
     14: ${CFLAGS=""}
    1015
    1116AM_INIT_AUTOMAKE([subdir-objects])
     
    1520AC_ARG_PROGRAM
    1621
     22#==============================================================================
    1723#Trasforming cc1 will break compilation
    18 if test "${program_transform_name}" = ""; then
    19     AC_MSG_ERROR([Program transform not supported.
    20                 Use --with-cfa-name='[[Desired name here]]' instead])
    21 fi
    22 
    23 AC_ARG_WITH(cfa-name,
    24         [  --with-cfa-name=NAME     NAME too which cfa will be installed],
    25         cfa_name=$withval, cfa_name="cfa")
    26 
    27 #Define the new name of the installed command
    28 AC_SUBST(CFA_NAME, ${cfa_name})
     24M4CFA_PROGRAM_NAME
     25
     26#==============================================================================
     27# version information
    2928
    3029rm -f version
     
    4645AC_DEFINE_UNQUOTED(CFA_VERSION_FULL, ["${ver_major}.${ver_minor}.${ver_patch}.${ver_build}"], [Major.Minor.Patch.Build])
    4746
    48 # Installation paths
    49 
    50 AC_ARG_WITH(backend-compiler,
    51         [  --with-backend-compiler=PROGRAM     PROGRAM that performs the final code compilation (must be gcc-compatible) ],
    52         backendcompiler=$withval, backendcompiler="")
    53 if test "x$backendcompiler" != "x"; then
    54         BACKEND_CC=${backendcompiler}
    55 else
    56         AC_PATH_PROG(BACKEND_CC, gcc, [])       # check gcc installed
    57         if test "x$BACKEND_CC" = "x"; then
    58                 AC_MSG_ERROR(some version of gcc is needed. Get it at ftp://ftp.gnu.org)
    59                 exit 1
    60         fi
    61 fi
    62 AC_DEFINE_UNQUOTED(CFA_BACKEND_CC, "${BACKEND_CC}", [Location of include files.])
    63 AC_SUBST(CFA_BACKEND_CC)
    64 
    65 
    66 
    67 AC_ARG_ENABLE(target-release, AS_HELP_STRING([--enable-target-release], [Build and install the release target]))
    68 AC_ARG_ENABLE(target-debug, AS_HELP_STRING([--enable-target-debug], [Build and install the debug target]))
    69 AC_ARG_ENABLE(threading, AS_HELP_STRING([--enable-threading], [Build and install libcfa with threading support (Enabled by default)]),
    70 [case "${enableval}" in
    71   yes) build_threading="yes" ;;
    72   no)  build_threading="no" ;;
    73   *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
    74 esac],[build_threading="yes"])
    75 
    76 case "$enable_target_release" in
    77         yes)
    78                 case "$enable_target_debug" in
    79                         yes)
    80                                 build_release="yes"
    81                                 build_debug="yes"
    82                                 ;;
    83                         no)
    84                                 build_release="yes"
    85                                 build_debug="no"
    86                                 ;;
    87                         *)
    88                                 build_release="yes"
    89                                 build_debug="no"
    90                                 ;;
    91                 esac
    92                 ;;
    93         no)
    94                 case "$enable_target_debug" in
    95                         yes)
    96                                 build_release="no"
    97                                 build_debug="yes"
    98                                 ;;
    99                         no)
    100                                 build_release="no"
    101                                 build_debug="no"
    102                                 ;;
    103                         *)
    104                                 build_release="no"
    105                                 build_debug="yes"
    106                                 ;;
    107                 esac
    108                 ;;
    109         *)
    110                 case "$enable_target_debug" in
    111                         yes)
    112                                 build_release="no"
    113                                 build_debug="yes"
    114                                 ;;
    115                         no)
    116                                 build_release="yes"
    117                                 build_debug="no"
    118                                 ;;
    119                         *)
    120                                 build_release="yes"
    121                                 build_debug="yes"
    122                                 ;;
    123                 esac
    124                 ;;
    125 esac
    126 
    127 AM_CONDITIONAL([BUILD_RELEASE], [test "x$build_release" = "xyes"])
    128 AM_CONDITIONAL([BUILD_DEBUG], [test "x$build_debug" = "xyes"])
    129 AM_CONDITIONAL([BUILD_NO_LIB], [test "x$build_release$build_debug" = "xnono"])
    130 AM_CONDITIONAL([BUILD_CONCURRENCY], [test "x$build_threading" = "xyes"])
    131 
     47#==============================================================================
     48# HACK to be able to use conditionnals inside makefiles
    13249DOifskipcompile='ifeq ($(skipcompile),yes)
    13350else'
     
    13956AM_SUBST_NOTMAKE([DOendif])
    14057
    141 if test "x$prefix" = "xNONE"; then
    142         cfa_prefix=${ac_default_prefix}
     58#==============================================================================
     59# backend compiler implementation
     60AC_ARG_WITH(backend-compiler,
     61       [  --with-backend-compiler=PROGRAM     PROGRAM that performs the final code compilation (must be gcc-compatible) ],
     62       backendcompiler=$withval, backendcompiler="")
     63if test "x$backendcompiler" != "x"; then
     64       BACKEND_CC=${backendcompiler}
    14365else
    144         cfa_prefix=${prefix}
     66       AC_PATH_PROG(BACKEND_CC, gcc, [])       # check gcc installed
     67       if test "x$BACKEND_CC" = "x"; then
     68               AC_MSG_ERROR(some version of gcc is needed. Get it at ftp://ftp.gnu.org)
     69               exit 1
     70       fi
    14571fi
    146 AC_DEFINE_UNQUOTED(CFA_PREFIX, "${cfa_prefix}", [Location of cfa install.])
    147 AC_SUBST(CFA_PREFIX, ${cfa_prefix})
    148 
    149 if test "$includedir" = '${prefix}/include'; then
    150         cfa_incdir="${cfa_prefix}/include/${cfa_name}"
    151 else
    152         cfa_incdir=${includedir}
    153 fi
    154 AC_DEFINE_UNQUOTED(CFA_INCDIR, "${cfa_incdir}", [Location of include files.])
    155 AC_SUBST(CFA_INCDIR, ${cfa_incdir})
    156 
    157 if test "$bindir" = '${exec_prefix}/bin'; then
    158         cfa_bindir="${cfa_prefix}/bin"
    159 else
    160         cfa_bindir=${bindir}
    161 fi
    162 AC_DEFINE_UNQUOTED(CFA_BINDIR, "${cfa_bindir}", [Location of cfa command.])
    163 AC_SUBST(CFA_BINDIR, ${cfa_bindir})
    164 
    165 if test "$libdir" = '${exec_prefix}/lib'; then
    166         cfa_libdir="${cfa_prefix}/lib/${cfa_name}"
    167 else
    168         cfa_libdir=${libdir}
    169 fi
    170 AC_DEFINE_UNQUOTED(CFA_LIBDIR, "${cfa_libdir}", [Location of cc1 and cfa-cpp commands.])
    171 AC_SUBST(CFA_LIBDIR, ${cfa_libdir})
    172 
     72AC_DEFINE_UNQUOTED(CFA_BACKEND_CC, "${BACKEND_CC}", [Location of include files.])
     73AC_SUBST(CFA_BACKEND_CC)
     74
     75#==============================================================================
     76# Installation paths
     77M4CFA_PARSE_PREFIX
     78
     79#==============================================================================
     80# Create variables for commonly used targets
     81
     82TOP_SRCDIR=$ac_pwd/$ac_confdir/
     83TOP_BUILDDIR=$ac_pwd/
     84
     85AC_DEFINE_UNQUOTED(TOP_SRCDIR, "$TOP_SRCDIR", [Top src directory])
     86AC_DEFINE_UNQUOTED(TOP_BUILDDIR, "$TOP_BUILDDIR", [Top build directory])
     87
     88DRIVER_DIR=${TOP_BUILDDIR}driver/
     89CFACC=${DRIVER_DIR}cfa
     90CFACPP=${DRIVER_DIR}cfa-cpp
     91AC_SUBST(DRIVER_DIR)
     92AC_SUBST(CFACC)
     93AC_SUBST(CFACPP)
     94
     95#==============================================================================
     96# Flag variables needed to build in tree
     97LIBCFA_SRC='${TOP_SRCDIR}/libcfa/src'
     98BUILD_IN_TREE_FLAGS="-XCFA -t -B${DRIVER_DIR}"
     99AC_SUBST(BUILD_IN_TREE_FLAGS)
     100
     101#==============================================================================
     102# handle the list of hosts to build for
     103for var in $ac_configure_args
     104do
     105        #strip quotes surrouding values
     106        case $var in
     107                # skip cross compilation related arguments
     108                \'--host=*) ;; \'host_alias=*) ;; \'--build=*) ;; \'build_alias=*) ;; \'--target=*) ;; \'target_alias=*) ;;
     109
     110                # skip the target hosts
     111                \'--with-target-hosts=*) ;;
     112
     113                # append all other arguments to the sub configure arguments
     114                *) LIBCFA_GENERAL_ARGS="${LIBCFA_GENERAL_ARGS} $var";;
     115        esac
     116done
     117
     118#==============================================================================
     119# handle the list of hosts to build for
    173120AC_CANONICAL_BUILD
    174121AC_CANONICAL_HOST
    175 AC_SUBST([MACHINE_TYPE],[$host_cpu])
    176 
    177 if ! test "$host_cpu" = "$build_cpu"; then
    178         case $host_cpu in
    179                 i386)
    180                         CFLAGS+=" -m32 "
    181                         CXXFLAGS+=" -m32 "
    182                         CFAFLAGS+=" -m32 "
    183                         LDFLAGS+=" -m32 "
    184                         ;;
    185                 i686)
    186                         CFLAGS+=" -m32 "
    187                   CXXFLAGS+=" -m32 "
    188                   CFAFLAGS+=" -m32 "
    189                   LDFLAGS+=" -m32 "
    190                         ;;
    191                 x86_64)
    192                         CFLAGS+=" -m64 "
    193                         CXXFLAGS+=" -m64 "
    194                         CFAFLAGS+=" -m64 "
    195                         LDFLAGS+=" -m64 "
    196                         ;;
     122
     123default_target="${host_cpu}:debug, ${host_cpu}:nodebug"
     124AC_ARG_WITH(target-hosts,
     125        [  --with-target-hosts=HOSTS     HOSTS comma seperated list of hosts to build for, format ARCH:[debug|nodebug|nolib]],
     126        target_hosts=$withval, target_hosts=${default_target})
     127
     128AC_SUBST(TARGET_HOSTS, ${target_hosts})
     129
     130LIBCFA_PATHS="DRIVER_DIR=${DRIVER_DIR}"
     131
     132for i in $(echo $target_hosts | sed "s/,/ /g")
     133do
     134        # call your procedure/other scripts here below
     135        arch_name=$(echo $i | sed -r "s/:(.*)//g")
     136        lib_config=$(echo $i | sed -r "s/(.*)://g")
     137
     138        case $lib_config in
     139                "nodebug") ;;
     140                "debug") ;;
     141                "nolib") ;;
     142                *)
     143                        >&2 echo "Configuration must be 'debug', 'nodebug' or 'nolib'"
     144                        exit 1
     145                ;;
    197146        esac
    198 fi
    199 
     147
     148        M4CFA_CANNON_CPU([${arch_name}])
     149        lib_arch=${cannon_arch_name}
     150        lib_dir="libcfa/${lib_arch}-${lib_config}"
     151
     152        LIBCFA_TARGET_DIRS="${LIBCFA_TARGET_DIRS} ${lib_dir}"
     153        LIBCFA_TARGET_MAKEFILES="${LIBCFA_TARGET_MAKEFILES} ${lib_dir}/Makefile"
     154
     155        mkdir -p ${lib_dir}
     156        echo -n "${LIBCFA_GENERAL_ARGS} " > ${lib_dir}/config.data
     157        echo -n "${LIBCFA_PATHS} " >> ${lib_dir}/config.data
     158        echo -n "ARCHITECTURE=${lib_arch} " >> ${lib_dir}/config.data
     159        echo -n "CONFIGURATION=${lib_config}" >> ${lib_dir}/config.data
     160done
     161
     162AC_SUBST(LIBCFA_TARGET_DIRS)
     163AC_SUBST(LIBCFA_TARGET_MAKEFILES)
     164
     165M4CFA_CANNON_CPU([${host_cpu}])
     166AC_DEFINE_UNQUOTED(CFA_DEFAULT_CPU, "$cannon_arch_name", [Default cpu to use if neither -m32 or -m64 are defined.])
     167AC_DEFINE_UNQUOTED(CFA_64_CPU, "x64", [CPU to use if the -m64 flags is given.])
     168AC_DEFINE_UNQUOTED(CFA_32_CPU, "x86", [CPU to use if the -m32 flags is given.])
     169
     170#==============================================================================
     171# CAFLAGS
    200172AC_DEFINE_UNQUOTED(CFA_FLAGS, "${CFAFLAGS}", [compilation flags for cfa libraries and test programs.])
    201173AC_SUBST(CFA_FLAGS, ${CFAFLAGS})
    202174
     175#==============================================================================
    203176# Checks for programs.
    204177AC_PROG_CXX
     
    236209AC_CHECK_FUNCS([memset putenv strchr strtol])
    237210
     211#==============================================================================
    238212AC_CONFIG_FILES([
    239213        Makefile
    240         src/driver/Makefile
     214        driver/Makefile
    241215        src/Makefile
    242         src/benchmark/Makefile
    243         src/examples/Makefile
    244         src/tests/Makefile
    245         src/tests/preempt_longrun/Makefile
    246         src/prelude/Makefile
    247         src/libcfa/Makefile
     216        benchmark/Makefile
     217        tests/Makefile
     218        tests/preempt_longrun/Makefile
    248219        tools/Makefile
    249220        tools/prettyprinter/Makefile
    250221        ])
    251222
    252 AC_CONFIG_LINKS([src/tests/test.py:src/tests/test.py])
    253 
    254 AC_OUTPUT(src/tests/config.py)
    255 
    256 AM_COND_IF([BUILD_RELEASE],
    257         [AM_COND_IF([BUILD_DEBUG],
    258                 [AC_MSG_NOTICE(Building libcfa for target: release & debug)],
    259                 [AC_MSG_NOTICE(Building libcfa for target: release)])],
    260         [AM_COND_IF([BUILD_DEBUG],
    261                 [AC_MSG_NOTICE(Building libcfa for target: debug)],
    262                 [AC_MSG_NOTICE(Running cfa without libcfa)])])
     223AC_CONFIG_LINKS([tests/test.py:tests/test.py])
     224
     225AC_OUTPUT(tests/config.py)
    263226
    264227# Final text
Note: See TracChangeset for help on using the changeset viewer.