]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Implements build options to specify socket dir and suffix.
authorOndrej Zajicek <santiago@crfreenet.org>
Thu, 3 May 2012 10:25:15 +0000 (12:25 +0200)
committerOndrej Zajicek <santiago@crfreenet.org>
Thu, 3 May 2012 10:25:15 +0000 (12:25 +0200)
configure.in
sysdep/autoconf.h.in
sysdep/config.h
sysdep/unix/main.c
tools/Makefile.in

index 7d9560d3718eaa116725503f1780bde8e31cba6d..dd57ab513769a96fdb6b280abac6f68cc74d514e 100644 (file)
@@ -6,17 +6,20 @@ AC_REVISION($Id$)
 AC_INIT(conf/confbase.Y)
 AC_CONFIG_AUX_DIR(tools)
 
-AC_ARG_ENABLE(debug,[  --enable-debug          enable internal debugging routines (default: disabled)],,enable_debug=no)
-AC_ARG_ENABLE(memcheck,[  --enable-memcheck       check memory allocations when debugging (default: enabled)],,enable_memcheck=yes)
-AC_ARG_ENABLE(client,[  --enable-client         enable building of BIRD client (default: enabled)],,enable_client=yes)
-AC_ARG_ENABLE(ipv6,[  --enable-ipv6           enable building of IPv6 version (default: disabled)],,enable_ipv6=no)
-AC_ARG_WITH(sysconfig,[  --with-sysconfig=FILE   use specified BIRD system configuration file])
-AC_ARG_WITH(protocols,[  --with-protocols=LIST   include specified routing protocols (default: all)],,[with_protocols="all"])
-AC_ARG_WITH(sysinclude,[  --with-sysinclude=PATH  search for system includes on specified place])
-AC_ARG_WITH(iproutedir,[  --with-iproutedir=PATH  path to iproute2 config files (default: /etc/iproute2)],[given_iproutedir="yes"])
-AC_ARG_VAR([FLEX], [location of the Flex program]) 
-AC_ARG_VAR([BISON], [location of the Bison program]) 
-AC_ARG_VAR([M4], [location of the M4 program]) 
+AC_ARG_ENABLE(debug,   [  --enable-debug          enable internal debugging routines (default: disabled)],,enable_debug=no)
+AC_ARG_ENABLE(memcheck,        [  --enable-memcheck       check memory allocations when debugging (default: enabled)],,enable_memcheck=yes)
+AC_ARG_ENABLE(client,  [  --enable-client         enable building of BIRD client (default: enabled)],,enable_client=yes)
+AC_ARG_ENABLE(ipv6,    [  --enable-ipv6           enable building of IPv6 version (default: disabled)],,enable_ipv6=no)
+AC_ARG_WITH(suffix,    [  --with-suffix=STRING    use specified suffix for BIRD files (default: 6 for IPv6 version)],[given_suffix="yes"])
+AC_ARG_WITH(sysconfig, [  --with-sysconfig=FILE   use specified BIRD system configuration file])
+AC_ARG_WITH(protocols, [  --with-protocols=LIST   include specified routing protocols (default: all)],,[with_protocols="all"])
+AC_ARG_WITH(sysinclude,        [  --with-sysinclude=PATH  search for system includes on specified place])
+AC_ARG_WITH(runtimedir,        [  --with-runtimedir=PATH  path for runtime files (default: $(localstatedir)/run)],[runtimedir="$with_runtimedir"],[runtimedir="\$(localstatedir)/run"])
+AC_ARG_WITH(iproutedir,        [  --with-iproutedir=PATH  path to iproute2 config files (default: /etc/iproute2)],[given_iproutedir="yes"])
+AC_ARG_VAR([FLEX], [location of the Flex program])
+AC_ARG_VAR([BISON], [location of the Bison program])
+AC_ARG_VAR([M4], [location of the M4 program])
+
 
 if test "$srcdir" = . ; then
        # Building in current directory => create obj directory holding all objects
@@ -39,21 +42,37 @@ esac
 AC_SUBST(objdir)
 AC_SUBST(exedir)
 AC_SUBST(srcdir_rel_mf)
+AC_SUBST(runtimedir)
 
 if test "$enable_ipv6" = yes ; then
        ip=ipv6
-       SUFFIX6=6
+       SUFFIX=6
        all_protocols=bgp,ospf,pipe,radv,rip,static
 else
        ip=ipv4
-       SUFFIX6=""
+       SUFFIX=""
        all_protocols=bgp,ospf,pipe,rip,static
 fi
 
+if test "$given_suffix" = yes ; then
+       SUFFIX="$with_suffix"
+fi
+AC_SUBST(SUFFIX)
+
 if test "$with_protocols" = all ; then
        with_protocols="$all_protocols"
 fi
 
