1dnl 2dnl Copyright (C) 2000-2015 QoSient, LLC. 3dnl 4dnl Copyright (c) 1995, 1996, 1997, 1998 5dnl The Regents of the University of California. All rights reserved. 6dnl 7dnl Redistribution and use in source and binary forms, with or without 8dnl modification, are permitted provided that: (1) source code distributions 9dnl retain the above copyright notice and this paragraph in its entirety, (2) 10dnl distributions including binary code include the above copyright notice and 11dnl this paragraph in its entirety in the documentation or other materials 12dnl provided with the distribution, and (3) all advertising materials mentioning 13dnl features or use of this software display the following acknowledgement: 14dnl ``This product includes software developed by the University of California, 15dnl Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 16dnl the University nor the names of its contributors may be used to endorse 17dnl or promote products derived from this software without specific prior 18dnl written permission. 19dnl THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 20dnl WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 21dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 22dnl 23dnl $Id: //depot/argus/argus/acsite.m4#24 $ 24dnl $DateTime: 2015/04/13 00:43:29 $ 25dnl $Change: 2982 $ 26dnl 27 28 29dnl QOSIENT and LBL autoconf macros 30dnl 31dnl 32dnl Check for flex require flex 2.4 or higher 33dnl Check for bison define the yy prefix string 34dnl 35dnl usage: 36dnl 37dnl AC_QOSIENT_LEX_AND_YACC(lex, yacc, yyprefix) 38dnl 39dnl results: 40dnl 41dnl $1 (lex set) 42dnl $2 (yacc appended) 43dnl $3 (optional flex and bison -P prefix) 44dnl 45AC_DEFUN([AC_QOSIENT_LEX_AND_YACC], 46 [AC_CHECK_PROGS($1, flex, lex) 47 if test "$$1" = flex ; then 48 AC_MSG_CHECKING(for flex 2.4 or higher) 49 AC_CACHE_VAL(ac_cv_lbl_flex_v24, 50 if flex -V >/dev/null 2>&1; then 51 ac_cv_lbl_flex_v24=yes 52 else 53 ac_cv_lbl_flex_v24=no 54 fi) 55 AC_MSG_RESULT($ac_cv_lbl_flex_v24) 56 if test $ac_cv_lbl_flex_v24 = no ; then 57 s="2.4 or higher required" 58 AC_MSG_WARN(ignoring obsolete flex executable ($s)) 59 $1=lex 60 fi 61 else 62 AC_MSG_ERROR(flex not found. see the INSTALL for more info) 63 fi 64 65 AC_CHECK_PROGS([$2], bison, yacc) 66 67 if test "$$2" = bison ; then 68 $2="$$2 -y" 69 else 70 AC_MSG_ERROR(bison not found. see the INSTALL for more info) 71 fi 72 73 if test "$$1" = flex -a -n "$3" ; then 74 $1="$$1 -P$3" 75 $2="$$2 -p $3" 76 fi]) 77 78dnl 79dnl Determine which compiler we're using (cc or gcc) 80dnl If using gcc, determine the version number 81dnl If using cc, require that it support ansi prototypes 82dnl If using gcc, use -O3 (otherwise use -O) 83dnl If using cc, explicitly specify /usr/local/include 84dnl 85dnl usage: 86dnl 87dnl AC_LBL_C_INIT(copt, incls) 88dnl 89dnl results: 90dnl 91dnl $1 (copt set) 92dnl $2 (incls set) 93dnl CC 94dnl LDFLAGS 95dnl ac_cv_lbl_gcc_vers 96dnl LBL_CFLAGS 97dnl 98m4_define([AC_LBL_C_INIT], 99 [AC_PREREQ(2.12) 100 AC_BEFORE([$0], [AC_PROG_CC]) 101 AC_BEFORE([$0], [AC_LBL_FIXINCLUDES]) 102 AC_BEFORE([$0], [AC_LBL_DEVEL]) 103 AC_BEFORE([$0], [AC_QOSIENT_DEBUG]) 104 AC_ARG_WITH(gcc, [ --without-gcc don't use gcc]) 105 AC_ARG_WITH(examples, [ --without-examples don't compile examples]) 106 AC_ARG_WITH(pluribus, 107 [AC_HELP_STRING([--with-pluribus],[Compile for pluribus])], 108 with_pluribus=yes, 109 with_pluribus=no) 110 $1="-O" 111 $2="" 112 if test "${srcdir}" != "." ; then 113 $2="-I\$(srcdir)" 114 fi 115 if test "${CFLAGS+set}" = set; then 116 LBL_CFLAGS="$CFLAGS" 117 fi 118 if test -z "$CC" ; then 119 case "$target_os" in 120 121 *darwin*) 122 AC_CHECK_PROG(CLANG, clang, yes, no) 123 if test $CLANG = yes ; then 124 CC=cc 125 export CC 126 fi 127 ;; 128 bsdi*) 129 AC_CHECK_PROG(SHLICC2, shlicc2, yes, no) 130 if test $SHLICC2 = yes ; then 131 CC=shlicc2 132 export CC 133 fi 134 ;; 135 esac 136 fi 137 if test -z "$CC" -a "$with_gcc" = no ; then 138 CC=cc 139 export CC 140 fi 141 142 AC_PROG_CC 143 144 if test "$GCC" = yes ; then 145 if test "$SHLICC2" = yes ; then 146 ac_cv_lbl_gcc_vers=2 147 $1="-O3" 148 else 149 ac_cv_lbl_gcc_vers=0 150 AC_MSG_CHECKING(gcc version) 151 AC_CACHE_VAL(ac_cv_lbl_gcc_vers, 152 ac_cv_lbl_gcc_vers=`$CC --version 2>&1 | \ 153 sed -e '/^ version /!d' \ 154 -e 's/^gcc version //' \ 155 -e 's/ .*//' -e 's/^[[[^0-9]]]*//' \ 156 -e 's/\..*//'`) 157 AC_MSG_RESULT($ac_cv_lbl_gcc_vers) 158 if test $ac_cv_lbl_gcc_vers -gt 0 ; then 159 $1="-O3" 160 fi 161 fi 162 else 163 AC_MSG_CHECKING(that $CC handles ansi prototypes) 164 AC_CACHE_VAL(ac_cv_lbl_cc_ansi_prototypes, 165 AC_TRY_COMPILE( 166 [#include <sys/types.h>], 167 [int frob(int, char *)], 168 ac_cv_lbl_cc_ansi_prototypes=yes, 169 ac_cv_lbl_cc_ansi_prototypes=no)) 170 AC_MSG_RESULT($ac_cv_lbl_cc_ansi_prototypes) 171 if test $ac_cv_lbl_cc_ansi_prototypes = no ; then 172 case "$target_os" in 173 174 hpux*) 175 AC_MSG_CHECKING(for HP-UX ansi compiler ($CC -Aa -D_HPUX_SOURCE)) 176 savedcflags="$CFLAGS" 177 CFLAGS="-Aa -D_HPUX_SOURCE $CFLAGS" 178 AC_CACHE_VAL(ac_cv_lbl_cc_hpux_cc_aa, 179 AC_TRY_COMPILE( 180 [#include <sys/types.h>], 181 [int frob(int, char *)], 182 ac_cv_lbl_cc_hpux_cc_aa=yes, 183 ac_cv_lbl_cc_hpux_cc_aa=no)) 184 AC_MSG_RESULT($ac_cv_lbl_cc_hpux_cc_aa) 185 if test $ac_cv_lbl_cc_hpux_cc_aa = no ; then 186 AC_MSG_ERROR(see the INSTALL doc for more info) 187 fi 188 CFLAGS="$savedcflags" 189 V_CCOPT="-Aa $V_CCOPT" 190 AC_DEFINE(_HPUX_SOURCE,1,[needed on HP-UX]) 191 ;; 192 193 *) 194 AC_MSG_ERROR(see the INSTALL doc for more info) 195 ;; 196 esac 197 fi 198 $2="$$2 -I/usr/local/include" 199 LDFLAGS="$LDFLAGS -L/usr/local/lib" 200 201 case "$target_os" in 202 203 irix*) 204 V_CCOPT="$V_CCOPT -xansi -signed -g3" 205 ;; 206 207 osf*) 208 V_CCOPT="$V_CCOPT -std1 -g3" 209 ;; 210 211 ultrix*) 212 AC_MSG_CHECKING(that Ultrix $CC hacks const in prototypes) 213 AC_CACHE_VAL(ac_cv_lbl_cc_const_proto, 214 AC_TRY_COMPILE( 215 [#include <sys/types.h>], 216 [struct a { int b; }; 217 void c(const struct a *)], 218 ac_cv_lbl_cc_const_proto=yes, 219 ac_cv_lbl_cc_const_proto=no)) 220 AC_MSG_RESULT($ac_cv_lbl_cc_const_proto) 221 if test $ac_cv_lbl_cc_const_proto = no ; then 222 AC_DEFINE([const], [], [Description]) 223 fi 224 ;; 225 esac 226 fi 227]) 228 229 230dnl 231dnl Check whether a given format can be used to print 64-bit integers 232dnl 233AC_DEFUN([AC_LBL_CHECK_64BIT_FORMAT], 234 [ 235 AC_MSG_CHECKING([whether %$1x can be used to format 64-bit integers]) 236 AC_RUN_IFELSE( 237 [ 238 AC_LANG_SOURCE( 239 [[ 240# ifdef HAVE_INTTYPES_H 241 #include <inttypes.h> 242# endif 243# ifdef HAVE_SYS_BITYPES_H 244 #include <sys/bitypes.h> 245# endif 246 #include <stdio.h> 247 #include <sys/types.h> 248 249 main() 250 { 251 u_int64_t t = 1; 252 char strbuf[16+1]; 253 sprintf(strbuf, "%016$1x", t << 32); 254 if (strcmp(strbuf, "0000000100000000") == 0) 255 exit(0); 256 else 257 exit(1); 258 } 259 ]]) 260 ], 261 [ 262 AC_DEFINE(PRId64, "$1d") 263 AC_DEFINE(PRIo64, "$1o") 264 AC_DEFINE(PRIx64, "$1x") 265 AC_DEFINE(PRIu64, "$1u") 266 AC_MSG_RESULT(yes) 267 ], 268 [ 269 AC_MSG_RESULT(no) 270 $2 271 ]) 272 ]) 273 274 275dnl 276dnl Checks to see if unaligned memory accesses fail 277dnl 278dnl usage: 279dnl 280dnl AC_LBL_UNALIGNED_ACCESS 281dnl 282dnl results: 283dnl 284dnl LBL_ALIGN (DEFINED) 285dnl 286AC_DEFUN([AC_LBL_UNALIGNED_ACCESS], 287 [AC_MSG_CHECKING(if unaligned accesses fail) 288 AC_CACHE_VAL(ac_cv_lbl_unaligned_fail, 289 [case "$target_cpu" in 290 291 # XXX: should also check that they don't do weird things (like on arm) 292 alpha*|arm*|hp*|mips|sparc) 293 ac_cv_lbl_unaligned_fail=yes 294 ;; 295 296 *) 297 cat >conftest.c <<EOF 298# include <sys/types.h> 299# include <sys/wait.h> 300# include <stdio.h> 301 unsigned char a[[5]] = { 1, 2, 3, 4, 5 }; 302 main() { 303 unsigned int i; 304 pid_t pid; 305 int status; 306 /* avoid "core dumped" message */ 307 pid = fork(); 308 if (pid < 0) 309 exit(2); 310 if (pid > 0) { 311 /* parent */ 312 pid = waitpid(pid, &status, 0); 313 if (pid < 0) 314 exit(3); 315 exit(!WIFEXITED(status)); 316 } 317 /* child */ 318 i = *(unsigned int *)&a[[1]]; 319 printf("%d\n", i); 320 exit(0); 321 } 322EOF 323 ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS \ 324 conftest.c $LIBS >/dev/null 2>&1 325 if test ! -x conftest ; then 326 dnl failed to compile for some reason 327 ac_cv_lbl_unaligned_fail=yes 328 else 329 ./conftest >conftest.out 330 if test ! -s conftest.out ; then 331 ac_cv_lbl_unaligned_fail=yes 332 else 333 ac_cv_lbl_unaligned_fail=no 334 fi 335 fi 336 rm -rf conftest* core core.conftest 337 ;; 338 esac]) 339 AC_MSG_RESULT($ac_cv_lbl_unaligned_fail) 340 if test $ac_cv_lbl_unaligned_fail = yes ; then 341 AC_DEFINE([LBL_ALIGN], [], [Description]) 342 fi]) 343 344 345dnl 346dnl If using gcc and the file .devel exists: 347dnl Compile with -g (if supported) and -Wall 348dnl If using gcc 2, do extra prototype checking 349dnl If an os prototype include exists, symlink os-proto.h to it 350dnl 351dnl usage: 352dnl 353dnl AC_LBL_DEVEL(copt) 354dnl 355dnl results: 356dnl 357dnl $1 (copt appended) 358dnl 359 360AC_DEFUN([AC_LBL_DEVEL], 361 [rm -f os-proto.h 362 if test "${LBL_CFLAGS+set}" = set; then 363 $1="$$1 ${LBL_CFLAGS}" 364 fi 365 if test -f .devel ; then 366 $1=`echo $$1 | sed -e 's/-O3//'` 367 $1=`echo $$1 | sed -e 's/-O//'` 368 if test "$GCC" = yes ; then 369 if test "${LBL_CFLAGS+set}" != set; then 370 if test "$ac_cv_prog_cc_g" = yes ; then 371 $1="-g $$1" 372 fi 373 $1="$$1 -Wall" 374 if test $ac_cv_lbl_gcc_vers -gt 1 ; then 375 $1="$$1 -Wmissing-prototypes" 376 fi 377 fi 378 else 379 case "$target_os" in 380 solaris*) 381 $1="$$1 -g" 382 ;; 383 384 irix6*) 385 V_CCOPT="$V_CCOPT -n32" 386 ;; 387 388 *) 389 ;; 390 esac 391 fi 392 fi]) 393 394dnl 395dnl If the file .debug exists: 396dnl Add ARGUS_DEBUG to the condefs.h file. 397dnl 398dnl usage: 399dnl 400dnl AC_QOSIENT_DEBUG(copt) 401dnl 402dnl results: 403dnl 404dnl $1 (copt appended) 405dnl 406 407 408AC_DEFUN([AC_QOSIENT_DEBUG], 409 [ 410 if test -f .debug ; then 411 AC_DEFINE([ARGUSDEBUG], [], [Using Argus debug]) 412 fi]) 413 414dnl 415dnl If the file .threads exists: 416dnl Add ARGUS_THREADS to the condefs.h file. 417dnl 418dnl usage: 419dnl 420dnl AC_QOSIENT_THREADS(copt) 421dnl 422dnl results: 423dnl 424dnl $1 (copt appended) 425dnl 426 427AC_DEFUN([AC_QOSIENT_THREADS], 428 [AC_ARG_WITH(threads, 429 [AC_HELP_STRING([--without-threads],[don't use native threads package])], 430 with_threads="$withval", 431 with_threads="yes") 432 433 if test "$with_threads" != no; then 434 case "$host_os" in 435 *openbsd*) 436 ;; 437 438 *) 439 AC_MSG_CHECKING(for .threads) 440 if test -f .threads ; then 441 AC_MSG_RESULT(yes) 442 $1="" 443 if test "$GCC" = yes ; then 444 case "$host_os" in 445 *darwin*) 446 ;; 447 cygwin*) 448 ;; 449 *) 450 $1="-lpthread $$1" 451 ;; 452 esac 453 else 454 case "$host_os" in 455 solaris*) 456 $1="-mt -lpthread $$1" 457 ;; 458 cygwin*) 459 ;; 460 *darwin*) 461 ;; 462 *) 463 $1="-lpthread $$1" 464 ;; 465 esac 466 fi 467 AC_DEFINE([ARGUS_THREADS], [], [Using Argus threads]) 468 AC_CHECK_FUNCS(sched_get_priority_min) 469 else 470 AC_MSG_RESULT(no) 471 fi 472 ;; 473 esac 474 fi 475]) 476 477 478dnl 479dnl 480dnl usage: 481dnl 482dnl AC_QOSIENT_READLINE(copt) 483dnl 484dnl results: 485dnl 486dnl $1 (copt appended) 487dnl 488 489 490dnl 491dnl usage: 492dnl 493dnl AC_QOSIENT_PCRE(pcrelib, incls) 494dnl 495dnl results: 496dnl 497dnl $1 (pcrelib set) 498dnl $2 (incls appended) 499dnl LIBS 500dnl LBL_LIBS 501dnl 502 503AC_DEFUN([AC_QOSIENT_PCRE], [ 504 AC_ARG_WITH(libpcre, 505 [AC_HELP_STRING([--with-libpcre=DIR],[Compile with libpcre in <DIR>])], 506 with_libpcre="$withval", 507 with_libpcre="no") 508 509 if test ${with_libpcre} != "no"; then 510 AC_MSG_CHECKING(for pcre library) 511 AC_ARG_WITH(pcre-config, 512 [AC_HELP_STRING([--with-pcre-config=PATH], [Location of PCRE pcre-config (auto)])], 513 with_pcre_config="$withval", 514 with_pcre_config="yes") 515 516 if test ${with_pcre_config} != "no"; then 517 if test -f $with_pcre_config ; then 518 PCRE_CONFIG=$with_pcre_config 519 else 520 AC_CHECK_PROGS(PCRE_CONFIG, pcre-config) 521 fi 522 fi 523 524 if test "x$PCRE_CONFIG" != "x"; then 525 PCRE_CFLAGS=`$PCRE_CONFIG --cflags` 526 PCRE_LIBS=`$PCRE_CONFIG --libs-posix` 527 fi 528 529 if test "x$PCRE_LIBS" != "x" ; then 530 AC_DEFINE([ARGUS_PCRE], [], [Using System Pcre Library]) 531 $1=$PCRE_LIBS; 532 $2="$PCRE_CFLAGS $$2" 533 else 534 AC_CHECK_HEADERS(regex.h,, AC_ERROR(neither pcre nor regex found)) 535 fi 536 else 537 AC_CHECK_HEADERS(regex.h,, AC_ERROR(regex not found)) 538 fi 539]) 540 541 542AC_DEFUN([AC_QOSIENT_READLINE], 543 [ 544 LBL_LIBS="$LIBS" 545 LIBS="$LIBS $CURSESLIB" 546 READLINELIB="" 547 READLINEHOOK="" 548 READLINEREPLACELINE="" 549 550 AC_CHECK_HEADER(readline/readline.h, AC_CHECK_LIB(readline, readline, READLINELIB="-lreadline",,),) 551 if test ! -z "$READLINELIB"; then 552 AC_DEFINE([ARGUS_READLINE], [], [Using System Readline]) 553 $1="$READLINELIB" 554 555 AC_CHECK_LIB(readline, rl_event_hook, READLINEHOOK="yes",,) 556 if test ! -z "$READLINEHOOK"; then 557 AC_DEFINE([ARGUS_READLINE_EVENT_HOOK], [], [Using System Readline Event Hook]) 558 AC_CHECK_LIB(readline, rl_replace_line, READLINEREPLACELINE="yes",,) 559 if test ! -z "$READLINEREPLACELINE"; then 560 AC_DEFINE([ARGUS_READLINE_REPLACE_LINE], [], [Using System Readline Replace Line]) 561 fi 562 fi 563 fi 564 LIBS="$LBL_LIBS" 565 ]) 566 567 568dnl 569dnl If the file .memory exists: 570dnl Add ARGUSMEMDEBUG to the condefs.h file. 571dnl 572dnl usage: 573dnl 574dnl AC_QOSIENT_MEMORY(copt) 575dnl 576dnl results: 577dnl 578dnl $1 (copt appended) 579dnl 580 581 582AC_DEFUN([AC_QOSIENT_MEMORY], 583 [ 584 if test -f .memory ; then 585 AC_DEFINE([ARGUSMEMDEBUG], [], [Using Argus memory]) 586 fi]) 587 588 589dnl 590dnl Use pfopen.c if available and pfopen() not in standard libraries 591dnl Require libpcap 592dnl Look for libpcap in .. 593dnl Use the installed libpcap if there is no local version 594dnl 595dnl usage: 596dnl 597dnl AC_QOSIENT_LIBPCAP(pcapdep, incls) 598dnl AC_LBL_LIBPCAP(pcapdep, incls) with mods 599dnl 600dnl results: 601dnl 602dnl $1 (pcapdep set) 603dnl $2 (incls appended) 604dnl LIBS 605dnl LBL_LIBS 606dnl 607 608AC_DEFUN([AC_QOSIENT_LIBPCAP], [ 609 AC_ARG_WITH(libpcap, 610 [AC_HELP_STRING([--with-libpcap=DIR],[Compile with libpcap in <DIR>])], 611 with_libpcap="$withval", 612 with_libpcap="yes") 613 614 AC_REQUIRE([AC_LBL_LIBRARY_NET]) 615 616 dnl 617 dnl save a copy before locating libpcap.a 618 dnl 619 620 LBL_LIBS="$LIBS" 621 libpcap=FAIL 622 lastdir=FAIL 623 624 if test ${with_libpcap} != "yes"; then 625 AC_MSG_CHECKING(for specified library) 626 for dir in ${with_libpcap}; do 627 if test -r $dir/libpcap.a ; then 628 if test -x $dir/pcap-config ; then 629 libpcap="$dir/libpcap.a `$dir/pcap-config --additional-libs --static`" 630 else 631 libpcap=$dir/libpcap.a 632 fi 633 AC_MSG_RESULT($libpcap) 634 $1=$libpcap 635 AC_MSG_CHECKING(for specified pcap.h) 636 if test -r $dir/pcap.h; then 637 d=$dir 638 AC_MSG_RESULT(found) 639 $2="-I$d $$2" 640 else 641 AC_MSG_WARN(not found) 642 fi 643 dnl continue and select the last one that exists 644 fi 645 done 646 647 else 648 pfopen=/usr/examples/packetfilter/pfopen.c 649 if test -f $pfopen ; then 650 AC_CHECK_FUNCS(pfopen) 651 if test $ac_cv_func_pfopen = "no" ; then 652 AC_MSG_RESULT(Using $pfopen) 653 LIBS="$LIBS $pfopen" 654 fi 655 fi 656 AC_MSG_CHECKING(for local pcap library) 657 places=`ls $srcdir/.. | sed -e 's,/$,,' -e "s,^,$srcdir/../," | \ 658 egrep '/libpcap-[[0-9]]*.[[0-9]]*(.[[0-9]]*)?([[ab]][[0-9]]*)?$'` 659 660 for dir in $places $srcdir/../libpcap $srcdir/libpcap ; do 661 basedir=`echo $dir | sed -e 's/[[ab]][[0-9]]*$//'` 662 if test $lastdir = $basedir ; then 663 dnl skip alphas when an actual release is present 664 continue; 665 fi 666 lastdir=$dir 667 if test -r $dir/libpcap.a ; then 668 if test -r $dir/pcap.h ; then 669 libpcap=$dir/libpcap.a 670 d=$dir 671 fi 672 dnl continue and select the last one that exists 673 fi 674 done 675 if ! test "$libpcap" = FAIL; then 676 AC_MSG_RESULT($libpcap) 677 $1=$libpcap 678 $2="-I$d $$2" 679 AC_PATH_PROG(PCAP_CONFIG, pcap-config,, $d) 680 if test -n "$PCAP_CONFIG"; then 681 # 682 # The libpcap directory has a pcap-config script. 683 # Use it to get any additioal libraries needed 684 # to link with the libpcap archive library in 685 # that directory 686 # 687 libpcap="$libpcap `$PCAP_CONFIG --additional-libs --static`" 688 fi 689 fi 690 fi 691 692 if test "$libpcap" = FAIL ; then 693 AC_MSG_RESULT(not found) 694 # 695 # Look for pcap-config. 696 # 697 AC_PATH_PROG(PCAP_CONFIG, pcap-config) 698 if test -n "$PCAP_CONFIG" ; then 699 # 700 # Found - use it to get the include flags for 701 # libpcap and the flags to link with libpcap. 702 # 703 libpcap="`$PCAP_CONFIG --libs`" 704 705 $2="`$PCAP_CONFIG --cflags` $$2" 706 $1="$libpcap" 707 else 708 AC_CHECK_LIB(pcap, main, libpcap="-lpcap") 709 if test $libpcap = FAIL ; then 710 AC_MSG_RESULT(not found) 711 AC_CHECK_LIB(pcap, main, libpcap="-lwpcap") 712 if test $libpcap = FAIL ; then 713 AC_MSG_CHECKING(for local wpcap library) 714 dir="../WpdPack" 715 if test -r $dir/Lib/libwpcap.a; then 716 $1="$dir/Lib/libwpcap.a" 717 else 718 AC_MSG_RESULT(no) 719 AC_MSG_ERROR(see the INSTALL doc for more info) 720 fi 721 else 722 $1="$libpcap" 723 fi 724 else 725 $1="$libpcap" 726 fi 727 dnl 728 dnl Good old Red Hat Linux puts "pcap.h" in 729 dnl "/usr/include/pcap"; had the LBL folks done so, 730 dnl that would have been a good idea, but for 731 dnl the Red Hat folks to do so just breaks source 732 dnl compatibility with other systems. 733 dnl 734 dnl We work around this by assuming that, as we didn't 735 dnl find a local libpcap, libpcap is in /usr/lib or 736 dnl /usr/local/lib and that the corresponding header 737 dnl file is under one of those directories; if we don't 738 dnl find it in either of those directories, we check to 739 dnl see if it's in a "pcap" subdirectory of them and, 740 dnl if so, add that subdirectory to the "-I" list. 741 dnl 742 AC_MSG_CHECKING(for extraneous pcap header directories) 743 if test \( ! -r /usr/local/include/pcap.h \) -a \ 744 \( ! -r /usr/include/pcap.h \); then 745 if test -r /usr/local/include/pcap/pcap.h; then 746 d="/usr/local/include/pcap" 747 elif test -r /usr/include/pcap/pcap.h; then 748 d="/usr/include/pcap" 749 elif test -r $dir/Include/pcap.h; then 750 d=$dir/Include 751 fi 752 fi 753 if test -z "$d" ; then 754 AC_MSG_RESULT(not found) 755 else 756 $2="-I$d $$2" 757 AC_MSG_RESULT(found -- -I$d added) 758 fi 759 fi 760 fi 761 762 $2=`echo $$2 | sed -e 's/\.\./..\/../'` 763 LIBS="$LIBS $libpcap" 764 case "$host_os" in 765 766 aix*) 767 pseexe="/lib/pse.exp" 768 AC_MSG_CHECKING(for $pseexe) 769 if test -f $pseexe ; then 770 AC_MSG_RESULT(yes) 771 LIBS="$LIBS -I:$pseexe" 772 fi 773 # 774 # We need "-lodm" and "-lcfg", as libpcap requires them on 775 # AIX, and we just build a static libpcap.a and thus can't 776 # arrange that when you link with libpcap you automatically 777 # link with those libraries. 778 # 779 LIBS="$LIBS -lodm -lcfg" 780 ;; 781 esac 782 783 dnl 784 dnl Check for "pcap_list_datalinks()", "pcap_set_datalink()", 785 dnl and "pcap_datalink_name_to_val()", and use substitute versions 786 dnl if they're not present. 787 dnl 788 789 AC_CHECK_FUNC(pcap_list_datalinks, 790 AC_DEFINE([HAVE_PCAP_LIST_DATALINKS], [], [pcap list datalinks]), 791 [ 792 AC_LIBOBJ(datalinks) 793 ]) 794 AC_CHECK_FUNC(pcap_set_datalink, 795 AC_DEFINE([HAVE_PCAP_SET_DATALINK], [], [pcap set datalink])) 796 AC_CHECK_FUNC(pcap_datalink_name_to_val, 797 [ 798 AC_DEFINE([HAVE_PCAP_DATALINK_NAME_TO_VAL], [], [pcap datalink name]) 799 AC_CHECK_FUNC(pcap_datalink_val_to_description, 800 AC_DEFINE([HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION], [], [pcap datalink val to desc]), 801 [ 802 AC_LIBOBJ(dlnames) 803 ]) 804 ], 805 [ 806 AC_LIBOBJ(dlnames) 807 ]) 808 809 dnl 810 dnl Check for vital pcap routines; you can't substitute for them if 811 dnl they are absent (it has hooks into the live capture routines), 812 dnl so just define the HAVE_ value if it's there. 813 dnl 814 AC_CHECK_FUNCS(pcap_set_buffer_size) 815 AC_CHECK_FUNCS(pcap_fopen_offline) 816 AC_CHECK_FUNCS(pcap_get_selectable_fd) 817 AC_CHECK_FUNCS(pcap_next_ex) 818 AC_CHECK_FUNCS(pcap_dump_ftell) 819 AC_CHECK_FUNCS(pcap_dump_flush) 820 LIBS="$LBL_LIBS" 821]) 822 823dnl 824dnl Find libwrappers 825dnl Look for libwrappers in .. 826dnl Use the installed libwrappers if there is no local version 827dnl 828dnl usage: 829dnl 830dnl AC_QOSIENT_TCPWRAP(wrapdep, incls) 831dnl 832dnl results: 833dnl 834dnl $1 (wrapdep set) 835dnl $2 (incls appended) 836dnl LIBS 837dnl LBL_LIBS 838dnl 839AC_DEFUN([AC_QOSIENT_TCPWRAP], [ 840 AC_ARG_WITH(tcpwrappers, 841 [AC_HELP_STRING([--with-wrappers=DIR],[Compile with tcpwrappers in <DIR>])], 842 with_wrappers="$withval", 843 with_wrappers="yes") 844 845 if test ${with_wrappers} != "no"; then 846 saved_CPPFLAGS=$CPPFLAGS 847 saved_LDFLAGS=$LDFLAGS 848 saved_LIBS=$LIBS 849 850 if test ${with_wrappers} != "yes"; then 851 CPPFLAGS="${saved_CPPFLAGS} -I${with_wrappers}/include" 852 LDFLAGS="${save_LDFLAGS} -L${with_wrappers}/lib" 853 else 854 AC_MSG_CHECKING(for local tcp_wrappers library) 855 libwrap=FAIL 856 lastdir=FAIL 857 pwdir=`pwd` 858 places=`ls .. | sed -e 's,/$,,' -e 's,^,../,' | egrep 'tcp_wrappers'` 859 for dir in $places; do 860 if test $lastdir = $dir ; then 861 dnl skip alphas when an actual release is present 862 continue; 863 fi 864 lastdir=$dir 865 if test -r $dir/libwrap.a ; then 866 libwrap=$dir/libwrap.a 867 d=$dir 868 dnl continue and select the last one that exists 869 fi 870 done 871 872 if test $libwrap = FAIL ; then 873 AC_MSG_RESULT(not found) 874 AC_MSG_CHECKING(for system tcp_wrappers library) 875 876 case "$target_os" in 877 solaris*) 878 dnl Workaround to look for wrappers on mac os x and solaris in /opt/local 879 CPPFLAGS="${saved_CPPFLAGS} -I/opt/local/include" 880 LDFLAGS="${save_LDFLAGS} -L/opt/local/lib" 881 ;; 882 darwin*) 883 dnl Workaround to look for wrappers on mac os x and solaris in /opt/local 884 CPPFLAGS="${saved_CPPFLAGS} -I/opt/local/include" 885 LDFLAGS="${save_LDFLAGS} -L/opt/local/lib" 886 ;; 887 esac 888 889 AC_CHECK_HEADERS(tcpd.h, 890 AC_CHECK_DECLS([fromhost ], [] , [] , [ #include <tcpd.h> ]), ac_cv_found_wrappers=no) 891 892 if test "$ac_cv_found_wrappers" != no; then 893 $1="-lwrap" 894 $2=$CPPFLAGS 895 AC_DEFINE([ARGUS_WRAPPERS], [], [Using System TcpWrappers Library]) 896 else 897 LIBS=$saved_LIBS 898 LDFLAGS=$saved_LDFLAGS 899 CPPFLAGS=$saved_CPPFLAGS 900 fi 901 fi 902 fi 903 fi 904]) 905 906 907dnl 908dnl Improved version of AC_CHECK_LIB 909dnl 910dnl Thanks to John Hawkinson (jhawk@mit.edu) 911dnl 912dnl usage: 913dnl 914dnl AC_LBL_CHECK_LIB(LIBRARY, FUNCTION [, ACTION-IF-FOUND [, 915dnl ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]]) 916dnl 917dnl results: 918dnl 919dnl LIBS 920dnl 921 922AC_DEFUN([AC_LBL_CHECK_LIB], 923[AC_MSG_CHECKING([for $2 in -l$1]) 924dnl Use a cache variable name containing both the library and function name, 925dnl because the test really is for library $1 defining function $2, not 926dnl just for library $1. Separate tests with the same $1 and different $2's 927dnl may have different results. 928ac_lib_var=`echo $1['_']$2['_']$5 | sed 'y%./+- %__p__%'` 929AC_CACHE_VAL(ac_cv_lbl_lib_$ac_lib_var, 930[ac_save_LIBS="$LIBS" 931LIBS="-l$1 $5 $LIBS" 932AC_TRY_LINK(dnl 933ifelse([$2], [main], , dnl Avoid conflicting decl of main. 934[/* Override any gcc2 internal prototype to avoid an error. */ 935]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus 936extern "C" 937#endif 938])dnl 939[/* We use char because int might match the return type of a gcc2 940 builtin and then its argument prototype would still apply. */ 941char $2(); 942]), 943 [$2()], 944 eval "ac_cv_lbl_lib_$ac_lib_var=yes", 945 eval "ac_cv_lbl_lib_$ac_lib_var=no") 946LIBS="$ac_save_LIBS" 947])dnl 948if eval "test \"`echo '$ac_cv_lbl_lib_'$ac_lib_var`\" = yes"; then 949 AC_MSG_RESULT(yes) 950 ifelse([$3], , 951[changequote(, )dnl 952 ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \ 953 -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` 954changequote([, ])dnl 955 AC_DEFINE_UNQUOTED($ac_tr_lib) 956 LIBS="-l$1 $LIBS" 957], [$3]) 958else 959 AC_MSG_RESULT(no) 960ifelse([$4], , , [$4 961])dnl 962fi 963]) 964 965 966dnl 967dnl AC_LBL_LIBRARY_NET 968dnl 969dnl This test is for network applications that need socket() and 970dnl gethostbyname() -ish functions. Under Solaris, those applications 971dnl need to link with "-lsocket -lnsl". Under IRIX, they need to link 972dnl with "-lnsl" but should *not* link with "-lsocket" because 973dnl libsocket.a breaks a number of things (for instance: 974dnl gethostbyname() under IRIX 5.2, and snoop sockets under most 975dnl versions of IRIX). 976dnl 977dnl Unfortunately, many application developers are not aware of this, 978dnl and mistakenly write tests that cause -lsocket to be used under 979dnl IRIX. It is also easy to write tests that cause -lnsl to be used 980dnl under operating systems where neither are necessary (or useful), 981dnl such as SunOS 4.1.4, which uses -lnsl for TLI. 982dnl 983dnl This test exists so that every application developer does not test 984dnl this in a different, and subtly broken fashion. 985 986dnl It has been argued that this test should be broken up into two 987dnl seperate tests, one for the resolver libraries, and one for the 988dnl libraries necessary for using Sockets API. Unfortunately, the two 989dnl are carefully intertwined and allowing the autoconf user to use 990dnl them independantly potentially results in unfortunate ordering 991dnl dependancies -- as such, such component macros would have to 992dnl carefully use indirection and be aware if the other components were 993dnl executed. Since other autoconf macros do not go to this trouble, 994dnl and almost no applications use sockets without the resolver, this 995dnl complexity has not been implemented. 996dnl 997dnl The check for libresolv is in case you are attempting to link 998dnl statically and happen to have a libresolv.a lying around (and no 999dnl libnsl.a). 1000dnl 1001AC_DEFUN([AC_LBL_LIBRARY_NET], [ 1002 # Most operating systems have gethostbyname() in the default searched 1003 # libraries (i.e. libc): 1004 # Some OSes (eg. Solaris) place it in libnsl 1005 # Some strange OSes (SINIX) have it in libsocket: 1006 AC_SEARCH_LIBS(gethostbyname, nsl socket resolv) 1007 # Unfortunately libsocket sometimes depends on libnsl and 1008 # AC_SEARCH_LIBS isn't up to the task of handling dependencies like this. 1009 if test "$ac_cv_search_gethostbyname" = "no" 1010 then 1011 AC_CHECK_LIB(socket, gethostbyname, 1012 LIBS="-lsocket -lnsl $LIBS", , -lnsl) 1013 fi 1014 AC_SEARCH_LIBS(socket, socket, , 1015 AC_CHECK_LIB(socket, socket, LIBS="-lsocket -lnsl $LIBS", , -lnsl)) 1016 # DLPI needs putmsg under HPUX so test for -lstr while we're at it 1017 AC_SEARCH_LIBS(putmsg, str) 1018 ]) 1019 1020 1021dnl 1022dnl If using gcc, make sure we have ANSI ioctl definitions 1023dnl 1024dnl usage: 1025dnl 1026dnl AC_LBL_FIXINCLUDES 1027dnl 1028AC_DEFUN([AC_LBL_FIXINCLUDES], 1029 [if test "$GCC" = yes ; then 1030 AC_MSG_CHECKING(for ANSI ioctl definitions) 1031 AC_CACHE_VAL(ac_cv_lbl_gcc_fixincludes, 1032 AC_TRY_COMPILE( 1033 [/* 1034 * This generates a "duplicate case value" when fixincludes 1035 * has not be run. 1036 */ 1037# include <sys/types.h> 1038# include <sys/time.h> 1039# include <sys/ioctl.h> 1040# ifdef HAVE_SYS_IOCCOM_H 1041# include <sys/ioccom.h> 1042# endif], 1043 [switch (0) { 1044 case _IO('A', 1):; 1045 case _IO('B', 1):; 1046 }], 1047 ac_cv_lbl_gcc_fixincludes=yes, 1048 ac_cv_lbl_gcc_fixincludes=no)) 1049 AC_MSG_RESULT($ac_cv_lbl_gcc_fixincludes) 1050 if test $ac_cv_lbl_gcc_fixincludes = no ; then 1051 # Don't cache failure 1052 unset ac_cv_lbl_gcc_fixincludes 1053 AC_MSG_ERROR(see the INSTALL for more info) 1054 fi 1055 fi]) 1056 1057 1058AC_DEFUN([CMU_TEST_LIBPATH], [ 1059changequote(<<, >>) 1060define(<<CMU_AC_CV_FOUND>>, translit(ac_cv_found_$2_lib, <<- *>>, <<__p>>)) 1061changequote([, ]) 1062if test "$CMU_AC_CV_FOUND" = "yes"; then 1063 if test \! -r "$1/lib$2.a" -a \! -r "$1/lib$2.so" -a \! -r "$1/lib$2.sl" -a \! -r "$1/lib$2.dylib"; then 1064 CMU_AC_CV_FOUND=no 1065 fi 1066fi 1067]) 1068 1069AC_DEFUN([CMU_TEST_INCPATH], [ 1070changequote(<<, >>) 1071define(<<CMU_AC_CV_FOUND>>, translit(ac_cv_found_$2_inc, [ *], [_p])) 1072changequote([, ]) 1073if test "$CMU_AC_CV_FOUND" = "yes"; then 1074 if test \! -r "$1/$2.h"; then 1075 CMU_AC_CV_FOUND=no 1076 fi 1077fi 1078]) 1079 1080dnl CMU_CHECK_HEADER_NOCACHE(HEADER-FILE, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) 1081AC_DEFUN([CMU_CHECK_HEADER_NOCACHE], 1082[dnl Do the transliteration at runtime so arg 1 can be a shell variable. 1083ac_safe=`echo "$1" | sed 'y%./+-%__p_%'` 1084AC_MSG_CHECKING([for $1]) 1085AC_TRY_CPP([#include <$1>], eval "ac_cv_header_$ac_safe=yes", 1086 eval "ac_cv_header_$ac_safe=no") 1087if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then 1088 AC_MSG_RESULT(yes) 1089 ifelse([$2], , :, [$2]) 1090else 1091 AC_MSG_RESULT(no) 1092ifelse([$3], , , [$3 1093])dnl 1094fi 1095]) 1096 1097AC_DEFUN([CMU_FIND_LIB_SUBDIR], 1098[dnl 1099AC_ARG_WITH([lib-subdir], AC_HELP_STRING([--with-lib-subdir=DIR],[Find libraries in DIR instead of lib])) 1100AC_CHECK_SIZEOF(long) 1101AC_CACHE_CHECK([what directory libraries are found in], [ac_cv_cmu_lib_subdir], 1102[test "X$with_lib_subdir" = "Xyes" && with_lib_subdir= 1103test "X$with_lib_subdir" = "Xno" && with_lib_subdir= 1104if test "X$with_lib_subdir" = "X" ; then 1105 ac_cv_cmu_lib_subdir=lib 1106 if test $ac_cv_sizeof_long -eq 4 ; then 1107 test -d /usr/lib32 && ac_cv_cmu_lib_subdir=lib32 1108 fi 1109 if test $ac_cv_sizeof_long -eq 8 ; then 1110 test -d /usr/lib64 && ac_cv_cmu_lib_subdir=lib64 1111 fi 1112else 1113 ac_cv_cmu_lib_subdir=$with_lib_subdir 1114fi]) 1115AC_SUBST(CMU_LIB_SUBDIR, $ac_cv_cmu_lib_subdir) 1116]) 1117 1118 1119dnl sasl.m4--sasl libraries and includes 1120dnl Derrick Brashear 1121dnl from KTH sasl and Arla 1122 1123AC_DEFUN([CMU_SASL_INC_WHERE1], [ 1124saved_CPPFLAGS=$CPPFLAGS 1125CPPFLAGS="$saved_CPPFLAGS -I$1" 1126CMU_CHECK_HEADER_NOCACHE(sasl.h, 1127ac_cv_found_sasl_inc=yes, 1128ac_cv_found_sasl_inc=no) 1129CPPFLAGS=$saved_CPPFLAGS 1130]) 1131 1132AC_DEFUN([CMU_SASL_INC_WHERE], [ 1133 for i in $1; do 1134 CMU_SASL_INC_WHERE1($i) 1135 CMU_TEST_INCPATH($i, sasl) 1136 if test "$ac_cv_found_sasl_inc" = "yes"; then 1137 ac_cv_sasl_where_inc=$i 1138 break 1139 fi 1140 done 1141]) 1142 1143AC_DEFUN([CMU_SASL_LIB_WHERE1], [ 1144saved_LIBS=$LIBS 1145LIBS="$saved_LIBS -L$1 -lsasl" 1146AC_TRY_LINK(, 1147[sasl_getprop();], 1148[ac_cv_found_sasl_lib=yes], 1149ac_cv_found_sasl_lib=no) 1150LIBS=$saved_LIBS 1151]) 1152 1153AC_DEFUN([CMU_SASL_LIB_WHERE], [ 1154 for i in $1; do 1155 CMU_SASL_LIB_WHERE1($i) 1156 dnl deal with false positives from implicit link paths 1157 CMU_TEST_LIBPATH($i, sasl) 1158 if test "$ac_cv_found_sasl_lib" = "yes" ; then 1159 ac_cv_sasl_where_lib=$i 1160 break 1161 fi 1162 done 1163]) 1164 1165AC_DEFUN([CMU_SASL], [ 1166AC_REQUIRE([CMU_FIND_LIB_SUBDIR]) 1167AC_ARG_WITH(sasl, 1168 [ --with-sasl=DIR|yes use with libsasl in <DIR> no], 1169 with_sasl="$withval", 1170 with_sasl="no") 1171 1172if test ${with_sasl} != "no"; then 1173 SASLFLAGS="" 1174 LIB_SASL="" 1175 1176 cmu_saved_CPPFLAGS=$CPPFLAGS 1177 cmu_saved_LDFLAGS=$LDFLAGS 1178 cmu_saved_LIBS=$LIBS 1179 if test -d ${with_sasl}; then 1180 ac_cv_sasl_where_lib=${with_sasl}/$CMU_LIB_SUBDIR 1181 ac_cv_sasl_where_inc=${with_sasl}/include 1182 1183 SASLFLAGS="-I$ac_cv_sasl_where_inc" 1184 LIB_SASL="-L$ac_cv_sasl_where_lib" 1185 CPPFLAGS="${cmu_saved_CPPFLAGS} -I${ac_cv_sasl_where_inc}" 1186 LDFLAGS="${cmu_saved_LDFLAGS} -L${ac_cv_sasl_where_lib}" 1187 fi 1188 1189 AC_CHECK_HEADER(sasl.h, 1190 AC_CHECK_LIB(sasl, sasl_getprop, 1191 ac_cv_found_sasl=yes, 1192 ac_cv_found_sasl=no), ac_cv_found_sasl=no) 1193 1194 LIBS="$cmu_saved_LIBS" 1195 LDFLAGS="$cmu_saved_LDFLAGS" 1196 CPPFLAGS="$cmu_saved_CPPFLAGS" 1197 if test "$ac_cv_found_sasl" = yes; then 1198 LIB_SASL="$LIB_SASL -lsasl" 1199 else 1200 AC_ERROR( sasl not found ) 1201 LIB_SASL="" 1202 SASLFLAGS="" 1203 fi 1204 AC_SUBST(LIB_SASL) 1205 AC_SUBST(SASLFLAGS) 1206fi 1207]) 1208 1209AC_DEFUN([CMU_SASL_REQUIRED], 1210[AC_REQUIRE([CMU_SASL]) 1211if test "$ac_cv_found_sasl" != "yes"; then 1212 AC_ERROR([Cannot continue without libsasl. 1213Get it from ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/.]) 1214fi]) 1215 1216 1217# sasl2.m4--sasl2 libraries and includes 1218# Rob Siemborski 1219 1220# SASL2_CRYPT_CHK 1221# --------------- 1222AC_DEFUN([SASL_GSSAPI_CHK], 1223[AC_REQUIRE([SASL2_CRYPT_CHK]) 1224AC_REQUIRE([CMU_SOCKETS]) 1225AC_ARG_ENABLE([gssapi], 1226 [AC_HELP_STRING([--enable-gssapi=<DIR>], 1227 [enable GSSAPI authentication [yes]])], 1228 [gssapi=$enableval], 1229 [gssapi=yes]) 1230AC_ARG_WITH([gss_impl], 1231 [AC_HELP_STRING([--with-gss_impl={heimdal|mit|cybersafe|seam|auto}], 1232 [choose specific GSSAPI implementation [[auto]]])], 1233 [gss_impl=$withval], 1234 [gss_impl=auto]) 1235 1236if test "$gssapi" != no; then 1237 platform= 1238 case "${host}" in 1239 *-*-linux*) 1240 platform=__linux 1241 ;; 1242 *-*-hpux*) 1243 platform=__hpux 1244 ;; 1245 *-*-irix*) 1246 platform=__irix 1247 ;; 1248 *-*-solaris2*) 1249# When should we use __sunos? 1250 platform=__solaris 1251 ;; 1252 *-*-aix*) 1253###_AIX 1254 platform=__aix 1255 ;; 1256 *) 1257 if test "$gss_impl" = "cybersafe"; then 1258 AC_ERROR([CyberSafe was forced, cannot continue as platform is not supported]) 1259 fi 1260 ;; 1261 esac 1262 1263 cmu_saved_CPPFLAGS=$CPPFLAGS 1264 1265 if test -d ${gssapi}; then 1266 CPPFLAGS="$CPPFLAGS -I$gssapi/include" 1267# We want to keep -I in our CPPFLAGS, but only if we succeed 1268 cmu_saved_CPPFLAGS=$CPPFLAGS 1269### I am not sure how useful is this (and whether this is required at all 1270### especially when we have to provide two -L flags for new CyberSafe 1271 LDFLAGS="$LDFLAGS -L$gssapi/lib" 1272 1273 if test -n "$platform"; then 1274 if test "$gss_impl" = "auto" -o "$gss_impl" = "cybersafe"; then 1275 CPPFLAGS="$CPPFLAGS -D$platform" 1276 if test -d "${gssapi}/appsec-sdk/include"; then 1277 CPPFLAGS="$CPPFLAGS -I${gssapi}/appsec-sdk/include" 1278 fi 1279 fi 1280 fi 1281 fi 1282 AC_CHECK_HEADER([gssapi.h], 1283 [AC_DEFINE(HAVE_GSSAPI_H,, 1284 [Define if you have the gssapi.h header file])], 1285 [AC_CHECK_HEADER([gssapi/gssapi.h],, 1286 [AC_WARN([Disabling GSSAPI - no include files found]); gssapi=no])]) 1287 1288 CPPFLAGS=$cmu_saved_CPPFLAGS 1289 1290fi 1291 1292if test "$gssapi" != no; then 1293 # We need to find out which gssapi implementation we are 1294 # using. Supported alternatives are: MIT Kerberos 5, 1295 # Heimdal Kerberos 5 (http://www.pdc.kth.se/heimdal), 1296 # CyberSafe Kerberos 5 (http://www.cybersafe.com/) 1297 # and Sun SEAM (http://wwws.sun.com/software/security/kerberos/) 1298 # 1299 # The choice is reflected in GSSAPIBASE_LIBS 1300 1301 AC_CHECK_LIB(resolv,res_search) 1302 if test -d ${gssapi}; then 1303 gssapi_dir="${gssapi}/lib" 1304 GSSAPIBASE_LIBS="-L$gssapi_dir" 1305 GSSAPIBASE_STATIC_LIBS="-L$gssapi_dir" 1306 else 1307 # FIXME: This is only used for building cyrus, and then only as 1308 # a real hack. it needs to be fixed. 1309 gssapi_dir="/usr/local/lib" 1310 fi 1311 1312 # Check a full link against the Heimdal libraries. 1313 # If this fails, check a full link against the MIT libraries. 1314 # If this fails, check a full link against the CyberSafe libraries. 1315 # If this fails, check a full link against the Solaris 8 and up libgss. 1316 1317 if test "$gss_impl" = "auto" -o "$gss_impl" = "heimdal"; then 1318 gss_failed=0 1319 AC_CHECK_LIB(gssapi,gss_unwrap,gss_impl="heimdal",gss_failed=1, 1320 ${GSSAPIBASE_LIBS} -lgssapi -lkrb5 -lasn1 -lroken ${LIB_CRYPT} ${LIB_DES} -lcom_err ${LIB_SOCKET}) 1321 if test "$gss_impl" != "auto" -a "$gss_failed" = "1"; then 1322 gss_impl="failed" 1323 fi 1324 fi 1325 1326 if test "$gss_impl" = "auto" -o "$gss_impl" = "mit"; then 1327 # check for libkrb5support first 1328 AC_CHECK_LIB(krb5support,krb5int_getspecific,K5SUP=-lkrb5support K5SUPSTATIC=$gssapi_dir/libkrb5support.a,,${LIB_SOCKET}) 1329 1330 gss_failed=0 1331 AC_CHECK_LIB(gssapi_krb5,gss_unwrap,gss_impl="mit",gss_failed=1, 1332 ${GSSAPIBASE_LIBS} -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err ${K5SUP} ${LIB_SOCKET}) 1333 if test "$gss_impl" != "auto" -a "$gss_failed" = "1"; then 1334 gss_impl="failed" 1335 fi 1336 fi 1337 1338 # For Cybersafe one has to set a platform define in order to make compilation work 1339 if test "$gss_impl" = "auto" -o "$gss_impl" = "cybersafe"; then 1340 1341 cmu_saved_CPPFLAGS=$CPPFLAGS 1342 cmu_saved_GSSAPIBASE_LIBS=$GSSAPIBASE_LIBS 1343# FIXME - Note that the libraries are in .../lib64 for 64bit kernels 1344 if test -d "${gssapi}/appsec-rt/lib"; then 1345 GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -L${gssapi}/appsec-rt/lib" 1346 fi 1347 CPPFLAGS="$CPPFLAGS -D$platform" 1348 if test -d "${gssapi}/appsec-sdk/include"; then 1349 CPPFLAGS="$CPPFLAGS -I${gssapi}/appsec-sdk/include" 1350 fi 1351 1352 gss_failed=0 1353 1354# Check for CyberSafe with two libraries first, than fall back to a single 1355# library (older CyberSafe) 1356 1357 unset ac_cv_lib_gss_csf_gss_acq_user 1358 AC_CHECK_LIB(gss,csf_gss_acq_user,gss_impl="cybersafe03", 1359 [unset ac_cv_lib_gss_csf_gss_acq_user; 1360 AC_CHECK_LIB(gss,csf_gss_acq_user,gss_impl="cybersafe", 1361 gss_failed=1,$GSSAPIBASE_LIBS -lgss)], 1362 [${GSSAPIBASE_LIBS} -lgss -lcstbk5]) 1363 1364 if test "$gss_failed" = "1"; then 1365# Restore variables 1366 GSSAPIBASE_LIBS=$cmu_saved_GSSAPIBASE_LIBS 1367 CPPFLAGS=$cmu_saved_CPPFLAGS 1368 1369 if test "$gss_impl" != "auto"; then 1370 gss_impl="failed" 1371 fi 1372 fi 1373 fi 1374 1375 if test "$gss_impl" = "auto" -o "$gss_impl" = "seam"; then 1376 gss_failed=0 1377 AC_CHECK_LIB(gss,gss_unwrap,gss_impl="seam",gss_failed=1,-lgss) 1378 if test "$gss_impl" != "auto" -a "$gss_failed" = "1"; then 1379 gss_impl="failed" 1380 fi 1381 fi 1382 1383 if test "$gss_impl" = "mit"; then 1384 GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err ${K5SUP}" 1385 GSSAPIBASE_STATIC_LIBS="$GSSAPIBASE_LIBS $gssapi_dir/libgssapi_krb5.a $gssapi_dir/libkrb5.a $gssapi_dir/libk5crypto.a $gssapi_dir/libcom_err.a ${K5SUPSTATIC}" 1386 elif test "$gss_impl" = "heimdal"; then 1387 CPPFLAGS="$CPPFLAGS -DKRB5_HEIMDAL" 1388 GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgssapi -lkrb5 -lasn1 -lroken ${LIB_CRYPT} ${LIB_DES} -lcom_err" 1389 GSSAPIBASE_STATIC_LIBS="$GSSAPIBASE_STATIC_LIBS $gssapi_dir/libgssapi.a $gssapi_dir/libkrb5.a $gssapi_dir/libasn1.a $gssapi_dir/libroken.a $gssapi_dir/libcom_err.a ${LIB_CRYPT}" 1390 elif test "$gss_impl" = "cybersafe03"; then 1391# Version of CyberSafe with two libraries 1392 CPPFLAGS="$CPPFLAGS -D$platform -I${gssapi}/appsec-sdk/include" 1393 GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgss -lcstbk5" 1394 # there is no static libgss for CyberSafe 1395 GSSAPIBASE_STATIC_LIBS=none 1396 elif test "$gss_impl" = "cybersafe"; then 1397 CPPFLAGS="$CPPFLAGS -D$platform -I${gssapi}/appsec-sdk/include" 1398 GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgss" 1399 # there is no static libgss for CyberSafe 1400 GSSAPIBASE_STATIC_LIBS=none 1401 elif test "$gss_impl" = "seam"; then 1402 GSSAPIBASE_LIBS=-lgss 1403 # there is no static libgss on Solaris 8 and up 1404 GSSAPIBASE_STATIC_LIBS=none 1405 elif test "$gss_impl" = "failed"; then 1406 gssapi="no" 1407 GSSAPIBASE_LIBS= 1408 GSSAPIBASE_STATIC_LIBS= 1409 AC_WARN([Disabling GSSAPI - specified library not found]) 1410 else 1411 gssapi="no" 1412 GSSAPIBASE_LIBS= 1413 GSSAPIBASE_STATIC_LIBS= 1414 AC_WARN([Disabling GSSAPI - no library]) 1415 fi 1416fi 1417 1418# 1419# Cybersafe defines both GSS_C_NT_HOSTBASED_SERVICE and GSS_C_NT_USER_NAME 1420# in gssapi\rfckrb5.h 1421# 1422if test "$gssapi" != "no"; then 1423 if test "$gss_impl" = "cybersafe" -o "$gss_impl" = "cybersafe03"; then 1424 AC_EGREP_CPP(hostbased_service_gss_nt_yes, 1425 [#include <gssapi/gssapi.h> 1426 #ifdef GSS_C_NT_HOSTBASED_SERVICE 1427 hostbased_service_gss_nt_yes 1428 #endif], 1429 [AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE,, 1430 [Define if your GSSAPI implimentation defines GSS_C_NT_HOSTBASED_SERVICE])], 1431 [AC_WARN([Cybersafe define not found])]) 1432 1433 elif test "$ac_cv_header_gssapi_h" = "yes"; then 1434 AC_EGREP_HEADER(GSS_C_NT_HOSTBASED_SERVICE, gssapi.h, 1435 [AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE,, 1436 [Define if your GSSAPI implimentation defines GSS_C_NT_HOSTBASED_SERVICE])]) 1437 elif test "$ac_cv_header_gssapi_gssapi_h"; then 1438 AC_EGREP_HEADER(GSS_C_NT_HOSTBASED_SERVICE, gssapi/gssapi.h, 1439 [AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE,, 1440 [Define if your GSSAPI implimentation defines GSS_C_NT_HOSTBASED_SERVICE])]) 1441 fi 1442 1443 if test "$gss_impl" = "cybersafe" -o "$gss_impl" = "cybersafe03"; then 1444 AC_EGREP_CPP(user_name_yes_gss_nt, 1445 [#include <gssapi/gssapi.h> 1446 #ifdef GSS_C_NT_USER_NAME 1447 user_name_yes_gss_nt 1448 #endif], 1449 [AC_DEFINE(HAVE_GSS_C_NT_USER_NAME,, 1450 [Define if your GSSAPI implimentation defines GSS_C_NT_USER_NAME])], 1451 [AC_WARN([Cybersafe define not found])]) 1452 elif test "$ac_cv_header_gssapi_h" = "yes"; then 1453 AC_EGREP_HEADER(GSS_C_NT_USER_NAME, gssapi.h, 1454 [AC_DEFINE(HAVE_GSS_C_NT_USER_NAME,, 1455 [Define if your GSSAPI implimentation defines GSS_C_NT_USER_NAME])]) 1456 elif test "$ac_cv_header_gssapi_gssapi_h"; then 1457 AC_EGREP_HEADER(GSS_C_NT_USER_NAME, gssapi/gssapi.h, 1458 [AC_DEFINE(HAVE_GSS_C_NT_USER_NAME,, 1459 [Define if your GSSAPI implimentation defines GSS_C_NT_USER_NAME])]) 1460 fi 1461fi 1462 1463GSSAPI_LIBS="" 1464AC_MSG_CHECKING([GSSAPI]) 1465if test "$gssapi" != no; then 1466 AC_MSG_RESULT([with implementation ${gss_impl}]) 1467 AC_CHECK_LIB(resolv,res_search,GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lresolv") 1468 SASL_MECHS="$SASL_MECHS libgssapiv2.la" 1469 SASL_STATIC_OBJS="$SASL_STATIC_OBJS gssapi.o" 1470 SASL_STATIC_SRCS="$SASL_STATIC_SRCS ../plugins/gssapi.c" 1471 1472 cmu_save_LIBS="$LIBS" 1473 LIBS="$LIBS $GSSAPIBASE_LIBS" 1474 AC_CHECK_FUNCS(gsskrb5_register_acceptor_identity) 1475 LIBS="$cmu_save_LIBS" 1476else 1477 AC_MSG_RESULT([disabled]) 1478fi 1479AC_SUBST(GSSAPI_LIBS) 1480AC_SUBST(GSSAPIBASE_LIBS) 1481])# SASL_GSSAPI_CHK 1482 1483 1484# SASL_SET_GSSAPI_LIBS 1485# -------------------- 1486AC_DEFUN([SASL_SET_GSSAPI_LIBS], 1487[SASL_GSSAPI_LIBS_SET="yes" 1488]) 1489 1490 1491# CMU_SASL2 1492# --------- 1493# What we want to do here is setup LIB_SASL with what one would 1494# generally want to have (e.g. if static is requested, make it that, 1495# otherwise make it dynamic. 1496# 1497# We also want to create LIB_DYN_SASL and DYNSASLFLAGS. 1498# 1499# Also sets using_static_sasl to "no" "static" or "staticonly" 1500# 1501# $1 (incls appended) 1502# 1503# 1504AC_DEFUN([CMU_SASL2], 1505[ 1506 AC_ARG_WITH(sasl, 1507 [AC_HELP_STRING([--with-sasl=DIR],[Compile with libsasl2 in <DIR>])], 1508 with_sasl="$withval", 1509 with_sasl="no") 1510 1511 AC_ARG_WITH(staticsasl, 1512 [AC_HELP_STRING([--with-staticsasl=DIR], 1513 [Compile with staticly linked libsasl in <DIR>])], 1514 [with_staticsasl="$withval"; 1515 if test $with_staticsasl != "no"; then 1516 using_static_sasl="static" 1517 fi], 1518 [with_staticsasl="no"; using_static_sasl="no"]) 1519 1520 if test ${with_staticsasl} != "no" || 1521 test ${with_sasl} != "no"; then 1522 1523 SASLFLAGS="" 1524 LIB_SASL="" 1525 1526 cmu_saved_CPPFLAGS=$CPPFLAGS 1527 cmu_saved_LDFLAGS=$LDFLAGS 1528 cmu_saved_LIBS=$LIBS 1529 1530 if test ${with_staticsasl} != "no"; then 1531 if test -d ${with_staticsasl}; then 1532 if test -d ${with_staticsasl}/lib64 ; then 1533 ac_cv_sasl_where_lib=${with_staticsasl}/lib64 1534 else 1535 ac_cv_sasl_where_lib=${with_staticsasl}/lib 1536 fi 1537 ac_cv_sasl_where_lib=${with_staticsasl}/lib 1538 ac_cv_sasl_where_inc=${with_staticsasl}/include 1539 1540 SASLFLAGS="-I$ac_cv_sasl_where_inc" 1541 LIB_SASL="-L$ac_cv_sasl_where_lib" 1542 CPPFLAGS="${cmu_saved_CPPFLAGS} -I${ac_cv_sasl_where_inc}" 1543 LDFLAGS="${cmu_saved_LDFLAGS} -L${ac_cv_sasl_where_lib}" 1544 else 1545 with_staticsasl="/usr" 1546 fi 1547 1548 AC_CHECK_HEADER(sasl/sasl.h, 1549 [AC_CHECK_HEADER(sasl/saslutil.h, 1550 [for i42 in lib64 lib; do 1551 if test -r ${with_staticsasl}/$i42/libsasl2.a; then 1552 ac_cv_found_sasl=yes 1553 AC_MSG_CHECKING([for static libsasl]) 1554 LIB_SASL="$LIB_SASL ${with_staticsasl}/$i42/libsasl2.a" 1555 fi 1556 done 1557 if test ! "$ac_cv_found_sasl" = "yes"; then 1558 AC_MSG_CHECKING([for static libsasl]) 1559 AC_ERROR([Could not find ${with_staticsasl}/lib*/libsasl2.a]) 1560 fi])]) 1561 1562 if test "$ac_cv_found_sasl" = "yes"; then 1563 AC_MSG_RESULT([found]) 1564 else 1565 AC_ERROR([Could not find ${with_staticsasl}/lib*/libsasl2.a]) 1566 fi 1567 fi 1568 1569 if test -d ${with_sasl}; then 1570 ac_cv_sasl_where_lib=${with_sasl}/lib 1571 ac_cv_sasl_where_inc=${with_sasl}/include 1572 1573 DYNSASLFLAGS="-I$ac_cv_sasl_where_inc" 1574 CPPFLAGS="${cmu_saved_CPPFLAGS} -I${ac_cv_sasl_where_inc}" 1575 LDFLAGS="${cmu_saved_LDFLAGS} -L${ac_cv_sasl_where_lib}" 1576 LIBS="-L$ac_cv_sasl_where_lib" 1577 fi 1578 1579# be sure to check for a SASLv2 specific function 1580 AC_CHECK_HEADER(sasl/sasl.h, 1581 [AC_CHECK_HEADER(sasl/saslutil.h, 1582 [AC_CHECK_LIB(sasl2, prop_get, 1583 ac_cv_found_sasl=yes, 1584 ac_cv_found_sasl=no)], 1585 ac_cv_found_sasl=no)], ac_cv_found_sasl=no) 1586 1587 if test ${with_sasl} != "no"; then 1588 if test "$ac_cv_found_sasl" = "yes"; then 1589 if test "$ac_cv_sasl_where_lib" != ""; then 1590 DYNLIB_SASL="-L$ac_cv_sasl_where_lib" 1591 fi 1592 DYNLIB_SASL="$DYNLIB_SASL -lsasl2" 1593 if test "$using_static_sasl" != "static"; then 1594 LIB_SASL=$DYNLIB_SASL 1595 SASLFLAGS=$DYNSASLFLAGS 1596 fi 1597 1598 CMU_SASL2_REQUIRE_VER(2,1,7) 1599 1600 if test "$ac_cv_sasl_where_inc" != ""; then 1601 $1="-I$ac_cv_sasl_where_inc $$1" 1602 fi 1603 AC_DEFINE([ARGUS_SASL], [], [Description]) 1604 AC_SUBST(LIB_SASL) 1605 AC_SUBST(SASLFLAGS) 1606 else 1607 AC_ERROR([Could not find sasl2]) 1608 fi 1609 fi 1610 1611 LIBS="$cmu_saved_LIBS" 1612 LDFLAGS="$cmu_saved_LDFLAGS" 1613 CPPFLAGS="$cmu_saved_CPPFLAGS" 1614 fi 1615])# CMU_SASL2 1616 1617 1618# CMU_SASL2_REQUIRE_VER 1619# --------------------- 1620AC_DEFUN([CMU_SASL2_REQUIRE_VER], 1621[ 1622 1623cmu_saved_CPPFLAGS=$CPPFLAGS 1624CPPFLAGS="$CPPFLAGS $SASLFLAGS" 1625 1626AC_TRY_CPP([ 1627#include <sasl/sasl.h> 1628 1629#ifndef SASL_VERSION_MAJOR 1630#error SASL_VERSION_MAJOR not defined 1631#endif 1632#ifndef SASL_VERSION_MINOR 1633#error SASL_VERSION_MINOR not defined 1634#endif 1635#ifndef SASL_VERSION_STEP 1636#error SASL_VERSION_STEP not defined 1637#endif 1638 1639#if SASL_VERSION_MAJOR < $1 || SASL_VERSION_MINOR < $2 || SASL_VERSION_STEP < $3 1640#error SASL version is less than $1.$2.$3 1641#endif 1642],, 1643 [AC_ERROR([Incorrect SASL headers found. This package requires SASL $1.$2.$3 or newer.])]) 1644 1645CPPFLAGS=$cmu_saved_CPPFLAGS 1646])# CMU_SASL2_REQUIRE_VER 1647 1648 1649dnl 1650dnl Additional macros for configure.in packaged up for easier theft. 1651dnl tjs@andrew.cmu.edu 6-may-1998 1652dnl 1653 1654dnl It would be good if ANDREW_ADD_LIBPATH could detect if something was 1655dnl already there and not redundantly add it if it is. 1656 1657dnl add -L(arg), and possibly (runpath switch)(arg), to LDFLAGS 1658dnl (so the runpath for shared libraries is set). 1659AC_DEFUN([CMU_ADD_LIBPATH], [ 1660 # this is CMU ADD LIBPATH 1661 if test "$andrew_runpath_switch" = "none" ; then 1662 LDFLAGS="-L$1 ${LDFLAGS}" 1663 else 1664 LDFLAGS="-L$1 $andrew_runpath_switch$1 ${LDFLAGS}" 1665 fi 1666]) 1667 1668dnl add -L(1st arg), and possibly (runpath switch)(1st arg), to (2nd arg) 1669dnl (so the runpath for shared libraries is set). 1670AC_DEFUN([CMU_ADD_LIBPATH_TO], [ 1671 # this is CMU ADD LIBPATH TO 1672 if test "$andrew_runpath_switch" = "none" ; then 1673 $2="-L$1 ${$2}" 1674 else 1675 $2="-L$1 ${$2} $andrew_runpath_switch$1" 1676 fi 1677]) 1678 1679dnl runpath initialization 1680AC_DEFUN([CMU_GUESS_RUNPATH_SWITCH], [ 1681 # CMU GUESS RUNPATH SWITCH 1682 AC_CACHE_CHECK(for runpath switch, andrew_runpath_switch, [ 1683 # first, try -R 1684 SAVE_LDFLAGS="${LDFLAGS}" 1685 LDFLAGS="-R /usr/lib" 1686 AC_TRY_LINK([],[],[andrew_runpath_switch="-R"], [ 1687 LDFLAGS="-Wl,-rpath,/usr/lib" 1688 AC_TRY_LINK([],[],[andrew_runpath_switch="-Wl,-rpath,"], 1689 [andrew_runpath_switch="none"]) 1690 ]) 1691 LDFLAGS="${SAVE_LDFLAGS}" 1692 ])]) 1693 1694AC_DEFUN([SASL2_CRYPT_CHK],[ 1695 AC_CHECK_FUNC(crypt, cmu_have_crypt=yes, [ 1696 AC_CHECK_LIB(crypt, crypt, 1697 LIB_CRYPT="-lcrypt"; cmu_have_crypt=yes, 1698 cmu_have_crypt=no)]) 1699 AC_SUBST(LIB_CRYPT) 1700]) 1701 1702dnl bsd_sockets.m4--which socket libraries do we need? 1703dnl Derrick Brashear 1704dnl from Zephyr 1705 1706dnl Hacked on by Rob Earhart to not just toss stuff in LIBS 1707dnl It now puts everything required for sockets into LIB_SOCKET 1708 1709AC_DEFUN([CMU_SOCKETS], [ 1710 save_LIBS="$LIBS" 1711 LIB_SOCKET="" 1712 AC_CHECK_FUNC(connect, :, 1713 AC_CHECK_LIB(nsl, gethostbyname, 1714 LIB_SOCKET="-lnsl $LIB_SOCKET") 1715 AC_CHECK_LIB(socket, connect, 1716 LIB_SOCKET="-lsocket $LIB_SOCKET") 1717 ) 1718 LIBS="$LIB_SOCKET $save_LIBS" 1719 AC_CHECK_FUNC(res_search, :, 1720 AC_CHECK_LIB(resolv, res_search, 1721 LIB_SOCKET="-lresolv $LIB_SOCKET") 1722 ) 1723 LIBS="$LIB_SOCKET $save_LIBS" 1724 AC_CHECK_FUNCS(dn_expand dns_lookup) 1725 LIBS="$save_LIBS" 1726 AC_SUBST(LIB_SOCKET) 1727 ]) 1728 1729dnl 1730dnl Look for Perl distribution and executable. 1731dnl 1732dnl usage: 1733dnl 1734dnl AC_QOSIENT_PERL(perldep) 1735dnl 1736dnl results: 1737dnl 1738dnl $1 (geoipdep set) 1739dnl 1740 1741AC_DEFUN([AC_QOSIENT_PERL], [ 1742 AC_ARG_WITH(perl, 1743 [AC_HELP_STRING([--with-perl=DIR],[Use perl in <DIR>])], 1744 with_perl="$withval", 1745 with_perl="yes") 1746 1747 perl=FAIL 1748 1749 if ! test ${with_perl} = "no"; then 1750 if test ${with_perl} = "yes"; then 1751 AC_MSG_CHECKING(for standard perl installation) 1752 for dir in /usr /usr/local /opt /opt/local; do 1753 if test -r $dir/bin/perl ; then 1754 perl=$dir/bin/perl 1755 AC_MSG_RESULT($perl) 1756 $1="$perl" 1757 break; 1758 else 1759 AC_MSG_RESULT(no) 1760 fi 1761 done 1762 else 1763 AC_MSG_CHECKING(for perl installation in ${with_perl}) 1764 if test -r ${with_perl}/perl ; then 1765 perl=${with_perl}/perl 1766 AC_MSG_RESULT($perl) 1767 $1="$perl" 1768 else 1769 AC_MSG_RESULT(no) 1770 fi 1771 fi 1772 fi 1773]) 1774