diff options
author | Eric Blake <ebb9@byu.net> | 2009-09-24 10:57:14 -0600 |
---|---|---|
committer | Eric Blake <ebb9@byu.net> | 2009-09-24 19:27:18 -0600 |
commit | 6471b4628903c7b85e6922e53b4205103b506c97 (patch) | |
tree | 85bb82e9ba23418f5f63597128caddc1a1c8f750 /modules/getopt-posix | |
parent | d2ce0449310435ff3ae29a08f74c21a961bd5e56 (diff) | |
download | gnulib-6471b4628903c7b85e6922e53b4205103b506c97.tar.gz |
getopt: fix inclusion guards for cygwin
cygwin <unistd.h> includes <getopt.h>, but gnulib <getopt.h> includes
<unistd.h>, so system declarations were happening after gnulib
replacements, leading to multiply-defined rpl_readlink error on
cygwin 1.5. The solution is to ensure that the system <unistd.h>
is complete prior to any of gnulib's contents, by picking up
system <getopt.h> in preference to a cycle to <unistd.h>.
* modules/getopt-posix (Depends-on): Add include-next.
(Makefile.am): Substitute more items in replacement header.
* m4/getopt.m4 (gl_GETOPT_CHECK_HEADERS): Also check for native
<getopt.h>.
* lib/getopt.in.h (includes): Use split inclusion guard, and
prefer <getopt.h> over include <unistd.h> when one is present.
(option): Also override name of 'struct option'.
Signed-off-by: Eric Blake <ebb9@byu.net>
Diffstat (limited to 'modules/getopt-posix')
-rw-r--r-- | modules/getopt-posix | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/getopt-posix b/modules/getopt-posix index b9d2658309..94932fcc00 100644 --- a/modules/getopt-posix +++ b/modules/getopt-posix @@ -12,6 +12,7 @@ Depends-on: gettext-h unistd extensions +include_next configure.ac: gl_FUNC_GETOPT_POSIX @@ -24,7 +25,12 @@ BUILT_SOURCES += $(GETOPT_H) getopt.h: getopt.in.h $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - cat $(srcdir)/getopt.in.h; \ + sed -e 's|@''HAVE_GETOPT_H''@|$(HAVE_GETOPT_H)|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''NEXT_GETOPT_H''@|$(NEXT_GETOPT_H)|g' \ + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + < $(srcdir)/getopt.in.h; \ } > $@-t && \ mv -f $@-t $@ MOSTLYCLEANFILES += getopt.h getopt.h-t |