From d4de93e6e93583f65d5d0ed535c836e1755a0329 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 5 Oct 2010 11:50:57 +0100 Subject: Populate the pkg-config Libs.private field --- configure.ac | 15 +++++++++++---- libusb-1.0.pc.in | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 7e544f0..1ca7eb7 100644 --- a/configure.ac +++ b/configure.ac @@ -37,6 +37,7 @@ AC_DEFINE([_GNU_SOURCE], [], [Use GNU extensions]) AM_MAINTAINER_MODE AC_MSG_CHECKING([operating system]) +PC_LIBS_PRIVATE= case $host in *-linux*) AC_DEFINE(OS_LINUX, [], [Linux backend]) @@ -44,9 +45,11 @@ case $host in AC_DEFINE([THREADS_POSIX], [], [Use Posix Threads]) AC_MSG_RESULT([Linux]) backend="linux" - AC_CHECK_LIB(rt, clock_gettime) + AC_CHECK_LIB(rt, clock_gettime, PC_LIBS_PRIVATE="-lrt") + LIBS="${LIBS} ${PC_LIBS_PRIVATE}" threads="posix" THREAD_CFLAGS="-pthread" + PC_LIBS_PRIVATE="${PC_LIBS_PRIVATE} -pthread" AM_CFLAGS="-std=gnu99" AM_LDFLAGS="" ;; @@ -60,7 +63,8 @@ case $host in threads="posix" THREAD_CFLAGS="-pthread" AM_CFLAGS="-std=gnu99" - AM_LDFLAGS="-Wl,-framework -Wl,IOKit -Wl,-framework -Wl,CoreFoundation -Wl,-prebind -no-undefined" + PC_LIBS_PRIVATE="-Wl,-framework,IOKit -Wl,-framework,CoreFoundation -Wl,-prebind -no-undefined -pthread" + AM_LDFLAGS=${PC_LIBS_PRIVATE} ;; *-mingw*) AC_DEFINE(OS_WINDOWS, [], [Windows backend]) @@ -69,7 +73,8 @@ case $host in backend="windows" threads="windows" create_import_lib="yes" - LIBS="-lsetupapi -lole32 -ladvapi32" + PC_LIBS_PRIVATE="-lsetupapi -lole32 -ladvapi32" + LIBS="${LIBS} ${PC_LIBS_PRIVATE}" # -avoid-version to avoid a naming scheme such as libusb-0.dll AM_LDFLAGS="-no-undefined -avoid-version -Wl,--add-stdcall-alias" AM_CFLAGS="-std=c99" @@ -83,7 +88,8 @@ case $host in AC_MSG_RESULT([Windows]) backend="windows" threads="posix" - LIBS="-lsetupapi -lole32 -ladvapi32" + PC_LIBS_PRIVATE="-lsetupapi -lole32 -ladvapi32" + LIBS="${LIBS} ${PC_LIBS_PRIVATE}" AM_CFLAGS="-std=c99" AM_LDFLAGS="-no-undefined -avoid-version" AC_CHECK_TOOL(RC, windres, no) @@ -91,6 +97,7 @@ case $host in *) AC_MSG_ERROR([unsupported operating system]) esac +AC_SUBST(PC_LIBS_PRIVATE) AM_CONDITIONAL([OS_LINUX], [test "x$backend" = "xlinux"]) AM_CONDITIONAL([OS_DARWIN], [test "x$backend" = "xdarwin"]) diff --git a/libusb-1.0.pc.in b/libusb-1.0.pc.in index dd6bde0..0abb16b 100644 --- a/libusb-1.0.pc.in +++ b/libusb-1.0.pc.in @@ -7,5 +7,6 @@ Name: libusb-1.0 Description: C API for USB device access from Linux userspace Version: @VERSION@ Libs: -L${libdir} -lusb-1.0 +Libs.private: @PC_LIBS_PRIVATE@ Cflags: -I${includedir}/libusb-1.0 -- cgit v1.2.1