diff --git a/configure.ac b/configure.ac index cd55663172de62d1b4cd77643cdeba6bff7db965..1d6ef2e8c3575064a86f39baa964f17a2be7c4bd 100644 --- a/configure.ac +++ b/configure.ac @@ -177,6 +177,12 @@ AC_ARG_WITH([storage], [storage_dir=$withval]) AC_SUBST(storage_dir) +config_dir="${sysconfdir}/knot" +AC_ARG_WITH([configdir], + AC_HELP_STRING([--with-configdir=path], [Default directory for configuration. [default=$(sysconfdir)/knot]]), + [config_dir=$withval]) +AC_SUBST(config_dir) + # Checks for libraries. # FIXME: Replace `main' with a function in `-lm': diff --git a/samples/Makefile.am b/samples/Makefile.am index 755ef078f299d8559eb94eae29aa5891e8df6e6a..f3ab8a55abb86b69737b0946c01195d615914396 100644 --- a/samples/Makefile.am +++ b/samples/Makefile.am @@ -3,7 +3,8 @@ edit = sed \ -e 's|@package[@]|$(PACKAGE_NAME)|g' \ -e 's|@localstatedir[@]|$(localstatedir)|g' \ -e 's|@prefix[@]|$(prefix)|g' \ - -e 's|@sysconfdir[@]|$(sysconfdir)|g' + -e 's|@sysconfdir[@]|$(sysconfdir)|g' \ + -e 's|@config_dir[@]|$(config_dir)|g' knot.sample.conf: knot.sample.conf.in rm -f $@ $@.tmp @@ -15,16 +16,16 @@ knot.sample.conf: knot.sample.conf.in EXTRA_DIST = knot.sample.conf.in knot.full.conf knot.keys.conf example.com.zone install-data-local: knot.sample.conf - [ -d $(DESTDIR)/$(sysconfdir) ] || \ - $(INSTALL) -d $(DESTDIR)/$(sysconfdir) - [ -f $(DESTDIR)/$(sysconfdir)/knot.sample.conf ] || \ - $(INSTALL_DATA) knot.sample.conf $(srcdir)/example.com.zone $(DESTDIR)/$(sysconfdir) + [ -d $(DESTDIR)/$(config_dir) ] || \ + $(INSTALL) -d $(DESTDIR)/$(config_dir) + [ -f $(DESTDIR)/$(config_dir)/knot.sample.conf ] || \ + $(INSTALL_DATA) knot.sample.conf $(srcdir)/example.com.zone $(DESTDIR)/$(config_dir) uninstall-local: - [ -f $(DESTDIR)/$(sysconfdir)/knot.sample.conf ] && \ - rm -f $(DESTDIR)/$(sysconfdir)/knot.sample.conf - [ -f $(DESTDIR)/$(sysconfdir)/example.com.zone ] && \ - rm -f $(DESTDIR)/$(sysconfdir)/example.com.zone + [ -f $(DESTDIR)/$(config_dir)/knot.sample.conf ] && \ + rm -f $(DESTDIR)/$(config_dir)/knot.sample.conf + [ -f $(DESTDIR)/$(config_dir)/example.com.zone ] && \ + rm -f $(DESTDIR)/$(config_dir)/example.com.zone clean-local: rm -f knot.sample.conf diff --git a/samples/knot.sample.conf.in b/samples/knot.sample.conf.in index 6530d1f57238913b43138a8d9b7e75e01ed678d5..806e7c9d3e701be3682a7e7630b9b6bcf9367a43 100644 --- a/samples/knot.sample.conf.in +++ b/samples/knot.sample.conf.in @@ -61,7 +61,7 @@ control { zones { # Example master zone # example.com { -# file "@sysconfdir@/example.com.zone"; +# file "@config_dir@/example.com.zone"; # xfr-out slave0; # notify-out slave0; # } diff --git a/src/Makefile.am b/src/Makefile.am index a542399e1bd534f25a47119eae96f363f7d9ab8d..191e6cccc5ddd8a55f607f01d89205f2fb7cd803 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -8,8 +8,8 @@ noinst_LTLIBRARIES = libknot.la libknotd.la libknots.la libzscanner.la # $(YACC) will generate header file AM_CPPFLAGS = -I$(top_srcdir)/src/libknot -DSYSCONFDIR='"$(sysconfdir)"' \ - -DSBINDIR='"$(sbindir)"' -DSTORAGE_DIR='"${storage_dir}"' \ - -DRUN_DIR='"${run_dir}"' + -DSBINDIR='"$(sbindir)"' -DCONFIG_DIR='"${config_dir}"' \ + -DSTORAGE_DIR='"${storage_dir}"' -DRUN_DIR='"${run_dir}"' AM_YFLAGS = -d libknotd_la_YFLAGS = -pcf_ -d libknotd_la_LFLAGS = # TODO: reentrant parser, prefix @@ -316,5 +316,6 @@ zscanner_tool_LDADD = libknots.la libknot.la libknotd.la libzscanner.la @LIBOBJS # Create storage and run-time directories install-data-hook: + $(INSTALL) -d $(DESTDIR)/@config_dir@ $(INSTALL) -d $(DESTDIR)/@run_dir@ $(INSTALL) -d $(DESTDIR)/@storage_dir@