On 6/4/07, deckrider <[EMAIL PROTECTED]> wrote:
On 6/4/07, Jason Curl <[EMAIL PROTECTED]> wrote:
> Daniel Leidert wrote:
> > BTW: If you use
> >
> > etcdir=${sysconfdir}
> >
> > you can set
> >
> > DISTCHECK_CONFIGURE_FLAGS = --sysconfdir=/etc
> >
> > And if you want to make this the default, set it in your configure
> > script:
> >
> > AC_SUBST([sysconfdir],[/etc])
> >
> > However, you should carefully think about this. I personally would leave
> > it up to the user to choose a directory.
>
> After comments from previous posts I'm thinking how I can then take the
> prefix the user provided and put that in "config.h" that the program can
> then read to know where the configuration files are. I'll now have to
> learn how to extend the installation to make backups of any old
> configurations that might be there.
>
> Doing AC_SUBST([sysconfdir],[/etc]) brings back the original problem and
> doesn't help.
When you use automake, you get all these nice user-controlled things
like --prefix and --sysconfdir (even if you don't want them). I
generally advise to use them instead of working to not use them,
thereby confusing the user who might be running './configure --help'
and seeing that they exist and finding later that your packages is
working to ignore them.
You may find some additional interesting information here (automake
uses autoconf):
http://www.gnu.org/software/autoconf/manual/autoconf.html#Installation-Directory-Variables
In short, assuming that the configure.ac/Makefile.am you are working
on controls the installation of the c/c++ compiled software that wants
to look for this configuration file, I would recommend against any
configure.ac stuff and instead do something like this in your
Makefile.am:
AM_CPPFLAGS = -DSYSCONFDIR=\"$(sysconfdir)"\
oops....I mean this:
AM_CPPFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\"
This works because automake will supply you with a sysconfdir value
(either a default one, or one provided by the user).