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