[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: getopt compilation failure on Darwin (gzip 1.3.13)
From: |
Eric Blake |
Subject: |
Re: getopt compilation failure on Darwin (gzip 1.3.13) |
Date: |
Tue, 06 Oct 2009 21:13:37 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Eric Blake on 10/6/2009 11:04 AM:
> Ludovic Courtès <ludo <at> gnu.org> writes:
>
>> GNU zip 1.3.13 fails to build on Darwin:
> This is a sign that our #include_next of darwin's <getopt.h> worked, but that
> darwin's header recursively includes some other header that calls back to our
> <getopt.h>, prior to the completion of the first use of the system's
> <getopt.h>.
The circle was:
./getopt.h did include_next <getopt.h>
<getopt.h> did include <unistd.h>, but found ./unistd.h
./unistd.h did include_next <unistd.h>
<unistd.h> completed
./unistd.h did include <getopt.h>, and found ./getopt.h
./getopt.h declared things
./unistd.h completed
<getopt.h> redeclared things
The solution is to teach ./unistd.h to skip <getopt.h> if the system
<getopt.h> was the guy including unistd. That way, both the system
<getopt.h> and <unistd.h> can run to completion prior to ./getopt.h
declaring overrides.
I will be pushing this, if further testing proves that it doesn't break
Linux or FreeBSD.
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkrMB2AACgkQ84KuGfSFAYDaIgCgkc1IshHToxoNPNX83XTASSDk
RooAoIK9BHxGGdveALO7tfnOfiJb5uQi
=VvmQ
-----END PGP SIGNATURE-----
From dd0ebefe4fe761f6f422a400430db53c64dbffd7 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Tue, 6 Oct 2009 20:44:13 -0600
Subject: [PATCH] getopt: fix compilation on darwin
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* 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 <address@hidden>
---
ChangeLog | 5 +++++
lib/getopt.in.h | 6 +++++-
lib/unistd.in.h | 2 +-
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 19d34df..f330309 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2009-10-06 Eric Blake <address@hidden>
+ 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.
+
utimens: minor optimization
* lib/utimens.c (gl_futimens): Use one less system call.
* modules/utimens (Depends-on): Add dup2.
diff --git a/lib/getopt.in.h b/lib/getopt.in.h
index 9de467a..7377f3c 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
+ <getopt.h>; 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 38e2e13..b6ea889 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 <getopt.h>
#endif
--
1.6.5.rc1