From eda03255a875d6ea4d991b54a3960a066dee0038 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Sat, 24 Sep 2011 14:11:10 +0200 Subject: [PATCH] Add the libusb dependency to the pkg-config file. When linking dynamically, the shared library contains a reference to all external dependencies, and the linker can easily resolve them. However when linking statically, all external dependencies have to be specified explicitly. This rule also applies to dependencies that are not exposed through the public api. The pkg-config Requires.private field is used to support both static and dynamic linking correctly. --- configure.ac | 1 + libdivecomputer.pc.in | 1 + 2 files changed, 2 insertions(+) diff --git a/configure.ac b/configure.ac index 71d1468..49ea29c 100644 --- a/configure.ac +++ b/configure.ac @@ -47,6 +47,7 @@ AM_CONDITIONAL([OS_WIN32], [test "$os_win32" = "yes"]) PKG_CHECK_MODULES([LIBUSB], [libusb-1.0], [have_libusb=yes], [have_libusb=no]) if test "$have_libusb" = "yes"; then AC_DEFINE([HAVE_LIBUSB], [1], [libusb support]) + AC_SUBST([DEPENDENCIES], [libusb-1.0]) fi # Checks for IrDA support. diff --git a/libdivecomputer.pc.in b/libdivecomputer.pc.in index ce37b68..b5f1274 100644 --- a/libdivecomputer.pc.in +++ b/libdivecomputer.pc.in @@ -6,5 +6,6 @@ includedir=@includedir@ Name: libdivecomputer Description: A library for communication with various dive computers. Version: @VERSION@ +Requires.private: @DEPENDENCIES@ Libs: -L${libdir} -ldivecomputer Cflags: -I${includedir}/libdivecomputer