OSDN Git Service

/cp
[pf3gnuchains/gcc-fork.git] / libquadmath / configure.ac
index 9a0f464..512b9f8 100644 (file)
@@ -112,7 +112,7 @@ esac
 AC_SUBST(toolexecdir)
 AC_SUBST(toolexeclibdir)
 
-AC_CHECK_HEADERS(fenv.h langinfo.h wchar.h wctype.h limits.h ctype.h printf.h errno.h)
+AC_CHECK_HEADERS(fenv.h langinfo.h locale.h wchar.h wctype.h limits.h ctype.h printf.h errno.h)
 
 # If available, sqrtl and cbrtl speed up the calculation -
 # but they are not required
@@ -124,6 +124,7 @@ if test x$gcc_no_link != xyes; then
   AC_CHECK_LIB([m],[feupdateenv],[AC_DEFINE([HAVE_FEUPDATEENV],[1],[libm includes feupdateenv])])
   AC_CHECK_LIB([m],[fesetenv],[AC_DEFINE([HAVE_FESETENV],[1],[libm includes fesetenv])])
   AC_CHECK_LIB([m],[fetestexcept],[AC_DEFINE([HAVE_FETESTEXCEPT],[1],[libm includes fetestexcept])])
+  AC_CHECK_FUNCS(strtoull)
 else
   if test "x$ac_cv_lib_m_sqrtl" = x""yes; then
     AC_DEFINE([HAVE_SQRTL],[1],[libm includes sqrtl])  
@@ -163,35 +164,42 @@ CFLAGS="$saved_CFLAGS"
 
 # Check for symbol versioning (copied from libssp).
 AC_MSG_CHECKING([whether symbol versioning is supported])
-if test x$gcc_no_link = xyes; then
-  # If we cannot link, we cannot build shared libraries, so do not use
-  # symbol versioning.
-  quadmath_use_symver=no
-else
-  save_LDFLAGS="$LDFLAGS"
-  LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map"
-  cat > conftest.map <<EOF
+AC_ARG_ENABLE(symvers,
+AS_HELP_STRING([--disable-symvers],
+  [disable symbol versioning for libquadmath]),
+quadmath_use_symver=$enableval,
+quadmath_use_symver=yes)
+if test "x$quadmath_use_symver" = xyes; then
+  if test x$gcc_no_link = xyes; then
+    # If we cannot link, we cannot build shared libraries, so do not use
+    # symbol versioning.
+    quadmath_use_symver=no
+  else
+    save_LDFLAGS="$LDFLAGS"
+    LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map"
+    cat > conftest.map <<EOF
 FOO_1.0 {
   global: *foo*; bar; local: *;
 };
 EOF
-  AC_TRY_LINK([int foo;],[],[quadmath_use_symver=gnu],[quadmath_use_symver=no])
-  if test x$quadmath_use_symver = xno; then
-    case "$target_os" in
-      solaris2*)
-        LDFLAGS="$save_LDFLAGS"
-        LDFLAGS="$LDFLAGS -fPIC -shared -Wl,-M,./conftest.map"
-        # Sun ld cannot handle wildcards and treats all entries as undefined.
-        cat > conftest.map <<EOF
+    AC_TRY_LINK([int foo;],[],[quadmath_use_symver=gnu],[quadmath_use_symver=no])
+    if test x$quadmath_use_symver = xno; then
+      case "$target_os" in
+        solaris2*)
+          LDFLAGS="$save_LDFLAGS"
+          LDFLAGS="$LDFLAGS -fPIC -shared -Wl,-M,./conftest.map"
+          # Sun ld cannot handle wildcards and treats all entries as undefined.
+          cat > conftest.map <<EOF
 FOO_1.0 {
   global: foo; local: *;
 };
 EOF
-        AC_TRY_LINK([int foo;],[],[quadmath_use_symver=sun],[quadmath_use_symver=no])
-        ;;
-    esac
+          AC_TRY_LINK([int foo;],[],[quadmath_use_symver=sun],[quadmath_use_symver=no])
+          ;;
+      esac
+    fi
+    LDFLAGS="$save_LDFLAGS"
   fi
-  LDFLAGS="$save_LDFLAGS"
 fi
 AC_MSG_RESULT($quadmath_use_symver)
 AM_CONDITIONAL(LIBQUAD_USE_SYMVER, [test "x$quadmath_use_symver" != xno])
