# HG changeset patch # User Bruno Haible # Date 1178043284 0 # Node ID d9e13374d31685fe7f05fb809024d9f00a9b67b3 # Parent cd42657bc151f27b26b7484d37b84cf5b80afcbf Make the generated sys/stat.h more self-contained. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-05-01 Bruno Haible + + * lib/sys_stat_.h: Test HAVE_LSTAT, HAVE_DECL_MKDIR, HAVE_IO_H at + configure time. + * m4/sys_stat_h.m4 (gl_HEADER_SYS_STAT_H): Substitute HAVE_LSTAT, + HAVE_DECL_MKDIR, HAVE_IO_H via AC_SUBST. + * modules/sys_stat (Makefile.am): Substitute their values into + sys/stat.h. + 2007-05-01 Bruno Haible * lib/glob_.h: Test HAVE_SYS_CDEFS_H at configure time. @@ -30162,4 +30171,4 @@ * m4/isc-posix.m4: New file. -1998-05-10 Jim Meyering +1998-05-10 Jim Meyering \ No newline at end of file diff --git a/lib/sys_stat_.h b/lib/sys_stat_.h --- a/lib/sys_stat_.h +++ b/lib/sys_stat_.h @@ -253,14 +253,14 @@ /* mingw does not support symlinks, therefore it does not have lstat. But without links, stat does just fine. */ -#if ! HAVE_LSTAT +#if ! @HAVE_LSTAT@ # define lstat stat #endif /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments. Additionally, it declares _mkdir (and depending on compile flags, an alias mkdir), only in the nonstandard io.h. */ -#if ! HAVE_DECL_MKDIR && HAVE_IO_H +#if ! @HAVE_DECL_MKDIR@ && @HAVE_IO_H@ # include static inline int diff --git a/m4/sys_stat_h.m4 b/m4/sys_stat_h.m4 --- a/m4/sys_stat_h.m4 +++ b/m4/sys_stat_h.m4 @@ -1,5 +1,5 @@ -# sys_stat_h.m4 serial 4 -*- Autoconf -*- -dnl Copyright (C) 2006 Free Software Foundation, Inc. +# sys_stat_h.m4 serial 5 -*- Autoconf -*- +dnl Copyright (C) 2006-2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -12,6 +12,12 @@ dnl Check for lstat. Systems that lack it (mingw) also lack symlinks, so dnl stat is a good replacement. AC_CHECK_FUNCS_ONCE([lstat]) + if test $ac_cv_func_lstat = yes; then + HAVE_LSTAT=1 + else + HAVE_LSTAT=0 + fi + AC_SUBST([HAVE_LSTAT]) dnl Check for mkdir. Mingw has _mkdir(name) in the nonstandard dnl instead. @@ -19,6 +25,18 @@ [], [AC_CHECK_HEADERS([io.h])], [#include ]) + if test $ac_cv_have_decl_mkdir = yes; then + HAVE_DECL_MKDIR=1 + else + HAVE_DECL_MKDIR=0 + fi + AC_SUBST([HAVE_DECL_MKDIR]) + if test "$ac_cv_header_io_h" = yes; then + HAVE_IO_H=1 + else + HAVE_IO_H=0 + fi + AC_SUBST([HAVE_IO_H]) AC_REQUIRE([AC_C_INLINE]) dnl Check for broken stat macros. diff --git a/modules/sys_stat b/modules/sys_stat --- a/modules/sys_stat +++ b/modules/sys_stat @@ -22,6 +22,9 @@ rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''ABSOLUTE_SYS_STAT_H''@|$(ABSOLUTE_SYS_STAT_H)|g' \ + -e 's|@''HAVE_IO_H''@|$(HAVE_IO_H)|g' \ + -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \ + -e 's|@''HAVE_DECL_MKDIR''@|$(HAVE_DECL_MKDIR)|g' \ < $(srcdir)/sys_stat_.h; \ } > $@-t mv $@-t $@