1# -*- Autoconf -*- 2# Process this file with autoconf to produce a configure script. 3 4AC_PREREQ([2.64]) 5AC_INIT(package-unused, version-unused, libmpx) 6 7# ------- 8# Options 9# ------- 10AC_MSG_CHECKING([for --enable-version-specific-runtime-libs]) 11AC_ARG_ENABLE(version-specific-runtime-libs, 12[ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ], 13[case "$enableval" in 14 yes) version_specific_libs=yes ;; 15 no) version_specific_libs=no ;; 16 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);; 17 esac], 18[version_specific_libs=no]) 19AC_MSG_RESULT($version_specific_libs) 20 21# Do not delete or change the following two lines. For why, see 22# http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html 23AC_CANONICAL_SYSTEM 24target_alias=${target_alias-$host_alias} 25AC_SUBST(target_alias) 26 27# See if supported. 28unset LIBMPX_SUPPORTED 29AC_MSG_CHECKING([for target support for Intel MPX runtime library]) 30echo "int i[[sizeof (void *) == 4 ? 1 : -1]] = { __x86_64__ };" > conftest.c 31if AC_TRY_COMMAND([${CC} ${CFLAGS} -c -o conftest.o conftest.c 1>&AS_MESSAGE_LOG_FD]) 32then 33 LIBMPX_SUPPORTED=no 34else 35 LIBMPX_SUPPORTED=yes 36fi 37rm -f conftest.o conftest.c 38AC_MSG_RESULT($LIBMPX_SUPPORTED) 39AM_CONDITIONAL(LIBMPX_SUPPORTED, [test "x$LIBMPX_SUPPORTED" = "xyes"]) 40 41link_libmpx="-lpthread" 42link_mpx="" 43AC_MSG_CHECKING([whether ld accepts -z bndplt]) 44echo "int main() {};" > conftest.c 45if AC_TRY_COMMAND([${CC} ${CFLAGS} -Wl,-z,bndplt -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]) 46then 47 AC_MSG_RESULT([yes]) 48 link_mpx="$link_mpx -z bndplt" 49else 50 AC_MSG_RESULT([no]) 51fi 52AC_SUBST(link_libmpx) 53AC_SUBST(link_mpx) 54 55AM_INIT_AUTOMAKE(foreign no-dist no-dependencies) 56AM_ENABLE_MULTILIB(, ..) 57AM_MAINTAINER_MODE 58 59AC_GNU_SOURCE 60AC_CHECK_FUNCS([secure_getenv]) 61 62# Calculate toolexeclibdir 63# Also toolexecdir, though it's only used in toolexeclibdir 64case ${version_specific_libs} in 65 yes) 66 # Need the gcc compiler version to know where to install libraries 67 # and header files if --enable-version-specific-runtime-libs option 68 # is selected. 69 toolexecdir='$(libdir)/gcc/$(target_alias)' 70 toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)' 71 ;; 72 no) 73 if test -n "$with_cross_host" && 74 test x"$with_cross_host" != x"no"; then 75 # Install a library built with a cross compiler in tooldir, not libdir. 76 toolexecdir='$(exec_prefix)/$(target_alias)' 77 toolexeclibdir='$(toolexecdir)/lib' 78 else 79 toolexecdir='$(libdir)/gcc-lib/$(target_alias)' 80 toolexeclibdir='$(libdir)' 81 fi 82 multi_os_directory=`$CC -print-multi-os-directory` 83 case $multi_os_directory in 84 .) ;; # Avoid trailing /. 85 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; 86 esac 87 ;; 88esac 89AC_SUBST(toolexecdir) 90AC_SUBST(toolexeclibdir) 91 92# Check for programs. 93m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS]) 94m4_define([_AC_ARG_VAR_PRECIOUS],[]) 95AC_PROG_CC 96m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) 97 98AM_PROG_CC_C_O 99 100AC_SUBST(CFLAGS) 101 102# Newer automakes demand CCAS and CCASFLAGS. 103: ${CCAS='$(CC)'} 104: ${CCASFLAGS='$(CFLAGS)'} 105AC_SUBST(CCAS) 106AC_SUBST(CCASFLAGS) 107 108AC_CHECK_TOOL(AS, as) 109AC_CHECK_TOOL(AR, ar) 110AC_CHECK_TOOL(RANLIB, ranlib, :) 111 112# Check we may build wrappers library 113echo "test: bndmov %bnd0, %bnd1" > conftest.s 114if AC_TRY_COMMAND([$AS -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD]) 115then 116 mpx_as=yes 117else 118 mpx_as=no 119 echo "configure: no MPX support fo as" >&AS_MESSAGE_LOG_FD 120fi 121rm -f conftest.o conftest.s 122AM_CONDITIONAL(MPX_AS_SUPPORTED, [test "x$mpx_as" = "xyes"]) 123 124# Configure libtool 125AC_LIBTOOL_DLOPEN 126AM_PROG_LIBTOOL 127AC_SUBST(enable_shared) 128AC_SUBST(enable_static) 129 130XCFLAGS="-Wall -Wextra" 131AC_SUBST(XCFLAGS) 132 133if test "${multilib}" = "yes"; then 134 multilib_arg="--enable-multilib" 135else 136 multilib_arg= 137fi 138 139AC_CONFIG_FILES([Makefile libmpx.spec]) 140AC_CONFIG_HEADERS(config.h) 141AC_CONFIG_FILES(AC_FOREACH([DIR], [mpxrt mpxwrap], [DIR/Makefile ]), 142 [cat > vpsed$$ << \_EOF 143s!`test -f '$<' || echo '$(srcdir)/'`!! 144_EOF 145 sed -f vpsed$$ $ac_file > tmp$$ 146 mv tmp$$ $ac_file 147 rm vpsed$$ 148 echo 'MULTISUBDIR =' >> $ac_file 149 ml_norecursion=yes 150 . ${multi_basedir}/config-ml.in 151 AS_UNSET([ml_norecursion]) 152]) 153 154AC_OUTPUT 155