1 From de99bb00b0084e8a1862398270278a14e099b22b Mon Sep 17 00:00:00 2001
2 From: Nils Philippsen <nils@redhat.com>
3 Date: Wed, 5 May 2010 13:23:40 +0200
4 Subject: [PATCH] patch: pkgconfig
6 Squashed commit of the following:
8 commit d615848c499842c5923c3274370d2536dc650916
9 Author: Nils Philippsen <nils@redhat.com>
10 Date: Fri Feb 26 17:51:14 2010 +0100
12 pkgconfig file is data
13 (cherry picked from commit 1f0e85c705a42c7e6ccd938eaad69f531c63f63d)
15 Signed-off-by: Nils Philippsen <nils@redhat.com>
17 commit 119d5af1ddd82dac034d0106a1d86b6d7564f25e
18 Author: Nils Philippsen <nils@redhat.com>
19 Date: Wed Jun 17 13:09:51 2009 +0200
21 make sane-config multilib-aware on Linux
22 (cherry picked from commit 52ef5f47ccc0128c78ab3ad38ac7b7918dd7ac88)
24 Signed-off-by: Nils Philippsen <nils@redhat.com>
26 commit 7ee1cbef01d851aca95d86145ac5dda02d9e7354
27 Author: Nils Philippsen <nils@redhat.com>
28 Date: Wed May 5 10:22:15 2010 +0200
30 use pkg-config in sane-config
32 tools/Makefile.am | 14 ++++++++++-
33 tools/sane-config.in | 66 ++++++++++++++++++++++++++++++++++++++-----------
34 2 files changed, 64 insertions(+), 16 deletions(-)
36 diff --git a/tools/Makefile.am b/tools/Makefile.am
37 index f52a39a..ab4e1b7 100644
38 --- a/tools/Makefile.am
39 +++ b/tools/Makefile.am
41 AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_builddir)/include \
42 -I$(top_srcdir)/include
44 +SUFFIXES = .pc.in .pc
46 +pkgconfigdir = ${libdir}/pkgconfig
48 bin_PROGRAMS = sane-find-scanner gamma4scanimage
49 noinst_PROGRAMS = sane-desc umax_pp
51 @@ -26,8 +30,14 @@ noinst_SCRIPTS = $(HOTPLUG)
52 BUILT_SOURCES = $(HOTPLUG_DIR)
53 CLEANFILES = $(bin_SCRIPTS) $(dist_noinst_SCRIPTS)
55 +pkgconfig_DATA = sane-backends.pc
58 + cd $(top_builddir) \
59 + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
61 EXTRA_DIST = check-po.awk libtool-get-dll-ext mustek600iin-off.c \
62 - RenSaneDlls.cmd README xerox
63 + RenSaneDlls.cmd README xerox sane-backends.pc.in
65 sane_find_scanner_SOURCES = sane-find-scanner.c check-usb-chip.c \
66 ../backend/sane_strstatus.c
67 @@ -72,5 +82,7 @@ hal/libsane.fdi: $(wildcard ${top_srcdir}/doc/descriptions/*.desc) $(wildcard ${
68 @./sane-desc -m hal -s ${top_srcdir}/doc/descriptions:${top_srcdir}/doc/descriptions-external \
71 +sane-backends.pc: $(top_builddir)/config.status
75 diff --git a/tools/sane-config.in b/tools/sane-config.in
76 index 22c02b5..a9ce6fb 100644
77 --- a/tools/sane-config.in
78 +++ b/tools/sane-config.in
79 @@ -19,7 +19,7 @@ pkglibdir="@pkglibdir@"
80 includedir="@includedir@"
85 localstatedir="@localstatedir@"
86 sysconfdir="@sysconfdir@"
87 datarootdir="@datarootdir@"
88 @@ -33,6 +33,30 @@ srcdir="@srcdir@"
89 top_srcdir="@top_srcdir@"
92 +pkgconfig_package=sane-backends
94 +if test -x "@bindir@/pkg-config" && "@bindir@/pkg-config" --exists "$pkgconfig_package"; then
98 + if kernel="`uname -s 2>/dev/null`"; then
101 + if hw="`uname -i 2>/dev/null`"; then
104 + libdir="@exec_prefix@/lib64"
111 + if test "x$libdir" = "x"; then
112 + libdir="@exec_prefix@/lib"
119 @@ -60,7 +84,7 @@ if test $# -gt 0; then
120 if test $# -eq 1; then
122 elif test $# -eq 2; then
126 echo "Usage: $0 --cflags"
127 echo " Print C compiler flags for compiling code that uses SANE."
128 @@ -86,26 +110,38 @@ if test $# -gt 0; then
132 - if test -z "$LINKER_RPATH"; then
133 - echo "-L${libdir} @LDFLAGS@"
134 + if test "x$use_pkgconfig" = "x0"; then
135 + if test -z "$LINKER_RPATH"; then
136 + echo "-L${libdir} @LDFLAGS@"
138 + echo "-L${libdir} @LDFLAGS@ ${LINKER_RPATH}${libdir}"
141 - echo "-L${libdir} @LDFLAGS@ ${LINKER_RPATH}${libdir}"
142 + pkg-config --libs-only-L "$pkgconfig_package"
146 - echo "-lsane ${LIBS}"
147 + if test "x$use_pkgconfig" = "x0"; then
148 + echo "-lsane ${LIBS}"
150 + pkg-config --libs "$pkgconfig_package"
155 - if test "${includedir}" != "/usr/include"; then
156 - unique_cflags="${unique_cflags} -I${includedir}"
158 - for i in $cflags; do
159 - if test "${i}" != "-I${includedir}"; then
160 - unique_cflags="${unique_cflags} $i"
161 + if test "x$use_pkgconfig" = "x0"; then
163 + if test "${includedir}" != "/usr/include"; then
164 + unique_cflags="${unique_cflags} -I${includedir}"
167 - echo ${unique_cflags}
168 + for i in $cflags; do
169 + if test "${i}" != "-I${includedir}"; then
170 + unique_cflags="${unique_cflags} $i"
173 + echo ${unique_cflags}
175 + pkg-config --cflags "$pkgconfig_package"