summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2000-05-08 16:19:47 +0200
committerMartin Mares <mj@ucw.cz>2000-05-08 16:19:47 +0200
commitf9254d2349c7e2e3c110f7850e402d1c11624940 (patch)
treeaf9ae9a6b2ca0107f4a02929fc9e332558b9e0ad
parent0bf7386b33fecac40be43f8db5b0ba0356123fd2 (diff)
downloadbird-f9254d2349c7e2e3c110f7850e402d1c11624940.tar
bird-f9254d2349c7e2e3c110f7850e402d1c11624940.zip
Autoconf is *evil*. The sysconfdir and similar variables are unusable in
C includes as they contain substitutions specific to make. Worked around by creating sysconf/paths.h which is created from the Makefile instead of by the configure script.
-rw-r--r--configure.in5
-rw-r--r--sysdep/autoconf.h.in6
-rw-r--r--sysdep/config.h7
-rw-r--r--tools/Makefile-top.in2
-rw-r--r--tools/Makefile.in11
-rw-r--r--tools/Rules.in1
6 files changed, 17 insertions, 15 deletions
diff --git a/configure.in b/configure.in
index b197c3d..cd7fa18 100644
--- a/configure.in
+++ b/configure.in
@@ -144,16 +144,11 @@ BIRD_CHECK_TIME_T
BIRD_CHECK_STRUCT_IP_MREQN
if test "$enable_debug" = yes ; then
- AC_DEFINE(PATH_CONFIG_DIR, ".")
- AC_DEFINE(PATH_CONTROL_SOCKET_DIR, ".")
AC_DEFINE(DEBUGGING)
AC_CHECK_LIB(dmalloc, dmalloc_debug)
if test $ac_cv_lib_dmalloc_dmalloc_debug != yes ; then
AC_CHECK_LIB(efence, malloc)
fi
-else
- AC_DEFINE_UNQUOTED(PATH_CONFIG_DIR, "$sysconfdir")
- AC_DEFINE_UNQUOTED(PATH_CONTROL_SOCKET_DIR, "$localstatedir")
fi
CLIENT=
diff --git a/sysdep/autoconf.h.in b/sysdep/autoconf.h.in
index 8d2ebf3..ca86ff4 100644
--- a/sysdep/autoconf.h.in
+++ b/sysdep/autoconf.h.in
@@ -41,11 +41,5 @@
/* We have <syslog.h> and syslog() */
#undef HAVE_SYSLOG
-/* Path to configuration files */
-#define PATH_CONFIG_DIR ?
-
-/* Path to control socket */
-#define PATH_CONTROL_SOCKET_DIR ?
-
/* Are we using dmalloc? */
#undef HAVE_LIBDMALLOC
diff --git a/sysdep/config.h b/sysdep/config.h
index 2b4a49d..276929e 100644
--- a/sysdep/config.h
+++ b/sysdep/config.h
@@ -17,6 +17,8 @@
#ifndef MACROS_ONLY
+#include "sysdep/paths.h"
+
/* Types */
typedef signed INTEGER_8 s8;
typedef unsigned INTEGER_8 u8;
@@ -30,7 +32,12 @@ typedef u16 word;
#endif
/* Path to configuration file */
+#ifdef DEBUGGING
+#define PATH_CONFIG "bird.conf"
+#define PATH_CONTROL_SOCKET "bird.ctl"
+#else
#define PATH_CONFIG PATH_CONFIG_DIR "/bird.conf"
#define PATH_CONTROL_SOCKET PATH_CONTROL_SOCKET_DIR "/bird.ctl"
+#endif
#endif
diff --git a/tools/Makefile-top.in b/tools/Makefile-top.in
index 9e5049e..855c274 100644
--- a/tools/Makefile-top.in
+++ b/tools/Makefile-top.in
@@ -12,4 +12,4 @@ clean:
distclean: clean
rm -rf $(objdir)
- rm -f config.* configure sysdep/autoconf.h Makefile
+ rm -f config.* configure sysdep/autoconf.h sysdep/paths.h Makefile
diff --git a/tools/Makefile.in b/tools/Makefile.in
index a740b9b..fb078d7 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -5,7 +5,7 @@ include Rules
.PHONY: all daemon client subdir depend clean distclean tags docs userdocs progdocs
-all: .dep-stamp subdir daemon @CLIENT@
+all: sysdep/paths.h .dep-stamp subdir daemon @CLIENT@
daemon: $(exedir)/bird
@@ -34,11 +34,16 @@ docs: userdocs progdocs
userdocs progdocs: .dir-stamp
$(MAKE) -C doc -f $(srcdir_abs)/doc/Makefile $@
+sysdep/paths.h:
+ echo >sysdep/paths.h "/* Generated by Makefile, don't edit manually! */"
+ echo >>sysdep/paths.h "#define PATH_CONFIG_DIR \"$(sysconfdir)\""
+ echo >>sysdep/paths.h "#define PATH_CONTROL_SOCKET_DIR \"$(localstatedir)\""
+
tags:
cd $(srcdir) ; etags -lc `find $(static-dirs) $(addprefix $(objdir)/,$(dynamic-dirs)) $(client-dirs) -name *.[chY]`
install: all
- $(INSTALL) -d $(sbindir) $(sysconfdir)
+ $(INSTALL) -d $(sbindir) $(sysconfdir) $(localstatedir)
$(INSTALL_PROGRAM) -s $(exedir)/bird $(sbindir)/
if test -n "@CLIENT@" ; then \
$(INSTALL_PROGRAM) -s $(exedir)/birdc $(sbindir)/ ; \
@@ -54,5 +59,5 @@ clean:
rm -f $(exedir)/bird $(exedir)/birdc $(exedir)/bird.ctl .dep-stamp
distclean: clean
- rm -f config.* configure sysdep/autoconf.h Makefile Rules
+ rm -f config.* configure sysdep/autoconf.h sysdep/paths.h Makefile Rules
rm -rf .dir-stamp $(clean-dirs)
diff --git a/tools/Rules.in b/tools/Rules.in
index 92dadcf..2d2a827 100644
--- a/tools/Rules.in
+++ b/tools/Rules.in
@@ -38,6 +38,7 @@ exec_prefix=@exec_prefix@
bindir=@bindir@
sbindir=@sbindir@
sysconfdir=@sysconfdir@
+localstatedir=@localstatedir@
ifdef source