OSDN Git Service

/
[pf3gnuchains/gcc-fork.git] / libquadmath / configure.ac
1 # Process this file with autoconf to produce a configure script, like so:
2 # aclocal && autoconf && autoheader && automake
3
4 AC_PREREQ(2.64)
5 AC_INIT([GCC Quad-precision Math Library], 0.1,,[libquadmath])
6 AC_CONFIG_HEADER(config.h)
7
8 # Gets build, host, target, *_vendor, *_cpu, *_os, etc.
9 #
10 # You will slowly go insane if you do not grok the following fact:  when
11 # building this library, the top-level /target/ becomes the library's /host/.
12 #
13 # configure then causes --target to default to --host, exactly like any
14 # other package using autoconf.  Therefore, 'target' and 'host' will
15 # always be the same.  This makes sense both for native and cross compilers
16 # just think about it for a little while.  :-)
17 #
18 # Also, if this library is being configured as part of a cross compiler, the
19 # top-level configure script will pass the "real" host as $with_cross_host.
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
23 AC_CANONICAL_SYSTEM
24 target_alias=${target_alias-$host_alias}
25
26 AM_INIT_AUTOMAKE([1.9.0 foreign subdir-objects no-dist -Wall -Werror])
27
28 AC_PROG_CC
29 AM_PROG_CC_C_O
30
31 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
32 AC_ARG_ENABLE(version-specific-runtime-libs,
33 [  --enable-version-specific-runtime-libs    Specify that runtime libraries should be installed in a compiler-specific directory ],
34 [case "$enableval" in
35  yes) version_specific_libs=yes ;;
36  no)  version_specific_libs=no ;;
37  *)   AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
38  esac],
39 [version_specific_libs=no])
40 AC_MSG_RESULT($version_specific_libs)
41
42
43 # Configure libtool
44 AM_PROG_LIBTOOL
45 AC_SUBST(enable_shared)
46 AC_SUBST(enable_static)
47
48 AM_MAINTAINER_MODE
49 AM_ENABLE_MULTILIB(, ..)
50
51 # Calculate toolexeclibdir
52 # Also toolexecdir, though it's only used in toolexeclibdir
53 case ${version_specific_libs} in
54   yes)
55     # Need the gcc compiler version to know where to install libraries
56     # and header files if --enable-version-specific-runtime-libs option
57     # is selected.
58     toolexecdir='$(libdir)/gcc/$(target_alias)'
59     toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
60     ;;
61   no)
62     if test -n "$with_cross_host" &&
63        test x"$with_cross_host" != x"no"; then
64       # Install a library built with a cross compiler in tooldir, not libdir.
65       toolexecdir='$(exec_prefix)/$(target_alias)'
66       toolexeclibdir='$(toolexecdir)/lib'
67     else
68       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
69       toolexeclibdir='$(libdir)'
70     fi
71     multi_os_directory=`$CC -print-multi-os-directory`
72     case $multi_os_directory in
73       .) ;; # Avoid trailing /.
74       *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
75     esac
76     ;;
77 esac
78 AC_SUBST(toolexecdir)
79 AC_SUBST(toolexeclibdir)
80
81 AC_CHECK_LIB([m],[sqrtl],[AC_DEFINE([HAVE_SQRTL],[1],[libm includes sqrtl])])
82 AC_CHECK_LIB([m],[cbrtl],[AC_DEFINE([HAVE_CBRTL],[1],[libm includes cbrtl])])
83
84 # Check for symbol versioning (copied from libssp).
85 AC_MSG_CHECKING([whether symbol versioning is supported])
86 save_LDFLAGS="$LDFLAGS"
87 LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map"
88 cat > conftest.map <<EOF
89 FOO_1.0 {
90   global: *foo*; bar; local: *;
91 };
92 EOF
93 AC_TRY_LINK([int foo;],[],[quadmath_use_symver=gnu],[quadmath_use_symver=no])
94 if test x$quadmath_use_symver = xno; then
95   case "$target_os" in
96     solaris2*)
97       LDFLAGS="$save_LDFLAGS"
98       LDFLAGS="$LDFLAGS -fPIC -shared -Wl,-M,./conftest.map"
99       # Sun ld cannot handle wildcards and treats all entries as undefined.
100       cat > conftest.map <<EOF
101 FOO_1.0 {
102   global: foo; local: *;
103 };
104 EOF
105       AC_TRY_LINK([int foo;],[],[quadmath_use_symver=sun],[quadmath_use_symver=no])
106       ;;
107   esac
108 fi
109 LDFLAGS="$save_LDFLAGS"
110 AC_MSG_RESULT($quadmath_use_symver)
111 AM_CONDITIONAL(LIBQUAD_USE_SYMVER, [test "x$quadmath_use_symver" != xno])
112 AM_CONDITIONAL(LIBQUAD_USE_SYMVER_GNU, [test "x$quadmath_use_symver" = xgnu])
113 AM_CONDITIONAL(LIBQUAD_USE_SYMVER_SUN, [test "x$quadmath_use_symver" = xsun])
114
115 AC_MSG_CHECKING([whether __float128 is supported])
116   AC_TRY_LINK([
117     typedef _Complex float __attribute__((mode(TC))) __complex128;
118
119     __float128 foo (__float128 x)
120     {
121
122      __complex128 z1, z2;
123
124      z1 = x;
125      z2 = x / 7.Q;
126      z2 /= z1;
127
128      return (__float128) z2;
129     }
130
131     __float128 bar (__float128 x)
132     {
133       return x * __builtin_huge_valq ();
134     }
135   ],[
136     foo (1.2Q);
137     bar (1.2Q);
138   ],[
139     libquad_have_float128=yes
140   ],[
141     libquad_have_float128=no
142 ])
143 AC_MSG_RESULT([$libquad_have_float128])
144
145 dnl
146 dnl Enable the following for a stand-alone library:
147 dnl
148 dnl if test $libquad_have_float128 = no; then
149 dnl   AC_MSG_ERROR([__float128 support is required to build this library.])
150 dnl fi
151
152 AM_CONDITIONAL(BUILD_LIBQUADMATH, [test "x$libquad_have_float128" = xyes])
153
154 AC_CACHE_SAVE
155
156 if test ${multilib} = yes; then
157   multilib_arg="--enable-multilib"
158 else
159   multilib_arg=
160 fi
161
162 AC_CONFIG_FILES(Makefile)
163 AC_OUTPUT