Hi Ben, > +uninstall-hook: uninstall-relocwrapper > +uninstall-relocwrapper: > +if RELOCATABLE_VIA_LD > + @: > +else > + if test $(RELOCATABLE) = yes; then \ > + case '$(EXEEXT)' in \ > + .bin*) ;; \ > + *) $(MAKE) uninstall EXEEXT=.bin$(EXEEXT) ;; \ > + esac; \ > + fi > +endif
Hmm, I don't like targets that contain empty commands in the default case (when no relocatability is requested): it looks like bloat. I'm adding a conditional 'RELOCATABLE_VIA_WRAPPER' that should allow you to simplify this code. Btw, in gnulib contributions, please indent shell statements by 2 spaces, not 4 spaces. > --- a/doc/relocatable-maint.texi > +++ b/doc/relocatable-maint.texi > @@ -145,6 +145,14 @@ foo_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)` > endif > @end example > > +Also, only in the @file{Makefile.am} at the top level of your source > +tree, add the following. Replace @samp{build-aux}, if necessary, by > +the directory where @file{gnulib-tool} places auxiliary build tools: > + > +...@example > +include build-aux/relocwrapper.am > +...@end example I would prefer to avoid Makefile.am fragments and 'include' statements. The reason is that here we start to get dependencies on the file layout of the package. The automake documentation says: There are two forms of `include': `include $(srcdir)/file' Include a fragment that is found relative to the current source directory. `include $(top_srcdir)/file' Include a fragment that is found relative to the top source directory. and your example is not one of these. Then, if the package's configure.ac invokes AC_CONFIG_AUX_DIR, the string 'build-aux/' needs to be replaced accordingly. This does not make it easier for the package maintainer. Instead, I would better see an AC_SUBSTed and AM_SUBST_NOTMAKEd variable that expands to uninstall-hook: if RELOCATABLE_VIA_WRAPPER is false, and to uninstall-hook: uninstall-relocwrapper uninstall-relocwrapper: ; case '$(EXEEXT)' in .bin*) ;; *) $(MAKE) $(AM_MAKEFLAGS) uninstall EXEEXT=.bin$(EXEEXT) ;; esac if RELOCATABLE_VIA_WRAPPER is true. Unfortunately, I don't see how to reduce this to a single line; this would make it unnecessary to rely on AM_SUBST_NOTMAKE - but how? Such a variable could be used in any Makefile.am, without thinking about how to access 'build-aux/'. Btw, make recursions in automake generated Makefile.ins use $(MAKE) $(AM_MAKEFLAGS) not plain $(MAKE) Bruno 2010-06-13 Bruno Haible <br...@clisp.org> relocatable: Make it easier to test whether to install wrappers. * m4/relocatable.m4 (gl_RELOCATABLE_BODY): New automake conditional RELOCATABLE_VIA_WRAPPER. --- m4/relocatable.m4.orig Mon Jun 14 01:52:11 2010 +++ m4/relocatable.m4 Mon Jun 14 01:52:09 2010 @@ -1,4 +1,4 @@ -# relocatable.m4 serial 15 +# relocatable.m4 serial 16 dnl Copyright (C) 2003, 2005-2007, 2009-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -36,6 +36,7 @@ AC_REQUIRE([gl_RELOCATABLE_LIBRARY_BODY]) is_noop=no use_elf_origin_trick=no + use_wrapper=no if test $RELOCATABLE = yes; then # --enable-relocatable implies --disable-rpath enable_rpath=no @@ -58,6 +59,7 @@ RELOCATABLE_LDFLAGS="\"$reloc_ldflags\" \"\$(host)\" \"\$(RELOCATABLE_LIBRARY_PATH)\"" AC_SUBST([RELOCATABLE_LDFLAGS]) else + use_wrapper=yes dnl Unfortunately we cannot define INSTALL_PROGRAM to a command dnl consisting of more than one word - libtool doesn't support this. dnl So we abuse the INSTALL_PROGRAM_ENV hook, originally meant for the @@ -73,6 +75,7 @@ fi AM_CONDITIONAL([RELOCATABLE_VIA_LD], [test $is_noop = yes || test $use_elf_origin_trick = yes]) + AM_CONDITIONAL([RELOCATABLE_VIA_WRAPPER], [test $use_wrapper = yes]) dnl RELOCATABLE_LIBRARY_PATH can be set in configure.ac. Default is empty. AC_SUBST([RELOCATABLE_LIBRARY_PATH])