| 1 | # -*- Autoconf -*-
|
|---|
| 2 | # Process this file with autoconf to produce a configure script.
|
|---|
| 3 |
|
|---|
| 4 | AC_PREREQ([2.68])
|
|---|
| 5 | AC_INIT([cfa-cc],[1.0.0.0],[cforall@plg.uwaterloo.ca])
|
|---|
| 6 | AC_CONFIG_AUX_DIR([automake])
|
|---|
| 7 | #AC_CONFIG_SRCDIR([src/main.cc])
|
|---|
| 8 | AC_CONFIG_HEADERS([config.h:src/config.h.in])
|
|---|
| 9 | AM_SILENT_RULES([no])
|
|---|
| 10 |
|
|---|
| 11 | AM_INIT_AUTOMAKE([subdir-objects])
|
|---|
| 12 |
|
|---|
| 13 | # Allow program name tansformation
|
|---|
| 14 | # will fill program_transform_name with appropriate sed regex
|
|---|
| 15 | AC_ARG_PROGRAM
|
|---|
| 16 |
|
|---|
| 17 | #==============================================================================
|
|---|
| 18 | #Trasforming cc1 will break compilation
|
|---|
| 19 | if test "${program_transform_name}" = ""; then
|
|---|
| 20 | AC_MSG_ERROR([Program transform not supported.
|
|---|
| 21 | Use --with-cfa-name='[[Desired name here]]' instead])
|
|---|
| 22 | fi
|
|---|
| 23 |
|
|---|
| 24 | #Define the new name of the installed command
|
|---|
| 25 | AC_ARG_WITH(cfa-name,
|
|---|
| 26 | [ --with-cfa-name=NAME NAME too which cfa will be installed],
|
|---|
| 27 | cfa_name=$withval, cfa_name="cfa")
|
|---|
| 28 |
|
|---|
| 29 | AC_SUBST(CFA_NAME, ${cfa_name})
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 | #==============================================================================
|
|---|
| 33 | # version information
|
|---|
| 34 |
|
|---|
| 35 | rm -f version
|
|---|
| 36 | echo ${PACKAGE_VERSION} > version # file containing version number for other tools
|
|---|
| 37 | chmod ugo-w version
|
|---|
| 38 | ver_major=`cut -d '.' -f1 version` # subdivide version number into components at periods
|
|---|
| 39 | ver_minor=`cut -d '.' -f2 version`
|
|---|
| 40 | ver_patch=`cut -d '.' -f3 version`
|
|---|
| 41 | ver_build=`cut -d '.' -f4 version`
|
|---|
| 42 |
|
|---|
| 43 | # AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/version'])
|
|---|
| 44 | AC_DEFINE_UNQUOTED(CFA_VERSION_MAJOR, ${ver_major}, [Major version number.])
|
|---|
| 45 | AC_DEFINE_UNQUOTED(CFA_VERSION_MINOR, ${ver_minor}, [Minor version number.])
|
|---|
| 46 | AC_DEFINE_UNQUOTED(CFA_VERSION_PATCH, ${ver_patch}, [Patch version number.])
|
|---|
| 47 | AC_DEFINE_UNQUOTED(CFA_VERSION_BUILD, ${ver_build}, [Build version number.])
|
|---|
| 48 | AC_DEFINE_UNQUOTED(CFA_VERSION_SHORT, ["${ver_major}"], [Major])
|
|---|
| 49 | AC_DEFINE_UNQUOTED(CFA_VERSION, ["${ver_major}.${ver_minor}"], [Major.Minor])
|
|---|
| 50 | AC_DEFINE_UNQUOTED(CFA_VERSION_LONG, ["${ver_major}.${ver_minor}.${ver_patch}"], [Major.Minor.Patch])
|
|---|
| 51 | AC_DEFINE_UNQUOTED(CFA_VERSION_FULL, ["${ver_major}.${ver_minor}.${ver_patch}.${ver_build}"], [Major.Minor.Patch.Build])
|
|---|
| 52 |
|
|---|
| 53 | #==============================================================================
|
|---|
| 54 | # HACK to be able to use conditionnals inside makefiles
|
|---|
| 55 | DOifskipcompile='ifeq ($(skipcompile),yes)
|
|---|
| 56 | else'
|
|---|
| 57 | AC_SUBST([DOifskipcompile])
|
|---|
| 58 | AM_SUBST_NOTMAKE([DOifskipcompile])
|
|---|
| 59 |
|
|---|
| 60 | DOendif='endif'
|
|---|
| 61 | AC_SUBST([DOendif])
|
|---|
| 62 | AM_SUBST_NOTMAKE([DOendif])
|
|---|
| 63 |
|
|---|
| 64 | #==============================================================================
|
|---|
| 65 | # backend compiler implementation
|
|---|
| 66 | AC_ARG_WITH(backend-compiler,
|
|---|
| 67 | [ --with-backend-compiler=PROGRAM PROGRAM that performs the final code compilation (must be gcc-compatible) ],
|
|---|
| 68 | backendcompiler=$withval, backendcompiler="")
|
|---|
| 69 | if test "x$backendcompiler" != "x"; then
|
|---|
| 70 | BACKEND_CC=${backendcompiler}
|
|---|
| 71 | else
|
|---|
| 72 | AC_PATH_PROG(BACKEND_CC, gcc, []) # check gcc installed
|
|---|
| 73 | if test "x$BACKEND_CC" = "x"; then
|
|---|
| 74 | AC_MSG_ERROR(some version of gcc is needed. Get it at ftp://ftp.gnu.org)
|
|---|
| 75 | exit 1
|
|---|
| 76 | fi
|
|---|
| 77 | fi
|
|---|
| 78 | AC_DEFINE_UNQUOTED(CFA_BACKEND_CC, "${BACKEND_CC}", [Location of include files.])
|
|---|
| 79 | AC_SUBST(CFA_BACKEND_CC)
|
|---|
| 80 |
|
|---|
| 81 | #==============================================================================
|
|---|
| 82 | # Installation paths
|
|---|
| 83 | if test "x$prefix" = "xNONE"; then
|
|---|
| 84 | cfa_prefix=${ac_default_prefix}
|
|---|
| 85 | else
|
|---|
| 86 | cfa_prefix=${prefix}
|
|---|
| 87 | fi
|
|---|
| 88 | AC_DEFINE_UNQUOTED(CFA_PREFIX, "${cfa_prefix}", [Location of cfa install.])
|
|---|
| 89 | AC_SUBST(CFA_PREFIX, ${cfa_prefix})
|
|---|
| 90 |
|
|---|
| 91 | if test "$includedir" = '${prefix}/include'; then
|
|---|
| 92 | cfa_incdir="${cfa_prefix}/include/${cfa_name}"
|
|---|
| 93 | else
|
|---|
| 94 | cfa_incdir=${includedir}
|
|---|
| 95 | fi
|
|---|
| 96 | AC_DEFINE_UNQUOTED(CFA_INCDIR, "${cfa_incdir}", [Location of include files.])
|
|---|
| 97 | AC_SUBST(CFA_INCDIR, ${cfa_incdir})
|
|---|
| 98 |
|
|---|
| 99 | if test "$bindir" = '${exec_prefix}/bin'; then
|
|---|
| 100 | cfa_bindir="${cfa_prefix}/bin"
|
|---|
| 101 | else
|
|---|
| 102 | cfa_bindir=${bindir}
|
|---|
| 103 | fi
|
|---|
| 104 | AC_DEFINE_UNQUOTED(CFA_BINDIR, "${cfa_bindir}", [Location of cfa command.])
|
|---|
| 105 | AC_SUBST(CFA_BINDIR, ${cfa_bindir})
|
|---|
| 106 |
|
|---|
| 107 | if test "$libdir" = '${exec_prefix}/lib'; then
|
|---|
| 108 | cfa_libdir="${cfa_prefix}/lib/${cfa_name}"
|
|---|
| 109 | else
|
|---|
| 110 | cfa_libdir=${libdir}
|
|---|
| 111 | fi
|
|---|
| 112 | AC_DEFINE_UNQUOTED(CFA_LIBDIR, "${cfa_libdir}", [Location of cc1 and cfa-cpp commands.])
|
|---|
| 113 | AC_SUBST(CFA_LIBDIR, ${cfa_libdir})
|
|---|
| 114 |
|
|---|
| 115 | #==============================================================================
|
|---|
| 116 | # Create variables for commonly used targets
|
|---|
| 117 |
|
|---|
| 118 | TOP_SRCDIR=$ac_pwd/$ac_confdir/
|
|---|
| 119 | TOP_BUILDDIR=$ac_pwd/
|
|---|
| 120 | PRELUDE_BUILDDIR=$ac_pwd/libcfa-x86_64-debug/prelude/
|
|---|
| 121 |
|
|---|
| 122 | AC_DEFINE_UNQUOTED(TOP_SRCDIR, "$TOP_SRCDIR", [Top src directory])
|
|---|
| 123 | AC_DEFINE_UNQUOTED(TOP_BUILDDIR, "$TOP_BUILDDIR", [Top build directory])
|
|---|
| 124 | AC_DEFINE_UNQUOTED(PRELUDE_BUILDDIR, "$PRELUDE_BUILDDIR", [Directory where the prelude files are built])
|
|---|
| 125 |
|
|---|
| 126 | DRIVER_DIR=${TOP_BUILDDIR}driver/
|
|---|
| 127 | CFACC=${DRIVER_DIR}cfa
|
|---|
| 128 | CFACPP=${DRIVER_DIR}cfa-cpp
|
|---|
| 129 | AC_SUBST(DRIVER_DIR)
|
|---|
| 130 | AC_SUBST(CFACC)
|
|---|
| 131 | AC_SUBST(CFACPP)
|
|---|
| 132 |
|
|---|
| 133 | #==============================================================================
|
|---|
| 134 | # Flag variables needed to build in tree
|
|---|
| 135 | LIBCFA_SRC='${TOP_SRCDIR}/libcfa/src'
|
|---|
| 136 | BUILD_IN_TREE_FLAGS="-XCFA -t -B${DRIVER_DIR}"
|
|---|
| 137 | AC_SUBST(BUILD_IN_TREE_FLAGS)
|
|---|
| 138 |
|
|---|
| 139 | #==============================================================================
|
|---|
| 140 | # handle the list of hosts to build for
|
|---|
| 141 | for var in $ac_configure_args
|
|---|
| 142 | do
|
|---|
| 143 | #strip quotes surrouding values
|
|---|
| 144 | var=$(echo $var | sed s/\'//g)
|
|---|
| 145 | case $var in
|
|---|
| 146 | # skip cross compilation related arguments
|
|---|
| 147 | --host=*) ;; host_alias=*) ;; --build=*) ;; build_alias=*) ;; --target=*) ;; target_alias=*) ;;
|
|---|
| 148 |
|
|---|
| 149 | # skip the target hosts
|
|---|
| 150 | --with-target-hosts=*) ;;
|
|---|
| 151 |
|
|---|
| 152 | # append all other arguments to the sub configure arguments
|
|---|
| 153 | *) LIBCFA_GENERAL_ARGS="${LIBCFA_GENERAL_ARGS} $var";;
|
|---|
| 154 | esac
|
|---|
| 155 | done
|
|---|
| 156 |
|
|---|
| 157 | #==============================================================================
|
|---|
| 158 | # handle the list of hosts to build for
|
|---|
| 159 | AC_CANONICAL_BUILD
|
|---|
| 160 | AC_CANONICAL_HOST
|
|---|
| 161 |
|
|---|
| 162 | default_target="${host_cpu}:debug, ${host_cpu}:nodebug"
|
|---|
| 163 | AC_ARG_WITH(target-hosts,
|
|---|
| 164 | [ --with-target-hosts=HOSTS HOSTS comma seperated list of hosts to build for, format ARCH:[debug|nodebug|nolib]],
|
|---|
| 165 | target_hosts=$withval, target_hosts=${default_target})
|
|---|
| 166 |
|
|---|
| 167 | AC_SUBST(TARGET_HOSTS, ${target_hosts})
|
|---|
| 168 |
|
|---|
| 169 | LIBCFA_PATHS="DRIVER_DIR=${DRIVER_DIR}"
|
|---|
| 170 |
|
|---|
| 171 | for i in $(echo $target_hosts | sed "s/,/ /g")
|
|---|
| 172 | do
|
|---|
| 173 | # call your procedure/other scripts here below
|
|---|
| 174 | lib_arch=$(echo $i | sed -r "s/:(.*)//g")
|
|---|
| 175 | lib_config=$(echo $i | sed -r "s/(.*)://g")
|
|---|
| 176 | lib_dir="libcfa-${lib_arch}-${lib_config}"
|
|---|
| 177 |
|
|---|
| 178 | LIBCFA_TARGET_DIRS="${LIBCFA_TARGET_DIRS} ${lib_dir}"
|
|---|
| 179 | LIBCFA_TARGET_MAKEFILES="${LIBCFA_TARGET_MAKEFILES} ${lib_dir}/Makefile"
|
|---|
| 180 |
|
|---|
| 181 | mkdir -p libcfa-${lib_arch}-${lib_config}
|
|---|
| 182 | echo -n "${LIBCFA_GENERAL_ARGS} " > libcfa-${lib_arch}-${lib_config}/config.data
|
|---|
| 183 | echo -n "${LIBCFA_PATHS} " >> libcfa-${lib_arch}-${lib_config}/config.data
|
|---|
| 184 | echo -n "--host=${lib_arch} " >> libcfa-${lib_arch}-${lib_config}/config.data
|
|---|
| 185 | echo -n "CONFIGURATION=${lib_config}" >> libcfa-${lib_arch}-${lib_config}/config.data
|
|---|
| 186 | done
|
|---|
| 187 |
|
|---|
| 188 | AC_SUBST(LIBCFA_TARGET_DIRS)
|
|---|
| 189 | AC_SUBST(LIBCFA_TARGET_MAKEFILES)
|
|---|
| 190 |
|
|---|
| 191 | #==============================================================================
|
|---|
| 192 | # CAFLAGS
|
|---|
| 193 | AC_DEFINE_UNQUOTED(CFA_FLAGS, "${CFAFLAGS}", [compilation flags for cfa libraries and test programs.])
|
|---|
| 194 | AC_SUBST(CFA_FLAGS, ${CFAFLAGS})
|
|---|
| 195 |
|
|---|
| 196 | #==============================================================================
|
|---|
| 197 | # Checks for programs.
|
|---|
| 198 | AC_PROG_CXX
|
|---|
| 199 | AC_PROG_CC
|
|---|
| 200 | AM_PROG_AS
|
|---|
| 201 | AM_PROG_CC_C_O # deprecated
|
|---|
| 202 | # These are often not installed and people miss seeing the "no", so stop the configure.
|
|---|
| 203 | AC_PROG_YACC
|
|---|
| 204 | if test "${YACC}" = "yacc" ; then echo "Error: bison required." ; exit 1 ; fi
|
|---|
| 205 | AC_PROG_LEX
|
|---|
| 206 | if test "${LEX}" = "lex" ; then echo "Error: flex required." ; exit 1 ; fi
|
|---|
| 207 | AC_PROG_INSTALL
|
|---|
| 208 | AC_PROG_MAKE_SET
|
|---|
| 209 | AC_PROG_RANLIB
|
|---|
| 210 |
|
|---|
| 211 | # Checks for libraries.
|
|---|
| 212 |
|
|---|
| 213 | # Checks for header files.
|
|---|
| 214 | AC_FUNC_ALLOCA
|
|---|
| 215 | AC_CHECK_HEADERS([fenv.h float.h inttypes.h libintl.h limits.h malloc.h stddef.h stdlib.h string.h unistd.h])
|
|---|
| 216 |
|
|---|
| 217 | # Checks for typedefs, structures, and compiler characteristics.
|
|---|
| 218 | AC_HEADER_STDBOOL
|
|---|
| 219 | AC_C_INLINE
|
|---|
| 220 | AC_TYPE_INT16_T
|
|---|
| 221 | AC_TYPE_INT32_T
|
|---|
| 222 | AC_TYPE_INT8_T
|
|---|
| 223 | AC_C_RESTRICT
|
|---|
| 224 | AC_TYPE_SIZE_T
|
|---|
| 225 | AC_TYPE_UINT16_T
|
|---|
| 226 | AC_TYPE_UINT32_T
|
|---|
| 227 | AC_TYPE_UINT8_T
|
|---|
| 228 |
|
|---|
| 229 | # Checks for library functions.
|
|---|
| 230 | AC_CHECK_FUNCS([memset putenv strchr strtol])
|
|---|
| 231 |
|
|---|
| 232 | #==============================================================================
|
|---|
| 233 | AC_CONFIG_FILES([
|
|---|
| 234 | Makefile
|
|---|
| 235 | driver/Makefile
|
|---|
| 236 | src/Makefile
|
|---|
| 237 | benchmark/Makefile
|
|---|
| 238 | tests/Makefile
|
|---|
| 239 | tests/preempt_longrun/Makefile
|
|---|
| 240 | tools/Makefile
|
|---|
| 241 | tools/prettyprinter/Makefile
|
|---|
| 242 | ])
|
|---|
| 243 |
|
|---|
| 244 | AC_CONFIG_LINKS([tests/test.py:tests/test.py])
|
|---|
| 245 |
|
|---|
| 246 | AC_OUTPUT(tests/config.py)
|
|---|
| 247 |
|
|---|
| 248 | # Final text
|
|---|
| 249 | AC_MSG_RESULT(Cforall configuraton completed. Type "make -j 8 install".)
|
|---|