diff --git a/ChangeLog b/ChangeLog index eab8ed14..f6b40bf6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2000-07-10 Akim Demaille + + * acspecific.m4 (_AC_FUNC_STAT, AC_FUNC_STAT, AC_FUNC_LSTAT): New + macros, from Jim's stat.m4 and lstat.m4 serial 6. + * doc/autoconf.texi (Particular Functions): Document + * acfunctions: Add them. + 2000-07-10 Akim Demaille AC_LIBOBJ when used by AC_REPLACE_FUNCS should not complain for diff --git a/NEWS b/NEWS index bc658a36..a6e8124b 100644 --- a/NEWS +++ b/NEWS @@ -171,7 +171,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_LSTAT_FOLLOWS_SLASHED_SYMLINK, AC_FUNC_STAT, AC_FUNC_LSTAT. New. - AC_FUNC_GETGROUPS diff --git a/acfunctions b/acfunctions index 7099d0a1..fc96257b 100644 --- a/acfunctions +++ b/acfunctions @@ -10,7 +10,7 @@ getloadavg AC_FUNC_GETLOADAVG getpgrp AC_FUNC_GETPGRP index AC_HEADER_STDC ioctl AC_PROG_GCC_TRADITIONAL -lstat AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK +lstat AC_FUNC_LSTAT major AC_HEADER_MAJOR malloc AC_FUNC_MALLOC makedev AC_HEADER_MAJOR @@ -26,6 +26,7 @@ rindex AC_HEADER_STDC setpgrp AC_FUNC_SETPGRP setvbuf AC_FUNC_SETVBUF_REVERSED signal AC_TYPE_SIGNAL +stat AC_FUNC_STAT strcoll AC_FUNC_STRCOLL strerror_r AC_FUNC_STRERROR_R strftime AC_FUNC_STRFTIME diff --git a/acspecific.m4 b/acspecific.m4 index a8376957..cf7113af 100644 --- a/acspecific.m4 +++ b/acspecific.m4 @@ -1715,6 +1715,47 @@ fi ])# AC_FUNC_SETPGRP +# _AC_FUNC_STAT(STAT | LSTAT) +# --------------------------- +# Determine whether stat or lstat have the bug that it succeeds when +# given the zero-length file name argument. The stat and lstat from +# SunOS4.1.4 and the Hurd (as of 1998-11-01) do this. +# +# If it does, then define HAVE_STAT_EMPTY_STRING_BUG (or +# HAVE_LSTAT_EMPTY_STRING_BUG) and arrange to compile the wrapper +# function. +define([_AC_FUNC_STAT], +[AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])dnl +AC_CACHE_CHECK([whether $1 accepts an empty string], + [ac_cv_func_$1_empty_string_bug], +[AC_TRY_RUN( +[#include +#include + +int +main () +{ + struct stat sbuf; + exit ($1 ("", &sbuf) ? 1 : 0); +}], + [ac_cv_func_$1_empty_string_bug=yes], + [ac_cv_func_$1_empty_string_bug=no], + [ac_cv_func_$1_empty_string_bug=yes])]) +if test $ac_cv_func_$1_empty_string_bug = yes; then + AC_LIBOBJ([$1]) + AC_DEFINE_UNQUOTED(AC_TR_CPP([HAVE_$1_EMPTY_STRING_BUG]), 1, + [Define if `$1' has the bug that it succeeds when + given the zero-length file name argument.]) +fi +])# _AC_FUNC_STAT + + +# AC_FUNC_STAT & AC_FUNC_LSTAT +# ---------------------------- +AC_DEFUN([AC_FUNC_STAT], [_AC_FUNC_STAT(stat)]) +AC_DEFUN([AC_FUNC_LSTAT], [_AC_FUNC_STAT(lstat)]) + + # AC_FUNC_STRERROR_R # ------------------ AC_DEFUN([AC_FUNC_STRERROR_R], diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 5dd707fd..97f641c4 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -2900,6 +2900,22 @@ two process ID as arguments. This macro does not check whether first call @code{AC_CHECK_FUNC} for @code{setpgrp}. @end defmac +@defmac AC_FUNC_STAT +@defmacx AC_FUNC_LSTAT +@maindex FUNC_STAT +@maindex FUNC_LSTAT +@cvindex HAVE_STAT_EMPTY_STRING_BUG +@cvindex HAVE_LSTAT_EMPTY_STRING_BUG +Determine whether @code{stat} or @code{lstat} have the bug that it +succeeds when given the zero-length file name argument. The @code{stat} +and @code{lstat} from SunOS4.1.4 and the Hurd (as of 1998-11-01) do +this. + +If it does, then define @code{HAVE_STAT_EMPTY_STRING_BUG} (or +@code{HAVE_LSTAT_EMPTY_STRING_BUG}) and ask for an @code{AC_LIBOBJ} +replacement of it. +@end defmac + @defmac AC_FUNC_SETVBUF_REVERSED @maindex FUNC_SETVBUF_REVERSED @cvindex SETVBUF_REVERSED diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4 index a8376957..cf7113af 100644 --- a/lib/autoconf/specific.m4 +++ b/lib/autoconf/specific.m4 @@ -1715,6 +1715,47 @@ fi ])# AC_FUNC_SETPGRP +# _AC_FUNC_STAT(STAT | LSTAT) +# --------------------------- +# Determine whether stat or lstat have the bug that it succeeds when +# given the zero-length file name argument. The stat and lstat from +# SunOS4.1.4 and the Hurd (as of 1998-11-01) do this. +# +# If it does, then define HAVE_STAT_EMPTY_STRING_BUG (or +# HAVE_LSTAT_EMPTY_STRING_BUG) and arrange to compile the wrapper +# function. +define([_AC_FUNC_STAT], +[AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])dnl +AC_CACHE_CHECK([whether $1 accepts an empty string], + [ac_cv_func_$1_empty_string_bug], +[AC_TRY_RUN( +[#include +#include + +int +main () +{ + struct stat sbuf; + exit ($1 ("", &sbuf) ? 1 : 0); +}], + [ac_cv_func_$1_empty_string_bug=yes], + [ac_cv_func_$1_empty_string_bug=no], + [ac_cv_func_$1_empty_string_bug=yes])]) +if test $ac_cv_func_$1_empty_string_bug = yes; then + AC_LIBOBJ([$1]) + AC_DEFINE_UNQUOTED(AC_TR_CPP([HAVE_$1_EMPTY_STRING_BUG]), 1, + [Define if `$1' has the bug that it succeeds when + given the zero-length file name argument.]) +fi +])# _AC_FUNC_STAT + + +# AC_FUNC_STAT & AC_FUNC_LSTAT +# ---------------------------- +AC_DEFUN([AC_FUNC_STAT], [_AC_FUNC_STAT(stat)]) +AC_DEFUN([AC_FUNC_LSTAT], [_AC_FUNC_STAT(lstat)]) + + # AC_FUNC_STRERROR_R # ------------------ AC_DEFUN([AC_FUNC_STRERROR_R], diff --git a/lib/autoscan/functions b/lib/autoscan/functions index 7099d0a1..fc96257b 100644 --- a/lib/autoscan/functions +++ b/lib/autoscan/functions @@ -10,7 +10,7 @@ getloadavg AC_FUNC_GETLOADAVG getpgrp AC_FUNC_GETPGRP index AC_HEADER_STDC ioctl AC_PROG_GCC_TRADITIONAL -lstat AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK +lstat AC_FUNC_LSTAT major AC_HEADER_MAJOR malloc AC_FUNC_MALLOC makedev AC_HEADER_MAJOR @@ -26,6 +26,7 @@ rindex AC_HEADER_STDC setpgrp AC_FUNC_SETPGRP setvbuf AC_FUNC_SETVBUF_REVERSED signal AC_TYPE_SIGNAL +stat AC_FUNC_STAT strcoll AC_FUNC_STRCOLL strerror_r AC_FUNC_STRERROR_R strftime AC_FUNC_STRFTIME