Requires.private with optional dependencies?
jefdriesen at hotmail.com
Fri Sep 23 03:59:02 PDT 2011
I have a library that depends on another library (libusb) for its implementation. My understanding is that I need to add the libusb library to the "Requires.private" of my pkg-config file. So far no problem, but what if the libusb dependency is optional?
My configure.ac file contains:
# Checks for USB support.
PKG_CHECK_MODULES([LIBUSB], [libusb-1.0], [have_libusb=yes], [have_libusb=no])
if test "$have_libusb" = "yes"; then
AC_DEFINE([HAVE_LIBUSB], , [libusb support])
With this I can use $(LIBUSB_CFLAGS) and $(LIBUSB_LIBS) in the Makefile.am and HAVE_LIBUSB in the source code. But how should I write th *.pc.in file for m library? Obviously I can't just write:
Is the correct way to add this line inside the if statement above:
And then use this line in the *.pc.in file:
More information about the pkg-config