4

I have two projects being built using Automake. Here are simplified versions of the Automake.amS:

AM_CPPFLAGS = -I/some/include_path
lib_LTLIBRARIES = libfoo.la
libfoo_la_SOURCES = foo.cpp
libegfconfig_la_LIBADD = -lxml2

and

AM_CPPFLAGS = -I/some/include_path # I want this to happen implicitly   
lib_LTLIBRARIES = libbar.la     
libbar_la_SOURCES = bar.cpp
libbar_la_LIBADD = $(top_builddir)/some/path/libfoo.la

The second file only has to specify the additional include path because bar.cpp includes foo.hpp which includes something from /some/include_path. I would like the second project to implicitly add the additional include path based on the fact that the first project does so and is a dependency.

Is this possibly?

deuberger
  • 3,578
  • 6
  • 31
  • 33

3 Answers3

1

Putting include paths into Makefile.am is not a good idea. If the user has installed the headers in a non-standard location, then let the user tell the configury about that by adding the appropriate -I clause to CPPFLAGS, either on the command line to configure or in a CONFIG_SITE. It sounds like what you really want to do is put

CPPFLAGS=-I/some/include_path

either in /usr/local/share/config.site or in $CONFIG_SITE, and not include it in the Makefile.am of either of your projects.

William Pursell
  • 204,365
  • 48
  • 270
  • 300
0

No, this is not possible with Automake.

adl
  • 15,627
  • 6
  • 51
  • 65
0

Well, pkg-config is usually used with autotools projects

Example:

gcc -o test test.c $(pkg-config --libs --cflags libpng)
sehe
  • 374,641
  • 47
  • 450
  • 633