build: Make log-directory configurable indepently of VARDIR
authorMathieu PARENT <math.parent@gmail.com>
Tue, 3 Feb 2009 23:15:57 +0000 (00:15 +0100)
committerMichael Adam <obnox@samba.org>
Tue, 3 Feb 2009 23:19:22 +0000 (00:19 +0100)
This adds a new configure option "--with-logdir".
logdir defaults to "${localstatedir}/log" .
It is important to have logdir configurable for debian systems,
where localstatedir is set to "/var/lib" and not "/var".

Signed-off-by: Michael Adam <obnox@samba.org>
Makefile.in
configure.ac
server/ctdbd.c

index 0002da5f1447733107ed7ed63792fa0b028bdafc..a15e7b645771783c7716fe879c7949effa69c3df 100755 (executable)
@@ -12,6 +12,7 @@ bindir = @bindir@
 sbindir = @sbindir@
 mandir = @mandir@
 localstatedir = @localstatedir@
+logdir = @LOGDIR@
 VPATH = @srcdir@:@tdbdir@:@tallocdir@:@libreplacedir@:@poptdir@
 srcdir = @srcdir@
 etcdir = @sysconfdir@
@@ -30,6 +31,7 @@ IPQ_LIBS = @IPQ_LIBS@
 CFLAGS=-g -I$(srcdir)/include -Iinclude -Ilib -Ilib/util -I$(srcdir) \
        -I@tallocdir@ -I@tdbdir@/include -I@libreplacedir@ \
        -DVARDIR=\"$(localstatedir)\" -DETCDIR=\"$(etcdir)\" \
+       -DLOGDIR=\"$(logdir)\" \
        -DUSE_MMAP=1 @CFLAGS@ $(POPT_CFLAGS)
 
 LIB_FLAGS=@LDFLAGS@ -Llib @LIBS@ $(POPT_LIBS) @INFINIBAND_LIBS@ @CTDB_PCAP_LDFLAGS@
index d552eed00b44bf1f02edbcb6608ba21f61f0f79a..88c82f0308ecf8be99a617730764c0ad49579e5c 100644 (file)
@@ -37,6 +37,17 @@ if test "$ac_cv_prog_gcc" = yes; then
    CFLAGS="$CFLAGS -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings"
 fi
 
+LOGDIR='${localstatedir}/log'
+AC_ARG_WITH([logdir],
+       [  --with-logdir=DIR       path to log directory],
+       LOGDIR=$withval)
+if test ! -z "$LOGDIR"; then
+  if test "$LOGDIR" = "yes" -o "$LOGDIR" = "no"; then
+    AC_MSG_ERROR([--with-logdir must specify a path])
+  fi
+fi
+AC_SUBST(LOGDIR)
+
 AC_CONFIG_HEADER(config.h)
 
 EXTRA_OBJ=""
index ee433da2eb6342bd8353c70d80df4b99eda2c6dc..1d3b22aff78f9a71ffab583061213e56a93a3b16 100644 (file)
@@ -52,7 +52,7 @@ static struct {
        .nlist = ETCDIR "/ctdb/nodes",
        .transport = "tcp",
        .event_script_dir = ETCDIR "/ctdb/events.d",
-       .logfile = VARDIR "/log/log.ctdb",
+       .logfile = LOGDIR "/log.ctdb",
        .db_dir = VARDIR "/ctdb",
        .db_dir_persistent = VARDIR "/ctdb/persistent",
        .script_log_level = DEBUG_ERR,