[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AC_FUNC_STRTOD
From: |
Bruno Haible |
Subject: |
Re: AC_FUNC_STRTOD |
Date: |
Sat, 28 Aug 2010 12:42:31 +0200 |
User-agent: |
KMail/1.9.9 |
> +** Newly obsolete macros
> + The following macros have been marked obsolete. New programs should use
> + the corresponding Gnulib modules. Gnulib not only detects the particular
> + portability problems but also provides complete workarounds.
> +
> + AC_FUNC_ERROR_AT_LINE AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
> + AC_FUNC_MKTIME AC_FUNC_STRTOD
If that gets accepted in Autoconf, here is a proposed patch for gnulib, in
order to take over the maintenance of these macros from Autoconf (and also of
AC_FUNC_MEMCMP, which was already marked obsolescent).
2010-08-28 Bruno Haible <address@hidden>
Take over the maintenance of some older macros from Autoconf.
* m4/error.m4 (AC_FUNC_ERROR_AT_LINE): New macro, from GNU Autoconf.
* m4/lstat.m4 (AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK): New macro, from
GNU Autoconf.
* m4/memcmp.m4 (AC_FUNC_MEMCMP): New macro, from GNU Autoconf.
* m4/mktime.m4 (AC_FUNC_MKTIME): Change comment.
--- m4/error.m4.orig Sat Aug 28 12:34:11 2010
+++ m4/error.m4 Sat Aug 28 12:08:17 2010
@@ -1,4 +1,4 @@
-#serial 12
+#serial 13
# Copyright (C) 1996-1998, 2001-2004, 2009-2010 Free Software Foundation, Inc.
#
@@ -13,6 +13,23 @@
gl_PREREQ_ERROR
])
+# Redefine AC_FUNC_ERROR_AT_LINE, because it is no longer maintained in
+# Autoconf.
+AC_DEFUN([AC_FUNC_ERROR_AT_LINE],
+[
+ AC_LIBSOURCES([error.h, error.c])dnl
+ AC_CACHE_CHECK([for error_at_line], [ac_cv_lib_error_at_line],
+ [AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <error.h>]],
+ [[error_at_line (0, 0, "", 0, "an error occurred");]])],
+ [ac_cv_lib_error_at_line=yes],
+ [ac_cv_lib_error_at_line=no])])
+ if test $ac_cv_lib_error_at_line = no; then
+ AC_LIBOBJ([error])
+ fi
+])
+
# Prerequisites of lib/error.c.
AC_DEFUN([gl_PREREQ_ERROR],
[
--- m4/lstat.m4.orig Sat Aug 28 12:34:11 2010
+++ m4/lstat.m4 Sat Aug 28 12:14:44 2010
@@ -1,4 +1,4 @@
-# serial 20
+# serial 21
# Copyright (C) 1997-2001, 2003-2010 Free Software Foundation, Inc.
#
@@ -26,3 +26,44 @@
HAVE_LSTAT=0
fi
])
+
+# Redefine AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK, because it is no longer
+# maintained in Autoconf.
+AC_DEFUN([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK],
+[
+ AC_CACHE_CHECK([whether lstat correctly handles trailing slash],
+ [ac_cv_func_lstat_dereferences_slashed_symlink],
+ [rm -f conftest.sym conftest.file
+ echo >conftest.file
+ if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
+ AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM(
+ [AC_INCLUDES_DEFAULT],
+ [[struct stat sbuf;
+ /* Linux will dereference the symlink and fail, as required by
+ POSIX. That is better in the sense that it means we will not
+ have to compile and use the lstat wrapper. */
+ return lstat ("conftest.sym/", &sbuf) == 0;
+ ]])],
+ [ac_cv_func_lstat_dereferences_slashed_symlink=yes],
+ [ac_cv_func_lstat_dereferences_slashed_symlink=no],
+ [# When cross-compiling, be pessimistic so we will end up using the
+ # replacement version of lstat that checks for trailing slashes and
+ # calls lstat a second time when necessary.
+ ac_cv_func_lstat_dereferences_slashed_symlink=no
+ ])
+ else
+ # If the 'ln -s' command failed, then we probably don't even
+ # have an lstat function.
+ ac_cv_func_lstat_dereferences_slashed_symlink=no
+ fi
+ rm -f conftest.sym conftest.file
+ ])
+ test $ac_cv_func_lstat_dereferences_slashed_symlink = yes &&
+ AC_DEFINE_UNQUOTED([LSTAT_FOLLOWS_SLASHED_SYMLINK], [1],
+ [Define to 1 if `lstat' dereferences a symlink specified
+ with a trailing slash.])
+ if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then
+ AC_LIBOBJ([lstat])
+ fi
+])
--- m4/memcmp.m4.orig Sat Aug 28 12:34:11 2010
+++ m4/memcmp.m4 Sat Aug 28 12:18:34 2010
@@ -1,4 +1,4 @@
-# memcmp.m4 serial 14
+# memcmp.m4 serial 15
dnl Copyright (C) 2002-2004, 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -27,5 +27,42 @@
fi
])
+# Redefine AC_FUNC_MEMCMP, because it is no longer maintained in Autoconf.
+AC_DEFUN([AC_FUNC_MEMCMP],
+[
+ AC_CACHE_CHECK([for working memcmp], [ac_cv_func_memcmp_working],
+ [AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM(
+ [AC_INCLUDES_DEFAULT],
+ [[/* Some versions of memcmp are not 8-bit clean. */
+ char c0 = '\100', c1 = '\200', c2 = '\201';
+ if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
+ return 1;
+ /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
+ or more and with at least one buffer not starting on a 4-byte
+ boundary. William Lewis provided this test program. */
+ {
+ char foo[21];
+ char bar[21];
+ int i;
+ for (i = 0; i < 4; i++)
+ {
+ char *a = foo + i;
+ char *b = bar + i;
+ strcpy (a, "--------01111111");
+ strcpy (b, "--------10000000");
+ if (memcmp (a, b, 16) >= 0)
+ return 1;
+ }
+ return 0;
+ }
+ ]])],
+ [ac_cv_func_memcmp_working=yes],
+ [ac_cv_func_memcmp_working=no],
+ [ac_cv_func_memcmp_working=no])])
+ test $ac_cv_func_memcmp_working = no &&
+ AC_LIBOBJ([memcmp])
+])
+
# Prerequisites of lib/memcmp.c.
AC_DEFUN([gl_PREREQ_MEMCMP], [:])
--- m4/mktime.m4.orig Sat Aug 28 12:34:11 2010
+++ m4/mktime.m4 Sat Aug 28 12:31:26 2010
@@ -1,4 +1,4 @@
-# serial 15
+# serial 16
dnl Copyright (C) 2002-2003, 2005-2007, 2009-2010 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
@@ -7,10 +7,7 @@
dnl From Jim Meyering.
-# Redefine AC_FUNC_MKTIME, to fix a bug in Autoconf 2.61a and earlier.
-# This redefinition can be removed once a new version of Autoconf is assumed.
-# The redefinition is taken from
-#
<http://cvs.sv.gnu.org/viewcvs/*checkout*/autoconf/autoconf/lib/autoconf/functions.m4?rev=1.119>.
+# Redefine AC_FUNC_MKTIME, because it is no longer maintained in Autoconf.
# AC_FUNC_MKTIME
# --------------
AC_DEFUN([AC_FUNC_MKTIME],