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

Re: Setting a default path with autoconf



Will Newton <will@misconception.org.uk> writes:

> I have a package that really needs to have a configurable location of it's 
> configuration files. This would be possible by putting them in $sysconfdir, 
> but for some reason I am yet to come close to understanding, $sysconfdir is 
> set to $prefix/etc which is not a good place to put config files in the 
> general case, so in adding configurability, I break the build for the average 
> user who justs wants to type ./configure without arguments.

"$prefix/etc" /is/ the correct behaviour.  If $prefix="/usr/local" or
"/opt/mkpkg" or "/usr/local/pkg/foobar", this is the correct
behaviour.  When configuring for a Debian package, and putting the
conffiles in /etc, you should consider this /an exception to the/
/rule/, required to make the package comply with Debian Policy Sections
10.1 (FHS) and 11.7.2:

"Any configuration files created or used by your package must reside
in /etc. If there are several you should consider creating a
subdirectory of /etc named after your package."

The "average user" shouldn't be running configure with a prefix of /
or /usr, and so the default is what they want.  /etc and /usr are
"owned" by dpkg, so nothing should be installed manually there.
Running ./configure without arguments will default to /usr/local,
and hence /usr/local/etc, which is entirely correct.

> Is there a way of setting the default value of an argument to configure? It 
> seems that argument processing is forced before it is possible to set the 
> value of a variable.

Only if you want to write hairy non-portable macros, using m4
diversions which are internal to autoconf and will break since there
is no formal interface for the autoconf developers to preserve.  No,
basically.

> Or if someone can explain to me another way of easily configuring a config 
> file path from configure.

You should create a local "config.site" which tells configure what
your local defaults/preferences are.  autoconf.info documents this.


HTH,
-- 
Roger Leigh

"Liberty and Livelihood"
Support the Countryside Alliance
www.march-info.org



Reply to: