Browse code

configure: allow checking multiple functions in check_func_headers()

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@mansr.com>
(cherry picked from commit edaf1ae2763ce1a23dec70e730ba2bb8ee476dfd)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Mans Rullgard authored on 2011/03/07 11:49:55
Showing 1 changed files
... ...
@@ -700,20 +700,17 @@ EOF
700 700
 check_func_headers(){
701 701
     log check_func_headers "$@"
702 702
     headers=$1
703
-    func=$2
703
+    funcs=$2
704 704
     shift 2
705
-    disable $func
706
-    incs=""
707
-    for hdr in $headers; do
708
-        incs="$incs
709
-#include <$hdr>"
710
-    done
711
-    check_ld "$@" <<EOF && enable $func && enable_safe $headers
712
-$incs
713
-int main(int argc, char **argv){
714
-    return (long) $func;
715
-}
716
-EOF
705
+    {
706
+        for hdr in $headers; do
707
+            echo "#include <$hdr>"
708
+        done
709
+        for func in $funcs; do
710
+            echo "long check_$func(void) { return (long) $func; }"
711
+        done
712
+        echo "int main(void) { return 0; }"
713
+    } | check_ld "$@" && enable $funcs && enable_safe $headers
717 714
 }
718 715
 
719 716
 check_cpp_condition(){
... ...
@@ -740,9 +737,9 @@ check_lib(){
740 740
 check_lib2(){
741 741
     log check_lib2 "$@"
742 742
     headers="$1"
743
-    func="$2"
743
+    funcs="$2"
744 744
     shift 2
745
-    check_func_headers "$headers" $func "$@" && add_extralibs "$@"
745
+    check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
746 746
 }
747 747
 
748 748
 check_exec(){