Annotation of embedaddon/bird/configure.in, revision 1.1.1.1.2.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: 
1.1.1.1.2.1! misho       5: AC_REVISION($Id: configure.in,v 1.1.1.1 2017/08/22 12:33:54 misho Exp $)
1.1       misho       6: AC_INIT(conf/confbase.Y)
                      7: AC_CONFIG_AUX_DIR(tools)
                      8: 
                      9: AC_ARG_ENABLE(debug,   [  --enable-debug          enable internal debugging routines (default: disabled)],,enable_debug=no)
                     10: AC_ARG_ENABLE(memcheck,        [  --enable-memcheck       check memory allocations when debugging (default: enabled)],,enable_memcheck=yes)
                     11: AC_ARG_ENABLE(client,  [  --enable-client         enable building of BIRD client (default: enabled)],,enable_client=yes)
                     12: AC_ARG_ENABLE(ipv6,    [  --enable-ipv6           enable building of IPv6 version (default: disabled)],,enable_ipv6=no)
                     13: AC_ARG_ENABLE(pthreads,        [  --enable-pthreads       enable POSIX threads support (default: detect)],,enable_pthreads=try)
                     14: AC_ARG_WITH(suffix,    [  --with-suffix=STRING    use specified suffix for BIRD files (default: 6 for IPv6 version)],[given_suffix="yes"])
                     15: AC_ARG_WITH(sysconfig, [  --with-sysconfig=FILE   use specified BIRD system configuration file])
                     16: AC_ARG_WITH(protocols, [  --with-protocols=LIST   include specified routing protocols (default: all)],,[with_protocols="all"])
                     17: AC_ARG_WITH(sysinclude,        [  --with-sysinclude=PATH  search for system includes on specified place])
                     18: AC_ARG_WITH(runtimedir,        [  --with-runtimedir=PATH  path for runtime files (default: $(localstatedir)/run)],[runtimedir="$with_runtimedir"],[runtimedir="\$(localstatedir)/run"])
                     19: AC_ARG_WITH(iproutedir,        [  --with-iproutedir=PATH  path to iproute2 config files (default: /etc/iproute2)],[given_iproutedir="yes"])
                     20: AC_ARG_VAR([FLEX], [location of the Flex program])
                     21: AC_ARG_VAR([BISON], [location of the Bison program])
                     22: AC_ARG_VAR([M4], [location of the M4 program])
                     23: 
                     24: 
                     25: if test "$srcdir" = . ; then
                     26:        # Building in current directory => create obj directory holding all objects
                     27:        objdir=obj
                     28:        mkdir -p obj
                     29:        srcdir_rel=..
                     30:        makefiles="Makefile:tools/Makefile-top.in obj/Makefile:tools/Makefile.in obj/Rules:tools/Rules.in"
                     31:        exedir=..
                     32: else
                     33:        # Building in separate directory
                     34:        objdir=.
                     35:        srcdir_rel=$srcdir
                     36:        makefiles="Makefile:tools/Makefile.in Rules:tools/Rules.in"
                     37:        exedir=.
                     38: fi
                     39: case $srcdir_rel in
                     40:        /*)     srcdir_rel_mf=$srcdir_rel ;;
                     41:        *)      srcdir_rel_mf="\$(root-rel)$srcdir_rel" ;;
                     42: esac
                     43: AC_SUBST(objdir)
                     44: AC_SUBST(exedir)
                     45: AC_SUBST(srcdir_rel_mf)
                     46: AC_SUBST(runtimedir)
                     47: 
                     48: if test "$enable_ipv6" = yes ; then
                     49:        ip=ipv6
                     50:        SUFFIX=6
                     51:        proto_radv=radv
                     52: else
                     53:        ip=ipv4
                     54:        SUFFIX=""
                     55: fi
                     56: 
                     57: if test "$given_suffix" = yes ; then
                     58:        SUFFIX="$with_suffix"
                     59: fi
                     60: AC_SUBST(SUFFIX)
                     61: 
                     62: if test "$enable_debug" = yes ; then
                     63:        CONFIG_FILE="bird$SUFFIX.conf"
                     64:        CONTROL_SOCKET="bird$SUFFIX.ctl"
                     65: else
                     66:        CONFIG_FILE="\$(sysconfdir)/bird$SUFFIX.conf"
                     67:        CONTROL_SOCKET="$runtimedir/bird$SUFFIX.ctl"
                     68: fi
                     69: AC_SUBST(CONFIG_FILE)
                     70: AC_SUBST(CONTROL_SOCKET)
                     71: 
                     72: AC_SEARCH_LIBS(clock_gettime, [c rt posix4], ,
                     73:        AC_MSG_ERROR([[Function clock_gettime not available.]]))
                     74: 
                     75: AC_CANONICAL_HOST
                     76: 
                     77: # Store this value because ac_test_CFLAGS is overwritten by AC_PROG_CC
                     78: if test "$ac_test_CFLAGS" != set ; then
                     79:        bird_cflags_default=yes
                     80: fi
                     81: 
                     82: AC_PROG_CC
                     83: if test -z "$GCC" ; then
                     84:        AC_MSG_ERROR([This program requires the GNU C Compiler.])
                     85: fi
                     86: 
                     87: # Enable threads by default just in Linux and FreeBSD
                     88: #if test "$enable_pthreads" = try ; then
                     89: #      case "$host_os" in
                     90: #              (linux* | freebsd* | openbsd* | netbsd* )       enable_pthreads=try ;;
                     91: #              (*)                             enable_pthreads=no ;;
                     92: #      esac
                     93: #fi
                     94: 
                     95: if test "$enable_pthreads" != no ; then
                     96:        BIRD_CHECK_PTHREADS
                     97: 
                     98:        if test "$bird_cv_lib_pthreads" = yes ; then
                     99:                AC_DEFINE(USE_PTHREADS)
                    100:                CFLAGS="$CFLAGS -pthread"
                    101:                LDFLAGS="$LDFLAGS -pthread"
                    102:                proto_bfd=bfd
                    103:        elif test "$enable_pthreads" = yes ; then
                    104:                AC_MSG_ERROR([POSIX threads not available.])
                    105:        fi
                    106: 
                    107:        if test "$enable_pthreads" = try ; then
                    108:                enable_pthreads="$bird_cv_lib_pthreads"
                    109:        fi
                    110: fi
                    111: 
                    112: if test "$bird_cflags_default" = yes ; then
                    113:        BIRD_CHECK_GCC_OPTION(bird_cv_c_option_wno_pointer_sign, -Wno-pointer-sign, -Wall)
                    114:        BIRD_CHECK_GCC_OPTION(bird_cv_c_option_wno_missing_init, -Wno-missing-field-initializers, -Wall -Wextra)
                    115:        BIRD_CHECK_GCC_OPTION(bird_cv_c_option_fno_strict_aliasing, -fno-strict-aliasing)
                    116:        BIRD_CHECK_GCC_OPTION(bird_cv_c_option_fno_strict_overflow, -fno-strict-overflow)
                    117: 
                    118:        CFLAGS="$CFLAGS -Wall -Wextra -Wstrict-prototypes -Wno-parentheses"
                    119:        BIRD_ADD_GCC_OPTION(bird_cv_c_option_wno_pointer_sign, -Wno-pointer-sign)
                    120:        BIRD_ADD_GCC_OPTION(bird_cv_c_option_wno_missing_init, -Wno-missing-field-initializers)
                    121:        BIRD_ADD_GCC_OPTION(bird_cv_c_option_fno_strict_aliasing, -fno-strict-aliasing)
                    122:        BIRD_ADD_GCC_OPTION(bird_cv_c_option_fno_strict_overflow, -fno-strict-overflow)
                    123: fi
                    124: AC_MSG_CHECKING([CFLAGS])
                    125: AC_MSG_RESULT($CFLAGS)
                    126: 
                    127: 
                    128: AC_PROG_CPP
                    129: AC_PROG_INSTALL
                    130: AC_PROG_RANLIB
                    131: AC_CHECK_PROG(FLEX, flex, flex)
                    132: AC_CHECK_PROG(BISON, bison, bison)
                    133: AC_CHECK_PROGS(M4, gm4 m4)
                    134: 
                    135: test -z "$FLEX"         && AC_MSG_ERROR([Flex is missing.])
                    136: test -z "$BISON" && AC_MSG_ERROR([Bison is missing.])
                    137: test -z "$M4"   && AC_MSG_ERROR([M4 is missing.])
                    138: BIRD_CHECK_PROG_FLAVOR_GNU([$M4], , [AC_MSG_ERROR([Provided M4 is not GNU M4.])])
                    139: 
                    140: if test -n "$with_sysconfig" -a "$with_sysconfig" != no ; then
                    141:        if test -f $with_sysconfig ; then
                    142:                sysdesc=$with_sysconfig
                    143:        else
                    144:                sysdesc=$srcdir/sysdep/cf/$with_sysconfig
                    145:                if ! test -f $sysdesc ; then
                    146:                        sysdesc=$sysdesc.h
                    147:                fi
                    148:        fi
                    149: elif test -f sysconfig.h ; then
                    150:        sysdesc=sysconfig
                    151: else
                    152:        case "$ip:$host_os" in
                    153:                ipv6:linux*)    sysdesc=linux-v6
                    154:                                default_iproutedir="/etc/iproute2"
                    155:                                ;;
                    156:                ipv4:linux*)    sysdesc=linux
                    157:                                default_iproutedir="/etc/iproute2"
                    158:                                ;;
                    159:                ipv6:netbsd*)   sysdesc=bsd-v6
                    160:                                CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
                    161:                                LDFLAGS="$LDFLAGS -L/usr/pkg/lib -R/usr/pkg/lib"
                    162:                                ;;
                    163:                ipv4:netbsd*)   sysdesc=bsd
                    164:                                CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
                    165:                                LDFLAGS="$LDFLAGS -L/usr/pkg/lib -R/usr/pkg/lib"
1.1.1.1.2.1! misho     166:                                AC_DEFINE(CONFIG_FIREWALL_PF, 1)
1.1       misho     167:                                ;;
                    168:                ipv6:freebsd*)  sysdesc=bsd-v6
                    169:                                ;;
                    170:                ipv4:freebsd*)  sysdesc=bsd
1.1.1.1.2.1! misho     171:                                AC_DEFINE(CONFIG_FIREWALL_IPFW, 1)
        !           172:                                AC_DEFINE(CONFIG_FIREWALL_PF, 1)
1.1       misho     173:                                ;;
                    174:                ipv6:dragonfly*)        sysdesc=bsd-v6
                    175:                                ;;
                    176:                ipv4:dragonfly*)        sysdesc=bsd
                    177:                                ;;
                    178:                ipv6:kfreebsd*) sysdesc=bsd-v6
                    179:                                ;;
                    180:                ipv4:kfreebsd*) sysdesc=bsd
                    181:                                ;;
                    182:                ipv6:openbsd*)  sysdesc=bsd-v6
                    183:                                ;;
                    184:                ipv4:openbsd*)  sysdesc=bsd
1.1.1.1.2.1! misho     185:                                AC_DEFINE(CONFIG_FIREWALL_PF, 1)
1.1       misho     186:                                ;;
                    187:                *)              AC_MSG_ERROR([Cannot determine correct system configuration. Please use --with-sysconfig to set it manually.])
                    188:                                ;;
                    189:                esac
                    190:        sysdesc=$srcdir/sysdep/cf/$sysdesc.h
                    191: fi
                    192: AC_MSG_CHECKING([which OS configuration should we use])
                    193: AC_MSG_RESULT($sysdesc)
                    194: if ! test -f $sysdesc ; then
                    195:        AC_MSG_ERROR([The system configuration file is missing.])
                    196: fi
                    197: sysname=`echo $sysdesc | sed 's/\.h$//'`
                    198: AC_DEFINE_UNQUOTED(SYSCONF_INCLUDE, "$sysdesc")
                    199: 
                    200: AC_MSG_CHECKING([system-dependent directories])
                    201: sysdep_dirs="`sed <$sysdesc '/^Link: /!d;s/^Link: \(.*\)$/\1/' | tr '\012' ' '` lib"
                    202: AC_MSG_RESULT($sysdep_dirs)
                    203: AC_SUBST(sysdep_dirs)
                    204: 
                    205: if test "$with_iproutedir" = no ; then with_iproutedir= ; fi
                    206: 
                    207: if test -n "$given_iproutedir"
                    208: then iproutedir=$with_iproutedir
                    209: else iproutedir=$default_iproutedir
                    210: fi
                    211: 
                    212: AC_SUBST(iproutedir)
                    213: 
                    214: all_protocols="$proto_bfd bgp ospf pipe $proto_radv rip static"
                    215: if test "$ip" = ipv6 ; then
                    216:    all_protocols="$all_protocols babel"
                    217: fi
                    218: all_protocols=`echo $all_protocols | sed 's/ /,/g'`
                    219: 
                    220: if test "$with_protocols" = all ; then
                    221:        with_protocols="$all_protocols"
                    222: fi
                    223: 
                    224: AC_MSG_CHECKING([protocols])
                    225: protocols=`echo "$with_protocols" | sed 's/,/ /g'`
                    226: if test "$protocols" = no ; then protocols= ; fi
                    227: for a in $protocols ; do
                    228:        if ! test -f $srcdir/proto/$a/Makefile ; then
                    229:                AC_MSG_RESULT(failed)
                    230:                AC_MSG_ERROR([Requested protocol $a not found.])
                    231:                fi
                    232:        AC_DEFINE_UNQUOTED(CONFIG_`echo $a | tr 'a-z' 'A-Z'`)
                    233:        done
                    234: AC_MSG_RESULT(ok)
                    235: AC_SUBST(protocols)
                    236: 
                    237: case $sysdesc in
                    238:        */linux*|*/linux-v6*)
                    239:                AC_CHECK_HEADER(linux/rtnetlink.h,,[AC_MSG_ERROR([Appropriate version of Linux kernel headers not found.])],[
                    240: #include <asm/types.h>
                    241: #include <sys/socket.h>
                    242: ])
                    243:                ;;
                    244: esac
                    245: 
                    246: AC_CHECK_HEADER(syslog.h, [AC_DEFINE(HAVE_SYSLOG)])
                    247: AC_CHECK_HEADER(alloca.h, [AC_DEFINE(HAVE_ALLOCA_H)])
                    248: AC_MSG_CHECKING(whether 'struct sockaddr' has sa_len)
                    249: AC_TRY_COMPILE([#include <sys/types.h>
                    250:   #include <sys/socket.h>
                    251:   ], [static struct sockaddr sa; int i = sizeof(sa.sa_len);],
                    252:   [AC_MSG_RESULT(yes)
                    253:   AC_DEFINE(HAVE_SIN_LEN,,sin_len)],
                    254:   AC_MSG_RESULT(no))
                    255: 
                    256: AC_C_BIGENDIAN([AC_DEFINE(CPU_BIG_ENDIAN)], [AC_DEFINE(CPU_LITTLE_ENDIAN)],
                    257:                 [AC_MSG_ERROR([Cannot determine CPU endianity.])])
                    258: 
                    259: BIRD_CHECK_INTEGERS
                    260: BIRD_CHECK_STRUCT_ALIGN
                    261: BIRD_CHECK_TIME_T
                    262: BIRD_CHECK_STRUCT_IP_MREQN
                    263: 
                    264: if test "$enable_debug" = yes ; then
                    265:        AC_DEFINE(DEBUGGING)
                    266:        if test "$enable_memcheck" = yes ; then
                    267:                AC_CHECK_LIB(dmalloc, dmalloc_debug)
                    268:                if test $ac_cv_lib_dmalloc_dmalloc_debug != yes ; then
                    269:                        AC_CHECK_LIB(efence, malloc)
                    270:                fi
                    271:        fi
                    272: fi
                    273: 
                    274: CLIENT=
                    275: CLIENT_LIBS=
                    276: if test "$enable_client" = yes ; then
                    277:        CLIENT=birdc
                    278:        AC_CHECK_LIB(history, add_history, CLIENT_LIBS="-lhistory")
                    279:        AC_CHECK_LIB(ncurses, tgetent, USE_TERMCAP_LIB=-lncurses,
                    280:                AC_CHECK_LIB(curses, tgetent, USE_TERMCAP_LIB=-lcurses,
                    281:                        AC_CHECK_LIB(tinfow, tgetent, USE_TERMCAP_LIB=-ltinfow,
                    282:                                AC_CHECK_LIB(tinfo, tgetent, USE_TERMCAP_LIB=-ltinfo,
                    283:                                        AC_CHECK_LIB(termcap, tgetent, USE_TERMCAP_LIB=-ltermcap,
                    284:                                                AC_MSG_ERROR([[The client requires ncurses library. Either install the library or use --disable-client to compile without the client.]]))))))
                    285:        AC_CHECK_LIB(readline, rl_callback_read_char, CLIENT_LIBS="-lreadline $CLIENT_LIBS $USE_TERMCAP_LIB",
                    286:                AC_MSG_ERROR([[The client requires GNU readline library 2.1 or newer. Either install the library or use --disable-client to compile without the client.]]), $USE_TERMCAP_LIB)
                    287:        AC_CHECK_LIB(readline, rl_crlf, AC_DEFINE(HAVE_RL_CRLF),,$USE_TERMCAP_LIB)
                    288:        AC_CHECK_LIB(readline, rl_ding, AC_DEFINE(HAVE_RL_DING),,$USE_TERMCAP_LIB)
                    289: fi
                    290: AC_SUBST(CLIENT)
                    291: AC_SUBST(CLIENT_LIBS)
                    292: 
                    293: mkdir -p $objdir/sysdep
                    294: AC_CONFIG_HEADERS([$objdir/sysdep/autoconf.h:sysdep/autoconf.h.in])
                    295: AC_CONFIG_COMMANDS([merge],[[export CPP="$CPP"
                    296: $srcdir/tools/mergedirs $srcdir $srcdir_rel $objdir $sysdep_dirs]],
                    297:        [[srcdir=$srcdir]
                    298:        [srcdir_rel=$srcdir_rel]
                    299:        [objdir=$objdir]
                    300:        [sysdep_dirs="$sysdep_dirs"]])
                    301: AC_CONFIG_FILES($makefiles)
                    302: AC_OUTPUT
                    303: 
                    304: rm -f $objdir/sysdep/paths.h
                    305: 
                    306: cat >&AC_FD_MSG <<EOF
                    307: 
                    308: BIRD was configured with the following options:
                    309:        Source directory:       $srcdir
                    310:        Object directory:       $objdir
                    311:        Iproute2 directory:     $iproutedir
                    312:        System configuration:   $sysdesc
                    313:        Debugging:              $enable_debug
                    314:        POSIX threads:          $enable_pthreads
                    315:        Routing protocols:      $protocols
                    316:        Client:                 $enable_client
                    317: EOF
                    318: rm -f $objdir/.*-stamp

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