[DVDnav-discuss] r1292 - in trunk/libdvdnav: configure.ac configure2

rathann subversion at mplayerhq.hu
Thu Dec 5 00:51:38 CET 2013


Author: rathann
Date: Thu Dec  5 00:51:38 2013
New Revision: 1292

Log:
check pkg-config before xxx-config

Based on a patch by Mike Frysinger <vapier AT gentoo DOT org>

configure2 equivalent by myself

Modified:
   trunk/libdvdnav/configure.ac
   trunk/libdvdnav/configure2

Modified: trunk/libdvdnav/configure.ac
==============================================================================
--- trunk/libdvdnav/configure.ac	Thu Dec  5 00:02:01 2013	(r1291)
+++ trunk/libdvdnav/configure.ac	Thu Dec  5 00:51:38 2013	(r1292)
@@ -89,6 +89,7 @@ AC_PROG_CC
 AC_PROG_MAKE_SET
 AC_PROG_INSTALL
 AC_PROG_LN_S
+PKG_PROG_PKG_CONFIG
 
 dnl --------------------------------------------------------------
 dnl Libtool
@@ -185,15 +186,25 @@ AC_ARG_WITH([dvdread-config],
   [AS_HELP_STRING([--with-dvdread-config=PROG],
     [dvdread-config program to use @<:@default=from PATH@:>@])],
   [DVDREAD_CONFIG="$withval"],
+  [DVDREAD_CONFIG=""])
+
+dnl by default, search pkg-config, and then fall back to dvdread-config
+DVDREAD_PKG_CONFIG="no"
+if test "x$DVDREAD_CONFIG" = "x"; then
+  PKG_CHECK_MODULES([DVDREAD], [dvdread],
+    [DVDREAD_PKG_CONFIG="yes"],
   [dnl User didn't specify program, search PATH
   AC_PATH_PROG([DVDREAD_CONFIG], [dvdread-config], [no])
   test "x$DVDREAD_CONFIG" = xno && \
     AC_MSG_ERROR([dvdread-config required to link with libdvdread])
   ])
+fi
+if test "x$DVDREAD_PKG_CONFIG" != "xyes"; then
 DVDREAD_CFLAGS=`$DVDREAD_CONFIG --cflags` || \
   AC_MSG_ERROR([Could not get libdvdread CFLAGS from $DVDREAD_CONFIG])
 DVDREAD_LIBS=`$DVDREAD_CONFIG --libs` || \
   AC_MSG_ERROR([Could not get libdvdread LIBS from $DVDREAD_CONFIG])
+fi
 AC_SUBST([DVDREAD_CFLAGS])
 AC_SUBST([DVDREAD_LIBS])
 

Modified: trunk/libdvdnav/configure2
==============================================================================
--- trunk/libdvdnav/configure2	Thu Dec  5 00:02:01 2013	(r1291)
+++ trunk/libdvdnav/configure2	Thu Dec  5 00:51:38 2013	(r1292)
@@ -48,7 +48,8 @@ show_help(){
 
 SHARED=yes
 STATIC=yes
-DVDREAD_CONFIG=dvdread-config
+DVDREAD_CONFIG=""
+DVDREAD_PKG_CONFIG="pkg-config dvdread"
 PREFIX=/usr/local/
 INSTALLSTRIP=-s
 USEDEBUG=-g
@@ -104,8 +105,14 @@ test -z "$shlibdir" && shlibdir=$PREFIX/
 test -z "$incdir" && incdir=$PREFIX/include/dvdnav
 
 dvdread=no
+if test -z "$DVDREAD_CONFIG" ; then
+DVDREAD_CONFIG="pkg-config dvdread"
+$DVDREAD_CONFIG --exists >> /dev/null 2>&1 && dvdread=yes
+fi
+if test "$dvdread" != "yes" ; then
+DVDREAD_CONFIG=dvdread-config
 $DVDREAD_CONFIG --prefix >> /dev/null 2>&1 && dvdread=yes
-test "$dvdread" != "yes" && $DVDREAD_CONFIG --exists >> /dev/null 2>&1 && dvdread=yes
+fi
 if test "$dvdread" != "yes" ; then
   echo "$DVDREAD_CONFIG returned an error. Can't proceed"
   exit 1


More information about the DVDnav-discuss mailing list