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

Jörg Krause jkrause at posteo.de
Thu Sep 18 09:51:19 CEST 2014


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, 
the header file <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 do not want) such 
a macro like __MUSL__. 

Building ffmpeg with the musl toolchain needs the feature test macro
_XOPEN_SOURCE=600 to be defined. As it is not possible to detect musl  
check for the <features.h> header file, which is assumed to be specific 
to glibc, uclibc, and musl.  

Signed-off-by: Jörg Krause <jkrause at posteo.de>
---
 configure | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/configure b/configure
index 110a3fd..528e4fc 100755
--- a/configure
+++ b/configure
@@ -4182,6 +4182,11 @@ esac
 probe_libc(){
     pfx=$1
     pfx_no_=${pfx%_}
+    # feature test macros are understood by glibc, uclibc, and musl
+    if check_header features.h; then
+        # _XOPEN_SOURCE=600 implicitly defines _POSIX_C_SOURCE=200112L
+        add_${pfx}cppflags -D_XOPEN_SOURCE=600
+    fi
     # uclibc defines __GLIBC__, so it needs to be checked before glibc.
     if check_${pfx}cpp_condition features.h "defined __UCLIBC__"; then
         eval ${pfx}libc_type=uclibc
-- 
2.1.0



More information about the ffmpeg-devel mailing list