The manual (gnulib-tool.texi) recommends including both builddir and srcdir into AM_CPPFLAGS (aka INCLUDES if you are using automake 1.9), which makes sense, since some headers come straight from gnulib and live in srcdir, while other headers are generated based on configure results and thus live in builddir. But which order is preferred?
The gnulib manual recommends: AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib But m4 is using the reverse order: AM_CPPFLAGS = -I$(top_srcdir)/lib -I../lib And coreutils has a bug, for forgetting the builddir version (which means it will build in an in-tree build, but probably fail in a VPATH build): AM_CPPFLAGS = -I$(top_srcdir)/lib Is there any specific reason that gnulib recommends builddir (generated files) before srcdir? Consider the ramifications if a file changes location. If it goes from generated to in-place (moves from builddir to srcdir, because it no longer depends on configure results), then favoring builddir first means that in an incremental build where you forget to run 'make clean' before updating gnulib, the stale generated header will be left over in the build tree and be picked up in preference to the new gnulib file. Conversely, if a header goes from in-place to generated, it will no longer live in srcdir, but only in builddir, so it doesn't matter whether you favor builddir or srcdir. Therefore, it seems to me that best practice would be to always favor srcdir first, builddir second. Thoughts, before I submit patches to coreutils and to either gnulib or m4? -- Eric Blake ebl...@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature