[FFmpeg-devel] [PATCH 1/3] configure: allow checking multiple functions in check_func_headers()

Mans Rullgard mans
Mon Mar 7 16:39:10 CET 2011


This makes it possible to pass a space-separated list of functions
to check_func_headers and check_lib2.  If any function is missing,
none are enabled as available, so this should only be used for
all-or-nothing sets, i.e. groups in which none will be used if any
one is missing.

Signed-off-by: Mans Rullgard <mans at mansr.com>
---
 configure |   27 ++++++++++++---------------
 1 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/configure b/configure
index 7cb0410..372724c 100755
--- a/configure
+++ b/configure
@@ -699,20 +699,17 @@ EOF
 check_func_headers(){
     log check_func_headers "$@"
     headers=$1
-    func=$2
+    funcs=$2
     shift 2
-    disable $func
-    incs=""
-    for hdr in $headers; do
-        incs="$incs
-#include <$hdr>"
-    done
-    check_ld "$@" <<EOF && enable $func && enable_safe $headers
-$incs
-int main(int argc, char **argv){
-    return (long) $func;
-}
-EOF
+    {
+        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(){
@@ -739,9 +736,9 @@ check_lib(){
 check_lib2(){
     log check_lib2 "$@"
     headers="$1"
-    func="$2"
+    funcs="$2"
     shift 2
-    check_func_headers "$headers" $func "$@" && add_extralibs "$@"
+    check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
 }
 
 check_exec(){
-- 
1.7.4.1




More information about the ffmpeg-devel mailing list