Reuben Thomas <r...@sc3d.org> writes: > I just realised that I never had this working properly, and I track the > problem all the way back to the gnulib manual. In the line: > > > echo "$gettext_dir/" \ > > should that not rather be "@gettext_dir@"? If not, then where does gettext_dir > get its value? It's not mentioned previously in the example script, and it's > not mentioned in relocatable.sh.in, as far as I can see.
This is confusing, so I spent a few minutes looking around. I believe that this comes directly from gettext-tools/misc/gettextize.in in GNU gettext. That script initializes gettext_dir in a stanza near the top, as: # Set variables # - gettext_dir directory where the sources are stored. prefix="@prefix@" datarootdir="@datarootdir@" gettext_dir="@datadir@/gettext" and then much later relocates it as: if test "@RELOCATABLE@" = yes; then exec_prefix="@exec_prefix@" bindir="@bindir@" orig_installdir="$bindir" # see Makefile.am's *_SCRIPTS variables func_find_curr_installdir # determine curr_installdir func_find_prefixes # Relocate the directory variables that we use. gettext_dir=`echo "$gettext_dir/" | sed -e "s%^${orig_installprefix}/%${curr_installprefix}/%" | sed -e 's,/$,,'` fi So, here gettext_dir is an example. In reality, your script might want to relocate any installation directory or directories, but it will probably not want to relocate that particular directory (because you are probably not writing GNU gettext). I think that the following change to Gnulib would clarify. I have not actually tested the shell code it suggests, although I probably should. Will you take a look at it? diff --git a/doc/relocatable-maint.texi b/doc/relocatable-maint.texi index 58160cf..86d1438 100644 --- a/doc/relocatable-maint.texi +++ b/doc/relocatable-maint.texi @@ -122,12 +122,20 @@ if test "@@RELOCATABLE@@" = yes; then orig_installdir="$bindir" # see Makefile.am's *_SCRIPTS variables func_find_curr_installdir # determine curr_installdir func_find_prefixes - # Relocate the directory variables that we use. - gettext_dir=` - echo "$gettext_dir/" \ + relocate () { + echo "$1/" \ | sed -e "s%^$@{orig_installprefix@}/%$@{curr_installprefix@}/%" \ - | sed -e 's,/$,,'` + | sed -e 's,/$,,' + } +else + relocate () { + echo "$1" + } fi + +# Get some relocated directory names. +sysconfdir=`relocate "@@sysconfdir@@"` +some_datadir=`relocate "@@datadir@@/something"` @end example You must adapt the definition of @code{orig_installdir}, depending on