mainAutoconf - Support: sr #110392, Define _NETBSD_SOURCE and...

 
 

sr #110392: Define _NETBSD_SOURCE and _OPENBSD_SOURCE in AC_USE_SYSTEM_EXTENSIONS

Submitter:  Julien ÉLIE <iulius>
Submitted:  Sun 06 Dec 2020 09:08:28 AM UTC
   
 
Priority:  * 5 - Unprioritized Severity:  3 - Normal
Status:  Done Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Operating System:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 06 Dec 2020 10:08:41 PM UTC, comment #2: 

Hi Zack,

Thanks for the commit!
Please note that "Enable OpenBSD extensions on NetBSD." was not a typo.  It is really meant for use on NetBSD (not on OpenBSD).

From NetBSD documentation:
https://man.netbsd.org/reallocarray.3
#define _OPENBSD_SOURCE

And also about BSD portability:
https://learnbchs.org/portability-page2.html
#if defined(_NetBSD_)
# define _OPENBSD_SOURCE /* reallocarray */
#endif

--
Julien ÉLIE

Julien ÉLIE <iulius>
Sun 06 Dec 2020 09:53:25 PM UTC, comment #1: 

Merged as c467efab94cd2d0331655d68d067fa0719fc8762 (with a typo fix and a comment added about there not being any such thing as _FREEBSD_SOURCE).  Thank you.

Zack Weinberg <zackw>
Group administrator
Sun 06 Dec 2020 09:08:28 AM UTC, original submission:  

Hi,

A few prototypes are available on NetBSD only when _NETBSD_SOURCE or _OPENBSD_SOURCE are set.
Would it be possible to add them to AC_USE_SYSTEM_EXTENSIONS?

--- specific.m4.old 2020-12-06 09:54:37.394649064 +0100
+++ specific.m4 2020-12-06 09:59:35.490562935 +0100
@@ -396,6 +396,14 @@
 #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
+#endif
 /* Enable threading extensions on Solaris.  */
 #ifndef _POSIX_PTHREAD_SEMANTICS
 # undef _POSIX_PTHREAD_SEMANTICS
@@ -456,6 +464,8 @@
   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__])
   AC_DEFINE([__STDC_WANT_IEC_60559_BFP_EXT__])


Seems like a few projects already use it locally:
  http://tug.ctan.org/tex-archive/macros/texinfo/texinfo/gnulib/m4/extensions.m4

And we recently encountered a build issue with reallocarray (NetBSD preferring reallocarr):
  https://git.eyrie.org/?p=devel/rra-c-util.git;a=commitdiff;h=f8a922cf31804dcc25ac176dcc22fdcdffcb5fdf


Thanks beforehand,

--
Julien ÉLIE

Julien ÉLIE <iulius>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by zackw (Posted a comment)
  • -email is unavailable- added by iulius (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-12-06 zackw StatusNone Done
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.12.
    Corresponding source code