Hi I am trying to do a conditional sysconf_DATA, meaning, I want to install my conf file into $(sysconfdir) only if it is not already installed.
i tried to use install-data-local and it seems to work on a real installation, but 'make distcheck' fails. I run the test like this: > autoreconf --install > ./configure > make distcheck this is my Makefile.am: SUBDIRS = common EXTRA_DIST = README conf install-data-local: @if test -f "$(sysconfdir)/settings.conf"; then \ echo settings.conf already exists at $(sysconfdir). not overriding.; \ else \ mkdir -p $(sysconfdir); \ cp $(srcdir)/conf/settings.conf $(sysconfdir)/settings.conf; \ fi echo "conf_dir=$(sysconfdir)" >> "$(sysconfdir)/settings.conf"; uninstall-local: rm -rf $(sysconfdir) rm -rf $(docdir) the error I get is: make[3]: Nothing to be done for 'install-exec-am'. echo "conf_dir=/me/foo/_inst/etc/foo" >> "/me/foo/_inst/etc/foo/_inst/etc/foo/settings.conf"; /bin/sh: /me/foo/_inst/etc/foo/_inst/etc/foo/settings.conf: Permission denied Makefile:810: recipe for target 'install-data-local' failed for some reason the file has no write permissions. Now, if i add chmod after the copying of the file, like this: install-data-local: @if test -f "$(sysconfdir)/settings.conf"; then \ echo settings.conf already exists at $(sysconfdir). not overriding.; \ else \ mkdir -p $(sysconfdir); \ cp $(srcdir)/conf/settings.conf $(sysconfdir)/settings.conf; \ * chmod u+w $(sysconfdir)/settings.conf; \* fi echo "conf_dir=$(sysconfdir)" >> "$(sysconfdir)/settings.conf"; I get this: make[3]: Nothing to be done for 'install-exec-am'. mkdir: /me/foo/_inst/etc/foo: Permission denied cp: /me/foo/_inst/etc/foo/settings.conf: No such file or directory chmod: /me/foo/_inst/etc/foo/settings.conf: No such file or directory Makefile:810: recipe for target 'install-data-local' failed what's going on...? Thanks, Asaf