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