source: configure.ac@ b26144d

ADT arm-eh ast-experimental enum forall-pointer-decay jacob/cs343-translation new-ast-unique-expr pthread-emulation qualifiedEnum
Last change on this file since b26144d was 0ea0b8f, checked in by Thierry Delisle <tdelisle@…>, 5 years ago

Using new-ast now requires configuring with --enable-new-ast or compiling with -XCFA,--new-ast

  • Property mode set to 100644
File size: 9.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])
[a5c722b]8AC_CONFIG_HEADERS([config.h:src/config.h.in])
[575a6e5]9AM_SILENT_RULES([yes])
[5d6ce1f]10
[0c30ecc]11m4_include([tools/build/cfa.m4])
[534e4e4]12
[575a6e5]13# don't use the default CFLAGS as they unconditonnaly add -O2
14: ${CFLAGS=""}
[c886f4b]15: ${CXXFLAGS=""}
[575a6e5]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
[0ea0b8f]27#==============================================================================
28# New AST toggling support
29AH_TEMPLATE([CFA_USE_NEW_AST],[Sets whether or not to use the new-ast, this is adefault value and can be overrided by --old-ast and --new-ast])
30AC_ARG_ENABLE(new-ast,
31 [ --enable-new-ast whether or not to use new ast as the default AST algorithm],
32 [case "${enableval}" in
33 yes) newast=true ;;
34 no) newast=false ;;
35 *) AC_MSG_ERROR([bad value ${enableval} for --enable-new-ast]) ;;
36 esac],[newast=false])
37AC_DEFINE_UNQUOTED([CFA_USE_NEW_AST], $newast)
38
[c59712e]39#==============================================================================
40# version information
41
[65c61ec]42rm -f version
[2042d41]43echo ${PACKAGE_VERSION} > version # file containing version number for other tools
[65c61ec]44chmod ugo-w version
[2042d41]45ver_major=`cut -d '.' -f1 version` # subdivide version number into components at periods
46ver_minor=`cut -d '.' -f2 version`
47ver_patch=`cut -d '.' -f3 version`
48ver_build=`cut -d '.' -f4 version`
[47a8d17]49
[4b1afb6]50# AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/version'])
[47a8d17]51AC_DEFINE_UNQUOTED(CFA_VERSION_MAJOR, ${ver_major}, [Major version number.])
52AC_DEFINE_UNQUOTED(CFA_VERSION_MINOR, ${ver_minor}, [Minor version number.])
53AC_DEFINE_UNQUOTED(CFA_VERSION_PATCH, ${ver_patch}, [Patch version number.])
54AC_DEFINE_UNQUOTED(CFA_VERSION_BUILD, ${ver_build}, [Build version number.])
[4b1afb6]55AC_DEFINE_UNQUOTED(CFA_VERSION_SHORT, ["${ver_major}"], [Major])
56AC_DEFINE_UNQUOTED(CFA_VERSION, ["${ver_major}.${ver_minor}"], [Major.Minor])
57AC_DEFINE_UNQUOTED(CFA_VERSION_LONG, ["${ver_major}.${ver_minor}.${ver_patch}"], [Major.Minor.Patch])
58AC_DEFINE_UNQUOTED(CFA_VERSION_FULL, ["${ver_major}.${ver_minor}.${ver_patch}.${ver_build}"], [Major.Minor.Patch.Build])
[ec129c4]59
[c59712e]60#==============================================================================
61# HACK to be able to use conditionnals inside makefiles
[05f4b85]62DOifskipcompile='ifeq ($(skipcompile),yes)
63else'
64AC_SUBST([DOifskipcompile])
65AM_SUBST_NOTMAKE([DOifskipcompile])
66
67DOendif='endif'
68AC_SUBST([DOendif])
69AM_SUBST_NOTMAKE([DOendif])
70
[bbfd0e0]71#==============================================================================
72# distcc support
73
74AC_ARG_ENABLE(distcc,
75 [ --enable-distcc whether or not to enable distributed compilation],
76 enable_distcc=$enableval, enable_distcc=no)
77
[7c6b262]78AC_ARG_WITH(bwlimit,
79 [ --with-bwlimit=RATE RATE the maximum rate at which rsync will be limited when using distributed builds],
80 [], [])
81
[bbfd0e0]82AM_CONDITIONAL([ENABLE_DISTCC], [test x$enable_distcc = xyes])
[d65f92c]83HAS_DISTCC="False"
[bbfd0e0]84
85if test x$enable_distcc = xyes; then
86 CXX="distcc ${CXX}"
87 LD="distcc ${LD} -lstdc++"
[d65f92c]88 HAS_DISTCC="True"
[bbfd0e0]89 echo "Enabling distributed builds"
90fi
91
92AC_SUBST(CXX)
93AC_SUBST(LD)
[d65f92c]94AC_SUBST(HAS_DISTCC)
[bbfd0e0]95
[c59712e]96#==============================================================================
97# Installation paths
[534e4e4]98M4CFA_PARSE_PREFIX
[5d6ce1f]99
[c59712e]100#==============================================================================
[50697b0]101# Create variables for commonly used targets
[ff1e0f38]102
[8e485801]103TOP_SRCDIR="$(readlink -m $ac_confdir/)/"
104TOP_BUILDDIR="$(readlink -m $ac_pwd/)/"
[ff1e0f38]105
106AC_DEFINE_UNQUOTED(TOP_SRCDIR, "$TOP_SRCDIR", [Top src directory])
107AC_DEFINE_UNQUOTED(TOP_BUILDDIR, "$TOP_BUILDDIR", [Top build directory])
108
109DRIVER_DIR=${TOP_BUILDDIR}driver/
110CFACC=${DRIVER_DIR}cfa
[158b026]111CFACC_INSTALL=${CFA_BINDIR}${CFA_NAME}
[ff1e0f38]112CFACPP=${DRIVER_DIR}cfa-cpp
[7fb69f6]113AC_SUBST(DRIVER_DIR)
114AC_SUBST(CFACC)
[158b026]115AC_SUBST(CFACC_INSTALL)
[50697b0]116AC_SUBST(CFACPP)
117
[c59712e]118#==============================================================================
[7fb69f6]119# Flag variables needed to build in tree
[ff1e0f38]120LIBCFA_SRC='${TOP_SRCDIR}/libcfa/src'
121BUILD_IN_TREE_FLAGS="-XCFA -t -B${DRIVER_DIR}"
[7fb69f6]122AC_SUBST(BUILD_IN_TREE_FLAGS)
123
[ff1e0f38]124#==============================================================================
125# handle the list of hosts to build for
126for var in $ac_configure_args
127do
128 #strip quotes surrouding values
129 case $var in
130 # skip cross compilation related arguments
[534e4e4]131 \'--host=*) ;; \'host_alias=*) ;; \'--build=*) ;; \'build_alias=*) ;; \'--target=*) ;; \'target_alias=*) ;;
[ff1e0f38]132
133 # skip the target hosts
[534e4e4]134 \'--with-target-hosts=*) ;;
[ff1e0f38]135
[120a28c3]136 # skip gprofiler for libcfa
137 \'--enable-gprofiler=*) ;;
138 \'--disable-gprofiler) ;;
139
[ff1e0f38]140 # append all other arguments to the sub configure arguments
141 *) LIBCFA_GENERAL_ARGS="${LIBCFA_GENERAL_ARGS} $var";;
142 esac
143done
144
145#==============================================================================
146# handle the list of hosts to build for
147AC_CANONICAL_BUILD
148AC_CANONICAL_HOST
149
[47c1928]150if ! test "$host_cpu" = "$build_cpu"; then
151 case $host_cpu in
152 i386)
153 HOST_FLAGS="-m32"
154 ;;
155 i686)
156 HOST_FLAGS="-m32"
157 ;;
158 x86_64)
159 HOST_FLAGS="-m64"
160 ;;
161 esac
162fi
163AC_SUBST(HOST_FLAGS)
164
[ff1e0f38]165default_target="${host_cpu}:debug, ${host_cpu}:nodebug"
166AC_ARG_WITH(target-hosts,
167 [ --with-target-hosts=HOSTS HOSTS comma seperated list of hosts to build for, format ARCH:[debug|nodebug|nolib]],
168 target_hosts=$withval, target_hosts=${default_target})
169
[120a28c3]170AC_ARG_ENABLE(gprofiler,
171 [ --enable-gprofiler whether or not to enable gprofiler tools (if available)],
172 enable_gprofiler=$enableval, enable_gprofiler=yes)
173
[df8b87cd]174AC_ARG_ENABLE(demangler,
175 [ --enable-demangler whether or not to build the demangler (executable and library)],
176 enable_demangler=$enableval, enable_demangler=yes)
177
[ff1e0f38]178AC_SUBST(TARGET_HOSTS, ${target_hosts})
179
180LIBCFA_PATHS="DRIVER_DIR=${DRIVER_DIR}"
181
182for i in $(echo $target_hosts | sed "s/,/ /g")
183do
184 # call your procedure/other scripts here below
[534e4e4]185 arch_name=$(echo $i | sed -r "s/:(.*)//g")
[ff1e0f38]186 lib_config=$(echo $i | sed -r "s/(.*)://g")
[37fe352]187
188 case $lib_config in
189 "nodebug") ;;
190 "debug") ;;
191 "nolib") ;;
[3fcbdca1]192 "profile") ;;
[37fe352]193 *)
194 >&2 echo "Configuration must be 'debug', 'nodebug' or 'nolib'"
195 exit 1
196 ;;
197 esac
198
199 M4CFA_CANNON_CPU([${arch_name}])
200 lib_arch=${cannon_arch_name}
[a5121bf]201 lib_dir="libcfa/${lib_arch}-${lib_config}"
[ff1e0f38]202
203 LIBCFA_TARGET_DIRS="${LIBCFA_TARGET_DIRS} ${lib_dir}"
204 LIBCFA_TARGET_MAKEFILES="${LIBCFA_TARGET_MAKEFILES} ${lib_dir}/Makefile"
205
[a5121bf]206 mkdir -p ${lib_dir}
207 echo -n "${LIBCFA_GENERAL_ARGS} " > ${lib_dir}/config.data
208 echo -n "${LIBCFA_PATHS} " >> ${lib_dir}/config.data
209 echo -n "ARCHITECTURE=${lib_arch} " >> ${lib_dir}/config.data
[c6bbcdb]210 echo -n "CONFIGURATION=${lib_config} " >> ${lib_dir}/config.data
211 echo -n "CFA_VERSION=${ver_major}:${ver_minor}:${ver_patch}" >> ${lib_dir}/config.data
[ff1e0f38]212done
213
214AC_SUBST(LIBCFA_TARGET_DIRS)
215AC_SUBST(LIBCFA_TARGET_MAKEFILES)
216
[37fe352]217M4CFA_CANNON_CPU([${host_cpu}])
218AC_DEFINE_UNQUOTED(CFA_DEFAULT_CPU, "$cannon_arch_name", [Default cpu to use if neither -m32 or -m64 are defined.])
219AC_DEFINE_UNQUOTED(CFA_64_CPU, "x64", [CPU to use if the -m64 flags is given.])
220AC_DEFINE_UNQUOTED(CFA_32_CPU, "x86", [CPU to use if the -m32 flags is given.])
221
[c59712e]222#==============================================================================
223# CAFLAGS
[3f414ef]224AC_DEFINE_UNQUOTED(CFA_FLAGS, "${CFAFLAGS}", [compilation flags for cfa libraries and test programs.])
225AC_SUBST(CFA_FLAGS, ${CFAFLAGS})
226
[c59712e]227#==============================================================================
[5d6ce1f]228# Checks for programs.
229AC_PROG_CXX
230AC_PROG_CC
[8e5724e]231AM_PROG_AS
[c3a4385]232# These are often not installed and people miss seeing the "no", so stop the configure.
[56c3935]233AC_PROG_YACC
[c3a4385]234if test "${YACC}" = "yacc" ; then echo "Error: bison required." ; exit 1 ; fi
[56c3935]235AC_PROG_LEX
[c3a4385]236if test "${LEX}" = "lex" ; then echo "Error: flex required." ; exit 1 ; fi
[107b01a]237AC_PROG_LIBTOOL
[5d6ce1f]238AC_PROG_INSTALL
239
240# Checks for libraries.
[41cca44]241AC_CHECK_LIB([fibre], [Fibre::yield], [HAVE_LIBFIBRE=1], [HAVE_LIBFIBRE=0])
242AM_CONDITIONAL([WITH_LIBFIBRE], [test "$HAVE_LIBFIBRE" -eq 1])
[5d6ce1f]243
[114936a]244AC_CHECK_LIB([profiler], [ProfilingIsEnabledForAllThreads], [HAVE_LIBPROFILER=1], [HAVE_LIBPROFILER=0])
[120a28c3]245AM_CONDITIONAL([WITH_LIBPROFILER], [test "x$enable_gprofiler" = "xyes" -a "$HAVE_LIBPROFILER" -eq 1])
[114936a]246
247AC_CHECK_LIB([tcmalloc], [malloc], [HAVE_LIBTCMALLOC=1], [HAVE_LIBTCMALLOC=0])
[120a28c3]248AM_CONDITIONAL([WITH_LIBTCMALLOC], [test "x$enable_gprofiler" = "xyes" -a "$HAVE_LIBTCMALLOC" -eq 1])
[114936a]249
[df8b87cd]250# conditionnally build the demangler
251if test "x$enable_demangler" == xyes; then
252 LIBDEMANGLE="libdemangle.a"
253 DEMANGLER="demangler"
254else
255 LIBDEMANGLE=""
256 DEMANGLER=""
257fi
258AC_SUBST([LIBDEMANGLE])
259AC_SUBST([DEMANGLER])
260
[5d6ce1f]261# Checks for header files.
[1f86d5e]262AC_CHECK_HEADERS([libintl.h malloc.h unistd.h], [], [echo "Error: Missing required header"; exit 1])
[5d6ce1f]263
264# Checks for typedefs, structures, and compiler characteristics.
[1f86d5e]265AC_CHECK_TYPES([_Float32], AC_DEFINE([HAVE_KEYWORDS_FLOATXX], [], [Have keywords _FloatXX.]), [], [[]])
266
267# Checks for compiler flags.
268M4CFA_CHECK_COMPILE_FLAG([-Wcast-function-type], AC_DEFINE([HAVE_CAST_FUNCTION_TYPE], [], [Have compiler warning cast-function-type.]))
[5d6ce1f]269
[95d0a5db]270#==============================================================================
271# backend compiler implementation
272AC_DEFINE_UNQUOTED(CFA_BACKEND_CC, "${CC}", [Backend compiler to use.])
273AC_SUBST(CFA_BACKEND_CC)
274
[c59712e]275#==============================================================================
[00cc023]276AC_CONFIG_FILES([
277 Makefile
[bf71cfd]278 driver/Makefile
[00cc023]279 src/Makefile
[bf71cfd]280 benchmark/Makefile
281 tests/Makefile
[1241851]282 longrun_tests/Makefile
[4149d9d]283 tools/Makefile
[2b7afbd]284 tools/prettyprinter/Makefile
[00cc023]285 ])
[5d6ce1f]286
[bf71cfd]287AC_CONFIG_LINKS([tests/test.py:tests/test.py])
[56de5932]288
[bf71cfd]289AC_OUTPUT(tests/config.py)
[7e91d4f]290
[5d6ce1f]291# Final text
292AC_MSG_RESULT(Cforall configuraton completed. Type "make -j 8 install".)
Note: See TracBrowser for help on using the repository browser.