Daniel Leidert wrote:
Am Montag, den 04.06.2007, 15:56 +0200 schrieb Jason Curl:
Hello,
I have a project where the program expects the configuration files to be
stored in '/etc/lx2005'. Appropriately, I've got such a Makefile.am:
# Makefile.am for installing configuration data
etcdir=/etc/lx2005
This line misses a $(DESTDIR) to not break package builds and distcheck.
etc_DATA = serlog.conf
[snip]
The configuration that gets copied depends on the 'configure' script
setting the variable $(MACHINE).
When I run 'make distcheck' it fails as it cannot install the files to
'/etc/lx2005'. I would very much like the location of the configuration
files to be independent of $(prefix) as the locations my project
searches are independent of where it was installed.
No problem: But you should add the DESTDIR variable to hardcoded paths.
If you use sysconfdir etc.pp, you don't need to add the DESTDIR variable
explicitly.
Installing to my remote file system is easy enough and it works:
make DESTDIR="/mnt/remotefs" install
And the configuration file then is inside /etc and not /mnt/remotefs?
Why? And BTW: That should be done using --prefix=/mnt/remotefs
--sysconfdir=/etc and not DESTDIR (IMHO). DESTDIR is used e.g. for
creating packages (e.g. Debian packages). With your usage of this
variable, you break the possibility to package your software, because it
will try to write to /etc in every case.
The configuration file gets copied to where I need it at
"/mnt/remotefs/etc/lx2005". I have --prefix=/ in this case as when
"remotefs" is mounted it looks like "/etc/lx2005". It's actually a
Compact Flash card that is later removed from the USB device and
installed in an x86 machine to boot from. DESTDIR appears to fit the
situation perfectly. I've just updated to autoconf-2.61 and
automake-1.10 and confirmed it does that.
How can I get 'make distcheck' to work with this configuration?
Alternatively, I'm open for other ideas of implementation.
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.
Regards, Daniel