[MPlayer-dev-eng] [PATCH] pkg-config -> $PKG_CONFIG

Enrico Weigelt weigelt at metux.de
Mon Feb 13 01:50:17 CET 2006


Hi folks,


here's a little patch that introduces $PKG_CONFIG in ./configure 
so one can specify an own command for the pkg-config tool.


cu
-- 
"*Who am I*? I am Susan Ivanova, Commander, daughter of Andrei and Sophie
  Ivanova. I am the right hand of vengeance, and the boot that is going 
  to kick your sorry ass all the way back to Earth... I am Death Incarnate, 
  and the last living thing that you are ever going to see. God sent me."
                                                       -- Cmdr. Ivanova
-------------- next part --------------
diff -ruN main.orig/configure main/configure
--- main.orig/configure	Sun Feb 12 15:17:39 2006
+++ main/configure	Mon Feb 13 01:44:27 2006
@@ -147,6 +147,18 @@
   echo "$@ $_res_comment"
   _res_comment=""
 }
+
+#### pkgconfig helpers  #####
+if [ ! "$PKG_CONFIG" ]; then 
+    export PKG_CONFIG=pkg-config
+fi
+
+echo "Checking for pkg-config ..."
+if ! $PKG_CONFIG --version ; then
+    echo "pkg-config seems to be missing. Try to adjust $$PKG_CONFIG"
+    exit 1;
+fi
+
 #############################################################################
 
 # Check how echo works in this /bin/sh
@@ -4744,7 +4756,7 @@
 echocheck "Polyp"
 if test "$_polyp" = auto ; then
   _polyp=no
-  if ( pkg-config --exists 'polyplib >= 0.6 polyplib-error >= 0.6 polyplib-mainloop >= 0.6' ) >> "$TMPLOG" 2>&1 ; then
+  if ( $PKG_CONFIG --exists 'polyplib >= 0.6 polyplib-error >= 0.6 polyplib-mainloop >= 0.6' ) >> "$TMPLOG" 2>&1 ; then
 
 cat > $TMPC << EOF
 #include <polyp/polyplib.h>
@@ -4752,7 +4764,7 @@
 #include <polyp/polyplib-error.h>
 int main(void) { return 0; }
 EOF
-cc_check `pkg-config --libs --cflags polyplib polyplib-error polyplib-mainloop` && tmp_run && _polyp=yes
+cc_check `$PKG_CONFIG --libs --cflags polyplib polyplib-error polyplib-mainloop` && tmp_run && _polyp=yes
 
   fi
 fi
@@ -4762,8 +4774,8 @@
   _def_polyp='#define USE_POLYP 1'
   _aosrc="$_aosrc ao_polyp.c"
   _aomodules="polyp $_aomodules"
-  _ld_polyp=`pkg-config --libs polyplib polyplib-error polyplib-mainloop`
-  _inc_polyp=`pkg-config --cflags polyplib polyplib-error polyplib-mainloop`
+  _ld_polyp=`$PKG_CONFIG --libs polyplib polyplib-error polyplib-mainloop`
+  _inc_polyp=`$PKG_CONFIG --cflags polyplib polyplib-error polyplib-mainloop`
 else
   _def_polyp='#undef USE_POLYP'
   _noaomodules="polyp $_noaomodules"
@@ -4780,9 +4792,9 @@
 EOF
   if cc_check -ljack ; then
     _ld_jack="-ljack"
-  elif cc_check `pkg-config --libs --cflags --silence-errors jack` ; then
-    _ld_jack="`pkg-config --libs jack`"
-    _inc_jack="`pkg-config --cflags jack`"
+  elif cc_check `$PKG_CONFIG --libs --cflags --silence-errors jack` ; then
+    _ld_jack="`$PKG_CONFIG --libs jack`"
+    _inc_jack="`$PKG_CONFIG --cflags jack`"
   else
     _jack=no
   fi
@@ -5145,7 +5157,7 @@
 
 echocheck "libcdio"
 if test "$_libcdio" = auto && test "$_cdparanoia" = no ; then
-    if ( pkg-config --modversion libcdio) > /dev/null 2>&1 ; then
+    if ( $PKG_CONFIG --modversion libcdio) > /dev/null 2>&1 ; then
         cat > $TMPC << EOF
 #include <stdio.h>
 #include <cdio/version.h>
@@ -5160,7 +5172,7 @@
 EOF
         _libcdio=no
     for _inc_tmp in "$_inc_libcdio" "-I/usr/include/cdio" "-I/usr/local/include/cdio" ; do
-       cc_check `pkg-config --cflags --libs libcdio` $_inc_tmp $_ld_libcdio -lcdio_cdda -lcdio_paranoia $_ld_lm && _inc_libcdio="$_inc_tmp" && ( $TMPO >> "$TMPLOG" ) && _libcdio=yes && break
+       cc_check `$PKG_CONFIG --cflags --libs libcdio` $_inc_tmp $_ld_libcdio -lcdio_cdda -lcdio_paranoia $_ld_lm && _inc_libcdio="$_inc_tmp" && ( $TMPO >> "$TMPLOG" ) && _libcdio=yes && break
     done
     else
         _libcdio=no
