Changes in configure.ac [ad486c5b:47c1928]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
configure.ac
rad486c5b r47c1928 7 7 #AC_CONFIG_SRCDIR([src/main.cc]) 8 8 AC_CONFIG_HEADERS([config.h:src/config.h.in]) 9 AM_SILENT_RULES([no]) 9 AM_SILENT_RULES([yes]) 10 11 m4_include([automake/cfa.m4]) 12 13 # don't use the default CFLAGS as they unconditonnaly add -O2 14 : ${CFLAGS=""} 10 15 11 16 AM_INIT_AUTOMAKE([subdir-objects]) … … 15 20 AC_ARG_PROGRAM 16 21 22 #============================================================================== 17 23 #Trasforming cc1 will break compilation 18 if test "${program_transform_name}" = ""; then 19 AC_MSG_ERROR([Program transform not supported. 20 Use --with-cfa-name='[[Desired name here]]' instead]) 21 fi 22 23 AC_ARG_WITH(cfa-name, 24 [ --with-cfa-name=NAME NAME too which cfa will be installed], 25 cfa_name=$withval, cfa_name="cfa") 26 27 #Define the new name of the installed command 28 AC_SUBST(CFA_NAME, ${cfa_name}) 24 M4CFA_PROGRAM_NAME 25 26 #============================================================================== 27 # version information 29 28 30 29 rm -f version … … 46 45 AC_DEFINE_UNQUOTED(CFA_VERSION_FULL, ["${ver_major}.${ver_minor}.${ver_patch}.${ver_build}"], [Major.Minor.Patch.Build]) 47 46 48 # Installation paths 49 50 AC_ARG_WITH(backend-compiler, 51 [ --with-backend-compiler=PROGRAM PROGRAM that performs the final code compilation (must be gcc-compatible) ], 52 backendcompiler=$withval, backendcompiler="") 53 if test "x$backendcompiler" != "x"; then 54 BACKEND_CC=${backendcompiler} 55 else 56 AC_PATH_PROG(BACKEND_CC, gcc, []) # check gcc installed 57 if test "x$BACKEND_CC" = "x"; then 58 AC_MSG_ERROR(some version of gcc is needed. Get it at ftp://ftp.gnu.org) 59 exit 1 60 fi 61 fi 62 AC_DEFINE_UNQUOTED(CFA_BACKEND_CC, "${BACKEND_CC}", [Location of include files.]) 63 AC_SUBST(CFA_BACKEND_CC) 64 65 66 67 AC_ARG_ENABLE(target-release, AS_HELP_STRING([--enable-target-release], [Build and install the release target])) 68 AC_ARG_ENABLE(target-debug, AS_HELP_STRING([--enable-target-debug], [Build and install the debug target])) 69 AC_ARG_ENABLE(threading, AS_HELP_STRING([--enable-threading], [Build and install libcfa with threading support (Enabled by default)]), 70 [case "${enableval}" in 71 yes) build_threading="yes" ;; 72 no) build_threading="no" ;; 73 *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;; 74 esac],[build_threading="yes"]) 75 76 case "$enable_target_release" in 77 yes) 78 case "$enable_target_debug" in 79 yes) 80 build_release="yes" 81 build_debug="yes" 82 ;; 83 no) 84 build_release="yes" 85 build_debug="no" 86 ;; 87 *) 88 build_release="yes" 89 build_debug="no" 90 ;; 91 esac 92 ;; 93 no) 94 case "$enable_target_debug" in 95 yes) 96 build_release="no" 97 build_debug="yes" 98 ;; 99 no) 100 build_release="no" 101 build_debug="no" 102 ;; 103 *) 104 build_release="no" 105 build_debug="yes" 106 ;; 107 esac 108 ;; 109 *) 110 case "$enable_target_debug" in 111 yes) 112 build_release="no" 113 build_debug="yes" 114 ;; 115 no) 116 build_release="yes" 117 build_debug="no" 118 ;; 119 *) 120 build_release="yes" 121 build_debug="yes" 122 ;; 123 esac 124 ;; 125 esac 126 127 AM_CONDITIONAL([BUILD_RELEASE], [test "x$build_release" = "xyes"]) 128 AM_CONDITIONAL([BUILD_DEBUG], [test "x$build_debug" = "xyes"]) 129 AM_CONDITIONAL([BUILD_NO_LIB], [test "x$build_release$build_debug" = "xnono"]) 130 AM_CONDITIONAL([BUILD_CONCURRENCY], [test "x$build_threading" = "xyes"]) 131 47 #============================================================================== 48 # HACK to be able to use conditionnals inside makefiles 132 49 DOifskipcompile='ifeq ($(skipcompile),yes) 133 50 else' … … 139 56 AM_SUBST_NOTMAKE([DOendif]) 140 57 141 if test "x$prefix" = "xNONE"; then 142 cfa_prefix=${ac_default_prefix} 58 #============================================================================== 59 # backend compiler implementation 60 AC_ARG_WITH(backend-compiler, 61 [ --with-backend-compiler=PROGRAM PROGRAM that performs the final code compilation (must be gcc-compatible) ], 62 backendcompiler=$withval, backendcompiler="") 63 if test "x$backendcompiler" != "x"; then 64 BACKEND_CC=${backendcompiler} 143 65 else 144 cfa_prefix=${prefix} 66 AC_PATH_PROG(BACKEND_CC, gcc, []) # check gcc installed 67 if test "x$BACKEND_CC" = "x"; then 68 AC_MSG_ERROR(some version of gcc is needed. Get it at ftp://ftp.gnu.org) 69 exit 1 70 fi 145 71 fi 146 AC_DEFINE_UNQUOTED(CFA_PREFIX, "${cfa_prefix}", [Location of cfa install.]) 147 AC_SUBST(CFA_PREFIX, ${cfa_prefix}) 148 149 if test "$includedir" = '${prefix}/include'; then 150 cfa_incdir="${cfa_prefix}/include/${cfa_name}" 151 else 152 cfa_incdir=${includedir} 153 fi 154 AC_DEFINE_UNQUOTED(CFA_INCDIR, "${cfa_incdir}", [Location of include files.]) 155 AC_SUBST(CFA_INCDIR, ${cfa_incdir}) 156 157 if test "$bindir" = '${exec_prefix}/bin'; then 158 cfa_bindir="${cfa_prefix}/bin" 159 else 160 cfa_bindir=${bindir} 161 fi 162 AC_DEFINE_UNQUOTED(CFA_BINDIR, "${cfa_bindir}", [Location of cfa command.]) 163 AC_SUBST(CFA_BINDIR, ${cfa_bindir}) 164 165 if test "$libdir" = '${exec_prefix}/lib'; then 166 cfa_libdir="${cfa_prefix}/lib/${cfa_name}" 167 else 168 cfa_libdir=${libdir} 169 fi 170 AC_DEFINE_UNQUOTED(CFA_LIBDIR, "${cfa_libdir}", [Location of cc1 and cfa-cpp commands.]) 171 AC_SUBST(CFA_LIBDIR, ${cfa_libdir}) 172 72 AC_DEFINE_UNQUOTED(CFA_BACKEND_CC, "${BACKEND_CC}", [Location of include files.]) 73 AC_SUBST(CFA_BACKEND_CC) 74 75 #============================================================================== 76 # Installation paths 77 M4CFA_PARSE_PREFIX 78 79 #============================================================================== 173 80 # Create variables for commonly used targets 174 DRIVER_DIR='$(top_builddir)/src/driver' 175 CFACC=${DRIVER_DIR}/cfa 176 CFACPP=${DRIVER_DIR}/cfa-cpp 81 82 TOP_SRCDIR="$(readlink -f $ac_confdir/)/" 83 TOP_BUILDDIR="$(readlink -f $ac_pwd/)/" 84 85 AC_DEFINE_UNQUOTED(TOP_SRCDIR, "$TOP_SRCDIR", [Top src directory]) 86 AC_DEFINE_UNQUOTED(TOP_BUILDDIR, "$TOP_BUILDDIR", [Top build directory]) 87 88 DRIVER_DIR=${TOP_BUILDDIR}driver/ 89 CFACC=${DRIVER_DIR}cfa 90 CFACPP=${DRIVER_DIR}cfa-cpp 177 91 AC_SUBST(DRIVER_DIR) 178 92 AC_SUBST(CFACC) 179 93 AC_SUBST(CFACPP) 180 94 95 #============================================================================== 181 96 # Flag variables needed to build in tree 182 LIBCFA_SRC='$(top_srcdir)/src/libcfa' 183 LIBCFA_BUILD='$(top_builddir)/src/libcfa' 184 BUILD_IN_TREE_FLAGS_NOLIB="-XCFA -t -B${DRIVER_DIR}" 185 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" 186 AC_SUBST(BUILD_IN_TREE_FLAGS_NOLIB) 97 LIBCFA_SRC='${TOP_SRCDIR}/libcfa/src' 98 BUILD_IN_TREE_FLAGS="-XCFA -t -B${DRIVER_DIR}" 187 99 AC_SUBST(BUILD_IN_TREE_FLAGS) 188 100 101 #============================================================================== 102 # handle the list of hosts to build for 103 for var in $ac_configure_args 104 do 105 #strip quotes surrouding values 106 case $var in 107 # skip cross compilation related arguments 108 \'--host=*) ;; \'host_alias=*) ;; \'--build=*) ;; \'build_alias=*) ;; \'--target=*) ;; \'target_alias=*) ;; 109 110 # skip the target hosts 111 \'--with-target-hosts=*) ;; 112 113 # append all other arguments to the sub configure arguments 114 *) LIBCFA_GENERAL_ARGS="${LIBCFA_GENERAL_ARGS} $var";; 115 esac 116 done 117 118 #============================================================================== 119 # handle the list of hosts to build for 189 120 AC_CANONICAL_BUILD 190 121 AC_CANONICAL_HOST 191 AC_SUBST([MACHINE_TYPE],[$host_cpu])192 122 193 123 if ! test "$host_cpu" = "$build_cpu"; then 194 124 case $host_cpu in 195 125 i386) 196 CFLAGS+=" -m32 " 197 CXXFLAGS+=" -m32 " 198 CFAFLAGS+=" -m32 " 199 LDFLAGS+=" -m32 " 126 HOST_FLAGS="-m32" 200 127 ;; 201 128 i686) 202 CFLAGS+=" -m32 " 203 CXXFLAGS+=" -m32 " 204 CFAFLAGS+=" -m32 " 205 LDFLAGS+=" -m32 " 129 HOST_FLAGS="-m32" 206 130 ;; 207 131 x86_64) 208 CFLAGS+=" -m64 " 209 CXXFLAGS+=" -m64 " 210 CFAFLAGS+=" -m64 " 211 LDFLAGS+=" -m64 " 132 HOST_FLAGS="-m64" 212 133 ;; 213 134 esac 214 135 fi 215 136 AC_SUBST(HOST_FLAGS) 137 138 default_target="${host_cpu}:debug, ${host_cpu}:nodebug" 139 AC_ARG_WITH(target-hosts, 140 [ --with-target-hosts=HOSTS HOSTS comma seperated list of hosts to build for, format ARCH:[debug|nodebug|nolib]], 141 target_hosts=$withval, target_hosts=${default_target}) 142 143 AC_SUBST(TARGET_HOSTS, ${target_hosts}) 144 145 LIBCFA_PATHS="DRIVER_DIR=${DRIVER_DIR}" 146 147 for i in $(echo $target_hosts | sed "s/,/ /g") 148 do 149 # call your procedure/other scripts here below 150 arch_name=$(echo $i | sed -r "s/:(.*)//g") 151 lib_config=$(echo $i | sed -r "s/(.*)://g") 152 153 case $lib_config in 154 "nodebug") ;; 155 "debug") ;; 156 "nolib") ;; 157 *) 158 >&2 echo "Configuration must be 'debug', 'nodebug' or 'nolib'" 159 exit 1 160 ;; 161 esac 162 163 M4CFA_CANNON_CPU([${arch_name}]) 164 lib_arch=${cannon_arch_name} 165 lib_dir="libcfa/${lib_arch}-${lib_config}" 166 167 LIBCFA_TARGET_DIRS="${LIBCFA_TARGET_DIRS} ${lib_dir}" 168 LIBCFA_TARGET_MAKEFILES="${LIBCFA_TARGET_MAKEFILES} ${lib_dir}/Makefile" 169 170 mkdir -p ${lib_dir} 171 echo -n "${LIBCFA_GENERAL_ARGS} " > ${lib_dir}/config.data 172 echo -n "${LIBCFA_PATHS} " >> ${lib_dir}/config.data 173 echo -n "ARCHITECTURE=${lib_arch} " >> ${lib_dir}/config.data 174 echo -n "CONFIGURATION=${lib_config}" >> ${lib_dir}/config.data 175 done 176 177 AC_SUBST(LIBCFA_TARGET_DIRS) 178 AC_SUBST(LIBCFA_TARGET_MAKEFILES) 179 180 M4CFA_CANNON_CPU([${host_cpu}]) 181 AC_DEFINE_UNQUOTED(CFA_DEFAULT_CPU, "$cannon_arch_name", [Default cpu to use if neither -m32 or -m64 are defined.]) 182 AC_DEFINE_UNQUOTED(CFA_64_CPU, "x64", [CPU to use if the -m64 flags is given.]) 183 AC_DEFINE_UNQUOTED(CFA_32_CPU, "x86", [CPU to use if the -m32 flags is given.]) 184 185 #============================================================================== 186 # CAFLAGS 216 187 AC_DEFINE_UNQUOTED(CFA_FLAGS, "${CFAFLAGS}", [compilation flags for cfa libraries and test programs.]) 217 188 AC_SUBST(CFA_FLAGS, ${CFAFLAGS}) 218 189 190 #============================================================================== 219 191 # Checks for programs. 220 192 AC_PROG_CXX … … 252 224 AC_CHECK_FUNCS([memset putenv strchr strtol]) 253 225 226 #============================================================================== 254 227 AC_CONFIG_FILES([ 255 228 Makefile 256 src/driver/Makefile229 driver/Makefile 257 230 src/Makefile 258 src/benchmark/Makefile 259 src/examples/Makefile 260 src/tests/Makefile 261 src/tests/preempt_longrun/Makefile 262 src/prelude/Makefile 263 src/libcfa/Makefile 231 benchmark/Makefile 232 tests/Makefile 233 tests/preempt_longrun/Makefile 264 234 tools/Makefile 265 235 tools/prettyprinter/Makefile 266 236 ]) 267 237 268 AC_CONFIG_LINKS([src/tests/test.py:src/tests/test.py]) 269 270 AC_OUTPUT(src/tests/config.py) 271 272 AM_COND_IF([BUILD_RELEASE], 273 [AM_COND_IF([BUILD_DEBUG], 274 [AC_MSG_NOTICE(Building libcfa for target: release & debug)], 275 [AC_MSG_NOTICE(Building libcfa for target: release)])], 276 [AM_COND_IF([BUILD_DEBUG], 277 [AC_MSG_NOTICE(Building libcfa for target: debug)], 278 [AC_MSG_NOTICE(Running cfa without libcfa)])]) 238 AC_CONFIG_LINKS([tests/test.py:tests/test.py]) 239 240 AC_OUTPUT(tests/config.py) 279 241 280 242 # Final text
Note: See TracChangeset
for help on using the changeset viewer.