paul | 7ea487b | 2003-03-17 02:05:07 +0000 | [diff] [blame^] | 1 | ## |
| 2 | ## Configure template file for Zebra. |
| 3 | ## autoconf will generate configure script. |
| 4 | ## |
| 5 | ## Copyright (c) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro <kunihiro@zebra.org> |
| 6 | ## |
| 7 | AC_PREREQ(2.13) |
| 8 | |
| 9 | AC_INIT(lib/zebra.h) |
| 10 | AM_INIT_AUTOMAKE(zebra, 0.94) |
| 11 | AM_CONFIG_HEADER(config.h) |
| 12 | |
| 13 | dnl ----------------------------------- |
| 14 | dnl Get hostname and other information. |
| 15 | dnl ----------------------------------- |
| 16 | AC_CANONICAL_HOST |
| 17 | |
| 18 | dnl ------------ |
| 19 | dnl Check CFLAGS |
| 20 | dnl ------------ |
| 21 | AC_ARG_WITH(cflags, |
| 22 | [ --with-cflags Set CFLAGS for use in compilation.]) |
| 23 | if test "x$with_cflags" != "x" ; then |
| 24 | CFLAGS="$with_cflags" ; cflags_specified=yes ; |
| 25 | elif test -n "$CFLAGS" ; then |
| 26 | cflags_specified=yes ; |
| 27 | fi |
| 28 | |
| 29 | dnl -------- |
| 30 | dnl Check CC |
| 31 | dnl -------- |
| 32 | AC_PROG_CC |
| 33 | |
| 34 | dnl ----------------------------------------- |
| 35 | dnl If CLFAGS doesn\'t exist set default value |
| 36 | dnl ----------------------------------------- |
| 37 | if test "x$cflags_specified" = "x" ; then |
| 38 | CFLAGS="$CFLAGS -Wall" |
| 39 | fi |
| 40 | |
| 41 | dnl -------------- |
| 42 | dnl Check programs |
| 43 | dnl -------------- |
| 44 | AC_PROG_CPP |
| 45 | AC_PROG_INSTALL |
| 46 | AC_PROG_MAKE_SET |
| 47 | AC_CHECK_TOOL(AR, ar) |
| 48 | AC_CHECK_TOOL(RANLIB, ranlib, :) |
| 49 | |
| 50 | dnl --------- |
| 51 | dnl AIX check |
| 52 | dnl --------- |
| 53 | AC_AIX |
| 54 | |
| 55 | dnl ---------------------- |
| 56 | dnl Packages configuration |
| 57 | dnl ---------------------- |
| 58 | AC_ARG_ENABLE(vtysh, |
| 59 | [ --enable-vtysh, Make integrated VTY version of zebra]) |
| 60 | AC_ARG_ENABLE(ipv6, |
| 61 | [ --disable-ipv6 turn off IPv6 related features and daemons]) |
| 62 | AC_ARG_ENABLE(zebra, |
| 63 | [ --disable-zebra do not build zebra daemon]) |
| 64 | AC_ARG_ENABLE(bgpd, |
| 65 | [ --disable-bgpd do not build bgpd]) |
| 66 | AC_ARG_ENABLE(ripd, |
| 67 | [ --disable-ripd do not build ripd]) |
| 68 | AC_ARG_ENABLE(ripngd, |
| 69 | [ --disable-ripngd do not build ripngd]) |
| 70 | AC_ARG_ENABLE(ospfd, |
| 71 | [ --disable-ospfd do not build ospfd]) |
| 72 | AC_ARG_ENABLE(ospfclient, |
| 73 | [ --disable-ospfclient do not build ospfclient]) |
| 74 | AC_ARG_ENABLE(ospf6d, |
| 75 | [ --disable-ospf6d do not build ospf6d]) |
| 76 | AC_ARG_ENABLE(bgp-announce, |
| 77 | [ --disable-bgp-announce, turn off BGP route announcement]) |
| 78 | AC_ARG_ENABLE(netlink, |
| 79 | [ --enable-netlink force to use Linux netlink interface]) |
| 80 | AC_ARG_ENABLE(broken-aliases, |
| 81 | [ --enable-broken-aliases enable aliases as distinct interfaces for Linux 2.2.X]) |
| 82 | AC_ARG_ENABLE(snmp, |
| 83 | [ --enable-snmp enable SNMP support]) |
| 84 | AC_ARG_WITH(libpam, |
| 85 | [ --with-libpam use libpam for PAM support in vtysh]) |
| 86 | AC_ARG_ENABLE(tcpsock, |
| 87 | [ --enable-tcp-zebra enable TCP/IP socket connection between zebra and protocol daemon]) |
| 88 | dnl Temporary option until OSPF NSSA implementation complete |
| 89 | AC_ARG_ENABLE(nssa, |
| 90 | [ --enable-nssa enable OSPF NSSA option]) |
| 91 | AC_ARG_ENABLE(opaque-lsa, |
| 92 | [ --enable-opaque-lsa enable OSPF Opaque-LSA support (RFC2370)]) |
| 93 | AC_ARG_ENABLE(ospf-te, |
| 94 | [ --enable-ospf-te enable Traffic Engineering Extension to OSPF]) |
| 95 | AC_ARG_ENABLE(multipath, |
| 96 | [ --enable-multipath=ARG enable multipath function, ARG must be digit]) |
| 97 | |
| 98 | dnl AC_ARG_ENABLE(rtadv, |
| 99 | dnl [ --enable-rtadv enable IPV6 router advertisment option]) |
| 100 | |
| 101 | if test "${enable_broken_aliases}" = "yes"; then |
| 102 | if test "${enable_netlink}" = "yes" |
| 103 | then |
| 104 | echo "Sorry, you can't use netlink with broken aliases" |
| 105 | exit 1 |
| 106 | fi |
| 107 | AC_DEFINE(HAVE_BROKEN_ALIASES,,Broken Alias) |
| 108 | enable_netlink=no |
| 109 | fi |
| 110 | |
| 111 | if test "${enable_tcp_zebra}" = "yes"; then |
| 112 | AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication) |
| 113 | fi |
| 114 | |
| 115 | if test "${enable_nssa}" = "yes"; then |
| 116 | AC_DEFINE(HAVE_NSSA,,OSPF NSSA) |
| 117 | fi |
| 118 | |
| 119 | if test "${enable_opaque_lsa}" = "yes"; then |
| 120 | AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA) |
| 121 | fi |
| 122 | |
| 123 | if test "${enable_ospf_te}" = "yes"; then |
| 124 | AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA) |
| 125 | AC_DEFINE(HAVE_OSPF_TE,,OSPF TE) |
| 126 | fi |
| 127 | |
| 128 | dnl if test "${enable_rtadv}" = "yes"; then |
| 129 | dnl AC_DEFINE(HAVE_RTADV) |
| 130 | dnl fi |
| 131 | |
| 132 | changequote(, )dnl |
| 133 | |
| 134 | MULTIPATH_NUM=1 |
| 135 | |
| 136 | case "${enable_multipath}" in |
| 137 | [0-9]|[1-9][0-9]) |
| 138 | MULTIPATH_NUM="${enable_multipath}" |
| 139 | ;; |
| 140 | "") |
| 141 | ;; |
| 142 | *) |
| 143 | echo "Please specify digit to --enable-multipath ARG." |
| 144 | exit 1 |
| 145 | ;; |
| 146 | esac |
| 147 | |
| 148 | changequote([, ])dnl |
| 149 | |
| 150 | AC_SUBST(MULTIPATH_NUM) |
| 151 | |
| 152 | dnl ------------------- |
| 153 | dnl Check header files. |
| 154 | dnl ------------------- |
| 155 | AC_STDC_HEADERS |
| 156 | AC_CHECK_HEADERS(string.h stropts.h sys/conf.h sys/ksym.h sys/time.h sys/times.h sys/select.h sys/sysctl.h sys/sockio.h sys/types.h net/if_dl.h net/if_var.h linux/version.h kvm.h netdb.h netinet/in.h net/netopt.h netinet/in_var.h netinet/in6_var.h netinet/in6.h inet/nd.h asm/types.h netinet/icmp6.h netinet6/nd6.h libutil.h) |
| 157 | |
| 158 | dnl check some types |
| 159 | AC_C_CONST |
| 160 | dnl AC_TYPE_PID_T |
| 161 | AC_TYPE_SIGNAL |
| 162 | |
| 163 | dnl Some systems (Solaris 2.x) require libnsl (Network Services Library) |
| 164 | case "$host" in |
| 165 | *-sunos5.6* | *-solaris2.6*) |
| 166 | opsys=sol2-6 |
| 167 | AC_DEFINE(SUNOS_5,,SunOS 5) |
| 168 | AC_CHECK_LIB(xnet, main) |
| 169 | CURSES=-lcurses |
| 170 | ;; |
| 171 | *-sunos5* | *-solaris2*) |
| 172 | AC_DEFINE(SUNOS_5,,SunOS 5) |
| 173 | AC_CHECK_LIB(socket, main) |
| 174 | AC_CHECK_LIB(nsl, main) |
| 175 | CURSES=-lcurses |
| 176 | ;; |
| 177 | *-linux-*) |
| 178 | opsys=gnu-linux |
| 179 | AC_DEFINE(GNU_LINUX,,GNU Linux) |
| 180 | ;; |
| 181 | *-nec-sysv4*) |
| 182 | AC_CHECK_LIB(nsl, gethostbyname) |
| 183 | AC_CHECK_LIB(socket, socket) |
| 184 | ;; |
| 185 | *-freebsd3.2) |
| 186 | AC_DEFINE(FREEBSD_32,,FreeBSD 3.2) |
| 187 | ;; |
| 188 | *-openbsd*) |
| 189 | opsys=openbsd |
| 190 | AC_DEFINE(OPEN_BSD,,OpenBSD) |
| 191 | ;; |
| 192 | *-bsdi*) |
| 193 | opsys=bsdi |
| 194 | OTHER_METHOD="mtu_kvm.o" |
| 195 | AC_CHECK_LIB(kvm, main) |
| 196 | ;; |
| 197 | esac |
| 198 | |
| 199 | dnl --------------------- |
| 200 | dnl Integrated VTY option |
| 201 | dnl --------------------- |
| 202 | case "${enable_vtysh}" in |
| 203 | "yes") VTYSH="vtysh"; |
| 204 | AC_DEFINE(VTYSH,,VTY shell) |
| 205 | AC_CHECK_LIB(tinfo, tputs, , AC_CHECK_LIB(ncurses, tputs)) |
| 206 | AC_CHECK_LIB(readline, main) |
| 207 | if test $ac_cv_lib_readline_main = no; then |
| 208 | AC_MSG_ERROR([vtysh needs libreadline but was not found on your system.]) |
| 209 | fi |
| 210 | AC_CHECK_HEADER(readline/history.h) |
| 211 | if test $ac_cv_header_readline_history_h = no;then |
| 212 | AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.]) |
| 213 | fi |
| 214 | ;; |
| 215 | "no" ) VTYSH="";; |
| 216 | * ) ;; |
| 217 | esac |
| 218 | |
| 219 | dnl ---------- |
| 220 | dnl PAM module |
| 221 | dnl ---------- |
| 222 | if test "$with_libpam" = "yes"; then |
| 223 | dnl took this test from proftpd's configure.in and suited to our needs |
| 224 | dnl ------------------------------------------------------------------------- |
| 225 | dnl |
| 226 | dnl This next check looks funky due to a linker problem with some versions |
| 227 | dnl of the PAM library. Prior to 0.72 release, the Linux PAM shared library |
| 228 | dnl omitted requiring libdl linking information. PAM-0.72 or better ships |
| 229 | dnl with RedHat 6.2 and Debian 2.2 or better. |
| 230 | AC_CHECK_LIB(pam, pam_start, |
| 231 | [AC_CHECK_LIB(pam, misc_conv, |
| 232 | [AC_DEFINE(USE_PAM,,Use PAM for authentication) |
| 233 | LIBPAM="-lpam"], |
| 234 | [AC_DEFINE(USE_PAM,,Use PAM for authentication) |
| 235 | LIBPAM="-lpam -lpam_misc"] |
| 236 | ) |
| 237 | ], |
| 238 | |
| 239 | [AC_CHECK_LIB(pam, pam_end, |
| 240 | [AC_CHECK_LIB(pam, misc_conv, |
| 241 | [AC_DEFINE(USE_PAM) |
| 242 | LIBPAM="-lpam -ldl"], |
| 243 | [AC_DEFINE(USE_PAM) |
| 244 | LIBPAM="-lpam -ldl -lpam_misc"] |
| 245 | ) |
| 246 | ],AC_MSG_WARN([*** pam support will not be built ***]), |
| 247 | [-ldl]) |
| 248 | ] |
| 249 | ) |
| 250 | fi |
| 251 | AC_SUBST(LIBPAM) |
| 252 | |
| 253 | dnl ------------------------------- |
| 254 | dnl Endian-ness check |
| 255 | dnl ------------------------------- |
| 256 | AC_WORDS_BIGENDIAN |
| 257 | |
| 258 | dnl ------------------------------- |
| 259 | dnl check the size in byte of the C |
| 260 | dnl ------------------------------- |
| 261 | dnl AC_CHECK_SIZEOF(char) |
| 262 | dnl AC_CHECK_SIZEOF(int) |
| 263 | dnl AC_CHECK_SIZEOF(short) |
| 264 | dnl AC_CHECK_SIZEOF(long) |
| 265 | |
| 266 | dnl ---------------------------- |
| 267 | dnl check existance of functions |
| 268 | dnl ---------------------------- |
| 269 | AC_CHECK_FUNCS(bcopy bzero strerror inet_aton daemon snprintf vsnprintf strlcat strlcpy if_nametoindex if_indextoname getifaddrs) |
| 270 | AC_CHECK_FUNCS(setproctitle, ,[AC_CHECK_LIB(util, setproctitle, [LIBS="$LIBS -lutil"; AC_DEFINE(HAVE_SETPROCTITLE)])]) |
| 271 | |
| 272 | dnl ------------------------------------ |
| 273 | dnl Determine routing get and set method |
| 274 | dnl ------------------------------------ |
| 275 | AC_MSG_CHECKING(zebra between kernel interface method) |
| 276 | if test x"$opsys" = x"gnu-linux"; then |
| 277 | if test "${enable_netlink}" = "yes";then |
| 278 | AC_MSG_RESULT(netlink) |
| 279 | RT_METHOD=rt_netlink.o |
| 280 | AC_DEFINE(HAVE_NETLINK,,netlink) |
| 281 | netlink=yes |
| 282 | elif test "${enable_netlink}" = "no"; then |
| 283 | AC_MSG_RESULT(ioctl) |
| 284 | RT_METHOD=rt_ioctl.o |
| 285 | netlink=no |
| 286 | else |
| 287 | AC_MSG_RESULT(netlink) |
| 288 | RT_METHOD=rt_netlink.o |
| 289 | AC_DEFINE(HAVE_NETLINK,,netlink) |
| 290 | netlink=yes |
| 291 | fi |
| 292 | else |
| 293 | if test "$opsys" = "sol2-6";then |
| 294 | AC_MSG_RESULT(solaris) |
| 295 | KERNEL_METHOD="kernel_socket.o" |
| 296 | RT_METHOD="rt_socket.o" |
| 297 | else |
| 298 | AC_TRY_RUN([#include <errno.h> |
| 299 | #include <sys/types.h> |
| 300 | #include <sys/socket.h> |
| 301 | |
| 302 | main () |
| 303 | { |
| 304 | int ac_sock; |
| 305 | |
| 306 | ac_sock = socket (AF_ROUTE, SOCK_RAW, 0); |
| 307 | if (ac_sock < 0 && errno == EINVAL) |
| 308 | exit (1); |
| 309 | exit (0); |
| 310 | }], |
| 311 | [KERNEL_METHOD=kernel_socket.o |
| 312 | RT_METHOD=rt_socket.o |
| 313 | AC_MSG_RESULT(socket)], |
| 314 | [RT_METHOD=rt_ioctl.o |
| 315 | AC_MSG_RESULT(ioctl)], |
| 316 | [KERNEL_METHOD=kernel_socket.o |
| 317 | RT_METHOD=rt_socket.o |
| 318 | AC_MSG_RESULT(socket)]) |
| 319 | fi |
| 320 | fi |
| 321 | AC_SUBST(RT_METHOD) |
| 322 | AC_SUBST(KERNEL_METHOD) |
| 323 | AC_SUBST(OTHER_METHOD) |
| 324 | |
| 325 | dnl ------------------------------ |
| 326 | dnl check kernel route read method |
| 327 | dnl ------------------------------ |
| 328 | AC_CACHE_CHECK(route read method check, zebra_rtread, |
| 329 | [if test "$netlink" = yes; then |
| 330 | RTREAD_METHOD="rtread_netlink.o" |
| 331 | zebra_rtread="netlink" |
| 332 | else |
| 333 | for zebra_rtread in /proc/net/route /dev/ip /dev/null; |
| 334 | do |
| 335 | test x`ls $zebra_rtread 2>/dev/null` = x"$zebra_rtread" && break |
| 336 | done |
| 337 | case $zebra_rtread in |
| 338 | "/proc/net/route") RTREAD_METHOD="rtread_proc.o" |
| 339 | zebra_rtread="proc";; |
| 340 | "/dev/ip") RTREAD_METHOD="rtread_getmsg.o" |
| 341 | zebra_rtread="getmsg";; |
| 342 | *) RTREAD_METHOD="rtread_sysctl.o" |
| 343 | zebra_rtread="sysctl";; |
| 344 | esac |
| 345 | fi]) |
| 346 | AC_SUBST(RTREAD_METHOD) |
| 347 | |
| 348 | dnl ----------------------------- |
| 349 | dnl check interface lookup method |
| 350 | dnl ----------------------------- |
| 351 | AC_MSG_CHECKING(interface looking up method) |
| 352 | if test "$netlink" = yes; then |
| 353 | AC_MSG_RESULT(netlink) |
| 354 | IF_METHOD=if_netlink.o |
| 355 | else |
| 356 | if test "$opsys" = "sol2-6";then |
| 357 | AC_MSG_RESULT(solaris) |
| 358 | IF_METHOD=if_ioctl.o |
| 359 | elif test "$opsys" = "openbsd";then |
| 360 | AC_MSG_RESULT(openbsd) |
| 361 | IF_METHOD=if_ioctl.o |
| 362 | elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then |
| 363 | AC_MSG_RESULT(sysctl) |
| 364 | IF_METHOD=if_sysctl.o |
| 365 | AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST) |
| 366 | else |
| 367 | AC_MSG_RESULT(ioctl) |
| 368 | IF_METHOD=if_ioctl.o |
| 369 | fi |
| 370 | fi |
| 371 | AC_SUBST(IF_METHOD) |
| 372 | |
| 373 | dnl ----------------------- |
| 374 | dnl check proc file system. |
| 375 | dnl ----------------------- |
| 376 | if test -r /proc/net/dev; then |
| 377 | AC_DEFINE(HAVE_PROC_NET_DEV,,/proc/net/dev) |
| 378 | IF_PROC=if_proc.o |
| 379 | fi |
| 380 | |
| 381 | if test -r /proc/net/if_inet6; then |
| 382 | AC_DEFINE(HAVE_PROC_NET_IF_INET6,,/proc/net/if_inet6) |
| 383 | IF_PROC=if_proc.o |
| 384 | fi |
| 385 | AC_SUBST(IF_PROC) |
| 386 | |
| 387 | dnl ----------------------------- |
| 388 | dnl check ipforward detect method |
| 389 | dnl ----------------------------- |
| 390 | AC_CACHE_CHECK(ipforward method check, zebra_ipforward_path, |
| 391 | [for zebra_ipforward_path in /proc/net/snmp /dev/ip /dev/null; |
| 392 | do |
| 393 | test x`ls $zebra_ipforward_path 2>/dev/null` = x"$zebra_ipforward_path" && break |
| 394 | done |
| 395 | case $zebra_ipforward_path in |
| 396 | "/proc/net/snmp") IPFORWARD=ipforward_proc.o |
| 397 | zebra_ipforward_path="proc";; |
| 398 | "/dev/ip") |
| 399 | case "$host" in |
| 400 | *-nec-sysv4*) IPFORWARD=ipforward_ews.o |
| 401 | zebra_ipforward_path="ews";; |
| 402 | *) IPFORWARD=ipforward_solaris.o |
| 403 | zebra_ipforward_path="solaris";; |
| 404 | esac;; |
| 405 | *) IPFORWARD=ipforward_sysctl.o |
| 406 | zebra_ipforward_path="sysctl";; |
| 407 | esac]) |
| 408 | AC_SUBST(IPFORWARD) |
| 409 | |
| 410 | AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no]) |
| 411 | |
| 412 | dnl ---------- |
| 413 | dnl IPv6 check |
| 414 | dnl ---------- |
| 415 | AC_MSG_CHECKING(whether does this OS have IPv6 stack) |
| 416 | if test "${enable_ipv6}" = "no"; then |
| 417 | AC_MSG_RESULT(disabled) |
| 418 | else |
| 419 | dnl ---------- |
| 420 | dnl INRIA IPv6 |
| 421 | dnl ---------- |
| 422 | if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then |
| 423 | zebra_cv_ipv6=yes |
| 424 | AC_DEFINE(HAVE_IPV6,,IPv6) |
| 425 | AC_DEFINE(INRIA_IPV6,,Inria IPv6) |
| 426 | RIPNGD="ripngd" |
| 427 | OSPF6D="ospf6d" |
| 428 | LIB_IPV6="" |
| 429 | AC_MSG_RESULT(INRIA IPv6) |
| 430 | fi |
| 431 | dnl --------- |
| 432 | dnl KAME IPv6 |
| 433 | dnl --------- |
| 434 | if grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then |
| 435 | zebra_cv_ipv6=yes |
| 436 | AC_DEFINE(HAVE_IPV6,,IPv6) |
| 437 | AC_DEFINE(KAME,,KAME IPv6) |
| 438 | RIPNGD="ripngd" |
| 439 | OSPF6D="ospf6d" |
| 440 | if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then |
| 441 | LIB_IPV6="-L/usr/local/v6/lib -linet6" |
| 442 | fi |
| 443 | AC_MSG_RESULT(KAME) |
| 444 | fi |
| 445 | dnl --------- |
| 446 | dnl NRL check |
| 447 | dnl --------- |
| 448 | if grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then |
| 449 | zebra_cv_ipv6=yes |
| 450 | AC_DEFINE(HAVE_IPV6,,IPv6) |
| 451 | AC_DEFINE(NRL,,NRL) |
| 452 | RIPNGD="ripngd" |
| 453 | OSPF6D="ospf6d" |
| 454 | if test x"$opsys" = x"bsdi";then |
| 455 | AC_DEFINE(BSDI_NRL,,BSDI) |
| 456 | AC_MSG_RESULT(BSDI_NRL) |
| 457 | else |
| 458 | AC_MSG_RESULT(NRL) |
| 459 | fi |
| 460 | fi |
| 461 | |
| 462 | dnl ---------- |
| 463 | dnl Linux IPv6 |
| 464 | dnl ---------- |
| 465 | if test "${enable_ipv6}" = "yes"; then |
| 466 | AC_EGREP_CPP(yes, [ |
| 467 | #include <linux/version.h> |
| 468 | /* 2.1.128 or later */ |
| 469 | #if LINUX_VERSION_CODE >= 0x020180 |
| 470 | yes |
| 471 | #endif], |
| 472 | [zebra_cv_ipv6=yes; zebra_cv_linux_ipv6=yes;AC_MSG_RESULT(Linux IPv6)]) |
| 473 | else |
| 474 | if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route" |
| 475 | then |
| 476 | zebra_cv_ipv6=yes |
| 477 | zebra_cv_linux_ipv6=yes |
| 478 | AC_MSG_RESULT(Linux IPv6) |
| 479 | fi |
| 480 | fi |
| 481 | |
| 482 | if test "$zebra_cv_linux_ipv6" = "yes";then |
| 483 | AC_DEFINE(HAVE_IPV6) |
| 484 | AC_MSG_CHECKING(for GNU libc 2.1) |
| 485 | AC_EGREP_CPP(yes, [ |
| 486 | #include <features.h> |
| 487 | #if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 |
| 488 | yes |
| 489 | #endif], [glibc=yes; AC_MSG_RESULT(yes)], AC_MSG_RESULT(no)) |
| 490 | AC_DEFINE(LINUX_IPV6,,Linux IPv6) |
| 491 | RIPNGD="ripngd" |
| 492 | OSPF6D="ospf6d" |
| 493 | if test "$glibc" != "yes"; then |
| 494 | INCLUDES="-I/usr/inet6/include" |
| 495 | if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then |
| 496 | LIB_IPV6="-L/usr/inet6/lib -linet6" |
| 497 | fi |
| 498 | fi |
| 499 | fi |
| 500 | |
| 501 | dnl ----------------------- |
| 502 | dnl Set IPv6 related values |
| 503 | dnl ----------------------- |
| 504 | LIBS="$LIB_IPV6 $LIBS" |
| 505 | AC_SUBST(LIB_IPV6) |
| 506 | |
| 507 | if test x"$RIPNGD" = x""; then |
| 508 | AC_MSG_RESULT(IPv4 only) |
| 509 | fi |
| 510 | fi |
| 511 | |
| 512 | dnl -------------------- |
| 513 | dnl Daemon disable check |
| 514 | dnl -------------------- |
| 515 | if test "${enable_zebra}" = "no";then |
| 516 | ZEBRA="" |
| 517 | else |
| 518 | ZEBRA="zebra" |
| 519 | fi |
| 520 | |
| 521 | if test "${enable_bgpd}" = "no";then |
| 522 | BGPD="" |
| 523 | else |
| 524 | BGPD="bgpd" |
| 525 | fi |
| 526 | |
| 527 | if test "${enable_ripd}" = "no";then |
| 528 | RIPD="" |
| 529 | else |
| 530 | RIPD="ripd" |
| 531 | fi |
| 532 | |
| 533 | if test "${enable_ospfd}" = "no";then |
| 534 | OSPFD="" |
| 535 | else |
| 536 | OSPFD="ospfd" |
| 537 | fi |
| 538 | |
| 539 | if test "${enable_ospfclient}" = "no";then |
| 540 | OSPFCLIENT="" |
| 541 | else |
| 542 | OSPFCLIENT="ospfclient" |
| 543 | fi |
| 544 | |
| 545 | case "${enable_ripngd}" in |
| 546 | "yes") RIPNGD="ripngd";; |
| 547 | "no" ) RIPNGD="";; |
| 548 | * ) ;; |
| 549 | esac |
| 550 | |
| 551 | case "${enable_ospf6d}" in |
| 552 | "yes") OSPF6D="ospf6d";; |
| 553 | "no" ) OSPF6D="";; |
| 554 | * ) ;; |
| 555 | esac |
| 556 | |
| 557 | if test "${enable_bgp_announce}" = "no";then |
| 558 | AC_DEFINE(DISABLE_BGP_ANNOUNCE,,Disable BGP installation to zebra) |
| 559 | fi |
| 560 | |
| 561 | AC_SUBST(ZEBRA) |
| 562 | AC_SUBST(BGPD) |
| 563 | AC_SUBST(RIPD) |
| 564 | AC_SUBST(RIPNGD) |
| 565 | AC_SUBST(OSPFD) |
| 566 | AC_SUBST(OSPF6D) |
| 567 | AC_SUBST(VTYSH) |
| 568 | AC_SUBST(INCLUDES) |
| 569 | AC_SUBST(CURSES) |
| 570 | AC_SUBST(OSPFCLIENT) |
| 571 | AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)]) |
| 572 | AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)]) |
| 573 | AC_CHECK_LIB(crypt, crypt) |
| 574 | AC_CHECK_LIB(resolv, res_init) |
| 575 | AC_CHECK_LIB(m, main) |
| 576 | |
| 577 | dnl --------------------------------------------------- |
| 578 | dnl BSD/OS 4.1 define inet_XtoY function as __inet_XtoY |
| 579 | dnl --------------------------------------------------- |
| 580 | AC_CHECK_FUNC(__inet_ntop, AC_DEFINE(HAVE_INET_NTOP)) |
| 581 | AC_CHECK_FUNC(__inet_pton, AC_DEFINE(HAVE_INET_PTON)) |
| 582 | AC_CHECK_FUNC(__inet_aton, AC_DEFINE(HAVE_INET_ATON)) |
| 583 | |
| 584 | dnl --------------------------- |
| 585 | dnl check system has GNU regexp |
| 586 | dnl --------------------------- |
| 587 | dnl AC_MSG_CHECKING(whether system has GNU regex) |
| 588 | AC_CHECK_LIB(c, regexec, |
| 589 | [AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library) |
| 590 | LIB_REGEX=""], |
| 591 | [LIB_REGEX="regex.o"]) |
| 592 | AC_SUBST(LIB_REGEX) |
| 593 | |
| 594 | dnl ------------------ |
| 595 | dnl check SNMP library |
| 596 | dnl ------------------ |
| 597 | if test "${enable_snmp}" = "yes";then |
| 598 | dnl AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes) |
| 599 | old_libs="${LIBS}" |
| 600 | LIBS="-L/usr/local/lib" |
| 601 | unset ac_cv_lib_snmp_asn_parse_int |
| 602 | AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes, ) |
| 603 | if test "${HAVE_SNMP}" = ""; then |
| 604 | unset ac_cv_lib_snmp_asn_parse_int |
| 605 | AC_CHECK_LIB(crypto, main, [NEED_CRYPTO=yes ], ) |
| 606 | if test "${NEED_CRYPTO}" = ""; then |
| 607 | AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes ],) |
| 608 | else |
| 609 | AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes;LIBS="$LIBS -lcrypto" ],,"-lcrypto") |
| 610 | fi |
| 611 | fi |
| 612 | LIBS="${old_libs}" |
| 613 | |
| 614 | if test "${HAVE_SNMP}" = ""; then |
| 615 | old_libs="${LIBS}" |
| 616 | LIBS="-L/usr/local/lib" |
| 617 | AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes) |
| 618 | LIBS="${old_libs}" |
| 619 | fi |
| 620 | if test "${HAVE_SNMP}" = "yes"; then |
| 621 | for ac_snmp in /usr/include/net-snmp/library/asn1.h /usr/include/ucd-snmp/asn1.h /usr/local/include/ucd-snmp/asn1.h /dev/null |
| 622 | do |
| 623 | test -f "${ac_snmp}" && break |
| 624 | done |
| 625 | case ${ac_snmp} in |
| 626 | /usr/include/net-snmp/*) |
| 627 | AC_DEFINE(HAVE_SNMP,,SNMP) |
| 628 | AC_DEFINE(UCD_COMPATIBLE,,SNMP) |
| 629 | CFLAGS="${CFLAGS} -I/usr/include/ucd-snmp" |
| 630 | LIBS="${LIBS} -lsnmp" |
| 631 | ;; |
| 632 | /usr/include/ucd-snmp/*) |
| 633 | AC_DEFINE(HAVE_SNMP,,SNMP) |
| 634 | CFLAGS="${CFLAGS} -I/usr/include/ucd-snmp" |
| 635 | LIBS="${LIBS} -lsnmp" |
| 636 | ;; |
| 637 | /usr/local/include/ucd-snmp/*) |
| 638 | AC_DEFINE(HAVE_SNMP,,SNMP) |
| 639 | CFLAGS="${CFLAGS} -I/usr/local/include/ucd-snmp" |
| 640 | LIBS="${LIBS} -L/usr/local/lib -lsnmp" |
| 641 | ;; |
| 642 | esac |
| 643 | if test "${NEED_CRYPTO}" = "yes"; then |
| 644 | LIBS="${LIBS} -lcrypto" |
| 645 | fi |
| 646 | fi |
| 647 | fi |
| 648 | |
| 649 | dnl ---------------------------- |
| 650 | dnl check sa_len of sockaddr |
| 651 | dnl ---------------------------- |
| 652 | AC_MSG_CHECKING(whether struct sockaddr has a sa_len field) |
| 653 | AC_TRY_COMPILE([#include <sys/types.h> |
| 654 | #include <sys/socket.h> |
| 655 | ],[static struct sockaddr ac_i;int ac_j = sizeof (ac_i.sa_len);], |
| 656 | [AC_MSG_RESULT(yes) |
| 657 | AC_DEFINE(HAVE_SA_LEN,,sa_len)], |
| 658 | AC_MSG_RESULT(no)) |
| 659 | |
| 660 | dnl ---------------------------- |
| 661 | dnl check sin_len of sockaddr_in |
| 662 | dnl ---------------------------- |
| 663 | AC_MSG_CHECKING(whether struct sockaddr_in has a sin_len field) |
| 664 | AC_TRY_COMPILE([#include <sys/types.h> |
| 665 | #include <netinet/in.h> |
| 666 | ],[static struct sockaddr_in ac_i;int ac_j = sizeof (ac_i.sin_len);], |
| 667 | [AC_MSG_RESULT(yes) |
| 668 | AC_DEFINE(HAVE_SIN_LEN,,sin_len)], |
| 669 | AC_MSG_RESULT(no)) |
| 670 | |
| 671 | dnl ---------------------------- |
| 672 | dnl check sun_len of sockaddr_un |
| 673 | dnl ---------------------------- |
| 674 | AC_MSG_CHECKING(whether struct sockaddr_un has a sun_len field) |
| 675 | AC_TRY_COMPILE([#include <sys/types.h> |
| 676 | #include <sys/un.h> |
| 677 | ],[static struct sockaddr_un ac_i;int ac_j = sizeof (ac_i.sun_len);], |
| 678 | [AC_MSG_RESULT(yes) |
| 679 | AC_DEFINE(HAVE_SUN_LEN,,sun_len)], |
| 680 | AC_MSG_RESULT(no)) |
| 681 | |
| 682 | dnl ----------------------------------- |
| 683 | dnl check sin6_scope_id of sockaddr_in6 |
| 684 | dnl ----------------------------------- |
| 685 | if test "$zebra_cv_ipv6" = yes; then |
| 686 | AC_MSG_CHECKING(whether struct sockaddr_in6 has a sin6_scope_id field) |
| 687 | AC_TRY_COMPILE([#include <sys/types.h> |
| 688 | #include <netinet/in.h> |
| 689 | ],[static struct sockaddr_in6 ac_i;int ac_j = sizeof (ac_i.sin6_scope_id);], |
| 690 | [AC_MSG_RESULT(yes) |
| 691 | AC_DEFINE(HAVE_SIN6_SCOPE_ID,,scope id)], |
| 692 | AC_MSG_RESULT(no)) |
| 693 | fi |
| 694 | |
| 695 | dnl ---------------------------- |
| 696 | dnl check socklen_t exist or not |
| 697 | dnl ---------------------------- |
| 698 | AC_MSG_CHECKING(whther socklen_t is defined) |
| 699 | AC_TRY_COMPILE([#include <sys/types.h> |
| 700 | #include <sys/socket.h> |
| 701 | #include <netinet/in.h> |
| 702 | ],[socklen_t ac_x;], |
| 703 | [AC_MSG_RESULT(yes) |
| 704 | AC_DEFINE(HAVE_SOCKLEN_T,,socklen_t)], |
| 705 | AC_MSG_RESULT(no)) |
| 706 | |
| 707 | dnl ------------------------ |
| 708 | dnl check struct sockaddr_dl |
| 709 | dnl ------------------------ |
| 710 | AC_MSG_CHECKING(whether struct sockaddr_dl exist) |
| 711 | AC_EGREP_HEADER(sockaddr_dl, |
| 712 | net/if_dl.h, |
| 713 | [AC_MSG_RESULT(yes) |
| 714 | AC_DEFINE(HAVE_SOCKADDR_DL,,sockaddr_dl)], |
| 715 | AC_MSG_RESULT(no)) |
| 716 | |
| 717 | dnl -------------------------- |
| 718 | dnl check structure ifaliasreq |
| 719 | dnl -------------------------- |
| 720 | AC_MSG_CHECKING(whether struct ifaliasreq exist) |
| 721 | AC_EGREP_HEADER(ifaliasreq, |
| 722 | net/if.h, |
| 723 | [AC_MSG_RESULT(yes) |
| 724 | AC_DEFINE(HAVE_IFALIASREQ,,ifaliasreq)], |
| 725 | AC_MSG_RESULT(no)) |
| 726 | |
| 727 | dnl ---------------------------- |
| 728 | dnl check structure in6_aliasreq |
| 729 | dnl ---------------------------- |
| 730 | AC_MSG_CHECKING(whether struct if6_aliasreq exist) |
| 731 | AC_EGREP_HEADER(in6_aliasreq, |
| 732 | netinet6/in6_var.h, |
| 733 | [AC_MSG_RESULT(yes) |
| 734 | AC_DEFINE(HAVE_IN6_ALIASREQ,,in6_aliasreq)], |
| 735 | AC_MSG_RESULT(no)) |
| 736 | |
| 737 | dnl --------------------------- |
| 738 | dnl check structure rt_addrinfo |
| 739 | dnl --------------------------- |
| 740 | AC_MSG_CHECKING(whether struct rt_addrinfo exist) |
| 741 | AC_EGREP_HEADER(rt_addrinfo, |
| 742 | net/route.h, |
| 743 | [AC_MSG_RESULT(yes) |
| 744 | AC_DEFINE(HAVE_RT_ADDRINFO,,rt_addrinfo)], |
| 745 | AC_MSG_RESULT(no)) |
| 746 | |
| 747 | dnl -------------------------- |
| 748 | dnl check structure in_pktinfo |
| 749 | dnl -------------------------- |
| 750 | AC_MSG_CHECKING(whether struct in_pktinfo exist) |
| 751 | AC_TRY_COMPILE([#include <netinet/in.h> |
| 752 | ],[struct in_pktinfo ac_x;], |
| 753 | [AC_MSG_RESULT(yes) |
| 754 | AC_DEFINE(HAVE_INPKTINFO,,in_pktinfo)], |
| 755 | AC_MSG_RESULT(no)) |
| 756 | |
| 757 | dnl -------------------------------------- |
| 758 | dnl checking for getrusage struct and call |
| 759 | dnl -------------------------------------- |
| 760 | AC_MSG_CHECKING(whether getrusage is available) |
| 761 | AC_TRY_COMPILE([#include <sys/resource.h> |
| 762 | ],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);], |
| 763 | [AC_MSG_RESULT(yes) |
| 764 | AC_DEFINE(HAVE_RUSAGE,,rusage)], |
| 765 | AC_MSG_RESULT(no)) |
| 766 | |
| 767 | dnl ------------- |
| 768 | dnl check version |
| 769 | dnl ------------- |
| 770 | file="${srcdir}/lib/version.h" |
| 771 | VERSION=`sed -ne 's/^#.*ZEBRA_VERSION.*\"\([^\"]*\)\"$/\1/p' $file` |
| 772 | AC_SUBST(VERSION) |
| 773 | |
| 774 | dnl ------------------------------ |
| 775 | dnl set paths for process id files |
| 776 | dnl ------------------------------ |
| 777 | AC_CACHE_CHECK(pid file directory,ac_piddir, |
| 778 | [for ZEBRA_PID_DIR in /var/run dnl |
| 779 | /var/adm dnl |
| 780 | /etc dnl |
| 781 | /dev/null; |
| 782 | do |
| 783 | test -d $ZEBRA_PID_DIR && break |
| 784 | done |
| 785 | ac_piddir=$ZEBRA_PID_DIR |
| 786 | if test $ZEBRA_PID_DIR = "/dev/null"; then |
| 787 | echo "PID DIRECTORY NOT FOUND!" |
| 788 | fi]) |
| 789 | AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$ac_piddir/zebra.pid",zebra PID) |
| 790 | AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$ac_piddir/ripd.pid",ripd PID) |
| 791 | AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$ac_piddir/ripngd.pid",ripngd PID) |
| 792 | AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$ac_piddir/bgpd.pid",bgpd PID) |
| 793 | AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$ac_piddir/ospfd.pid",ospfd PID) |
| 794 | AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$ac_piddir/ospf6d.pid",ospf6d PID) |
| 795 | |
| 796 | |
| 797 | dnl --------------------------- |
| 798 | dnl Check htonl works correctly |
| 799 | dnl --------------------------- |
| 800 | AC_MSG_CHECKING(for working htonl) |
| 801 | AC_CACHE_VAL(ac_cv_htonl_works, [ |
| 802 | AC_TRY_LINK([#ifdef HAVE_SYS_TYPES_H |
| 803 | #include <sys/types.h> |
| 804 | #endif |
| 805 | #ifdef HAVE_NETDB_H |
| 806 | #include <netdb.h> |
| 807 | #endif |
| 808 | #ifdef HAVE_NETINET_IN_H |
| 809 | #include <netinet/in.h> |
| 810 | #endif], |
| 811 | [htonl (0);], |
| 812 | ac_cv_htonl_works=yes, |
| 813 | ac_cv_htonl_works=no)]) |
| 814 | AC_MSG_RESULT($ac_cv_htonl_works) |
| 815 | |
| 816 | AC_OUTPUT(Makefile lib/Makefile zebra/Makefile ripd/Makefile ripngd/Makefile bgpd/Makefile ospfd/Makefile ospf6d/Makefile vtysh/Makefile doc/Makefile ospfclient/Makefile) |
| 817 | |
| 818 | echo " |
| 819 | zebra configuration |
| 820 | ------------------- |
| 821 | zebra version : ${VERSION} |
| 822 | host operationg system : ${host_os} |
| 823 | source code location : ${srcdir} |
| 824 | compiler : ${CC} |
| 825 | compiler flags : ${CFLAGS} |
| 826 | directory for pid files : ${ac_piddir} |
| 827 | " |