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