Paul Eggert wrote: > https://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/sys/sys/featuretest.h > > says that defining _NETBSD_SOURCE should be helpful only if _ANSI_SOURCE, > _POSIX_SOURCE, _POSIX_C_SOURCE, or _XOPEN_SOURCE is defined. I suppose it > shouldn't hurt to define _NETBSD_SOURCE, to handle these (presumably rare) > configurations.
Yes, I agree. Our 'extensions' module does not define any of _ANSI_SOURCE, _POSIX_SOURCE, _POSIX_C_SOURCE, or _XOPEN_SOURCE on NetBSD (I checked it with NetBSD 7.0), therefore with the default CFLAGS and CPPFLAGS this patch is a no-op. But when someone uses -D_XOPEN_SOURCE=500 or something like that, gnulib would not operate properly without -D_NETBSD_SOURCE: configure produces wrong findings for REPLACE_FCNTL, REPLACE_FSTATAT, REPLACE_DUPLOCALE, REPLACE_RENAMEAT, HAVE_COPYSIGN, REPLACE_SYMLINKAT, REPLACE_LINKAT, REPLACE_FCHOWNAT, REPLACE_UNSETENV, REPLACE_PTSNAME_R, and so on. 2017-08-15 Bruno Haible <[email protected]> extensions: Enable NetBSD specific extensions. * m4/extensions.m4 (AC_USE_SYSTEM_EXTENSIONS): Define _NETBSD_SOURCE. diff --git a/m4/extensions.m4 b/m4/extensions.m4 index 0c16bb8..f854338 100644 --- a/m4/extensions.m4 +++ b/m4/extensions.m4 @@ -1,4 +1,4 @@ -# serial 16 -*- Autoconf -*- +# serial 17 -*- Autoconf -*- # Enable extensions on systems that normally disable them. # Copyright (C) 2003, 2006-2017 Free Software Foundation, Inc. @@ -68,6 +68,10 @@ dnl configure.ac when using autoheader 2.62. #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif +/* Enable NetBSD extensions on NetBSD. */ +#ifndef _NETBSD_SOURCE +# undef _NETBSD_SOURCE +#endif /* Enable OpenBSD extensions on NetBSD. */ #ifndef _OPENBSD_SOURCE # undef _OPENBSD_SOURCE @@ -132,6 +136,7 @@ dnl configure.ac when using autoheader 2.62. AC_DEFINE([_ALL_SOURCE]) AC_DEFINE([_DARWIN_C_SOURCE]) AC_DEFINE([_GNU_SOURCE]) + AC_DEFINE([_NETBSD_SOURCE]) AC_DEFINE([_OPENBSD_SOURCE]) AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) AC_DEFINE([__STDC_WANT_IEC_60559_ATTRIBS_EXT__])
