]> git.ipfire.org Git - thirdparty/gcc.git/blame - libquadmath/configure.ac
Simple patch only add assumed-rank to the list of possible attributes.
[thirdparty/gcc.git] / libquadmath / configure.ac
CommitLineData
1ec601bf
FXC
1# Process this file with autoconf to produce a configure script, like so:
2# aclocal && autoconf && autoheader && automake
3
1ec601bf
FXC
4AC_INIT([GCC Quad-precision Math Library], 0.1,,[libquadmath])
5AC_CONFIG_HEADER(config.h)
6
7# Gets build, host, target, *_vendor, *_cpu, *_os, etc.
8#
9# You will slowly go insane if you do not grok the following fact: when
10# building this library, the top-level /target/ becomes the library's /host/.
11#
12# configure then causes --target to default to --host, exactly like any
13# other package using autoconf. Therefore, 'target' and 'host' will
14# always be the same. This makes sense both for native and cross compilers
15# just think about it for a little while. :-)
16#
17# Also, if this library is being configured as part of a cross compiler, the
18# top-level configure script will pass the "real" host as $with_cross_host.
19#
20# Do not delete or change the following two lines. For why, see
21# http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
22AC_CANONICAL_SYSTEM
fabfcf5e
KT
23ACX_NONCANONICAL_TARGET
24
ee5f0523
MK
25AM_ENABLE_MULTILIB(, ..)
26
1ec601bf 27target_alias=${target_alias-$host_alias}
fabfcf5e 28AC_SUBST(target_alias)
1ec601bf 29
a6098a28 30AM_INIT_AUTOMAKE([1.9.0 foreign subdir-objects no-dist -Wall -Wno-override -Werror])
1ec601bf 31
1ec601bf
FXC
32AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
33AC_ARG_ENABLE(version-specific-runtime-libs,
4c993c44
TB
34AS_HELP_STRING([--enable-version-specific-runtime-libs],
35 [specify that runtime libraries should be installed in a compiler-specific directory]),
1ec601bf
FXC
36[case "$enableval" in
37 yes) version_specific_libs=yes ;;
38 no) version_specific_libs=no ;;
39 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
40 esac],
41[version_specific_libs=no])
42AC_MSG_RESULT($version_specific_libs)
43
fabfcf5e 44GCC_NO_EXECUTABLES
1ec601bf 45
1d92226b
JJ
46AC_USE_SYSTEM_EXTENSIONS
47
4c993c44
TB
48# See if makeinfo has been installed and is modern enough
49# that we can use it.
50ACX_CHECK_PROG_VER([MAKEINFO], [makeinfo], [--version],
51 [GNU texinfo.* \([0-9][0-9.]*\)],
52 [4.[4-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*])
53AM_CONDITIONAL(BUILD_INFO, test $gcc_cv_prog_makeinfo_modern = "yes")
54
19e30111 55ACX_BUGURL([https://gcc.gnu.org/bugs/])
4c993c44 56
1ec601bf
FXC
57# Configure libtool
58AM_PROG_LIBTOOL
7de6ba7a 59ACX_LT_HOST_FLAGS
1ec601bf
FXC
60AC_SUBST(enable_shared)
61AC_SUBST(enable_static)
62
63AM_MAINTAINER_MODE
1ec601bf 64
fabfcf5e
KT
65AC_LANG_C
66# The same as in boehm-gc and libstdc++. Have to borrow it from there.
67# We must force CC to /not/ be precious variables; otherwise
68# the wrong, non-multilib-adjusted value will be used in multilibs.
69# As a side effect, we have to subst CFLAGS ourselves.
70
71m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
72m4_define([_AC_ARG_VAR_PRECIOUS],[])
73AC_PROG_CC
74m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
75
76AC_SUBST(CFLAGS)
77
78AM_PROG_CC_C_O
79
80if test "x$GCC" != "xyes"; then
81 AC_MSG_ERROR([libquadmath must be built with GCC])
82fi
83AC_PROG_CPP
84
e8e66971
MR
85GCC_WITH_TOOLEXECLIBDIR
86
1ec601bf
FXC
87# Calculate toolexeclibdir
88# Also toolexecdir, though it's only used in toolexeclibdir
89case ${version_specific_libs} in
90 yes)
91 # Need the gcc compiler version to know where to install libraries
92 # and header files if --enable-version-specific-runtime-libs option
93 # is selected.
94 toolexecdir='$(libdir)/gcc/$(target_alias)'
95 toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
96 ;;
97 no)
98 if test -n "$with_cross_host" &&
99 test x"$with_cross_host" != x"no"; then
100 # Install a library built with a cross compiler in tooldir, not libdir.
101 toolexecdir='$(exec_prefix)/$(target_alias)'
e8e66971
MR
102 case ${with_toolexeclibdir} in
103 no)
104 toolexeclibdir='$(toolexecdir)/lib'
105 ;;
106 *)
107 toolexeclibdir=${with_toolexeclibdir}
108 ;;
109 esac
1ec601bf
FXC
110 else
111 toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
112 toolexeclibdir='$(libdir)'
113 fi
114 multi_os_directory=`$CC -print-multi-os-directory`
115 case $multi_os_directory in
116 .) ;; # Avoid trailing /.
117 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
118 esac
119 ;;
120esac
121AC_SUBST(toolexecdir)
122AC_SUBST(toolexeclibdir)
123
d2995f21 124AC_CHECK_HEADERS(fenv.h langinfo.h locale.h wchar.h wctype.h limits.h ctype.h printf.h errno.h)
5a09d908 125LIBQUAD_CHECK_MATH_H_SIGNGAM
e8d42d28 126
6f468984
TB
127# If available, sqrtl and cbrtl speed up the calculation -
128# but they are not required
129if test x$gcc_no_link != xyes; then
130 AC_CHECK_LIB([m],[sqrtl],[AC_DEFINE([HAVE_SQRTL],[1],[libm includes sqrtl])])
131 AC_CHECK_LIB([m],[cbrtl],[AC_DEFINE([HAVE_CBRTL],[1],[libm includes cbrtl])])
e8d42d28
JJ
132 AC_CHECK_LIB([m],[feholdexcept],[AC_DEFINE([HAVE_FEHOLDEXCEPT],[1],[libm includes feholdexcept])])
133 AC_CHECK_LIB([m],[fesetround],[AC_DEFINE([HAVE_FESETROUND],[1],[libm includes fesetround])])
134 AC_CHECK_LIB([m],[feupdateenv],[AC_DEFINE([HAVE_FEUPDATEENV],[1],[libm includes feupdateenv])])
135 AC_CHECK_LIB([m],[fesetenv],[AC_DEFINE([HAVE_FESETENV],[1],[libm includes fesetenv])])
136 AC_CHECK_LIB([m],[fetestexcept],[AC_DEFINE([HAVE_FETESTEXCEPT],[1],[libm includes fetestexcept])])
a855debf 137 AC_CHECK_FUNCS(strtoull)
6f468984
TB
138else
139 if test "x$ac_cv_lib_m_sqrtl" = x""yes; then
140 AC_DEFINE([HAVE_SQRTL],[1],[libm includes sqrtl])
141 fi
142 if test "x$ac_cv_lib_m_cbrtl" = x""yes; then
143 AC_DEFINE([HAVE_CBRTL],[1],[libm includes cbrtl])
144 fi
e8d42d28
JJ
145 if test "x$ac_cv_lib_m_feholdexcept" = x""yes; then
146 AC_DEFINE([HAVE_FEHOLDEXCEPT],[1],[libm includes feholdexcept])
147 fi
148 if test "x$ac_cv_lib_m_fesetround" = x""yes; then
149 AC_DEFINE([HAVE_FESETROUND],[1],[libm includes fesetround])
150 fi
151 if test "x$ac_cv_lib_m_feupdateenv" = x""yes; then
152 AC_DEFINE([HAVE_FEUPDATEENV],[1],[libm includes feupdateenv])
153 fi
154 if test "x$ac_cv_lib_m_fesetenv" = x""yes; then
155 AC_DEFINE([HAVE_FESETENV],[1],[libm includes fesetenv])
156 fi
157 if test "x$ac_cv_lib_m_fetestexcept" = x""yes; then
158 AC_DEFINE([HAVE_FETESTEXCEPT],[1],[libm includes fetestexcept])
159 fi
6f468984 160fi
1ec601bf 161
1d92226b 162# Check for hidden visibility (copied from libssp).
49f0e1ba
JJ
163saved_CFLAGS="$CFLAGS"
164CFLAGS="$CFLAGS -Werror"
1d92226b
JJ
165AC_MSG_CHECKING([whether hidden visibility is supported])
166AC_TRY_COMPILE([
167void __attribute__((visibility ("hidden"))) bar (void) {}],,
168[quadmath_hidden=yes],[quadmath_hidden=no])
169AC_MSG_RESULT($quadmath_hidden)
170if test x$quadmath_hidden = xyes; then
171 AC_DEFINE([HAVE_HIDDEN_VISIBILITY],[1],[__attribute__((visibility ("hidden"))) supported])
172fi
49f0e1ba 173CFLAGS="$saved_CFLAGS"
1d92226b 174
1ec601bf
FXC
175# Check for symbol versioning (copied from libssp).
176AC_MSG_CHECKING([whether symbol versioning is supported])
bf382f5f
RO
177AC_ARG_ENABLE(symvers,
178AS_HELP_STRING([--disable-symvers],
179 [disable symbol versioning for libquadmath]),
180quadmath_use_symver=$enableval,
181quadmath_use_symver=yes)
19af62db 182if test "x$quadmath_use_symver" != xno; then
bf382f5f
RO
183 if test x$gcc_no_link = xyes; then
184 # If we cannot link, we cannot build shared libraries, so do not use
185 # symbol versioning.
186 quadmath_use_symver=no
187 else
188 save_LDFLAGS="$LDFLAGS"
189 LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map"
190 cat > conftest.map <<EOF
1ec601bf
FXC
191FOO_1.0 {
192 global: *foo*; bar; local: *;
193};
194EOF
bf382f5f
RO
195 AC_TRY_LINK([int foo;],[],[quadmath_use_symver=gnu],[quadmath_use_symver=no])
196 if test x$quadmath_use_symver = xno; then
197 case "$target_os" in
198 solaris2*)
199 LDFLAGS="$save_LDFLAGS"
200 LDFLAGS="$LDFLAGS -fPIC -shared -Wl,-M,./conftest.map"
201 # Sun ld cannot handle wildcards and treats all entries as undefined.
202 cat > conftest.map <<EOF
1ec601bf
FXC
203FOO_1.0 {
204 global: foo; local: *;
205};
206EOF
bf382f5f
RO
207 AC_TRY_LINK([int foo;],[],[quadmath_use_symver=sun],[quadmath_use_symver=no])
208 ;;
209 esac
210 fi
211 LDFLAGS="$save_LDFLAGS"
fabfcf5e 212 fi
1ec601bf 213fi
1ec601bf
FXC
214AC_MSG_RESULT($quadmath_use_symver)
215AM_CONDITIONAL(LIBQUAD_USE_SYMVER, [test "x$quadmath_use_symver" != xno])
216AM_CONDITIONAL(LIBQUAD_USE_SYMVER_GNU, [test "x$quadmath_use_symver" = xgnu])
217AM_CONDITIONAL(LIBQUAD_USE_SYMVER_SUN, [test "x$quadmath_use_symver" = xsun])
218
abccc9a9
TB
219AC_CACHE_CHECK([whether __float128 is supported], [libquad_cv_have_float128],
220 [GCC_TRY_COMPILE_OR_LINK([
0c949f0a 221 #if (!defined(_ARCH_PPC)) || defined(__LONG_DOUBLE_IEEE128__)
1ec601bf 222 typedef _Complex float __attribute__((mode(TC))) __complex128;
0c949f0a
MM
223 #else
224 typedef _Complex float __attribute__((mode(KC))) __complex128;
225 #endif
1ec601bf
FXC
226
227 __float128 foo (__float128 x)
228 {
229
230 __complex128 z1, z2;
231
232 z1 = x;
233 z2 = x / 7.Q;
234 z2 /= z1;
235
236 return (__float128) z2;
237 }
238
239 __float128 bar (__float128 x)
240 {
241 return x * __builtin_huge_valq ();
242 }
243 ],[
244 foo (1.2Q);
245 bar (1.2Q);
246 ],[
abccc9a9 247 libquad_cv_have_float128=yes
1ec601bf 248 ],[
abccc9a9
TB
249 libquad_cv_have_float128=no
250])])
251AM_CONDITIONAL(BUILD_LIBQUADMATH, [test "x$libquad_cv_have_float128" = xyes])
1ec601bf 252
1d92226b
JJ
253# Check for printf hook support.
254AC_MSG_CHECKING([whether printf hooks are supported])
255AC_TRY_COMPILE([
256#include <printf.h>
257#include <stdarg.h>
258#include <stdlib.h>
259extern void flt128_va (void *, va_list *);
260extern int flt128_ais (const struct printf_info *, size_t, int *, int *);
261extern int flt128_printf_fp (FILE *, const struct printf_info *, const void *const *);
262],[
263int pa_flt128 = register_printf_type (flt128_va);
264int mod_Q = register_printf_modifier (L"Q");
265int res = register_printf_specifier ('f', flt128_printf_fp, flt128_ais);
12967872 266struct printf_info info = { .user = -1 };
1d92226b
JJ
267],
268[quadmath_printf_hooks=yes],[quadmath_printf_hooks=no])
269AC_MSG_RESULT($quadmath_printf_hooks)
270if test x$quadmath_printf_hooks = xyes; then
271 AC_DEFINE([HAVE_PRINTF_HOOKS],[1],[GNU C Library stype printf hooks supported])
272fi
273
274# Check for whether locale support for quadmath_snprintf or Q printf hooks
275# should be provided.
d2995f21 276AC_MSG_CHECKING([whether nl_langinfo should be used])
1d92226b
JJ
277AC_TRY_COMPILE([#include <langinfo.h>],[
278const char *s;
279s = nl_langinfo (DECIMAL_POINT);
280s = nl_langinfo (MON_DECIMAL_POINT);
281s = nl_langinfo (GROUPING);
282s = nl_langinfo (MON_GROUPING);
283s = nl_langinfo (THOUSANDS_SEP);
284s = nl_langinfo (MON_THOUSANDS_SEP);
d2995f21
JJ
285(void) s;
286],
287[quadmath_use_nl_langinfo=yes],[quadmath_use_nl_langinfo=no])
288AC_MSG_RESULT($quadmath_use_nl_langinfo)
289if test x$quadmath_use_nl_langinfo = xyes; then
290 AC_DEFINE([USE_NL_LANGINFO],[1],[whether nl_langinfo should be used])
291fi
292
293AC_MSG_CHECKING([whether nl_langinfo should be used for wide char locale info])
294AC_TRY_COMPILE([#include <langinfo.h>],[
295const char *s;
1d92226b
JJ
296s = nl_langinfo (_NL_NUMERIC_DECIMAL_POINT_WC);
297s = nl_langinfo (_NL_MONETARY_DECIMAL_POINT_WC);
298s = nl_langinfo (_NL_NUMERIC_THOUSANDS_SEP_WC);
299s = nl_langinfo (_NL_MONETARY_THOUSANDS_SEP_WC);
1d92226b
JJ
300(void) s;
301],
d2995f21
JJ
302[quadmath_use_nl_langinfo_wc=yes],[quadmath_use_nl_langinfo_wc=no])
303AC_MSG_RESULT($quadmath_use_nl_langinfo_wc)
304if test x$quadmath_use_nl_langinfo_wc = xyes; then
305 AC_DEFINE([USE_NL_LANGINFO_WC],[1],[whether nl_langinfo should be used for wide char locale info])
306fi
307
308AC_MSG_CHECKING([whether localeconv should be used])
309AC_TRY_COMPILE([#include <locale.h>],[
310const struct lconv *l = localeconv ();
311const char *s;
312s = l->decimal_point;
313s = l->mon_decimal_point;
314s = l->grouping;
315s = l->mon_grouping;
316s = l->thousands_sep;
317s = l->mon_thousands_sep;
318(void) s;
319],
320[quadmath_use_localeconv=yes],[quadmath_use_localeconv=no])
321AC_MSG_RESULT($quadmath_use_localeconv)
322if test x$quadmath_use_localeconv = xyes; then
323 AC_DEFINE([USE_LOCALECONV],[1],[whether localeconv should be used])
1d92226b
JJ
324fi
325
326# Check for whether i18n number rewriting support for quadmath_snprintf
327# or Q printf hooks should be provided.
328AC_MSG_CHECKING([whether i18n number rewriting support for quadmath_snprintf should be added])
329AC_TRY_COMPILE([#include <langinfo.h>
330#include <limits.h>
331#include <string.h>
332#include <wchar.h>
333#include <wctype.h>],[
334const char *s;
335char decimal[MB_LEN_MAX];
336wctrans_t map = wctrans ("to_outpunct");
337wint_t wdecimal = towctrans (L'.', map);
338mbstate_t state;
339memset (&state, '\0', sizeof (state));
340wcrtomb (decimal, wdecimal, &state);
341s = nl_langinfo (_NL_CTYPE_OUTDIGIT0_MB);
342s = nl_langinfo (_NL_CTYPE_OUTDIGIT0_WC);
d2995f21 343s = nl_langinfo (_NL_CTYPE_MB_CUR_MAX);
1d92226b
JJ
344(void) s;
345],
346[quadmath_use_i18n_number_h=yes],[quadmath_use_i18n_number_h=no])
347AC_MSG_RESULT($quadmath_use_i18n_number_h)
348if test x$quadmath_use_i18n_number_h = xyes; then
349 AC_DEFINE([USE_I18N_NUMBER_H],[1],[whether i18n number rewriting can be supported])
350fi
351
fda26abe
IT
352# Add CET specific flags if CET is enabled
353GCC_CET_FLAGS(CET_FLAGS)
354XCFLAGS="$XCFLAGS $CET_FLAGS"
355AC_SUBST(XCFLAGS)
356
1ec601bf
FXC
357AC_CACHE_SAVE
358
359if test ${multilib} = yes; then
360 multilib_arg="--enable-multilib"
361else
362 multilib_arg=
363fi
364
4c993c44
TB
365
366# We would like our source tree to be readonly. However when releases or
367# pre-releases are generated, the flex/bison generated files as well as the
368# various formats of manuals need to be included along with the rest of the
369# sources. Therefore we have --enable-generated-files-in-srcdir to do
370# just that.
371AC_MSG_CHECKING(generated-files-in-srcdir)
372AC_ARG_ENABLE(generated-files-in-srcdir,
373AS_HELP_STRING([--enable-generated-files-in-srcdir],
374 [put copies of generated files in source dir intended for creating source tarballs for users without texinfo bison or flex]),
375[case "$enableval" in
376 yes) enable_generated_files_in_srcdir=yes ;;
377 no) enable_generated_files_in_srcdir=no ;;
378 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
379 esac],
380[enable_generated_files_in_srcdir=no])
381AC_MSG_RESULT($enable_generated_files_in_srcdir)
382AM_CONDITIONAL(GENINSRC, test "$enable_generated_files_in_srcdir" = yes)
383
3c36aa6b
JJ
384# Determine what GCC version number to use in filesystem paths.
385GCC_BASE_VER
4c993c44 386
1ec601bf
FXC
387AC_CONFIG_FILES(Makefile)
388AC_OUTPUT