From a345ffccfaae008b6547d5de26d209c503a01dca Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Fri, 15 Feb 2008 14:13:09 +0000 Subject: [PATCH] fixup --prefix also changes config file default paths. git-svn-id: file:///svn/unbound/trunk@958 be551aaa-1e26-0410-a405-d3ace91eadb9 --- config.h.in | 9 ++++++ configure | 73 +++++++++++++++++++++++++++++----------------- configure.ac | 7 +++++ doc/Changelog | 2 ++ util/config_file.c | 7 ++--- 5 files changed, 67 insertions(+), 31 deletions(-) diff --git a/config.h.in b/config.h.in index e4b7ff8a0..382299d6e 100644 --- a/config.h.in +++ b/config.h.in @@ -1,5 +1,8 @@ /* config.h.in. Generated from configure.ac by autoheader. */ +/* Directory to chroot to */ +#undef CHROOT_DIR + /* Pathname to the Unbound configuration file */ #undef CONFIGFILE @@ -175,6 +178,9 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* Pathname to unbound process id file */ +#undef PIDFILE + /* Define to necessary symbol if this constant uses a non-standard name on your system. */ #undef PTHREAD_CREATE_JOINABLE @@ -182,6 +188,9 @@ /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE +/* Directory to chdir to */ +#undef RUN_DIR + /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS diff --git a/configure b/configure index 1a273e8b9..f2e5500ab 100755 --- a/configure +++ b/configure @@ -3292,6 +3292,25 @@ cat >>confdefs.h <<_ACEOF _ACEOF +# Determine run, chroot directory and pidfile locations +ub_cfg=`eval echo $ub_conf_file` +ub_dir=`dirname $ub_cfg` + +cat >>confdefs.h <<_ACEOF +#define RUN_DIR "$ub_dir" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define CHROOT_DIR "$ub_dir" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PIDFILE "$ub_dir/unbound.pid" +_ACEOF + + # if the given code compiles without the flag, execute argument 4 @@ -5731,7 +5750,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5734 "configure"' > conftest.$ac_ext + echo '#line 5753 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7033,11 +7052,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:7036: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7055: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7040: \$? = $ac_status" >&5 + echo "$as_me:7059: \$? = $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. @@ -7301,11 +7320,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:7304: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7323: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7308: \$? = $ac_status" >&5 + echo "$as_me:7327: \$? = $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. @@ -7405,11 +7424,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:7408: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7427: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7412: \$? = $ac_status" >&5 + echo "$as_me:7431: \$? = $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 @@ -8870,7 +8889,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 8873 "configure"' > conftest.$ac_ext + echo '#line 8892 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -9734,7 +9753,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:12192: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12177: \$? = $ac_status" >&5 + echo "$as_me:12196: \$? = $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. @@ -12274,11 +12293,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:12277: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12296: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12281: \$? = $ac_status" >&5 + echo "$as_me:12300: \$? = $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 @@ -12810,7 +12829,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 12813 "configure"' > conftest.$ac_ext + echo '#line 12832 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -13865,11 +13884,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:13868: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13887: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13872: \$? = $ac_status" >&5 + echo "$as_me:13891: \$? = $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. @@ -13969,11 +13988,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:13972: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13991: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13976: \$? = $ac_status" >&5 + echo "$as_me:13995: \$? = $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 @@ -15414,7 +15433,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 15417 "configure"' > conftest.$ac_ext + echo '#line 15436 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -16188,11 +16207,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:16191: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16210: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16195: \$? = $ac_status" >&5 + echo "$as_me:16214: \$? = $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. @@ -16456,11 +16475,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:16459: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16478: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16463: \$? = $ac_status" >&5 + echo "$as_me:16482: \$? = $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. @@ -16560,11 +16579,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:16563: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16582: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16567: \$? = $ac_status" >&5 + echo "$as_me:16586: \$? = $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 @@ -18025,7 +18044,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 18028 "configure"' > conftest.$ac_ext + echo '#line 18047 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? diff --git a/configure.ac b/configure.ac index 242e6ea66..1c375b3aa 100644 --- a/configure.ac +++ b/configure.ac @@ -36,6 +36,13 @@ AC_SUBST(ub_conf_file) # 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]) +# Determine run, chroot directory and pidfile locations +ub_cfg=`eval echo $ub_conf_file` +ub_dir=`dirname $ub_cfg` +AC_DEFINE_UNQUOTED(RUN_DIR, ["$ub_dir"], [Directory to chdir to]) +AC_DEFINE_UNQUOTED(CHROOT_DIR, ["$ub_dir"], [Directory to chroot to]) +AC_DEFINE_UNQUOTED(PIDFILE, ["$ub_dir/unbound.pid"], [Pathname to unbound process id file]) + dnl routine to help check for compiler flags. AC_DEFUN([CHECK_COMPILER_FLAG], [ diff --git a/doc/Changelog b/doc/Changelog index 5bf00a14c..f588c955a 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,5 +1,7 @@ 15 February 2008: Wouter - added FreeBSD rc.d script to contrib. + - --prefix option for configure also changes directory: pidfile: + and chroot: defaults in config file. 14 February 2008: Wouter - start without a config file (will complain, but start with diff --git a/util/config_file.c b/util/config_file.c index 7262ce499..fad6742c6 100644 --- a/util/config_file.c +++ b/util/config_file.c @@ -96,11 +96,10 @@ config_create() cfg->infra_cache_numhosts = 10000; cfg->infra_cache_lame_size = 10240; /* easily 40 or more entries */ if(!(cfg->username = strdup("unbound"))) goto error_exit; - if(!(cfg->chrootdir = strdup("/etc/unbound"))) goto error_exit; - if(!(cfg->directory = strdup("/etc/unbound"))) goto error_exit; + if(!(cfg->chrootdir = strdup(CHROOT_DIR))) goto error_exit; + if(!(cfg->directory = strdup(RUN_DIR))) goto error_exit; if(!(cfg->logfile = strdup(""))) goto error_exit; - if(!(cfg->pidfile = strdup("/etc/unbound/unbound.pid"))) - goto error_exit; + if(!(cfg->pidfile = strdup(PIDFILE))) goto error_exit; if(!(cfg->target_fetch_policy = strdup("3 2 1 0 0"))) goto error_exit; cfg->donotqueryaddrs = NULL; cfg->donotquery_localhost = 1; -- 2.47.2