mi...@gnu.org wrote: > Jef Driesen writes: >> Isn't it easier to just check for the presence of the header file and/or >> the library file, avoiding pkg-config entirely? > > Well, I'd prefer not to guess when possible, and not using pkg-config > for a package that wants you to use it means you end up guessing at the > proper locations/settings. Maybe this often works, but why risk it when > it's not necessary?
I'm aware of the advantage of using pkg-config. I even supply the *.pc files for my own projects. But the point is that if I want to support systems that don't have pkg-config installed (like Mac OS X in my case), I have to provide a fallback with manual detection anyway. So why not skip pkg-config entirely? Most libraries have only very standard stuff in there pkg-config file, like this: Libs: -L${libdir} -lusb-1.0 Cflags: -I${includedir}/libusb-1.0 And I could simply replace the pkg-config based check with something like: AC_CHECK_HEADER([libusb-1.0/libusb.h], AC_CHECK_LIB([usb-1.0], [libusb_init], [have_libusb=yes], [have_libusb=no]), [have_libusb=no]) if test "$have_libusb" = "yes"; then AC_DEFINE([HAVE_LIBUSB], [1], [Define if you have the libusb library and header]) AC_SUBST([LIBUSB_CFLAGS], []) AC_SUBST([LIBUSB_LIBS], [-lusb-1.0]) fi Jef