Hello All, >From the googling I've done, it seems that it is generally recommended that perl module packages be handled via MakeMaker rather than automake/autoconf. However, I have a mixed-language project that requires handling of perl modules along with other items that I would ordinarily handle with automake, so I came up with the following solution. [ I am working with ancient versions of automake and autoconf (1.4-p5 and 2.13, respectively) ] By default, I install perl modules beneath $libdir/$PACKAGE. This is the default because it repects the '--prefix=DIR' option specified by the user. I provide the user with two configure options, '--enable-perlsysdirs' and '--with-perldir=DIR'. Using '--enable-perlsysdirs' changes the default behavior to install perl modules beneath Perl's 'installsitelib' directory, as determined by running a variation of: $ perl -V:install.* | grep installsitelib This has the benefit of putting the modules where perl is already looking, but cannot be made the default because it causes the installation to ignore the value of the '--prefix=DIR' arg for perl modules; obviously, this violates the principle of least surprise and could conceivably hose a system. The '--with-perldir=DIR' option allows the user to explicitly set the directory beneath which the perl modules will be installed. Note that it does not make sense to specify both the '--enable-perlsysdirs' option and the '--with-perldir=DIR' options at the same time; nevertheless, if both options are specified, the '--enable-perlsysdirs' option is effectively ignored because the '--with-perldir=DIR' option is more specific. The only real downside I see to this scheme is that it requires the user to specify the '--enable-perlsysdirs' if he wants CPAN-module-like behavior of just installing the modules where perl will find them. I created the macro 'ads_PERL_INSTALLSITELIB' for use in my configure.in file, and a helper macro 'ads_PERL_DIR_PREFIX' to provide part of the implementation. The macros are included at the end of this message. I would very much appreciate critiques of the above, both of the general approach and the macro code itself. -Al ---------------------------8<------------------------------ dnl DO NOT put this macro directly in your 'configure.in' (unless you know dnl exactly what you're doing. This macro exists only to allow the dnl 'ads_PERL_INSTALLSITELIB' macro to depend upon it and allow the user dnl to manually specify where to drop the perl libraries. dnl dnl This macro provides for two 'configure' options: dnl --with-perldir=DIR dnl --enable-perlsysdirs dnl dnl In practice, it only makes sense to specify one option or the other, dnl but if both are specified correctly, then '--enable-perlsysdirs' is dnl effectively ignored (since '--with-perldir=DIR' is more specific). dnl dnl This macro sets up two shell variables: dnl dnl $PERLDIR, which will contain either be empty or contain a dnl directory name at the end of the macro dnl dnl $using_perlsysdirs, which will be either "yes" or "no" at dnl the end of the macro dnl dnl This macro sets up the automake conditional 'USING_PERLSYSDIRS' for dnl use in Makefile.am files dnl dnl This macro also expands PERLDIR as an automake variable; this is dnl probably a bug. Code that needs the base of the perl tree should dnl use PERL_INSTALLSITELIB instead. AC_DEFUN(ads_PERL_DIR_PREFIX, [ AC_ARG_WITH(perldir, changequote(<<, >>)dnl << --with-perldir=DIR where to install perl modules [\${libdir}/\${PACKAGE}]>>dnl changequote([, ])dnl , [ # AC_ARG_WITH: option if given AC_MSG_CHECKING(for override perl site lib dir) if test -z "$withval" || \ test "$withval" = "yes" || \ test "$withval" = "no"; then # user specified --with-perldir w/o giving an '=DIR' arg AC_MSG_ERROR(no directory specified) else PERLDIR="${withval}" AC_MSG_RESULT([yes: ${withval}]) dnl FIXME: warn the user if dir not in @INC? fi AC_SUBST(PERLDIR) ], [ # AC_ARG_WITH: option if not given AC_MSG_CHECKING(for override perl site lib dir) PERLDIR= AC_MSG_RESULT(no) AC_SUBST(PERLDIR) ])dnl end of AC_ARG_WITH() macro dnl The way this works is as follows: if the user explicitly set dnl the PERLDIR above, then --enable-perlsysdirs will be ignored dnl because --enable-perlsysdirs exists only to change the default dnl perl module installation directory; in this case we'll explicity dnl set using_perlsysdirs to "no". AC_ARG_ENABLE(perlsysdirs, changequote(<<, >>)dnl << --enable-perlsysdirs install perl modules into perl system directories>>dnl changequote([, ])dnl , [ # AC_ARG_ENABLE: option if given AC_MSG_CHECKING(whether perl modules should be installed into perl system dirs) if test ! -z "$PERLDIR"; then # user explicitly set PERLDIR using '--with-perldir', so we'll ignore # the '--enable-perlsysdirs' option using_perlsysdirs="no" AC_MSG_RESULT([no (overridden by --with-perldir option)]) else case "${enableval}" in yes) using_perlsysdirs="yes" AC_MSG_RESULT(yes) ;; no) using_perlsysdirs="no" AC_MSG_RESULT(no) ;; *) AC_MSG_ERROR(bad value \"${enableval}\" for --enable-perlsysdirs) ;; esac fi ], [ # AC_ARG_ENABLE: option if not given. By default we'll set up the # installation junk to respect the user's --prefix arg and not try # to install the perl modules into the perl 'installsitelib' dir. AC_MSG_CHECKING(whether perl modules should be installed into perl system dirs) using_perlsysdirs="no" AC_MSG_RESULT(no) ])dnl end AC_ARG_ENABLE(perlsysdirs) macro dnl register a conditional for use in Makefile.am files AM_CONDITIONAL(USING_PERLSYSDIRS, test x$using_perlsysdirs = x$yes) ]) AC_DEFUN(ads_PERL_INSTALLSITELIB, [ dnl AL.DEBUG: make me require something that defines PERL (fullpath), AC_REQUIRE([ads_PERL_DIR_PREFIX]) if test ! -z "${PERLDIR}"; then PERL_INSTALLSITELIB=$PERLDIR else if test "x${using_perlsysdirs}" = "xno"; then dnl only show this checking message if user did not specify dnl '--with-perldir' option /and/ the user has not specified dnl the '--enable-perlsysdirs' option. This is the default dnl because it respects the '--prefix' option if specified dnl by the user. AC_MSG_CHECKING(for where to install perl modules) PERL_INSTALLSITELIB="${libdir}/${PACKAGE}" else dnl only show this checking message if user did not specify dnl '--with-perldir' option /and/ the user has specified the dnl --enable-perlsysdirs option AC_MSG_CHECKING(for perl site lib dir) PERL_INSTALLSITELIB=`$PERL '-V:install.*' | \ $GREP 'installsitelib' | \ $SED -e "s/^installsitelib=[']\(.*\)[']\$/\1/"` if test "${PERL_INSTALLSITELIB}" = "undef" || test "${PERL_INSTALLSITELIB}X" = "X"; then tmp_valid_opts="`printf "\t"`"`$PERL -le 'print join $/."\t", @INC'` AC_MSG_ERROR([ Perl\'s installsitelib is not defined, and this is the preferred location in which to install the perl libraries included with ${PACKAGE}. Of course, you may specify that the perl libraries be installed anywhere perl will find them (anywhere in the @INC array), but you must explicitely request where, as this is non-standard. You may specify where to place them by using the \'--with-perldir=DIR\' option to \'configure\'. All of the following are in @INC: $tmp_valid_opts ]) fi fi AC_MSG_RESULT([$PERL_INSTALLSITELIB]) fi AC_SUBST([PERL_INSTALLSITELIB]) ]) ---------------------------8<------------------------------ -- a l a n d. s a l e w s k i salewski@xxxxxxxxxxxxxxxx -------------------------------------------------------------------- We envision an extraordinarily powerful 32-bit approach. -------------------------------------------------------------------- Generated from WWW Marketing Phrase gizmo: www.lyra.org/phrase.cgi