This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[Patch] Fix ac_c99_complex configury
- From: Paolo Carlini <pcarlini at suse dot de>
- To: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Mon, 06 Jun 2005 17:37:22 +0200
- Subject: [Patch] Fix ac_c99_complex configury
Hi,
the use of the new __builtin_clog exposed a serious weakness in our
configury: the check for ac_c99_complex (and then for
_GLIBCXX_USE_C99_COMPLEX), uses the C compiler together with
AC_TRY_COMPILE: we are basically checking for prototypes but C (vs C++)
doesn't care and this means that the test basically *always* passes. I
propose to simply use AC_TRY_LINK, here and I'm finishing regtesting the
below.
(the problem is not present in 4_0-branch, AFAICS)
Paolo.
/////////////
2005-06-06 Paolo Carlini <pcarlini@suse.de>
* acinclude.m4 ([GLIBCXX_ENABLE_C99]): Together with the C
compiler, for ac_c99_complex, use AC_TRY_LINK.
* configure: Regenerate.
diff -urN libstdc++-v3-orig/acinclude.m4 libstdc++-v3/acinclude.m4
--- libstdc++-v3-orig/acinclude.m4 2005-06-05 23:58:52.000000000 +0200
+++ libstdc++-v3/acinclude.m4 2005-06-06 17:17:26.000000000 +0200
@@ -802,54 +802,55 @@
# of these functions, because if the builtin cannot be used, a reference
# to the library function is emitted.
# In addition, need to explicitly specify "C" compilation for this
- # one, or else the backwards C++ <complex.h> include will be selected.
+ # one, or else the backwards C++ <complex.h> include will be selected,
+ # which implies, in turn, that AC_TRY_LINK is necessary.
save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -x c"
AC_CHECK_HEADERS(complex.h, ac_has_complex_h=yes, ac_has_complex_h=no)
ac_c99_complex=no;
if test x"$ac_has_complex_h" = x"yes"; then
AC_MSG_CHECKING([for ISO C99 support in <complex.h>])
- AC_TRY_COMPILE([#include <complex.h>],
- [typedef __complex__ float float_type; float_type tmpf;
- cabsf(tmpf);
- cargf(tmpf);
- ccosf(tmpf);
- ccoshf(tmpf);
- cexpf(tmpf);
- clogf(tmpf);
- csinf(tmpf);
- csinhf(tmpf);
- csqrtf(tmpf);
- ctanf(tmpf);
- ctanhf(tmpf);
- cpowf(tmpf, tmpf);
- typedef __complex__ double double_type; double_type tmpd;
- cabs(tmpd);
- carg(tmpd);
- ccos(tmpd);
- ccosh(tmpd);
- cexp(tmpd);
- clog(tmpd);
- csin(tmpd);
- csinh(tmpd);
- csqrt(tmpd);
- ctan(tmpd);
- ctanh(tmpd);
- cpow(tmpd, tmpd);
- typedef __complex__ long double ld_type; ld_type tmpld;
- cabsl(tmpld);
- cargl(tmpld);
- ccosl(tmpld);
- ccoshl(tmpld);
- cexpl(tmpld);
- clogl(tmpld);
- csinl(tmpld);
- csinhl(tmpld);
- csqrtl(tmpld);
- ctanl(tmpld);
- ctanhl(tmpld);
- cpowl(tmpld, tmpld);
- ],[ac_c99_complex=yes], [ac_c99_complex=no])
+ AC_TRY_LINK([#include <complex.h>],
+ [typedef __complex__ float float_type; float_type tmpf;
+ cabsf(tmpf);
+ cargf(tmpf);
+ ccosf(tmpf);
+ ccoshf(tmpf);
+ cexpf(tmpf);
+ clogf(tmpf);
+ csinf(tmpf);
+ csinhf(tmpf);
+ csqrtf(tmpf);
+ ctanf(tmpf);
+ ctanhf(tmpf);
+ cpowf(tmpf, tmpf);
+ typedef __complex__ double double_type; double_type tmpd;
+ cabs(tmpd);
+ carg(tmpd);
+ ccos(tmpd);
+ ccosh(tmpd);
+ cexp(tmpd);
+ clog(tmpd);
+ csin(tmpd);
+ csinh(tmpd);
+ csqrt(tmpd);
+ ctan(tmpd);
+ ctanh(tmpd);
+ cpow(tmpd, tmpd);
+ typedef __complex__ long double ld_type; ld_type tmpld;
+ cabsl(tmpld);
+ cargl(tmpld);
+ ccosl(tmpld);
+ ccoshl(tmpld);
+ cexpl(tmpld);
+ clogl(tmpld);
+ csinl(tmpld);
+ csinhl(tmpld);
+ csqrtl(tmpld);
+ ctanl(tmpld);
+ ctanhl(tmpld);
+ cpowl(tmpld, tmpld);
+ ],[ac_c99_complex=yes], [ac_c99_complex=no])
fi
CXXFLAGS="$save_CXXFLAGS"
AC_MSG_RESULT($ac_c99_complex)