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 <akim@epita.fr>
+
+ * 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 <akim@epita.fr>
AC_LIBOBJ when used by AC_REPLACE_FUNCS should not complain for
** 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
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
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
])# 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 <sys/types.h>
+#include <sys/stat.h>
+
+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],
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
])# 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 <sys/types.h>
+#include <sys/stat.h>
+
+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],
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
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