[FFmpeg-devel] [PATCH v3 1/1] configure: Refactor setting of feature test macro _XOPEN_SOURCE

Michael Niedermayer michaelni at gmx.at
Mon Sep 22 17:23:26 CEST 2014


On Mon, Sep 22, 2014 at 05:13:24PM +0200, Michael Niedermayer wrote:
> On Sun, Sep 21, 2014 at 10:48:01PM +0200, Jörg Krause wrote:
> > Some C libraries, eg glibc, uclibc, and musl, uses feature test macros 
> > to expose definitions conforming to the standards ISO C, POSIX and 
> > extensions. According to which feature test macros are defined by the 
> > user or the compiler, a header file, eg <features.h>, used by these 
> > libraries internally defines various other macros.
> > 
> > glibc and uclibc also defines release test macros, eg __GLIBC__ and
> > __UCLIBC__ in <features.h>. musl does not have (and does not want) a 
> > macro __MUSL__. Therefore it is not possible to check for the musl
> > library.
> > 
> > However, building FFmpeg with musl needs the feature test macro
> > _XOPEN_SOURCE=600 to be defined.
> > 
> > Signed-off-by: Jörg Krause <jkrause at posteo.de>
> > ---
> > Changes v2 -> v3:
> >   - set _XOPEN_SOURCE as default in case no C library can be detected
> > 
> > Changes v1 -> v2:
> >   - do not set _XOPEN_SOURCE twice for glibc and uclibc
> > ---
> >  configure | 3 +++
> >  1 file changed, 3 insertions(+)
> 
> patch reverted
> it broke netbsd and macosx at least
> see
> http://fate.ffmpeg.org/log.cgi?time=20140922033546&log=compile&slot=i386-darwin-gcc-4.7

heres the stuff causing the problem from teh netbsd headers:

/usr/include/sys/featuretest.h
    ...
    #if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
    #define _POSIX_C_SOURCE 1L
    #endif

    #if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
        !defined(_XOPEN_SOURCE) && !defined(_NETBSD_SOURCE)
    #define _NETBSD_SOURCE 1
    #endif

    ...

/usr/include/arpa/inet.h
    ...
    #if defined(_NETBSD_SOURCE)
    int              inet_aton(const char *, struct in_addr *);
    char *           inet_neta(u_long, char *, size_t);
    char            *inet_net_ntop(int, const void *, int, char *, size_t);
    int              inet_net_pton(int, const char *, void *, size_t);
    char            *inet_cidr_ntop(int, const void *, int, char *, size_t);
    int              inet_cidr_pton(int, const char *, void *, int *);
    u_int            inet_nsap_addr(const char *, u_char *, int);
    char            *inet_nsap_ntoa(int, const u_char *, char *);
    #endif
    ...

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140922/6008abf5/attachment.asc>


More information about the ffmpeg-devel mailing list