source: configure.ac @ 21a44ca

ADTarm-ehast-experimentalcleanup-dtorsenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 21a44ca was 3fcbdca1, checked in by Thierry Delisle <tdelisle@…>, 6 years ago

Moved compilation to use O3/Og instead of O2/O0 for both cfa-cpp and libcfa

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