configure: add check_struct function
authorMåns Rullgård <mans@mansr.com>
Sun, 17 Jan 2010 19:10:03 +0000 (19:10 +0000)
committerMåns Rullgård <mans@mansr.com>
Sun, 17 Jan 2010 19:10:03 +0000 (19:10 +0000)
This adds a check_struct function to test for availability of a
member within a struct.

Originally committed as revision 21267 to svn://svn.ffmpeg.org/ffmpeg/trunk

configure

index cf3d51a..391e034 100755 (executable)
--- a/configure
+++ b/configure
@@ -759,6 +759,24 @@ $type v;
 EOF
 }
 
+check_struct(){
+    log check_type "$@"
+    headers=$1
+    struct=$2
+    member=$3
+    shift 3
+    disable_safe "${struct}_${member}"
+    incs=""
+    for hdr in $headers; do
+        incs="$incs
+#include <$hdr>"
+    done
+    check_cc "$@" <<EOF && enable_safe "${struct}_${member}"
+$incs
+const void *p = &(($struct *)0)->$member;
+EOF
+}
+
 require(){
     name="$1"
     header="$2"