[Top][All Lists]

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

using builddir/srcdir at configure time

From: Karl Berry
Subject: using builddir/srcdir at configure time
Date: Sat, 25 Nov 2006 16:19:05 +0100

I am wondering if there's a reasonable way to use the top_builddir and
top_srcdir values at configure time.  As in:
CPPFLAGS="$CPPFLAGS -I$top_builddir/whatever"

When simply used as above, the value is not defined.  It seems that the
value for these variables only gets defined at the end, for output (or
for recursive --help's).

I guess I could simply duplicate the code which computes them, but of
course that is not very appealing.  Is there a better way?

That's the question.  Here is the background, in case a better way comes
to mind:

- TeX Live ( is a large TeX distribution,
  including many programs, which depend on many libraries, notably
  including the TeX file-searching library kpathsea.
- TL has thousands of users, and they almost all install binaries,
  rather than compile from source.

- Of course kpathsea is itself part of TeX Live, and we need to use the
  version that is included there, not whatever is randomly installed on
  the build system or the end-user's system.

- So a program TL includes, such as lcdf-typetools
  (, has a configure option
  --enable-tetex-build, which sets up CPPFLAGS and LDFLAGS to use the
  local kpathsea in the build tree, which we have been doing like this:

if test "x$enable_tetex_build" = xyes; then
 CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/../../texk -I\$(top_srcdir)/../../texk"
 LDFLAGS="$LDFLAGS -L\$(top_builddir)/../../texk/kpathsea/.libs"

- The exact paths there aren't important, they just reflect the structure
  of our source hierarchy.  The important thing is that we have to find
  another directory relative to top_builddir/srcddir.

- The quoting there makes the values in the Makefile use the Make variables:
CPPFLAGS =  -I$(top_builddir)/../../texk -I$(top_srcdir)/../../texk

- However, since "$(top_builddir)" is used as a literal string, of
  course that's not going to be found in the -I list, so any further
  configure tests that need those values are going to fail.  For example:
AC_CHECK_DECLS(kpse_opentype_format, :, :, [#include <kpathsea/kpathsea.h>])

- To get around this, we've simply been hardwiring the test results of
  when --enable-tetex-build is given.  But I'm hoping there's a better way.

- None of this is actually specific to kpathsea, there are tons of other
  libraries involved.  It's just easier to discuss a specific example.

If possible, please cc me on any replies.  Thanks in advance for any
suggestions or solutions.


reply via email to

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