Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH v2] define _GNU_SOURCE



On Thu, 14 Apr 2011 09:35:23 +0100
Peter Stephenson <Peter.Stephenson@xxxxxxx> wrote:

> On Tue, 12 Apr 2011 15:09:32 +0200
> Valentin Ochs <a@xxxxxx> wrote:
> > -#if defined(__linux) || defined(__GNU__) || defined(__GLIBC__)
> >  /*
> >   * Turn on numerous extensions.
> >   * This is in order to get the functions for
> > manipulating /dev/ptmx. */
> >  #define _GNU_SOURCE 1
> > -#endif
> > +#define _POSIX_C_SOURCE 200809L
> 
> Looks like we'll need to #ifdef these for the appropriate system,
> since it's causing mayhem elsewhere.  Can you provide a preprocessor
> test for the system you're fixing?

I couldn't see anything obvious in musl to test for.  For, I'll make it
so that it can be explicitly enabled with configure --enable-libc-musl.

Index: configure.ac
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.ac,v
retrieving revision 1.133
diff -p -u -r1.133 configure.ac
--- configure.ac	12 Apr 2011 14:51:31 -0000	1.133
+++ configure.ac	14 Apr 2011 09:01:45 -0000
@@ -2466,6 +2466,17 @@ if test x$zsh_cv_c_unicode_support = xye
 fi
 
 dnl
+dnl musl support
+dnl
+AH_TEMPLATE([LIBC_MUSL],
+[Define to 1 if musl is being used as the C library])
+AC_ARG_ENABLE(libc-musl,
+AC_HELP_STRING([--enable-libc-musl], [compile with musl as the C library]),
+[if test x$enableval = xyes; then
+  AC_DEFINE(LIBC_MUSL)
+fi])
+
+dnl
 dnl static user lookup
 dnl
 AC_ARG_ENABLE(dynamic-nss,
Index: Src/system.h
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/system.h,v
retrieving revision 1.57
diff -p -u -r1.57 system.h
--- Src/system.h	12 Apr 2011 14:51:33 -0000	1.57
+++ Src/system.h	14 Apr 2011 09:01:45 -0000
@@ -37,12 +37,16 @@
 #endif
 #endif
 
+#if defined(__linux) || defined(__GNU__) || defined(__GLIBC__) || defined(LIBC_MUSL)
 /*
  * Turn on numerous extensions.
  * This is in order to get the functions for manipulating /dev/ptmx.
  */
 #define _GNU_SOURCE 1
+#endif
+#ifdef LIBC_MUSL
 #define _POSIX_C_SOURCE 200809L
+#endif
 
 /* NeXT has half-implemented POSIX support *
  * which currently fools configure         */


-- 
Peter Stephenson <pws@xxxxxxx>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom



Messages sorted by: Reverse Date, Date, Thread, Author