On Sat, Apr 30, 2011 at 04:39:29PM +0000, Diogo Franco wrote:
> 2011/4/30 Måns Rullgård <[email protected]>
> > The correct solution is to not define those things in the first place on
> > BSD.
> 
> Yeah, I mentioned that (more complex) alternative on the first mail.
> The problem is that configure unconditionally defines the conformance
> flags. See configure lines 1666 and 2313 on git revision 7089265
> (current HEAD).

Please test the preliminary work-in-progress patch I attached.
I do not consider it fit for master yet, but I would appreciate
if you could test that it works as expected.

Diego
>From aa2c316b1db86cf31273b84a59b9d771bdc33f25 Mon Sep 17 00:00:00 2001
From: Diego Biurrun <[email protected]>
Date: Sun, 1 May 2011 21:57:06 +0200
Subject: [PATCH] configure: Do not Add _POSIX_C_SOURCE unconditionally to CPPFLAGS.

On some (BSD) systems _POSIX_C_SOURCE masks function definitions in
system header files.  Avoid the #define in that case.
---
 configure |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/configure b/configure
index 2b5aeab..c83b353 100755
--- a/configure
+++ b/configure
@@ -723,6 +723,26 @@ check_func_headers(){
     } | check_ld "$@" && enable $funcs && enable_safe $headers
 }
 
+check_func_headers_definitions(){
+    log check_func_headers_definitions "$@"
+    definitions=$1
+    headers=$2
+    funcs=$3
+    shift 3
+    {
+        for def in $definitions; do
+            echo "#define $def"
+        done
+        for hdr in $headers; do
+            echo "#include <$hdr>"
+        done
+        for func in $funcs; do
+            echo "long check_$func(void) { return (long) $func; }"
+        done
+        echo "int main(void) { return 0; }"
+    } | check_ld "$@" && enable $funcs && enable_safe $headers
+}
+
 check_cpp_condition(){
     log check_cpp_condition "$@"
     header=$1
@@ -2310,7 +2330,9 @@ if test "$?" != 0; then
     die "C compiler test failed."
 fi
 
-add_cppflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
+add_cppflags -D_ISOC99_SOURCE
+check_func_headers_definitions _POSIX_C_SOURCE=200112 arpa/inet.h inet_aton &&
+    add_cppflags -D_POSIX_C_SOURCE=200112
 check_cflags -std=c99
 check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
 #include <stdlib.h>
-- 
1.7.1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to