source: configure.ac @ 15f9c8e

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

Tests almost work, the only issue left is using -E and -CFA together

  • Property mode set to 100644
File size: 8.9 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# distcc support
61
62AC_ARG_ENABLE(distcc,
63        [  --enable-distcc     whether or not to enable distributed compilation],
64        enable_distcc=$enableval, enable_distcc=no)
65
66AM_CONDITIONAL([ENABLE_DISTCC], [test x$enable_distcc = xyes])
67HAS_DISTCC="False"
68
69if test x$enable_distcc = xyes; then
70        CXX="distcc ${CXX}"
71        LD="distcc ${LD} -lstdc++"
72        HAS_DISTCC="True"
73        echo "Enabling distributed builds"
74fi
75
76AC_SUBST(CXX)
77AC_SUBST(LD)
78AC_SUBST(HAS_DISTCC)
79
80#==============================================================================
81# Installation paths
82M4CFA_PARSE_PREFIX
83
84#==============================================================================
85# Create variables for commonly used targets
86
87TOP_SRCDIR="$(readlink -m $ac_confdir/)/"
88TOP_BUILDDIR="$(readlink -m $ac_pwd/)/"
89
90AC_DEFINE_UNQUOTED(TOP_SRCDIR, "$TOP_SRCDIR", [Top src directory])
91AC_DEFINE_UNQUOTED(TOP_BUILDDIR, "$TOP_BUILDDIR", [Top build directory])
92
93DRIVER_DIR=${TOP_BUILDDIR}driver/
94CFACC=${DRIVER_DIR}cfa
95CFACPP=${DRIVER_DIR}cfa-cpp
96AC_SUBST(DRIVER_DIR)
97AC_SUBST(CFACC)
98AC_SUBST(CFACPP)
99
100#==============================================================================
101# Flag variables needed to build in tree
102LIBCFA_SRC='${TOP_SRCDIR}/libcfa/src'
103BUILD_IN_TREE_FLAGS="-XCFA -t -B${DRIVER_DIR}"
104AC_SUBST(BUILD_IN_TREE_FLAGS)
105
106#==============================================================================
107# handle the list of hosts to build for
108for var in $ac_configure_args
109do
110        #strip quotes surrouding values
111        case $var in
112                # skip cross compilation related arguments
113                \'--host=*) ;; \'host_alias=*) ;; \'--build=*) ;; \'build_alias=*) ;; \'--target=*) ;; \'target_alias=*) ;;
114
115                # skip the target hosts
116                \'--with-target-hosts=*) ;;
117
118                # skip gprofiler for libcfa
119                \'--enable-gprofiler=*) ;;
120                \'--disable-gprofiler) ;;
121
122                # append all other arguments to the sub configure arguments
123                *) LIBCFA_GENERAL_ARGS="${LIBCFA_GENERAL_ARGS} $var";;
124        esac
125done
126
127#==============================================================================
128# handle the list of hosts to build for
129AC_CANONICAL_BUILD
130AC_CANONICAL_HOST
131
132if ! test "$host_cpu" = "$build_cpu"; then
133        case $host_cpu in
134                i386)
135                        HOST_FLAGS="-m32"
136                        ;;
137                i686)
138                        HOST_FLAGS="-m32"
139                        ;;
140                x86_64)
141                        HOST_FLAGS="-m64"
142                        ;;
143        esac
144fi
145AC_SUBST(HOST_FLAGS)
146
147default_target="${host_cpu}:debug, ${host_cpu}:nodebug"
148AC_ARG_WITH(target-hosts,
149        [  --with-target-hosts=HOSTS     HOSTS comma seperated list of hosts to build for, format ARCH:[debug|nodebug|nolib]],
150        target_hosts=$withval, target_hosts=${default_target})
151
152AC_ARG_ENABLE(gprofiler,
153        [  --enable-gprofiler     whether or not to enable gprofiler tools (if available)],
154        enable_gprofiler=$enableval, enable_gprofiler=yes)
155
156AC_ARG_ENABLE(demangler,
157        [  --enable-demangler     whether or not to build the demangler (executable and library)],
158        enable_demangler=$enableval, enable_demangler=yes)
159
160AC_SUBST(TARGET_HOSTS, ${target_hosts})
161
162LIBCFA_PATHS="DRIVER_DIR=${DRIVER_DIR}"
163
164for i in $(echo $target_hosts | sed "s/,/ /g")
165do
166        # call your procedure/other scripts here below
167        arch_name=$(echo $i | sed -r "s/:(.*)//g")
168        lib_config=$(echo $i | sed -r "s/(.*)://g")
169
170        case $lib_config in
171                "nodebug") ;;
172                "debug") ;;
173                "nolib") ;;
174                "profile") ;;
175                *)
176                        >&2 echo "Configuration must be 'debug', 'nodebug' or 'nolib'"
177                        exit 1
178                ;;
179        esac
180
181        M4CFA_CANNON_CPU([${arch_name}])
182        lib_arch=${cannon_arch_name}
183        lib_dir="libcfa/${lib_arch}-${lib_config}"
184
185        LIBCFA_TARGET_DIRS="${LIBCFA_TARGET_DIRS} ${lib_dir}"
186        LIBCFA_TARGET_MAKEFILES="${LIBCFA_TARGET_MAKEFILES} ${lib_dir}/Makefile"
187
188        mkdir -p ${lib_dir}
189        echo -n "${LIBCFA_GENERAL_ARGS} " > ${lib_dir}/config.data
190        echo -n "${LIBCFA_PATHS} " >> ${lib_dir}/config.data
191        echo -n "ARCHITECTURE=${lib_arch} " >> ${lib_dir}/config.data
192        echo -n "CONFIGURATION=${lib_config} " >> ${lib_dir}/config.data
193        echo -n "CFA_VERSION=${ver_major}:${ver_minor}:${ver_patch}" >> ${lib_dir}/config.data
194done
195
196AC_SUBST(LIBCFA_TARGET_DIRS)
197AC_SUBST(LIBCFA_TARGET_MAKEFILES)
198
199M4CFA_CANNON_CPU([${host_cpu}])
200AC_DEFINE_UNQUOTED(CFA_DEFAULT_CPU, "$cannon_arch_name", [Default cpu to use if neither -m32 or -m64 are defined.])
201AC_DEFINE_UNQUOTED(CFA_64_CPU, "x64", [CPU to use if the -m64 flags is given.])
202AC_DEFINE_UNQUOTED(CFA_32_CPU, "x86", [CPU to use if the -m32 flags is given.])
203
204#==============================================================================
205# CAFLAGS
206AC_DEFINE_UNQUOTED(CFA_FLAGS, "${CFAFLAGS}", [compilation flags for cfa libraries and test programs.])
207AC_SUBST(CFA_FLAGS, ${CFAFLAGS})
208
209#==============================================================================
210# Checks for programs.
211AC_PROG_CXX
212AC_PROG_CC
213AM_PROG_AS
214# These are often not installed and people miss seeing the "no", so stop the configure.
215AC_PROG_YACC
216if test "${YACC}" = "yacc" ; then echo "Error: bison required." ; exit 1 ; fi
217AC_PROG_LEX
218if test "${LEX}" = "lex" ; then echo "Error: flex required." ; exit 1 ; fi
219AC_PROG_LIBTOOL
220AC_PROG_INSTALL
221
222# Checks for libraries.
223AC_CHECK_LIB([fibre], [Fibre::yield], [HAVE_LIBFIBRE=1], [HAVE_LIBFIBRE=0])
224AM_CONDITIONAL([WITH_LIBFIBRE], [test "$HAVE_LIBFIBRE" -eq 1])
225
226AC_CHECK_LIB([profiler], [ProfilingIsEnabledForAllThreads], [HAVE_LIBPROFILER=1], [HAVE_LIBPROFILER=0])
227AM_CONDITIONAL([WITH_LIBPROFILER], [test "x$enable_gprofiler" = "xyes" -a "$HAVE_LIBPROFILER" -eq 1])
228
229AC_CHECK_LIB([tcmalloc], [malloc], [HAVE_LIBTCMALLOC=1], [HAVE_LIBTCMALLOC=0])
230AM_CONDITIONAL([WITH_LIBTCMALLOC], [test "x$enable_gprofiler" = "xyes" -a "$HAVE_LIBTCMALLOC" -eq 1])
231
232# conditionnally build the demangler
233if test "x$enable_demangler" == xyes; then
234        LIBDEMANGLE="libdemangle.a"
235        DEMANGLER="demangler"
236else
237        LIBDEMANGLE=""
238        DEMANGLER=""
239fi
240AC_SUBST([LIBDEMANGLE])
241AC_SUBST([DEMANGLER])
242
243# Checks for header files.
244AC_CHECK_HEADERS([libintl.h malloc.h unistd.h], [], [echo "Error: Missing required header"; exit 1])
245
246# Checks for typedefs, structures, and compiler characteristics.
247AC_CHECK_TYPES([_Float32], AC_DEFINE([HAVE_KEYWORDS_FLOATXX], [], [Have keywords _FloatXX.]), [], [[]])
248
249# Checks for compiler flags.
250M4CFA_CHECK_COMPILE_FLAG([-Wcast-function-type], AC_DEFINE([HAVE_CAST_FUNCTION_TYPE], [], [Have compiler warning cast-function-type.]))
251
252#==============================================================================
253# backend compiler implementation
254AC_DEFINE_UNQUOTED(CFA_BACKEND_CC, "${CC}", [Backend compiler to use.])
255AC_SUBST(CFA_BACKEND_CC)
256
257#==============================================================================
258AC_CONFIG_FILES([
259        Makefile
260        driver/Makefile
261        src/Makefile
262        benchmark/Makefile
263        tests/Makefile
264        longrun_tests/Makefile
265        tools/Makefile
266        tools/prettyprinter/Makefile
267        ])
268
269AC_CONFIG_LINKS([tests/test.py:tests/test.py])
270
271AC_OUTPUT(tests/config.py)
272
273# Final text
274AC_MSG_RESULT(Cforall configuraton completed. Type "make -j 8 install".)
Note: See TracBrowser for help on using the repository browser.