]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
default config file location, example conf installed.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 9 Nov 2007 13:52:13 +0000 (13:52 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 9 Nov 2007 13:52:13 +0000 (13:52 +0000)
git-svn-id: file:///svn/unbound/trunk@736 be551aaa-1e26-0410-a405-d3ace91eadb9

Makefile.in
checkconf/unbound-checkconf.c
config.h.in
configure
configure.ac
daemon/unbound.c
doc/Changelog
doc/example.conf
doc/unbound-checkconf.8
doc/unbound.8

index a6475fef655cfec520f5e2bac6276fdf44b16f83..c44640c5c0751a7ad473afcd89e6ae64ce6a1622 100644 (file)
@@ -28,6 +28,7 @@ doxygen=@doxygen@
 libtool=@libtool@
 ldnsdir=@ldnsdir@
 staticexe=@staticexe@
+configfile=@ub_conf_file@
 
 YACC=@YACC@
 LEX=@LEX@
@@ -212,10 +213,13 @@ install:
        $(INSTALL) -c -m 644 $(srcdir)/doc/unbound.8 $(mandir)/man8
        $(INSTALL) -c -m 644 $(srcdir)/doc/unbound-checkconf.8 $(mandir)/man8
        $(INSTALL) -c -m 644 $(srcdir)/doc/unbound.conf.5 $(mandir)/man5
+       if test ! -e $(configfile); then $(INSTALL) -d `dirname $(configfile)`; $(INSTALL) -c -m 644 $(srcdir)/doc/example.conf $(configfile); fi
 
 uninstall:
        rm -f -- $(bindir)/unbound $(bindir)/unbound-checkconf
        rm -f -- $(mandir)/man8/unbound.8 $(mandir)/man8/unbound-checkconf.8 $(mandir)/man5/unbound.conf.5
+       @echo
+       @echo "You still need to remove `dirname $(configfile)` , $(configfile) by hand"
 
 download_ldns:
        svn export https://www.nlnetlabs.nl/ldns/svn/trunk/makedist.sh ldns_makedist.sh
index 3a58aa759e163b64ca46f8a517761c76ca9cb975..2aaaaec7fa20ebecdb2adaeb061f6011e2d516e3 100644 (file)
@@ -56,8 +56,9 @@
 static void
 usage()
 {
-       printf("Usage:  unbound-checkconf [options] file\n");
+       printf("Usage:  unbound-checkconf [file]\n");
        printf("        Checks unbound configuration file for errors.\n");
+       printf("file    if omitted %s is used.\n", CONFIGFILE);
        printf("-h      show this usage help.\n");
        printf("Version %s\n", PACKAGE_VERSION);
        printf("BSD licensed, see LICENSE in source package for details.\n");
@@ -171,6 +172,7 @@ extern char* optarg;
 int main(int argc, char* argv[])
 {
        int c;
+       char* f;
        log_ident_set("unbound-checkconf");
        log_init(NULL, 0, NULL);
        checklock_start();
@@ -185,9 +187,12 @@ int main(int argc, char* argv[])
        }
        argc -= optind;
        argv += optind;
-       if(argc != 1)
+       if(argc != 0 && argc != 1)
                usage();
-       checkconf(argv[0]);
+       if(argc == 1)
+               f = argv[0];
+       else    f = CONFIGFILE;
+       checkconf(f);
        checklock_stop();
        return 0;
 }
index 5f169c811372f61bb14bbf082e45fa577548ecc8..8d92639d58e1022ac99e75ac9be4316633c87f24 100644 (file)
@@ -1,5 +1,8 @@
 /* config.h.in.  Generated from configure.ac by autoheader.  */
 
+/* Pathname to the Unbound configuration file */
+#undef CONFIGFILE
+
 /* Define if you want to use debug lock checking (slow). */
 #undef ENABLE_LOCK_CHECKS
 
index 6e9a11f5bb15ac595343bb197a4586eed4214a91..62a3ee77930aad16c9135b267b7d8da31309fe53 100755 (executable)
--- a/configure
+++ b/configure
@@ -811,6 +811,7 @@ OBJEXT
 CPP
 GREP
 EGREP
+ub_conf_file
 libtool
 AR
 doxygen
@@ -1446,6 +1447,7 @@ Optional Features:
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-conf-file=path   Pathname to the Unbound configuration file
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
   --with-pic              try to use only PIC/non-PIC objects [default=use
                           both]
@@ -3254,6 +3256,40 @@ rm -f conftest*
 
 
 
+case "$prefix" in
+        NONE)
+                case "$sysconfdir" in
+                        '${prefix}/etc')
+                                sysconfdir=/etc
+                        ;;
+                esac
+                case "$localstatedir" in
+                        '${prefix}/var')
+                                localstatedir=/var
+                        ;;
+                esac
+        ;;
+esac
+
+#
+# Determine configuration file
+ub_conf_file=${sysconfdir}/unbound/unbound.conf
+
+# Check whether --with-conf_file was given.
+if test "${with_conf_file+set}" = set; then
+  withval=$with_conf_file; ub_conf_file=$withval
+fi
+
+
+# the eval is to evaluate shell expansion twice, once
+# for $nsd_conf_file and once for the ${prefix} within it.
+
+cat >>confdefs.h <<_ACEOF
+#define CONFIGFILE "`eval echo $ub_conf_file`"
+_ACEOF
+
+echo $ub_conf_file
+
 
 
 # if the given code compiles without the flag, execute argument 4
