Subject: LT_CONFIG_H contains entire relative path when embedding libltdl in recursive mode

From: Brice Goglin <[email-masked]>
Date: Wed, 22 Aug 2012 21:53:18 +0200

Hello,

I am reporting a problem that we discussed today in the thread starting at
    http://lists.gnu.org/archive/html/libtool/2012-08/msg00010.html

The same behavior exists with libtool 2.2.6b and 2.4.2. Looking at the
git log, it has likely been there for ever.

I am attaching a small testcase. Here's how to use it:

tar xfj bug.tar.bz2
cd bug
autoreconf -ifv
./configure
make
[... fails quickly with...]
libltdl/lt__private.h:35:23: fatal error: mysubdir/config.h: No such file or directory

The issue is that lt__private.h contains #include LT_CONFIG_H and
LT_CONFIG_H is set to the entire relative path given in
AC_CONFIG_HEADER. So the build cannot find it unless -I$(top_builddir)
is added to CPPFLAGS.

>From what was said in today's discussion, automake adds the path to the
config header to CPPFLAGS, so libltdl should just set LT_CONFIG_H to the
config header basename without any path.

The problem can be worked around by modifying the embedder's project
CPPFLAGS as explained above, or by adding this

  AC_CONFIG_COMMANDS_PRE([LT_CONFIG_H=`expr "$LT_CONFIG_H" : '.*/\(.*\)'`])

Thanks
Brice