relocatable-prog: Enable ELF ORIGIN trick also on GNU/kFreeBSD.
[gnulib.git] / m4 / trunc.m4
index 953f5b1..e9d5295 100644 (file)
@@ -1,5 +1,5 @@
-# trunc.m4 serial 6
-dnl Copyright (C) 2007, 2010-2011 Free Software Foundation, Inc.
+# trunc.m4 serial 8
+dnl Copyright (C) 2007, 2010-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -11,7 +11,7 @@ AC_DEFUN([gl_FUNC_TRUNC],
   dnl Persuade glibc <math.h> to declare trunc().
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
   dnl Test whether trunc() is declared.
-  AC_CHECK_DECLS([trunc], , , [#include <math.h>])
+  AC_CHECK_DECLS([trunc], , , [[#include <math.h>]])
   if test "$ac_cv_have_decl_trunc" = yes; then
     dnl Test whether trunc() can be used without libm.
     TRUNC_LIBM=?
@@ -56,10 +56,12 @@ AC_DEFUN([gl_FUNC_TRUNC],
 #include <math.h>
 ]gl_DOUBLE_MINUS_ZERO_CODE[
 ]gl_DOUBLE_SIGNBIT_CODE[
-int main()
+static double dummy (double f) { return 0; }
+int main (int argc, char *argv[])
 {
+  double (*my_trunc) (double) = argc ? trunc : dummy;
   /* Test whether trunc (-0.0) is -0.0.  */
-  if (signbitd (minus_zerod) && !signbitd (trunc (minus_zerod)))
+  if (signbitd (minus_zerod) && !signbitd (my_trunc (minus_zerod)))
     return 1;
   return 0;
 }