# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ([2.68]) AC_INIT([cfa-cc],[1.0.0.0],[cforall@plg.uwaterloo.ca]) AC_CONFIG_AUX_DIR([automake]) #AC_CONFIG_SRCDIR([src/main.cc]) AC_CONFIG_HEADERS([config.h:src/config.h.in]) AM_SILENT_RULES([no]) AM_INIT_AUTOMAKE([subdir-objects]) # Allow program name tansformation # will fill program_transform_name with appropriate sed regex AC_ARG_PROGRAM #Trasforming cc1 will break compilation if test "${program_transform_name}" = ""; then AC_MSG_ERROR([Program transform not supported. Use --with-cfa-name='[[Desired name here]]' instead]) fi AC_ARG_WITH(cfa-name, [ --with-cfa-name=NAME NAME too which cfa will be installed], cfa_name=$withval, cfa_name="cfa") #Define the new name of the installed command AC_SUBST(CFA_NAME, ${cfa_name}) rm -f version echo ${PACKAGE_VERSION} > version # file containing version number for other tools chmod ugo-w version ver_major=`cut -d '.' -f1 version` # subdivide version number into components at periods ver_minor=`cut -d '.' -f2 version` ver_patch=`cut -d '.' -f3 version` ver_build=`cut -d '.' -f4 version` # AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/version']) AC_DEFINE_UNQUOTED(CFA_VERSION_MAJOR, ${ver_major}, [Major version number.]) AC_DEFINE_UNQUOTED(CFA_VERSION_MINOR, ${ver_minor}, [Minor version number.]) AC_DEFINE_UNQUOTED(CFA_VERSION_PATCH, ${ver_patch}, [Patch version number.]) AC_DEFINE_UNQUOTED(CFA_VERSION_BUILD, ${ver_build}, [Build version number.]) AC_DEFINE_UNQUOTED(CFA_VERSION_SHORT, ["${ver_major}"], [Major]) AC_DEFINE_UNQUOTED(CFA_VERSION, ["${ver_major}.${ver_minor}"], [Major.Minor]) AC_DEFINE_UNQUOTED(CFA_VERSION_LONG, ["${ver_major}.${ver_minor}.${ver_patch}"], [Major.Minor.Patch]) AC_DEFINE_UNQUOTED(CFA_VERSION_FULL, ["${ver_major}.${ver_minor}.${ver_patch}.${ver_build}"], [Major.Minor.Patch.Build]) # Installation paths AC_ARG_WITH(backend-compiler, [ --with-backend-compiler=PROGRAM PROGRAM that performs the final code compilation (must be gcc-compatible) ], backendcompiler=$withval, backendcompiler="") if test "x$backendcompiler" != "x"; then BACKEND_CC=${backendcompiler} else AC_PATH_PROG(BACKEND_CC, gcc, []) # check gcc installed if test "x$BACKEND_CC" = "x"; then AC_MSG_ERROR(some version of gcc is needed. Get it at ftp://ftp.gnu.org) exit 1 fi fi AC_DEFINE_UNQUOTED(CFA_BACKEND_CC, "${BACKEND_CC}", [Location of include files.]) AC_SUBST(CFA_BACKEND_CC) AC_ARG_ENABLE(target-release, AS_HELP_STRING([--enable-target-release], [Build and install the release target])) AC_ARG_ENABLE(target-debug, AS_HELP_STRING([--enable-target-debug], [Build and install the debug target])) AC_ARG_ENABLE(threading, AS_HELP_STRING([--enable-threading], [Build and install libcfa with threading support (Enabled by default)]), [case "${enableval}" in yes) build_threading="yes" ;; no) build_threading="no" ;; *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;; esac],[build_threading="yes"]) case "$enable_target_release" in yes) case "$enable_target_debug" in yes) build_release="yes" build_debug="yes" ;; no) build_release="yes" build_debug="no" ;; *) build_release="yes" build_debug="no" ;; esac ;; no) case "$enable_target_debug" in yes) build_release="no" build_debug="yes" ;; no) build_release="no" build_debug="no" ;; *) build_release="no" build_debug="yes" ;; esac ;; *) case "$enable_target_debug" in yes) build_release="no" build_debug="yes" ;; no) build_release="yes" build_debug="no" ;; *) build_release="yes" build_debug="yes" ;; esac ;; esac AM_CONDITIONAL([BUILD_RELEASE], [test "x$build_release" = "xyes"]) AM_CONDITIONAL([BUILD_DEBUG], [test "x$build_debug" = "xyes"]) AM_CONDITIONAL([BUILD_NO_LIB], [test "x$build_release$build_debug" = "xnono"]) AM_CONDITIONAL([BUILD_CONCURRENCY], [test "x$build_threading" = "xyes"]) DOifskipcompile='ifeq ($(skipcompile),yes) else' AC_SUBST([DOifskipcompile]) AM_SUBST_NOTMAKE([DOifskipcompile]) DOendif='endif' AC_SUBST([DOendif]) AM_SUBST_NOTMAKE([DOendif]) if test "x$prefix" = "xNONE"; then cfa_prefix=${ac_default_prefix} else cfa_prefix=${prefix} fi AC_DEFINE_UNQUOTED(CFA_PREFIX, "${cfa_prefix}", [Location of cfa install.]) AC_SUBST(CFA_PREFIX, ${cfa_prefix}) if test "$includedir" = '${prefix}/include'; then cfa_incdir="${cfa_prefix}/include/${cfa_name}" else cfa_incdir=${includedir} fi AC_DEFINE_UNQUOTED(CFA_INCDIR, "${cfa_incdir}", [Location of include files.]) AC_SUBST(CFA_INCDIR, ${cfa_incdir}) if test "$bindir" = '${exec_prefix}/bin'; then cfa_bindir="${cfa_prefix}/bin" else cfa_bindir=${bindir} fi AC_DEFINE_UNQUOTED(CFA_BINDIR, "${cfa_bindir}", [Location of cfa command.]) AC_SUBST(CFA_BINDIR, ${cfa_bindir}) if test "$libdir" = '${exec_prefix}/lib'; then cfa_libdir="${cfa_prefix}/lib/${cfa_name}" else cfa_libdir=${libdir} fi AC_DEFINE_UNQUOTED(CFA_LIBDIR, "${cfa_libdir}", [Location of cc1 and cfa-cpp commands.]) AC_SUBST(CFA_LIBDIR, ${cfa_libdir}) # Create variables for commonly used targets DRIVER_DIR='$(top_builddir)/driver' CFACC=${DRIVER_DIR}/cfa CFACPP=${DRIVER_DIR}/cfa-cpp AC_SUBST(DRIVER_DIR) AC_SUBST(CFACC) AC_SUBST(CFACPP) # Flag variables needed to build in tree LIBCFA_SRC='$(top_srcdir)/libcfa/src' LIBCFA_BUILD='$(top_builddir)/libcfa/src' BUILD_IN_TREE_FLAGS_NOLIB="-XCFA -t -B${DRIVER_DIR}" BUILD_IN_TREE_FLAGS="${BUILD_IN_TREE_FLAGS_NOLIB} -L${LIBCFA_BUILD} -I${LIBCFA_SRC} -I${LIBCFA_SRC}/containers -I${LIBCFA_SRC}/concurrency -I${LIBCFA_SRC}/stdhdr" AC_SUBST(BUILD_IN_TREE_FLAGS_NOLIB) AC_SUBST(BUILD_IN_TREE_FLAGS) AC_CANONICAL_BUILD AC_CANONICAL_HOST AC_SUBST([MACHINE_TYPE],[$host_cpu]) if ! test "$host_cpu" = "$build_cpu"; then case $host_cpu in i386) CFLAGS+=" -m32 " CXXFLAGS+=" -m32 " CFAFLAGS+=" -m32 " LDFLAGS+=" -m32 " ;; i686) CFLAGS+=" -m32 " CXXFLAGS+=" -m32 " CFAFLAGS+=" -m32 " LDFLAGS+=" -m32 " ;; x86_64) CFLAGS+=" -m64 " CXXFLAGS+=" -m64 " CFAFLAGS+=" -m64 " LDFLAGS+=" -m64 " ;; esac fi AC_DEFINE_UNQUOTED(CFA_FLAGS, "${CFAFLAGS}", [compilation flags for cfa libraries and test programs.]) AC_SUBST(CFA_FLAGS, ${CFAFLAGS}) # Checks for programs. AC_PROG_CXX AC_PROG_CC AM_PROG_AS AM_PROG_CC_C_O # deprecated # These are often not installed and people miss seeing the "no", so stop the configure. AC_PROG_YACC if test "${YACC}" = "yacc" ; then echo "Error: bison required." ; exit 1 ; fi AC_PROG_LEX if test "${LEX}" = "lex" ; then echo "Error: flex required." ; exit 1 ; fi AC_PROG_INSTALL AC_PROG_MAKE_SET AC_PROG_RANLIB # Checks for libraries. # Checks for header files. AC_FUNC_ALLOCA AC_CHECK_HEADERS([fenv.h float.h inttypes.h libintl.h limits.h malloc.h stddef.h stdlib.h string.h unistd.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL AC_C_INLINE AC_TYPE_INT16_T AC_TYPE_INT32_T AC_TYPE_INT8_T AC_C_RESTRICT AC_TYPE_SIZE_T AC_TYPE_UINT16_T AC_TYPE_UINT32_T AC_TYPE_UINT8_T # Checks for library functions. AC_CHECK_FUNCS([memset putenv strchr strtol]) AC_CONFIG_FILES([ Makefile driver/Makefile src/Makefile benchmark/Makefile tests/Makefile tests/preempt_longrun/Makefile libcfa/prelude/Makefile libcfa/src/Makefile tools/Makefile tools/prettyprinter/Makefile ]) AC_CONFIG_LINKS([tests/test.py:tests/test.py]) AC_OUTPUT(tests/config.py) AM_COND_IF([BUILD_RELEASE], [AM_COND_IF([BUILD_DEBUG], [AC_MSG_NOTICE(Building libcfa for target: release & debug)], [AC_MSG_NOTICE(Building libcfa for target: release)])], [AM_COND_IF([BUILD_DEBUG], [AC_MSG_NOTICE(Building libcfa for target: debug)], [AC_MSG_NOTICE(Running cfa without libcfa)])]) # Final text AC_MSG_RESULT(Cforall configuraton completed. Type "make -j 8 install".)