isfinite, isinf, isnan tests: Avoid syntax error on MSVC 9.
[gnulib.git] / m4 / truncl.m4
index 36dd648..e6110c3 100644 (file)
@@ -1,4 +1,4 @@
-# truncl.m4 serial 6
+# truncl.m4 serial 9
 dnl Copyright (C) 2007-2008, 2010-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -12,7 +12,7 @@ AC_DEFUN([gl_FUNC_TRUNCL],
   dnl Persuade glibc <math.h> to declare truncl().
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
   dnl Test whether truncl() is declared.
-  AC_CHECK_DECLS([truncl], , , [#include <math.h>])
+  AC_CHECK_DECLS([truncl], , , [[#include <math.h>]])
   if test "$ac_cv_have_decl_truncl" = yes; then
     dnl Test whether truncl() can be used without libm.
     TRUNCL_LIBM=?
@@ -84,10 +84,12 @@ int main()
 #include <math.h>
 ]gl_LONG_DOUBLE_MINUS_ZERO_CODE[
 ]gl_LONG_DOUBLE_SIGNBIT_CODE[
-int main()
+static long double dummy (long double f) { return 0; }
+int main (int argc, char *argv[])
 {
+  long double (*my_truncl) (long double) = argc ? truncl : dummy;
   /* Test whether truncl (-0.3L) is -0.0L.  */
-  if (signbitl (minus_zerol) && !signbitl (truncl (-0.3L)))
+  if (signbitl (minus_zerol) && !signbitl (my_truncl (-0.3L)))
     return 1;
   return 0;
 }
@@ -107,7 +109,7 @@ int main()
     HAVE_DECL_TRUNCL=0
   fi
   if test $HAVE_DECL_TRUNCL = 0 || test $REPLACE_TRUNCL = 1; then
-    AC_LIBOBJ([truncl])
+    dnl No libraries are needed to link lib/truncl.c.
     TRUNCL_LIBM=
   fi
   AC_SUBST([TRUNCL_LIBM])