Annotation of embedaddon/bird/configure.ac, revision 1.1.1.1

1.1       misho       1: dnl ** This is a configure script template for BIRD
                      2: dnl ** Process it with autoconf to get ./configure
                      3: dnl ** (c) 1999--2000 Martin Mares <mj@ucw.cz>
                      4: 
                      5: AC_INIT
                      6: AC_CONFIG_SRCDIR([conf/confbase.Y])
                      7: AC_CONFIG_AUX_DIR([tools])
                      8: 
                      9: AC_ARG_ENABLE([client],
                     10:   [AS_HELP_STRING([--enable-client], [enable building of BIRD client @<:@yes@:>@])],
                     11:   [],
                     12:   [enable_client=yes]
                     13: )
                     14: 
                     15: AC_ARG_ENABLE([debug],
                     16:   [AS_HELP_STRING([--enable-debug], [enable internal debugging routines @<:@no@:>@])],
                     17:   [],
                     18:   [enable_debug=no]
                     19: )
                     20: 
                     21: AC_ARG_ENABLE([ipv6],
                     22:   [AS_HELP_STRING([--enable-ipv6], [enable building of IPv6 version @<:@no@:>@])],
                     23:   [],
                     24:   [enable_ipv6=no]
                     25: )
                     26: 
                     27: AC_ARG_ENABLE([memcheck],
                     28:   [AS_HELP_STRING([--enable-memcheck], [check memory allocations when debugging @<:@yes@:>@])],
                     29:   [],
                     30:   [enable_memcheck=yes]
                     31: )
                     32: 
                     33: AC_ARG_ENABLE([pthreads],
                     34:   [AS_HELP_STRING([--enable-pthreads], [enable POSIX threads support @<:@try@:>@])],
                     35:   [],
                     36:   [enable_pthreads=try]
                     37: )
                     38: 
                     39: AC_ARG_WITH([protocols],
                     40:   [AS_HELP_STRING([--with-protocols=LIST], [include specified routing protocols @<:@all@:>@])],
                     41:   [],
                     42:   [with_protocols="all"]
                     43: )
                     44: 
                     45: AC_ARG_WITH([suffix],
                     46:   [AS_HELP_STRING([--with-suffix=STRING], [use specified suffix for BIRD files @<:@6 for IPv6@:>@])],
                     47:   [given_suffix="yes"]
                     48: )
                     49: 
                     50: AC_ARG_WITH([sysconfig],
                     51:   [AS_HELP_STRING([--with-sysconfig=FILE], [use specified BIRD system configuration file])]
                     52: )
                     53: 
                     54: AC_ARG_WITH([runtimedir],
                     55:   [AS_HELP_STRING([--with-runtimedir=PATH], [run-state data, obsolete variant of --runstatedir])],
                     56:   [runstatedir="$with_runtimedir"]
                     57: )
                     58: 
                     59: AC_ARG_WITH([iproutedir],
                     60:   [AS_HELP_STRING([--with-iproutedir=PATH], [path to iproute2 config files @<:@/etc/iproute2@:>@])],
                     61:   [given_iproutedir="yes"]
                     62: )
                     63: 
                     64: AC_ARG_VAR([FLEX], [location of the Flex program])
                     65: AC_ARG_VAR([BISON], [location of the Bison program])
                     66: AC_ARG_VAR([M4], [location of the M4 program])
                     67: 
                     68: 
                     69: if test "$srcdir" = . ; then
                     70:   # Building in current directory => create obj directory holding all objects
                     71:   objdir=obj
                     72:   mkdir -p obj
                     73:   srcdir_rel=..
                     74:   makefiles="Makefile:tools/Makefile-top.in obj/Makefile:tools/Makefile.in obj/Rules:tools/Rules.in"
                     75:   exedir=..
                     76: else
                     77:   # Building in separate directory
                     78:   objdir=.
                     79:   srcdir_rel=$srcdir
                     80:   makefiles="Makefile:tools/Makefile.in Rules:tools/Rules.in"
                     81:   exedir=.
                     82: fi
                     83: 
                     84: case $srcdir_rel in
                     85:   /*)  srcdir_rel_mf=$srcdir_rel ;;
                     86:   *)   srcdir_rel_mf="\$(root-rel)$srcdir_rel" ;;
                     87: esac
                     88: 
                     89: AC_SUBST([objdir])
                     90: AC_SUBST([exedir])
                     91: AC_SUBST([srcdir_rel_mf])
                     92: 
                     93: # Workaround for older Autoconfs that do not define runstatedir
                     94: AS_IF([test -z "${runstatedir}"], [runstatedir='${localstatedir}/run'])
                     95: AC_SUBST([runstatedir])
                     96: 
                     97: 
                     98: if test "$enable_ipv6" = yes ; then
                     99:   ip=ipv6
                    100:   SUFFIX=6
                    101:   proto_radv=radv
                    102: else
                    103:   ip=ipv4
                    104:   SUFFIX=""
                    105: fi
                    106: 
                    107: if test "$given_suffix" = yes ; then
                    108:   SUFFIX="$with_suffix"
                    109: fi
                    110: AC_SUBST([SUFFIX])
                    111: 
                    112: if test "$enable_debug" = yes ; then
                    113:   CONFIG_FILE="bird$SUFFIX.conf"
                    114:   CONTROL_SOCKET="bird$SUFFIX.ctl"
                    115: else
                    116:   CONFIG_FILE="\$(sysconfdir)/bird$SUFFIX.conf"
                    117:   CONTROL_SOCKET="\$(runstatedir)/bird$SUFFIX.ctl"
                    118: fi
                    119: AC_SUBST([CONFIG_FILE])
                    120: AC_SUBST([CONTROL_SOCKET])
                    121: 
                    122: AC_SEARCH_LIBS([clock_gettime], [rt posix4],
                    123:   [],
                    124:   [AC_MSG_ERROR([Function clock_gettime not available.])]
                    125: )
                    126: 
                    127: AC_CANONICAL_HOST
                    128: 
                    129: # Store this value because ac_test_CFLAGS is overwritten by AC_PROG_CC
                    130: if test "$ac_test_CFLAGS" != set ; then
                    131:   bird_cflags_default=yes
                    132: fi
                    133: 
                    134: AC_PROG_CC
                    135: if test -z "$GCC" ; then
                    136:   AC_MSG_ERROR([This program requires the GNU C Compiler.])
                    137: fi
                    138: 
                    139: if test "$enable_pthreads" != no ; then
                    140:   BIRD_CHECK_PTHREADS
                    141: 
                    142:   if test "$bird_cv_lib_pthreads" = yes ; then
                    143:     AC_DEFINE([USE_PTHREADS], [1], [Define to 1 if pthreads are enabled])
                    144:     CFLAGS="$CFLAGS -pthread"
                    145:     LDFLAGS="$LDFLAGS -pthread"
                    146:     proto_bfd=bfd
                    147:   elif test "$enable_pthreads" = yes ; then
                    148:     AC_MSG_ERROR([POSIX threads not available.])
                    149:   fi
                    150: 
                    151:   if test "$enable_pthreads" = try ; then
                    152:     enable_pthreads="$bird_cv_lib_pthreads"
                    153:   fi
                    154: fi
                    155: 
                    156: if test "$bird_cflags_default" = yes ; then
                    157:   BIRD_CHECK_GCC_OPTION([bird_cv_c_option_wno_pointer_sign], [-Wno-pointer-sign], [-Wall])
                    158:   BIRD_CHECK_GCC_OPTION([bird_cv_c_option_wno_missing_init], [-Wno-missing-field-initializers], [-Wall -Wextra])
                    159:   BIRD_CHECK_GCC_OPTION([bird_cv_c_option_fno_strict_aliasing], [-fno-strict-aliasing])
                    160:   BIRD_CHECK_GCC_OPTION([bird_cv_c_option_fno_strict_overflow], [-fno-strict-overflow])
                    161: 
                    162:   CFLAGS="$CFLAGS -Wall -Wextra -Wstrict-prototypes -Wno-parentheses"
                    163:   BIRD_ADD_GCC_OPTION([bird_cv_c_option_wno_pointer_sign], [-Wno-pointer-sign])
                    164:   BIRD_ADD_GCC_OPTION([bird_cv_c_option_wno_missing_init], [-Wno-missing-field-initializers])
                    165:   BIRD_ADD_GCC_OPTION([bird_cv_c_option_fno_strict_aliasing], [-fno-strict-aliasing])
                    166:   BIRD_ADD_GCC_OPTION([bird_cv_c_option_fno_strict_overflow], [-fno-strict-overflow])
                    167: fi
                    168: AC_MSG_CHECKING([CFLAGS])
                    169: AC_MSG_RESULT([$CFLAGS])
                    170: 
                    171: 
                    172: AC_PROG_CPP
                    173: AC_PROG_INSTALL
                    174: AC_PROG_RANLIB
                    175: AC_CHECK_PROG([FLEX], [flex], [flex])
                    176: AC_CHECK_PROG([BISON], [bison], [bison])
                    177: AC_CHECK_PROGS([M4], [gm4 m4])
                    178: 
                    179: test -z "$FLEX"         && AC_MSG_ERROR([Flex is missing.])
                    180: test -z "$BISON" && AC_MSG_ERROR([Bison is missing.])
                    181: test -z "$M4"   && AC_MSG_ERROR([M4 is missing.])
                    182: 
                    183: BIRD_CHECK_PROG_FLAVOR_GNU([$M4],
                    184:   [],
                    185:   [AC_MSG_ERROR([Provided M4 is not GNU M4.])]
                    186: )
                    187: 
                    188: if test -n "$with_sysconfig" -a "$with_sysconfig" != no ; then
                    189:   if test -f $with_sysconfig ; then
                    190:     sysdesc=$with_sysconfig
                    191:   else
                    192:     sysdesc=$srcdir/sysdep/cf/$with_sysconfig
                    193:     if ! test -f $sysdesc ; then
                    194:       sysdesc=$sysdesc.h
                    195:     fi
                    196:   fi
                    197: elif test -f sysconfig.h ; then
                    198:   sysdesc=sysconfig
                    199: else
                    200:   case "$ip:$host_os" in
                    201:     ipv6:linux*)
                    202:       sysdesc=linux-v6
                    203:       default_iproutedir="/etc/iproute2"
                    204:       ;;
                    205:     ipv4:linux*)
                    206:       sysdesc=linux
                    207:       default_iproutedir="/etc/iproute2"
                    208:       ;;
                    209:     ipv6:netbsd*)
                    210:       sysdesc=bsd-v6
                    211:       CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
                    212:       LDFLAGS="$LDFLAGS -L/usr/pkg/lib -R/usr/pkg/lib"
                    213:       ;;
                    214:     ipv4:netbsd*)
                    215:       sysdesc=bsd
                    216:       CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
                    217:       LDFLAGS="$LDFLAGS -L/usr/pkg/lib -R/usr/pkg/lib"
                    218:       ;;
                    219:     ipv6:freebsd*)
                    220:       sysdesc=bsd-v6
                    221:       CPPFLAGS="$CPPFLAGS -I/usr/local/include"
                    222:       LDFLAGS="$LDFLAGS -L/usr/local/lib"
                    223:       ;;
                    224:     ipv4:freebsd*)
                    225:       sysdesc=bsd
                    226:       CPPFLAGS="$CPPFLAGS -I/usr/local/include"
                    227:       LDFLAGS="$LDFLAGS -L/usr/local/lib"
                    228:       ;;
                    229:     ipv6:dragonfly*)
                    230:       sysdesc=bsd-v6
                    231:       ;;
                    232:     ipv4:dragonfly*)
                    233:       sysdesc=bsd
                    234:       ;;
                    235:     ipv6:kfreebsd*)
                    236:       sysdesc=bsd-v6
                    237:       ;;
                    238:     ipv4:kfreebsd*)
                    239:       sysdesc=bsd
                    240:       ;;
                    241:     ipv6:openbsd*)
                    242:       sysdesc=bsd-v6
                    243:       ;;
                    244:     ipv4:openbsd*)
                    245:       sysdesc=bsd
                    246:       ;;
                    247:     *)
                    248:       AC_MSG_ERROR([Cannot determine correct system configuration. Please use --with-sysconfig to set it manually.])
                    249:       ;;
                    250:   esac
                    251:   sysdesc=$srcdir/sysdep/cf/$sysdesc.h
                    252: fi
                    253: AC_MSG_CHECKING([which OS configuration should we use])
                    254: AC_MSG_RESULT([$sysdesc])
                    255: if ! test -f $sysdesc ; then
                    256:   AC_MSG_ERROR([The system configuration file is missing.])
                    257: fi
                    258: sysname=`echo $sysdesc | sed 's/\.h$//'`
                    259: AC_DEFINE_UNQUOTED([SYSCONF_INCLUDE], ["$sysdesc"], [Which sysdep header to include])
                    260: 
                    261: AC_MSG_CHECKING([system-dependent directories])
                    262: sysdep_dirs="`sed <$sysdesc '/^Link: /!d;s/^Link: \(.*\)$/\1/' | tr '\012' ' '` lib"
                    263: AC_MSG_RESULT([$sysdep_dirs])
                    264: AC_SUBST([sysdep_dirs])
                    265: 
                    266: if test "$with_iproutedir" = no ; then with_iproutedir= ; fi
                    267: 
                    268: if test -n "$given_iproutedir"
                    269: then iproutedir=$with_iproutedir
                    270: else iproutedir=$default_iproutedir
                    271: fi
                    272: 
                    273: AC_SUBST([iproutedir])
                    274: 
                    275: all_protocols="$proto_bfd bgp mrt ospf pipe $proto_radv rip static"
                    276: if test "$ip" = ipv6 ; then
                    277:    all_protocols="$all_protocols babel"
                    278: fi
                    279: all_protocols=`echo $all_protocols | sed 's/ /,/g'`
                    280: 
                    281: if test "$with_protocols" = all ; then
                    282:   with_protocols="$all_protocols"
                    283: fi
                    284: 
                    285: AH_TEMPLATE([CONFIG_BABEL],    [Babel protocol])
                    286: AH_TEMPLATE([CONFIG_BFD],      [BFD protocol])
                    287: AH_TEMPLATE([CONFIG_BGP],      [BGP protocol])
                    288: AH_TEMPLATE([CONFIG_MRT],      [MRT protocol])
                    289: AH_TEMPLATE([CONFIG_OSPF],     [OSPF protocol])
                    290: AH_TEMPLATE([CONFIG_PIPE],     [Pipe protocol])
                    291: AH_TEMPLATE([CONFIG_RADV],     [RAdv protocol])
                    292: AH_TEMPLATE([CONFIG_RIP],      [RIP protocol])
                    293: AH_TEMPLATE([CONFIG_STATIC],   [Static protocol])
                    294: 
                    295: AC_MSG_CHECKING([protocols])
                    296: protocols=`echo "$with_protocols" | sed 's/,/ /g'`
                    297: if test "$protocols" = no ; then protocols= ; fi
                    298: for a in $protocols ; do
                    299:   if ! test -f $srcdir/proto/$a/Makefile ; then
                    300:     AC_MSG_RESULT([failed])
                    301:     AC_MSG_ERROR([Requested protocol $a not found])
                    302:   fi
                    303:   AC_DEFINE_UNQUOTED([CONFIG_`echo $a | tr 'a-z' 'A-Z'`])
                    304: done
                    305: AC_MSG_RESULT([ok])
                    306: AC_SUBST([protocols])
                    307: 
                    308: case $sysdesc in
                    309:   */linux*|*/linux-v6*)
                    310:     AC_CHECK_HEADER([linux/rtnetlink.h],
                    311:       [],
                    312:       [AC_MSG_ERROR([Appropriate version of Linux kernel headers not found.])],
                    313:       [
                    314:        dnl Some older versions of Linux kernel headers require these includes
                    315:        #include <asm/types.h>
                    316:        #include <sys/socket.h>
                    317:       ]
                    318:     )
                    319:     ;;
                    320: esac
                    321: 
                    322: AC_CHECK_HEADERS_ONCE([alloca.h syslog.h])
                    323: AC_CHECK_MEMBERS([struct sockaddr.sa_len], [], [], [#include <sys/socket.h>])
                    324: 
                    325: AC_C_BIGENDIAN(
                    326:   [AC_DEFINE([CPU_BIG_ENDIAN], [1], [Define to 1 if cpu is big endian])],
                    327:   [AC_DEFINE([CPU_LITTLE_ENDIAN], [1], [Define to 1 if cpu is little endian])],
                    328:   [AC_MSG_ERROR([Cannot determine CPU endianity.])]
                    329: )
                    330: 
                    331: BIRD_CHECK_ANDROID_GLOB
                    332: if test "$bird_cv_lib_glob" = no ; then
                    333:   AC_MSG_ERROR([glob.h not found.])
                    334: elif test "$bird_cv_lib_glob" != yes ; then
                    335:   LIBS="$LIBS $bird_cv_lib_glob"
                    336: fi
                    337: 
                    338: BIRD_CHECK_ANDROID_LOG
                    339: if test "$bird_cv_lib_log" = no ; then
                    340:   AC_MSG_ERROR([don't know how to link syslog.])
                    341: elif test "$bird_cv_lib_log" != yes ; then
                    342:   LIBS="$LIBS $bird_cv_lib_log"
                    343: fi
                    344: 
                    345: if test "$enable_debug" = yes ; then
                    346:   AC_DEFINE([DEBUGGING], [1], [Define to 1 if debugging is enabled])
                    347:   if test "$enable_memcheck" = yes ; then
                    348:     AC_CHECK_LIB([dmalloc], [dmalloc_debug])
                    349:     if test $ac_cv_lib_dmalloc_dmalloc_debug != yes ; then
                    350:       AC_CHECK_LIB([efence], [malloc])
                    351:     fi
                    352:   fi
                    353: fi
                    354: 
                    355: CLIENT=
                    356: CLIENT_LIBS=
                    357: if test "$enable_client" = yes ; then
                    358:   CLIENT=birdc
                    359:   BASE_LIBS="$LIBS"
                    360:   LIBS=""
                    361: 
                    362:   AC_CHECK_HEADERS([curses.h],
                    363:     [],
                    364:     [AC_MSG_ERROR([The client requires ncurses library. Either install the library or use --disable-client to compile without the client.])],
                    365:     [AC_INCLUDES_DEFAULT]
                    366:   )
                    367: 
                    368:   AC_SEARCH_LIBS([tgetent], [tinfo tinfow ncurses curses termcap],
                    369:     [TINFO_LIBS="$LIBS"; LIBS=""],
                    370:     [AC_MSG_ERROR([The client requires ncurses library. Either install the library or use --disable-client to compile without the client.])],
                    371:   )
                    372: 
                    373:   AC_CHECK_HEADERS([readline/readline.h readline/history.h],
                    374:     [],
                    375:     [AC_MSG_ERROR([The client requires GNU Readline library. Either install the library or use --disable-client to compile without the client.])],
                    376:     [AC_INCLUDES_DEFAULT]
                    377:   )
                    378: 
                    379:   AC_SEARCH_LIBS([rl_callback_read_char], [readline],
                    380:     [READLINE_LIBS="$LIBS"; LIBS=""],
                    381:     [AC_MSG_ERROR([The client requires GNU Readline library. Either install the library or use --disable-client to compile without the client.])],
                    382:     [$TINFO_LIBS]
                    383:   )
                    384: 
                    385:   AC_CHECK_LIB([readline], [rl_crlf],
                    386:     [AC_DEFINE([HAVE_RL_CRLF], [1], [Define to 1 if you have rl_crlf()])],
                    387:     [],
                    388:     [$TINFO_LIBS]
                    389:   )
                    390: 
                    391:   AC_CHECK_LIB([readline], [rl_ding],
                    392:     [AC_DEFINE([HAVE_RL_DING], [1], [Define to 1 if you have rl_ding()])],
                    393:     [],
                    394:     [$TINFO_LIBS]
                    395:   )
                    396: 
                    397:   LIBS="$BASE_LIBS"
                    398:   CLIENT_LIBS="$READLINE_LIBS $TINFO_LIBS"
                    399: fi
                    400: AC_SUBST([CLIENT])
                    401: AC_SUBST([CLIENT_LIBS])
                    402: 
                    403: mkdir -p $objdir/sysdep
                    404: AC_CONFIG_HEADERS([$objdir/sysdep/autoconf.h:sysdep/autoconf.h.in])
                    405: AC_CONFIG_COMMANDS([merge],
                    406:   [ export CPP="$CPP"; sh $srcdir/tools/mergedirs $srcdir $srcdir_rel $objdir $sysdep_dirs ],
                    407:   [
                    408:     srcdir=$srcdir
                    409:     srcdir_rel=$srcdir_rel
                    410:     objdir=$objdir
                    411:     sysdep_dirs="$sysdep_dirs"
                    412:   ]
                    413: )
                    414: AC_CONFIG_FILES([$makefiles])
                    415: AC_OUTPUT
                    416: 
                    417: rm -f $objdir/sysdep/paths.h
                    418: 
                    419: AC_MSG_RESULT()
                    420: AC_MSG_RESULT([BIRD was configured with the following options:])
                    421: AC_MSG_RESULT([        Source directory:       $srcdir])
                    422: AC_MSG_RESULT([        Object directory:       $objdir])
                    423: AC_MSG_RESULT([        Iproute2 directory:     $iproutedir])
                    424: AC_MSG_RESULT([        System configuration:   $sysdesc])
                    425: AC_MSG_RESULT([        Debugging:              $enable_debug])
                    426: AC_MSG_RESULT([        POSIX threads:          $enable_pthreads])
                    427: AC_MSG_RESULT([        Routing protocols:      $protocols])
                    428: AC_MSG_RESULT([        Client:                 $enable_client])
                    429: 
                    430: rm -f $objdir/.*-stamp

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>