[Top][All Lists]

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

AC_CONFIG_SUBDIRS and pkg-config

From: Richard Ash
Subject: AC_CONFIG_SUBDIRS and pkg-config
Date: Fri, 23 May 2008 22:31:39 +0100

I seem to have hit a fundamental problem with the way AC_CONFIG_SUBDIRS
that seems to make it most of the way to useless if you want to also use
pkg-config. Basically, it runs the configure scripts in sub-directories
after my main configure script has finished, which is useless because I
want information from those subsidiary configure script to decide how to
build my application.

I'm using AC_CONFIG_SUBDIRS because as well as my application which I'm
configuring directly, I also have a number of sub-directories which
contain libraries that are required to build the application (some are
actually external, others hope to be in the longer term).

In order to use these libraries I will need to add compiler and linker
flags to locate the library and the header files. It's the job of
configure to collect this information so that it can write it into the
Makefiles. This means that when configure (for the application) runs,
the information for the sub-directories must already exist. If the
libraries were installed on the system this is no problem - just use the
PKG_CHECK_MODULES macro. The problem comes when I want to use the copy
of the library that is in the same source tree as my application. I can
easily set the PKG_CONFIG_PATH environment variable so that pkg-config
looks in the right place for the library. It will even know to prefer
the uninstalled version of the library and use those paths not the final
install paths (I'm assuming static linkage). The problem is that the
pkg-config file won't exist to be used.

Because the paths pkg-config file depend on the prefix used to install
the library, and the libraries listed depend on the libs needed to build
the library, almost all library writers write a file, and use
configure to create the pkg-config file from that, so that all the
information from configure can be put in the pkg-config file. This means
that I can't get the paths for the local copy of the library unless it
has already been configured, and the local copy isn't configured until I
have finished configuring this package.

So all I want is a version of AC_CONFIG_SUBDIRS that runs the configure
script when I ask it to (having worked out when the right time is), not
when it chooses at the end of the script. Do I have to create this from
scratch, or am I missing something obvious?

There are various possible hacks, but all of them either make it
impossible to do out-of-source-tree builds, or push the problem down to
the Makefile instead.

Richard Ash
Audacity developer

reply via email to

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