This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] Fix ac_c99_complex configury


Paolo Carlini wrote:

>I
>propose to simply use AC_TRY_LINK, here and I'm finishing regtesting the
>below.
>  
>
Actually, what I posted is too simplistic: being all those functions
builtins, the compiler is able to optimize the calls away, and no actual
functions calls are issued, anyway, even at -O0. In order to fix that I
add '-fno-builtin -lm' to the options, which actually leads to link
failures on non-C99 systems. I'm finishing testing the below (still only
two lines + reformatting)

Paolo.

////////////
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 18:08:28.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"
+  CXXFLAGS="$CXXFLAGS -x c -lm -fno-builtin"
   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)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]