[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 'round' modules takes 3
From: |
Bruno Haible |
Subject: |
Re: 'round' modules takes 3 |
Date: |
Mon, 29 Oct 2007 04:12:44 +0100 |
User-agent: |
KMail/1.5.4 |
Hi Ben,
On 2007-10-22 you wrote:
> >> I am not sure about this. gl_FUNC_FLOORF checks for floorf and
> >> provides a substitute if it is not available. But for roundf I
> >> was planning to use the system floorf if it was available and, if
> >> not, use the roundf implementation that does not need floorf.
> >> Thus, gl_FUNC_FLOORF does more than what roundf needs.
> >
> > OK, I can provide a macro that just tests whether floorf() needs libm.
>
> OK. For now, I have invented an m4 macro AC_CHECK_MATH_LIB for
> testing whether a function or functions need -lm. It seems to
> work pretty well.
I'm not sure about this "pretty well". In the newest state, I get link
errors on Solaris 10 for the roundf and roundl modules:
cc -O -DHAVE_CONFIG_H -I. -I. -I. -I.. -I./.. -I../gllib -I./../gllib -g
-c test-roundf1.c
"test-roundf1.c", line 86: warning: division by 0
"test-roundf1.c", line 86: warning: division by 0
"test-roundf1.c", line 87: warning: division by 0
"test-roundf1.c", line 87: warning: division by 0
"test-roundf1.c", line 89: warning: division by 0
cc -O -g -o test-roundf1 test-roundf1.o ../gllib/libgnu.a missing
ild: (bad file) argument file doesn't exist :: missing
*** Error code 1
make: Fatal error: Command failed for target `test-roundf1'
cc -O -DHAVE_CONFIG_H -I. -I. -I. -I.. -I./.. -I../gllib -I./../gllib -g
-c test-roundl.c
"test-roundl.c", line 79: warning: division by 0
"test-roundl.c", line 79: warning: division by 0
"test-roundl.c", line 80: warning: division by 0
"test-roundl.c", line 80: warning: division by 0
"test-roundl.c", line 82: warning: division by 0
cc -O -g -o test-roundl test-roundl.o ../gllib/libgnu.a missing
ild: (bad file) argument file doesn't exist :: missing
*** Error code 1
make: Fatal error: Command failed for target `test-roundl'
ROUNDF_LIBM and ROUNDL_LIBM are set to the value 'missing'.
This is certainly due to Solaris problem for which I just committed a
workaround in the floorf, ceilf, floorl, ceill modules. I propose to
change the round* macros as follows, so as to
1. fix the Solaris problem with roundf, roundl,
2. use the gl_FUNC_FLOOR*_LIBS, gl_FUNC_CEIL*_LIBS macros introduced
earlier today.
And the corresponding changes to the 'math' module, of course.
Bruno
*** lib/round.c.orig 2007-10-29 04:11:46.000000000 +0100
--- lib/round.c 2007-10-29 04:07:25.000000000 +0100
***************
*** 30,36 ****
# define DOUBLE long double
# define MANT_DIG LDBL_MANT_DIG
# define L_(literal) literal##L
! # define HAVE_FLOOR_AND_CEIL (HAVE_DECL_FLOORL && HAVE_DECL_CEILL)
#elif ! defined USE_FLOAT
# define ROUND round
# define FLOOR floor
--- 30,36 ----
# define DOUBLE long double
# define MANT_DIG LDBL_MANT_DIG
# define L_(literal) literal##L
! # define HAVE_FLOOR_AND_CEIL HAVE_FLOORL_AND_CEILL
#elif ! defined USE_FLOAT
# define ROUND round
# define FLOOR floor
***************
*** 46,52 ****
# define DOUBLE float
# define MANT_DIG FLT_MANT_DIG
# define L_(literal) literal##f
! # define HAVE_FLOOR_AND_CEIL (HAVE_DECL_FLOORF && HAVE_DECL_CEILF)
#endif
/* If we're being included from test-round2[f].c, it already defined names for
--- 46,52 ----
# define DOUBLE float
# define MANT_DIG FLT_MANT_DIG
# define L_(literal) literal##f
! # define HAVE_FLOOR_AND_CEIL HAVE_FLOORF_AND_CEILF
#endif
/* If we're being included from test-round2[f].c, it already defined names for
*** m4/round.m4.orig 2007-10-29 04:11:46.000000000 +0100
--- m4/round.m4 2007-10-29 03:34:10.000000000 +0100
***************
*** 1,4 ****
! # round.m4 serial 3
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,
--- 1,4 ----
! # round.m4 serial 4
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,
***************
*** 14,22 ****
gl_CHECK_MATH_LIB([ROUND_LIBM], [x = round (x);])
fi
if test "$ac_cv_have_decl_round" != yes || test "$ROUND_LIBM" = missing;
then
! gl_CHECK_MATH_LIB([ROUND_LIBM], [x = floor (x) + ceil (x);])
! HAVE_DECL_ROUND=0
AC_LIBOBJ([round])
fi
! AC_SUBST([HAVE_DECL_ROUND])
AC_SUBST([ROUND_LIBM])])
--- 14,24 ----
gl_CHECK_MATH_LIB([ROUND_LIBM], [x = round (x);])
fi
if test "$ac_cv_have_decl_round" != yes || test "$ROUND_LIBM" = missing;
then
! REPLACE_ROUND=1
AC_LIBOBJ([round])
+ gl_FUNC_FLOOR_LIBS
+ gl_FUNC_CEIL_LIBS
+ ROUND_LIBM="$FLOOR_LIBM $CEIL_LIBM"
fi
! AC_SUBST([REPLACE_ROUND])
AC_SUBST([ROUND_LIBM])])
*** m4/roundf.m4.orig 2007-10-29 04:11:46.000000000 +0100
--- m4/roundf.m4 2007-10-29 04:06:07.000000000 +0100
***************
*** 1,4 ****
! # roundf.m4 serial 3
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,
--- 1,4 ----
! # roundf.m4 serial 4
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,
***************
*** 14,29 ****
gl_CHECK_MATH_LIB([ROUNDF_LIBM], [x = roundf (x);])
fi
if test "$ac_cv_have_decl_roundf" != yes || test "$ROUNDF_LIBM" = missing;
then
AC_CHECK_DECLS([ceilf, floorf], , , [#include <math.h>])
if test "$ac_cv_have_decl_floorf" = yes &&
test "$ac_cv_have_decl_ceilf" = yes; then
! gl_CHECK_MATH_LIB([ROUNDF_LIBM], [x = floorf (x) + ceilf (x);])
! else
! ROUNDF_LIBM=
fi
- HAVE_DECL_ROUNDF=0
- AC_LIBOBJ([roundf])
fi
! AC_SUBST([HAVE_DECL_ROUNDF])
AC_SUBST([ROUNDF_LIBM])
])
--- 14,34 ----
gl_CHECK_MATH_LIB([ROUNDF_LIBM], [x = roundf (x);])
fi
if test "$ac_cv_have_decl_roundf" != yes || test "$ROUNDF_LIBM" = missing;
then
+ REPLACE_ROUNDF=1
+ AC_LIBOBJ([roundf])
+ ROUNDF_LIBM=
AC_CHECK_DECLS([ceilf, floorf], , , [#include <math.h>])
if test "$ac_cv_have_decl_floorf" = yes &&
test "$ac_cv_have_decl_ceilf" = yes; then
! gl_FUNC_FLOORF_LIBS
! gl_FUNC_CEILF_LIBS
! if test "$FLOORF_LIBM" != '?' && test "$CEILF_LIBM" != '?'; then
! AC_DEFINE([HAVE_FLOORF_AND_CEILF], 1,
! [Define if the both the floorf() and ceilf() functions exist.])
! ROUNDF_LIBM="$FLOORF_LIBM $CEILF_LIBM"
! fi
fi
fi
! AC_SUBST([REPLACE_ROUNDF])
AC_SUBST([ROUNDF_LIBM])
])
*** m4/roundl.m4.orig 2007-10-29 04:11:46.000000000 +0100
--- m4/roundl.m4 2007-10-29 04:06:57.000000000 +0100
***************
*** 1,4 ****
! # roundl.m4 serial 3
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,
--- 1,4 ----
! # roundl.m4 serial 4
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,
***************
*** 14,29 ****
gl_CHECK_MATH_LIB([ROUNDL_LIBM], [x = roundl (x);])
fi
if test "$ac_cv_have_decl_roundl" != yes || test "$ROUNDL_LIBM" = missing;
then
AC_CHECK_DECLS([ceill, floorl], , , [#include <math.h>])
if test "$ac_cv_have_decl_floorl" = yes &&
test "$ac_cv_have_decl_ceill" = yes; then
! gl_CHECK_MATH_LIB([ROUNDL_LIBM], [x = floorl (x) + ceill (x);])
! else
! ROUNDL_LIBM=
fi
- HAVE_DECL_ROUNDL=0
- AC_LIBOBJ([roundl])
fi
! AC_SUBST([HAVE_DECL_ROUNDL])
AC_SUBST([ROUNDL_LIBM])
])
--- 14,34 ----
gl_CHECK_MATH_LIB([ROUNDL_LIBM], [x = roundl (x);])
fi
if test "$ac_cv_have_decl_roundl" != yes || test "$ROUNDL_LIBM" = missing;
then
+ REPLACE_ROUNDL=1
+ AC_LIBOBJ([roundl])
+ ROUNDL_LIBM=
AC_CHECK_DECLS([ceill, floorl], , , [#include <math.h>])
if test "$ac_cv_have_decl_floorl" = yes &&
test "$ac_cv_have_decl_ceill" = yes; then
! gl_FUNC_FLOORL_LIBS
! gl_FUNC_CEILL_LIBS
! if test "$FLOORL_LIBM" != '?' && test "$CEILL_LIBM" != '?'; then
! AC_DEFINE([HAVE_FLOORL_AND_CEILL], 1,
! [Define if the both the floorl() and ceill() functions exist.])
! ROUNDL_LIBM="$FLOORL_LIBM $CEILL_LIBM"
! fi
fi
fi
! AC_SUBST([REPLACE_ROUNDL])
AC_SUBST([ROUNDL_LIBM])
])
- Re: modules 'round', 'roundf', 'roundl' for review, (continued)
- Re: modules 'round', 'roundf', 'roundl' for review, Ben Pfaff, 2007/10/07
- Re: modules 'round', 'roundf', 'roundl' for review, Bruno Haible, 2007/10/12
- 'round' modules takes 3 (was: Re: modules 'round', 'roundf', 'roundl' for review), Ben Pfaff, 2007/10/19
- Re: 'round' modules takes 3 (was: Re: modules 'round', 'roundf', 'roundl' for review), Bruno Haible, 2007/10/20
- Re: 'round' modules takes 3, Ben Pfaff, 2007/10/20
- Re: 'round' modules takes 3, Bruno Haible, 2007/10/21
- Re: 'round' modules takes 3, Bruno Haible, 2007/10/21
- Re: 'round' modules takes 3, Ben Pfaff, 2007/10/21
- Re: 'round' modules takes 3, Ben Pfaff, 2007/10/21
- Re: 'round' modules takes 3, Bruno Haible, 2007/10/23
- Re: 'round' modules takes 3,
Bruno Haible <=
- Re: 'round' modules takes 3, Ben Pfaff, 2007/10/28
- Re: 'round' modules takes 3, Bruno Haible, 2007/10/28
- Re: 'round' modules takes 3, Ralf Wildenhues, 2007/10/29
- Re: 'round' modules takes 3, Bruno Haible, 2007/10/29
Re: modules 'round', 'roundf', 'roundl' for review, Bruno Haible, 2007/10/07