Skip to content
Snippets Groups Projects
Commit f8d7b072 authored by Måns Rullgård's avatar Måns Rullgård
Browse files

feature tests for functions requiring one or more headers

Originally committed as revision 8032 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent fcfcde17
No related branches found
No related tags found
No related merge requests found
...@@ -438,6 +438,26 @@ int main(){ ...@@ -438,6 +438,26 @@ int main(){
EOF EOF
} }
check_func2(){
log check_func2 "$@"
headers=$1
func=$2
shift 2
disable $func
incs=""
for hdr in $headers; do
incs="$incs
#include <$hdr>"
done
check_ld "$@" <<EOF && enable $func
$incs
int main(){
(void) $func;
return 0;
}
EOF
}
check_lib(){ check_lib(){
log check_lib "$@" log check_lib "$@"
header="$1" header="$1"
...@@ -450,6 +470,18 @@ check_lib(){ ...@@ -450,6 +470,18 @@ check_lib(){
return $err return $err
} }
check_lib2(){
log check_lib2 "$@"
headers="$1"
func="$2"
shift 2
temp_extralibs "$@"
check_func2 "$headers" $func && add_extralibs "$@"
err=$?
restore_flags
return $err
}
check_exec(){ check_exec(){
check_ld "$@" && { enabled cross_compile || $TMPE >>$logfile 2>&1; } check_ld "$@" && { enabled cross_compile || $TMPE >>$logfile 2>&1; }
} }
...@@ -462,6 +494,14 @@ require(){ ...@@ -462,6 +494,14 @@ require(){
check_lib $header $func "$@" || die "ERROR: $name not found" check_lib $header $func "$@" || die "ERROR: $name not found"
} }
require2(){
name="$1"
headers="$2"
func="$3"
shift 3
check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
}
apply(){ apply(){
file=$1 file=$1
shift shift
...@@ -1486,54 +1526,9 @@ enabled xvid && require XviD xvid.h xvid_global -lxvidcore ...@@ -1486,54 +1526,9 @@ enabled xvid && require XviD xvid.h xvid_global -lxvidcore
enabled x264 && require x264 x264.h x264_encoder_open -lx264 enabled x264 && require x264 x264.h x264_encoder_open -lx264
enabled dc1394 && require libdc1394 libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 enabled dc1394 && require libdc1394 libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394
enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
# Ugh, libfaac uses stdcall calling convention on win32 so we can't use enabled libfaad && require2 libfaad faad.h faacDecOpen -lfaad
# the generic test functions enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32
if enabled libfaac; then
save_flags
temp_extralibs -lfaac
check_ld <<EOF && add_extralibs -lfaac || die "ERROR: libfaac not found"
#include <stdint.h>
#include <faac.h>
int main(){
char *id, *cpr;
faacEncGetVersion(&id, &cpr);
return 0;
}
EOF
restore_flags
fi
# Ugh, recent faad2 versions have renamed all functions and #define the
# old names in faad.h. Generic tests won't work.
if enabled libfaad; then
save_flags
temp_extralibs -lfaad
check_ld <<EOF && add_extralibs -lfaad || die "ERROR: libfaad not found"
#include <faad.h>
int main(){
faacDecOpen();
return 0;
}
EOF
restore_flags
fi
# Ugh, avisynth uses WINAPI calls. Generic tests won't work.
if enabled avisynth; then
save_flags
temp_extralibs -lvfw32
check_ld <<EOF && add_extralibs -lvfw32 || die "ERROR: vfw32 not found"
#include <windows.h>
#include <vfw.h>
int main(){
AVIFileInit();
return 0;
}
EOF
restore_flags
fi
# test for lrintf in math.h # test for lrintf in math.h
check_exec <<EOF && lrintf=yes || lrintf=no check_exec <<EOF && lrintf=yes || lrintf=no
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment