changeset 2728:75019f2bb32f

(jm_MACROS): Add a test to see if -lm is required to link seq. If so, set SEQ_LIBM to -lm. From Bruno Haible.
author Jim Meyering <jim@meyering.net>
date Sun, 09 Jul 2000 17:46:11 +0000
parents 23b74176b0a0
children fe0bc5252f84
files m4/jm-macros.m4
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/m4/jm-macros.m4
+++ b/m4/jm-macros.m4
@@ -188,6 +188,22 @@
   AC_SUBST(POW_LIBM)
   test $am_cv_func_strtod_needs_libm = yes && POW_LIBM=-lm
 
+  # See if linking `seq' requires -lm.
+  # It does on nearly every system.  The single exception (so far) is
+  # BeOS which doesn't even have a separate math library.
+  AC_SUBST(SEQ_LIBM)
+  ac_seq_body='
+     static double x, y;
+     x = floor (x);
+     x = rint (x);
+     x = modf (x, &y);'
+  AC_TRY_LINK([#include <math.h>], $ac_seq_body, ,
+    [ac_seq_save_LIBS="$LIBS"
+     LIBS="$LIBS -lm"
+     AC_TRY_LINK([#include <math.h>], $ac_seq_body, SEQ_LIBM=-lm)
+     LIBS="$ac_seq_save_LIBS"
+    ])
+
   jm_LANGINFO_CODESET
   jm_GLIBC21
   jm_ICONV