From: Eric Blake Date: Wed, 7 Oct 2009 02:44:13 +0000 (-0600) Subject: getopt: fix compilation on darwin X-Git-Tag: v0.1~5364 X-Git-Url: http://erislabs.net/gitweb/?a=commitdiff_plain;h=09e22b5a16b5cd926d75dd9e052b6b2188981df5;p=gnulib.git getopt: fix compilation on darwin * lib/getopt.in.h (includes): Leave breadcrumbs during system include. * lib/unistd.in.h (getopt): Use them to avoid recursive include. Reported by Ludovic Courtès. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index e971922af..78b33867c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-10-06 Eric Blake + + getopt: fix compilation on darwin + * lib/getopt.in.h (includes): Leave breadcrumbs during system + include. + * lib/unistd.in.h (getopt): Use them to avoid recursive include. + Reported by Ludovic Courtès. + 2009-10-06 Bruno Haible * modules/size_max (Description): Discourage its use. diff --git a/lib/getopt.in.h b/lib/getopt.in.h index 9de467ae9..7377f3cfb 100644 --- a/lib/getopt.in.h +++ b/lib/getopt.in.h @@ -22,9 +22,13 @@ @PRAGMA_SYSTEM_HEADER@ #endif -/* The include_next requires a split double-inclusion guard. */ +/* The include_next requires a split double-inclusion guard. We must + also inform the replacement unistd.h to not recursively use + ; our definitions will be present soon enough. */ #if @HAVE_GETOPT_H@ +# define _GL_SYSTEM_GETOPT # @INCLUDE_NEXT@ @NEXT_GETOPT_H@ +# undef _GL_SYSTEM_GETOPT #endif #ifndef _GL_GETOPT_H diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 38e2e13f7..b6ea889a8 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -49,7 +49,7 @@ #endif /* Get getopt(), optarg, optind, opterr, optopt. */ -#if @GNULIB_UNISTD_H_GETOPT@ +#if @GNULIB_UNISTD_H_GETOPT@ && !defined _GL_SYSTEM_GETOPT # include #endif