@@ -5593,7 +5629,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 5596 "configure"' > conftest.$ac_ext
+  echo '#line 5632 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -6895,11 +6931,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:6898: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:6934: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:6902: \$? = $ac_status" >&5
+   echo "$as_me:6938: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7163,11 +7199,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7166: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7202: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7170: \$? = $ac_status" >&5
+   echo "$as_me:7206: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7267,11 +7303,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7270: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7306: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7274: \$? = $ac_status" >&5
+   echo "$as_me:7310: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -8732,7 +8768,7 @@ linux*)
   libsuff=
   case "$host_cpu" in
   x86_64*|s390x*|powerpc64*)
-    echo '#line 8735 "configure"' > conftest.$ac_ext
+    echo '#line 8771 "configure"' > conftest.$ac_ext
     if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -9596,7 +9632,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 9599 "configure"
+#line 9635 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -9696,7 +9732,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 9699 "configure"
+#line 9735 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12032,11 +12068,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:12035: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:12071: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:12039: \$? = $ac_status" >&5
+   echo "$as_me:12075: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -12136,11 +12172,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:12139: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:12175: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:12143: \$? = $ac_status" >&5
+   echo "$as_me:12179: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -12672,7 +12708,7 @@ linux*)
   libsuff=
   case "$host_cpu" in
   x86_64*|s390x*|powerpc64*)
-    echo '#line 12675 "configure"' > conftest.$ac_ext
+    echo '#line 12711 "configure"' > conftest.$ac_ext
     if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -13727,11 +13763,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:13730: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13766: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:13734: \$? = $ac_status" >&5
+   echo "$as_me:13770: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -13831,11 +13867,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:13834: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13870: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:13838: \$? = $ac_status" >&5
+   echo "$as_me:13874: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -15276,7 +15312,7 @@ linux*)
   libsuff=
   case "$host_cpu" in
   x86_64*|s390x*|powerpc64*)
-    echo '#line 15279 "configure"' > conftest.$ac_ext
+    echo '#line 15315 "configure"' > conftest.$ac_ext
     if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -16050,11 +16086,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16053: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16089: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:16057: \$? = $ac_status" >&5
+   echo "$as_me:16093: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -16318,11 +16354,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16321: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16357: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:16325: \$? = $ac_status" >&5
+   echo "$as_me:16361: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -16422,11 +16458,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16425: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16461: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:16429: \$? = $ac_status" >&5
+   echo "$as_me:16465: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -17887,7 +17923,7 @@ linux*)
   libsuff=
   case "$host_cpu" in
   x86_64*|s390x*|powerpc64*)
-    echo '#line 17890 "configure"' > conftest.$ac_ext
+    echo '#line 17926 "configure"' > conftest.$ac_ext
     if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -25205,6 +25241,7 @@ OBJEXT!$OBJEXT$ac_delim
 CPP!$CPP$ac_delim
 GREP!$GREP$ac_delim
 EGREP!$EGREP$ac_delim
+ub_conf_file!$ub_conf_file$ac_delim
 libtool!$libtool$ac_delim
 AR!$AR$ac_delim
 doxygen!$doxygen$ac_delim
@@ -25239,7 +25276,7 @@ ldnsdir!$ldnsdir$ac_delim
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 79; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 80; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
index 4bdf63ddb77fca860440928ed1c9733187957499..454c4ee4c3f4b877bd40b12d8d300b09da50fef6 100644 (file)
@@ -7,6 +7,36 @@ AC_INIT(unbound, 0.6, wouter@nlnetlabs.nl, unbound)
 CFLAGS=
 AC_AIX
 
