Changeset 37fe352


Ignore:
Timestamp:
Aug 5, 2018, 4:11:41 PM (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:
28582b2
Parents:
4dcaed2
Message:

Added proper multi-lib handling, tests still do not work and arm support is broken

Files:
2 added
13 edited

Legend:

Unmodified
Added
Removed
  • automake/cfa.m4

    r4dcaed2 r37fe352  
    2626
    2727        if test "$libdir" = '${exec_prefix}/lib'; then
    28                 cfa_libdir="${cfa_prefix}/lib/${cfa_name}"
     28                cfa_libdir="${cfa_prefix}/lib/${cfa_name}/${ARCHITECTURE}${CONFIGURATION}"
    2929        else
    30                 cfa_libdir=${libdir}
     30                cfa_libdir="${libdir}/${ARCHITECTURE}${CONFIGURATION}"
    3131        fi
    3232        AC_DEFINE_UNQUOTED(CFA_LIBDIR, "${cfa_libdir}", [Location of cc1 and cfa-cpp commands.])
    3333        AC_SUBST(CFA_LIBDIR, ${cfa_libdir})
    3434])
     35
     36m4_define([M4CFA_PROGRAM_NAME], [
     37        if test "${program_transform_name}" = ""; then
     38        AC_MSG_ERROR([Program transform not supported.
     39                        Use --with-cfa-name='[[Desired name here]]' instead])
     40        fi
     41
     42        #Define the new name of the installed command
     43        AC_ARG_WITH(cfa-name,
     44                [  --with-cfa-name=NAME     NAME too which cfa will be installed],
     45                cfa_name=$withval, cfa_name="cfa")
     46
     47        AC_SUBST(CFA_NAME, ${cfa_name})
     48])
     49
     50AC_DEFUN([M4CFA_CANNON_CPU], [
     51        case $arch_name in
     52                "x64"        ) cannon_arch_name="x64";;
     53                "x86-64"     ) cannon_arch_name="x64";;
     54                "x86_64"     ) cannon_arch_name="x64";;
     55                "x86"        ) cannon_arch_name="x86";;
     56                "i386"       ) cannon_arch_name="x86";;
     57                "i486"       ) cannon_arch_name="x86";;
     58                "i686"       ) cannon_arch_name="x86";;
     59                "Intel 80386") cannon_arch_name="x86";;
     60                "arm"        ) cannon_arch_name="arm";;
     61                "ARM"        ) cannon_arch_name="arm";;
     62                *)
     63                >&2 echo "Unkown architecture " $arch_name;
     64                exit 1
     65                ;;
     66        esac
     67])
  • configure

    r4dcaed2 r37fe352  
    25232523
    25242524
     2525
     2526
     2527
     2528
    25252529am__api_version='1.15'
    25262530
     
    30703074#==============================================================================
    30713075#Trasforming cc1 will break compilation
    3072 if test "${program_transform_name}" = ""; then
    3073     as_fn_error $? "Program transform not supported.
    3074                 Use --with-cfa-name='[Desired name here]' instead" "$LINENO" 5
    3075 fi
    3076 
    3077 #Define the new name of the installed command
     3076
     3077        if test "${program_transform_name}" = ""; then
     3078        as_fn_error $? "Program transform not supported.
     3079                        Use --with-cfa-name='[Desired name here]' instead" "$LINENO" 5
     3080        fi
     3081
     3082        #Define the new name of the installed command
    30783083
    30793084# Check whether --with-cfa-name was given.
     
    30853090
    30863091
    3087 CFA_NAME=${cfa_name}
     3092        CFA_NAME=${cfa_name}
    30883093
    30893094
     
    32613266
    32623267        if test "$libdir" = '${exec_prefix}/lib'; then
    3263                 cfa_libdir="${cfa_prefix}/lib/${cfa_name}"
     3268                cfa_libdir="${cfa_prefix}/lib/${cfa_name}/${ARCHITECTURE}${CONFIGURATION}"
    32643269        else
    3265                 cfa_libdir=${libdir}
     3270                cfa_libdir="${libdir}/${ARCHITECTURE}${CONFIGURATION}"
    32663271        fi
    32673272
     
    34153420        arch_name=$(echo $i | sed -r "s/:(.*)//g")
    34163421        lib_config=$(echo $i | sed -r "s/(.*)://g")
    3417         if test $lib_config != "nodebug";
    3418         then
    3419                 if test $lib_config != "debug";
    3420                 then
    3421                         if test $lib_config != "nolib";
    3422                         then
    3423                                 >&2 echo "Configuration must be 'debug', 'nodebug' or 'nolib'"
    3424                                 exit 1
    3425                         fi
    3426                 fi
    3427         fi
    3428 
    3429         lib_arch=$($ac_aux_dir/config.sub $arch_name)
    3430         if test "$?" != "0"; then
     3422
     3423        case $lib_config in
     3424                "nodebug") ;;
     3425                "debug") ;;
     3426                "nolib") ;;
     3427                *)
     3428                        >&2 echo "Configuration must be 'debug', 'nodebug' or 'nolib'"
     3429                        exit 1
     3430                ;;
     3431        esac
     3432
     3433
     3434        case $arch_name in
     3435                "x64"        ) cannon_arch_name="x64";;
     3436                "x86-64"     ) cannon_arch_name="x64";;
     3437                "x86_64"     ) cannon_arch_name="x64";;
     3438                "x86"        ) cannon_arch_name="x86";;
     3439                "i386"       ) cannon_arch_name="x86";;
     3440                "i486"       ) cannon_arch_name="x86";;
     3441                "i686"       ) cannon_arch_name="x86";;
     3442                "Intel 80386") cannon_arch_name="x86";;
     3443                "arm"        ) cannon_arch_name="arm";;
     3444                "ARM"        ) cannon_arch_name="arm";;
     3445                *)
    34313446                >&2 echo "Unkown architecture " $arch_name;
    3432                 exit 1;
    3433         fi
     3447                exit 1
     3448                ;;
     3449        esac
     3450
     3451        lib_arch=${cannon_arch_name}
    34343452        lib_dir="libcfa-${lib_arch}-${lib_config}"
    34353453
     
    34403458        echo -n "${LIBCFA_GENERAL_ARGS} " > libcfa-${lib_arch}-${lib_config}/config.data
    34413459        echo -n "${LIBCFA_PATHS} " >> libcfa-${lib_arch}-${lib_config}/config.data
    3442         echo -n "--host=${lib_arch} " >> libcfa-${lib_arch}-${lib_config}/config.data
     3460        echo -n "ARCHITECTURE=${lib_arch} " >> libcfa-${lib_arch}-${lib_config}/config.data
    34433461        echo -n "CONFIGURATION=${lib_config}" >> libcfa-${lib_arch}-${lib_config}/config.data
    34443462done
    34453463
    34463464
     3465
     3466
     3467
     3468        case $arch_name in
     3469                "x64"        ) cannon_arch_name="x64";;
     3470                "x86-64"     ) cannon_arch_name="x64";;
     3471                "x86_64"     ) cannon_arch_name="x64";;
     3472                "x86"        ) cannon_arch_name="x86";;
     3473                "i386"       ) cannon_arch_name="x86";;
     3474                "i486"       ) cannon_arch_name="x86";;
     3475                "i686"       ) cannon_arch_name="x86";;
     3476                "Intel 80386") cannon_arch_name="x86";;
     3477                "arm"        ) cannon_arch_name="arm";;
     3478                "ARM"        ) cannon_arch_name="arm";;
     3479                *)
     3480                >&2 echo "Unkown architecture " $arch_name;
     3481                exit 1
     3482                ;;
     3483        esac
     3484
     3485
     3486cat >>confdefs.h <<_ACEOF
     3487#define CFA_DEFAULT_CPU "$cannon_arch_name"
     3488_ACEOF
     3489
     3490
     3491cat >>confdefs.h <<_ACEOF
     3492#define CFA_64_CPU "x64"
     3493_ACEOF
     3494
     3495
     3496cat >>confdefs.h <<_ACEOF
     3497#define CFA_32_CPU "x86"
     3498_ACEOF
    34473499
    34483500
  • configure.ac

    r4dcaed2 r37fe352  
    1919#==============================================================================
    2020#Trasforming cc1 will break compilation
    21 if test "${program_transform_name}" = ""; then
    22     AC_MSG_ERROR([Program transform not supported.
    23                 Use --with-cfa-name='[[Desired name here]]' instead])
    24 fi
    25 
    26 #Define the new name of the installed command
    27 AC_ARG_WITH(cfa-name,
    28         [  --with-cfa-name=NAME     NAME too which cfa will be installed],
    29         cfa_name=$withval, cfa_name="cfa")
    30 
    31 AC_SUBST(CFA_NAME, ${cfa_name})
    32 
     21M4CFA_PROGRAM_NAME
    3322
    3423#==============================================================================
     
    143132        arch_name=$(echo $i | sed -r "s/:(.*)//g")
    144133        lib_config=$(echo $i | sed -r "s/(.*)://g")
    145         if test $lib_config != "nodebug";
    146         then
    147                 if test $lib_config != "debug";
    148                 then
    149                         if test $lib_config != "nolib";
    150                         then
    151                                 >&2 echo "Configuration must be 'debug', 'nodebug' or 'nolib'"
    152                                 exit 1
    153                         fi
    154                 fi
    155         fi
    156 
    157         lib_arch=$($ac_aux_dir/config.sub $arch_name)
    158         if test "$?" != "0"; then
    159                 >&2 echo "Unkown architecture " $arch_name;
    160                 exit 1;
    161         fi
     134
     135        case $lib_config in
     136                "nodebug") ;;
     137                "debug") ;;
     138                "nolib") ;;
     139                *)
     140                        >&2 echo "Configuration must be 'debug', 'nodebug' or 'nolib'"
     141                        exit 1
     142                ;;
     143        esac
     144
     145        M4CFA_CANNON_CPU([${arch_name}])
     146        lib_arch=${cannon_arch_name}
    162147        lib_dir="libcfa-${lib_arch}-${lib_config}"
    163148
     
    168153        echo -n "${LIBCFA_GENERAL_ARGS} " > libcfa-${lib_arch}-${lib_config}/config.data
    169154        echo -n "${LIBCFA_PATHS} " >> libcfa-${lib_arch}-${lib_config}/config.data
    170         echo -n "--host=${lib_arch} " >> libcfa-${lib_arch}-${lib_config}/config.data
     155        echo -n "ARCHITECTURE=${lib_arch} " >> libcfa-${lib_arch}-${lib_config}/config.data
    171156        echo -n "CONFIGURATION=${lib_config}" >> libcfa-${lib_arch}-${lib_config}/config.data
    172157done
     
    174159AC_SUBST(LIBCFA_TARGET_DIRS)
    175160AC_SUBST(LIBCFA_TARGET_MAKEFILES)
     161
     162M4CFA_CANNON_CPU([${host_cpu}])
     163AC_DEFINE_UNQUOTED(CFA_DEFAULT_CPU, "$cannon_arch_name", [Default cpu to use if neither -m32 or -m64 are defined.])
     164AC_DEFINE_UNQUOTED(CFA_64_CPU, "x64", [CPU to use if the -m64 flags is given.])
     165AC_DEFINE_UNQUOTED(CFA_32_CPU, "x86", [CPU to use if the -m32 flags is given.])
    176166
    177167#==============================================================================
  • driver/cfa.cc

    r4dcaed2 r37fe352  
    2121#include <string.h>                                                                             // strcmp
    2222
     23#include <sys/types.h>
     24#include <sys/stat.h>
     25
    2326#include "Common/SemanticError.h"
    2427#include "config.h"                                                                             // configure info
     
    6669} // shuffle
    6770
     71static inline bool dirExists(const string & path) {
     72    struct stat info;
     73    if(stat( path.c_str(), &info ) != 0)
     74        return false;
     75    else if(info.st_mode & S_IFDIR)
     76        return true;
     77    else
     78        return false;
     79} //dirExists
     80
    6881
    6982#define str(s) #s
     
    96109        bool xflag = false;                                                                     // user supplied -x flag
    97110        bool debugging __attribute(( unused )) = false;         // -g flag
     111        bool m32 = false;                                    // -m32 flag
     112        bool m64 = false;                                    // -m64 flag
     113        bool intree = false;
    98114
    99115        const char *args[argc + 100];                                           // cfa command line values, plus some space for additional flags
     
    154170                        } else if ( arg == "-no-include-stdhdr" ) {
    155171                                noincstd_flag = true;                                   // strip the no-include-stdhdr flag
     172                        } else if ( arg == "-in-tree" ) {
     173                                noincstd_flag = true;
     174                                intree = true;
    156175                        } else if ( arg == "-compiler" ) {
    157176                                // use the user specified compiler
     
    258277                                libs[nlibs] = argv[i];
    259278                                nlibs += 1;
     279                        } else if ( arg == "-m32" ) {
     280                                m32 = true;
     281                                m64 = false;
     282                                args[nargs] = argv[i];
     283                                nargs += 1;
     284                        } else if ( arg == "-m64" ) {
     285                                m64 = true;
     286                                m32 = false;
     287                                args[nargs] = argv[i];
     288                                nargs += 1;
    260289                        } else {
    261290                                // concatenate any other arguments
     
    320349        nargs += 1;
    321350
     351        string libdir;
     352        if( !intree ) {
     353                const char * const arch = m32 ? CFA_32_CPU : (m64 ? CFA_64_CPU : CFA_DEFAULT_CPU);
     354                const char * config = debug ? "debug": "nodebug";
     355                libdir = string(CFA_LIBDIR) + arch + config;
     356                if( !dirExists(libdir) ) {
     357                        cerr << argv[0] << " internal error, cannot find prelude directory." << endl;
     358                        cerr << "Was looking for " << libdir << endl;
     359                        libdir = string(CFA_LIBDIR) + arch + "nolib";
     360                }
     361
     362                if( !dirExists(libdir) ) {
     363                        cerr << argv[0] << " internal error, cannot find prelude directory." << endl;
     364                        cerr << "Was looking for " << libdir << endl;
     365                        exit( EXIT_FAILURE );
     366                }
     367
     368                args[nargs] = ( *new string( string("-D__CFA_FLAG__=--prelude-dir=" ) + libdir) ).c_str();
     369                nargs += 1;
     370        } else {
     371                args[nargs] = "-D__CFA_FLAG__=-t";
     372                nargs += 1;
     373        }
     374
    322375        if ( link ) {
    323376                args[nargs] = "-Xlinker";
     
    335388
    336389                // include the cfa library in case it's needed
    337                 args[nargs] = "-L" CFA_LIBDIR;
    338                 nargs += 1;
    339                 if ( debug ) {
    340                         args[nargs] = "-lcfa-d";
    341                 } else {
    342                         args[nargs] = "-lcfa";
    343                 } // if
     390                if( !intree ) {
     391                        args[nargs] = ( *new string( string("-L" ) + libdir) ).c_str();
     392                        nargs += 1;
     393                }
     394                args[nargs] = "-lcfa";
    344395                nargs += 1;
    345396                args[nargs] = "-lpthread";
     
    400451        } // if
    401452
    402     args[nargs] = "-Xlinker";                                                   // used by backtrace
    403     nargs += 1;
    404     args[nargs] = "-export-dynamic";
    405     nargs += 1;
     453        args[nargs] = "-Xlinker";                                                       // used by backtrace
     454        nargs += 1;
     455        args[nargs] = "-export-dynamic";
     456        nargs += 1;
    406457
    407458        // execute the compilation command
  • libcfa/Makefile.in

    r4dcaed2 r37fe352  
    8989PRE_UNINSTALL = :
    9090POST_UNINSTALL = :
    91 build_triplet = @build@
    92 host_triplet = @host@
    9391subdir = .
    9492ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    95 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
     93am__aclocal_m4_deps = $(top_srcdir)/../automake/cfa.m4 \
     94        $(top_srcdir)/configure.ac
    9695am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
    9796        $(ACLOCAL_M4)
     
    161160am__DIST_COMMON = $(srcdir)/Makefile.in \
    162161        $(top_srcdir)/./automake/compile \
    163         $(top_srcdir)/./automake/config.guess \
    164         $(top_srcdir)/./automake/config.sub \
    165162        $(top_srcdir)/./automake/install-sh \
    166163        $(top_srcdir)/./automake/missing ./automake/compile \
     
    212209AMTAR = @AMTAR@
    213210AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
     211ARCHITECTURE = @ARCHITECTURE@
     212ARCH_FLAGS = @ARCH_FLAGS@
    214213AUTOCONF = @AUTOCONF@
    215214AUTOHEADER = @AUTOHEADER@
     
    226225CFA_INCDIR = @CFA_INCDIR@
    227226CFA_LIBDIR = @CFA_LIBDIR@
     227CFA_NAME = @CFA_NAME@
    228228CFA_PREFIX = @CFA_PREFIX@
    229229CFLAGS = @CFLAGS@
     
    278278am__untar = @am__untar@
    279279bindir = @bindir@
    280 build = @build@
    281280build_alias = @build_alias@
    282 build_cpu = @build_cpu@
    283 build_os = @build_os@
    284 build_vendor = @build_vendor@
    285281builddir = @builddir@
    286282datadir = @datadir@
     
    289285dvidir = @dvidir@
    290286exec_prefix = @exec_prefix@
    291 host = @host@
    292287host_alias = @host_alias@
    293 host_cpu = @host_cpu@
    294 host_os = @host_os@
    295 host_vendor = @host_vendor@
    296288htmldir = @htmldir@
    297289includedir = @includedir@
  • libcfa/configure

    r4dcaed2 r37fe352  
    622622CFA_INCDIR
    623623CFA_PREFIX
     624CFA_NAME
     625ARCH_FLAGS
    624626CFACPP
    625627CFACC
    626628DRIVER_DIR
    627629CONFIGURATION
    628 host_os
    629 host_vendor
    630 host_cpu
    631 host
    632 build_os
    633 build_vendor
    634 build_cpu
    635 build
     630ARCHITECTURE
    636631AM_BACKSLASH
    637632AM_DEFAULT_VERBOSITY
     
    704699enable_option_checking
    705700enable_silent_rules
     701with_cfa_name
    706702enable_dependency_tracking
    707703'
     
    709705host_alias
    710706target_alias
     707ARCHITECTURE
    711708CONFIGURATION
    712709DRIVER_DIR
     
    13331330  --program-suffix=SUFFIX            append SUFFIX to installed program names
    13341331  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
    1335 
    1336 System types:
    1337   --build=BUILD     configure for building on BUILD [guessed]
    1338   --host=HOST       cross-compile to build programs to run on HOST [BUILD]
    13391332_ACEOF
    13401333fi
     
    13571350                          speeds up one-time build
    13581351
     1352Optional Packages:
     1353  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
     1354  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
     1355  --with-cfa-name=NAME     NAME too which cfa will be installed
     1356
    13591357Some influential environment variables:
     1358  ARCHITECTURE
     1359              The architecture to use when building libcfa
    13601360  CONFIGURATION
    13611361              The configuration to use when building libcfa, options are:
     
    19111911
    19121912
     1913
     1914
     1915
     1916
     1917
     1918
     1919
    19131920am__api_version='1.15'
    19141921
     
    24952502
    24962503
    2497 # Make sure we can run config.sub.
    2498 $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
    2499   as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
    2500 
    2501 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
    2502 $as_echo_n "checking build system type... " >&6; }
    2503 if ${ac_cv_build+:} false; then :
    2504   $as_echo_n "(cached) " >&6
    2505 else
    2506   ac_build_alias=$build_alias
    2507 test "x$ac_build_alias" = x &&
    2508   ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
    2509 test "x$ac_build_alias" = x &&
    2510   as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
    2511 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
    2512   as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
    2513 
    2514 fi
    2515 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
    2516 $as_echo "$ac_cv_build" >&6; }
    2517 case $ac_cv_build in
    2518 *-*-*) ;;
    2519 *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
    2520 esac
    2521 build=$ac_cv_build
    2522 ac_save_IFS=$IFS; IFS='-'
    2523 set x $ac_cv_build
    2524 shift
    2525 build_cpu=$1
    2526 build_vendor=$2
    2527 shift; shift
    2528 # Remember, the first character of IFS is used to create $*,
    2529 # except with old shells:
    2530 build_os=$*
    2531 IFS=$ac_save_IFS
    2532 case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
    2533 
    2534 
    2535 { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
    2536 $as_echo_n "checking host system type... " >&6; }
    2537 if ${ac_cv_host+:} false; then :
    2538   $as_echo_n "(cached) " >&6
    2539 else
    2540   if test "x$host_alias" = x; then
    2541   ac_cv_host=$ac_cv_build
    2542 else
    2543   ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
    2544     as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
    2545 fi
    2546 
    2547 fi
    2548 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
    2549 $as_echo "$ac_cv_host" >&6; }
    2550 case $ac_cv_host in
    2551 *-*-*) ;;
    2552 *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
    2553 esac
    2554 host=$ac_cv_host
    2555 ac_save_IFS=$IFS; IFS='-'
    2556 set x $ac_cv_host
    2557 shift
    2558 host_cpu=$1
    2559 host_vendor=$2
    2560 shift; shift
    2561 # Remember, the first character of IFS is used to create $*,
    2562 # except with old shells:
    2563 host_os=$*
    2564 IFS=$ac_save_IFS
    2565 case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
    2566 
    2567 
    25682504
    25692505
     
    25752511
    25762512
     2513case $ARCHITECTURE in
     2514        "x64"        ) ARCH_FLAGS="-m64";;
     2515        "x86"        ) ARCH_FLAGS="-m32";;
     2516        "arm"        ) ARCH_FLAGS="";;
     2517esac
     2518
     2519
     2520
     2521#==============================================================================
     2522#Trasforming cc1 will break compilation
     2523
     2524        if test "${program_transform_name}" = ""; then
     2525        as_fn_error $? "Program transform not supported.
     2526                        Use --with-cfa-name='[Desired name here]' instead" "$LINENO" 5
     2527        fi
     2528
     2529        #Define the new name of the installed command
     2530
     2531# Check whether --with-cfa-name was given.
     2532if test "${with_cfa_name+set}" = set; then :
     2533  withval=$with_cfa_name; cfa_name=$withval
     2534else
     2535  cfa_name="cfa"
     2536fi
     2537
     2538
     2539        CFA_NAME=${cfa_name}
     2540
     2541
     2542
    25772543#==============================================================================
    25782544# Installation paths
    2579 if test "x$prefix" = "xNONE"; then
    2580         cfa_prefix=${ac_default_prefix}
    2581 else
    2582         cfa_prefix=${prefix}
    2583 fi
     2545
     2546        if test "x$prefix" = "xNONE"; then
     2547                cfa_prefix=${ac_default_prefix}
     2548        else
     2549                cfa_prefix=${prefix}
     2550        fi
    25842551
    25852552cat >>confdefs.h <<_ACEOF
     
    25872554_ACEOF
    25882555
    2589 CFA_PREFIX=${cfa_prefix}
    2590 
    2591 
    2592 if test "$includedir" = '${prefix}/include'; then
    2593         cfa_incdir="${cfa_prefix}/include/${cfa_name}"
    2594 else
    2595         cfa_incdir=${includedir}
    2596 fi
     2556        CFA_PREFIX=${cfa_prefix}
     2557
     2558
     2559        if test "$includedir" = '${prefix}/include'; then
     2560                cfa_incdir="${cfa_prefix}/include/${cfa_name}"
     2561        else
     2562                cfa_incdir=${includedir}
     2563        fi
    25972564
    25982565cat >>confdefs.h <<_ACEOF
     
    26002567_ACEOF
    26012568
    2602 CFA_INCDIR=${cfa_incdir}
    2603 
    2604 
    2605 if test "$bindir" = '${exec_prefix}/bin'; then
    2606         cfa_bindir="${cfa_prefix}/bin"
    2607 else
    2608         cfa_bindir=${bindir}
    2609 fi
     2569        CFA_INCDIR=${cfa_incdir}
     2570
     2571
     2572        if test "$bindir" = '${exec_prefix}/bin'; then
     2573                cfa_bindir="${cfa_prefix}/bin"
     2574        else
     2575                cfa_bindir=${bindir}
     2576        fi
    26102577
    26112578cat >>confdefs.h <<_ACEOF
     
    26132580_ACEOF
    26142581
    2615 CFA_BINDIR=${cfa_bindir}
    2616 
    2617 
    2618 if test "$libdir" = '${exec_prefix}/lib'; then
    2619         cfa_libdir="${cfa_prefix}/lib/${cfa_name}"
    2620 else
    2621         cfa_libdir=${libdir}
    2622 fi
     2582        CFA_BINDIR=${cfa_bindir}
     2583
     2584
     2585        if test "$libdir" = '${exec_prefix}/lib'; then
     2586                cfa_libdir="${cfa_prefix}/lib/${cfa_name}/${ARCHITECTURE}${CONFIGURATION}"
     2587        else
     2588                cfa_libdir="${libdir}/${ARCHITECTURE}${CONFIGURATION}"
     2589        fi
    26232590
    26242591cat >>confdefs.h <<_ACEOF
     
    26262593_ACEOF
    26272594
    2628 CFA_LIBDIR=${cfa_libdir}
     2595        CFA_LIBDIR=${cfa_libdir}
     2596
    26292597
    26302598
  • libcfa/configure.ac

    r4dcaed2 r37fe352  
    66AC_CONFIG_AUX_DIR([./automake])
    77
     8m4_include([../automake/cfa.m4])
     9
    810AM_INIT_AUTOMAKE([subdir-objects])
    911
     
    1214AC_ARG_PROGRAM
    1315
    14 AC_CANONICAL_BUILD
    15 AC_CANONICAL_HOST
    16 
     16AC_ARG_VAR(ARCHITECTURE,  [The architecture  to use when building libcfa])
    1717AC_ARG_VAR(CONFIGURATION, [The configuration to use when building libcfa, options are: deubg, nodebug, nolib (prelude-only)])
    1818AC_ARG_VAR(DRIVER_DIR, [The path to the cforall driver directory])
     
    2323AC_SUBST(CFACPP)
    2424
     25case $ARCHITECTURE in
     26        "x64"        ) ARCH_FLAGS="-m64";;
     27        "x86"        ) ARCH_FLAGS="-m32";;
     28        "arm"        ) ARCH_FLAGS="";;
     29esac
     30
     31AC_SUBST(ARCH_FLAGS)
     32
     33#==============================================================================
     34#Trasforming cc1 will break compilation
     35M4CFA_PROGRAM_NAME
     36
    2537#==============================================================================
    2638# Installation paths
    27 if test "x$prefix" = "xNONE"; then
    28         cfa_prefix=${ac_default_prefix}
    29 else
    30         cfa_prefix=${prefix}
    31 fi
    32 AC_DEFINE_UNQUOTED(CFA_PREFIX, "${cfa_prefix}", [Location of cfa install.])
    33 AC_SUBST(CFA_PREFIX, ${cfa_prefix})
    34 
    35 if test "$includedir" = '${prefix}/include'; then
    36         cfa_incdir="${cfa_prefix}/include/${cfa_name}"
    37 else
    38         cfa_incdir=${includedir}
    39 fi
    40 AC_DEFINE_UNQUOTED(CFA_INCDIR, "${cfa_incdir}", [Location of include files.])
    41 AC_SUBST(CFA_INCDIR, ${cfa_incdir})
    42 
    43 if test "$bindir" = '${exec_prefix}/bin'; then
    44         cfa_bindir="${cfa_prefix}/bin"
    45 else
    46         cfa_bindir=${bindir}
    47 fi
    48 AC_DEFINE_UNQUOTED(CFA_BINDIR, "${cfa_bindir}", [Location of cfa command.])
    49 AC_SUBST(CFA_BINDIR, ${cfa_bindir})
    50 
    51 if test "$libdir" = '${exec_prefix}/lib'; then
    52         cfa_libdir="${cfa_prefix}/lib/${cfa_name}"
    53 else
    54         cfa_libdir=${libdir}
    55 fi
    56 AC_DEFINE_UNQUOTED(CFA_LIBDIR, "${cfa_libdir}", [Location of cc1 and cfa-cpp commands.])
    57 AC_SUBST(CFA_LIBDIR, ${cfa_libdir})
     39M4CFA_PARSE_PREFIX
    5840
    5941# Checks for programs.
  • libcfa/prelude/Makefile.am

    r4dcaed2 r37fe352  
    2424
    2525CC = @CFACC@
     26AM_CFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@
    2627
    2728$(DEPDIR) :
     
    3334# create extra forward types/declarations to reduce inclusion of library files
    3435extras.cf : ${srcdir}/extras.regx ${srcdir}/extras.c
    35         ${AM_V_GEN}gcc -E ${srcdir}/extras.c | grep -f ${srcdir}/extras.regx > extras.cf
     36        ${AM_V_GEN}gcc ${AM_CFLAGS} -E ${srcdir}/extras.c | grep -f ${srcdir}/extras.regx > extras.cf
    3637
    3738# create forward declarations for gcc builtins
     
    4344
    4445prelude.cf : prelude-gen.cc
    45         ${AM_V_GEN}${CXX} ${AM_CXXFLAGS} ${CXXFLAGS} ${<} -o prelude-gen -Wall -Wextra -O2 -g -std=c++14
     46        ${AM_V_GEN}${CXX} ${AM_CXXFLAGS} ${CXXFLAGS} ${AM_CFLAGS} ${<} -o prelude-gen -Wall -Wextra -O2 -g -std=c++14
    4647        @./prelude-gen > $@
    4748        @rm ./prelude-gen
     
    5354# create forward declarations for cfa builtins
    5455builtins.cf : builtins.c ${CC}
    55         ${AM_V_GEN}${CC} -E -P ${<} -o ${@} -MD -MP -MF $(DEPDIR)/builtins.Po
     56        ${AM_V_GEN}gcc ${AM_CFLAGS} -E -P ${<} -o ${@} -MD -MP -MF $(DEPDIR)/builtins.Po
    5657        ${AM_V_at}sed -i 's/builtins.o/builtins.cf/g' $(DEPDIR)/builtins.Po
    5758
     
    6768        rm -rf $(DEPDIR)
    6869
    69 MAINTAINERCLEANFILES = gcc-builtins.c gcc-builtins.cf builtins.cf extras.cf bootloader.c prelude.cf ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}
     70MOSTLYCLEANFILES = bootloader.c builtins.cf extras.cf gcc-builtins.c gcc-builtins.cf prelude.cf
     71MAINTAINERCLEANFILES = ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}
  • libcfa/prelude/Makefile.in

    r4dcaed2 r37fe352  
    9090PRE_UNINSTALL = :
    9191POST_UNINSTALL = :
    92 build_triplet = @build@
    93 host_triplet = @host@
    9492subdir = prelude
    9593ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    96 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
     94am__aclocal_m4_deps = $(top_srcdir)/../automake/cfa.m4 \
     95        $(top_srcdir)/configure.ac
    9796am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
    9897        $(ACLOCAL_M4)
     
    155154AMTAR = @AMTAR@
    156155AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
     156ARCHITECTURE = @ARCHITECTURE@
     157ARCH_FLAGS = @ARCH_FLAGS@
    157158AUTOCONF = @AUTOCONF@
    158159AUTOHEADER = @AUTOHEADER@
     
    169170CFA_INCDIR = @CFA_INCDIR@
    170171CFA_LIBDIR = @CFA_LIBDIR@
     172CFA_NAME = @CFA_NAME@
    171173CFA_PREFIX = @CFA_PREFIX@
    172174CFLAGS = @CFLAGS@
     
    221223am__untar = @am__untar@
    222224bindir = @bindir@
    223 build = @build@
    224225build_alias = @build_alias@
    225 build_cpu = @build_cpu@
    226 build_os = @build_os@
    227 build_vendor = @build_vendor@
    228226builddir = @builddir@
    229227datadir = @datadir@
     
    232230dvidir = @dvidir@
    233231exec_prefix = @exec_prefix@
    234 host = @host@
    235232host_alias = @host_alias@
    236 host_cpu = @host_cpu@
    237 host_os = @host_os@
    238 host_vendor = @host_vendor@
    239233htmldir = @htmldir@
    240234includedir = @includedir@
     
    269263cfalib_DATA = gcc-builtins.cf builtins.cf extras.cf prelude.cf bootloader.c
    270264noinst_DATA = ../src/prelude.c
    271 MAINTAINERCLEANFILES = gcc-builtins.c gcc-builtins.cf builtins.cf extras.cf bootloader.c prelude.cf ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}
     265AM_CFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@
     266MOSTLYCLEANFILES = bootloader.c builtins.cf extras.cf gcc-builtins.c gcc-builtins.cf prelude.cf
     267MAINTAINERCLEANFILES = ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}
    272268all: all-am
    273269
     
    387383        fi
    388384mostlyclean-generic:
     385        -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
    389386
    390387clean-generic:
     
    490487# create extra forward types/declarations to reduce inclusion of library files
    491488extras.cf : ${srcdir}/extras.regx ${srcdir}/extras.c
    492         ${AM_V_GEN}gcc -E ${srcdir}/extras.c | grep -f ${srcdir}/extras.regx > extras.cf
     489        ${AM_V_GEN}gcc ${AM_CFLAGS} -E ${srcdir}/extras.c | grep -f ${srcdir}/extras.regx > extras.cf
    493490
    494491# create forward declarations for gcc builtins
     
    500497
    501498prelude.cf : prelude-gen.cc
    502         ${AM_V_GEN}${CXX} ${AM_CXXFLAGS} ${CXXFLAGS} ${<} -o prelude-gen -Wall -Wextra -O2 -g -std=c++14
     499        ${AM_V_GEN}${CXX} ${AM_CXXFLAGS} ${CXXFLAGS} ${AM_CFLAGS} ${<} -o prelude-gen -Wall -Wextra -O2 -g -std=c++14
    503500        @./prelude-gen > $@
    504501        @rm ./prelude-gen
     
    510507# create forward declarations for cfa builtins
    511508builtins.cf : builtins.c ${CC}
    512         ${AM_V_GEN}${CC} -E -P ${<} -o ${@} -MD -MP -MF $(DEPDIR)/builtins.Po
     509        ${AM_V_GEN}gcc ${AM_CFLAGS} -E -P ${<} -o ${@} -MD -MP -MF $(DEPDIR)/builtins.Po
    513510        ${AM_V_at}sed -i 's/builtins.o/builtins.cf/g' $(DEPDIR)/builtins.Po
    514511
  • libcfa/src/Makefile.am

    r4dcaed2 r37fe352  
    2828# use -no-include-stdhdr to prevent rebuild cycles
    2929# The built sources must not depend on the installed headers
    30 AM_CFAFLAGS = -quiet -no-include-stdhdr -XCFA -t -B@DRIVER_DIR@ -XCFA --prelude-dir=$(top_builddir)/prelude -imacros prelude.c -I$(srcdir)/stdhdr
    31 AM_CFLAGS = -g -Wall -Wno-unused-function
     30AM_CFAFLAGS = -quiet -in-tree -B@DRIVER_DIR@ -XCFA --prelude-dir=$(top_builddir)/prelude -imacros prelude.c -I$(srcdir)/stdhdr
     31AM_CFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@
     32AM_CCASFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@
    3233CFACC = @CFACC@
    3334
     
    4344
    4445# not all platforms support concurrency, add option do disable it
    45 libsrc += concurrency/CtxSwitch-@host_cpu@.S concurrency/alarm.cfa concurrency/invoke.c concurrency/preemption.cfa
     46libsrc += concurrency/CtxSwitch-@ARCHITECTURE@.S concurrency/alarm.cfa concurrency/invoke.c concurrency/preemption.cfa
    4647
    4748# extensionless header files are overridden by -o flag in default makerule => explicitly override default rule to silently do nothing
  • libcfa/src/Makefile.in

    r4dcaed2 r37fe352  
    9191PRE_UNINSTALL = :
    9292POST_UNINSTALL = :
    93 build_triplet = @build@
    94 host_triplet = @host@
    9593subdir = src
    9694ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    97 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
     95am__aclocal_m4_deps = $(top_srcdir)/../automake/cfa.m4 \
     96        $(top_srcdir)/configure.ac
    9897am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
    9998        $(ACLOCAL_M4)
     
    151150        interpose.$(OBJEXT) bits/debug.$(OBJEXT) assert.$(OBJEXT) \
    152151        exception.$(OBJEXT) virtual.$(OBJEXT) heap.$(OBJEXT) \
    153         $(am__objects_1) concurrency/CtxSwitch-@host_cpu@.$(OBJEXT) \
     152        $(am__objects_1) \
     153        concurrency/CtxSwitch-@ARCHITECTURE@.$(OBJEXT) \
    154154        concurrency/alarm.$(OBJEXT) concurrency/invoke.$(OBJEXT) \
    155155        concurrency/preemption.$(OBJEXT)
     
    223223AMTAR = @AMTAR@
    224224AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
     225ARCHITECTURE = @ARCHITECTURE@
     226ARCH_FLAGS = @ARCH_FLAGS@
    225227AUTOCONF = @AUTOCONF@
    226228AUTOHEADER = @AUTOHEADER@
     
    237239CFA_INCDIR = @CFA_INCDIR@
    238240CFA_LIBDIR = @CFA_LIBDIR@
     241CFA_NAME = @CFA_NAME@
    239242CFA_PREFIX = @CFA_PREFIX@
    240243CFLAGS = @CFLAGS@
     
    289292am__untar = @am__untar@
    290293bindir = @bindir@
    291 build = @build@
    292294build_alias = @build_alias@
    293 build_cpu = @build_cpu@
    294 build_os = @build_os@
    295 build_vendor = @build_vendor@
    296295builddir = @builddir@
    297296datadir = @datadir@
     
    300299dvidir = @dvidir@
    301300exec_prefix = @exec_prefix@
    302 host = @host@
    303301host_alias = @host_alias@
    304 host_cpu = @host_cpu@
    305 host_os = @host_os@
    306 host_vendor = @host_vendor@
    307302htmldir = @htmldir@
    308303includedir = @includedir@
     
    344339# use -no-include-stdhdr to prevent rebuild cycles
    345340# The built sources must not depend on the installed headers
    346 AM_CFAFLAGS = -quiet -no-include-stdhdr -XCFA -t -B@DRIVER_DIR@ -XCFA --prelude-dir=$(top_builddir)/prelude -imacros prelude.c -I$(srcdir)/stdhdr
    347 AM_CFLAGS = -g -Wall -Wno-unused-function
     341AM_CFAFLAGS = -quiet -in-tree -B@DRIVER_DIR@ -XCFA --prelude-dir=$(top_builddir)/prelude -imacros prelude.c -I$(srcdir)/stdhdr
     342AM_CFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@
     343AM_CCASFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@
    348344
    349345# not all platforms support concurrency, add option do disable it
     
    357353libsrc = prelude.c startup.cfa interpose.cfa bits/debug.cfa assert.cfa \
    358354        exception.c virtual.c heap.cfa ${headers:=.cfa} \
    359         concurrency/CtxSwitch-@host_cpu@.S concurrency/alarm.cfa \
     355        concurrency/CtxSwitch-@ARCHITECTURE@.S concurrency/alarm.cfa \
    360356        concurrency/invoke.c concurrency/preemption.cfa
    361357libcfa_a_SOURCES = ${libsrc}
     
    479475concurrency/mutex.$(OBJEXT): concurrency/$(am__dirstamp) \
    480476        concurrency/$(DEPDIR)/$(am__dirstamp)
    481 concurrency/CtxSwitch-@host_cpu@.$(OBJEXT):  \
     477concurrency/CtxSwitch-@ARCHITECTURE@.$(OBJEXT):  \
    482478        concurrency/$(am__dirstamp) \
    483479        concurrency/$(DEPDIR)/$(am__dirstamp)
     
    506502@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prelude.Po@am__quote@
    507503@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/virtual.Po@am__quote@
    508 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/CtxSwitch-@host_cpu@.Po@am__quote@
     504@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/CtxSwitch-@ARCHITECTURE@.Po@am__quote@
    509505@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/invoke.Po@am__quote@
    510506
  • src/config.h.in

    r4dcaed2 r37fe352  
    11/* src/config.h.in.  Generated from configure.ac by autoheader.  */
     2
     3/* CPU to use if the -m32 flags is given. */
     4#undef CFA_32_CPU
     5
     6/* CPU to use if the -m64 flags is given. */
     7#undef CFA_64_CPU
    28
    39/* Location of include files. */
     
    612/* Location of cfa command. */
    713#undef CFA_BINDIR
     14
     15/* Default cpu to use if neither -m32 or -m64 are defined. */
     16#undef CFA_DEFAULT_CPU
    817
    918/* compilation flags for cfa libraries and test programs. */
  • src/main.cc

    r4dcaed2 r37fe352  
    209209                        // -l is for initial build ONLY and builtins.cf is not in the lib directory so access it here.
    210210
    211                         assertf( (libcfap | treep) != PreludeDirector.empty(), "When building in tree option --prelude-dir must be used." );
     211                        assertf( !PreludeDirector.empty(), "Can't find prelude without option --prelude-dir must be used." );
    212212
    213213                        // Read to gcc builtins, if not generating the cfa library
    214                         FILE * gcc_builtins = fopen( libcfap | treep ? (PreludeDirector + "/gcc-builtins.cf").c_str() : CFA_LIBDIR "/gcc-builtins.cf", "r" );
     214                        FILE * gcc_builtins = fopen( (PreludeDirector + "/gcc-builtins.cf").c_str(), "r" );
    215215                        assertf( gcc_builtins, "cannot open gcc-builtins.cf\n" );
    216216                        parse( gcc_builtins, LinkageSpec::Compiler );
    217217
    218218                        // read the extra prelude in, if not generating the cfa library
    219                         FILE * extras = fopen( libcfap | treep ? (PreludeDirector + "/extras.cf").c_str() : CFA_LIBDIR "/extras.cf", "r" );
     219                        FILE * extras = fopen( (PreludeDirector + "/extras.cf").c_str(), "r" );
    220220                        assertf( extras, "cannot open extras.cf\n" );
    221221                        parse( extras, LinkageSpec::BuiltinC );
     
    223223                        if ( ! libcfap ) {
    224224                                // read the prelude in, if not generating the cfa library
    225                                 FILE * prelude = fopen( treep ? (PreludeDirector + "/prelude.cf").c_str() : CFA_LIBDIR "/prelude.cf", "r" );
     225                                FILE * prelude = fopen( (PreludeDirector + "/prelude.cf").c_str(), "r" );
    226226                                assertf( prelude, "cannot open prelude.cf\n" );
    227227                                parse( prelude, LinkageSpec::Intrinsic );
    228228
    229229                                // Read to cfa builtins, if not generating the cfa library
    230                                 FILE * builtins = fopen( libcfap | treep ? (PreludeDirector + "/builtins.cf").c_str() : CFA_LIBDIR "/builtins.cf", "r" );
     230                                FILE * builtins = fopen( (PreludeDirector + "/builtins.cf").c_str(), "r" );
    231231                                assertf( builtins, "cannot open builtins.cf\n" );
    232232                                parse( builtins, LinkageSpec::BuiltinCFA );
     
    352352                PASS( "codegen", CodeGen::generate( translationUnit, *output, ! noprotop, prettycodegenp, true, linemarks ) );
    353353
    354                 CodeGen::FixMain::fix( *output, treep ? (PreludeDirector + "/bootloader.c").c_str() : CFA_LIBDIR "/bootloader.c" );
     354                CodeGen::FixMain::fix( *output, (PreludeDirector + "/bootloader.c").c_str() );
    355355                if ( output != &cout ) {
    356356                        delete output;
Note: See TracChangeset for help on using the changeset viewer.