Changeset c59712e for configure.ac


Ignore:
Timestamp:
Aug 3, 2018, 11:25:46 AM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer
Children:
ff1e0f38
Parents:
25a9b5a
Message:

Parent make now seems to properly call libcfa

File:
1 edited

Legend:

Unmodified
Added
Removed
  • configure.ac

    r25a9b5a rc59712e  
    1515AC_ARG_PROGRAM
    1616
     17#==============================================================================
    1718#Trasforming cc1 will break compilation
    1819if test "${program_transform_name}" = ""; then
     
    2122fi
    2223
     24#Define the new name of the installed command
    2325AC_ARG_WITH(cfa-name,
    2426        [  --with-cfa-name=NAME     NAME too which cfa will be installed],
    2527        cfa_name=$withval, cfa_name="cfa")
    2628
    27 #Define the new name of the installed command
    2829AC_SUBST(CFA_NAME, ${cfa_name})
     30
     31#==============================================================================
     32# handle the list of hosts to build for
     33for var in $ac_configure_args
     34do
     35        #strip quotes surrouding values
     36        var=$(echo $var | sed s/\'//g)
     37        case $var in
     38                # skip cross compilation related arguments
     39                --host=*) ;; host_alias=*) ;; --build=*) ;; build_alias=*) ;; --target=*) ;; target_alias=*) ;;
     40
     41                # append all other arguments to the sub configure arguments
     42                *) LIBCFA_GENERAL_ARGS="${LIBCFA_GENERAL_ARGS} $var";;
     43        esac
     44done
     45
     46echo $LIBCFA_GENERAL_ARGS
     47
     48#==============================================================================
     49# handle the list of hosts to build for
     50AC_CANONICAL_BUILD
     51AC_CANONICAL_HOST
     52
     53default_target="${host_cpu}:debug, ${host_cpu}:nodebug"
     54AC_ARG_WITH(target-hosts,
     55        [  --with-target-hosts=HOSTS     HOSTS comma seperated list of hosts to build for, format ARCH:[debug|nodebug|nolib]],
     56        target_hosts=$withval, target_hosts=${default_target})
     57
     58AC_SUBST(TARGET_HOSTS, ${target_hosts})
     59
     60for i in $(echo $target_hosts | sed "s/,/ /g")
     61do
     62        # call your procedure/other scripts here below
     63        lib_arch=$(echo $i | sed -r "s/:(.*)//g")
     64        lib_config=$(echo $i | sed -r "s/(.*)://g")
     65        lib_dir="libcfa-${lib_arch}-${lib_config}"
     66
     67        LIBCFA_TARGET_DIRS="${LIBCFA_TARGET_DIRS} ${lib_dir}"
     68        LIBCFA_TARGET_MAKEFILES="${LIBCFA_TARGET_MAKEFILES} ${lib_dir}/Makefile"
     69
     70        mkdir -p libcfa-${lib_arch}-${lib_config}
     71        echo -n "${LIBCFA_GENERAL_ARGS} " > libcfa-${lib_arch}-${lib_config}/config.data
     72        echo -n "--host=${lib_arch} " >> libcfa-${lib_arch}-${lib_config}/config.data
     73        echo -n "CONFIGURATION=${lib_config}" >> libcfa-${lib_arch}-${lib_config}/config.data
     74done
     75
     76AC_SUBST(LIBCFA_TARGET_DIRS)
     77AC_SUBST(LIBCFA_TARGET_MAKEFILES)
     78
     79
     80#==============================================================================
     81# version information
    2982
    3083rm -f version
     
    4699AC_DEFINE_UNQUOTED(CFA_VERSION_FULL, ["${ver_major}.${ver_minor}.${ver_patch}.${ver_build}"], [Major.Minor.Patch.Build])
    47100
    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 
     101#==============================================================================
     102# HACK to be able to use conditionnals inside makefiles
    132103DOifskipcompile='ifeq ($(skipcompile),yes)
    133104else'
     
    139110AM_SUBST_NOTMAKE([DOendif])
    140111
     112#==============================================================================
     113# backend compiler implementation
     114AC_ARG_WITH(backend-compiler,
     115       [  --with-backend-compiler=PROGRAM     PROGRAM that performs the final code compilation (must be gcc-compatible) ],
     116       backendcompiler=$withval, backendcompiler="")
     117if test "x$backendcompiler" != "x"; then
     118       BACKEND_CC=${backendcompiler}
     119else
     120       AC_PATH_PROG(BACKEND_CC, gcc, [])       # check gcc installed
     121       if test "x$BACKEND_CC" = "x"; then
     122               AC_MSG_ERROR(some version of gcc is needed. Get it at ftp://ftp.gnu.org)
     123               exit 1
     124       fi
     125fi
     126AC_DEFINE_UNQUOTED(CFA_BACKEND_CC, "${BACKEND_CC}", [Location of include files.])
     127AC_SUBST(CFA_BACKEND_CC)
     128
     129#==============================================================================
     130# Installation paths
    141131if test "x$prefix" = "xNONE"; then
    142132        cfa_prefix=${ac_default_prefix}
     
    171161AC_SUBST(CFA_LIBDIR, ${cfa_libdir})
    172162
     163#==============================================================================
    173164# Create variables for commonly used targets
    174165DRIVER_DIR='$(top_builddir)/driver'
     
    182173AC_DEFINE_UNQUOTED(PRELUDE_BUILDDIR, "$ac_pwd/libcfa/prelude/", [Directory where the prelude files are built])
    183174
     175#==============================================================================
    184176# Flag variables needed to build in tree
    185177LIBCFA_SRC='$(top_srcdir)/libcfa/src'
     
    190182AC_SUBST(BUILD_IN_TREE_FLAGS)
    191183
    192 AC_CANONICAL_BUILD
    193 AC_CANONICAL_HOST
    194 AC_SUBST([MACHINE_TYPE],[$host_cpu])
    195 
    196 if ! test "$host_cpu" = "$build_cpu"; then
    197         case $host_cpu in
    198                 i386)
    199                         CFLAGS+=" -m32 "
    200                         CXXFLAGS+=" -m32 "
    201                         CFAFLAGS+=" -m32 "
    202                         LDFLAGS+=" -m32 "
    203                         ;;
    204                 i686)
    205                         CFLAGS+=" -m32 "
    206                   CXXFLAGS+=" -m32 "
    207                   CFAFLAGS+=" -m32 "
    208                   LDFLAGS+=" -m32 "
    209                         ;;
    210                 x86_64)
    211                         CFLAGS+=" -m64 "
    212                         CXXFLAGS+=" -m64 "
    213                         CFAFLAGS+=" -m64 "
    214                         LDFLAGS+=" -m64 "
    215                         ;;
    216         esac
    217 fi
    218 
     184#==============================================================================
     185# CAFLAGS
    219186AC_DEFINE_UNQUOTED(CFA_FLAGS, "${CFAFLAGS}", [compilation flags for cfa libraries and test programs.])
    220187AC_SUBST(CFA_FLAGS, ${CFAFLAGS})
    221188
     189#==============================================================================
    222190# Checks for programs.
    223191AC_PROG_CXX
     
    255223AC_CHECK_FUNCS([memset putenv strchr strtol])
    256224
     225#==============================================================================
    257226AC_CONFIG_FILES([
    258227        Makefile
     
    262231        tests/Makefile
    263232        tests/preempt_longrun/Makefile
    264         libcfa/prelude/Makefile
    265         libcfa/src/Makefile
    266233        tools/Makefile
    267234        tools/prettyprinter/Makefile
     
    272239AC_OUTPUT(tests/config.py)
    273240
    274 AM_COND_IF([BUILD_RELEASE],
    275         [AM_COND_IF([BUILD_DEBUG],
    276                 [AC_MSG_NOTICE(Building libcfa for target: release & debug)],
    277                 [AC_MSG_NOTICE(Building libcfa for target: release)])],
    278         [AM_COND_IF([BUILD_DEBUG],
    279                 [AC_MSG_NOTICE(Building libcfa for target: debug)],
    280                 [AC_MSG_NOTICE(Running cfa without libcfa)])])
    281 
    282241# Final text
    283242AC_MSG_RESULT(Cforall configuraton completed. Type "make -j 8 install".)
Note: See TracChangeset for help on using the changeset viewer.