source: configure.ac @ 9fb8f01

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 9fb8f01 was df8b87cd, checked in by Thierry Delisle <tdelisle@…>, 5 years ago

Demangler can now be disable to avoid compiling it (enabled by default)

  • Property mode set to 100644
File size: 8.4 KB
Line 
1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ([2.68])
5AC_INIT([cfa-cc],[1.0.0.0],[cforall@plg.uwaterloo.ca])
6AC_CONFIG_AUX_DIR([automake])
7AC_CONFIG_MACRO_DIRS([automake])
8#AC_CONFIG_SRCDIR([src/main.cc])
9AC_CONFIG_HEADERS([config.h:src/config.h.in])
10AM_SILENT_RULES([yes])
11
12m4_include([automake/cfa.m4])
13
14# don't use the default CFLAGS as they unconditonnaly add -O2
15: ${CFLAGS=""}
16
17AM_INIT_AUTOMAKE([subdir-objects])
18
19# Allow program name tansformation
20# will fill program_transform_name with appropriate sed regex
21AC_ARG_PROGRAM
22
23#==============================================================================
24#Trasforming cc1 will break compilation
25M4CFA_PROGRAM_NAME
26
27#==============================================================================
28# version information
29
30rm -f version
31echo ${PACKAGE_VERSION} > version               # file containing version number for other tools
32chmod ugo-w version
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`
37
38# AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/version'])
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.])
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])
47
48#==============================================================================
49# HACK to be able to use conditionnals inside makefiles
50DOifskipcompile='ifeq ($(skipcompile),yes)
51else'
52AC_SUBST([DOifskipcompile])
53AM_SUBST_NOTMAKE([DOifskipcompile])
54
55DOendif='endif'
56AC_SUBST([DOendif])
57AM_SUBST_NOTMAKE([DOendif])
58
59#==============================================================================
60# Installation paths
61M4CFA_PARSE_PREFIX
62
63#==============================================================================
64# Create variables for commonly used targets
65
66TOP_SRCDIR="$(readlink -m $ac_confdir/)/"
67TOP_BUILDDIR="$(readlink -m $ac_pwd/)/"
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
75AC_SUBST(DRIVER_DIR)
76AC_SUBST(CFACC)
77AC_SUBST(CFACPP)
78
79#==============================================================================
80# Flag variables needed to build in tree
81LIBCFA_SRC='${TOP_SRCDIR}/libcfa/src'
82BUILD_IN_TREE_FLAGS="-XCFA -t -B${DRIVER_DIR}"
83AC_SUBST(BUILD_IN_TREE_FLAGS)
84
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
92                \'--host=*) ;; \'host_alias=*) ;; \'--build=*) ;; \'build_alias=*) ;; \'--target=*) ;; \'target_alias=*) ;;
93
94                # skip the target hosts
95                \'--with-target-hosts=*) ;;
96
97                # skip gprofiler for libcfa
98                \'--enable-gprofiler=*) ;;
99                \'--disable-gprofiler) ;;
100
101                # append all other arguments to the sub configure arguments
102                *) LIBCFA_GENERAL_ARGS="${LIBCFA_GENERAL_ARGS} $var";;
103        esac
104done
105
106#==============================================================================
107# handle the list of hosts to build for
108AC_CANONICAL_BUILD
109AC_CANONICAL_HOST
110
111if ! test "$host_cpu" = "$build_cpu"; then
112        case $host_cpu in
113                i386)
114                        HOST_FLAGS="-m32"
115                        ;;
116                i686)
117                        HOST_FLAGS="-m32"
118                        ;;
119                x86_64)
120                        HOST_FLAGS="-m64"
121                        ;;
122        esac
123fi
124AC_SUBST(HOST_FLAGS)
125
126default_target="${host_cpu}:debug, ${host_cpu}:nodebug"
127AC_ARG_WITH(target-hosts,
128        [  --with-target-hosts=HOSTS     HOSTS comma seperated list of hosts to build for, format ARCH:[debug|nodebug|nolib]],
129        target_hosts=$withval, target_hosts=${default_target})
130
131AC_ARG_ENABLE(gprofiler,
132        [  --enable-gprofiler     whether or not to enable gprofiler tools (if available)],
133        enable_gprofiler=$enableval, enable_gprofiler=yes)
134
135AC_ARG_ENABLE(demangler,
136        [  --enable-demangler     whether or not to build the demangler (executable and library)],
137        enable_demangler=$enableval, enable_demangler=yes)
138
139AC_SUBST(TARGET_HOSTS, ${target_hosts})
140
141LIBCFA_PATHS="DRIVER_DIR=${DRIVER_DIR}"
142
143for i in $(echo $target_hosts | sed "s/,/ /g")
144do
145        # call your procedure/other scripts here below
146        arch_name=$(echo $i | sed -r "s/:(.*)//g")
147        lib_config=$(echo $i | sed -r "s/(.*)://g")
148
149        case $lib_config in
150                "nodebug") ;;
151                "debug") ;;
152                "nolib") ;;
153                "profile") ;;
154                *)
155                        >&2 echo "Configuration must be 'debug', 'nodebug' or 'nolib'"
156                        exit 1
157                ;;
158        esac
159
160        M4CFA_CANNON_CPU([${arch_name}])
161        lib_arch=${cannon_arch_name}
162        lib_dir="libcfa/${lib_arch}-${lib_config}"
163
164        LIBCFA_TARGET_DIRS="${LIBCFA_TARGET_DIRS} ${lib_dir}"
165        LIBCFA_TARGET_MAKEFILES="${LIBCFA_TARGET_MAKEFILES} ${lib_dir}/Makefile"
166
167        mkdir -p ${lib_dir}
168        echo -n "${LIBCFA_GENERAL_ARGS} " > ${lib_dir}/config.data
169        echo -n "${LIBCFA_PATHS} " >> ${lib_dir}/config.data
170        echo -n "ARCHITECTURE=${lib_arch} " >> ${lib_dir}/config.data
171        echo -n "CONFIGURATION=${lib_config} " >> ${lib_dir}/config.data
172        echo -n "CFA_VERSION=${ver_major}:${ver_minor}:${ver_patch}" >> ${lib_dir}/config.data
173done
174
175AC_SUBST(LIBCFA_TARGET_DIRS)
176AC_SUBST(LIBCFA_TARGET_MAKEFILES)
177
178M4CFA_CANNON_CPU([${host_cpu}])
179AC_DEFINE_UNQUOTED(CFA_DEFAULT_CPU, "$cannon_arch_name", [Default cpu to use if neither -m32 or -m64 are defined.])
180AC_DEFINE_UNQUOTED(CFA_64_CPU, "x64", [CPU to use if the -m64 flags is given.])
181AC_DEFINE_UNQUOTED(CFA_32_CPU, "x86", [CPU to use if the -m32 flags is given.])
182
183#==============================================================================
184# CAFLAGS
185AC_DEFINE_UNQUOTED(CFA_FLAGS, "${CFAFLAGS}", [compilation flags for cfa libraries and test programs.])
186AC_SUBST(CFA_FLAGS, ${CFAFLAGS})
187
188#==============================================================================
189# Checks for programs.
190AC_PROG_CXX
191AC_PROG_CC
192AM_PROG_AS
193# These are often not installed and people miss seeing the "no", so stop the configure.
194AC_PROG_YACC
195if test "${YACC}" = "yacc" ; then echo "Error: bison required." ; exit 1 ; fi
196AC_PROG_LEX
197if test "${LEX}" = "lex" ; then echo "Error: flex required." ; exit 1 ; fi
198AC_PROG_LIBTOOL
199AC_PROG_INSTALL
200
201# Checks for libraries.
202AC_CHECK_LIB([fibre], [Fibre::yield], [HAVE_LIBFIBRE=1], [HAVE_LIBFIBRE=0])
203AM_CONDITIONAL([WITH_LIBFIBRE], [test "$HAVE_LIBFIBRE" -eq 1])
204
205AC_CHECK_LIB([profiler], [ProfilingIsEnabledForAllThreads], [HAVE_LIBPROFILER=1], [HAVE_LIBPROFILER=0])
206AM_CONDITIONAL([WITH_LIBPROFILER], [test "x$enable_gprofiler" = "xyes" -a "$HAVE_LIBPROFILER" -eq 1])
207
208AC_CHECK_LIB([tcmalloc], [malloc], [HAVE_LIBTCMALLOC=1], [HAVE_LIBTCMALLOC=0])
209AM_CONDITIONAL([WITH_LIBTCMALLOC], [test "x$enable_gprofiler" = "xyes" -a "$HAVE_LIBTCMALLOC" -eq 1])
210
211# conditionnally build the demangler
212if test "x$enable_demangler" == xyes; then
213        LIBDEMANGLE="libdemangle.a"
214        DEMANGLER="demangler"
215else
216        LIBDEMANGLE=""
217        DEMANGLER=""
218fi
219AC_SUBST([LIBDEMANGLE])
220AC_SUBST([DEMANGLER])
221
222# Checks for header files.
223AC_CHECK_HEADERS([libintl.h malloc.h unistd.h], [], [echo "Error: Missing required header"; exit 1])
224
225# Checks for typedefs, structures, and compiler characteristics.
226AC_CHECK_TYPES([_Float32], AC_DEFINE([HAVE_KEYWORDS_FLOATXX], [], [Have keywords _FloatXX.]), [], [[]])
227
228# Checks for compiler flags.
229M4CFA_CHECK_COMPILE_FLAG([-Wcast-function-type], AC_DEFINE([HAVE_CAST_FUNCTION_TYPE], [], [Have compiler warning cast-function-type.]))
230
231#==============================================================================
232# backend compiler implementation
233AC_DEFINE_UNQUOTED(CFA_BACKEND_CC, "${CC}", [Backend compiler to use.])
234AC_SUBST(CFA_BACKEND_CC)
235
236#==============================================================================
237AC_CONFIG_FILES([
238        Makefile
239        driver/Makefile
240        src/Makefile
241        benchmark/Makefile
242        tests/Makefile
243        longrun_tests/Makefile
244        tools/Makefile
245        tools/prettyprinter/Makefile
246        ])
247
248AC_CONFIG_LINKS([tests/test.py:tests/test.py])
249
250AC_OUTPUT(tests/config.py)
251
252# Final text
253AC_MSG_RESULT(Cforall configuraton completed. Type "make -j 8 install".)
Note: See TracBrowser for help on using the repository browser.