sane-backends/sane-backends-1.0.22-pkgconfig.patch
Nils Philippsen 4c4b8135b8 version 1.0.22
remove obsolete i18n, xerox-mfp-color-mode, epson2-fixes, open-macro patches
update pkgconfig, udev, docs-utf8, v4l, man-encoding patches
submit patches upstream where this is applicable, add comments
manually install pkg-config file
2011-03-16 18:17:05 +01:00

128 lines
3.5 KiB
Diff

From 867c994d6cb1b750cdaa7589de8d60f24e0738d0 Mon Sep 17 00:00:00 2001
From: Nils Philippsen <nils@redhat.com>
Date: Tue, 15 Mar 2011 14:42:07 +0100
Subject: [PATCH] patch: pkgconfig
Squashed commit of the following:
commit 7101c2b317274a25bb7d0cc459047b16318cb110
Author: Nils Philippsen <nils@redhat.com>
Date: Tue Mar 15 14:41:37 2011 +0100
use pkg-config in sane-config, make it multilib-aware
---
tools/sane-config.in | 69 +++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 54 insertions(+), 15 deletions(-)
diff --git a/tools/sane-config.in b/tools/sane-config.in
index 22c02b5..efa9169 100644
--- a/tools/sane-config.in
+++ b/tools/sane-config.in
@@ -19,7 +19,7 @@ pkglibdir="@pkglibdir@"
includedir="@includedir@"
mandir="@mandir@"
infodir="@infodir@"
-libdir="@libdir@"
+#libdir=
localstatedir="@localstatedir@"
sysconfdir="@sysconfdir@"
datarootdir="@datarootdir@"
@@ -33,6 +33,33 @@ srcdir="@srcdir@"
top_srcdir="@top_srcdir@"
cflags=
+pkgconfig_package=sane-backends
+use_pkgconfig=0
+if test -x "@bindir@/pkg-config" && "@bindir@/pkg-config" --exists "$pkgconfig_package"; then
+ use_pkgconfig=1
+else
+ libdir=
+ if kernel="`uname -s 2>/dev/null`"; then
+ case "$kernel" in
+ Linux)
+ if hw="`uname -i 2>/dev/null`"; then
+ case "$hw" in
+ ia64)
+ # Linux/ia64 uses /usr/lib
+ ;;
+ *64|s390x)
+ libdir="@exec_prefix@/lib64"
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ fi
+ if test "x$libdir" = "x"; then
+ libdir="@exec_prefix@/lib"
+ fi
+fi
+
usage ()
{
echo "Usage: " 1>&2
@@ -60,7 +87,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."
@@ -86,26 +113,38 @@ if test $# -gt 0; then
;;
--ldflags)
- if test -z "$LINKER_RPATH"; then
- echo "-L${libdir} @LDFLAGS@"
+ if test "x$use_pkgconfig" = "x0"; then
+ if test -z "$LINKER_RPATH"; then
+ echo "-L${libdir} @LDFLAGS@"
+ else
+ echo "-L${libdir} @LDFLAGS@ ${LINKER_RPATH}${libdir}"
+ fi
else
- echo "-L${libdir} @LDFLAGS@ ${LINKER_RPATH}${libdir}"
+ pkg-config --libs-only-L "$pkgconfig_package"
fi
;;
--libs)
- echo "-lsane ${LIBS}"
+ if test "x$use_pkgconfig" = "x0"; then
+ echo "-lsane ${LIBS}"
+ else
+ pkg-config --libs "$pkgconfig_package"
+ fi
;;
--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"
+ if test "x$use_pkgconfig" = "x0"; then
+ unique_cflags=
+ if test "${includedir}" != "/usr/include"; then
+ unique_cflags="${unique_cflags} -I${includedir}"
fi
- done
- echo ${unique_cflags}
+ for i in $cflags; do
+ if test "${i}" != "-I${includedir}"; then
+ unique_cflags="${unique_cflags} $i"
+ fi
+ done
+ echo ${unique_cflags}
+ else
+ pkg-config --cflags "$pkgconfig_package"
+ fi
;;
--prefix)
echo ${prefix}
--
1.7.4