summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2007-10-29 02:08:41 +0100
committerBruno Haible <bruno@clisp.org>2007-10-29 02:08:41 +0100
commit1fd8064a06ed3ca83f73c495e998e66c225e395b (patch)
tree5b51d92a72c374d79cd75fa7d8a38f77d487d2e8
parent7b104303bd1c2fd1536f918d69379308f80fdab8 (diff)
downloadgnulib-1fd8064a06ed3ca83f73c495e998e66c225e395b.tar.gz
Put the test whether the floor or ceil variant needs libm into a separate macro.
-rw-r--r--ChangeLog23
-rw-r--r--m4/ceil.m448
-rw-r--r--m4/ceilf.m440
-rw-r--r--m4/ceill.m440
-rw-r--r--m4/floor.m448
-rw-r--r--m4/floorf.m440
-rw-r--r--m4/floorl.m440
7 files changed, 181 insertions, 98 deletions
diff --git a/ChangeLog b/ChangeLog
index 6784a45abf..3baecae5d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,28 @@
2007-10-28 Bruno Haible <bruno@clisp.org>
+ * m4/floorl.m4 (gl_FUNC_FLOORL_LIBS): New macro, extracted from
+ gl_FUNC_FLOORL. Cache the result.
+ (gl_FUNC_FLOORL): Use it.
+ * m4/ceill.m4 (gl_FUNC_CEILL_LIBS): New macro, extracted from
+ gl_FUNC_CEILL. Cache the result.
+ (gl_FUNC_CEILL): Use it.
+
+ * m4/floor.m4 (gl_FUNC_FLOOR_LIBS): New macro, extracted from
+ gl_FUNC_FLOOR. Cache the result.
+ (gl_FUNC_FLOOR): Use it.
+ * m4/ceil.m4 (gl_FUNC_CEIL_LIBS): New macro, extracted from
+ gl_FUNC_CEIL. Cache the result.
+ (gl_FUNC_CEIL): Use it.
+
+ * m4/floorf.m4 (gl_FUNC_FLOORF_LIBS): New macro, extracted from
+ gl_FUNC_FLOORF. Cache the result.
+ (gl_FUNC_FLOORF): Use it.
+ * m4/ceilf.m4 (gl_FUNC_CEILF_LIBS): New macro, extracted from
+ gl_FUNC_CEILF. Cache the result.
+ (gl_FUNC_CEILF): Use it.
+
+2007-10-28 Bruno Haible <bruno@clisp.org>
+
* gnulib-tool: Allow specifying the LGPL version number through
--lgpl=2 or --lgpl=3.
(func_usage): Document --lgpl with argument.
diff --git a/m4/ceil.m4 b/m4/ceil.m4
index 9e035f17f9..9a8eb05830 100644
--- a/m4/ceil.m4
+++ b/m4/ceil.m4
@@ -1,4 +1,4 @@
-# ceil.m4 serial 1
+# ceil.m4 serial 2
dnl Copyright (C) 2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -7,18 +7,19 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_CEIL],
[
dnl Test whether ceil() can be used without libm.
- CEIL_LIBM=?
- AC_TRY_LINK([
- #ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- double x;],
- [x = ceil(x);],
- [CEIL_LIBM=])
+ gl_FUNC_CEIL_LIBS
if test "$CEIL_LIBM" = "?"; then
- save_LIBS="$LIBS"
- LIBS="$LIBS -lm"
+ CEIL_LIBM=
+ fi
+ AC_SUBST([CEIL_LIBM])
+])
+
+# Determines the libraries needed to get the ceil() function.
+# Sets CEIL_LIBM.
+AC_DEFUN([gl_FUNC_CEIL_LIBS],
+[
+ AC_CACHE_VAL([gl_func_ceil_libm], [
+ gl_func_ceil_libm=?
AC_TRY_LINK([
#ifndef __NO_MATH_INLINES
# define __NO_MATH_INLINES 1 /* for glibc */
@@ -26,11 +27,20 @@ AC_DEFUN([gl_FUNC_CEIL],
#include <math.h>
double x;],
[x = ceil(x);],
- [CEIL_LIBM="-lm"])
- LIBS="$save_LIBS"
- fi
- if test "$CEIL_LIBM" = "?"; then
- CEIL_LIBM=
- fi
- AC_SUBST([CEIL_LIBM])
+ [gl_func_ceil_libm=])
+ if test "$gl_func_ceil_libm" = "?"; then
+ save_LIBS="$LIBS"
+ LIBS="$LIBS -lm"
+ AC_TRY_LINK([
+ #ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ double x;],
+ [x = ceil(x);],
+ [gl_func_ceil_libm="-lm"])
+ LIBS="$save_LIBS"
+ fi
+ ])
+ CEIL_LIBM="$gl_func_ceil_libm"
])
diff --git a/m4/ceilf.m4 b/m4/ceilf.m4
index 65f10bedef..b409829945 100644
--- a/m4/ceilf.m4
+++ b/m4/ceilf.m4
@@ -1,4 +1,4 @@
-# ceilf.m4 serial 1
+# ceilf.m4 serial 2
dnl Copyright (C) 2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -13,7 +13,25 @@ AC_DEFUN([gl_FUNC_CEILF],
AC_CHECK_DECLS([ceilf], , , [#include <math.h>])
if test "$ac_cv_have_decl_ceilf" = yes; then
dnl Test whether ceilf() can be used without libm.
- CEILF_LIBM=?
+ gl_FUNC_CEILF_LIBS
+ if test "$CEILF_LIBM" = "?"; then
+ CEILF_LIBM=
+ fi
+ else
+ HAVE_DECL_CEILF=0
+ AC_LIBOBJ([ceilf])
+ CEILF_LIBM=
+ fi
+ AC_SUBST([HAVE_DECL_CEILF])
+ AC_SUBST([CEILF_LIBM])
+])
+
+# Determines the libraries needed to get the ceilf() function.
+# Sets CEILF_LIBM.
+AC_DEFUN([gl_FUNC_CEILF_LIBS],
+[
+ AC_CACHE_VAL([gl_func_ceilf_libm], [
+ gl_func_ceilf_libm=?
AC_TRY_LINK([
#ifndef __NO_MATH_INLINES
# define __NO_MATH_INLINES 1 /* for glibc */
@@ -21,8 +39,8 @@ AC_DEFUN([gl_FUNC_CEILF],
#include <math.h>
float x;],
[x = ceilf(x);],
- [CEILF_LIBM=])
- if test "$CEILF_LIBM" = "?"; then
+ [gl_func_ceilf_libm=])
+ if test "$gl_func_ceilf_libm" = "?"; then
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
AC_TRY_LINK([
@@ -32,17 +50,9 @@ AC_DEFUN([gl_FUNC_CEILF],
#include <math.h>
float x;],
[x = ceilf(x);],
- [CEILF_LIBM="-lm"])
+ [gl_func_ceilf_libm="-lm"])
LIBS="$save_LIBS"
fi
- if test "$CEILF_LIBM" = "?"; then
- CEILF_LIBM=
- fi
- else
- HAVE_DECL_CEILF=0
- AC_LIBOBJ([ceilf])
- CEILF_LIBM=
- fi
- AC_SUBST([HAVE_DECL_CEILF])
- AC_SUBST([CEILF_LIBM])
+ ])
+ CEILF_LIBM="$gl_func_ceilf_libm"
])
diff --git a/m4/ceill.m4 b/m4/ceill.m4
index 7413a3110c..577bc55369 100644
--- a/m4/ceill.m4
+++ b/m4/ceill.m4
@@ -1,4 +1,4 @@
-# ceill.m4 serial 1
+# ceill.m4 serial 2
dnl Copyright (C) 2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -13,7 +13,25 @@ AC_DEFUN([gl_FUNC_CEILL],
AC_CHECK_DECLS([ceill], , , [#include <math.h>])
if test "$ac_cv_have_decl_ceill" = yes; then
dnl Test whether ceill() can be used without libm.
- CEILL_LIBM=?
+ gl_FUNC_CEILL_LIBS
+ if test "$CEILL_LIBM" = "?"; then
+ CEILL_LIBM=
+ fi
+ else
+ HAVE_DECL_CEILL=0
+ AC_LIBOBJ([ceill])
+ CEILL_LIBM=
+ fi
+ AC_SUBST([HAVE_DECL_CEILL])
+ AC_SUBST([CEILL_LIBM])
+])
+
+# Determines the libraries needed to get the ceill() function.
+# Sets CEILL_LIBM.
+AC_DEFUN([gl_FUNC_CEILL_LIBS],
+[
+ AC_CACHE_VAL([gl_func_ceill_libm], [
+ gl_func_ceill_libm=?
AC_TRY_LINK([
#ifndef __NO_MATH_INLINES
# define __NO_MATH_INLINES 1 /* for glibc */
@@ -21,8 +39,8 @@ AC_DEFUN([gl_FUNC_CEILL],
#include <math.h>
long double x;],
[x = ceill(x);],
- [CEILL_LIBM=])
- if test "$CEILL_LIBM" = "?"; then
+ [gl_func_ceill_libm=])
+ if test "$gl_func_ceill_libm" = "?"; then
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
AC_TRY_LINK([
@@ -32,17 +50,9 @@ AC_DEFUN([gl_FUNC_CEILL],
#include <math.h>
long double x;],
[x = ceill(x);],
- [CEILL_LIBM="-lm"])
+ [gl_func_ceill_libm="-lm"])
LIBS="$save_LIBS"
fi
- if test "$CEILL_LIBM" = "?"; then
- CEILL_LIBM=
- fi
- else
- HAVE_DECL_CEILL=0
- AC_LIBOBJ([ceill])
- CEILL_LIBM=
- fi
- AC_SUBST([HAVE_DECL_CEILL])
- AC_SUBST([CEILL_LIBM])
+ ])
+ CEILL_LIBM="$gl_func_ceill_libm"
])
diff --git a/m4/floor.m4 b/m4/floor.m4
index dd1e6f6e25..780a88fbf1 100644
--- a/m4/floor.m4
+++ b/m4/floor.m4
@@ -1,4 +1,4 @@
-# floor.m4 serial 1
+# floor.m4 serial 2
dnl Copyright (C) 2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -7,18 +7,19 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_FLOOR],
[
dnl Test whether floor() can be used without libm.
- FLOOR_LIBM=?
- AC_TRY_LINK([
- #ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- double x;],
- [x = floor(x);],
- [FLOOR_LIBM=])
+ gl_FUNC_FLOOR_LIBS
if test "$FLOOR_LIBM" = "?"; then
- save_LIBS="$LIBS"
- LIBS="$LIBS -lm"
+ FLOOR_LIBM=
+ fi
+ AC_SUBST([FLOOR_LIBM])
+])
+
+# Determines the libraries needed to get the floor() function.
+# Sets FLOOR_LIBM.
+AC_DEFUN([gl_FUNC_FLOOR_LIBS],
+[
+ AC_CACHE_VAL([gl_func_floor_libm], [
+ gl_func_floor_libm=?
AC_TRY_LINK([
#ifndef __NO_MATH_INLINES
# define __NO_MATH_INLINES 1 /* for glibc */
@@ -26,11 +27,20 @@ AC_DEFUN([gl_FUNC_FLOOR],
#include <math.h>
double x;],
[x = floor(x);],
- [FLOOR_LIBM="-lm"])
- LIBS="$save_LIBS"
- fi
- if test "$FLOOR_LIBM" = "?"; then
- FLOOR_LIBM=
- fi
- AC_SUBST([FLOOR_LIBM])
+ [gl_func_floor_libm=])
+ if test "$gl_func_floor_libm" = "?"; then
+ save_LIBS="$LIBS"
+ LIBS="$LIBS -lm"
+ AC_TRY_LINK([
+ #ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ double x;],
+ [x = floor(x);],
+ [gl_func_floor_libm="-lm"])
+ LIBS="$save_LIBS"
+ fi
+ ])
+ FLOOR_LIBM="$gl_func_floor_libm"
])
diff --git a/m4/floorf.m4 b/m4/floorf.m4
index 184c2ee54e..3baadc03d6 100644
--- a/m4/floorf.m4
+++ b/m4/floorf.m4
@@ -1,4 +1,4 @@
-# floorf.m4 serial 1
+# floorf.m4 serial 2
dnl Copyright (C) 2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -13,7 +13,25 @@ AC_DEFUN([gl_FUNC_FLOORF],
AC_CHECK_DECLS([floorf], , , [#include <math.h>])
if test "$ac_cv_have_decl_floorf" = yes; then
dnl Test whether floorf() can be used without libm.
- FLOORF_LIBM=?
+ gl_FUNC_FLOORF_LIBS
+ if test "$FLOORF_LIBM" = "?"; then
+ FLOORF_LIBM=
+ fi
+ else
+ HAVE_DECL_FLOORF=0
+ AC_LIBOBJ([floorf])
+ FLOORF_LIBM=
+ fi
+ AC_SUBST([HAVE_DECL_FLOORF])
+ AC_SUBST([FLOORF_LIBM])
+])
+
+# Determines the libraries needed to get the floorf() function.
+# Sets FLOORF_LIBM.
+AC_DEFUN([gl_FUNC_FLOORF_LIBS],
+[
+ AC_CACHE_VAL([gl_func_floorf_libm], [
+ gl_func_floorf_libm=?
AC_TRY_LINK([
#ifndef __NO_MATH_INLINES
# define __NO_MATH_INLINES 1 /* for glibc */
@@ -21,8 +39,8 @@ AC_DEFUN([gl_FUNC_FLOORF],
#include <math.h>
float x;],
[x = floorf(x);],
- [FLOORF_LIBM=])
- if test "$FLOORF_LIBM" = "?"; then
+ [gl_func_floorf_libm=])
+ if test "$gl_func_floorf_libm" = "?"; then
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
AC_TRY_LINK([
@@ -32,17 +50,9 @@ AC_DEFUN([gl_FUNC_FLOORF],
#include <math.h>
float x;],
[x = floorf(x);],
- [FLOORF_LIBM="-lm"])
+ [gl_func_floorf_libm="-lm"])
LIBS="$save_LIBS"
fi
- if test "$FLOORF_LIBM" = "?"; then
- FLOORF_LIBM=
- fi
- else
- HAVE_DECL_FLOORF=0
- AC_LIBOBJ([floorf])
- FLOORF_LIBM=
- fi
- AC_SUBST([HAVE_DECL_FLOORF])
- AC_SUBST([FLOORF_LIBM])
+ ])
+ FLOORF_LIBM="$gl_func_floorf_libm"
])
diff --git a/m4/floorl.m4 b/m4/floorl.m4
index 0a5ecb76a2..ab54d939bd 100644
--- a/m4/floorl.m4
+++ b/m4/floorl.m4
@@ -1,4 +1,4 @@
-# floorl.m4 serial 1
+# floorl.m4 serial 2
dnl Copyright (C) 2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -13,7 +13,25 @@ AC_DEFUN([gl_FUNC_FLOORL],
AC_CHECK_DECLS([floorl], , , [#include <math.h>])
if test "$ac_cv_have_decl_floorl" = yes; then
dnl Test whether floorl() can be used without libm.
- FLOORL_LIBM=?
+ gl_FUNC_FLOORL_LIBS
+ if test "$FLOORL_LIBM" = "?"; then
+ FLOORL_LIBM=
+ fi
+ else
+ HAVE_DECL_FLOORL=0
+ AC_LIBOBJ([floorl])
+ FLOORL_LIBM=
+ fi
+ AC_SUBST([HAVE_DECL_FLOORL])
+ AC_SUBST([FLOORL_LIBM])
+])
+
+# Determines the libraries needed to get the floorl() function.
+# Sets FLOORL_LIBM.
+AC_DEFUN([gl_FUNC_FLOORL_LIBS],
+[
+ AC_CACHE_VAL([gl_func_floorl_libm], [
+ gl_func_floorl_libm=?
AC_TRY_LINK([
#ifndef __NO_MATH_INLINES
# define __NO_MATH_INLINES 1 /* for glibc */
@@ -21,8 +39,8 @@ AC_DEFUN([gl_FUNC_FLOORL],
#include <math.h>
long double x;],
[x = floorl(x);],
- [FLOORL_LIBM=])
- if test "$FLOORL_LIBM" = "?"; then
+ [gl_func_floorl_libm=])
+ if test "$gl_func_floorl_libm" = "?"; then
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
AC_TRY_LINK([
@@ -32,17 +50,9 @@ AC_DEFUN([gl_FUNC_FLOORL],
#include <math.h>
long double x;],
[x = floorl(x);],
- [FLOORL_LIBM="-lm"])
+ [gl_func_floorl_libm="-lm"])
LIBS="$save_LIBS"
fi
- if test "$FLOORL_LIBM" = "?"; then
- FLOORL_LIBM=
- fi
- else
- HAVE_DECL_FLOORL=0
- AC_LIBOBJ([floorl])
- FLOORL_LIBM=
- fi
- AC_SUBST([HAVE_DECL_FLOORL])
- AC_SUBST([FLOORL_LIBM])
+ ])
+ FLOORL_LIBM="$gl_func_floorl_libm"
])