From: Akim Demaille Date: Tue, 1 Aug 2000 11:16:33 +0000 (+0000) Subject: * acfunctions.m4 (_AC_LIBOBJ_STRTOD, AC_FUNC_STRTOD, X-Git-Tag: autoconf-2.50~679 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7bd04c77a0414432f751ed7e826d3f83ab0fffca;p=thirdparty%2Fautoconf.git * acfunctions.m4 (_AC_LIBOBJ_STRTOD, AC_FUNC_STRTOD, AM_FUNC_STRTOD): New macros, from Automake. * acfunctions: Adjust. --- diff --git a/ChangeLog b/ChangeLog index cb7ee3a43..4b066061d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2000-08-01 Akim Demaille + + * acfunctions.m4 (_AC_LIBOBJ_STRTOD, AC_FUNC_STRTOD, + AM_FUNC_STRTOD): New macros, from Automake. + * acfunctions: Adjust. + 2000-08-01 Akim Demaille * acidentifiers: Catch ptrdiff_t. diff --git a/NEWS b/NEWS index 752fb2a6f..7cb81353f 100644 --- a/NEWS +++ b/NEWS @@ -190,7 +190,7 @@ test cases in this new frame work. ** Specific Macros - AC_FUNC_CHOWN, AC_FUNC_MALLOC, AC_FUNC_STRERROR_R, AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK, AC_FUNC_STAT, AC_FUNC_LSTAT, - AC_FUNC_ERROR_AT_LINE, AC_FUNC_OBSTACK. + AC_FUNC_ERROR_AT_LINE, AC_FUNC_OBSTACK, AC_FUNC_STRTOD. New. - AC_FUNC_GETGROUPS diff --git a/TODO b/TODO index aed34c0a3..2af535ee1 100644 --- a/TODO +++ b/TODO @@ -97,6 +97,8 @@ this. Most should be removed. ** AC_EXEXT, AC_OBJEXT Support should be enabled by default. +** Macros now swallowed by Autoconf. +error.m4, obstack.m4, ptrdiff.m4, strtod.m4, termios.m4, winsz.m4. ------------------------------------------------------------------------------ diff --git a/acfunctions b/acfunctions index 795f1b42e..d5d512527 100644 --- a/acfunctions +++ b/acfunctions @@ -33,6 +33,7 @@ stat AC_FUNC_STAT strcoll AC_FUNC_STRCOLL strerror_r AC_FUNC_STRERROR_R strftime AC_FUNC_STRFTIME +strtod AC_FUNC_STRTOD utime AC_FUNC_UTIME_NULL vfork AC_FUNC_VFORK vfprintf AC_FUNC_VPRINTF diff --git a/acfunctions.m4 b/acfunctions.m4 index fe8e77629..7b7b93299 100644 --- a/acfunctions.m4 +++ b/acfunctions.m4 @@ -1201,6 +1201,64 @@ AC_DEFUN([AC_FUNC_STAT], [_AC_FUNC_STAT(stat)]) AC_DEFUN([AC_FUNC_LSTAT], [_AC_FUNC_STAT(lstat)]) +# _AC_LIBOBJ_STRTOD +# ----------------- +define([_AC_LIBOBJ_STRTOD], +[AC_LIBOBJ(strtod) +AC_CHECK_FUNC(pow) +if test $ac_cv_func_pow = no; then + AC_CHECK_LIB(m, pow, + [POW_LIB=-lm], + [AC_MSG_WARN(can't find library containing definition of pow)]) +fi +])# _AC_LIBOBJ_STRTOD + + +# AC_FUNC_STRTOD +# -------------- +AC_DEFUN([AC_FUNC_STRTOD], +[AC_CACHE_CHECK(for working strtod, ac_cv_func_strtod, +[AC_TRY_RUN([ +double strtod (); +int +main() +{ + { + /* Some versions of Linux strtod mis-parse strings with leading '+'. */ + char *string = " +69"; + char *term; + double value; + value = strtod (string, &term); + if (value != 69 || term != (string + 4)) + exit (1); + } + + { + /* Under Solaris 2.4, strtod returns the wrong value for the + terminating character under some conditions. */ + char *string = "NaN"; + char *term; + strtod (string, &term); + if (term != string && *(term - 1) == 0) + exit (1); + } + exit (0); +} +], + ac_cv_func_strtod=yes, + ac_cv_func_strtod=no, + ac_cv_func_strtod=no)]) +if test $ac_cv_func_strtod = no; then + _AC_LIBOBJ_STRTOD +fi +]) + + +# AU::AM_FUNC_STRTOD +# ------------------- +AU_ALIAS([AM_FUNC_STRTOD], [AC_FUNC_STRTOD]) + + # AC_FUNC_STRERROR_R # ------------------ AC_DEFUN([AC_FUNC_STRERROR_R], diff --git a/doc/autoconf.texi b/doc/autoconf.texi index b7b580c6e..ae8baf1de 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -3140,6 +3140,15 @@ If the @code{strcoll} function exists and works correctly, define definitions of @code{strcoll}, which should not be used. @end defmac +@defmac AC_FUNC_STRTOD +@maindex FUNC_STRTOD +@ovindex POW_LIB +If the @code{strtod} function does not exist or doesn't work correctly, +ask for an @code{AC_LIBOBJ} replacement of @samp{strtod}. In this case, +because @file{strtod.c} is likely to need @samp{pow}, set the output +variable @code{POW_LIB} to the extra library needed. +@end defmac + @defmac AC_FUNC_STRERROR_R @maindex FUNC_STRERROR_R @cvindex HAVE_STRERROR_R diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4 index fe8e77629..7b7b93299 100644 --- a/lib/autoconf/functions.m4 +++ b/lib/autoconf/functions.m4 @@ -1201,6 +1201,64 @@ AC_DEFUN([AC_FUNC_STAT], [_AC_FUNC_STAT(stat)]) AC_DEFUN([AC_FUNC_LSTAT], [_AC_FUNC_STAT(lstat)]) +# _AC_LIBOBJ_STRTOD +# ----------------- +define([_AC_LIBOBJ_STRTOD], +[AC_LIBOBJ(strtod) +AC_CHECK_FUNC(pow) +if test $ac_cv_func_pow = no; then + AC_CHECK_LIB(m, pow, + [POW_LIB=-lm], + [AC_MSG_WARN(can't find library containing definition of pow)]) +fi +])# _AC_LIBOBJ_STRTOD + + +# AC_FUNC_STRTOD +# -------------- +AC_DEFUN([AC_FUNC_STRTOD], +[AC_CACHE_CHECK(for working strtod, ac_cv_func_strtod, +[AC_TRY_RUN([ +double strtod (); +int +main() +{ + { + /* Some versions of Linux strtod mis-parse strings with leading '+'. */ + char *string = " +69"; + char *term; + double value; + value = strtod (string, &term); + if (value != 69 || term != (string + 4)) + exit (1); + } + + { + /* Under Solaris 2.4, strtod returns the wrong value for the + terminating character under some conditions. */ + char *string = "NaN"; + char *term; + strtod (string, &term); + if (term != string && *(term - 1) == 0) + exit (1); + } + exit (0); +} +], + ac_cv_func_strtod=yes, + ac_cv_func_strtod=no, + ac_cv_func_strtod=no)]) +if test $ac_cv_func_strtod = no; then + _AC_LIBOBJ_STRTOD +fi +]) + + +# AU::AM_FUNC_STRTOD +# ------------------- +AU_ALIAS([AM_FUNC_STRTOD], [AC_FUNC_STRTOD]) + + # AC_FUNC_STRERROR_R # ------------------ AC_DEFUN([AC_FUNC_STRERROR_R], diff --git a/lib/autoscan/functions b/lib/autoscan/functions index 795f1b42e..d5d512527 100644 --- a/lib/autoscan/functions +++ b/lib/autoscan/functions @@ -33,6 +33,7 @@ stat AC_FUNC_STAT strcoll AC_FUNC_STRCOLL strerror_r AC_FUNC_STRERROR_R strftime AC_FUNC_STRFTIME +strtod AC_FUNC_STRTOD utime AC_FUNC_UTIME_NULL vfork AC_FUNC_VFORK vfprintf AC_FUNC_VPRINTF