sane-backends/sane-backends-1.0.20-pkgconfig.patch
2010-02-26 17:34:24 +00:00

212 lines
6.1 KiB
Diff

From ce4539752ed502cb1a5e10fa47890f42db964472 Mon Sep 17 00:00:00 2001
From: Nils Philippsen <nils@redhat.com>
Date: Fri, 26 Feb 2010 18:20:41 +0100
Subject: [PATCH] patch: pkgconfig
Squashed commit of the following:
commit 1f0e85c705a42c7e6ccd938eaad69f531c63f63d
Author: Nils Philippsen <nils@redhat.com>
Date: Fri Feb 26 17:51:14 2010 +0100
pkgconfig file is data
commit 52ef5f47ccc0128c78ab3ad38ac7b7918dd7ac88
Author: Nils Philippsen <nils@redhat.com>
Date: Wed Jun 17 13:09:51 2009 +0200
make sane-config multilib-aware on Linux
commit 7787640dd567b93dd0a458fd5fb662bb7b85ff36
Author: Nils Philippsen <nils@redhat.com>
Date: Fri Jun 5 12:55:39 2009 +0200
use pkg-config in sane-config
---
configure.in | 3 ++
tools/Makefile.am | 14 +++++++++-
tools/sane-backends.pc.in | 14 ++++++++++
tools/sane-config.in | 64 +++++++++++++++++++++++++++++++++++----------
4 files changed, 80 insertions(+), 15 deletions(-)
create mode 100644 tools/sane-backends.pc.in
diff --git a/configure.in b/configure.in
index 126edbf..7199c44 100644
--- a/configure.in
+++ b/configure.in
@@ -161,6 +161,8 @@ AC_CHECK_HEADER(resmgr.h,[
rsm_open_device,[
AC_DEFINE(HAVE_RESMGR,1,[define if you have the resmgr library])
LIBS="$LIBS -lresmgr"
+ RESMGR_LIB="-lresmgr"
+ AC_SUBST(RESMGR_LIB)
]
)
])
@@ -673,6 +675,7 @@ AC_CONFIG_FILES([Makefile lib/Makefile sanei/Makefile frontend/Makefile \
japi/Makefile backend/Makefile include/Makefile doc/Makefile \
po/Makefile testsuite/Makefile tools/Makefile doc/doxygen-sanei.conf])
AC_CONFIG_FILES([tools/sane-config], [chmod a+x tools/sane-config])
+AC_CONFIG_FILES([tools/sane-backends.pc])
AC_OUTPUT
dnl ***********************************************************************
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 0932e45..b7fa670 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -7,6 +7,10 @@
AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_builddir)/include \
-I$(top_srcdir)/include
+SUFFIXES = .pc.in .pc
+
+pkgconfigdir = ${libdir}/pkgconfig
+
bin_PROGRAMS = sane-find-scanner gamma4scanimage
noinst_PROGRAMS = sane-desc umax_pp
@@ -26,8 +30,14 @@ noinst_SCRIPTS = $(HOTPLUG)
BUILT_SOURCES = $(HOTPLUG_DIR)
CLEANFILES = $(bin_SCRIPTS) $(dist_noinst_SCRIPTS)
+pkgconfig_DATA = sane-backends.pc
+
+.pc.in.pc:
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
EXTRA_DIST = check-po.awk libtool-get-dll-ext mustek600iin-off.c \
- RenSaneDlls.cmd README xerox
+ RenSaneDlls.cmd README xerox sane-backends.pc.in
sane_find_scanner_SOURCES = sane-find-scanner.c check-usb-chip.c \
../backend/sane_strstatus.c
@@ -72,5 +82,7 @@ hal/libsane.fdi: $(wildcard ${top_srcdir}/doc/descriptions/*.desc) $(wildcard ${
@./sane-desc -m hal -s ${top_srcdir}/doc/descriptions:${top_srcdir}/doc/descriptions-external \
-d 0 > $@
+sane-backends.pc: $(top_builddir)/config.status
+
clean-local:
rm -f $(HOTPLUG)
diff --git a/tools/sane-backends.pc.in b/tools/sane-backends.pc.in
new file mode 100644
index 0000000..fb64e3b
--- /dev/null
+++ b/tools/sane-backends.pc.in
@@ -0,0 +1,14 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+pc_libs=@RESMGR_LIB@ @DL_LIBS@ @IEEE1284_LIBS@ @PTHREAD_LIBS@ @JPEG_LIBS@ @USB_LIBS@
+pc_reqs=libusb
+
+Name: SANE Backends
+Description: Backends for SANE, the universal scanner interface
+Version: @VERSION@
+Requires: ${pc_reqs}
+Libs: -L${libdir} -lsane ${pc_libs}
+Cflags:
diff --git a/tools/sane-config.in b/tools/sane-config.in
index 85add1a..c0450d4 100644
--- a/tools/sane-config.in
+++ b/tools/sane-config.in
@@ -18,7 +18,7 @@ pkglibdir="@pkglibdir@"
includedir="@includedir@"
mandir="@mandir@"
infodir="@infodir@"
-libdir="@libdir@"
+#libdir=
localstatedir="@localstatedir@"
sysconfdir="@sysconfdir@"
datarootdir="@datarootdir@"
@@ -32,6 +32,30 @@ 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
+ *64)
+ 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
@@ -85,26 +109,38 @@ if test $# -gt 0; then
;;
--ldflags)
- if test -z "$LINKER_RPATH"; then
- echo "-L${libdir}"
+ if test "x$use_pkgconfig" = "x0"; then
+ if test -z "$LINKER_RPATH"; then
+ echo "-L${libdir}"
+ else
+ echo "-L${libdir} ${LINKER_RPATH}${libdir}"
+ fi
else
- echo "-L${libdir} ${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.6.6.1