On Mac OS X, when building GNU gettext with --enable-relocatable (and a configuration that forces the use of the relocatable wrapper programs), I get this compilation error during 'make install':
RELOC_MODE=wrapper RELOC_LIBRARY_PATH_VAR=DYLD_LIBRARY_PATH RELOC_LIBRARY_PATH_VALUE=/tmp/inst1/lib RELOC_PREFIX=/tmp/inst1 RELOC_DESTDIR= RELOC_COMPILE_COMMAND=gcc -m64 -std=gnu99 -g -O2 RELOC_SRCDIR=../gnulib-lib RELOC_BUILDDIR=../gnulib-lib RELOC_CONFIG_H_DIR=.. RELOC_EXEEXT= RELOC_STRIP_PROG=: RELOC_INSTALL_PROG=/Users/bruno/data/local-macos/bin/install -c /bin/sh ../libtool --mode=install ../../build-aux/install-reloc msgcmp msgfmt msgmerge msgunfmt xgettext msgattrib msgcat msgcomm msgconv msgen msgexec msgfilter msggrep msginit msguniq recode-sr-latin '/tmp/inst1/bin' libtool: warning: '/Users/bruno/data/build/gettext-0.19.8.1.346-939e-dirty/gettext-tools/intl/libintl.la' has not been installed in '/tmp/inst1/lib' libtool: install: ../../build-aux/install-reloc .libs/msgcmp /tmp/inst1/bin/msgcmp /Users/bruno/data/local-macos/bin/install -c .libs/msgcmp /tmp/inst1/bin/msgcmp gcc -m64 -std=gnu99 -g -O2 -I../gnulib-lib -I../gnulib-lib -I.. -DHAVE_CONFIG_H -DIN_RELOCWRAPPER -DNO_XMALLOC -DINSTALLPREFIX="/tmp/inst1" -DINSTALLDIR="/tmp/inst1/bin" -DLIBPATHVAR="DYLD_LIBRARY_PATH" -DLIBDIRS="/tmp/inst1/lib", -DEXEEXT="" ../gnulib-lib/relocwrapper.c ../gnulib-lib/progname.c ../gnulib-lib/progreloc.c ../gnulib-lib/areadlink.c ../gnulib-lib/careadlinkat.c ../gnulib-lib/allocator.c ../gnulib-lib/readlink.c ../gnulib-lib/stat.c ../gnulib-lib/canonicalize-lgpl.c ../gnulib-lib/malloca.c ../gnulib-lib/lstat.c ../gnulib-lib/relocatable.c ../gnulib-lib/setenv.c ../gnulib-lib/c-ctype.c -o /tmp/inst1/bin/msgcmp.wrapper In file included from ../gnulib-lib/sys/stat.h:44, from ../gnulib-lib/sys/stat.h:47, from ../gnulib-lib/sys/stat.h:47, from ../gnulib-lib/stat.c:48: ../gnulib-lib/time.h:35:24: error: #include nested too deeply In file included from ../gnulib-lib/sys/stat.h:47, from ../gnulib-lib/sys/stat.h:47, from ../gnulib-lib/sys/stat.h:47, from ../gnulib-lib/stat.c:48: ../gnulib-lib/sys/stat.h:41:23: error: #include nested too deeply ../gnulib-lib/sys/stat.h:44:18: error: #include nested too deeply ../gnulib-lib/sys/stat.h:47:27: error: #include nested too deeply In file included from ../gnulib-lib/sys/stat.h:44, from ../gnulib-lib/sys/stat.h:47, from ../gnulib-lib/sys/stat.h:47, from ../gnulib-lib/lstat.c:48: ../gnulib-lib/time.h:35:24: error: #include nested too deeply In file included from ../gnulib-lib/sys/stat.h:47, from ../gnulib-lib/sys/stat.h:47, from ../gnulib-lib/sys/stat.h:47, from ../gnulib-lib/lstat.c:48: ../gnulib-lib/sys/stat.h:41:23: error: #include nested too deeply ../gnulib-lib/sys/stat.h:44:18: error: #include nested too deeply ../gnulib-lib/sys/stat.h:47:27: error: #include nested too deeply make[5]: *** [install-binPROGRAMS] Error 1 make[4]: *** [install-am] Error 2 make[3]: *** [install] Error 2 make[2]: *** [install-recursive] Error 1 make[1]: *** [install-recursive] Error 1 make: *** [install] Error 2 The '#include_next <sys/stat.h>' is apparently not working, it is acting like '#include "sys/stat.h"'. The cause is the initial '#include "sys/stat.h"' in stat.c and lstat.c - which is a workaround for OSF/1. So let me disable this workaround when we're not on OSF/1. 2019-02-24 Bruno Haible <br...@clisp.org> stat, lstat: Fix conflict with relocatable-prog-wrapper module. * lib/stat.c: On platforms other than OSF/1, include <sys/stat.h>, not "sys/stat.h". * lib/lstat.c: Likewise. * lib/fstat.c: Likewise. * lib/fstatat.c: Likewise. diff --git a/lib/fstat.c b/lib/fstat.c index 4f0e618..a892b8f 100644 --- a/lib/fstat.c +++ b/lib/fstat.c @@ -40,10 +40,14 @@ orig_fstat (int fd, struct stat *buf) #endif /* Specification. */ +#ifdef __osf__ /* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc eliminates this include because of the preliminary #include <sys/stat.h> above. */ -#include "sys/stat.h" +# include "sys/stat.h" +#else +# include <sys/stat.h> +#endif #include "stat-time.h" diff --git a/lib/fstatat.c b/lib/fstatat.c index 515b569..019d3c6 100644 --- a/lib/fstatat.c +++ b/lib/fstatat.c @@ -36,10 +36,14 @@ orig_fstatat (int fd, char const *filename, struct stat *buf, int flags) } #endif +#ifdef __osf__ /* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc eliminates this include because of the preliminary #include <sys/stat.h> above. */ -#include "sys/stat.h" +# include "sys/stat.h" +#else +# include <sys/stat.h> +#endif #include "stat-time.h" diff --git a/lib/lstat.c b/lib/lstat.c index d57ca10..a3e40d8 100644 --- a/lib/lstat.c +++ b/lib/lstat.c @@ -42,10 +42,14 @@ orig_lstat (const char *filename, struct stat *buf) } /* Specification. */ +# ifdef __osf__ /* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc eliminates this include because of the preliminary #include <sys/stat.h> above. */ -# include "sys/stat.h" +# include "sys/stat.h" +# else +# include <sys/stat.h> +# endif # include "stat-time.h" diff --git a/lib/stat.c b/lib/stat.c index 74f4795..e4fc2cb 100644 --- a/lib/stat.c +++ b/lib/stat.c @@ -42,10 +42,14 @@ orig_stat (const char *filename, struct stat *buf) #endif /* Specification. */ +#ifdef __osf__ /* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc eliminates this include because of the preliminary #include <sys/stat.h> above. */ -#include "sys/stat.h" +# include "sys/stat.h" +#else +# include <sys/stat.h> +#endif #include "stat-time.h"