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