@@ -241,6 +249,7 @@ extern int flt128_printf_fp (FILE *, const struct printf_info *, const void *con
 int pa_flt128 = register_printf_type (flt128_va);
 int mod_Q = register_printf_modifier (L"Q");
 int res = register_printf_specifier ('f', flt128_printf_fp, flt128_ais);
+struct printf_info info = { .user = -1 };
 ],
 [quadmath_printf_hooks=yes],[quadmath_printf_hooks=no])
 AC_MSG_RESULT($quadmath_printf_hooks)
@@ -250,7 +259,7 @@ fi
 
 # Check for whether locale support for quadmath_snprintf or Q printf hooks
 # should be provided.
-AC_MSG_CHECKING([whether locale support for quadmath_snprintf should be added])
+AC_MSG_CHECKING([whether nl_langinfo should be used])
 AC_TRY_COMPILE([#include <langinfo.h>],[
 const char *s;
 s = nl_langinfo (DECIMAL_POINT);
@@ -259,17 +268,45 @@ s = nl_langinfo (GROUPING);
 s = nl_langinfo (MON_GROUPING);
 s = nl_langinfo (THOUSANDS_SEP);
 s = nl_langinfo (MON_THOUSANDS_SEP);
+(void) s;
+],
+[quadmath_use_nl_langinfo=yes],[quadmath_use_nl_langinfo=no])
+AC_MSG_RESULT($quadmath_use_nl_langinfo)
+if test x$quadmath_use_nl_langinfo = xyes; then
+  AC_DEFINE([USE_NL_LANGINFO],[1],[whether nl_langinfo should be used])
+fi
+
+AC_MSG_CHECKING([whether nl_langinfo should be used for wide char locale info])
+AC_TRY_COMPILE([#include <langinfo.h>],[
+const char *s;
 s = nl_langinfo (_NL_NUMERIC_DECIMAL_POINT_WC);
 s = nl_langinfo (_NL_MONETARY_DECIMAL_POINT_WC);
 s = nl_langinfo (_NL_NUMERIC_THOUSANDS_SEP_WC);
 s = nl_langinfo (_NL_MONETARY_THOUSANDS_SEP_WC);
-s = nl_langinfo (_NL_CTYPE_MB_CUR_MAX);
 (void) s;
 ],
-[quadmath_use_locale_support=yes],[quadmath_use_locale_support=no])
-AC_MSG_RESULT($quadmath_use_locale_support)
-if test x$quadmath_use_locale_support = xyes; then
-  AC_DEFINE([USE_LOCALE_SUPPORT],[1],[whether nl_langinfo is sufficiently supported])
+[quadmath_use_nl_langinfo_wc=yes],[quadmath_use_nl_langinfo_wc=no])
+AC_MSG_RESULT($quadmath_use_nl_langinfo_wc)
+if test x$quadmath_use_nl_langinfo_wc = xyes; then
+  AC_DEFINE([USE_NL_LANGINFO_WC],[1],[whether nl_langinfo should be used for wide char locale info])
+fi
+
+AC_MSG_CHECKING([whether localeconv should be used])
+AC_TRY_COMPILE([#include <locale.h>],[
+const struct lconv *l = localeconv ();
+const char *s;
+s = l->decimal_point;
+s = l->mon_decimal_point;
+s = l->grouping;
+s = l->mon_grouping;
+s = l->thousands_sep;
+s = l->mon_thousands_sep;
+(void) s;
+],
+[quadmath_use_localeconv=yes],[quadmath_use_localeconv=no])
+AC_MSG_RESULT($quadmath_use_localeconv)
+if test x$quadmath_use_localeconv = xyes; then
+  AC_DEFINE([USE_LOCALECONV],[1],[whether localeconv should be used])
 fi
 
 # Check for whether i18n number rewriting support for quadmath_snprintf
@@ -289,6 +326,7 @@ memset (&state, '\0', sizeof (state));
 wcrtomb (decimal, wdecimal, &state);
 s = nl_langinfo (_NL_CTYPE_OUTDIGIT0_MB);
 s = nl_langinfo (_NL_CTYPE_OUTDIGIT0_WC);
+s = nl_langinfo (_NL_CTYPE_MB_CUR_MAX);
 (void) s;
 ],
 [quadmath_use_i18n_number_h=yes],[quadmath_use_i18n_number_h=no])