Merge from mainline
[official-gcc.git] / libgcc-math / configure.ac
blob48ad73ad4bdbe92665663797b588c914985f504e
1 # Process this file with autoconf to produce a configure script, like so:
2 # aclocal && autoconf && autoheader && automake
4 AC_PREREQ(2.59)
5 AC_INIT(libgcc-math, 1.0)
6 AC_CONFIG_SRCDIR(configure.ac)
7 AC_CANONICAL_SYSTEM
9 AM_INIT_AUTOMAKE
11 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
12 AC_ARG_ENABLE(version-specific-runtime-libs,
13 [  --enable-version-specific-runtime-libs    Specify that runtime libraries should be installed in a compiler-specific directory ],
14 [case "$enableval" in
15  yes) version_specific_libs=yes ;;
16  no)  version_specific_libs=no ;;
17  *)   AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
18  esac],
19 [version_specific_libs=no])
20 AC_MSG_RESULT($version_specific_libs)
22 AM_MAINTAINER_MODE
23 AC_EXEEXT
25 AM_ENABLE_MULTILIB(, ..)
27 target_alias=${target_alias-$host_alias}
28 AC_SUBST(target_alias)
30 AC_LANG_C
31 # The same as in boehm-gc and libstdc++. Have to borrow it from there.
32 # We must force CC to /not/ be precious variables; otherwise
33 # the wrong, non-multilib-adjusted value will be used in multilibs.
34 # As a side effect, we have to subst CFLAGS ourselves.
36 m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
37 m4_define([_AC_ARG_VAR_PRECIOUS],[])
38 AC_PROG_CC
39 m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
41 AC_SUBST(CFLAGS)
43 if test "x$GCC" != "xyes"; then
44   AC_MSG_ERROR([libgcc-math must be built with GCC])
46 AC_PROG_CPP
47 AM_PROG_AS
49 AC_MSG_CHECKING([whether hidden visibility is supported])
50 AC_TRY_COMPILE([
51 void __attribute__((visibility ("hidden"))) bar (void) {}],,
52 [gccm_hidden=yes],[gccm_hidden=no])
53 AC_MSG_RESULT($gccm_hidden)
54 if test x$gccm_hidden = xyes; then
55   AC_DEFINE([HAVE_HIDDEN_VISIBILITY],[1],[__attribute__((visibility ("hidden"))) supported])
58 AC_MSG_CHECKING([whether symbol versioning is supported])
59 cat > conftest.map <<EOF
60 FOO_1.0 {
61   global: *foo*; bar; local: *;
63 EOF
64 save_LDFLAGS="$LDFLAGS"
65 LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map"
66 AC_TRY_LINK([int foo;],[],[gccm_use_symver=yes],[gccm_use_symver=no])
67 LDFLAGS="$save_LDFLAGS"
68 AC_MSG_RESULT($gccm_use_symver)
69 AM_CONDITIONAL(LIBGCCM_USE_SYMVER, [test "x$gccm_use_symver" = xyes])
71 AC_MSG_CHECKING([whether we are a 32bit target])
72 save_CFLAGS="$CFLAGS"
73 CFLAGS="-O2"
74 AC_TRY_LINK(,[
75 if (sizeof(int) == 4 && sizeof(long) == 4 && sizeof(void *) == 4)
76   ;
77 else
78   undefined_function ();
80 target_ilp32=yes,
81 target_ilp32=no)
82 CFLAGS="$save_CFLAGS"
83 AM_CONDITIONAL(TARGET_ILP32, [test "x$target_ilp32" = xyes])
86 AM_PROG_LIBTOOL
87 AC_SUBST(enable_shared)
88 AC_SUBST(enable_static)
90 # Calculate toolexeclibdir
91 # Also toolexecdir, though it's only used in toolexeclibdir
92 case ${version_specific_libs} in
93   yes)
94     # Need the gcc compiler version to know where to install libraries
95     # and header files if --enable-version-specific-runtime-libs option
96     # is selected.
97     toolexecdir='$(libdir)/gcc/$(target_alias)'
98     toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
99     ;;
100   no)
101     if test -n "$with_cross_host" &&
102        test x"$with_cross_host" != x"no"; then
103       # Install a library built with a cross compiler in tooldir, not libdir.
104       toolexecdir='$(exec_prefix)/$(target_alias)'
105       toolexeclibdir='$(toolexecdir)/lib'
106     else
107       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
108       toolexeclibdir='$(libdir)'
109     fi
110     multi_os_directory=`$CC -print-multi-os-directory`
111     case $multi_os_directory in
112       .) ;; # Avoid trailing /.
113       *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
114     esac
115     ;;
116 esac
117 AC_SUBST(toolexecdir)
118 AC_SUBST(toolexeclibdir)
120 if test ${multilib} = yes; then
121   multilib_arg="--enable-multilib"
122 else
123   multilib_arg=
126 GCC_HEADER_STDINT(gstdint.h)
128 # Check for target library dependencies
129 cannot_build=no
131 AC_MSG_CHECKING([whether math.h conflicts with defining __isinf])
132 AC_TRY_LINK([
133 #include "math.h"
134 int __isinf (double x)
137 ], [
138 return __isinf (1.0);
139 ], [
140 AC_MSG_RESULT([no])
141 ], [
142 AC_MSG_RESULT([yes])
143 cannot_build=yes
147 # Now check which parts we include in the library.
149 arch_subdirs=
150 case "${target}" in
151   i?86-* | x86_64-* )
152 # Handle multilib cases
153     if test "x$target_ilp32" = xyes; then
154       arch_subdirs="i386"
155       arch_libraries="i386/libsse2.la"
156       arch_maps="i386/sse2.map"
157     fi ;;
158   *)
159     ;;
160 esac
161 AC_SUBST(arch_subdirs)
162 AC_SUBST(arch_libraries)
163 AC_SUBST(arch_maps)
164 if test "$cannot_build" = "yes"; then
165   arch_subdirs=
167 AM_CONDITIONAL(BUILD_LIBGCC_MATH, [test "x$arch_subdirs" != x])
170 AC_CONFIG_FILES([Makefile i386/Makefile])
171 AC_OUTPUT