OSDN Git Service

68b5cf8924cea28c4ad42f0accefa66309398f33
[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 ACX_NONCANONICAL_TARGET
25
26 target_alias=${target_alias-$host_alias}
27 AC_SUBST(target_alias)
28
29 AM_INIT_AUTOMAKE([1.9.0 foreign subdir-objects no-dist -Wall -Werror])
30
31 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
32 AC_ARG_ENABLE(version-specific-runtime-libs,
33 AS_HELP_STRING([--enable-version-specific-runtime-libs],
34  [specify that runtime libraries should be installed in a compiler-specific directory]),
35 [case "$enableval" in
36  yes) version_specific_libs=yes ;;
37  no)  version_specific_libs=no ;;
38  *)   AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
39  esac],
40 [version_specific_libs=no])
41 AC_MSG_RESULT($version_specific_libs)
42
43 GCC_NO_EXECUTABLES
44
45 # See if makeinfo has been installed and is modern enough
46 # that we can use it.
47 ACX_CHECK_PROG_VER([MAKEINFO], [makeinfo], [--version],
48                    [GNU texinfo.* \([0-9][0-9.]*\)],
49                    [4.[4-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*])
50 AM_CONDITIONAL(BUILD_INFO, test $gcc_cv_prog_makeinfo_modern = "yes")
51
52
53 # Configure libtool
54 AM_PROG_LIBTOOL
55 ACX_LT_HOST_FLAGS
56 AC_SUBST(enable_shared)
57 AC_SUBST(enable_static)
58
59 AM_MAINTAINER_MODE
60 AM_ENABLE_MULTILIB(, ..)
61
62 AC_LANG_C
63 # The same as in boehm-gc and libstdc++. Have to borrow it from there.
64 # We must force CC to /not/ be precious variables; otherwise
65 # the wrong, non-multilib-adjusted value will be used in multilibs.
66 # As a side effect, we have to subst CFLAGS ourselves.
67
68 m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
69 m4_define([_AC_ARG_VAR_PRECIOUS],[])
70 AC_PROG_CC
71 m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
72
73 AC_SUBST(CFLAGS)
74
75 AM_PROG_CC_C_O
76
77 if test "x$GCC" != "xyes"; then
78   AC_MSG_ERROR([libquadmath must be built with GCC])
79 fi
80 AC_PROG_CPP
81
82 # Calculate toolexeclibdir
83 # Also toolexecdir, though it's only used in toolexeclibdir
84 case ${version_specific_libs} in
85   yes)
86     # Need the gcc compiler version to know where to install libraries
87     # and header files if --enable-version-specific-runtime-libs option
88     # is selected.
89     toolexecdir='$(libdir)/gcc/$(target_alias)'
90     toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
91     ;;
92   no)
93     if test -n "$with_cross_host" &&
94        test x"$with_cross_host" != x"no"; then
95       # Install a library built with a cross compiler in tooldir, not libdir.
96       toolexecdir='$(exec_prefix)/$(target_alias)'
97       toolexeclibdir='$(toolexecdir)/lib'
98     else
99       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
100       toolexeclibdir='$(libdir)'
101     fi
102     multi_os_directory=`$CC -print-multi-os-directory`
103     case $multi_os_directory in
104       .) ;; # Avoid trailing /.
105       *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
106     esac
107     ;;
108 esac
109 AC_SUBST(toolexecdir)
110 AC_SUBST(toolexeclibdir)
111
112 # If available, sqrtl and cbrtl speed up the calculation -
113 # but they are not required
114 if test x$gcc_no_link != xyes; then
115   AC_CHECK_LIB([m],[sqrtl],[AC_DEFINE([HAVE_SQRTL],[1],[libm includes sqrtl])])
116   AC_CHECK_LIB([m],[cbrtl],[AC_DEFINE([HAVE_CBRTL],[1],[libm includes cbrtl])])
117 else
118   if test "x$ac_cv_lib_m_sqrtl" = x""yes; then
119     AC_DEFINE([HAVE_SQRTL],[1],[libm includes sqrtl])  
120   fi
121   if test "x$ac_cv_lib_m_cbrtl" = x""yes; then
122     AC_DEFINE([HAVE_CBRTL],[1],[libm includes cbrtl])  
123   fi
124 fi
125
126 # Check for symbol versioning (copied from libssp).
127 AC_MSG_CHECKING([whether symbol versioning is supported])
128 if test x$gcc_no_link = xyes; then
129   # If we cannot link, we cannot build shared libraries, so do not use
130   # symbol versioning.
131   quadmath_use_symver=no
132 else
133   save_LDFLAGS="$LDFLAGS"
134   LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map"
135   cat > conftest.map <<EOF
136 FOO_1.0 {
137   global: *foo*; bar; local: *;
138 };
139 EOF
140   AC_TRY_LINK([int foo;],[],[quadmath_use_symver=gnu],[quadmath_use_symver=no])
141   if test x$quadmath_use_symver = xno; then
142     case "$target_os" in
143       solaris2*)
144         LDFLAGS="$save_LDFLAGS"
145         LDFLAGS="$LDFLAGS -fPIC -shared -Wl,-M,./conftest.map"
146         # Sun ld cannot handle wildcards and treats all entries as undefined.
147         cat > conftest.map <<EOF
148 FOO_1.0 {
149   global: foo; local: *;
150 };
151 EOF
152         AC_TRY_LINK([int foo;],[],[quadmath_use_symver=sun],[quadmath_use_symver=no])
153         ;;
154     esac
155   fi
156   LDFLAGS="$save_LDFLAGS"
157 fi
158 AC_MSG_RESULT($quadmath_use_symver)
159 AM_CONDITIONAL(LIBQUAD_USE_SYMVER, [test "x$quadmath_use_symver" != xno])
160 AM_CONDITIONAL(LIBQUAD_USE_SYMVER_GNU, [test "x$quadmath_use_symver" = xgnu])
161 AM_CONDITIONAL(LIBQUAD_USE_SYMVER_SUN, [test "x$quadmath_use_symver" = xsun])
162
163 AC_CACHE_CHECK([whether __float128 is supported], [libquad_cv_have_float128],
164   [GCC_TRY_COMPILE_OR_LINK([
165     typedef _Complex float __attribute__((mode(TC))) __complex128;
166
167     __float128 foo (__float128 x)
168     {
169
170      __complex128 z1, z2;
171
172      z1 = x;
173      z2 = x / 7.Q;
174      z2 /= z1;
175
176      return (__float128) z2;
177     }
178
179     __float128 bar (__float128 x)
180     {
181       return x * __builtin_huge_valq ();
182     }
183   ],[
184     foo (1.2Q);
185     bar (1.2Q);
186   ],[
187     libquad_cv_have_float128=yes
188   ],[
189     libquad_cv_have_float128=no
190 ])])
191 AM_CONDITIONAL(BUILD_LIBQUADMATH, [test "x$libquad_cv_have_float128" = xyes])
192
193 AC_CACHE_SAVE
194
195 if test ${multilib} = yes; then
196   multilib_arg="--enable-multilib"
197 else
198   multilib_arg=
199 fi
200
201
202 # We would like our source tree to be readonly. However when releases or
203 # pre-releases are generated, the flex/bison generated files as well as the
204 # various formats of manuals need to be included along with the rest of the
205 # sources.  Therefore we have --enable-generated-files-in-srcdir to do 
206 # just that.
207 AC_MSG_CHECKING(generated-files-in-srcdir)
208 AC_ARG_ENABLE(generated-files-in-srcdir,
209 AS_HELP_STRING([--enable-generated-files-in-srcdir],
210  [put copies of generated files in source dir intended for creating source tarballs for users without texinfo bison or flex]),
211 [case "$enableval" in
212  yes) enable_generated_files_in_srcdir=yes ;;
213  no)  enable_generated_files_in_srcdir=no ;;
214  *)   AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
215  esac],
216 [enable_generated_files_in_srcdir=no])
217 AC_MSG_RESULT($enable_generated_files_in_srcdir)
218 AM_CONDITIONAL(GENINSRC, test "$enable_generated_files_in_srcdir" = yes)
219
220
221 AC_CONFIG_FILES(Makefile)
222 AC_OUTPUT