Colin Watson wrote: > I was trying to prepare a test case for you, but I find that now I > cannot reproduce the problem, either with VPATH or non-VPATH builds! It > seems there must have been some junk lying around in my tree after all, ... > > http://people.debian.org/~cjwatson/tmp/man-db-gnulib.tar.gz
The -I options in this tar file looks fine for me, whether in a VPATH build or not. So the situation is probably not so frequent. I will therefore write the usual rpl_ prefix in those functions that invoke the system's function, but do without the - hard to maintain - #error. Applying the appended patch and proposing this additional patch. Paul, Jim, what do you think of this? --- lib/getcwd.c.orig 2007-10-15 22:41:27.000000000 +0200 +++ lib/getcwd.c 2007-10-15 21:45:25.000000000 +0200 @@ -89,7 +89,7 @@ #endif #if !_LIBC -# define __getcwd getcwd +# define __getcwd rpl_getcwd # define __lstat lstat # define __closedir closedir # define __opendir opendir --- lib/getgroups.c.orig 2007-10-15 22:41:27.000000000 +0200 +++ lib/getgroups.c 2007-10-15 21:36:06.000000000 +0200 @@ -1,6 +1,6 @@ /* provide consistent interface to getgroups for systems that don't allow N==0 - Copyright (C) 1996, 1999, 2003, 2006 Free Software Foundation, Inc. + Copyright (C) 1996, 1999, 2003, 2006, 2007 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -32,7 +32,7 @@ provided function handle all others. */ int -getgroups (int n, GETGROUPS_T *group) +rpl_getgroups (int n, GETGROUPS_T *group) { int n_groups; GETGROUPS_T *gbuf; --- lib/gettimeofday.c.orig 2007-10-15 22:41:27.000000000 +0200 +++ lib/gettimeofday.c 2007-10-15 21:57:55.000000000 +0200 @@ -48,7 +48,7 @@ localtime uses for its result. */ struct tm * -localtime (time_t const *timep) +rpl_localtime (time_t const *timep) { #undef localtime extern struct tm *localtime (time_t const *); @@ -62,7 +62,7 @@ /* Same as above, since gmtime and localtime use the same buffer. */ struct tm * -gmtime (time_t const *timep) +rpl_gmtime (time_t const *timep) { #undef gmtime extern struct tm *gmtime (time_t const *); @@ -80,7 +80,7 @@ /* This is a wrapper for tzset, for systems on which tzset may clobber the static buffer used for localtime's result. */ void -tzset (void) +rpl_tzset (void) { #undef tzset extern void tzset (void); 2007-10-15 Bruno Haible <[EMAIL PROTECTED]> * lib/fchdir.c (close, open, closedir, opendir, dup, dup2): Define with explicit rpl_ prefix. * lib/fopen.c (fopen): Likewise. * lib/freopen.c (freopen): Likewise. * lib/iconv.c (iconv): Likewise. * lib/iconv_close.c (iconv_close): Likewise. *** lib/fchdir.c.orig 2007-10-15 22:36:18.000000000 +0200 --- lib/fchdir.c 2007-10-15 21:46:52.000000000 +0200 *************** *** 78,84 **** /* Override open() and close(), to keep track of the open file descriptors. */ int ! close (int fd) #undef close { int retval = close (fd); --- 78,84 ---- /* Override open() and close(), to keep track of the open file descriptors. */ int ! rpl_close (int fd) #undef close { int retval = close (fd); *************** *** 94,100 **** } int ! open (const char *filename, int flags, ...) #undef open { mode_t mode; --- 94,100 ---- } int ! rpl_open (const char *filename, int flags, ...) #undef open { mode_t mode; *************** *** 139,145 **** descriptors. Needed because there is a function dirfd(). */ int ! closedir (DIR *dp) #undef closedir { int fd = dirfd (dp); --- 139,145 ---- descriptors. Needed because there is a function dirfd(). */ int ! rpl_closedir (DIR *dp) #undef closedir { int fd = dirfd (dp); *************** *** 156,162 **** } DIR * ! opendir (const char *filename) #undef opendir { DIR *dp; --- 156,162 ---- } DIR * ! rpl_opendir (const char *filename) #undef opendir { DIR *dp; *************** *** 182,188 **** /* Override dup() and dup2(), to keep track of open file descriptors. */ int ! dup (int oldfd) #undef dup { int newfd = dup (oldfd); --- 182,188 ---- /* Override dup() and dup2(), to keep track of open file descriptors. */ int ! rpl_dup (int oldfd) #undef dup { int newfd = dup (oldfd); *************** *** 217,223 **** } int ! dup2 (int oldfd, int newfd) #undef dup2 { int retval = dup2 (oldfd, newfd); --- 217,223 ---- } int ! rpl_dup2 (int oldfd, int newfd) #undef dup2 { int retval = dup2 (oldfd, newfd); *** lib/fopen.c.orig 2007-10-15 22:36:18.000000000 +0200 --- lib/fopen.c 2007-10-15 21:37:49.000000000 +0200 *************** *** 24,30 **** #include <string.h> FILE * ! fopen (const char *filename, const char *mode) #undef fopen { #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ --- 24,30 ---- #include <string.h> FILE * ! rpl_fopen (const char *filename, const char *mode) #undef fopen { #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ *** lib/freopen.c.orig 2007-10-15 22:36:18.000000000 +0200 --- lib/freopen.c 2007-10-15 21:37:57.000000000 +0200 *************** *** 24,30 **** #include <string.h> FILE * ! freopen (const char *filename, const char *mode, FILE *stream) #undef freopen { #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ --- 24,30 ---- #include <string.h> FILE * ! rpl_freopen (const char *filename, const char *mode, FILE *stream) #undef freopen { #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ *** lib/iconv.c.orig 2007-10-15 22:36:18.000000000 +0200 --- lib/iconv.c 2007-10-15 21:39:03.000000000 +0200 *************** *** 275,283 **** #endif size_t ! iconv (iconv_t cd, ! ICONV_CONST char **inbuf, size_t *inbytesleft, ! char **outbuf, size_t *outbytesleft) #undef iconv { #if REPLACE_ICONV_UTF --- 275,283 ---- #endif size_t ! rpl_iconv (iconv_t cd, ! ICONV_CONST char **inbuf, size_t *inbytesleft, ! char **outbuf, size_t *outbytesleft) #undef iconv { #if REPLACE_ICONV_UTF *** lib/iconv_close.c.orig 2007-10-15 22:36:18.000000000 +0200 --- lib/iconv_close.c 2007-10-15 21:39:11.000000000 +0200 *************** *** 26,32 **** #endif int ! iconv_close (iconv_t cd) #undef iconv_close { #if REPLACE_ICONV_UTF --- 26,32 ---- #endif int ! rpl_iconv_close (iconv_t cd) #undef iconv_close { #if REPLACE_ICONV_UTF