Hi all, I have been struggling to make GNU Stow installable via both autotools and a more conventional CPAN-oriented process (since it's written in Perl). I've largely succeeded, but I've realised that I currently have an unreliable method for calculating the path under which `make install' should put Perl modules (which my code refers to as `pmdir'). Currently it naively defaults to ${libdir}/perl5 even though the correct default would be the directory given by:
perl -V:installsitelib Incidentally this varies significantly by distribution; a quick sample from my local systems reveals openSUSE: /usr/lib/perl5/site_perl/5.12.3 Fedora: /usr/local/share/perl5 Ubuntu: /usr/local/share/perl/5.12.4 But it's not good enough to simply take this value as the default, because if the user invokes something like ./configure --prefix=/opt then `make install' must not touch any directory outside /opt. Bearing that in mind, what should the default value for pmdir be? For the Perl installations referenced above, I would suggest: openSUSE: /opt/lib/perl5/site_perl/5.12.3 Fedora: /opt/share/perl5 Ubuntu: /opt/share/perl/5.12.4 This can be calculated by stripping `perl -V:siteprefix` (which will be /usr on openSUSE and /usr/local on Fedora/Ubuntu) from off the front of `perl -V:installsitelib` to obtain a relative path, and then appending that to ${prefix}. This means that the hierarchy under the ${prefix} chosen by the user mirrors Perl's siteprefix hierarchy for per-site installs. In other words: AC_ARG_WITH( pmdir, [ --with-pmdir=DIR Perl modules are in DIR [[LIBDIR/perl5]]], [PMDIR=${withval}], [eval `$PERL -V:installsitelib -V:siteprefix` PMDIR='${prefix}'/"${installsitelib#$siteprefix/}"]) AC_CONFIG_COMMANDS_POST([eval echo "Perl modules will be installed to $PMDIR"]) AC_SUBST([PMDIR]) except that now the default value in the help text is wrong, and I don't know how to fix it. Is this a reasonable approach, and if so, how can I dynamically generate the correct default value in the help text? Thanks, Adam