diff --git a/aclocal.m4 b/aclocal.m4 index 3ceb6eb6..02c0f76b 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -133,6 +133,18 @@ if test "$bird_cv_struct_ip_mreqn" = yes ; then fi ]) +AC_DEFUN(BIRD_CHECK_PTHREADS, +[ + bird_tmp_cflags="$CFLAGS" + + CFLAGS="$CFLAGS -pthread" + AC_CACHE_CHECK([whether POSIX threads are available], bird_cv_lib_pthreads, + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[pthread_t pt; pthread_create(&pt, NULL, NULL, NULL); pthread_spinlock_t lock; pthread_spin_lock(&lock); ]])], + [bird_cv_lib_pthreads=yes], [bird_cv_lib_pthreads=no])]) + + CFLAGS="$bird_tmp_cflags" +]) + AC_DEFUN(BIRD_CHECK_GCC_OPTION, [ bird_tmp_cflags="$CFLAGS" diff --git a/conf/confbase.Y b/conf/confbase.Y index 83037182..c1f2ccf3 100644 --- a/conf/confbase.Y +++ b/conf/confbase.Y @@ -90,7 +90,7 @@ CF_DECLS %left '!' %nonassoc '.' -CF_KEYWORDS(DEFINE, ON, OFF, YES, NO, XS, XMS, XUS) +CF_KEYWORDS(DEFINE, ON, OFF, YES, NO, S, MS, US) CF_GRAMMAR @@ -129,11 +129,10 @@ expr: ; -/* XXX fix X* symbols, they collide with macros */ expr_us: - expr XS { $$ = (u32) $1 * 1000000; } - | expr XMS { $$ = (u32) $1 * 1000; } - | expr XUS { $$ = (u32) $1 * 1; } + expr S { $$ = (u32) $1 * 1000000; } + | expr MS { $$ = (u32) $1 * 1000; } + | expr US { $$ = (u32) $1 * 1; } ; /* expr_u16: expr { check_u16($1); $$ = $1; }; */ diff --git a/configure.in b/configure.in index 3b0f2e32..971532e1 100644 --- a/configure.in +++ b/configure.in @@ -9,6 +9,7 @@ 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(pthreads, [ --enable-pthreads enable POSIX threads support (default: detect)],,enable_pthreads=try) 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]) @@ -42,12 +43,6 @@ AC_SUBST(exedir) AC_SUBST(srcdir_rel_mf) AC_SUBST(runtimedir) -# all_protocols=bfd,bgp,ospf,pipe,radv,rip,static -all_protocols=pipe,radv,rip,static - -if test "$with_protocols" = all ; then - with_protocols="$all_protocols" -fi if test "$enable_debug" = yes ; then CONFIG_FILE="bird.conf" @@ -73,12 +68,29 @@ if test -z "$GCC" ; then AC_MSG_ERROR([This program requires the GNU C Compiler.]) fi +if test "$enable_pthreads" != no ; then + BIRD_CHECK_PTHREADS + + if test "$bird_cv_lib_pthreads" = yes ; then + AC_DEFINE(USE_PTHREADS) + CFLAGS="$CFLAGS -pthread" + LDFLAGS="$LDFLAGS -pthread" + proto_bfd=bfd + elif test "$enable_pthreads" = yes ; then + AC_MSG_ERROR([POSIX threads not available.]) + fi + + if test "$enable_pthreads" = try ; then + enable_pthreads="$bird_cv_lib_pthreads" + fi +fi + if test "$bird_cflags_default" = yes ; then BIRD_CHECK_GCC_OPTION(bird_cv_c_option_wno_pointer_sign, -Wno-pointer-sign, -Wall) BIRD_CHECK_GCC_OPTION(bird_cv_c_option_fno_strict_aliasing, -fno-strict-aliasing) BIRD_CHECK_GCC_OPTION(bird_cv_c_option_fno_strict_overflow, -fno-strict-overflow) - CFLAGS="$CFLAGS -pthread -Wall -Wstrict-prototypes -Wno-parentheses" + CFLAGS="$CFLAGS -Wall -Wstrict-prototypes -Wno-parentheses" BIRD_ADD_GCC_OPTION(bird_cv_c_option_wno_pointer_sign, -Wno-pointer-sign) BIRD_ADD_GCC_OPTION(bird_cv_c_option_fno_strict_aliasing, -fno-strict-aliasing) BIRD_ADD_GCC_OPTION(bird_cv_c_option_fno_strict_overflow, -fno-strict-overflow) @@ -154,6 +166,14 @@ fi AC_SUBST(iproutedir) +# all_protocols="$proto_bfd bgp ospf pipe radv rip static" +all_protocols="pipe radv rip static" +all_protocols=`echo $all_protocols | sed 's/ /,/g'` + +if test "$with_protocols" = all ; then + with_protocols="$all_protocols" +fi + AC_MSG_CHECKING([protocols]) protocols=`echo "$with_protocols" | sed 's/,/ /g'` if test "$protocols" = no ; then protocols= ; fi @@ -243,6 +263,7 @@ BIRD was configured with the following options: Iproute2 directory: $iproutedir System configuration: $sysdesc Debugging: $enable_debug + POSIX threads: $enable_pthreads Routing protocols: $protocols Client: $enable_client EOF diff --git a/doc/bird.sgml b/doc/bird.sgml index 63890031..46d2e026 100644 --- a/doc/bird.sgml +++ b/doc/bird.sgml @@ -144,7 +144,10 @@ options. The most important ones are: nonzero if there are some errors. -s - use given filename for a socket for communications with the client, default is /var/run/bird.ctl. + use given filename for a socket for communications with the client, default is /var/run/bird.ctl. + + -P + create a PID file with given filename. -u drop privileges and use that user ID, see the next section for details. @@ -915,62 +918,63 @@ bird> incompatible with each other (that is to prevent you from shooting in the foot). - .mask(num) - on values of type ip. It masks out all but first num bits from the IP - address. So .mask(num) on values of type ip. It masks out + all but first num bits from the IP address. So + ipaddress/pxlen, or + ipaddress/pxlen, or ipaddress/netmask. There are two special - operators on prefixes: - 1.2.0.0/16.pxlen = 16 is true. + operators on prefixes: 1.2.0.0/16.pxlen = 16 is true. - (, where (, + where int set look like - [ 1, 2, 5..7 ]. As you can see, both simple values and ranges are permitted in - sets. + int set look like [ + 1, 2, 5..7 ]. As you can see, both simple values and ranges are + permitted in sets. For pair sets, expressions like Protocols +