when linking to external libav* try using pkg-config first

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17518 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
nicodvb 2006-01-30 20:58:11 +00:00
parent 6a978e7764
commit 59936f1933
1 changed files with 19 additions and 4 deletions

23
configure vendored
View File

@ -6078,8 +6078,14 @@ int main(void) {
return 0;
}
EOF
if cc_check -lavcodec $_ld_lm ; then
if (pkg-config --exists libavcodec >> "$TMPLOG" 2>&1) ; then
_inc_libavcodec=`pkg-config --cflags libavcodec`
_ld_libavcodec=`pkg-config --libs libavcodec`
cc_check $_inc_libavcodec $_ld_libavcodec && _libavcodec_so=yes
elif cc_check -lavcodec $_ld_lm ; then
_libavcodec_so=yes
fi
if test "$_libavcodec_so" == yes ; then
_res_comment="using libavcodec.so, but static libavcodec is recommended"
fi
fi
@ -6094,7 +6100,16 @@ if test "$_libavformat_so" = auto ; then
#include <ffmpeg/avformat.h>
int main(void) { av_alloc_format_context(); return 0; }
EOF
cc_check $_ld_lm -lavformat && _libavformat_so=yes
if (pkg-config --exists libavformat >> "$TMPLOG" 2>&1 ) ; then
_inc_libavformat=`pkg-config --cflags libavformat`
_ld_libavformat=`pkg-config --libs libavformat`
cc_check $_inc_libavformat $_ld_libavformat && _libavformat_so=yes
elif cc_check $_ld_lm -lavformat ; then
_libavformat_so=yes
fi
if test "$_libavformat_so" == yes ; then
_res_comment="using libavformat.so, but static libavformat is recommended"
fi
fi
echores "$_libavformat_so"
fi
@ -6133,7 +6148,7 @@ if test "$_libavcodec" = yes ; then
elif test "$_libavcodec_so" = yes ; then
_def_libavcodec='#define USE_LIBAVCODEC 1'
_def_libavcodec_so='#define USE_LIBAVCODEC_SO 1'
_ld_libavcodec='-lavcodec'
test "$_ld_libavcodec" || _ld_libavcodec='-lavcodec'
_codecmodules="libavcodec.so $_codecmodules"
else
_nocodecmodules="libavcodec $_nocodecmodules"
@ -6152,7 +6167,7 @@ if test "$_libavformat" = yes ; then
else
if test "$_libavformat_so" = yes ; then
_def_libavformat_so='#define USE_LIBAVFORMAT_SO 1'
_ld_libavformat='-lavformat'
test "$_ld_libavformat" || _ld_libavformat='-lavformat'
if win32 ; then
_def_libavformat_win32='#define CONFIG_WIN32 1'
fi