changeset 17517:07d73385c036

when linking to external libav* try using pkg-config first
author nicodvb
date Mon, 30 Jan 2006 20:58:11 +0000
parents 4daed8895ce0
children eef1a44cf2cb
files configure
diffstat 1 files changed, 19 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Mon Jan 30 19:39:01 2006 +0000
+++ b/configure	Mon Jan 30 20:58:11 2006 +0000
@@ -6078,8 +6078,14 @@
     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 @@
   #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 @@
 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 @@
 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