autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fine-grained install control


From: Keith MARSHALL
Subject: Re: Fine-grained install control
Date: Thu, 4 May 2006 15:55:02 +0100

Robert Lowe wrote:
> I have a small project that needs to install executables under
> /usr/local/<package>/, but the manpages under /usr/local/man.
> If I use AC_PREFIX_DEFAULT in configure.ac to point to
> /usr/local/<package>, how can I override it for manpages?

Hi Robert,

Just a simple `off the cuff' suggestion.  A quick look in configure
shows that it initialises mandir as:

  mandir='${prefix}/man'

*before* it parses the command line arguments, where that might be
overridden by a `--mandir=...' option.  Thus, for one off use, you
could just inline the assignment:

  mandir=`echo $mandir | sed s?^${prefix}?/usr/local?`

in your configure.ac.  (Just after the AC_PREFIX_DEFAULT seems the
most logical place, but it doesn't really matter that much, as long
as it comes after AC_INIT, and before AC_OUTPUT).

For a slightly more polished, and reusable solution, you could use
something like:

  # RL_AC_DEFAULT_OVERRIDE( VARNAME, PATHTAG, REPLACEMENT )
  # Modify the default configure path specified by VARNAME, replacing
  # PATHTAG with REPLACEMENT.
  #
  # e.g. RL_AC_DEFAULT_OVERRIDE([mandir],[^${prefix}],[/opt])
  # will set the default mandir to /var/man, rather than its normal
  # default setting of ${prefix}/man
  #
  AC_DEFUN([RL_AC_DEFAULT_OVERRIDE],
  [ $1=`echo $[$1] | sed s'?$2?$3?'`
  ]) dnl RL_AC_DEFAULT_OVERRIDE

(which IMO belongs in aclocal.m4, but it's short enough to inline
 in configure.ac, if you prefer).

Then, in configure.ac, after AC_PREFIX_DEFAULT, you could say:

  RL_AC_DEFAULT_OVERRIDE([mandir],[^${prefix}],[/usr/local])

to achieve the effect you desire, while still leaving the user the
option to override this with `--mandir=...'.

The same macro could also be used to set an alternative default for,
say, `infodir':

  RL_AC_DEFAULT_OVERRIDE([infodir],[^${prefix}],[/usr/local])

or any of the other default paths defined in terms of ${prefix},
or even ${exec_prefix}.

HTH,
Keith.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]