Commit b3226574 by Richard Sandiford Committed by Kazu Hirata

no-executables.m4 (GCC_TRY_COMPILE_OR_LINK): New function.

config/
	* no-executables.m4 (GCC_TRY_COMPILE_OR_LINK): New function.

libstdc++/
	* acinclude.m4 (GLIBCXX_ENABLE_C99): Temporarily add
	-fno-exceptions to CXXFLAGS.  Use GCC_TRY_COMPILE_OR_LINK.
	Make the tests assign results to volatile variables.
	* configure: Regenerate.

From-SVN: r128959
parent 506f93ba
2007-10-02 Richard Sandiford <richard@codesourcery.com>
* no-executables.m4 (GCC_TRY_COMPILE_OR_LINK): New function.
2007-09-21 Richard Sandiford <rsandifo@nildram.co.uk> 2007-09-21 Richard Sandiford <rsandifo@nildram.co.uk>
* mt-sde (CFLAGS_FOR_TARGET): Replace -fno-optimize-sibling-calls * mt-sde (CFLAGS_FOR_TARGET): Replace -fno-optimize-sibling-calls
......
...@@ -59,3 +59,11 @@ fi) ...@@ -59,3 +59,11 @@ fi)
m4_divert_pop()dnl m4_divert_pop()dnl
])# GCC_NO_EXECUTABLES ])# GCC_NO_EXECUTABLES
# Use the strongest available test out of AC_TRY_COMPILE and AC_TRY_LINK.
AC_DEFUN([GCC_TRY_COMPILE_OR_LINK],
[if test x$gcc_no_link = xyes; then
AC_TRY_COMPILE([$1], [$2], [$3], [$4])
else
AC_TRY_LINK([$1], [$2], [$3], [$4])
fi])
2007-10-02 Richard Sandiford <richard@codesourcery.com>
* acinclude.m4 (GLIBCXX_ENABLE_C99): Temporarily add
-fno-exceptions to CXXFLAGS. Use GCC_TRY_COMPILE_OR_LINK.
Make the tests assign results to volatile variables.
* configure: Regenerate.
2007-10-02 Benjamin Kosnik <bkoz@redhat.com> 2007-10-02 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/25_algorithms/binary_search/2.cc: Split into... * testsuite/25_algorithms/binary_search/2.cc: Split into...
......
...@@ -763,23 +763,31 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [ ...@@ -763,23 +763,31 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [
AC_LANG_SAVE AC_LANG_SAVE
AC_LANG_CPLUSPLUS AC_LANG_CPLUSPLUS
# Use -fno-exceptions so that the C driver can link these tests without
# hitting undefined references to personality routines.
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -fno-exceptions"
# Check for the existence of <math.h> functions used if C99 is enabled. # Check for the existence of <math.h> functions used if C99 is enabled.
AC_MSG_CHECKING([for ISO C99 support in <math.h>]) AC_MSG_CHECKING([for ISO C99 support in <math.h>])
AC_CACHE_VAL(ac_c99_math, [ AC_CACHE_VAL(ac_c99_math, [
AC_TRY_COMPILE([#include <math.h>], GCC_TRY_COMPILE_OR_LINK(
[fpclassify(0.0); [#include <math.h>
isfinite(0.0); volatile double d1, d2;
isinf(0.0); volatile int i;],
isnan(0.0); [i = fpclassify(d1);
isnormal(0.0); i = isfinite(d1);
signbit(0.0); i = isinf(d1);
isgreater(0.0,0.0); i = isnan(d1);
isgreaterequal(0.0,0.0); i = isnormal(d1);
isless(0.0,0.0); i = signbit(d1);
islessequal(0.0,0.0); i = isgreater(d1, d2);
islessgreater(0.0,0.0); i = isgreaterequal(d1, d2);
islessgreater(0.0,0.0); i = isless(d1, d2);
isunordered(0.0,0.0); i = islessequal(d1, d2);
i = islessgreater(d1, d2);
i = islessgreater(d1, d2);
i = isunordered(d1, d2);
],[ac_c99_math=yes], [ac_c99_math=no]) ],[ac_c99_math=yes], [ac_c99_math=no])
]) ])
AC_MSG_RESULT($ac_c99_math) AC_MSG_RESULT($ac_c99_math)
...@@ -798,46 +806,53 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [ ...@@ -798,46 +806,53 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [
ac_c99_complex=no; ac_c99_complex=no;
if test x"$ac_has_complex_h" = x"yes"; then if test x"$ac_has_complex_h" = x"yes"; then
AC_MSG_CHECKING([for ISO C99 support in <complex.h>]) AC_MSG_CHECKING([for ISO C99 support in <complex.h>])
AC_TRY_COMPILE([#include <complex.h>], GCC_TRY_COMPILE_OR_LINK(
[typedef __complex__ float float_type; float_type tmpf; [#include <complex.h>
cabsf(tmpf); typedef __complex__ float float_type;
cargf(tmpf); typedef __complex__ double double_type;
ccosf(tmpf); typedef __complex__ long double ld_type;
ccoshf(tmpf); volatile float_type tmpf;
cexpf(tmpf); volatile double_type tmpd;
clogf(tmpf); volatile ld_type tmpld;
csinf(tmpf); volatile float f;
csinhf(tmpf); volatile double d;
csqrtf(tmpf); volatile long double ld;],
ctanf(tmpf); [f = cabsf(tmpf);
ctanhf(tmpf); f = cargf(tmpf);
cpowf(tmpf, tmpf); tmpf = ccosf(tmpf);
typedef __complex__ double double_type; double_type tmpd; tmpf = ccoshf(tmpf);
cabs(tmpd); tmpf = cexpf(tmpf);
carg(tmpd); tmpf = clogf(tmpf);
ccos(tmpd); tmpf = csinf(tmpf);
ccosh(tmpd); tmpf = csinhf(tmpf);
cexp(tmpd); tmpf = csqrtf(tmpf);
clog(tmpd); tmpf = ctanf(tmpf);
csin(tmpd); tmpf = ctanhf(tmpf);
csinh(tmpd); tmpf = cpowf(tmpf, tmpf);
csqrt(tmpd); d = cabs(tmpd);
ctan(tmpd); d = carg(tmpd);
ctanh(tmpd); tmpd = ccos(tmpd);
cpow(tmpd, tmpd); tmpd = ccosh(tmpd);
typedef __complex__ long double ld_type; ld_type tmpld; tmpd = cexp(tmpd);
cabsl(tmpld); tmpd = clog(tmpd);
cargl(tmpld); tmpd = csin(tmpd);
ccosl(tmpld); tmpd = csinh(tmpd);
ccoshl(tmpld); tmpd = csqrt(tmpd);
cexpl(tmpld); tmpd = ctan(tmpd);
clogl(tmpld); tmpd = ctanh(tmpd);
csinl(tmpld); tmpd = cpow(tmpd, tmpd);
csinhl(tmpld); ld = cabsl(tmpld);
csqrtl(tmpld); ld = cargl(tmpld);
ctanl(tmpld); tmpld = ccosl(tmpld);
ctanhl(tmpld); tmpld = ccoshl(tmpld);
cpowl(tmpld, tmpld); tmpld = cexpl(tmpld);
tmpld = clogl(tmpld);
tmpld = csinl(tmpld);
tmpld = csinhl(tmpld);
tmpld = csqrtl(tmpld);
tmpld = ctanl(tmpld);
tmpld = ctanhl(tmpld);
tmpld = cpowl(tmpld, tmpld);
],[ac_c99_complex=yes], [ac_c99_complex=no]) ],[ac_c99_complex=yes], [ac_c99_complex=no])
fi fi
AC_MSG_RESULT($ac_c99_complex) AC_MSG_RESULT($ac_c99_complex)
...@@ -851,7 +866,8 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [ ...@@ -851,7 +866,8 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [
# Check for the existence in <stdio.h> of vscanf, et. al. # Check for the existence in <stdio.h> of vscanf, et. al.
AC_MSG_CHECKING([for ISO C99 support in <stdio.h>]) AC_MSG_CHECKING([for ISO C99 support in <stdio.h>])
AC_CACHE_VAL(ac_c99_stdio, [ AC_CACHE_VAL(ac_c99_stdio, [
AC_TRY_COMPILE([#include <stdio.h> GCC_TRY_COMPILE_OR_LINK(
[#include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
void foo(char* fmt, ...) void foo(char* fmt, ...)
{ {
...@@ -869,17 +885,24 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [ ...@@ -869,17 +885,24 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [
# Check for the existence in <stdlib.h> of lldiv_t, et. al. # Check for the existence in <stdlib.h> of lldiv_t, et. al.
AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>]) AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>])
AC_CACHE_VAL(ac_c99_stdlib, [ AC_CACHE_VAL(ac_c99_stdlib, [
AC_TRY_COMPILE([#include <stdlib.h>], GCC_TRY_COMPILE_OR_LINK(
[#include <stdlib.h>
volatile float f;
volatile long double ld;
volatile unsigned long long ll;
lldiv_t mydivt;],
[char* tmp; [char* tmp;
strtof("gnu", &tmp); f = strtof("gnu", &tmp);
strtold("gnu", &tmp); ld = strtold("gnu", &tmp);
strtoll("gnu", &tmp, 10); ll = strtoll("gnu", &tmp, 10);
strtoull("gnu", &tmp, 10); ll = strtoull("gnu", &tmp, 10);
llabs(10); ll = llabs(10);
lldiv(10,1); mydivt = lldiv(10,1);
atoll("10"); ll = mydivt.quot;
ll = mydivt.rem;
ll = atoll("10");
_Exit(0); _Exit(0);
lldiv_t mydivt;],[ac_c99_stdlib=yes], [ac_c99_stdlib=no]) ],[ac_c99_stdlib=yes], [ac_c99_stdlib=no])
]) ])
AC_MSG_RESULT($ac_c99_stdlib) AC_MSG_RESULT($ac_c99_stdlib)
...@@ -940,6 +963,7 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [ ...@@ -940,6 +963,7 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [
<complex.h>, <stdio.h>, and <stdlib.h> can be used or exposed.]) <complex.h>, <stdio.h>, and <stdlib.h> can be used or exposed.])
fi fi
CXXFLAGS="$ac_save_CXXFLAGS"
AC_LANG_RESTORE AC_LANG_RESTORE
fi fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment