]>
Commit | Line | Data |
---|---|---|
11eadc86 | 1 | From de99bb00b0084e8a1862398270278a14e099b22b Mon Sep 17 00:00:00 2001 |
ed0a9fda | 2 | From: Nils Philippsen <nils@redhat.com> |
11eadc86 | 3 | Date: Wed, 5 May 2010 13:23:40 +0200 |
ed0a9fda SS |
4 | Subject: [PATCH] patch: pkgconfig |
5 | ||
6 | Squashed commit of the following: | |
7 | ||
11eadc86 | 8 | commit d615848c499842c5923c3274370d2536dc650916 |
ed0a9fda SS |
9 | Author: Nils Philippsen <nils@redhat.com> |
10 | Date: Fri Feb 26 17:51:14 2010 +0100 | |
11 | ||
12 | pkgconfig file is data | |
11eadc86 | 13 | (cherry picked from commit 1f0e85c705a42c7e6ccd938eaad69f531c63f63d) |
ed0a9fda | 14 | |
11eadc86 SS |
15 | Signed-off-by: Nils Philippsen <nils@redhat.com> |
16 | ||
17 | commit 119d5af1ddd82dac034d0106a1d86b6d7564f25e | |
ed0a9fda SS |
18 | Author: Nils Philippsen <nils@redhat.com> |
19 | Date: Wed Jun 17 13:09:51 2009 +0200 | |
20 | ||
21 | make sane-config multilib-aware on Linux | |
11eadc86 SS |
22 | (cherry picked from commit 52ef5f47ccc0128c78ab3ad38ac7b7918dd7ac88) |
23 | ||
24 | Signed-off-by: Nils Philippsen <nils@redhat.com> | |
ed0a9fda | 25 | |
11eadc86 | 26 | commit 7ee1cbef01d851aca95d86145ac5dda02d9e7354 |
ed0a9fda | 27 | Author: Nils Philippsen <nils@redhat.com> |
11eadc86 | 28 | Date: Wed May 5 10:22:15 2010 +0200 |
ed0a9fda SS |
29 | |
30 | use pkg-config in sane-config | |
31 | --- | |
11eadc86 SS |
32 | tools/Makefile.am | 14 ++++++++++- |
33 | tools/sane-config.in | 66 ++++++++++++++++++++++++++++++++++++++----------- | |
34 | 2 files changed, 64 insertions(+), 16 deletions(-) | |
ed0a9fda | 35 | |
ed0a9fda | 36 | diff --git a/tools/Makefile.am b/tools/Makefile.am |
11eadc86 | 37 | index f52a39a..ab4e1b7 100644 |
ed0a9fda SS |
38 | --- a/tools/Makefile.am |
39 | +++ b/tools/Makefile.am | |
40 | @@ -7,6 +7,10 @@ | |
41 | AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_builddir)/include \ | |
42 | -I$(top_srcdir)/include | |
43 | ||
44 | +SUFFIXES = .pc.in .pc | |
45 | + | |
46 | +pkgconfigdir = ${libdir}/pkgconfig | |
47 | + | |
48 | bin_PROGRAMS = sane-find-scanner gamma4scanimage | |
49 | noinst_PROGRAMS = sane-desc umax_pp | |
50 | ||
51 | @@ -26,8 +30,14 @@ noinst_SCRIPTS = $(HOTPLUG) | |
52 | BUILT_SOURCES = $(HOTPLUG_DIR) | |
53 | CLEANFILES = $(bin_SCRIPTS) $(dist_noinst_SCRIPTS) | |
54 | ||
55 | +pkgconfig_DATA = sane-backends.pc | |
56 | + | |
57 | +.pc.in.pc: | |
58 | + cd $(top_builddir) \ | |
59 | + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status | |
60 | + | |
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 | |
64 | ||
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 \ | |
69 | -d 0 > $@ | |
70 | ||
71 | +sane-backends.pc: $(top_builddir)/config.status | |
72 | + | |
73 | clean-local: | |
74 | rm -f $(HOTPLUG) | |
ed0a9fda | 75 | diff --git a/tools/sane-config.in b/tools/sane-config.in |
11eadc86 | 76 | index 22c02b5..a9ce6fb 100644 |
ed0a9fda SS |
77 | --- a/tools/sane-config.in |
78 | +++ b/tools/sane-config.in | |
11eadc86 | 79 | @@ -19,7 +19,7 @@ pkglibdir="@pkglibdir@" |
ed0a9fda SS |
80 | includedir="@includedir@" |
81 | mandir="@mandir@" | |
82 | infodir="@infodir@" | |
83 | -libdir="@libdir@" | |
84 | +#libdir= | |
85 | localstatedir="@localstatedir@" | |
86 | sysconfdir="@sysconfdir@" | |
87 | datarootdir="@datarootdir@" | |
11eadc86 | 88 | @@ -33,6 +33,30 @@ srcdir="@srcdir@" |
ed0a9fda SS |
89 | top_srcdir="@top_srcdir@" |
90 | cflags= | |
91 | ||
92 | +pkgconfig_package=sane-backends | |
93 | +use_pkgconfig=0 | |
94 | +if test -x "@bindir@/pkg-config" && "@bindir@/pkg-config" --exists "$pkgconfig_package"; then | |
95 | + use_pkgconfig=1 | |
96 | +else | |
97 | + libdir= | |
98 | + if kernel="`uname -s 2>/dev/null`"; then | |
99 | + case "$kernel" in | |
100 | + Linux) | |
101 | + if hw="`uname -i 2>/dev/null`"; then | |
102 | + case "$hw" in | |
103 | + *64) | |
104 | + libdir="@exec_prefix@/lib64" | |
105 | + ;; | |
106 | + esac | |
107 | + fi | |
108 | + ;; | |
109 | + esac | |
110 | + fi | |
111 | + if test "x$libdir" = "x"; then | |
112 | + libdir="@exec_prefix@/lib" | |
113 | + fi | |
114 | +fi | |
115 | + | |
116 | usage () | |
117 | { | |
118 | echo "Usage: " 1>&2 | |
11eadc86 SS |
119 | @@ -60,7 +84,7 @@ if test $# -gt 0; then |
120 | if test $# -eq 1; then | |
121 | usage | |
122 | elif test $# -eq 2; then | |
123 | - case $2 in | |
124 | + case $2 in | |
125 | --cflags) | |
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 | |
ed0a9fda SS |
129 | ;; |
130 | --ldflags) | |
131 | ||
132 | - if test -z "$LINKER_RPATH"; then | |
11eadc86 | 133 | - echo "-L${libdir} @LDFLAGS@" |
ed0a9fda SS |
134 | + if test "x$use_pkgconfig" = "x0"; then |
135 | + if test -z "$LINKER_RPATH"; then | |
11eadc86 | 136 | + echo "-L${libdir} @LDFLAGS@" |
ed0a9fda | 137 | + else |
11eadc86 | 138 | + echo "-L${libdir} @LDFLAGS@ ${LINKER_RPATH}${libdir}" |
ed0a9fda SS |
139 | + fi |
140 | else | |
11eadc86 | 141 | - echo "-L${libdir} @LDFLAGS@ ${LINKER_RPATH}${libdir}" |
ed0a9fda SS |
142 | + pkg-config --libs-only-L "$pkgconfig_package" |
143 | fi | |
144 | ;; | |
145 | --libs) | |
146 | - echo "-lsane ${LIBS}" | |
147 | + if test "x$use_pkgconfig" = "x0"; then | |
148 | + echo "-lsane ${LIBS}" | |
149 | + else | |
150 | + pkg-config --libs "$pkgconfig_package" | |
151 | + fi | |
152 | ;; | |
153 | --cflags) | |
154 | - unique_cflags= | |
155 | - if test "${includedir}" != "/usr/include"; then | |
156 | - unique_cflags="${unique_cflags} -I${includedir}" | |
157 | - fi | |
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 | |
162 | + unique_cflags= | |
163 | + if test "${includedir}" != "/usr/include"; then | |
164 | + unique_cflags="${unique_cflags} -I${includedir}" | |
165 | fi | |
166 | - done | |
167 | - echo ${unique_cflags} | |
168 | + for i in $cflags; do | |
169 | + if test "${i}" != "-I${includedir}"; then | |
170 | + unique_cflags="${unique_cflags} $i" | |
171 | + fi | |
172 | + done | |
173 | + echo ${unique_cflags} | |
174 | + else | |
175 | + pkg-config --cflags "$pkgconfig_package" | |
176 | + fi | |
177 | ;; | |
178 | --prefix) | |
179 | echo ${prefix} | |
180 | -- | |
181 | 1.6.6.1 | |
182 |