Mercurial > hg > octave-lyh > gnulib-hg
changeset 9419:8c764a2deb81
Put the test whether the floor or ceil variant needs libm into a separate macro.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Mon, 29 Oct 2007 02:08:41 +0100 |
parents | 5e7b33ec70ff |
children | 9e0484f26251 |
files | ChangeLog m4/ceil.m4 m4/ceilf.m4 m4/ceill.m4 m4/floor.m4 m4/floorf.m4 m4/floorl.m4 |
diffstat | 7 files changed, 213 insertions(+), 130 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +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
--- 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 @@ 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 @@ #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" ])
--- 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,28 +13,7 @@ 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=? - AC_TRY_LINK([ - #ifndef __NO_MATH_INLINES - # define __NO_MATH_INLINES 1 /* for glibc */ - #endif - #include <math.h> - float x;], - [x = ceilf(x);], - [CEILF_LIBM=]) - if test "$CEILF_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> - float x;], - [x = ceilf(x);], - [CEILF_LIBM="-lm"]) - LIBS="$save_LIBS" - fi + gl_FUNC_CEILF_LIBS if test "$CEILF_LIBM" = "?"; then CEILF_LIBM= fi @@ -46,3 +25,34 @@ 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 */ + #endif + #include <math.h> + float x;], + [x = ceilf(x);], + [gl_func_ceilf_libm=]) + if test "$gl_func_ceilf_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> + float x;], + [x = ceilf(x);], + [gl_func_ceilf_libm="-lm"]) + LIBS="$save_LIBS" + fi + ]) + CEILF_LIBM="$gl_func_ceilf_libm" +])
--- 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,28 +13,7 @@ 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=? - AC_TRY_LINK([ - #ifndef __NO_MATH_INLINES - # define __NO_MATH_INLINES 1 /* for glibc */ - #endif - #include <math.h> - long double x;], - [x = ceill(x);], - [CEILL_LIBM=]) - if test "$CEILL_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> - long double x;], - [x = ceill(x);], - [CEILL_LIBM="-lm"]) - LIBS="$save_LIBS" - fi + gl_FUNC_CEILL_LIBS if test "$CEILL_LIBM" = "?"; then CEILL_LIBM= fi @@ -46,3 +25,34 @@ 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 */ + #endif + #include <math.h> + long double x;], + [x = ceill(x);], + [gl_func_ceill_libm=]) + if test "$gl_func_ceill_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> + long double x;], + [x = ceill(x);], + [gl_func_ceill_libm="-lm"]) + LIBS="$save_LIBS" + fi + ]) + CEILL_LIBM="$gl_func_ceill_libm" +])
--- 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 @@ 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 @@ #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" ])
--- 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,28 +13,7 @@ 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=? - AC_TRY_LINK([ - #ifndef __NO_MATH_INLINES - # define __NO_MATH_INLINES 1 /* for glibc */ - #endif - #include <math.h> - float x;], - [x = floorf(x);], - [FLOORF_LIBM=]) - if test "$FLOORF_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> - float x;], - [x = floorf(x);], - [FLOORF_LIBM="-lm"]) - LIBS="$save_LIBS" - fi + gl_FUNC_FLOORF_LIBS if test "$FLOORF_LIBM" = "?"; then FLOORF_LIBM= fi @@ -46,3 +25,34 @@ 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 */ + #endif + #include <math.h> + float x;], + [x = floorf(x);], + [gl_func_floorf_libm=]) + if test "$gl_func_floorf_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> + float x;], + [x = floorf(x);], + [gl_func_floorf_libm="-lm"]) + LIBS="$save_LIBS" + fi + ]) + FLOORF_LIBM="$gl_func_floorf_libm" +])
--- 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,28 +13,7 @@ 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=? - AC_TRY_LINK([ - #ifndef __NO_MATH_INLINES - # define __NO_MATH_INLINES 1 /* for glibc */ - #endif - #include <math.h> - long double x;], - [x = floorl(x);], - [FLOORL_LIBM=]) - if test "$FLOORL_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> - long double x;], - [x = floorl(x);], - [FLOORL_LIBM="-lm"]) - LIBS="$save_LIBS" - fi + gl_FUNC_FLOORL_LIBS if test "$FLOORL_LIBM" = "?"; then FLOORL_LIBM= fi @@ -46,3 +25,34 @@ 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 */ + #endif + #include <math.h> + long double x;], + [x = floorl(x);], + [gl_func_floorl_libm=]) + if test "$gl_func_floorl_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> + long double x;], + [x = floorl(x);], + [gl_func_floorl_libm="-lm"]) + LIBS="$save_LIBS" + fi + ]) + FLOORL_LIBM="$gl_func_floorl_libm" +])