source: configure.ac @ 9d362a0

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resnenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprno_listpersistent-indexerpthread-emulationqualifiedEnum
Last change on this file since 9d362a0 was 95d0a5db, checked in by Thierry Delisle <tdelisle@…>, 5 years ago

Removed backend_cc, everything now uses CC or CXX

  • Property mode set to 100644
File size: 7.4 KB
RevLine 
[5d6ce1f]1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ([2.68])
[4b1afb6]5AC_INIT([cfa-cc],[1.0.0.0],[cforall@plg.uwaterloo.ca])
[00cc023]6AC_CONFIG_AUX_DIR([automake])
[d3b7937]7#AC_CONFIG_SRCDIR([src/main.cc])
[a5c722b]8AC_CONFIG_HEADERS([config.h:src/config.h.in])
[575a6e5]9AM_SILENT_RULES([yes])
[5d6ce1f]10
[534e4e4]11m4_include([automake/cfa.m4])
12
[575a6e5]13# don't use the default CFLAGS as they unconditonnaly add -O2
14: ${CFLAGS=""}
15
[44f44617]16AM_INIT_AUTOMAKE([subdir-objects])
[00cc023]17
[df47e2f]18# Allow program name tansformation
[6363ad1]19# will fill program_transform_name with appropriate sed regex
[df47e2f]20AC_ARG_PROGRAM
21
[c59712e]22#==============================================================================
[df47e2f]23#Trasforming cc1 will break compilation
[37fe352]24M4CFA_PROGRAM_NAME
[c59712e]25
26#==============================================================================
27# version information
28
[65c61ec]29rm -f version
[2042d41]30echo ${PACKAGE_VERSION} > version               # file containing version number for other tools
[65c61ec]31chmod ugo-w version
[2042d41]32ver_major=`cut -d '.' -f1 version`              # subdivide version number into components at periods
33ver_minor=`cut -d '.' -f2 version`
34ver_patch=`cut -d '.' -f3 version`
35ver_build=`cut -d '.' -f4 version`
[47a8d17]36
[4b1afb6]37# AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/version'])
[47a8d17]38AC_DEFINE_UNQUOTED(CFA_VERSION_MAJOR, ${ver_major}, [Major version number.])
39AC_DEFINE_UNQUOTED(CFA_VERSION_MINOR, ${ver_minor}, [Minor version number.])
40AC_DEFINE_UNQUOTED(CFA_VERSION_PATCH, ${ver_patch}, [Patch version number.])
41AC_DEFINE_UNQUOTED(CFA_VERSION_BUILD, ${ver_build}, [Build version number.])
[4b1afb6]42AC_DEFINE_UNQUOTED(CFA_VERSION_SHORT, ["${ver_major}"], [Major])
43AC_DEFINE_UNQUOTED(CFA_VERSION, ["${ver_major}.${ver_minor}"], [Major.Minor])
44AC_DEFINE_UNQUOTED(CFA_VERSION_LONG, ["${ver_major}.${ver_minor}.${ver_patch}"], [Major.Minor.Patch])
45AC_DEFINE_UNQUOTED(CFA_VERSION_FULL, ["${ver_major}.${ver_minor}.${ver_patch}.${ver_build}"], [Major.Minor.Patch.Build])
[ec129c4]46
[c59712e]47#==============================================================================
48# HACK to be able to use conditionnals inside makefiles
[05f4b85]49DOifskipcompile='ifeq ($(skipcompile),yes)
50else'
51AC_SUBST([DOifskipcompile])
52AM_SUBST_NOTMAKE([DOifskipcompile])
53
54DOendif='endif'
55AC_SUBST([DOendif])
56AM_SUBST_NOTMAKE([DOendif])
57
[c59712e]58#==============================================================================
59# Installation paths
[534e4e4]60M4CFA_PARSE_PREFIX
[5d6ce1f]61
[c59712e]62#==============================================================================
[50697b0]63# Create variables for commonly used targets
[ff1e0f38]64
[8e485801]65TOP_SRCDIR="$(readlink -m $ac_confdir/)/"
66TOP_BUILDDIR="$(readlink -m $ac_pwd/)/"
[ff1e0f38]67
68AC_DEFINE_UNQUOTED(TOP_SRCDIR, "$TOP_SRCDIR", [Top src directory])
69AC_DEFINE_UNQUOTED(TOP_BUILDDIR, "$TOP_BUILDDIR", [Top build directory])
70
71DRIVER_DIR=${TOP_BUILDDIR}driver/
72CFACC=${DRIVER_DIR}cfa
73CFACPP=${DRIVER_DIR}cfa-cpp
[7fb69f6]74AC_SUBST(DRIVER_DIR)
75AC_SUBST(CFACC)
[50697b0]76AC_SUBST(CFACPP)
77
[c59712e]78#==============================================================================
[7fb69f6]79# Flag variables needed to build in tree
[ff1e0f38]80LIBCFA_SRC='${TOP_SRCDIR}/libcfa/src'
81BUILD_IN_TREE_FLAGS="-XCFA -t -B${DRIVER_DIR}"
[7fb69f6]82AC_SUBST(BUILD_IN_TREE_FLAGS)
83
[ff1e0f38]84#==============================================================================
85# handle the list of hosts to build for
86for var in $ac_configure_args
87do
88        #strip quotes surrouding values
89        case $var in
90                # skip cross compilation related arguments
[534e4e4]91                \'--host=*) ;; \'host_alias=*) ;; \'--build=*) ;; \'build_alias=*) ;; \'--target=*) ;; \'target_alias=*) ;;
[ff1e0f38]92
93                # skip the target hosts
[534e4e4]94                \'--with-target-hosts=*) ;;
[ff1e0f38]95
96                # append all other arguments to the sub configure arguments
97                *) LIBCFA_GENERAL_ARGS="${LIBCFA_GENERAL_ARGS} $var";;
98        esac
99done
100
101#==============================================================================
102# handle the list of hosts to build for
103AC_CANONICAL_BUILD
104AC_CANONICAL_HOST
105
[47c1928]106if ! test "$host_cpu" = "$build_cpu"; then
107        case $host_cpu in
108                i386)
109                        HOST_FLAGS="-m32"
110                        ;;
111                i686)
112                        HOST_FLAGS="-m32"
113                        ;;
114                x86_64)
115                        HOST_FLAGS="-m64"
116                        ;;
117        esac
118fi
119AC_SUBST(HOST_FLAGS)
120
[ff1e0f38]121default_target="${host_cpu}:debug, ${host_cpu}:nodebug"
122AC_ARG_WITH(target-hosts,
123        [  --with-target-hosts=HOSTS     HOSTS comma seperated list of hosts to build for, format ARCH:[debug|nodebug|nolib]],
124        target_hosts=$withval, target_hosts=${default_target})
125
126AC_SUBST(TARGET_HOSTS, ${target_hosts})
127
128LIBCFA_PATHS="DRIVER_DIR=${DRIVER_DIR}"
129
130for i in $(echo $target_hosts | sed "s/,/ /g")
131do
132        # call your procedure/other scripts here below
[534e4e4]133        arch_name=$(echo $i | sed -r "s/:(.*)//g")
[ff1e0f38]134        lib_config=$(echo $i | sed -r "s/(.*)://g")
[37fe352]135
136        case $lib_config in
137                "nodebug") ;;
138                "debug") ;;
139                "nolib") ;;
140                *)
141                        >&2 echo "Configuration must be 'debug', 'nodebug' or 'nolib'"
142                        exit 1
143                ;;
144        esac
145
146        M4CFA_CANNON_CPU([${arch_name}])
147        lib_arch=${cannon_arch_name}
[a5121bf]148        lib_dir="libcfa/${lib_arch}-${lib_config}"
[ff1e0f38]149
150        LIBCFA_TARGET_DIRS="${LIBCFA_TARGET_DIRS} ${lib_dir}"
151        LIBCFA_TARGET_MAKEFILES="${LIBCFA_TARGET_MAKEFILES} ${lib_dir}/Makefile"
152
[a5121bf]153        mkdir -p ${lib_dir}
154        echo -n "${LIBCFA_GENERAL_ARGS} " > ${lib_dir}/config.data
155        echo -n "${LIBCFA_PATHS} " >> ${lib_dir}/config.data
156        echo -n "ARCHITECTURE=${lib_arch} " >> ${lib_dir}/config.data
[c6bbcdb]157        echo -n "CONFIGURATION=${lib_config} " >> ${lib_dir}/config.data
158        echo -n "CFA_VERSION=${ver_major}:${ver_minor}:${ver_patch}" >> ${lib_dir}/config.data
[ff1e0f38]159done
160
161AC_SUBST(LIBCFA_TARGET_DIRS)
162AC_SUBST(LIBCFA_TARGET_MAKEFILES)
163
[37fe352]164M4CFA_CANNON_CPU([${host_cpu}])
165AC_DEFINE_UNQUOTED(CFA_DEFAULT_CPU, "$cannon_arch_name", [Default cpu to use if neither -m32 or -m64 are defined.])
166AC_DEFINE_UNQUOTED(CFA_64_CPU, "x64", [CPU to use if the -m64 flags is given.])
167AC_DEFINE_UNQUOTED(CFA_32_CPU, "x86", [CPU to use if the -m32 flags is given.])
168
[c59712e]169#==============================================================================
170# CAFLAGS
[3f414ef]171AC_DEFINE_UNQUOTED(CFA_FLAGS, "${CFAFLAGS}", [compilation flags for cfa libraries and test programs.])
172AC_SUBST(CFA_FLAGS, ${CFAFLAGS})
173
[c59712e]174#==============================================================================
[5d6ce1f]175# Checks for programs.
176AC_PROG_CXX
177AC_PROG_CC
[8e5724e]178AM_PROG_AS
[00cc023]179AM_PROG_CC_C_O  # deprecated
[c3a4385]180# These are often not installed and people miss seeing the "no", so stop the configure.
[56c3935]181AC_PROG_YACC
[c3a4385]182if test "${YACC}" = "yacc" ; then echo "Error: bison required." ; exit 1 ; fi
[56c3935]183AC_PROG_LEX
[c3a4385]184if test "${LEX}" = "lex" ; then echo "Error: flex required." ; exit 1 ; fi
[5d6ce1f]185AC_PROG_INSTALL
186AC_PROG_MAKE_SET
[00cc023]187AC_PROG_RANLIB
[5d6ce1f]188
189# Checks for libraries.
[41cca44]190AC_CHECK_LIB([fibre], [Fibre::yield], [HAVE_LIBFIBRE=1], [HAVE_LIBFIBRE=0])
191AM_CONDITIONAL([WITH_LIBFIBRE], [test "$HAVE_LIBFIBRE" -eq 1])
[5d6ce1f]192
193# Checks for header files.
194AC_FUNC_ALLOCA
195AC_CHECK_HEADERS([fenv.h float.h inttypes.h libintl.h limits.h malloc.h stddef.h stdlib.h string.h unistd.h])
196
197# Checks for typedefs, structures, and compiler characteristics.
198AC_HEADER_STDBOOL
199AC_C_INLINE
200AC_TYPE_INT16_T
201AC_TYPE_INT32_T
202AC_TYPE_INT8_T
203AC_C_RESTRICT
204AC_TYPE_SIZE_T
205AC_TYPE_UINT16_T
206AC_TYPE_UINT32_T
207AC_TYPE_UINT8_T
208
209# Checks for library functions.
210AC_CHECK_FUNCS([memset putenv strchr strtol])
211
[95d0a5db]212#==============================================================================
213# backend compiler implementation
214AC_DEFINE_UNQUOTED(CFA_BACKEND_CC, "${CC}", [Backend compiler to use.])
215AC_SUBST(CFA_BACKEND_CC)
216
[c59712e]217#==============================================================================
[00cc023]218AC_CONFIG_FILES([
219        Makefile
[bf71cfd]220        driver/Makefile
[00cc023]221        src/Makefile
[bf71cfd]222        benchmark/Makefile
223        tests/Makefile
224        tests/preempt_longrun/Makefile
[4149d9d]225        tools/Makefile
[2b7afbd]226        tools/prettyprinter/Makefile
[00cc023]227        ])
[5d6ce1f]228
[bf71cfd]229AC_CONFIG_LINKS([tests/test.py:tests/test.py])
[56de5932]230
[bf71cfd]231AC_OUTPUT(tests/config.py)
[7e91d4f]232
[5d6ce1f]233# Final text
234AC_MSG_RESULT(Cforall configuraton completed. Type "make -j 8 install".)
Note: See TracBrowser for help on using the repository browser.