On 2012-08-22 18:32 +0200, Brice Goglin wrote: > Le 22/08/2012 16:32, Nick Bowler a écrit : > > On 2012-08-22 15:12 +0200, Brice Goglin wrote: > >> I am working at embedding libltdl inside our project (hwloc, an Open MPI > >> subprojet). Our plugins are not expected to be enabled in the most > >> common cases. So I am trying to see if the libltdl sub-configure could > >> be skipped entirely unless really needed (when plugins are enabled, and > >> libltdl is indeed built). I got the usual failure when I tried to put > >> LTDL_INIT inside a conditional block so I am looking for something else > >> now. > >> > >> Modifying the subdirs variable before AC_OUTPUT seems to work. But this > >> hack may not be safe enough. Is there a better way to do this? > > Use either the "recursive" or "nonrecursive" libltdl styles. Do not use > > "subproject" (the default). Both these styles integrate all the > > configure machinery directly into your main configure script, so there > > may still be some extra checks but they should be fairly low-cost in the > > grand scheme of things (especially compared to subproject!). > > > > You can then use Automake conditionals to control whether or not libltdl > > will be built. > > > > Cheers, > > Thanks a lot! It looks promising, indeed. > > One small problem with this is that it requires -I$(top_builddir) in > CPPFLAGS since it wants to include LT_CONFIG_H=relative/path/config.h > Not sure how this could be improved. Maybe by passing the absolute path > in LT_CONFIG_H? Or by allowing to manually override it?
So you have your config.h in a subdir from the top of your project, e.g., something like AC_CONFIG_HEADERS([some/subdir/config.h]) and libltdl is trying to #include <some/subdir/config.h> ? That sounds like it might be a libltdl bug. Automake will in this case add -Isome/subdir by default, so libltdl should just be be #including <config.h> instead (i.e., not specifying any of the leading directories). Other than adding -I$(top_builddir) to CPPFLAGS, as a workaround you could probably add something like this just before AC_OUTPUT (untested): LT_CONFIG_H=`expr "$LT_CONFIG_H" : '.*/\(.*\)'` Cheers, -- Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/) _______________________________________________ https://lists.gnu.org/mailman/listinfo/libtool