From: Paul Eggert Date: Wed, 25 Mar 2020 19:13:33 +0000 (-0700) Subject: getopt-posix: port __GETOPT_PREFIX to macOS X-Git-Tag: v1.0~4182 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=79e056e5a0394b75dd38772697b495d60e2c3b3f;p=gnulib.git getopt-posix: port __GETOPT_PREFIX to macOS * lib/getopt-pfx-core.h (_GETOPT) [__APPLE__ && __GETOPT_PREFIX]: Define to work around a problem with asm on macOS (Bug#40205). --- diff --git a/ChangeLog b/ChangeLog index 53f61ebbe4..d91e44a7e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2020-03-25 Paul Eggert + + getopt-posix: port __GETOPT_PREFIX to macOS + * lib/getopt-pfx-core.h (_GETOPT) [__APPLE__ && __GETOPT_PREFIX]: + Define to work around a problem with asm on macOS (Bug#40205). + 2020-03-22 Bruno Haible MODULES.html.sh: Add support for reproducible builds. diff --git a/lib/getopt-pfx-core.h b/lib/getopt-pfx-core.h index 31a747d676..a4891bc802 100644 --- a/lib/getopt-pfx-core.h +++ b/lib/getopt-pfx-core.h @@ -48,6 +48,14 @@ # define optind __GETOPT_ID (optind) # define optopt __GETOPT_ID (optopt) +/* Work around a a problem on macOS, which declares getopt with a + trailing __DARWIN_ALIAS(getopt) that would expand to something like + __asm("_" "rpl_getopt" "$UNIX2003") were it not for the following + hack to suppress the macOS declaration . */ +# ifdef __APPLE__ +# define _GETOPT +# endif + /* The system's getopt.h may have already included getopt-core.h to declare the unprefixed identifiers. Undef _GETOPT_CORE_H so that getopt-core.h declares them with prefixes. */