PR target/65871
[official-gcc.git] / libmpx / configure.ac
blob463e85562bcb0158dda1b6f0c0acfb8983981236
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)
27 # See if supported.
28 unset LIBMPX_SUPPORTED
29 AC_MSG_CHECKING([for target support for Intel MPX runtime library])
30 echo "int i[[sizeof (void *) == 4 ? 1 : -1]] = { __x86_64__ };" > conftest.c
31 if AC_TRY_COMMAND([${CC} ${CFLAGS} -c -o conftest.o conftest.c 1>&AS_MESSAGE_LOG_FD])
32 then
33     LIBMPX_SUPPORTED=no
34 else
35     LIBMPX_SUPPORTED=yes
37 rm -f conftest.o conftest.c
38 AC_MSG_RESULT($LIBMPX_SUPPORTED)
39 AM_CONDITIONAL(LIBMPX_SUPPORTED, [test "x$LIBMPX_SUPPORTED" = "xyes"])
41 link_libmpx="-lpthread"
42 link_mpx=""
43 AC_MSG_CHECKING([whether ld accepts -z bndplt])
44 echo "int main() {};" > conftest.c
45 if AC_TRY_COMMAND([${CC} ${CFLAGS} -Wl,-z,bndplt -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
46 then
47     AC_MSG_RESULT([yes])
48     link_mpx="$link_mpx -z bndplt"
49 else
50     AC_MSG_RESULT([no])
52 AC_SUBST(link_libmpx)
53 AC_SUBST(link_mpx)
55 AM_INIT_AUTOMAKE(foreign no-dist no-dependencies)
56 AM_ENABLE_MULTILIB(, ..)
57 AM_MAINTAINER_MODE
59 AC_GNU_SOURCE
60 AC_CHECK_FUNCS([secure_getenv])
62 # Calculate toolexeclibdir
63 # Also toolexecdir, though it's only used in toolexeclibdir
64 case ${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     ;;
88 esac
89 AC_SUBST(toolexecdir)
90 AC_SUBST(toolexeclibdir)
92 # Check for programs.
93 m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
94 m4_define([_AC_ARG_VAR_PRECIOUS],[])
95 AC_PROG_CC
96 m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
98 AM_PROG_CC_C_O
100 AC_SUBST(CFLAGS)
102 # Newer automakes demand CCAS and CCASFLAGS.
103 : ${CCAS='$(CC)'}
104 : ${CCASFLAGS='$(CFLAGS)'}
105 AC_SUBST(CCAS)
106 AC_SUBST(CCASFLAGS)
108 AC_CHECK_TOOL(AS, as)
109 AC_CHECK_TOOL(AR, ar)
110 AC_CHECK_TOOL(RANLIB, ranlib, :)
112 # Check we may build wrappers library
113 echo "test:  bndmov %bnd0, %bnd1" > conftest.s
114 if AC_TRY_COMMAND([$AS -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
115 then
116     mpx_as=yes
117 else
118     mpx_as=no
119     echo "configure: no MPX support fo as" >&AS_MESSAGE_LOG_FD
121 rm -f conftest.o conftest.s
122 AM_CONDITIONAL(MPX_AS_SUPPORTED, [test "x$mpx_as" = "xyes"])
124 # Configure libtool
125 AC_LIBTOOL_DLOPEN
126 AM_PROG_LIBTOOL
127 AC_SUBST(enable_shared)
128 AC_SUBST(enable_static)
130 XCFLAGS="-Wall -Wextra"
131 AC_SUBST(XCFLAGS)
133 if test "${multilib}" = "yes"; then
134   multilib_arg="--enable-multilib"
135 else
136   multilib_arg=
139 AC_CONFIG_FILES([Makefile libmpx.spec])
140 AC_CONFIG_HEADERS(config.h)
141 AC_CONFIG_FILES(AC_FOREACH([DIR], [mpxrt mpxwrap], [DIR/Makefile ]),
142   [cat > vpsed$$ << \_EOF
143 s!`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])
154 AC_OUTPUT