+dnl
+dnl By default set $sysconfdir to /etc and $localstatedir to /var
+dnl
+case "$prefix" in
+        NONE)
+                case "$sysconfdir" in
+                        '${prefix}/etc')
+                                sysconfdir=/etc
+                        ;;
+                esac
+                case "$localstatedir" in
+                        '${prefix}/var')
+                                localstatedir=/var
+                        ;;
+                esac
+        ;;
+esac
+
+#
+# Determine configuration file
+ub_conf_file=${sysconfdir}/unbound/unbound.conf
+AC_ARG_WITH([conf_file],
+        AC_HELP_STRING([--with-conf-file=path], [Pathname to the Unbound configuration file]),
+       [ub_conf_file=$withval])
+AC_SUBST(ub_conf_file)
+# the eval is to evaluate shell expansion twice, once
+# for $nsd_conf_file and once for the ${prefix} within it.
+AC_DEFINE_UNQUOTED(CONFIGFILE, ["`eval echo $ub_conf_file`"], [Pathname to the Unbound configuration file])
+echo $ub_conf_file
+
 dnl routine to help check for compiler flags.
 AC_DEFUN([CHECK_COMPILER_FLAG],
 [
index 41bb53de38c952a8a029e6610f1c2a8de9a99eeb..ccdb156118fdea0553f586acc15d4067e21beee5 100644 (file)
@@ -61,10 +61,11 @@ void* unbound_start_brk = 0;
 /** print usage. */
 static void usage()
 {
-       printf("usage: unbound [options]\n");
+       printf("usage:  unbound [options]\n");
        printf("        start unbound daemon DNS resolver.\n");
        printf("-h      this help\n");
-       printf("-c file config file to read, unbound.conf(5).\n");
+       printf("-c file config file to read instead of %s\n", CONFIGFILE);
+       printf("        file format is described in unbound.conf(5).\n");
        printf("-d      do not fork into the background.\n");
        printf("-v      verbose (multiple times increase verbosity)\n");
        printf("Version %s\n", PACKAGE_VERSION);
@@ -382,7 +383,7 @@ int
 main(int argc, char* argv[])
 {
        int c;
-       char* cfgfile = NULL;
+       char* cfgfile = CONFIGFILE;
        int cmdline_verbose = 0;
        int debug_mode = 0;
 
index 0fb74ca13ec1a925df290bdc840b0baa3414aa6a..ee7c160b52ed9d25faf9975a3141fc807679e7df 100644 (file)
@@ -1,3 +1,9 @@
+9 November 2007: Wouter
+       - took ldns snapshot in repo.
+       - default config file is /etc/unbound/unbound.conf.
+         If it doesn't exist, it is installed with the doc/example.conf file.
+         The file is not deleted on uninstall.
+       
 8 November 2007: Wouter
        - Fixup chroot and drop user privileges.
        - new L root ip address in default hints.
index df51d864766d91299b0213133fe851061612f5bd..1c9b8a4a17444983166923226a6a10f9835e38ba 100644 (file)
@@ -13,8 +13,8 @@ server:
        # whitespace is not necessary, but looks cleaner.
 
        # verbosity number, 0 is least verbose. 1 is default.
-       verbosity: 2
-       
+       verbosity: 1
+
        # number of threads to create. 1 disables threading.
        # num-threads: 1
 
index 2275af43fa0528f032293b8400fb6b349ac53e58..d65934bbd280ff17dc146fab9b951151ebf3b08e 100644 (file)
@@ -14,7 +14,7 @@ unbound-checkconf
 .Sh SYNOPSIS
 .Nm unbound-checkconf
 .Op Fl h
-cfgfile
+.Op cfgfile
 .Sh DESCRIPTION
 .Ic Unbound-checkconf
 checks the configuration file for the
@@ -30,10 +30,16 @@ The available options are:
 Show the version and commandline option help.
 .It cfgfile
 The config file to read with settings for unbound. It is checked.
+If omitted, the config file at the default location is checked.
 .Sh EXIT CODE
 The unbound-checkconf program exits with status code 1 on error, 
 0 for a correct config file.
 .El
+.Sh FILES
+.Bl -tag -width indent
+.It Pa /etc/unbound/unbound.conf
+unbound configuration file.
+.El
 .Sh SEE ALSO
 .Xr unbound.conf 5 , 
 .Xr unbound 8 .
index c89378874fa1e224d31e8448a125f3e7f1867f52..48e90454c33041834d2cb44e9f5e0497470e65d5 100644 (file)
@@ -27,7 +27,8 @@ The available options are:
 .It Fl h
 Show the version and commandline option help.
 .It Fl c Ar cfgfile
-Set the config file to read with settings for unbound. The syntax is
+Set the config file with settings for unbound to read instead of the 
+file at default location /etc/unbound/unbound.conf. The syntax is
 described in 
 .Xr unbound.conf 5 .
 .It Fl d