Changeset 90152a4 for configure.ac


Ignore:
Timestamp:
Aug 27, 2018, 4:40:34 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum, stuck-waitfor-destruct
Children:
b7c89aa
Parents:
f9feab8 (diff), 305581d (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 cleanup-dtors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • configure.ac

    rf9feab8 r90152a4  
    66AC_CONFIG_AUX_DIR([automake])
    77#AC_CONFIG_SRCDIR([src/main.cc])
    8 AC_CONFIG_HEADERS([config.h])
    9 AM_SILENT_RULES([no])
     8AC_CONFIG_HEADERS([config.h:src/config.h.in])
     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])
    12 AM_MAINTAINER_MODE(enable)                      # may require auto* software to be installed
    1317
    1418# Allow program name tansformation
     
    1620AC_ARG_PROGRAM
    1721
     22#==============================================================================
    1823#Trasforming cc1 will break compilation
    19 if test "${program_transform_name}" = ""; then
    20     AC_MSG_ERROR([Program transform not supported.
    21                 Use --with-cfa-name='[[Desired name here]]' instead])
    22 fi
    23 
    24 AC_ARG_WITH(cfa-name,
    25         [  --with-cfa-name=NAME     NAME too which cfa will be installed],
    26         cfa_name=$withval, cfa_name="cfa")
    27 
    28 #Define the new name of the installed command
    29 AC_SUBST(CFA_NAME, ${cfa_name})
     24M4CFA_PROGRAM_NAME
     25
     26#==============================================================================
     27# version information
    3028
    3129rm -f version
     
    4745AC_DEFINE_UNQUOTED(CFA_VERSION_FULL, ["${ver_major}.${ver_minor}.${ver_patch}.${ver_build}"], [Major.Minor.Patch.Build])
    4846
    49 # Installation paths
    50 
     47#==============================================================================
     48# HACK to be able to use conditionnals inside makefiles
     49DOifskipcompile='ifeq ($(skipcompile),yes)
     50else'
     51AC_SUBST([DOifskipcompile])
     52AM_SUBST_NOTMAKE([DOifskipcompile])
     53
     54DOendif='endif'
     55AC_SUBST([DOendif])
     56AM_SUBST_NOTMAKE([DOendif])
     57
     58#==============================================================================
     59# backend compiler implementation
    5160AC_ARG_WITH(backend-compiler,
    52         [  --with-backend-compiler=PROGRAM     PROGRAM that performs the final code compilation (must be gcc-compatible) ],
    53         backendcompiler=$withval, backendcompiler="")
     61       [  --with-backend-compiler=PROGRAM     PROGRAM that performs the final code compilation (must be gcc-compatible) ],
     62       backendcompiler=$withval, backendcompiler="")
    5463if test "x$backendcompiler" != "x"; then
    55         BACKEND_CC=${backendcompiler}
     64       BACKEND_CC=${backendcompiler}
    5665else
    57         AC_PATH_PROG(BACKEND_CC, gcc, [])       # check gcc installed
    58         if test "x$BACKEND_CC" = "x"; then
    59                 AC_MSG_ERROR(some version of gcc is needed. Get it at ftp://ftp.gnu.org)
    60                 exit 1
    61         fi
     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
    6271fi
    6372AC_DEFINE_UNQUOTED(CFA_BACKEND_CC, "${BACKEND_CC}", [Location of include files.])
    6473AC_SUBST(CFA_BACKEND_CC)
    6574
    66 
    67 
    68 AC_ARG_ENABLE(target-release, AS_HELP_STRING([--enable-target-release], [Build and install the release target]))
    69 AC_ARG_ENABLE(target-debug, AS_HELP_STRING([--enable-target-debug], [Build and install the debug target]))
    70 AC_ARG_ENABLE(threading, AS_HELP_STRING([--enable-threading], [Build and install libcfa with threading support (Enabled by default)]),
    71 [case "${enableval}" in
    72   yes) build_threading="yes" ;;
    73   no)  build_threading="no" ;;
    74   *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
    75 esac],[build_threading="yes"])
    76 
    77 case "$enable_target_release" in
    78         yes)
    79                 case "$enable_target_debug" in
    80                         yes)
    81                                 build_release="yes"
    82                                 build_debug="yes"
    83                                 ;;
    84                         no)
    85                                 build_release="yes"
    86                                 build_debug="no"
    87                                 ;;
    88                         *)
    89                                 build_release="yes"
    90                                 build_debug="no"
    91                                 ;;
    92                 esac
    93                 ;;
    94         no)
    95                 case "$enable_target_debug" in
    96                         yes)
    97                                 build_release="no"
    98                                 build_debug="yes"
    99                                 ;;
    100                         no)
    101                                 build_release="no"
    102                                 build_debug="no"
    103                                 ;;
    104                         *)
    105                                 build_release="no"
    106                                 build_debug="yes"
    107                                 ;;
    108                 esac
    109                 ;;
    110         *)
    111                 case "$enable_target_debug" in
    112                         yes)
    113                                 build_release="no"
    114                                 build_debug="yes"
    115                                 ;;
    116                         no)
    117                                 build_release="yes"
    118                                 build_debug="no"
    119                                 ;;
    120                         *)
    121                                 build_release="yes"
    122                                 build_debug="yes"
    123                                 ;;
    124                 esac
    125                 ;;
    126 esac
    127 
    128 AM_CONDITIONAL([BUILD_RELEASE], [test "x$build_release" = "xyes"])
    129 AM_CONDITIONAL([BUILD_DEBUG], [test "x$build_debug" = "xyes"])
    130 AM_CONDITIONAL([BUILD_NO_LIB], [test "x$build_release$build_debug" = "xnono"])
    131 AM_CONDITIONAL([BUILD_CONCURRENCY], [test "x$build_threading" = "xyes"])
    132 
    133 if test "x$prefix" = "xNONE"; then
    134         cfa_prefix=${ac_default_prefix}
    135 else
    136         cfa_prefix=${prefix}
    137 fi
    138 AC_DEFINE_UNQUOTED(CFA_PREFIX, "${cfa_prefix}", [Location of cfa install.])
    139 AC_SUBST(CFA_PREFIX, ${cfa_prefix})
    140 
    141 if test "$includedir" = '${prefix}/include'; then
    142         cfa_incdir="${cfa_prefix}/include/${cfa_name}"
    143 else
    144         cfa_incdir=${includedir}
    145 fi
    146 AC_DEFINE_UNQUOTED(CFA_INCDIR, "${cfa_incdir}", [Location of include files.])
    147 AC_SUBST(CFA_INCDIR, ${cfa_incdir})
    148 
    149 if test "$bindir" = '${exec_prefix}/bin'; then
    150         cfa_bindir="${cfa_prefix}/bin"
    151 else
    152         cfa_bindir=${bindir}
    153 fi
    154 AC_DEFINE_UNQUOTED(CFA_BINDIR, "${cfa_bindir}", [Location of cfa command.])
    155 AC_SUBST(CFA_BINDIR, ${cfa_bindir})
    156 
    157 if test "$libdir" = '${exec_prefix}/lib'; then
    158         cfa_libdir="${cfa_prefix}/lib/${cfa_name}"
    159 else
    160         cfa_libdir=${libdir}
    161 fi
    162 AC_DEFINE_UNQUOTED(CFA_LIBDIR, "${cfa_libdir}", [Location of cc1 and cfa-cpp commands.])
    163 AC_SUBST(CFA_LIBDIR, ${cfa_libdir})
    164 
     75#==============================================================================
     76# Installation paths
     77M4CFA_PARSE_PREFIX
     78
     79#==============================================================================
     80# Create variables for commonly used targets
     81
     82TOP_SRCDIR="$(readlink -m $ac_confdir/)/"
     83TOP_BUILDDIR="$(readlink -m $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
    165120AC_CANONICAL_BUILD
    166121AC_CANONICAL_HOST
    167 AC_SUBST([MACHINE_TYPE],[$host_cpu])
    168122
    169123if ! test "$host_cpu" = "$build_cpu"; then
    170124        case $host_cpu in
    171125                i386)
    172                         CFLAGS+=" -m32 "
    173                         CXXFLAGS+=" -m32 "
    174                         CFAFLAGS+=" -m32 "
    175                         LDFLAGS+=" -m32 "
     126                        HOST_FLAGS="-m32"
    176127                        ;;
    177128                i686)
    178                         CFLAGS+=" -m32 "
    179                   CXXFLAGS+=" -m32 "
    180                   CFAFLAGS+=" -m32 "
    181                   LDFLAGS+=" -m32 "
     129                        HOST_FLAGS="-m32"
    182130                        ;;
    183131                x86_64)
    184                         CFLAGS+=" -m64 "
    185                         CXXFLAGS+=" -m64 "
    186                         CFAFLAGS+=" -m64 "
    187                         LDFLAGS+=" -m64 "
     132                        HOST_FLAGS="-m64"
    188133                        ;;
    189134        esac
    190135fi
    191 
     136AC_SUBST(HOST_FLAGS)
     137
     138default_target="${host_cpu}:debug, ${host_cpu}:nodebug"
     139AC_ARG_WITH(target-hosts,
     140        [  --with-target-hosts=HOSTS     HOSTS comma seperated list of hosts to build for, format ARCH:[debug|nodebug|nolib]],
     141        target_hosts=$withval, target_hosts=${default_target})
     142
     143AC_SUBST(TARGET_HOSTS, ${target_hosts})
     144
     145LIBCFA_PATHS="DRIVER_DIR=${DRIVER_DIR}"
     146
     147for i in $(echo $target_hosts | sed "s/,/ /g")
     148do
     149        # call your procedure/other scripts here below
     150        arch_name=$(echo $i | sed -r "s/:(.*)//g")
     151        lib_config=$(echo $i | sed -r "s/(.*)://g")
     152
     153        case $lib_config in
     154                "nodebug") ;;
     155                "debug") ;;
     156                "nolib") ;;
     157                *)
     158                        >&2 echo "Configuration must be 'debug', 'nodebug' or 'nolib'"
     159                        exit 1
     160                ;;
     161        esac
     162
     163        M4CFA_CANNON_CPU([${arch_name}])
     164        lib_arch=${cannon_arch_name}
     165        lib_dir="libcfa/${lib_arch}-${lib_config}"
     166
     167        LIBCFA_TARGET_DIRS="${LIBCFA_TARGET_DIRS} ${lib_dir}"
     168        LIBCFA_TARGET_MAKEFILES="${LIBCFA_TARGET_MAKEFILES} ${lib_dir}/Makefile"
     169
     170        mkdir -p ${lib_dir}
     171        echo -n "${LIBCFA_GENERAL_ARGS} " > ${lib_dir}/config.data
     172        echo -n "${LIBCFA_PATHS} " >> ${lib_dir}/config.data
     173        echo -n "ARCHITECTURE=${lib_arch} " >> ${lib_dir}/config.data
     174        echo -n "CONFIGURATION=${lib_config}" >> ${lib_dir}/config.data
     175done
     176
     177AC_SUBST(LIBCFA_TARGET_DIRS)
     178AC_SUBST(LIBCFA_TARGET_MAKEFILES)
     179
     180M4CFA_CANNON_CPU([${host_cpu}])
     181AC_DEFINE_UNQUOTED(CFA_DEFAULT_CPU, "$cannon_arch_name", [Default cpu to use if neither -m32 or -m64 are defined.])
     182AC_DEFINE_UNQUOTED(CFA_64_CPU, "x64", [CPU to use if the -m64 flags is given.])
     183AC_DEFINE_UNQUOTED(CFA_32_CPU, "x86", [CPU to use if the -m32 flags is given.])
     184
     185#==============================================================================
     186# CAFLAGS
    192187AC_DEFINE_UNQUOTED(CFA_FLAGS, "${CFAFLAGS}", [compilation flags for cfa libraries and test programs.])
    193188AC_SUBST(CFA_FLAGS, ${CFAFLAGS})
    194189
     190#==============================================================================
    195191# Checks for programs.
    196192AC_PROG_CXX
     
    228224AC_CHECK_FUNCS([memset putenv strchr strtol])
    229225
     226#==============================================================================
    230227AC_CONFIG_FILES([
    231228        Makefile
    232         src/driver/Makefile
     229        driver/Makefile
    233230        src/Makefile
    234         src/benchmark/Makefile
    235         src/examples/Makefile
    236         src/tests/Makefile
    237         src/tests/preempt_longrun/Makefile
    238         src/prelude/Makefile
    239         src/libcfa/Makefile
     231        benchmark/Makefile
     232        tests/Makefile
     233        tests/preempt_longrun/Makefile
    240234        tools/Makefile
    241235        tools/prettyprinter/Makefile
    242236        ])
    243237
    244 AC_OUTPUT
    245 
    246 AM_COND_IF([BUILD_RELEASE],
    247         [AM_COND_IF([BUILD_DEBUG],
    248                 [AC_MSG_NOTICE(Building libcfa for target: release & debug)],
    249                 [AC_MSG_NOTICE(Building libcfa for target: release)])],
    250         [AM_COND_IF([BUILD_DEBUG],
    251                 [AC_MSG_NOTICE(Building libcfa for target: debug)],
    252                 [AC_MSG_NOTICE(Running cfa without libcfa)])])
     238AC_CONFIG_LINKS([tests/test.py:tests/test.py])
     239
     240AC_OUTPUT(tests/config.py)
    253241
    254242# Final text
Note: See TracChangeset for help on using the changeset viewer.