pipe: Set errno upon failure.
[gnulib.git] / m4 / round.m4
index a887127..8860e01 100644 (file)
@@ -1,5 +1,5 @@
-# round.m4 serial 5
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+# round.m4 serial 7
+dnl Copyright (C) 2007, 2009-2010 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.
@@ -22,7 +22,7 @@ AC_DEFUN([gl_FUNC_ROUND],
       [
         save_LIBS="$LIBS"
         LIBS="$LIBS $ROUND_LIBM"
-        AC_TRY_RUN([
+        AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #include <float.h>
 #include <math.h>
 int main()
@@ -39,7 +39,7 @@ int main()
     * (double) (1U << ((DBL_MANT_DIG + 4) / 5));
   volatile double x = 0.5 - 0.5 / TWO_MANT_DIG;
   exit (x < 0.5 && round (x) != 0.0);
-}], [gl_cv_func_round_works=yes], [gl_cv_func_round_works=no],
+}]])], [gl_cv_func_round_works=yes], [gl_cv_func_round_works=no],
         [case "$host_os" in
            netbsd*) gl_cv_func_round_works="guessing no";;
            *)       gl_cv_func_round_works="guessing yes";;
@@ -56,7 +56,17 @@ int main()
     AC_LIBOBJ([round])
     gl_FUNC_FLOOR_LIBS
     gl_FUNC_CEIL_LIBS
-    ROUND_LIBM="$FLOOR_LIBM $CEIL_LIBM"
+    ROUND_LIBM=
+    dnl Append $FLOOR_LIBM to ROUND_LIBM, avoiding gratuitous duplicates.
+    case " $ROUND_LIBM " in
+      *" $FLOOR_LIBM "*) ;;
+      *) ROUND_LIBM="$ROUND_LIBM $FLOOR_LIBM" ;;
+    esac
+    dnl Append $CEIL_LIBM to ROUND_LIBM, avoiding gratuitous duplicates.
+    case " $ROUND_LIBM " in
+      *" $CEIL_LIBM "*) ;;
+      *) ROUND_LIBM="$ROUND_LIBM $CEIL_LIBM" ;;
+    esac
   fi
   AC_SUBST([ROUND_LIBM])
 ])