@@ -5171,8 +5183,8 @@
     _def_cdparanoia='#define HAVE_CDDA'
     _def_havelibcdio='yes'
     _inputmodules="cdda $_inputmodules"
-    _inc_libcdio=`pkg-config --cflags libcdio`
-    _ld_libcdio=`pkg-config --libs libcdio`
+    _inc_libcdio=`$PKG_CONFIG --cflags libcdio`
+    _ld_libcdio=`$PKG_CONFIG --libs libcdio`
     _ld_cdparanoia="$_ld_cdparanoia -lcdio_cdda -lcdio_paranoia -lcdio"
 else
     if test "$_cdparanoia" = yes ; then
@@ -5261,9 +5273,9 @@
   _fontconfig=yes
   if cc_check -lfontconfig ; then
     _ld_fontconfig="-lfontconfig"
-  elif cc_check `pkg-config --cflags --libs fontconfig` ; then
-    _inc_fontconfig=`pkg-config --cflags fontconfig`
-    _ld_fontconfig=`pkg-config --libs fontconfig`
+  elif cc_check `$PKG_CONFIG --cflags --libs fontconfig` ; then
+    _inc_fontconfig=`$PKG_CONFIG --cflags fontconfig`
+    _ld_fontconfig=`$PKG_CONFIG --libs fontconfig`
   else
     _fontconfig=no
   fi
@@ -5563,11 +5575,11 @@
   return 0;
 }
 EOF
-  for _ld_theora in "`pkg-config --silence-errors --libs --cflags theora`" "-ltheora"; do
+  for _ld_theora in "`$PKG_CONFIG --silence-errors --libs --cflags theora`" "-ltheora"; do
     cc_check $_ld_theora && _theora=yes && break
   done
   if test "$_theora" = no && test "$_tremor_internal" = yes; then
-    for _ld_theora in "`pkg-config --silence-errors --libs --cflags theora`" "-ltheora"; do
+    for _ld_theora in "`$PKG_CONFIG --silence-errors --libs --cflags theora`" "-ltheora"; do
       cc_check -I. tremor/bitwise.c $_ld_theora && _theora=yes && break
     done
   fi
@@ -6078,9 +6090,9 @@
     return 0; 
 }
 EOF
-  if (pkg-config --exists libavcodec >> "$TMPLOG" 2>&1) ; then
-    _inc_libavcodec=`pkg-config --cflags libavcodec`
-    _ld_libavcodec=`pkg-config --libs libavcodec`
+  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
@@ -6100,9 +6112,9 @@
   #include <ffmpeg/avformat.h>
   int main(void) { av_alloc_format_context(); return 0; }
 EOF
-  if (pkg-config --exists libavformat >> "$TMPLOG" 2>&1 ) ; then
-    _inc_libavformat=`pkg-config --cflags libavformat`
-    _ld_libavformat=`pkg-config --libs libavformat`
+  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  
@@ -6847,18 +6859,18 @@
   #Check for GTK2 :
   echocheck "GTK+ version"
 
-  if pkg-config gtk+-2.0 --exists ; then
-    _gtk=`pkg-config gtk+-2.0 --modversion 2>/dev/null`
-    _inc_gtk=`pkg-config gtk+-2.0 --cflags 2>/dev/null`
-    _ld_gtk=`pkg-config gtk+-2.0 --libs 2>/dev/null`
+  if $PKG_CONFIG gtk+-2.0 --exists ; then
+    _gtk=`$PKG_CONFIG gtk+-2.0 --modversion 2>/dev/null`
+    _inc_gtk=`$PKG_CONFIG gtk+-2.0 --cflags 2>/dev/null`
+    _ld_gtk=`$PKG_CONFIG gtk+-2.0 --libs 2>/dev/null`
     echores "$_gtk"
 
     # Check for GLIB2
-    if pkg-config glib-2.0 --exists ; then
+    if $PKG_CONFIG glib-2.0 --exists ; then
       echocheck "glib version"
-      _glib=`pkg-config glib-2.0 --modversion 2>/dev/null`
-      _inc_glib=`pkg-config glib-2.0 --cflags 2>/dev/null`
-      _ld_glib=`pkg-config glib-2.0 --libs 2>/dev/null`
+      _glib=`$PKG_CONFIG glib-2.0 --modversion 2>/dev/null`
+      _inc_glib=`$PKG_CONFIG glib-2.0 --cflags 2>/dev/null`
+      _ld_glib=`$PKG_CONFIG glib-2.0 --libs 2>/dev/null`
       echores "$_glib"
 
       _def_gui='#define HAVE_NEW_GUI 1'


More information about the MPlayer-dev-eng mailing list