Changeset b067d9b for configure.ac


Ignore:
Timestamp:
Oct 29, 2019, 4:01:24 PM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
773db65, 9421f3d8
Parents:
7951100 (diff), 8364209 (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' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • configure.ac

    r7951100 rb067d9b  
    55AC_INIT([cfa-cc],[1.0.0.0],[cforall@plg.uwaterloo.ca])
    66AC_CONFIG_AUX_DIR([automake])
     7AC_CONFIG_MACRO_DIRS([automake])
    78#AC_CONFIG_SRCDIR([src/main.cc])
    8 AC_CONFIG_HEADERS([config.h])
    9 AM_SILENT_RULES([no])
     9AC_CONFIG_HEADERS([config.h:src/config.h.in])
     10AM_SILENT_RULES([yes])
     11
     12m4_include([automake/cfa.m4])
     13
     14# don't use the default CFLAGS as they unconditonnaly add -O2
     15: ${CFLAGS=""}
    1016
    1117AM_INIT_AUTOMAKE([subdir-objects])
    12 AM_MAINTAINER_MODE(enable)                      # may require auto* software to be installed
    1318
    1419# Allow program name tansformation
     
    1621AC_ARG_PROGRAM
    1722
     23#==============================================================================
    1824#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})
     25M4CFA_PROGRAM_NAME
     26
     27#==============================================================================
     28# version information
    3029
    3130rm -f version
     
    4746AC_DEFINE_UNQUOTED(CFA_VERSION_FULL, ["${ver_major}.${ver_minor}.${ver_patch}.${ver_build}"], [Major.Minor.Patch.Build])
    4847
    49 # Installation paths
    50 
    51 AC_ARG_WITH(backend-compiler,
    52         [  --with-backend-compiler=PROGRAM     PROGRAM that performs the final code compilation (must be gcc-compatible) ],
    53         backendcompiler=$withval, backendcompiler="")
    54 if test "x$backendcompiler" != "x"; then
    55         BACKEND_CC=${backendcompiler}
    56 else
    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
    62 fi
    63 AC_DEFINE_UNQUOTED(CFA_BACKEND_CC, "${BACKEND_CC}", [Location of include files.])
    64 AC_SUBST(CFA_BACKEND_CC)
    65 
    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 
     48#==============================================================================
     49# HACK to be able to use conditionnals inside makefiles
    13350DOifskipcompile='ifeq ($(skipcompile),yes)
    13451else'
     
    14057AM_SUBST_NOTMAKE([DOendif])
    14158
    142 if test "x$prefix" = "xNONE"; then
    143         cfa_prefix=${ac_default_prefix}
    144 else
    145         cfa_prefix=${prefix}
     59#==============================================================================
     60# distcc support
     61
     62AC_ARG_ENABLE(distcc,
     63        [  --enable-distcc     whether or not to enable distributed compilation],
     64        enable_distcc=$enableval, enable_distcc=no)
     65
     66AM_CONDITIONAL([ENABLE_DISTCC], [test x$enable_distcc = xyes])
     67HAS_DISTCC="False"
     68
     69if test x$enable_distcc = xyes; then
     70        CXX="distcc ${CXX}"
     71        LD="distcc ${LD} -lstdc++"
     72        HAS_DISTCC="True"
     73        echo "Enabling distributed builds"
    14674fi
    147 AC_DEFINE_UNQUOTED(CFA_PREFIX, "${cfa_prefix}", [Location of cfa install.])
    148 AC_SUBST(CFA_PREFIX, ${cfa_prefix})
    149 
    150 if test "$includedir" = '${prefix}/include'; then
    151         cfa_incdir="${cfa_prefix}/include/${cfa_name}"
    152 else
    153         cfa_incdir=${includedir}
    154 fi
    155 AC_DEFINE_UNQUOTED(CFA_INCDIR, "${cfa_incdir}", [Location of include files.])
    156 AC_SUBST(CFA_INCDIR, ${cfa_incdir})
    157 
    158 if test "$bindir" = '${exec_prefix}/bin'; then
    159         cfa_bindir="${cfa_prefix}/bin"
    160 else
    161         cfa_bindir=${bindir}
    162 fi
    163 AC_DEFINE_UNQUOTED(CFA_BINDIR, "${cfa_bindir}", [Location of cfa command.])
    164 AC_SUBST(CFA_BINDIR, ${cfa_bindir})
    165 
    166 if test "$libdir" = '${exec_prefix}/lib'; then
    167         cfa_libdir="${cfa_prefix}/lib/${cfa_name}"
    168 else
    169         cfa_libdir=${libdir}
    170 fi
    171 AC_DEFINE_UNQUOTED(CFA_LIBDIR, "${cfa_libdir}", [Location of cc1 and cfa-cpp commands.])
    172 AC_SUBST(CFA_LIBDIR, ${cfa_libdir})
    173 
     75
     76AC_SUBST(CXX)
     77AC_SUBST(LD)
     78AC_SUBST(HAS_DISTCC)
     79
     80#==============================================================================
     81# Installation paths
     82M4CFA_PARSE_PREFIX
     83
     84#==============================================================================
     85# Create variables for commonly used targets
     86
     87TOP_SRCDIR="$(readlink -m $ac_confdir/)/"
     88TOP_BUILDDIR="$(readlink -m $ac_pwd/)/"
     89
     90AC_DEFINE_UNQUOTED(TOP_SRCDIR, "$TOP_SRCDIR", [Top src directory])
     91AC_DEFINE_UNQUOTED(TOP_BUILDDIR, "$TOP_BUILDDIR", [Top build directory])
     92
     93DRIVER_DIR=${TOP_BUILDDIR}driver/
     94CFACC=${DRIVER_DIR}cfa
     95CFACC_INSTALL=${CFA_BINDIR}${CFA_NAME}
     96CFACPP=${DRIVER_DIR}cfa-cpp
     97AC_SUBST(DRIVER_DIR)
     98AC_SUBST(CFACC)
     99AC_SUBST(CFACC_INSTALL)
     100AC_SUBST(CFACPP)
     101
     102#==============================================================================
     103# Flag variables needed to build in tree
     104LIBCFA_SRC='${TOP_SRCDIR}/libcfa/src'
     105BUILD_IN_TREE_FLAGS="-XCFA -t -B${DRIVER_DIR}"
     106AC_SUBST(BUILD_IN_TREE_FLAGS)
     107
     108#==============================================================================
     109# handle the list of hosts to build for
     110for var in $ac_configure_args
     111do
     112        #strip quotes surrouding values
     113        case $var in
     114                # skip cross compilation related arguments
     115                \'--host=*) ;; \'host_alias=*) ;; \'--build=*) ;; \'build_alias=*) ;; \'--target=*) ;; \'target_alias=*) ;;
     116
     117                # skip the target hosts
     118                \'--with-target-hosts=*) ;;
     119
     120                # skip gprofiler for libcfa
     121                \'--enable-gprofiler=*) ;;
     122                \'--disable-gprofiler) ;;
     123
     124                # append all other arguments to the sub configure arguments
     125                *) LIBCFA_GENERAL_ARGS="${LIBCFA_GENERAL_ARGS} $var";;
     126        esac
     127done
     128
     129#==============================================================================
     130# handle the list of hosts to build for
    174131AC_CANONICAL_BUILD
    175132AC_CANONICAL_HOST
    176 AC_SUBST([MACHINE_TYPE],[$host_cpu])
    177133
    178134if ! test "$host_cpu" = "$build_cpu"; then
    179135        case $host_cpu in
    180136                i386)
    181                         CFLAGS+=" -m32 "
    182                         CXXFLAGS+=" -m32 "
    183                         CFAFLAGS+=" -m32 "
    184                         LDFLAGS+=" -m32 "
     137                        HOST_FLAGS="-m32"
    185138                        ;;
    186139                i686)
    187                         CFLAGS+=" -m32 "
    188                   CXXFLAGS+=" -m32 "
    189                   CFAFLAGS+=" -m32 "
    190                   LDFLAGS+=" -m32 "
     140                        HOST_FLAGS="-m32"
    191141                        ;;
    192142                x86_64)
    193                         CFLAGS+=" -m64 "
    194                         CXXFLAGS+=" -m64 "
    195                         CFAFLAGS+=" -m64 "
    196                         LDFLAGS+=" -m64 "
     143                        HOST_FLAGS="-m64"
    197144                        ;;
    198145        esac
    199146fi
    200 
     147AC_SUBST(HOST_FLAGS)
     148
     149default_target="${host_cpu}:debug, ${host_cpu}:nodebug"
     150AC_ARG_WITH(target-hosts,
     151        [  --with-target-hosts=HOSTS     HOSTS comma seperated list of hosts to build for, format ARCH:[debug|nodebug|nolib]],
     152        target_hosts=$withval, target_hosts=${default_target})
     153
     154AC_ARG_ENABLE(gprofiler,
     155        [  --enable-gprofiler     whether or not to enable gprofiler tools (if available)],
     156        enable_gprofiler=$enableval, enable_gprofiler=yes)
     157
     158AC_ARG_ENABLE(demangler,
     159        [  --enable-demangler     whether or not to build the demangler (executable and library)],
     160        enable_demangler=$enableval, enable_demangler=yes)
     161
     162AC_SUBST(TARGET_HOSTS, ${target_hosts})
     163
     164LIBCFA_PATHS="DRIVER_DIR=${DRIVER_DIR}"
     165
     166for i in $(echo $target_hosts | sed "s/,/ /g")
     167do
     168        # call your procedure/other scripts here below
     169        arch_name=$(echo $i | sed -r "s/:(.*)//g")
     170        lib_config=$(echo $i | sed -r "s/(.*)://g")
     171
     172        case $lib_config in
     173                "nodebug") ;;
     174                "debug") ;;
     175                "nolib") ;;
     176                "profile") ;;
     177                *)
     178                        >&2 echo "Configuration must be 'debug', 'nodebug' or 'nolib'"
     179                        exit 1
     180                ;;
     181        esac
     182
     183        M4CFA_CANNON_CPU([${arch_name}])
     184        lib_arch=${cannon_arch_name}
     185        lib_dir="libcfa/${lib_arch}-${lib_config}"
     186
     187        LIBCFA_TARGET_DIRS="${LIBCFA_TARGET_DIRS} ${lib_dir}"
     188        LIBCFA_TARGET_MAKEFILES="${LIBCFA_TARGET_MAKEFILES} ${lib_dir}/Makefile"
     189
     190        mkdir -p ${lib_dir}
     191        echo -n "${LIBCFA_GENERAL_ARGS} " > ${lib_dir}/config.data
     192        echo -n "${LIBCFA_PATHS} " >> ${lib_dir}/config.data
     193        echo -n "ARCHITECTURE=${lib_arch} " >> ${lib_dir}/config.data
     194        echo -n "CONFIGURATION=${lib_config} " >> ${lib_dir}/config.data
     195        echo -n "CFA_VERSION=${ver_major}:${ver_minor}:${ver_patch}" >> ${lib_dir}/config.data
     196done
     197
     198AC_SUBST(LIBCFA_TARGET_DIRS)
     199AC_SUBST(LIBCFA_TARGET_MAKEFILES)
     200
     201M4CFA_CANNON_CPU([${host_cpu}])
     202AC_DEFINE_UNQUOTED(CFA_DEFAULT_CPU, "$cannon_arch_name", [Default cpu to use if neither -m32 or -m64 are defined.])
     203AC_DEFINE_UNQUOTED(CFA_64_CPU, "x64", [CPU to use if the -m64 flags is given.])
     204AC_DEFINE_UNQUOTED(CFA_32_CPU, "x86", [CPU to use if the -m32 flags is given.])
     205
     206#==============================================================================
     207# CAFLAGS
    201208AC_DEFINE_UNQUOTED(CFA_FLAGS, "${CFAFLAGS}", [compilation flags for cfa libraries and test programs.])
    202209AC_SUBST(CFA_FLAGS, ${CFAFLAGS})
    203210
     211#==============================================================================
    204212# Checks for programs.
    205213AC_PROG_CXX
    206214AC_PROG_CC
    207215AM_PROG_AS
    208 AM_PROG_CC_C_O  # deprecated
    209216# These are often not installed and people miss seeing the "no", so stop the configure.
    210217AC_PROG_YACC
     
    212219AC_PROG_LEX
    213220if test "${LEX}" = "lex" ; then echo "Error: flex required." ; exit 1 ; fi
     221AC_PROG_LIBTOOL
    214222AC_PROG_INSTALL
    215 AC_PROG_MAKE_SET
    216 AC_PROG_RANLIB
    217223
    218224# Checks for libraries.
     225AC_CHECK_LIB([fibre], [Fibre::yield], [HAVE_LIBFIBRE=1], [HAVE_LIBFIBRE=0])
     226AM_CONDITIONAL([WITH_LIBFIBRE], [test "$HAVE_LIBFIBRE" -eq 1])
     227
     228AC_CHECK_LIB([profiler], [ProfilingIsEnabledForAllThreads], [HAVE_LIBPROFILER=1], [HAVE_LIBPROFILER=0])
     229AM_CONDITIONAL([WITH_LIBPROFILER], [test "x$enable_gprofiler" = "xyes" -a "$HAVE_LIBPROFILER" -eq 1])
     230
     231AC_CHECK_LIB([tcmalloc], [malloc], [HAVE_LIBTCMALLOC=1], [HAVE_LIBTCMALLOC=0])
     232AM_CONDITIONAL([WITH_LIBTCMALLOC], [test "x$enable_gprofiler" = "xyes" -a "$HAVE_LIBTCMALLOC" -eq 1])
     233
     234# conditionnally build the demangler
     235if test "x$enable_demangler" == xyes; then
     236        LIBDEMANGLE="libdemangle.a"
     237        DEMANGLER="demangler"
     238else
     239        LIBDEMANGLE=""
     240        DEMANGLER=""
     241fi
     242AC_SUBST([LIBDEMANGLE])
     243AC_SUBST([DEMANGLER])
    219244
    220245# Checks for header files.
    221 AC_FUNC_ALLOCA
    222 AC_CHECK_HEADERS([fenv.h float.h inttypes.h libintl.h limits.h malloc.h stddef.h stdlib.h string.h unistd.h])
     246AC_CHECK_HEADERS([libintl.h malloc.h unistd.h], [], [echo "Error: Missing required header"; exit 1])
    223247
    224248# Checks for typedefs, structures, and compiler characteristics.
    225 AC_HEADER_STDBOOL
    226 AC_C_INLINE
    227 AC_TYPE_INT16_T
    228 AC_TYPE_INT32_T
    229 AC_TYPE_INT8_T
    230 AC_C_RESTRICT
    231 AC_TYPE_SIZE_T
    232 AC_TYPE_UINT16_T
    233 AC_TYPE_UINT32_T
    234 AC_TYPE_UINT8_T
    235 
    236 # Checks for library functions.
    237 AC_CHECK_FUNCS([memset putenv strchr strtol])
    238 
     249AC_CHECK_TYPES([_Float32], AC_DEFINE([HAVE_KEYWORDS_FLOATXX], [], [Have keywords _FloatXX.]), [], [[]])
     250
     251# Checks for compiler flags.
     252M4CFA_CHECK_COMPILE_FLAG([-Wcast-function-type], AC_DEFINE([HAVE_CAST_FUNCTION_TYPE], [], [Have compiler warning cast-function-type.]))
     253
     254#==============================================================================
     255# backend compiler implementation
     256AC_DEFINE_UNQUOTED(CFA_BACKEND_CC, "${CC}", [Backend compiler to use.])
     257AC_SUBST(CFA_BACKEND_CC)
     258
     259#==============================================================================
    239260AC_CONFIG_FILES([
    240261        Makefile
    241         src/driver/Makefile
     262        driver/Makefile
    242263        src/Makefile
    243         src/benchmark/Makefile
    244         src/examples/Makefile
    245         src/tests/Makefile
    246         src/tests/preempt_longrun/Makefile
    247         src/prelude/Makefile
    248         src/libcfa/Makefile
     264        benchmark/Makefile
     265        tests/Makefile
     266        longrun_tests/Makefile
    249267        tools/Makefile
    250268        tools/prettyprinter/Makefile
    251269        ])
    252270
    253 AC_OUTPUT
    254 
    255 AM_COND_IF([BUILD_RELEASE],
    256         [AM_COND_IF([BUILD_DEBUG],
    257                 [AC_MSG_NOTICE(Building libcfa for target: release & debug)],
    258                 [AC_MSG_NOTICE(Building libcfa for target: release)])],
    259         [AM_COND_IF([BUILD_DEBUG],
    260                 [AC_MSG_NOTICE(Building libcfa for target: debug)],
    261                 [AC_MSG_NOTICE(Running cfa without libcfa)])])
     271AC_CONFIG_LINKS([tests/test.py:tests/test.py])
     272
     273AC_OUTPUT(tests/config.py)
    262274
    263275# Final text
Note: See TracChangeset for help on using the changeset viewer.