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

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

From: Jörg Krause <jkrause at posteo.de>

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

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>

the else is replaced by elif checking for features.h
this avoids breaking netbsd

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
 configure |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/configure b/configure
index f674a06..bc89c28 100755
--- a/configure
+++ b/configure
@@ -4232,6 +4232,9 @@ probe_libc(){
     elif check_${pfx}cpp_condition sys/brand.h "defined LABELED_BRAND_NAME"; then
         eval ${pfx}libc_type=solaris
         add_${pfx}cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
+    # FFmpeg needs a POSIX.1-2001/XSI compliant C library
+    elif check_header features.h; then
+        add_${pfx}cppflags -D_XOPEN_SOURCE=600

More information about the ffmpeg-devel mailing list