From 38197bf86dc80271af8992a4121d9497bccd265c Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 16 Jan 2025 23:10:10 +0100 Subject: [PATCH] getopt-posix: Fix compilation error in C++ mode (regression 2024-09-21). Reported by G. Branden Robinson in . * lib/getopt-pfx-core.h: On several platforms, include first. * modules/getopt-posix (Files): Add m4/musl.m4. (configure.ac): Invoke gl_MUSL_LIBC. --- ChangeLog | 9 +++++++++ lib/getopt-pfx-core.h | 3 +++ modules/getopt-posix | 2 ++ 3 files changed, 14 insertions(+) diff --git a/ChangeLog b/ChangeLog index 33a5bbb06a..48fe21b6aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2025-01-16 Bruno Haible + + getopt-posix: Fix compilation error in C++ mode (regression 2024-09-21). + Reported by G. Branden Robinson in + . + * lib/getopt-pfx-core.h: On several platforms, include first. + * modules/getopt-posix (Files): Add m4/musl.m4. + (configure.ac): Invoke gl_MUSL_LIBC. + 2025-01-16 Bruno Haible wchar_h: Fix for glibc 2.5. diff --git a/lib/getopt-pfx-core.h b/lib/getopt-pfx-core.h index 391c7af8e7..7c5ea09468 100644 --- a/lib/getopt-pfx-core.h +++ b/lib/getopt-pfx-core.h @@ -37,6 +37,9 @@ # if defined _AIX || defined __hpux || defined __sun || defined __QNX__ # include # endif +# if defined MUSL_LIBC || (defined __FreeBSD__ || defined __DragonFly__) || defined __NetBSD__ || defined __OpenBSD__ || (defined __APPLE__ && defined __MACH__) || defined _AIX || defined __sun || defined __minix || defined __HAIKU__ +# include +# endif # ifndef __GETOPT_ID # define __GETOPT_CONCAT(x, y) x ## y diff --git a/modules/getopt-posix b/modules/getopt-posix index 28ab405471..f27f5282e4 100644 --- a/modules/getopt-posix +++ b/modules/getopt-posix @@ -13,6 +13,7 @@ lib/getopt-pfx-ext.h lib/getopt_int.h m4/getopt.m4 m4/sys_cdefs_h.m4 +m4/musl.m4 Depends-on: unistd-h @@ -35,6 +36,7 @@ AM_COND_IF([GL_COND_OBJ_GETOPT], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_GETOPT], [1]) ]) gl_UNISTD_MODULE_INDICATOR([getopt-posix]) +gl_MUSL_LIBC Makefile.am: BUILT_SOURCES += $(GETOPT_H) $(GETOPT_CDEFS_H) -- 2.39.5