Blob Blame History Raw
From 62b327a3a6a289ef3b89d6cfe239a9008a0303c3 Mon Sep 17 00:00:00 2001
From: Nils Philippsen <nils@redhat.com>
Date: Fri, 16 Sep 2011 12:23:57 +0200
Subject: [PATCH] patch: pkgconfig

Squashed commit of the following:

commit 8232a5fdf931da4b1adfade313c17c9cd118790d
Author: Nils Philippsen <nils@redhat.com>
Date:   Fri Sep 16 12:18:06 2011 +0200

    use pkg-config in sane-config

    As we require pkg-config anyway, simply let sane-config use it to make
    it compatible with multilib systems. Previously, sane-config contained
    paths which were different on e.g. x86_64 and i386 which made the 64 and
    32 bit versions conflict if installed in parallel.
---
 tools/sane-config.in |   49 +++++++------------------------------------------
 1 files changed, 7 insertions(+), 42 deletions(-)

diff --git a/tools/sane-config.in b/tools/sane-config.in
index 22c02b5..1fae2e5 100644
--- a/tools/sane-config.in
+++ b/tools/sane-config.in
@@ -7,31 +7,10 @@
 PACKAGE="@PACKAGE@"
 scriptname="sane-config"
 
-LINKER_RPATH="@LINKER_RPATH@"
-
 prefix="@prefix@"
 exec_prefix="@exec_prefix@"
 
-LDFLAGS="@LDFLAGS@ @GPHOTO2_LDFLAGS@"
-LIBS="@LIBS@ @DL_LIBS@ @LIBV4L_LIBS@ @MATH_LIB@ @TIFF_LIBS@ @JPEG_LIBS@ @GPHOTO2_LIBS@ @SOCKET_LIBS@ @AVAHI_LIBS@ @USB_LIBS@ @SCSI_LIBS@ @RESMGR_LIBS@"
-pkgincludedir="@pkgincludedir@"
-pkglibdir="@pkglibdir@"
-includedir="@includedir@"
-mandir="@mandir@"
-infodir="@infodir@"
-libdir="@libdir@"
-localstatedir="@localstatedir@"
-sysconfdir="@sysconfdir@"
-datarootdir="@datarootdir@"
-datadir="@datadir@"
-libexecdir="@libexecdir@"
-sbindir="@sbindir@"
-bindir="@bindir@"
-#${prefix}
-#exec_prefix_set=no
-srcdir="@srcdir@"
-top_srcdir="@top_srcdir@"
-cflags=
+pkgconfig_package=sane-backends
 
 usage ()
 {
@@ -60,7 +39,7 @@ if test $# -gt 0; then
       if test $# -eq 1; then
         usage
       elif test $# -eq 2; then
-        case $2 in 
+        case $2 in
           --cflags)
             echo "Usage: $0 --cflags"
             echo "  Print C compiler flags for compiling code that uses SANE."
@@ -85,33 +64,19 @@ if test $# -gt 0; then
       exit 1
       ;;
     --ldflags)
-
-      if test -z "$LINKER_RPATH"; then
-        echo "-L${libdir} @LDFLAGS@" 
-      else
-        echo "-L${libdir} @LDFLAGS@ ${LINKER_RPATH}${libdir}"
-      fi
+      pkg-config --libs-only-L "$pkgconfig_package"
       ;;
     --libs)
-      echo "-lsane ${LIBS}"
+      pkg-config --libs "$pkgconfig_package"
       ;;
     --cflags)
-      unique_cflags=
-      if test "${includedir}" != "/usr/include"; then
-        unique_cflags="${unique_cflags} -I${includedir}"
-      fi
-      for i in $cflags; do
-        if test "${i}" != "-I${includedir}"; then
-          unique_cflags="${unique_cflags} $i"
-        fi
-      done
-      echo ${unique_cflags}
+      pkg-config --cflags "$pkgconfig_package"
       ;;
     --prefix)
-      echo ${prefix}
+      echo "${prefix}"
       ;;
     --exec-prefix)
-      echo ${exec_prefix}
+      echo "${exec_prefix}"
       ;;
     *)
       usage
-- 
1.7.6.1