source: configure.ac @ 365e423

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 365e423 was 7c6b262, checked in by Thierry Delisle <tdelisle@…>, 4 years ago

Added option to limit bandwith during the distribution phase of th build (when using distcc)

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