[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: extending directory selection, --pkglibdir
From: |
Tommi Mäkitalo |
Subject: |
Re: extending directory selection, --pkglibdir |
Date: |
Wed, 6 Sep 2006 14:58:48 +0200 |
User-agent: |
KMail/1.9.4 |
Am Mittwoch, 6. September 2006 11:30 schrieb Ralf Wildenhues:
> * Tommi Mäkitalo wrote on Wed, Sep 06, 2006 at 10:59:30AM CEST:
> > Am Mittwoch, 6. September 2006 10:18 schrieb Ralf Wildenhues:
> > > AC_SUBST([pkglibdir], ['${libdir}/'$PACKAGE])
> >
> > I want to have a configure-switch, so the packager can decide, where to
> > install them. Something like:
> >
> > ./configure --pkgdir=/usr/lib/some/where/else
> >
> > Default will be $libdir/$PACKAGE.
>
> So how about this in configure.ac, after AM_INIT_AUTOMAKE:
> pkglibdir='${libdir}/'$PACKAGE
> AC_ARG_ENABLE([pkglibdir],
> [AS_HELP_STRING([--enable-pkglibdir=DIR], [library modules directory])
> [case $enableval in
> yes|no) AC_MSG_ERROR([invalid pkglibdir `$enableval']) ;;
> *) pkglibdir=$enableval;;
> esac])
> AC_SUBST([pkglibdir])
>
> (--with is supposed to be only for decisions about external software, see
> <http://www.gnu.org/software/autoconf/manual/html_node/Package-Options.html
>>).
>
> You could then add -DPKGLIBDIR="$(pkglibdir)" and
> lt_dlsetsearchpath (PKGLIBDIR);
>
> in your code, before `lt_dlopen'ing the libraries.
I put this into my configure.in:
# pkglibdir
AC_ARG_WITH(
[pkglibdir],
AS_HELP_STRING([--with-pkglibdir=dir],
[specify directory for driver files (default LIBDIR/tntdb)]),
[pkglibdir=$withval],
[pkglibdir=$libdir/tntdb])
AC_SUBST(pkglibdir)
It is quite similar by misusing --with-pkglibdir instead of
misusing --enable-pkglibdir. It sounds more natural for me to
say "--with-pkglibdir=/usr/lib/tntdb0"
than "--enable-pkglibdir=/usr/lib/tntdb0". I hoped to find a better solution
in autoconf.
> Adding --pkglibdir support to Autoconf would be a possibility, but it
> would require changing the GNU Coding Standards, which do not allow all
> kinds of arbitrary options to configure scripts. This is done so that
> users can execute (possibly recursively) all kinds of configure scripts
> and pass identical options to them: --with-* and --enable-* are ignored
> for values not recognized in a specific configure script, whereas
> arbitrary other options are not ignored. (Not knowing whether those
> took an argument or not prevents robust parsing of the command line in
> that case.)
>
> And changing the GCS is not a step done lightly.
>
> Hope that helps.
>
> Cheers,
> Ralf
>
>
btw: I did not know about lt_dlsetsearchpath. Thank you for pointing there.
Tommi
P.S.: I just found this in configure.in of wireshark:
dnl
dnl check whether plugins should be enabled and, if they should be,
dnl check for plugins directory - stolen from Amanda's configure.in
dnl
plugindir="$libdir/wireshark/plugins/$VERSION"
AC_ARG_WITH(plugins,
[ --with-plugins[[=DIR]] support plugins (installed in DIR, if
supplied).],
[
case "$withval" in
"" | y | ye | yes )
if test x$have_plugins = xno
then
AC_MSG_ERROR([GLib on this platform doesn't support loadable modules, so
you can't enable plugins.])
fi
;;
n | no)
have_plugins=no
;;
*)
if test x$have_plugins = xno
then
AC_MSG_ERROR([GLib on this platform doesn't support loadable modules, so
you can't enable plugins.])
fi
plugindir="$withval"
;;
esac
])
Open source is nice - isn't it?