From: Bruno Haible Date: Mon, 29 Oct 2007 01:08:41 +0000 (+0100) Subject: Put the test whether the floor or ceil variant needs libm into a separate macro. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1fd8064a06ed3ca83f73c495e998e66c225e395b;p=pspp Put the test whether the floor or ceil variant needs libm into a separate macro. --- diff --git a/ChangeLog b/ChangeLog index 6784a45abf..3baecae5d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2007-10-28 Bruno Haible + + * 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 * gnulib-tool: Allow specifying the LGPL version number through 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 - 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 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 + 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 ]) 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 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 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 ]) 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 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 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 - 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 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 + 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 ]) 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 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 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 ]) 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 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 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" ])