sane-backends/sane-backends-1.0.19-pkgconfig.patch

292 lines
10 KiB
Diff
Raw Normal View History

diff -U0 sane-backends-20080206/ChangeLog.pkgconfig sane-backends-20080206/ChangeLog
--- sane-backends-20080206/ChangeLog.pkgconfig 2008-02-04 02:20:01.000000000 +0100
+++ sane-backends-20080206/ChangeLog 2008-02-06 11:49:41.000000000 +0100
@@ -0,0 +1,7 @@
+2006-05-16 Nils Philippsen <nphilipp@redhat.com>
+
+ * acinclude.m4 configure.in tools/sane-config.in
+ tools/sane-backends.pc.in tools/Makefile.in: add pkg-config support,
+ re-write sane-config to use pkg-config to avoid multilib problems with
+ conflicting sane-config scripts
+
diff -up sane-backends-20080206/acinclude.m4.pkgconfig sane-backends-20080206/acinclude.m4
--- sane-backends-20080206/acinclude.m4.pkgconfig 2007-11-10 08:12:54.000000000 +0100
+++ sane-backends-20080206/acinclude.m4 2008-02-06 11:49:41.000000000 +0100
@@ -194,6 +194,7 @@ unset param
# Checks for ieee1284 library, needed for canon_pp backend.
AC_DEFUN([SANE_CHECK_IEEE1284],
[
+ AC_SUBST(IEEE1284_LIBS)
AC_CHECK_HEADER(ieee1284.h, [
AC_CACHE_CHECK([for libieee1284 >= 0.1.5], sane_cv_use_libieee1284, [
AC_TRY_COMPILE([#include <ieee1284.h>], [
@@ -206,6 +207,7 @@ AC_DEFUN([SANE_CHECK_IEEE1284],
],)
if test "$sane_cv_use_libieee1284" = "yes" ; then
AC_DEFINE(HAVE_LIBIEEE1284,1,[Define to 1 if you have the `ieee1284' library (-lcam).])
+ AC_SUBST(IEEE1284_LIBS, "-lieee1284")
fi
])
@@ -213,6 +215,7 @@ AC_DEFUN([SANE_CHECK_IEEE1284],
# Checks for pthread support
AC_DEFUN([SANE_CHECK_PTHREAD],
[
+ AC_SUBST(PTHREAD_LIBS)
case "${host_os}" in
darwin*) # currently only enabled on MacOS X
@@ -246,6 +249,7 @@ AC_DEFUN([SANE_CHECK_PTHREAD],
[Define if pthreads should be used instead of forked processes.])
fi
if test "$have_pthread" = "yes" ; then
+ AC_SUBST(PTHREAD_LIBS, "-lpthread")
CPPFLAGS="${CPPFLAGS} -D_REENTRANT"
fi
AC_MSG_CHECKING([whether to enable pthread support])
@@ -259,6 +263,7 @@ AC_DEFUN([SANE_CHECK_PTHREAD],
# GPHOTO2 and dell1600n_net backends.
AC_DEFUN([SANE_CHECK_JPEG],
[
+ AC_SUBST(JPEG_LIBS)
AC_CHECK_LIB(jpeg,jpeg_start_decompress,
[
AC_CHECK_HEADER(jconfig.h,
@@ -271,7 +276,7 @@ AC_DEFUN([SANE_CHECK_JPEG],
sane_correct_jpeg_lib_version_found
#endif
],[sane_cv_use_libjpeg="yes"; LIBS="${LIBS} -ljpeg";
- AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
+ AC_SUBST(JPEG_LIBS, "-ljpeg") AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
],)
],)
])
@@ -425,6 +430,7 @@ AC_CHECK_TYPE(u_long, unsigned long)
# Checks for gphoto2 libs, needed by gphoto2 backend
AC_DEFUN([SANE_CHECK_GPHOTO2],
[
+ AC_SUBST(PC_REQS)
AC_ARG_WITH(gphoto2,
AC_HELP_STRING([--with-gphoto2],
[include the gphoto2 backend @<:@default=yes@:>@]),
@@ -454,6 +460,7 @@ AC_DEFUN([SANE_CHECK_GPHOTO2],
LDFLAGS="$LDFLAGS $GPHOTO2_LDFLAGS"
AC_SUBST(GPHOTO2_LDFLAGS)
+ AC_SUBST(PC_REQS, "libgphoto2 $PC_REQS")
saved_LIBS="${LIBS}"
LIBS="${LIBS} ${GPHOTO2_LIBS}"
diff -up /dev/null sane-backends-20080206/tools/sane-backends.pc.in
--- /dev/null 2008-02-01 17:10:39.395027948 +0100
+++ sane-backends-20080206/tools/sane-backends.pc.in 2008-02-06 11:49:41.000000000 +0100
@@ -0,0 +1,14 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+pc_libs=@RESMGR_LIBS@ @DL_LIB@ @IEEE1284_LIBS@ @PTHREAD_LIBS@ @JPEG_LIBS@ @PC_LIBS@
+pc_reqs=@PC_REQS@
+
+Name: SANE Backends
+Description: Backends for SANE, the universal scanner interface
+Version: @VERSION@
+Requires: ${pc_reqs}
+Libs: -L${libdir} -lsane ${pc_libs}
+Cflags:
diff -up sane-backends-20080206/tools/sane-config.in.pkgconfig sane-backends-20080206/tools/sane-config.in
--- sane-backends-20080206/tools/sane-config.in.pkgconfig 2008-02-06 11:49:41.000000000 +0100
+++ sane-backends-20080206/tools/sane-config.in 2008-02-06 11:52:03.000000000 +0100
@@ -7,31 +7,9 @@
PACKAGE="@PACKAGE@"
scriptname="sane-config"
-LINKER_RPATH=""
-
prefix="@prefix@"
exec_prefix="@exec_prefix@"
-LIBS="@LIBS@ @DL_LIB@"
-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=
-
usage ()
{
echo "Usage: " 1>&2
@@ -84,27 +62,13 @@ if test $# -gt 0; then
exit 1
;;
--ldflags)
-
- if test -z "$LINKER_RPATH"; then
- echo "-L${libdir} @GPHOTO2_LDFLAGS@"
- else
- echo "-L${libdir} @GPHOTO2_LDFLAGS@ ${LINKER_RPATH}${libdir}"
- fi
+ pkg-config --libs-only-L sane-backends
;;
--libs)
- echo "-lsane ${LIBS}"
+ pkg-config --libs sane-backends
;;
--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 sane-backends
;;
--prefix)
echo ${prefix}
diff -up sane-backends-20080206/tools/Makefile.in.pkgconfig sane-backends-20080206/tools/Makefile.in
--- sane-backends-20080206/tools/Makefile.in.pkgconfig 2008-02-03 07:59:36.000000000 +0100
+++ sane-backends-20080206/tools/Makefile.in 2008-02-06 11:49:41.000000000 +0100
@@ -26,6 +26,7 @@ mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
configdir = ${sysconfdir}/sane.d
+pkgconfigdir = ${libdir}/pkgconfig
MKDIR = $(top_srcdir)/mkinstalldirs
INSTALL = @INSTALL@
@@ -74,7 +75,8 @@ LIBLIB = ../lib/liblib.a
DISTFILES = Makefile.in RenSaneDlls.cmd README libtool-get-dll-ext \
mustek600iin-off.c sane-config.in sane-desc.c check-usb-chip.c \
- sane-find-scanner.c umax_pp.c xerox gamma4scanimage.c check-po.awk
+ sane-find-scanner.c umax_pp.c xerox gamma4scanimage.c check-po.awk \
+ sane-backends.pc.in
SUBDIRS = hotplug hotplug-ng udev hal
@@ -88,18 +90,24 @@ SUBDIRS = hotplug hotplug-ng udev hal
all: $(DESTINATIONS)
-install: sane-config sane-find-scanner gamma4scanimage
+install: sane-config sane-backends.pc sane-find-scanner gamma4scanimage
+ $(MKDIR) $(DESTDIR)$(bindir) $(DESTDIR)$(pkgconfigdir)
+ $(INSTALL_DATA) sane-backends.pc $(DESTDIR)$(pkgconfigdir)/sane-backends.pc
$(INSTALL_SCRIPT) sane-config $(DESTDIR)$(bindir)/sane-config
$(INSTALL_PROGRAM) sane-find-scanner $(DESTDIR)$(bindir)/sane-find-scanner
$(INSTALL_PROGRAM) gamma4scanimage $(DESTDIR)$(bindir)/gamma4scanimage
uninstall:
- rm -f $(bindir)/sane-config $(bindir)/sane-find-scanner $(bindir)/gamma4scanimage
+ rm -f $(bindir)/sane-config $(bindir)/sane-find-scanner $(bindir)/gamma4scanimage $(pkgconfigdir)/sane-backends.pc
sane-config: sane-config.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+sane-backends.pc: sane-backends.pc.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
sane-find-scanner: sane-find-scanner.o check-usb-chip.o ../backend/sane_strstatus.lo \
../sanei/sanei_scsi.lo ../sanei/sanei_usb.lo ../sanei/sanei_init_debug.lo \
../sanei/sanei_config.lo
diff -up sane-backends-20080206/configure.in.pkgconfig sane-backends-20080206/configure.in
--- sane-backends-20080206/configure.in.pkgconfig 2008-02-02 13:20:45.000000000 +0100
+++ sane-backends-20080206/configure.in 2008-02-06 11:49:41.000000000 +0100
@@ -52,6 +52,7 @@ AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_CPP
AC_PROG_GCC_TRADITIONAL
+PKG_PROG_PKG_CONFIG
AC_PATH_PROG(SANE_CONFIG_PATH, sane-config, no)
AC_PATH_PROG(MSGFMT, msgfmt$EXEEXT, no)
AC_PATH_PROG(XGETTEXT, xgettext$EXEEXT, no)
@@ -99,6 +100,8 @@ dnl Checks for libraries
dnl ***********************************************************************
SANE_CHECK_DLL_LIB
dnl Checks for Backend libraries.
+_pc_libs_save="$LIBS"
+LIBS=""
AC_CHECK_LIB(m,sqrt)
AC_CHECK_LIB(scsi, scsireq_enter) # FreeBSD needs this
AC_CHECK_LIB(cam, cam_open_device) # FreeBSD 3+ needs this
@@ -109,6 +112,8 @@ if test "`uname`" != "IRIX" -a "`uname`"
AC_SEARCH_LIBS(socket, socket)
AC_SEARCH_LIBS(syslog, syslog be) # OS/2 needs -lsyslog, BeOS needs -lbe
fi
+AC_SUBST(PC_LIBS, "$LIBS")
+LIBS="$LIBS $_pc_libs_save"
SANE_CHECK_JPEG
SANE_CHECK_TIFF
SANE_CHECK_IEEE1284
@@ -139,19 +144,23 @@ AC_CHECK_HEADERS([io/cam/cam.h],,,[#incl
SANE_CHECK_MISSING_HEADERS
+AC_SUBST(RESMGR_LIBS)
AC_CHECK_HEADER(resmgr.h,[
AC_CHECK_LIB(
resmgr,
rsm_open_device,[
AC_DEFINE(HAVE_RESMGR,1,[define if you have the resmgr library])
LIBS="$LIBS -lresmgr"
+ AC_SUBST(RESMGR_LIBS, "-lresmgr")
]
)
])
+AC_SUBST(USBCALLS_LIBS)
AC_CHECK_HEADER(usbcalls.h,[
AC_DEFINE(HAVE_USBCALLS,1,[define if you have the usbcalls library])
LIBS="$LIBS -lusbcalls"
+ AC_SUBST(USBCALLS_LIBS, "-lusbcalls")
],,[
#include <usb.h>
#include <os2.h>])
@@ -279,6 +288,7 @@ if test -c /dev/urandom ; then
fi
dnl libusb on enabled by default (if found)
+AC_SUBST(PC_REQS)
USE_LIBUSB=yes
AC_ARG_ENABLE(libusb,
AC_HELP_STRING([--disable-libusb],
@@ -294,6 +304,10 @@ if test "${ac_cv_header_usb_h}" = "yes"
AC_CHECK_LIB(usb, usb_interrupt_read)
if test "${ac_cv_lib_usb_usb_interrupt_read}" = "yes" ; then
HAVE_LIBUSB="yes"
+ PKG_CHECK_MODULES(LIBUSB, libusb)
+ if test "${LIBUSB_LIBS}"; then
+ AC_SUBST(PC_REQS, "libusb $PC_REQS")
+ fi
fi
fi
@@ -560,6 +574,7 @@ AC_CONFIG_FILES([Makefile lib/Makefile s
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 ***********************************************************************