From 59936f19336f2c262b09e4dbff52ef8f0444c7cb Mon Sep 17 00:00:00 2001 From: nicodvb Date: Mon, 30 Jan 2006 20:58:11 +0000 Subject: [PATCH] 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 --- configure | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 4b8bed5f23..4a6f175558 100755 --- a/configure +++ b/configure @@ -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 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