autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

pkg-config and autoconf


From: Larry Siden
Subject: pkg-config and autoconf
Date: 09 Aug 2003 05:01:36 -0400

The man page for pkg-config says:
AUTOCONF MACROS
       PKG_CHECK_MODULES(VARIABLEBASE,MODULELIST[,ACTION-IF-FOUND,[ACTION-IF-NOT-FOUND]])

              The  macro  PKG_CHECK_MODULES  can  be used in configure.in to check whether
              modules exist. A typical usage would be:
               PKG_CHECK_MODULES(MYSTUFF, gtk+-2.0 >= 1.3.5 libxml = 1.8.4)

              This would result in MYSTUFF_LIBS and MYSTUFF_CFLAGS substitution variables,
              set  to the libs and cflags for the given module list.  If a module is miss-
              ing or has the wrong version, by default configure will abort  with  a  mes-
              sage.  To  replace  the  default  action,  specify  an  ACTION-IF-NOT-FOUND.
              PKG_CHECK_MODULES will not print any error messages if you specify your  own
              ACTION-IF-NOT-FOUND.   However, it will set the variable MYSTUFF_PKG_ERRORS,
              which you can use to display what went wrong.

              If you want to use MYSTUFF_LIBS and MYSTUFF_CFLAGS as Makefile.am  variables
              (i.e.  $(MYSTUFF_LIBS))  then you have to add AC_SUBST(MYSTUFF_LIBS) to your
              configure.in so automake can find the variable. You don't need to do this if
              you   use   the   @MYSTUFF_LIBS@  syntax  in  your  Makefile.am  instead  of
              $(MYSTUFF_LIBS).

However, autoconf 2.57 doesn't seem to recognize the PKG_CHECK_MODULES macro.  In addition, the conventional name "configure.in" has been replaced by "configure.ac", suggesting that this document may be refering to an earlier version of autoconf.  If so, can someone tell me how I can use pkg-config with the latest version of autoconf?

I am publishing a library that depends on several other non-standard (not part of the C/C++ standard) libraries.  Instead of forcing the package builder (my client/user) to specify the locations of the header files for these libraries on the ./configure command line (e.g. "./configure CPPFLAGS=-I..."), I would like for the configure script to discover where the corresponding include directories are located on the user's/build machine, if possible, using pkg-config.  How can this be accomplished?  I'm still a novice with the GNU build tools.

Thanks in adv.,
Larry Siden
reply via email to

[Prev in Thread] Current Thread [Next in Thread]