1dnl -*- mode: shell-script -*- 2dnl Process this file with autoconf to produce a configure script. 3dnl 4dnl Permission is hereby granted, free of charge, to any person obtaining a 5dnl copy of this software and associated documentation files (the "Software"), 6dnl to deal in the Software without restriction, subject to the conditions 7dnl listed in the Click LICENSE file. These conditions include: you must 8dnl preserve this copyright notice, and you cannot mention the copyright 9dnl holders in advertising related to the Software without their permission. 10dnl The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This 11dnl notice is a summary of the Click LICENSE file; the license in that file is 12dnl legally binding. 13 14AC_INIT([libclick], [2.1]) 15AC_PREREQ(2.60) 16AC_CONFIG_HEADER([include/click/config.h:config.h.in include/click/pathvars.h:pathvars.h.in include/click/config-userlevel.h:config-userlevel.h.in]) 17AC_CONFIG_SRCDIR([click-buildtool.in]) 18 19CLICK_VERSION=$PACKAGE_VERSION 20 21AC_SUBST(ac_configure_args) 22AC_DEFINE_UNQUOTED([CLICK_VERSION], ["$CLICK_VERSION"]) 23AC_SUBST(CLICK_VERSION) 24 25click_version_code_in=`echo "$CLICK_VERSION" | sed -e 's/[[a-z]].*//' | sed -e 's/$/.0/' | tr . , | sed -e 's/^\([[0-9]]*,[[0-9]]*,[[0-9]]\).*/\1/'` 26AC_DEFINE_UNQUOTED([CLICK_VERSION_CODE], [CLICK_MAKE_VERSION_CODE($click_version_code_in)]) 27 28CLICK_INIT('$(top_srcdir)') 29 30dnl support for cross compiling 31AC_CANONICAL_SYSTEM 32 33dnl This is wrong!! 34AC_CHECK_TOOL(CC, gcc) 35AC_CHECK_TOOL(CXX, g++) 36 37CLICK_PROG_CC 38AC_PROG_CPP 39AC_C_INLINE 40 41CLICK_PROG_CXX 42AC_PROG_CXXCPP 43 44ac_preset_ar="$AR" 45AC_CHECK_TOOL(AR, ar) 46AC_CHECK_TOOL(LD, ld) 47AC_CHECK_TOOL(RANLIB, ranlib, :) 48AC_CHECK_TOOL(STRIP, strip, :) 49 50conf_auxdir='$(top_srcdir)' 51AC_SUBST(conf_auxdir) 52 53test -z "$AR_CREATEFLAGS" && AR_CREATEFLAGS=cru 54AC_SUBST(AR_CREATEFLAGS) 55 56 57dnl 58dnl drivers 59dnl 60 61dnl userlevel driver and features 62 63AC_ARG_ENABLE([user-multithread], 64 [AS_HELP_STRING([ --enable-user-multithread], [support userlevel multithreading])], 65 [:], [enable_user_multithread=no]) 66 67PTHREAD_LIBS="" 68AC_SUBST(PTHREAD_LIBS) 69 70if test "x$enable_user_multithread" = xyes; then 71 SAVE_LIBS="$LIBS" 72 AC_SEARCH_LIBS([pthread_create], [pthread], [ac_have_libpthread=yes], [ac_have_libpthread=no]) 73 AC_CHECK_HEADERS([pthread.h], [ac_have_pthread_h=yes], [ac_have_pthread_h=no]) 74 if test "$ac_have_libpthread$ac_have_pthread_h" = yesyes; then 75 AC_DEFINE([HAVE_USER_MULTITHREAD]) 76 AC_CHECK_DECLS([pthread_setaffinity_np], [], [], [#define _GNU_SOURCE 77#include <pthread.h>]) 78 if echo "$LIBS" | grep -e -lpthread >/dev/null 2>&1; then 79 PTHREAD_LIBS="-lpthread" 80 fi 81 else 82 AC_MSG_ERROR([ 83========================================= 84 85Can't find -lpthread and/or <pthread.h>, so I can't compile with 86--enable-user-multithread. 87 88=========================================]) 89 fi 90 LIBS="$SAVE_LIBS" 91fi 92 93AC_ARG_ENABLE([select], 94 [AS_HELP_STRING([ --enable-select=[[select|poll|kqueue]]], [set file descriptor wait mechanism]) 95AS_HELP_STRING([ --disable-select], [do not use select()])], 96 [:], [enable_select="select poll kqueue"]) 97AC_ARG_ENABLE([poll], 98 [AS_HELP_STRING([ --disable-poll], [do not use poll()])], 99 [:], [enable_poll=yes]) 100AC_ARG_ENABLE([kqueue], 101 [AS_HELP_STRING([ --disable-kqueue], [do not use kqueue()])], 102 [:], [enable_kqueue=yes]) 103 104if test "$enable_select" = yes; then 105 enable_select='select poll kqueue' 106elif test "$enable_select" = no; then 107 enable_select='poll kqueue' 108fi 109if echo "$enable_select" | grep select >/dev/null 2>&1; then 110 AC_DEFINE([HAVE_ALLOW_SELECT], [1], [Define if select() may be used to wait for file descriptor events.]) 111fi 112if echo "$enable_select" | grep poll >/dev/null 2>&1 && test "$enable_poll" = yes; then 113 AC_DEFINE([HAVE_ALLOW_POLL], [1], [Define if poll() may be used to wait for file descriptor events.]) 114fi 115if echo "$enable_select" | grep kqueue >/dev/null 2>&1 && test "$enable_kqueue" = yes; then 116 AC_DEFINE([HAVE_ALLOW_KQUEUE], [1], [Define if kqueue() may be used to wait for file descriptor events.]) 117fi 118 119 120dnl 121dnl element collections 122dnl 123 124AC_ARG_ENABLE([all-elements], [AS_HELP_STRING([--enable-all-elements], [include all provided element groups])]) 125 126dnl ELEMENTS_ARG_ENABLE(COLLECTION, HELP-STRING, DEFAULT-VALUE) 127element_groups="" 128AC_SUBST(element_groups) 129AC_DEFUN([ELEMENTS_ARG_ENABLE], 130[AC_ARG_ENABLE($1, [ --]builtin(substr, builtin(ifelse, [$3], yes, dis, en)[able-$1 ], 0, 21)[ ]builtin(ifelse, [$3], yes, [do not ], [])[$2], , 131[enable_]patsubst([$1], -, _)=$3)dnl 132test "x$enable_all_elements" = xyes -a \( ["x$enable_]patsubst([$1], -, _)["] = xNO -o ["x$enable_]patsubst([$1], -, _)["] = x \) && [enable_]patsubst([$1], -, _)[=yes] 133if test ["x$enable_]patsubst([$1], -, _)["] = xyes; then 134 : 135 $4 136fi]) 137 138ELEMENTS_ARG_ENABLE(ip6, [include IPv6 elements], NO, AC_DEFINE(HAVE_IP6)) 139ELEMENTS_ARG_ENABLE(ipsec, [include IP security elements], NO, AC_DEFINE(HAVE_IPSEC)) 140AC_ARG_ENABLE(experimental, [ --enable-experimental enable experimental elements in normal groups], :, enable_experimental=no) 141 142 143dnl 144dnl check whether target is Linux 145dnl 146 147AC_CACHE_CHECK([whether we are compiling for Linux], [ac_cv_under_linux], 148 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[#ifndef __linux__ 149#error "fuckers! fuckers!" 150#endif 151return 0;]])], ac_cv_under_linux=yes, ac_cv_under_linux=no)]) 152 153 154dnl 155dnl functions 156dnl 157 158AC_LANG_C 159AC_REPLACE_FUNCS(strerror) 160AC_CHECK_FUNCS(random snprintf strnlen strtof strtold strtoul tcgetpgrp vsnprintf) 161AC_LANG_CPLUSPLUS 162 163 164dnl 165dnl integer types, endianness, int64, addressable va_list 166dnl 167 168AC_ARG_ENABLE([smaller-code], 169 [AS_HELP_STRING([--enable-smaller-code], [generate smaller code (sometimes slower)])], 170 [:], [enable_smaller_code=no]) 171if test "x$enable_smaller_code" = xyes; then 172 AC_DEFINE([CLICK_OPTIMIZE_SIZE], [1], [Define to generate smaller object files.]) 173fi 174 175AC_ARG_ENABLE([int64], 176 [AS_HELP_STRING([--disable-int64], [disable 64-bit integer support])], 177 [:], [enable_int64=yes]) 178 179AC_CHECK_SIZEOF(int) 180AC_CHECK_SIZEOF(long) 181AC_CHECK_SIZEOF(size_t) 182AC_CHECK_SIZEOF(ptrdiff_t) 183AC_CHECK_SIZEOF([void *]) 184CLICK_CHECK_INTEGER_TYPES 185CLICK_CHECK_ALIGNMENT 186if test "x$enable_int64" = xyes; then 187 AC_CHECK_SIZEOF(long long) 188 CLICK_CHECK_INT64_TYPES 189fi 190CLICK_CHECK_ENDIAN 191CLICK_CHECK_SIGNED_SHIFT 192CLICK_CHECK_ADDRESSABLE_VA_LIST 193CLICK_CHECK_COMPILER_INTRINSICS 194 195 196dnl 197dnl timestamps 198dnl 199 200AC_CHECK_HEADERS_ONCE([time.h]) 201AC_CHECK_SIZEOF([struct timeval]) 202AC_CHECK_TYPES([struct timespec], [have_timespec=yes], [have_timespec=no], 203 [AC_INCLUDES_DEFAULT 204[#ifdef HAVE_TIME_H] 205[# include <time.h>] 206[#endif]]) 207if test "x$have_timespec" = xyes; then 208 AC_CHECK_SIZEOF([struct timespec]) 209fi 210CLICK_CHECK_POSIX_CLOCKS 211 212AC_ARG_ENABLE(nanotimestamp, [ --enable-nanotimestamp enable nanosecond timestamps]) 213# Default to nanosecond-precision timestamps if clock_gettime is available. 214if test "x$enable_nanotimestamp" = x -a "x$have_clock_gettime" = xyes; then 215 enable_nanotimestamp=yes 216fi 217if test "x$enable_nanotimestamp" = xyes; then 218 AC_DEFINE([HAVE_NANOTIMESTAMP_ENABLED], [1], [Define if nanosecond-granularity timestamps are enabled.]) 219fi 220 221 222dnl 223dnl check forms of port transfer 224dnl 225 226AC_ARG_ENABLE(bound-port-transfer, 227 [[ --enable-bound-port-transfer enable port transfer function ptr optimization]], 228 :, enable_bound_port_transfer=no) 229 230if test "$enable_bound_port_transfer" = yes; then 231 AC_DEFINE([HAVE_BOUND_PORT_TRANSFER], [1], [Define if Port::push/Port::pull should use bound function pointers.]) 232 CXXFLAGS="$CXXFLAGS -Wno-pmf-conversions" 233fi 234 235 236dnl 237dnl headers, event detection, dynamic linking 238dnl 239 240AC_CHECK_HEADERS_ONCE([termio.h netdb.h sys/event.h pwd.h grp.h execinfo.h]) 241CLICK_CHECK_POLL_H 242AC_CHECK_FUNCS([pselect sigaction]) 243 244AC_CHECK_FUNCS([kqueue], [have_kqueue=yes]) 245if test "x$have_kqueue" = xyes; then 246 AC_CACHE_CHECK([whether EV_SET last argument is void *], [ac_cv_ev_set_udata_pointer], 247 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 248#include <sys/event.h> 249#include <sys/time.h>]], [[struct kevent kev; EV_SET(&kev, 1, EVFILT_WRITE, EV_ADD, 0, 0, (void *) &kev);]])], [ac_cv_ev_set_udata_pointer=yes], [ac_cv_ev_set_udata_pointer=no])]) 250 if test $ac_cv_ev_set_udata_pointer = yes; then 251 AC_DEFINE([HAVE_EV_SET_UDATA_POINTER], [1], [Define if the last argument to EV_SET has pointer type.]) 252 fi 253fi 254 255AC_ARG_ENABLE(dynamic-linking, [ --disable-dynamic-linking disable dynamic linking], :, enable_dynamic_linking=yes) 256 257if test "x$enable_dynamic_linking" = xyes; then 258 CLICK_CHECK_DYNAMIC_LINKING 259fi 260 261 262dnl 263dnl sockets 264dnl 265 266AC_LANG_C 267SOCKET_LIBS= 268dnl if test "$enable_userlevel" = yes; then 269 savelibs="$LIBS"; LIBS= 270 AC_SEARCH_LIBS(gethostbyname, nsl, , , $savelibs) 271 AC_SEARCH_LIBS(connect, socket, , , $savelibs) 272 SOCKET_LIBS="$LIBS"; LIBS="$savelibs" 273 274 AC_CACHE_CHECK([whether accept() uses socklen_t], [ac_cv_accept_socklen_t], 275 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 276#include <sys/socket.h> 277]], [[socklen_t sl; (void) accept(0, (struct sockaddr *) 0, &sl);]])], 278 ac_cv_accept_socklen_t=yes, ac_cv_accept_socklen_t=no)]) 279 if test "$ac_cv_accept_socklen_t" = yes; then 280 AC_DEFINE([HAVE_ACCEPT_SOCKLEN_T], [1], [Define if accept() uses socklen_t.]) 281 fi 282dnl fi 283AC_SUBST(SOCKET_LIBS) 284AC_LANG_CPLUSPLUS 285 286 287dnl 288dnl large file support 289dnl 290 291CLICK_CHECK_LARGE_FILE_SUPPORT 292 293 294dnl 295dnl mmap 296dnl 297 298AC_LANG_C 299AC_CHECK_HEADERS_ONCE([sys/mman.h]) 300AC_FUNC_MMAP 301AC_LANG_CPLUSPLUS 302AC_CHECK_FUNCS(madvise) 303AC_CHECK_DECLS(madvise, [], [], [#if HAVE_SYS_MMAN_H 304#include <sys/types.h> 305#include <sys/mman.h> 306#endif]) 307 308 309dnl 310dnl objects required by element collections 311dnl 312 313EXTRA_DRIVER_OBJS= 314EXTRA_TOOL_OBJS= 315if test "x$enable_ip6" = xyes; then 316 EXTRA_DRIVER_OBJS="ip6address.o ip6flowid.o ip6table.o $EXTRA_DRIVER_OBJS" 317 EXTRA_TOOL_OBJS="ip6address.o $EXTRA_TOOL_OBJS" 318fi 319AC_SUBST(EXTRA_DRIVER_OBJS) 320AC_SUBST(EXTRA_TOOL_OBJS) 321 322 323dnl 324dnl more features 325dnl 326 327dnl statistics 328 329AC_ARG_ENABLE(stats, [[ --enable-stats[=LEVEL] enable statistics collection]], :, enable_stats=no) 330if test "$enable_stats" = no; then enable_stats=0; fi 331if test "$enable_stats" = yes; then enable_stats=1; fi 332if test "$enable_stats" -ge 0 > /dev/null 2>&1; then 333 AC_DEFINE_UNQUOTED([CLICK_STATS], $enable_stats) 334else 335 AC_MSG_ERROR([ 336========================================= 337 338--enable-stats takes an integer, "yes", or "no". 339 340=========================================]) 341fi 342 343dnl type of scheduling 344 345AC_ARG_ENABLE(stride, [ --disable-stride disable stride scheduler], :, enable_stride=yes) 346if test $enable_stride = yes; then 347 AC_DEFINE(HAVE_STRIDE_SCHED) 348fi 349 350AC_ARG_ENABLE(task-heap, [ --enable-task-heap use heap for task list], :, enable_task_heap=no) 351if test $enable_task_heap = yes -a $enable_stride = yes; then 352 AC_DEFINE(HAVE_TASK_HEAP) 353elif test $enable_task_heap = yes; then 354 AC_MSG_WARN([ 355========================================= 356 357Ignoring --enable-task-heap, which is incompatible with --disable-stride. 358 359=========================================]) 360fi 361 362 363dnl debugging malloc 364 365AC_ARG_ENABLE(dmalloc, [ --enable-dmalloc enable debugging malloc], :, enable_dmalloc=no) 366if test $enable_dmalloc = yes; then 367 AC_DEFINE([CLICK_DMALLOC], [1], [Define for Click memory allocation debugging.]) 368fi 369 370 371dnl valgrind debugging support 372 373AC_ARG_ENABLE(valgrind, [ --enable-valgrind extra support for debugging with valgrind], :, enable_valgrind=no) 374if test $enable_valgrind = yes; then 375 AC_CHECK_HEADERS(valgrind/memcheck.h, ac_found_valgrind_memcheck_h=yes, ac_found_valgrind_memcheck_h=no) 376 if test $ac_found_valgrind_memcheck_h = no; then 377 AC_MSG_ERROR([ 378========================================= 379 380Can't find Valgrind header file 'valgrind/memcheck.h'. 381Try again without '--enable-valgrind'. 382 383=========================================]) 384 dnl ' fix syntax highlighting 385 fi 386 AC_DEFINE([HAVE_VALGRIND], [1], [Define if Click should use Valgrind client requests.]) 387fi 388 389 390dnl Click debugging support 391 392AC_ARG_ENABLE(schedule-debugging, [[ --enable-schedule-debugging[=WHAT] enable Click scheduler debugging 393 (no/yes/extra) [yes]]], :, enable_schedule_debugging=no) 394value=0 395if test "$enable_schedule_debugging" = yes; then 396 value=1 397elif test "$enable_schedule_debugging" = extra; then 398 value=2 399fi 400if test "$value" != 0; then 401 AC_DEFINE_UNQUOTED([CLICK_DEBUG_SCHEDULING], [$value], [Define to enable debugging support for Click scheduling.]) 402fi 403 404 405dnl use Intel-specific machine instructions 406 407AC_ARG_ENABLE(intel-cpu, [ --enable-intel-cpu enable Intel-specific machine instructions], :, enable_intel_cpu=no) 408if test $enable_intel_cpu = yes; then 409 AC_DEFINE(HAVE_INTEL_CPU) 410fi 411 412 413dnl 414dnl expand path variables 415dnl The "click" versions are expanded versions of the final install locations. 416dnl The "clickbuild_" versions are partially expanded versions, with an initial 417dnl "clickprefix" replaced by "${clickbuild_prefix}". 418dnl Do this here because variables like "CLICKLINUX_FIXINCLUDES_PROGRAM" need 419dnl the expanded versions. 420dnl 421 422shell_expand () { 423 val=`eval echo '$'"$1"` 424 while echo "x$val" | grep '\$' >/dev/null 2>&1; do val=`eval echo "$val"`; done 425 val=`echo "$val" | sed 's,//*,/,g'` 426 eval "$1='$val'" 427} 428 429shell_mkbuild () { 430 val=`eval echo '$'"$1"` 431 pval="$prefix" 432 while test -n "$pval" -a -n "$val"; do 433 component=`echo "$val" | sed 's,^\(/[[^/]]*\).*,\1,'` 434 pcomponent=`echo "$pval" | sed 's,^\(/[[^/]]*\).*,\1,'` 435 if test "$component" != "$pcomponent"; then break; fi 436 val=`echo "$val" | sed 's,^/[[^/]]*,,'` 437 pval=`echo "$pval" | sed 's,^/[[^/]]*,,'` 438 done 439 while test -n "$pval"; do 440 val="/..$val" 441 pval=`echo "$pval" | sed 's,^/[[^/]]*,,'` 442 done 443 eval "clickbuild_$1='"'$'"{clickbuild_prefix}$val'" 444} 445 446dnl Preset $prefix and $exec_prefix. 447test "x$prefix" = xNONE && prefix=$ac_default_prefix 448test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' 449 450clickdatadir="$datadir/click" 451 452for i in bin clickdata data dataroot include lib sbin; do 453 shell_expand ${i}dir 454 shell_mkbuild ${i}dir 455done 456 457 458dnl 459dnl kernel interfaces 460dnl 461 462AC_CHECK_HEADERS_ONCE([ifaddrs.h linux/if_tun.h net/if_dl.h net/if_tap.h net/if_tun.h net/if_types.h net/bpf.h netpacket/packet.h]) 463 464 465dnl pcap library 466dnl note: no longer need pcap under Linux 467 468dnl if test "$enable_userlevel" = yes; then 469 CLICK_CHECK_LIBPCAP 470 CLICK_CHECK_NETMAP 471 if test "$HAVE_PCAP" != yes -a "$HAVE_NETMAP" != yes -a "$ac_cv_under_linux" != yes; then 472 AC_MSG_WARN([ 473========================================= 474 475pcap.h and/or -lpcap not found; user-level driver can't steal packets. 476 477=========================================]) 478 dnl ' fix syntax highlighting 479 fi 480 DRIVERS="$DRIVERS userlevel" 481 AC_DEFINE(HAVE_USERLEVEL_DRIVER) 482 HAVE_USERLEVEL_DRIVER=1 483dnl fi 484 485 486dnl other user-level specifics 487 488AC_CACHE_CHECK([whether struct if_data has ifi_datalen], [ac_cv_if_data_ifi_datalen], 489 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <net/if.h> 490#include <net/if_var.h> 491]], [[struct if_msghdr ifm; ifm.ifm_data.ifi_datalen = 0;]])], ac_cv_if_data_ifi_datalen=yes, ac_cv_if_data_ifi_datalen=no)]) 492if test "x$ac_cv_if_data_ifi_datalen" = xyes; then 493 AC_DEFINE([HAVE_IF_DATA_IFI_DATALEN], [1], [Define if 'struct if_data' has an 'ifi_datalen' member.]) 494fi 495 496AC_CACHE_CHECK([whether struct sockaddr_in has sin_len], [ac_cv_sockaddr_in_sin_len], 497 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h> 498#include <netinet/in.h> 499]], [[struct sockaddr_in sin; sin.sin_len = 0;]])], ac_cv_sockaddr_in_sin_len=yes, ac_cv_sockaddr_in_sin_len=no)]) 500if test "x$ac_cv_sockaddr_in_sin_len" = xyes; then 501 AC_DEFINE([HAVE_SOCKADDR_IN_SIN_LEN], [1], [Define if 'struct sockaddr_in' has a 'sin_len' member.]) 502fi 503 504 505dnl PlanetLab "Privileged Operations" library 506 507explicit_proper=yes 508AC_ARG_WITH(proper, [[ --with-proper[=PREFIX] use PlanetLab Proper library (optional)]], 509 [properprefix=$withval; if test -z "$withval" -o "$withval" = yes; then properprefix=; fi], 510 [properprefix=no; explicit_proper=no]) 511if test "$properprefix" != no; then 512 dnl Proper requires libcurl 513 dnl AC_CHECK_HEADER(curl/curl.h, have_curl_h=yes, have_curl_h=no) 514 dnl AC_CHECK_LIB(curl, curl_easy_init) 515 516 saveflags="$CPPFLAGS"; test -n "$properprefix" && CPPFLAGS="$CPPFLAGS -I$properprefix/include" 517 AC_CHECK_HEADER(prop.h, have_prop_h=yes, have_prop_h=no) 518 CPPFLAGS="$saveflags" 519 520 AC_LANG_C 521 saveflags="$LDFLAGS"; test -n "$properprefix" && LDFLAGS="$LDFLAGS -L$properprefix/lib" 522 AC_CHECK_LIB(proper, prop_open, have_libproper=yes, have_libproper=no) 523 LDFLAGS="$saveflags" 524 AC_LANG_CPLUSPLUS 525 526 if test $have_prop_h = yes -a $have_libproper = yes; then 527 AC_DEFINE(HAVE_PROPER) 528 test -n "$properprefix" && PROPER_INCLUDES="-I$properprefix/include" && PROPER_LIBS="-L$properprefix/lib" 529 PROPER_LIBS="$PROPER_LIBS -lproper" 530 elif test $explicit_proper = yes; then 531 PROPER_INCLUDES= PROPER_LIBS= 532 AC_MSG_ERROR([ 533========================================= 534 535You explicitly specified --with-proper, but the proper headers and/or 536libraries are not where you said they would be. Run again supplying 537--without-proper or --with-proper=PREFIX. 538 539=========================================]) 540 fi 541fi 542AC_SUBST(PROPER_INCLUDES) 543AC_SUBST(PROPER_LIBS) 544 545 546dnl expat library 547 548explicit_expat=yes 549AC_ARG_WITH(expat, [[ --with-expat[=PREFIX] locate expat XML library (optional)]], 550 [expatprefix=$withval; if test -z "$withval" -o "$withval" = yes; then expatprefix=; fi], 551 expatprefix=; explicit_expat=no) 552 553XML2CLICK= 554if test "$expatprefix" != no; then 555 saveflags="$CPPFLAGS"; test -n "$expatprefix" && CPPFLAGS="$CPPFLAGS -I$expatprefix/include" 556 AC_CHECK_HEADER(expat.h, have_expat_h=yes, have_expat_h=no) 557 CPPFLAGS="$saveflags" 558 559 AC_LANG_C 560 saveflags="$LDFLAGS"; test -n "$expatprefix" && LDFLAGS="$LDFLAGS -L$expatprefix/lib" 561 AC_CHECK_LIB(expat, XML_ParserCreateNS, have_libexpat=yes, have_libexpat=no) 562 LDFLAGS="$saveflags" 563 564 if test $have_expat_h = yes -a $have_libexpat = yes; then 565 AC_DEFINE(HAVE_EXPAT) 566 XML2CLICK=xml2click 567 test -n "$expatprefix" && EXPAT_INCLUDES="-I$expatprefix/include" && EXPAT_LIBS="-L$expatprefix/lib" 568 EXPAT_LIBS="$EXPAT_LIBS -lexpat" 569 elif test $explicit_expat = yes; then 570 EXPAT_INCLUDES= EXPAT_LIBS= 571 AC_MSG_ERROR([ 572========================================= 573 574You explicitly specified --with-expat, but the expat headers and/or libraries 575are not where you said they would be. Run again supplying --without-expat 576or --with-expat=PREFIX. 577 578=========================================]) 579 fi 580fi 581AC_SUBST(XML2CLICK) 582AC_SUBST(EXPAT_INCLUDES) 583AC_SUBST(EXPAT_LIBS) 584 585 586dnl 587dnl programs needed for build process 588dnl 589 590CLICK_PROG_INSTALL 591CLICK_PROG_GMAKE 592CLICK_PROG_AUTOCONF 593CLICK_PROG_PERL5 594AC_PROG_AWK 595AC_PROG_GREP 596AC_PROG_EGREP 597AC_CHECK_PROGS([MD5SUM], [md5sum md5]) 598 599if test -z "$GMAKE"; then 600 AC_MSG_ERROR([ 601============================================== 602 603Can't find GNU make. Either put 'gmake' on your PATH and 604rerun './configure', or set the GMAKE environment variable to 605GNU make's pathname. 606 607==============================================]) 608fi 609 610 611dnl 612dnl Makeinfo, texi2dvi, install-info, pod2man 613dnl 614 615AC_MSG_CHECKING(for working makeinfo) 616MAKEINFO=${MAKEINFO-makeinfo} 617if ($MAKEINFO --version) < /dev/null > conftest.out 2>&1; then 618 if test `head -n 1 conftest.out | sed 's/^.* \([[0-9]][[0-9]]*\).*$/\1/'` -ge 4; then 619 AC_MSG_RESULT(found) 620 else 621 MAKEINFO='$(conf_auxdir)/missing makeinfo' 622 AC_MSG_RESULT(old) 623 fi 624else 625 MAKEINFO='$(conf_auxdir)/missing makeinfo' 626 AC_MSG_RESULT(missing) 627fi 628 629AC_MSG_CHECKING(for working texi2dvi) 630TEXI2DVI=${TEXI2DVI-texi2dvi} 631if ($TEXI2DVI --version) < /dev/null > conftest.out 2>&1; then 632 dnl Search for a good version of texi2dvi 633 if test `head -n 1 conftest.out | sed 's/.*Texinfo \([[0-9]][[0-9]]*\).*/\1/'` -ge 4; then 634 AC_MSG_RESULT(found) 635 else 636 TEXI2DVI='$(conf_auxdir)/missing texi2dvi' 637 AC_MSG_RESULT(old) 638 fi 639else 640 TEXI2DVI='$(conf_auxdir)/missing texi2dvi' 641 AC_MSG_RESULT(missing) 642fi 643 644dnl Assume any version of install-info is OK 645if test ${INSTALL_INFO-xxx} = xxx; then 646 AC_PATH_PROG(INSTALL_INFO, install-info, '$(conf_auxdir)/missing install-info', 647 $PATH:/sbin:/usr/sbin:/usr/local/sbin) 648fi 649AC_MSG_CHECKING(for working install-info) 650if ($INSTALL_INFO --version) < /dev/null > conftest.out 2>&1; then 651 AC_MSG_RESULT(found) 652else 653 INSTALL_INFO='$(conf_auxdir)/missing install-info' 654 AC_MSG_RESULT(missing) 655fi 656 657AC_MSG_CHECKING(for working pod2man) 658POD2MAN=${POD2MAN-pod2man} 659if ($POD2MAN --help) < /dev/null > conftest.out 2>&1 && grep pod2man conftest.out >/dev/null 2>&1; then 660 AC_MSG_RESULT(found) 661else 662 POD2MAN='$(conf_auxdir)/missing pod2man' 663 AC_MSG_RESULT(missing) 664fi 665 666 667AC_SUBST(MAKEINFO) 668AC_SUBST(TEXI2DVI) 669AC_SUBST(INSTALL_INFO) 670AC_SUBST(POD2MAN) 671 672 673dnl 674dnl substitute path variables 675dnl 676 677AC_DEFINE_UNQUOTED([CLICK_BINDIR], ["$bindir"], [Install directory for Click executables.]) 678AC_DEFINE_UNQUOTED([CLICK_LIBDIR], ["$libdir"], [Install directory for Click libraries and packages.]) 679AC_DEFINE_UNQUOTED([CLICK_DATADIR], ["$clickdatadir"], [Install directory for Click shared data.]) 680 681AC_SUBST(clickdatadir) 682AC_SUBST(clickbuild_bindir) 683AC_SUBST(clickbuild_clickdatadir) 684AC_SUBST(clickbuild_datadir) 685AC_SUBST(clickbuild_includedir) 686AC_SUBST(clickbuild_libdir) 687AC_SUBST(clickbuild_sbindir) 688 689 690dnl 691dnl Provisions 692dnl 693 694dnl start out with CPU 695provisions="$target_cpu" 696case "$target_cpu" in 697 i386) :;; 698 i486|i586) provisions="$provisions i386";; 699 i686|i786) provisions="$provisions i386 i586";; 700esac 701 702dnl add 'analysis' if analysis elements are available 703if test "x$enable_analysis" = xyes; then 704 provisions="$provisions analysis" 705fi 706 707dnl add 'experimental' if --enable-experimental was supplied 708if test "x$enable_experimental" = xyes; then 709 provisions="$provisions experimental" 710fi 711 712dnl add 'int64' if 64-bit integers are available 713if test "x$have_int64_types" = xyes; then 714 provisions="$provisions int64" 715fi 716 717dnl add 'ip6' if ip6 elements are available 718if test "x$enable_ip6" = xyes; then 719 provisions="$provisions ip6" 720fi 721 722dnl add 'linux' if compiling under linux 723if test "x$ac_cv_under_linux" = xyes; then 724 provisions="$provisions linux" 725fi 726 727dnl add 'netmap' if netmap support is available 728if test "x$HAVE_NETMAP" = xyes; then 729 provisions="$provisions netmap" 730fi 731 732dnl add 'pcap' if libpcap is available 733if test "x$HAVE_PCAP" = xyes; then 734 provisions="$provisions pcap" 735fi 736 737dnl add 'umultithread' if compiled with --enable-user-multithread 738if test "x$enable_user_multithread" = xyes; then 739 provisions="$provisions umultithread" 740fi 741 742dnl add 'wifi' if wifi elements are available 743if test "x$enable_wifi" = xyes; then 744 provisions="$provisions wifi" 745fi 746 747AC_SUBST(provisions) 748 749dnl 750dnl Output 751dnl 752 753config_files="Makefile click-buildtool libsrc/Makefile" 754for ac_dir in include; do 755 test ! -d "$ac_dir" && mkdir "$ac_dir" 756done 757 758AC_OUTPUT_COMMANDS([for ac_file in $CONFIG_HEADERS; do 759 test $ac_file = include/click/config.h:config.h.in && echo > stamp-h 760done 761for ac_file in $CONFIG_FILES; do 762 test $ac_file = click-buildtool && chmod +x click-buildtool 763 test -z "$GMAKE" && echo $ac_file | grep Makefile >/dev/null && $ac_given_srcdir/missing gmake $ac_file 764done], GMAKE="$GMAKE") 765AC_OUTPUT($config_files) 766