From: Bruno Haible Date: Fri, 17 Sep 2010 16:18:38 +0000 (-0600) Subject: Take over the maintenance of some older macros from Autoconf. X-Git-Tag: v0.1~3792 X-Git-Url: http://erislabs.net/gitweb/?a=commitdiff_plain;h=025fae6d61b82020179feb5c72d3747f1ce351c4;p=gnulib.git 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. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index 54319d5c5..2356ea56e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2010-09-17 Bruno Haible + + 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. + 2010-09-17 Eric Blake fdutimensat: drop atflag validation diff --git a/m4/error.m4 b/m4/error.m4 index 9f1307a42..dd5a197b6 100644 --- a/m4/error.m4 +++ b/m4/error.m4 @@ -1,4 +1,4 @@ -#serial 12 +#serial 13 # Copyright (C) 1996-1998, 2001-2004, 2009-2010 Free Software Foundation, Inc. # @@ -13,6 +13,23 @@ AC_DEFUN([gl_ERROR], 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_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], [ diff --git a/m4/lstat.m4 b/m4/lstat.m4 index 5dbd16e28..236af540e 100644 --- a/m4/lstat.m4 +++ b/m4/lstat.m4 @@ -1,4 +1,4 @@ -# serial 20 +# serial 21 # Copyright (C) 1997-2001, 2003-2010 Free Software Foundation, Inc. # @@ -26,3 +26,44 @@ AC_DEFUN([gl_FUNC_LSTAT], 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 +]) diff --git a/m4/memcmp.m4 b/m4/memcmp.m4 index c0e9265da..a15e9b798 100644 --- a/m4/memcmp.m4 +++ b/m4/memcmp.m4 @@ -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 @@ AC_DEFUN([gl_FUNC_MEMCMP], 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], [:]) diff --git a/m4/mktime.m4 b/m4/mktime.m4 index 44b8d8788..3e3b22d40 100644 --- a/m4/mktime.m4 +++ b/m4/mktime.m4 @@ -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 with or without modifications, as long as this notice is preserved. 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 -# . +# Redefine AC_FUNC_MKTIME, because it is no longer maintained in Autoconf. # AC_FUNC_MKTIME # -------------- AC_DEFUN([AC_FUNC_MKTIME],