+if test "$enable_debug" = yes ; then
+       CONFIG_FILE="bird$SUFFIX.conf"
+       CONTROL_SOCKET="bird$SUFFIX.ctl"
+else
+       CONFIG_FILE="\$(sysconfdir)/bird$SUFFIX.conf"
+       CONTROL_SOCKET="$runtimedir/bird$SUFFIX.ctl"
+fi
+AC_SUBST(CONFIG_FILE)
+AC_SUBST(CONTROL_SOCKET)
+
 AC_SEARCH_LIBS(clock_gettime,[c rt posix4])
 
 AC_CANONICAL_HOST
@@ -225,7 +244,6 @@ if test "$enable_client" = yes ; then
 fi
 AC_SUBST(CLIENT)
 AC_SUBST(CLIENT_LIBS)
-AC_SUBST(SUFFIX6)
 
 mkdir -p $objdir/sysdep
 AC_CONFIG_HEADERS([$objdir/sysdep/autoconf.h:sysdep/autoconf.h.in])
index d029e2a7d40da06262f2868fa24de43c9271c221..ac6f7a8765b4cf48f0375eed8c273014fc16e67e 100644 (file)
@@ -62,3 +62,4 @@
 /* We have stdint.h */
 #undef HAVE_STDINT_H
 
+#define CONFIG_PATH ?
index 7e6fad8b4621cd242fe89659654c59567494ac2e..8d93d3811ab492d669bf2bb6b09405ca8aa2fa02 100644 (file)
@@ -37,23 +37,4 @@ typedef u16 word;
 
 #endif
 
-/* Path to configuration file */
-#ifdef IPV6
-#  ifdef DEBUGGING
-#    define PATH_CONFIG "bird6.conf"
-#    define PATH_CONTROL_SOCKET "bird6.ctl"
-#  else
-#    define PATH_CONFIG PATH_CONFIG_DIR "/bird6.conf"
-#    define PATH_CONTROL_SOCKET PATH_CONTROL_SOCKET_DIR "/bird6.ctl"
-#  endif
-#else
-#  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
-
 #endif
index dfe0b89c1534ec071e73eae9719f91cec169cebd..e0563aaedd5a3d41de5f331a31fb228fbaa311c5 100644 (file)
@@ -151,7 +151,7 @@ read_iproute_table(char *file, char *prefix, int max)
 #endif // PATH_IPROUTE_DIR
 
 
-static char *config_name = PATH_CONFIG;
+static char *config_name = PATH_CONFIG_FILE;
 
 static int
 cf_read(byte *dest, unsigned int len, int fd)
index 556eba5fa2f863a005952940dc5b6afbbe711831..728e5797f2004166e655264199961cab8336fc9d 100644 (file)
@@ -48,23 +48,23 @@ userdocs progdocs: .dir-stamp
 
 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)/run\""
+       echo >>sysdep/paths.h "#define PATH_CONFIG_FILE \"@CONFIG_FILE@\""
+       echo >>sysdep/paths.h "#define PATH_CONTROL_SOCKET \"@CONTROL_SOCKET@\""
        if test -n "@iproutedir@" ; then echo >>sysdep/paths.h "#define PATH_IPROUTE_DIR \"@iproutedir@\"" ; fi
 
 tags:
        cd $(srcdir) ; etags -lc `find $(static-dirs) $(addprefix $(objdir)/,$(dynamic-dirs)) $(client-dirs) -name *.[chY]`
 
 install: all
-       $(INSTALL) -d $(DESTDIR)/$(sbindir) $(DESTDIR)/$(sysconfdir) $(DESTDIR)/$(localstatedir)/run
-       $(INSTALL_PROGRAM) -s $(exedir)/bird $(DESTDIR)/$(sbindir)/bird@SUFFIX6@
+       $(INSTALL) -d $(DESTDIR)/$(sbindir) $(DESTDIR)/$(sysconfdir) $(DESTDIR)/@runtimedir@
+       $(INSTALL_PROGRAM) -s $(exedir)/bird $(DESTDIR)/$(sbindir)/bird@SUFFIX@
        if test -n "@CLIENT@" ; then                                                            \
-               $(INSTALL_PROGRAM) -s $(exedir)/birdc $(DESTDIR)/$(sbindir)/birdc@SUFFIX6@ ;                            \
+               $(INSTALL_PROGRAM) -s $(exedir)/birdc $(DESTDIR)/$(sbindir)/birdc@SUFFIX@ ;     \
        fi
-       if ! test -f $(DESTDIR)/$(sysconfdir)/bird@SUFFIX6@.conf ; then                                         \
-               $(INSTALL_DATA) $(srcdir)/doc/bird.conf.example $(DESTDIR)/$(sysconfdir)/bird@SUFFIX6@.conf ;   \
+       if ! test -f $(DESTDIR)/@CONFIG_FILE@ ; then                                            \
+               $(INSTALL_DATA) $(srcdir)/doc/bird.conf.example $(DESTDIR)/@CONFIG_FILE@ ;      \
        else                                                                                    \
-               echo "Not overwriting old bird@SUFFIX@.conf" ;                                          \
+               echo "Not overwriting old bird@SUFFIX@.conf" ;                                  \
        fi
 
 install-docs: