1AC_DEFUN(wi_ARG_ENABLE_DEBUG, [ 2# if DEBUGBUILD is yes, other macros try to set up a compilation environment 3# with debugging symbols enabled. Example macros which are affected are 4# wi_CFLAGS and wi_SFLAG. 5# 6DEBUGBUILD=no 7DEBUGCONFIGUREFLAG="" 8AC_ARG_ENABLE(debug, 9[ --enable-debug enable debugging symbols], 10[ 11 DEBUGBUILD=yes 12 DEBUGCONFIGUREFLAG="--enable-debug" 13],[ 14 DEBUGBUILD=no 15 DEBUGCONFIGUREFLAG="" 16]) 17]) 18dnl 19dnl 20dnl 21dnl 22AC_DEFUN(wi_EXTRA_IDIR, [ 23incdir="$1" 24if test -r $incdir ; then 25 case "$CPPFLAGS" in 26 *${incdir}*) 27 # echo " + already had $incdir" 1>&6 28 ;; 29 *) 30 if test "$CPPFLAGS" = "" ; then 31 CPPFLAGS="-I$incdir" 32 else 33 CPPFLAGS="$CPPFLAGS -I$incdir" 34 fi 35 echo " + found $incdir" 1>&6 36 ;; 37 esac 38fi 39]) 40dnl 41dnl 42dnl 43dnl 44AC_DEFUN(wi_PROG_TAR, [ 45TAR="" 46AC_PATH_PROG(TAR, "tar") 47if test -x "$TAR" ; then 48 AC_DEFINE_UNQUOTED(TAR, "$TAR") 49fi 50]) 51dnl 52dnl 53dnl 54dnl 55AC_DEFUN(wi_EXTRA_LDIR, [ 56libdir="$1" 57if test -r $libdir ; then 58 case "$LDFLAGS" in 59 *${libdir}*) 60 # echo " + already had $libdir" 1>&6 61 ;; 62 *) 63 if test "$LDFLAGS" = "" ; then 64 LDFLAGS="-L$libdir" 65 else 66 LDFLAGS="$LDFLAGS -L$libdir" 67 fi 68 echo " + found $libdir" 1>&6 69 ;; 70 esac 71fi 72]) 73dnl 74dnl 75dnl 76dnl 77AC_DEFUN(wi_GNU_LD, [ 78AC_MSG_CHECKING([for GNU ld]) 79wi_cv_prog_ld="ld" 80result="no" 81x=`ld --version 2>/dev/null | fgrep GNU` 82if test "$x" != "" ; then 83 wi_cv_prog_ld="gld" 84 result="yes" 85fi 86AC_MSG_RESULT($result) 87]) 88dnl 89dnl 90dnl 91dnl 92AC_DEFUN(wi_LD_READONLY_TEXT, [ 93if test "$SYS$wi_cv_prog_ld" = "linuxgld" ; then 94 LDFLAGS="$LDFLAGS -Xlinker -n" 95fi 96]) 97dnl 98dnl 99dnl 100dnl 101AC_DEFUN(wi_EXTRA_SYSV_SUNOS_DIRS, [ 102AC_MSG_CHECKING([for System V compatibility directories]) 103AC_MSG_RESULT([]) 104wi_EXTRA_IDIR("/usr/5include") 105wi_EXTRA_LDIR("/usr/5lib") 106]) 107dnl 108dnl 109dnl If you want to also look for include and lib subdirectories in the 110dnl $HOME tree, you supply "yes" as the first argument to this macro. 111dnl 112dnl If you want to look for subdirectories in include/lib directories, 113dnl you pass the names in argument 3, otherwise pass a dash. 114dnl 115AC_DEFUN(wi_EXTRA_DIRS, [ 116AC_MSG_CHECKING([for extra include and lib directories]) 117AC_MSG_RESULT([]) 118ifelse([$1], yes, [dnl 119b1=`cd .. ; pwd` 120b2=`cd ../.. ; pwd` 121exdirs="$HOME $j $b1 $b2 $prefix $2" 122if test -x "$HOME/bin/OS" ; then 123 b3=`$HOME/bin/OS` 124 b3="$HOME/$b3" 125 if test -d "$b3" ; then 126 exdirs="$b3 $exdirs" 127 fi 128fi 129],[dnl 130exdirs="$prefix $2" 131]) 132subexdirs="$3" 133if test "$subexdirs" = "" ; then 134 subexdirs="-" 135fi 136for subexdir in $subexdirs ; do 137if test "$subexdir" = "-" ; then 138 subexdir="" 139else 140 subexdir="/$subexdir" 141fi 142for exdir in $exdirs ; do 143 case "$exdir" in 144 "/usr"|"/"|"//") 145 if test "$exdir" = "//" ; then exdir="/" ; fi 146 if test "$subexdir" != ""; then 147 incdir="${exdir}/include${subexdir}" 148 wi_EXTRA_IDIR($incdir) 149 150 libdir="${exdir}/lib${subexdir}" 151 wi_EXTRA_LDIR($libdir) 152 fi 153 ;; 154 *) 155 if test "$subexdir" = ""; then 156 incdir="${exdir}/include${subexdir}" 157 wi_EXTRA_IDIR($incdir) 158 159 libdir="${exdir}/lib${subexdir}" 160 wi_EXTRA_LDIR($libdir) 161 fi 162 ;; 163 esac 164done 165done 166]) 167dnl 168dnl 169dnl 170AC_DEFUN(wi_HPUX_CFLAGS, 171[AC_MSG_CHECKING(if HP-UX ansi C compiler flags are needed) 172AC_REQUIRE([AC_PROG_CC]) 173AC_REQUIRE([wi_OS_VAR]) 174ac_cv_hpux_flags=no 175if test "$os" = hp-ux ; then 176 if test "$ac_cv_prog_gcc" = yes ; then 177 if test "$CFLAGS" != "" ; then 178 # Shouldn't be in there. 179changequote(<<, >>)dnl 180 CFLAGS=`echo "$CFLAGS" | sed 's/-A[ae]//g'` 181changequote([, ])dnl 182 case "$CFLAGS" in 183 *_HPUX_SOURCE*) 184 ;; 185 *) 186 # This is required for the extended 187 # namespace. 188 # 189 CFLAGS="-D_HPUX_SOURCE $CFLAGS" 190 ;; 191 esac 192 fi 193 else 194 # If you're not using gcc, then you better have a cc/c89 195 # that is usable. If you have the barebones compiler, it 196 # won't work. The good compiler uses -Aa for the ANSI 197 # compatible stuff. 198changequote(<<, >>)dnl 199 x=`echo "$CFLAGS" | grep 'A[ae]' 2>/dev/null` 200changequote([, ])dnl 201 if test "$x" = "" ; then 202 CFLAGS="$CFLAGS -Ae" 203 fi 204 fi 205 ac_cv_hpux_flags=yes 206fi 207AC_MSG_RESULT($ac_cv_hpux_flags) 208]) 209dnl 210dnl 211dnl 212AC_DEFUN(wi_SFLAG, [AC_REQUIRE([AC_PROG_CC]) 213STRIP="strip" 214if test "$SFLAG" = "" ; then 215 SFLAG="-s" 216 case "$OS" in 217 macosx*) 218 SFLAG='-Wl,-x' 219 ;; 220 esac 221fi 222# 223# Was it ./configure --enable-debug ? 224# 225if test "$DEBUGBUILD" = yes ; then 226 SFLAG="" 227 STRIP=":" 228fi 229case "$CFLAGS" in 230 "-g"|"-g "*|*" -g"|*" -g "*|*"-g"[0-9]*) 231 # SFLAG="# $SFLAG" 232 SFLAG="" 233 STRIP=":" 234 ;; 235esac 236STRIPFLAG="$SFLAG" 237]) 238dnl 239dnl 240dnl 241AC_DEFUN(wi_REQUEST_NO_Y2K_WARNINGS, [ 242 wi_cv_request_no_y2k=yes 243]) 244dnl 245dnl 246dnl 247AC_DEFUN(wi_CFLAGS_NO_Y2K_WARNINGS, [AC_REQUIRE([AC_PROG_CC]) 248if test "$ac_cv_prog_gcc" = yes ; then 249 case "$CFLAGS" in 250 *-Wno-format-y2k*) 251 ;; 252 *) 253 oldCFLAGS="$CFLAGS" 254 CFLAGS="$CFLAGS -Wno-format-y2k" 255 # 256 # Now check if this version of GCC 257 # accepts this flag... 258 # 259AC_TRY_COMPILE([],[int junk;],[],[CFLAGS="$oldCFLAGS"]) 260 unset oldCFLAGS 261 ;; 262 esac 263fi 264]) 265dnl 266dnl 267dnl 268AC_DEFUN(wi_CFLAGS, [AC_REQUIRE([AC_PROG_CC]) 269AC_REQUIRE_CPP() 270wi_HPUX_CFLAGS 271 if test "$CFLAGS" = "" ; then 272 AC_MSG_WARN([Your CFLAGS environment variable was not set. A default of \"-g\" will be used.]) 273 CFLAGS="-g" 274 fi 275 if test "x$wi_cv_request_no_y2k" = xyes ; then 276 wi_CFLAGS_NO_Y2K_WARNINGS 277 fi 278 if test "$NOOPTCFLAGS" = "" ; then 279changequote(<<, >>)dnl 280 NOOPTCFLAGS=`echo "$CFLAGS" | sed 's/[-+]O[0-9A-Za-z]*//g;s/-xO[0-9]//g;s/-Wc,-O3//g;s/-IPA//g;s/\ \ */ /g;s/^\ *//;s/\ *$//;'` 281changequote([, ])dnl 282 fi 283 if test "$DEBUGCFLAGS" = "" ; then 284 DEBUGCFLAGS="-g $NOOPTCFLAGS" 285 fi 286 # 287 # Was it ./configure --enable-debug ? 288 # 289 AC_MSG_CHECKING([if this is a debug build]) 290 if test "$DEBUGBUILD" = yes ; then 291 AC_MSG_RESULT(yes) 292 CFLAGS="$DEBUGCFLAGS" 293 SFLAG="" 294 STRIPFLAG="" 295 STRIP=":" 296 else 297 AC_MSG_RESULT(no) 298 fi 299 AC_MSG_CHECKING([NOOPTCFLAGS]) 300 AC_MSG_RESULT($NOOPTCFLAGS) 301 AC_MSG_CHECKING([DEBUGCFLAGS]) 302 AC_MSG_RESULT($DEBUGCFLAGS) 303 AC_MSG_CHECKING([CFLAGS]) 304 AC_MSG_RESULT($CFLAGS) 305]) 306dnl 307dnl 308dnl 309AC_DEFUN(wi_CFLAGS_LFS64, [AC_REQUIRE([AC_PROG_CC]) 310AC_REQUIRE([wi_OS_VAR]) 311wi_CFLAGS 312if test "os_${os}_gcc_${ac_cv_prog_gcc}" = os_hp-ux_gcc_yes ; then 313 case "$CFLAGS" in 314 *__STDC_EXT__*) 315 ;; 316 *) 317 # This is required for the extended 318 # namespace symbols for Large Files. 319 # 320 CFLAGS="-D__STDC_EXT__ $CFLAGS" 321 ;; 322 esac 323fi 324case "$CFLAGS" in 325 *-D_LARGEFILE64_SOURCE*) 326 ;; 327 *) 328 CFLAGS="-D_LARGEFILE64_SOURCE $CFLAGS" 329 ;; 330esac 331AC_MSG_CHECKING([additional CFLAGS for LFS64 support]) 332AC_MSG_RESULT($CFLAGS) 333]) 334dnl 335dnl 336dnl 337AC_DEFUN(wi_PROTOTYPES, [ 338AC_MSG_CHECKING(if the compiler supports function prototypes) 339AC_TRY_COMPILE(,[extern void exit(int status);],[wi_cv_prototypes=yes 340AC_DEFINE(PROTOTYPES)],wi_cv_prototypes=no) 341AC_MSG_RESULT($wi_cv_prototypes) 342]) 343dnl 344dnl 345dnl 346AC_DEFUN(wi_INSECURE_CHOWN, [ 347AC_MSG_CHECKING(if chown can be used to subvert security) 348AC_TRY_RUN([ 349#include <sys/types.h> 350#include <sys/stat.h> 351#include <stdio.h> 352 353main() 354{ 355 int result; 356 char fn[64]; 357 FILE *fp; 358 struct stat st; 359 360 setuid(1); /* if you're root, try set to someone else. */ 361 sprintf(fn, "/tmp/fu%06ld", (long) getpid()); 362 unlink(fn); 363 fp = fopen(fn, "w"); 364 if (fp == NULL) 365 exit(1); /* assume the worst */ 366 fprintf(fp, "%s\n", "hello world"); 367 fclose(fp); 368 369 result = chown(fn, 0, 0); 370 if (stat(fn, &st) < 0) { 371 unlink(fn); 372 exit((result == 0) ? 0 : 1); 373 } 374 unlink(fn); 375 376 /* exit(0) if the insecure chown to uid 0 succeeded. */ 377 exit((st.st_uid == 0) ? 0 : 1); 378}],[ 379 # action if true 380 wi_cv_insecure_chown=yes 381 AC_DEFINE(INSECURE_CHOWN) 382],[ 383 # action if false 384 wi_cv_insecure_chown=no 385],[ 386 # action if cross-compiling, guess 387 wi_cv_insecure_chown=no 388]) 389 390AC_MSG_RESULT($wi_cv_insecure_chown) 391]) 392dnl 393dnl 394dnl 395AC_DEFUN(wi_LIB_SNPRINTF, [ 396if test "$ac_cv_func_snprintf" = "no" ; then 397 AC_CHECK_LIB(snprintf,snprintf) 398 if test "$ac_cv_lib_snprintf_snprintf" = yes ; then 399 unset ac_cv_func_snprintf 400 AC_CHECK_FUNCS(snprintf) 401 fi 402fi 403]) 404dnl 405dnl 406dnl 407AC_DEFUN(wi_SNPRINTF_TERMINATES, [ 408if test "$ac_cv_func_snprintf" != "no" ; then 409AC_MSG_CHECKING(if snprintf always NUL terminates) 410 if test "$ac_cv_func_snprintf" = "no" ; then 411 AC_CHECK_LIB(snprintf,snprintf) 412 fi 413AC_TRY_RUN([ 414 /* program */ 415#include <stdio.h> 416#include <string.h> 417 418main() 419{ 420 char s[10]; 421 int i, result; 422 423 for (i=0; i<(int)(sizeof(s)/sizeof(char)); i++) 424 s[i] = 'x'; 425 result = (int) snprintf(s, sizeof(s), "%s %s!", "hello", "world"); 426 if (s[sizeof(s) - 1] == '\0') 427 exit(0); 428 exit(1); 429 430} 431],[ 432 # action if true 433 wi_cv_snprintf_terminates=no 434 AC_DEFINE(SNPRINTF_TERMINATES) 435 x="yes"; 436],[ 437 # action if false 438 wi_cv_snprintf_terminates=yes 439 x="no"; 440],[ 441 # action if cross compiling 442 wi_cv_snprintf_terminates=no 443 x="unknown"; 444]) 445AC_MSG_RESULT($x) 446fi 447]) 448dnl 449dnl 450dnl 451AC_DEFUN(wi_SNPRINTF, [ 452wi_SPRINTF_RETVAL 453dnl Uncache these -- config.cache doesn't cache it right for this case. 454unset ac_cv_func_snprintf 455unset ac_cv_func_vsnprintf 456 457AC_CHECK_FUNCS(snprintf vsnprintf) 458wi_SNPRINTF_TERMINATES 459 460AC_CHECK_HEADERS(snprintf.h) 461wi_LIB_SNPRINTF 462]) 463dnl 464dnl 465dnl 466AC_DEFUN(wi_HEADER_HPSECURITY_H, [ 467AC_MSG_CHECKING(for hpsecurity.h) 468wi_cv_header_hpsecurity_h=no 469if test -f /usr/include/hpsecurity.h ; then 470 wi_cv_header_hpsecurity_h=yes 471 AC_DEFINE(HAVE_HPSECURITY_H) 472fi 473AC_MSG_RESULT($wi_cv_header_hpsecurity_h) 474]) 475dnl 476dnl 477dnl 478AC_DEFUN(wi_HEADER_SYS_SELECT_H, [ 479# See if <sys/select.h> is includable after <sys/time.h> 480if test "$ac_cv_header_sys_time_h" = no ; then 481AC_CHECK_HEADERS(sys/time.h sys/select.h) 482else 483AC_CHECK_HEADERS(sys/select.h) 484fi 485if test "$ac_cv_header_sys_select_h" = yes ; then 486 AC_MSG_CHECKING([if <sys/select.h> is compatible with <sys/time.h>]) 487 selecth=yes 488 if test "$ac_cv_header_sys_time_h" = yes ; then 489 AC_TRY_COMPILE([ 490#if defined(_AIX) || defined(__aix) || defined(__AIX) 491# define _ALL_SOURCE 1 492#endif 493#ifdef HAVE_UNISTD_H 494# include <unistd.h> 495#endif 496#include <sys/types.h> 497#include <sys/time.h> 498#include <sys/select.h>],[ 499 fd_set a; 500 struct timeval tmval; 501 502 tmval.tv_sec = 0;],selecth=yes,selecth=no) 503 fi 504 if test "$selecth" = yes ; then 505 AC_DEFINE(CAN_USE_SYS_SELECT_H) 506 fi 507 AC_MSG_RESULT($selecth) 508fi 509]) 510dnl 511dnl 512dnl 513AC_DEFUN(wi_LIB_44BSD, [ 514AC_CHECK_FUNC(strerror,[a=yes],[a=no]) 515if test "$a" = no ; then 516 # Not in libc, try lib44bsd. 517 AC_CHECK_LIB(44bsd,strerror) 518fi 519]) 520dnl 521dnl 522dnl 523AC_DEFUN(wi_LIB_NSL, [ 524dnl Note: Check for socket lib first, then nsl. 525 526case "$OS" in 527 hpux1[123456789]*) 528 # HP-UX 11 uses NSL for YP services 529 AC_CHECK_LIB(nsl,getpwent) 530 ;; 531 532 *) 533 AC_CHECK_FUNC(gethostbyname,[a=yes],[a=no]) 534 if test "$a" = no ; then 535 # Not in libc, try libnsl. 536 AC_CHECK_LIB(nsl,gethostbyname) 537 fi 538 ;; 539esac 540 541]) 542dnl 543dnl 544dnl 545AC_DEFUN(wi_LIB_SOCKET, [ 546AC_CHECK_FUNC(socket,[a=yes],[a=no]) 547if test "$a" = no ; then 548 # Not in libc, try libsocket. 549 AC_CHECK_LIB(socket,socket) 550fi 551]) 552dnl 553dnl 554dnl 555AC_DEFUN(wi_LIB_RESOLV, [ 556# See if we could access two well-known sites without help of any special 557# libraries, like resolv. 558dnl 559AC_MSG_WARN([the following check may take several minutes if networking is not up. You may want to bring it up now and restart configure, otherwise please be patient.]) 560dnl 561AC_MSG_CHECKING([if we need to look for -lresolv]) 562AC_TRY_RUN([ 563#include <sys/types.h> 564#include <sys/socket.h> 565#include <netinet/in.h> 566#include <netdb.h> 567 568main() 569{ 570 struct hostent *hp1, *hp2; 571 int result; 572 573 hp1 = gethostbyname("gatekeeper.dec.com"); 574 hp2 = gethostbyname("ftp.ncsa.uiuc.edu"); 575 result = ((hp1 != (struct hostent *) 0) && (hp2 != (struct hostent *) 0)); 576 exit(! result); 577}],look_for_resolv=no,look_for_resolv=yes,look_for_resolv=yes) 578 579AC_MSG_RESULT($look_for_resolv) 580if test "$look_for_resolv" = yes ; then 581AC_CHECK_LIB(resolv,main) 582else 583 ac_cv_lib_resolv=no 584fi 585]) 586dnl 587dnl 588dnl 589AC_DEFUN(wi_LIB_TCP_WRAPPERS, [ 590AC_MSG_CHECKING([for tcp wrappers library (libwrap)]) 591 592AC_TRY_LINK([ 593 /* includes */ 594#ifdef HAVE_UNISTD_H 595# include <unistd.h> 596#endif 597#include <sys/types.h> 598#include <stdio.h> 599 600/* These are needed if libwrap.a was compiled with 601 * PROCESS_OPTIONS defined. 602 */ 603int allow_severity = 1; /* arbitrary for this test */ 604int deny_severity = 2; /* arbitrary for this test */ 605 606],[ 607 /* function-body */ 608 exit((allow_severity == deny_severity) ? 1 : 0); 609],[ 610dnl ...Don't bother defining this symbol... 611dnl ...Check for tcpd.h instead... 612dnl AC_DEFINE(HAVE_LIBWRAP) 613dnl 614dnl ...Don't modify LIBS, instead set WRAPLIB... 615dnl LIBS="-lwrap $LIBS" 616dnl 617 WRAPLIB="-lwrap" 618 wi_cv_lib_wrap_hosts_access=yes 619],[ 620 WRAPLIB="" 621 wi_cv_lib_wrap_hosts_access=no 622]) 623AC_MSG_RESULT($wi_cv_lib_wrap_hosts_access) 624]) 625dnl 626dnl 627dnl 628AC_DEFUN(wi_NET_LIBS, [ 629# Mostly for SunOS 4 -- needs to come first because other libs depend on it 630wi_LIB_44BSD 631 632wi_LIB_SOCKET 633 634if test "$SYS" = unixware ; then 635 # So far, only UnixWare needs this. 636 AC_CHECK_LIB(gen,syslog) 637 638 case "$OS" in 639 unixware2*) 640 if test -f /usr/ucblib/libucb.a ; then 641 LDFLAGS="$LDFLAGS -L/usr/ucblib" 642 LIBS="$LIBS -lucb" 643 fi 644 if test -f /usr/include/unistd.h ; then 645 ac_cv_header_unistd_h=yes 646 fi 647 648 # UnixWare 2 needs both lsocket and lnsl, and configure 649 # script won't detect this condition properly because 650 # the libraries are interdependent. 651 # 652 LIBS="$LIBS -lsocket -lnsl" 653 654 # Now look for socket() 655 # 656 # AC_CHECK_FUNC(socket,[a=yes],[a=no]) 657 # 658 AC_CHECK_FUNC(socket,[a=yes],[a=no]) 659 ;; 660 *) 661 ;; 662 esac 663fi 664 665dnl AC_CHECK_LIB(inet,main) 666 667wi_LIB_NSL 668wi_LIB_RESOLV 669 670if test "$SYS" = dynixptx ; then 671 LIBS="$LIBS -lsocket -lnsl" 672fi 673 674]) 675dnl 676dnl 677dnl 678dnl 679AC_DEFUN(wi_DEFINE_UNAME, [ 680# Get first 127 chars of all uname information. Some folks have 681# way too much stuff there, so grab only the first 127. 682unam=`uname -a 2>/dev/null | cut -c1-127` 683if test "$unam" != "" ; then 684 AC_DEFINE_UNQUOTED(UNAME, "$unam") 685fi 686]) 687dnl 688dnl 689dnl 690AC_DEFUN(wi_FUNC_SIGSETJMP, [ 691AC_MSG_CHECKING([for sigsetjmp and siglongjmp]) 692 693AC_TRY_LINK([ 694 /* includes */ 695#ifdef HAVE_UNISTD_H 696# include <unistd.h> 697#endif 698#include <sys/types.h> 699#include <stdio.h> 700#include <signal.h> 701#include <setjmp.h> 702],[ 703 /* function-body */ 704 sigjmp_buf sjb; 705 706 if (sigsetjmp(sjb, 1) != 0) 707 siglongjmp(sjb, 1); /* bogus code, of course. */ 708 exit(0); 709],[ 710 AC_DEFINE(HAVE_SIGSETJMP) 711 wi_cv_func_sigsetjmp=yes 712],[ 713 wi_cv_func_sigsetjmp=no 714]) 715AC_MSG_RESULT($wi_cv_func_sigsetjmp) 716]) 717dnl 718dnl 719dnl 720AC_DEFUN(wi_UTMP_UT_NAME, [ 721AC_MSG_CHECKING([for ut_name field in struct utmp]) 722AC_TRY_LINK([ 723 /* includes */ 724#include <unistd.h> 725#include <sys/types.h> 726#include <utmp.h> 727],[ 728struct utmp u; 729 730u.ut_name[0] = '\0'; 731exit(((int) &u.ut_name) & 0xff); /* bogus code, of course. */ 732],[ 733 wi_cv_utmp_ut_name=yes 734 AC_DEFINE(HAVE_UTMP_UT_NAME) 735],[ 736 wi_cv_utmp_ut_name=no 737]) 738AC_MSG_RESULT($wi_cv_utmp_ut_name) 739]) 740dnl 741dnl 742dnl 743AC_DEFUN(wi_UTMPX_UT_SYSLEN, [ 744AC_MSG_CHECKING([for ut_syslen field in struct utmpx]) 745AC_TRY_LINK([ 746 /* includes */ 747#include <unistd.h> 748#include <sys/types.h> 749#include <utmpx.h> 750],[ 751struct utmpx u; 752 753u.ut_syslen = 0; 754exit(((int) &u.ut_syslen) & 0xff); /* bogus code, of course. */ 755],[ 756 wi_cv_utmpx_ut_syslen=yes 757 AC_DEFINE(HAVE_UTMPX_UT_SYSLEN) 758],[ 759 wi_cv_utmpx_ut_syslen=no 760]) 761AC_MSG_RESULT($wi_cv_utmpx_ut_syslen) 762]) 763dnl 764dnl 765dnl 766AC_DEFUN(wi_UTMP_UT_USER, [ 767AC_MSG_CHECKING([for ut_user field in struct utmp]) 768AC_TRY_LINK([ 769 /* includes */ 770#include <unistd.h> 771#include <sys/types.h> 772#include <utmp.h> 773],[ 774struct utmp u; 775 776u.ut_user[0] = '\0'; 777exit(((int) &u.ut_user) & 0xff); /* bogus code, of course. */ 778],[ 779 wi_cv_utmp_ut_user=yes 780 AC_DEFINE(HAVE_UTMP_UT_USER) 781],[ 782 wi_cv_utmp_ut_user=no 783]) 784AC_MSG_RESULT($wi_cv_utmp_ut_user) 785]) 786dnl 787dnl 788dnl 789AC_DEFUN(wi_UTMP_UT_PID, [ 790AC_MSG_CHECKING([for ut_pid field in struct utmp]) 791AC_TRY_LINK([ 792 /* includes */ 793#include <unistd.h> 794#include <sys/types.h> 795#include <utmp.h> 796],[ 797struct utmp u; 798 799u.ut_pid = 1; 800exit(((int) &u.ut_pid) & 0xff); /* bogus code, of course. */ 801],[ 802 wi_cv_utmp_ut_pid=yes 803 AC_DEFINE(HAVE_UTMP_UT_PID) 804],[ 805 wi_cv_utmp_ut_pid=no 806]) 807AC_MSG_RESULT($wi_cv_utmp_ut_pid) 808]) 809 810dnl 811dnl 812dnl 813AC_DEFUN(wi_UTMP_UT_TIME, [ 814AC_MSG_CHECKING([for ut_time field in struct utmp]) 815AC_TRY_LINK([ 816 /* includes */ 817#include <unistd.h> 818#include <sys/types.h> 819#include <utmp.h> 820],[ 821struct utmp u; 822 823u.ut_time = 1; 824exit(((int) &u.ut_time) & 0xff); /* bogus code, of course. */ 825],[ 826 wi_cv_utmp_ut_time=yes 827 AC_DEFINE(HAVE_UTMP_UT_TIME) 828],[ 829 wi_cv_utmp_ut_time=no 830]) 831AC_MSG_RESULT($wi_cv_utmp_ut_time) 832]) 833dnl 834dnl 835dnl 836AC_DEFUN(wi_UTMP_UT_HOST, [ 837AC_MSG_CHECKING([for ut_host field in struct utmp]) 838AC_TRY_LINK([ 839 /* includes */ 840#include <unistd.h> 841#include <sys/types.h> 842#include <utmp.h> 843],[ 844struct utmp u; 845 846u.ut_host[0] = '\0'; 847exit(((int) &u.ut_host) & 0xff); /* bogus code, of course. */ 848],[ 849 wi_cv_utmp_ut_host=yes 850 AC_DEFINE(HAVE_UTMP_UT_HOST) 851],[ 852 wi_cv_utmp_ut_host=no 853]) 854AC_MSG_RESULT($wi_cv_utmp_ut_host) 855]) 856dnl 857dnl 858dnl 859AC_DEFUN(wi_STRUCT_STAT64, [ 860AC_MSG_CHECKING([for struct stat64]) 861AC_TRY_LINK([ 862 /* includes */ 863#include <unistd.h> 864#include <sys/types.h> 865#include <sys/stat.h> 866],[ 867struct stat64 st; 868 869st.st_size = 0; 870exit(((int) &st.st_size) & 0xff); /* bogus code, of course. */ 871],[ 872 wi_cv_struct_stat64=yes 873 AC_DEFINE(HAVE_STRUCT_STAT64) 874],[ 875 wi_cv_struct_stat64=no 876]) 877AC_MSG_RESULT($wi_cv_struct_stat64) 878]) 879dnl 880dnl 881dnl 882AC_DEFUN(wi_STRUCT_CMSGHDR, [ 883AC_MSG_CHECKING([for struct cmsghdr]) 884AC_TRY_LINK([ 885 /* includes */ 886#include <unistd.h> 887#include <sys/types.h> 888#include <sys/uio.h> 889#include <sys/socket.h> 890#include <sys/un.h> 891],[ 892struct cmsghdr cm; 893 894cm.cmsg_len = 0; 895cm.cmsg_level = 0; 896cm.cmsg_type = 0; 897exit(((int) &cm.cmsg_type) & 0xff); /* bogus code, of course. */ 898],[ 899 wi_cv_struct_cmsghdr=yes 900 AC_DEFINE(HAVE_STRUCT_CMSGDHR) 901],[ 902 wi_cv_struct_cmsghdr=no 903]) 904AC_MSG_RESULT($wi_cv_struct_cmsghdr) 905]) 906dnl 907dnl 908dnl 909AC_DEFUN(wi_MSGHDR_CONTROL, [ 910AC_MSG_CHECKING([for msg_control field in struct msghdr]) 911AC_TRY_LINK([ 912 /* includes */ 913#include <unistd.h> 914#include <sys/types.h> 915#include <sys/uio.h> 916#include <sys/socket.h> 917#include <sys/un.h> 918],[ 919struct msghdr m; 920 921m.msg_control = &m; 922m.msg_controllen = sizeof(m); 923exit(((int) &m.msg_control) & 0xff); /* bogus code, of course. */ 924],[ 925 wi_cv_msghdr_control=yes 926 AC_DEFINE(HAVE_MSGHDR_CONTROL) 927],[ 928 wi_cv_msghdr_control=no 929]) 930AC_MSG_RESULT($wi_cv_msghdr_control) 931]) 932dnl 933dnl 934dnl 935AC_DEFUN(wi_MSGHDR_ACCRIGHTS, [ 936AC_MSG_CHECKING([for msg_accrights field in struct msghdr]) 937AC_TRY_LINK([ 938 /* includes */ 939#include <unistd.h> 940#include <sys/types.h> 941#include <sys/uio.h> 942#include <sys/socket.h> 943#include <sys/un.h> 944],[ 945struct msghdr m; 946 947m.msg_accrights = &m; 948m.msg_accrightslen = sizeof(m); 949exit(((int) &m.msg_accrights) & 0xff); /* bogus code, of course. */ 950],[ 951 wi_cv_msghdr_accrights=yes 952 AC_DEFINE(HAVE_MSGHDR_ACCRIGHTS) 953],[ 954 wi_cv_msghdr_accrights=no 955]) 956AC_MSG_RESULT($wi_cv_msghdr_accrights) 957]) 958dnl 959dnl 960dnl 961AC_DEFUN(wi_PR_PASSWD_FG_OLDCRYPT, [ 962AC_MSG_CHECKING([for fg_oldcrypt field in struct pr_passwd]) 963AC_TRY_LINK([ 964 /* includes */ 965#include <unistd.h> 966#include <sys/types.h> 967#include <sys/stat.h> 968#include <stdio.h> 969#include <string.h> 970#include <stdlib.h> 971#include <pwd.h> 972#include <grp.h> 973#include <errno.h> 974 975#if defined(HAVE_USERPW_H) && defined(HAVE_GETUSERPW) /* AIX */ 976# include <userpw.h> 977#elif defined(HAVE_PWDADJ_H) && defined(HAVE_GETPWANAM) /* SunOS */ 978# include <sys/label.h> 979# ifdef HAVE_SYS_AUDIT_H 980# include <sys/audit.h> 981# endif 982# include <pwdadj.h> 983#elif defined(HAVE_GETESPWNAM) /* Digital UNIX 4 */ 984# ifdef HAVE_SYS_SECDEFINES_H 985# include <sys/secdefines.h> 986# endif 987# ifdef HAVE_SYS_SECURITY_H 988# include <sys/security.h> 989# endif 990# ifdef HAVE_SYS_AUDIT_H 991# include <sys/audit.h> 992# endif 993# ifdef HAVE_KRB_H 994# include <krb.h> 995# endif 996# ifdef HAVE_PROT_H 997# include <prot.h> 998# endif 999#elif defined(HAVE_GETPRPWNAM) /* SCO Open Server V, Digital UNIX 3, HP-UX 10 */ 1000# ifdef HAVE_SYS_SECDEFINES_H 1001# include <sys/secdefines.h> 1002# endif 1003# ifdef HAVE_SYS_SECURITY_H 1004# include <sys/security.h> 1005# endif 1006# ifdef HAVE_SYS_AUDIT_H 1007# include <sys/audit.h> 1008# endif 1009# ifdef HAVE_HPSECURITY_H 1010# include <hpsecurity.h> 1011# endif 1012# ifdef HAVE_KRB_H 1013# include <krb.h> 1014# endif 1015# ifdef HAVE_PROT_H 1016# include <prot.h> 1017# endif 1018#endif 1019],[ 1020 struct pr_passwd xu; 1021 memset(&xu, 0, sizeof(xu)); 1022 if (xu.uflg.fg_oldcrypt != 0) 1023 xu.uflg.fg_oldcrypt++; /* bogus code, of course */ 1024 exit(0); 1025],[ 1026 wi_cv_pr_passwd_fg_oldcrypt=yes 1027 AC_DEFINE(HAVE_PR_PASSWD_FG_OLDCRYPT) 1028],[ 1029 wi_cv_pr_passwd_fg_oldcrypt=no 1030]) 1031AC_MSG_RESULT($wi_cv_pr_passwd_fg_oldcrypt) 1032]) 1033dnl 1034dnl 1035dnl 1036AC_DEFUN(wi_SOCKADDR_UN_SUN_LEN, [ 1037AC_MSG_CHECKING([for sun_len field in struct sockaddr_un]) 1038AC_TRY_LINK([ 1039 /* includes */ 1040#include <unistd.h> 1041#include <sys/types.h> 1042#include <sys/uio.h> 1043#include <sys/socket.h> 1044#include <sys/un.h> 1045],[ 1046struct sockaddr_un uaddr; 1047 1048uaddr.sun_len = strlen("/tmp/test.sock"); 1049exit(((int) uaddr.sun_len); /* bogus code, of course. */ 1050],[ 1051 wi_cv_sockaddr_un_sun_len=yes 1052 AC_DEFINE(HAVE_SOCKADDR_UN_SUN_LEN) 1053],[ 1054 wi_cv_sockaddr_un_sun_len=no 1055]) 1056AC_MSG_RESULT($wi_cv_sockaddr_un_sun_len) 1057]) 1058dnl 1059dnl 1060dnl 1061AC_DEFUN(wi_STATFS_F_BAVAIL, [ 1062AC_MSG_CHECKING([for f_bavail field in struct statfs]) 1063AC_TRY_LINK([ 1064 /* includes */ 1065#include <unistd.h> 1066#include <sys/types.h> 1067#ifdef HAVE_SYS_STATFS_H 1068# include <sys/statfs.h> 1069#elif defined(HAVE_SYS_VFS_H) 1070# include <sys/vfs.h> 1071#endif 1072],[ 1073struct statfs st; 1074 1075st.f_bavail = 1; 1076exit((int) st.f_bavail); /* bogus code, of course. */ 1077],[ 1078 wi_cv_statfs_f_bavail=yes 1079 AC_DEFINE(HAVE_STATFS_F_BAVAIL) 1080],[ 1081 wi_cv_statfs_f_bavail=no 1082]) 1083AC_MSG_RESULT($wi_cv_statfs_f_bavail) 1084]) 1085dnl 1086dnl 1087dnl 1088AC_DEFUN(wi_SPRINTF_RETVAL, [ 1089AC_MSG_CHECKING([what sprintf() returns]) 1090AC_TRY_RUN([ 1091 /* program */ 1092#include <stdio.h> 1093#include <string.h> 1094 1095main() 1096{ 1097 int result; 1098 char s[8]; 1099 1100 result = (int) sprintf(s, "%d", 22); 1101 if (result == 2) 1102 exit(0); 1103 exit(1); 1104 1105} 1106],[ 1107 # action if true 1108 wi_cv_sprintf_returns_ptr=no 1109 x="length of data written"; 1110],[ 1111 # action if false 1112 wi_cv_sprintf_returns_ptr=yes 1113 AC_DEFINE(SPRINTF_RETURNS_PTR) 1114 x="pointer to data"; 1115],[ 1116 # action if cross compiling 1117 wi_cv_sprintf_returns_ptr=no 1118 x="unknown"; 1119]) 1120AC_MSG_RESULT($x) 1121]) 1122dnl 1123dnl 1124dnl 1125AC_DEFUN(wi_LIB_CRYPT, [ 1126AC_MSG_CHECKING([which library has usable crypt() function]) 1127ac_save_LIBS="$LIBS" 1128crypt_lib=NONE 1129 1130for lib in "c" "crypt" "descrypt" "des" 1131do 1132 1133if test "$lib" = "c" ; then 1134 LIBS="$ac_save_LIBS" 1135else 1136 LIBS="$ac_save_LIBS -l${lib}" 1137fi 1138 1139AC_TRY_RUN([ 1140 /* program */ 1141#include <stdio.h> 1142#include <string.h> 1143 1144extern char *crypt(const char *key, const char *salt); 1145 1146main() 1147{ 1148 char cleartext[256]; 1149 char *cp; 1150 1151 memset(cleartext, 0, sizeof(cleartext)); 1152 strcpy(cleartext, "password"); 1153 1154 cp = crypt(cleartext, "xx"); 1155 if ((cp != NULL) && (strcmp(cp, "xxj31ZMTZzkVA") == 0)) { 1156 /* printf("PASS\n"); */ 1157 exit(0); 1158 } 1159 /* printf("FAIL\n"); */ 1160 exit(1); 1161} 1162],[ 1163 # action if true 1164 crypt_lib="$lib" 1165],[ 1166 # action if false 1167 : 1168],[ 1169 # action if cross compiling 1170 : 1171]) 1172 1173 1174if test "$crypt_lib" != NONE ; then 1175 break 1176fi 1177 1178done 1179 1180 1181LIBS="$ac_save_LIBS" 1182 1183if test "$crypt_lib" = NONE ; then 1184 crypt_lib=c 1185 AC_MSG_RESULT([none?]) 1186else 1187 AC_MSG_RESULT([lib${crypt_lib}]) 1188fi 1189if test "$crypt_lib" != c ; then 1190 AC_CHECK_LIB(${lib},crypt) 1191fi 1192]) 1193dnl 1194dnl 1195dnl 1196AC_DEFUN(wi_TEST, [ 1197changequote(<^, ^>)dnl 1198changequote([, ])dnl 1199]) 1200dnl 1201dnl 1202dnl 1203AC_DEFUN(wi__RES_DEFDNAME, [ 1204AC_MSG_CHECKING([for useable _res global variable]) 1205AC_TRY_LINK([ 1206 /* includes */ 1207#include <unistd.h> 1208#include <sys/types.h> 1209#include <sys/stat.h> 1210#include <sys/socket.h> 1211#include <arpa/inet.h> 1212#include <netinet/in.h> 1213#ifdef HAVE_ARPA_NAMESER_H 1214# include <arpa/nameser.h> 1215#endif 1216#ifdef HAVE_RESOLV_H 1217# include <resolv.h> 1218#endif 1219],[ 1220 /* function-body */ 1221 int len; 1222 1223 res_init(); 1224 len = (int) strlen(_res.defdname); 1225],[ 1226 wi_cv__res_defdname=yes 1227 AC_DEFINE(HAVE__RES_DEFDNAME) 1228],[ 1229 wi_cv__res_defdname=no 1230]) 1231AC_MSG_RESULT($wi_cv__res_defdname) 1232]) 1233dnl 1234dnl 1235dnl 1236dnl 1237AC_DEFUN(wi_TYPE_SIG_ATOMIC_T, [ 1238AC_MSG_CHECKING([for sig_atomic_t]) 1239AC_TRY_LINK([ 1240 /* includes */ 1241#ifdef HAVE_UNISTD_H 1242#include <unistd.h> 1243#endif 1244#include <sys/types.h> 1245#include <sys/signal.h> 1246#include <signal.h> /* MG: for IRIX */ 1247#if STDC_HEADERS 1248#include <stdlib.h> 1249#include <stddef.h> 1250#endif 1251],[ 1252 /* function-body */ 1253 sig_atomic_t sample; 1254 1255 sample = (sig_atomic_t) getpid(); /* bogus code, of course */ 1256 exit((sample > 0) ? 0 : 1); 1257],[ 1258 ac_cv_type_sig_atomic_t=yes 1259],[ 1260 ac_cv_type_sig_atomic_t=no 1261]) 1262AC_MSG_RESULT($ac_cv_type_sig_atomic_t) 1263if test $ac_cv_type_sig_atomic_t = no ; then 1264 AC_DEFINE(sig_atomic_t, int) 1265fi 1266]) 1267dnl 1268dnl 1269dnl 1270dnl 1271AC_DEFUN(wi_LIB_READLINE, [ 1272AC_MSG_CHECKING([for GNU Readline library, version 2.0 or newer]) 1273 1274wi_cv_lib_readline=no 1275wi_cv_lib_readline_result=no 1276ac_save_LIBS="$LIBS" 1277# Note: $LIBCURSES is permitted to be empty. 1278for LIBREADLINE in "-lreadline" "-lreadline $LIBCURSES" "-lreadline -ltermcap" "-lreadline -lncurses" "-lreadline -lcurses" 1279do 1280 LIBS="$ac_save_LIBS $LIBREADLINE" 1281 AC_TRY_RUN([ 1282 /* program */ 1283#include <stdio.h> 1284#include <stdlib.h> 1285 1286main(int argc, char **argv) 1287{ 1288 /* Note: don't actually call readline, since it may block; 1289 * We just want to see if it (dynamic) linked in okay. 1290 */ 1291 if (argc == 0) /* never true */ 1292 readline(0); 1293 exit(0); 1294} 1295],[ 1296 # action if true 1297 wi_cv_lib_readline=yes 1298],[ 1299 # action if false 1300 wi_cv_lib_readline=no 1301],[ 1302 # action if cross compiling 1303 wi_cv_lib_readline=no 1304]) 1305 1306 if test "$wi_cv_lib_readline" = yes ; then break ; fi 1307done 1308 1309# Now try it again, to be sure it is recent enough. 1310# rl_function_of_keyseq appeared in version 2.0 1311# 1312dnl AC_CHECK_FUNC(rl_function_of_keyseq, [wi_cv_lib_readline=yes],[ 1313dnl wi_cv_lib_readline=no;wi_cv_lib_readline_result="no (it is present but too old to use)" 1314dnl ]) 1315 AC_TRY_LINK([ 1316 /* includes */ 1317 ],[ 1318 /* function-body */ 1319 readline(0); 1320 rl_function_of_keyseq(0); 1321 ],[ 1322 wi_cv_lib_readline=yes 1323 ],[ 1324 wi_cv_lib_readline=no 1325 wi_cv_lib_readline_result="no (it is present but too old to use)" 1326 ]) 1327 1328if test "$wi_cv_lib_readline" = no ; then 1329 LIBREADLINE="" 1330 # restore LIBS 1331 LIBS="$ac_save_LIBS" 1332else 1333 /bin/rm -f readline.ver 1334 touch readline.ver 1335 1336 AC_TRY_RUN([ 1337 /* program */ 1338#include <unistd.h> 1339#include <sys/types.h> 1340#include <stdio.h> 1341 1342extern char *rl_library_version; 1343 1344main() 1345{ 1346 FILE *fp; 1347 double d; 1348 1349 sscanf(rl_library_version, "%lf", &d); 1350 fp = fopen("readline.ver", "w"); 1351 if (fp == NULL) exit(1); 1352 if (fprintf(fp, "%s\n", rl_library_version) < 0) exit(1); 1353 if (fprintf(fp, "%03d\n", (int) (d * 100.0)) < 0) exit(1); 1354 if (fclose(fp) < 0) exit(1); 1355 exit(0); 1356} 1357 ],[ 1358 # action if true 1359 rl_library_version=`sed -n 1,1p readline.ver 2>/dev/null` 1360 rlver=`sed -n 2,2p readline.ver 2>/dev/null` 1361 /bin/rm -f readline.ver 1362 ],[ 1363 # action if false 1364 rl_library_version='' 1365 rlver='' 1366 /bin/rm -f readline.ver 1367 ],[ 1368 # action if cross compiling 1369 rl_library_version='' 1370 rlver='' 1371 /bin/rm -f readline.ver 1372 ]) 1373 1374 case "$rlver" in 1375 ???) 1376 wi_cv_lib_readline_result="yes, installed version is $rl_library_version" 1377 ;; 1378 *) 1379 # Test using current LIBS. 1380 AC_TRY_LINK([ 1381 /* includes */ 1382 extern int rl_completion_append_character; 1383 ],[ 1384 /* function-body */ 1385 readline(0); 1386 rl_completion_append_character = 0; 1387 ],[ 1388 rlver="210" 1389 ],[ 1390 rlver="200" 1391 ]) 1392 1393 if test "$rlver" = "210" ; then 1394 wi_cv_lib_readline_result="yes, version 2.1 or higher" 1395 else 1396 wi_cv_lib_readline_result="yes, version 2.0" 1397 fi 1398 ;; 1399 esac 1400 1401 wi_cv_lib_readline=yes 1402 # restore LIBS 1403 LIBS="$ac_save_LIBS" 1404fi 1405AC_MSG_RESULT($wi_cv_lib_readline_result) 1406AC_SUBST(LIBREADLINE) 1407 1408if test "$wi_cv_lib_readline" = yes ; then 1409 # Now verify that all the headers are installed. 1410 # 1411 AC_REQUIRE_CPP() 1412 unset ac_cv_header_readline_chardefs_h 1413 unset ac_cv_header_readline_history_h 1414 unset ac_cv_header_readline_keymaps_h 1415 unset ac_cv_header_readline_readline_h 1416 unset ac_cv_header_readline_tilde_h 1417 AC_CHECK_HEADERS([readline/chardefs.h readline/history.h readline/keymaps.h readline/readline.h readline/tilde.h]) 1418 1419 for xxwi in \ 1420 "$ac_cv_header_readline_chardefs_h" \ 1421 "$ac_cv_header_readline_history_h" \ 1422 "$ac_cv_header_readline_keymaps_h" \ 1423 "$ac_cv_header_readline_readline_h" \ 1424 "$ac_cv_header_readline_tilde_h" 1425 do 1426 if test "$xxwi" = no ; then 1427 break 1428 fi 1429 done 1430 1431 if test "$xxwi" = no ; then 1432 AC_MSG_WARN([GNU Readline headers are not installed or could not be found -- GNU Readline will not be used.]) 1433 wi_cv_lib_readline=no 1434 wi_cv_lib_readline_result="no (headers not installed)" 1435 else 1436 AC_DEFINE_UNQUOTED(HAVE_LIBREADLINE, $rlver) 1437 fi 1438fi 1439]) 1440dnl 1441dnl 1442dnl 1443AC_DEFUN(wi_USE_LONG_LONG, [ 1444AC_MSG_CHECKING([for 64-bit integral type: long long]) 1445LONGEST_INT="long" 1446AC_TRY_RUN([ 1447 /* program */ 1448#include <unistd.h> 1449#include <sys/types.h> 1450#include <stdio.h> 1451 1452long long hugeNumvar = 1; 1453 1454main() 1455{ 1456 long long hugeNumtoo = 2; 1457 1458 if (hugeNumtoo > hugeNumvar) 1459 hugeNumvar++; 1460 if (sizeof(hugeNumvar) < 8) 1461 exit(1); 1462 exit(0); 1463} 1464 1465],[ 1466 # action if true 1467 wi_cv_type_long_long=yes 1468 LONGEST_INT="long long" 1469],[ 1470 # action if false 1471 wi_cv_type_long_long=no 1472],[ 1473 # action if cross compiling 1474 wi_cv_type_long_long=no 1475]) 1476AC_MSG_RESULT($wi_cv_type_long_long) 1477 1478if test "$wi_cv_type_long_long" = yes ; then 1479 1480AC_MSG_CHECKING([how to print a 64-bit integral type]) 1481wi_cv_printf_long_long=fail 1482 1483AC_TRY_RUN([ 1484 /* program */ 1485#include <unistd.h> 1486#include <sys/types.h> 1487#include <stdio.h> 1488#include <string.h> 1489#include <stdlib.h> 1490 1491main() 1492{ 1493 char s[80]; 1494 long long hugeNum; 1495 1496 hugeNum = (long long) 1000000000; 1497 hugeNum = hugeNum * (long long) 99; 1498 hugeNum = hugeNum + (long long) 1; 1499 1500 (void) sprintf(s, "%lld", hugeNum); 1501 exit((strcmp(s, "99000000001") == 0) ? 0 : 1); 1502} 1503],[ 1504 # action if true 1505 wi_cv_printf_long_long="%lld" 1506],[ 1507 # action if false 1508 : 1509],[ 1510 # action if cross compiling 1511 : 1512]) 1513 1514 1515if test "$wi_cv_printf_long_long" = fail ; then 1516 1517AC_TRY_RUN([ 1518 /* program */ 1519#include <unistd.h> 1520#include <sys/types.h> 1521#include <stdio.h> 1522#include <string.h> 1523#include <stdlib.h> 1524 1525main() 1526{ 1527 char s[80]; 1528 long long hugeNum; 1529 1530 hugeNum = (long long) 1000000000; 1531 hugeNum = hugeNum * (long long) 99; 1532 hugeNum = hugeNum + (long long) 1; 1533 1534 (void) sprintf(s, "%qd", hugeNum); 1535 exit((strcmp(s, "99000000001") == 0) ? 0 : 1); 1536} 1537],[ 1538 # action if true 1539 wi_cv_printf_long_long="%qd" 1540],[ 1541 # action if false 1542 : 1543],[ 1544 # action if cross compiling 1545 : 1546]) 1547fi 1548 1549if test "$wi_cv_printf_long_long" = fail ; then 1550 wi_cv_printf_long_long_msg_result='cannot print' 1551else 1552 wi_cv_printf_long_long_msg_result="$wi_cv_printf_long_long" 1553fi 1554 1555AC_MSG_RESULT($wi_cv_printf_long_long_msg_result) 1556 1557 1558AC_MSG_CHECKING([how to scan a 64-bit integral type]) 1559wi_cv_scanf_long_long=fail 1560 1561AC_TRY_RUN([ 1562 /* program */ 1563#include <unistd.h> 1564#include <sys/types.h> 1565#include <stdio.h> 1566#include <string.h> 1567#include <stdlib.h> 1568 1569main() 1570{ 1571 long long hugeNum, justAsHugeNum; 1572 1573 hugeNum = (long long) 1000000000; 1574 hugeNum = hugeNum * (long long) 99; 1575 hugeNum = hugeNum + (long long) 1; 1576 1577 justAsHugeNum = (long long) 0; 1578 --justAsHugeNum; 1579 sscanf("99000000001", "%lld", &justAsHugeNum); 1580 if (memcmp(&hugeNum, &justAsHugeNum, sizeof(hugeNum)) == 0) 1581 exit(0); 1582 exit(1); 1583} 1584],[ 1585 # action if true 1586 wi_cv_scanf_long_long="%lld" 1587],[ 1588 # action if false 1589 : 1590],[ 1591 # action if cross compiling 1592 : 1593]) 1594 1595 1596if test "$wi_cv_scanf_long_long" = fail ; then 1597 1598AC_TRY_RUN([ 1599 /* program */ 1600#include <unistd.h> 1601#include <sys/types.h> 1602#include <stdio.h> 1603#include <string.h> 1604#include <stdlib.h> 1605 1606main() 1607{ 1608 long long hugeNum, justAsHugeNum; 1609 1610 hugeNum = (long long) 1000000000; 1611 hugeNum = hugeNum * (long long) 99; 1612 hugeNum = hugeNum + (long long) 1; 1613 1614 justAsHugeNum = (long long) 0; 1615 --justAsHugeNum; 1616 sscanf("99000000001", "%qd", &justAsHugeNum); 1617 if (memcmp(&hugeNum, &justAsHugeNum, sizeof(hugeNum)) == 0) 1618 exit(0); 1619 exit(1); 1620} 1621],[ 1622 # action if true 1623 wi_cv_scanf_long_long="%qd" 1624],[ 1625 # action if false 1626 : 1627],[ 1628 # action if cross compiling 1629 : 1630]) 1631fi 1632 1633if test "$wi_cv_scanf_long_long" = fail ; then 1634 wi_cv_scanf_long_long_msg_result='cannot scan' 1635else 1636 wi_cv_scanf_long_long_msg_result="$wi_cv_scanf_long_long" 1637fi 1638 1639AC_MSG_RESULT($wi_cv_scanf_long_long_msg_result) 1640 1641fi 1642 1643AC_MSG_CHECKING([if everything was available to use the 64-bit integral type]) 1644 1645if test "$wi_cv_type_long_long" = no ; then 1646 wi_cv_use_long_long_msg_result="no (long long type not available)" 1647 wi_cv_use_long_long="no" 1648 wi_cv_scanf_long_long="fail" 1649 wi_cv_prihtf_long_long="fail" 1650 LONGEST_INT="long" 1651elif test "$wi_cv_printf_long_long" = fail ; then 1652 wi_cv_use_long_long_msg_result="no (libc printf() does not support them)" 1653 wi_cv_use_long_long="no" 1654 wi_cv_scanf_long_long="fail" 1655 wi_cv_prihtf_long_long="fail" 1656 LONGEST_INT="long" 1657elif test "$wi_cv_scanf_long_long" = fail ; then 1658 wi_cv_use_long_long_msg_result="no (libc scanf() does not support them)" 1659 wi_cv_use_long_long="no" 1660 wi_cv_scanf_long_long="fail" 1661 wi_cv_prihtf_long_long="fail" 1662 LONGEST_INT="long" 1663else 1664 AC_DEFINE(HAVE_LONG_LONG) 1665 if test "$wi_cv_printf_long_long$wi_cv_scanf_long_long" = "%lld%qd" ; then 1666 # FreeBSD 3.2 has %lld and %qd, but we want to 1667 # run on 3.1 and 3.0. 1668 # 1669 wi_cv_printf_long_long="%qd" 1670 fi 1671 AC_DEFINE_UNQUOTED(PRINTF_LONG_LONG, "$wi_cv_printf_long_long") 1672 AC_DEFINE_UNQUOTED(SCANF_LONG_LONG , "$wi_cv_scanf_long_long") 1673 if test "$wi_cv_printf_long_long" = "%qd" ; then 1674 AC_DEFINE(PRINTF_LONG_LONG_QD) 1675 else 1676 AC_DEFINE(PRINTF_LONG_LONG_LLD) 1677 fi 1678 if test "$wi_cv_scanf_long_long" = "%qd" ; then 1679 AC_DEFINE(SCANF_LONG_LONG_QD) 1680 else 1681 AC_DEFINE(SCANF_LONG_LONG_LLD) 1682 fi 1683 wi_cv_use_long_long="yes" 1684 wi_cv_use_long_long_msg_result="yes" 1685fi 1686AC_MSG_RESULT($wi_cv_use_long_long_msg_result) 1687]) 1688dnl 1689dnl 1690dnl 1691dnl 1692AC_DEFUN(wi_CREATE_TAR_FILES, [ 1693AC_MSG_CHECKING([how to create TAR files]) 1694changequote(<<, >>)dnl 1695TAR=/usr/bin/tar 1696if [ ! -f /usr/bin/tar ] && [ -f /bin/tar ] ; then 1697 TAR=/bin/tar 1698fi 1699x="" 1700if [ -x /usr/bin/what ] ; then 1701 x=`/usr/bin/what "$TAR" 2>&1 | sed -n 's/.*pax.*/pax/g;/pax/p'` 1702elif [ -x /bin/what ] ; then 1703 x=`/bin/what "$TAR" 2>&1 | sed -n 's/.*pax.*/pax/g;/pax/p'` 1704fi 1705if [ "x$x" != "xpax" ] ; then 1706 # The junk above is because Mac OS X Server's tar freaks out 1707 # and does not exit if you do "tar --help". 1708 # 1709 x=`$TAR --help 2>&1 | sed -n 's/.*owner=NAME.*/owner=NAME/g;/owner=NAME/p'` 1710fi 1711case "$x" in 1712 *owner=NAME*) 1713 TARFLAGS="-c --owner=root --group=bin --verbose -f" 1714 ;; 1715 *) 1716 TARFLAGS="cvf" 1717 x2=`gtar --help 2>&1 | sed -n 's/.*owner=NAME.*/owner=NAME/g;/owner=NAME/p'` 1718 case "$x2" in 1719 *owner=NAME*) 1720 TARFLAGS="-c --owner=root --group=bin --verbose -f" 1721 TAR=gtar 1722 ;; 1723 esac 1724 ;; 1725esac 1726changequote([, ])dnl 1727AC_SUBST(TARFLAGS) 1728AC_SUBST(TAR) 1729AC_MSG_RESULT([$TAR $TARFLAGS]) 1730]) 1731dnl 1732dnl 1733dnl 1734dnl 1735AC_DEFUN(wi_HEADER_CURSES, [ 1736AC_MSG_CHECKING([for curses library headers]) 1737if test "$nc_cv_ncurses" != "no" ; then 1738 AC_CHECK_HEADERS(ncurses.h curses.h) 1739else 1740 AC_CHECK_HEADERS(curses.h) 1741fi 1742dnl needed for Solaris 7 1743if test "$ac_cv_header_curses_h" = no ; then 1744 if test -f /usr/include/curses.h ; then 1745 AC_DEFINE(HAVE_CURSES_H) 1746 ac_cv_header_curses_h=yes 1747 fi 1748fi 1749]) 1750dnl 1751dnl 1752dnl 1753dnl 1754AC_DEFUN(wi_LIB_CURSES, [ 1755wi_HEADER_CURSES 1756AC_MSG_CHECKING([for curses library]) 1757 1758wi_cv_lib_curses=no 1759wi_cv_lib_curses_result=no 1760ac_save_LIBS="$LIBS" 1761for LIBCURSES in "-lncurses" "-lcurses" "-lcurses -ltermcap" "-ltermcap -lcurses" 1762do 1763 if test "x$LIBCURSES-$nc_cv_ncurses" = "x-lncurses-no" ; then 1764 # This should never work 1765 LIBCURSES="-lkdfjkdjfs" 1766 fi 1767 LIBS="$ac_save_LIBS $LIBCURSES" 1768 AC_TRY_RUN([ 1769 /* program */ 1770#include <stdio.h> 1771#include <stdlib.h> 1772 1773#ifdef HAVE_NCURSES_H 1774# include <ncurses.h> 1775#else 1776# include <curses.h> 1777#endif 1778 1779 1780main(int argc, char **argv) 1781{ 1782 /* Note: don't actually call curses, since it may block; 1783 * We just want to see if it (dynamic) linked in okay. 1784 */ 1785 if (argc == 4) 1786 initscr(); 1787 exit(0); 1788} 1789],[ 1790 # action if true 1791 wi_cv_lib_curses=yes 1792 wi_cv_lib_curses_result="yes" 1793],[ 1794 # action if false 1795 wi_cv_lib_curses=no 1796],[ 1797 # action if cross compiling 1798 wi_cv_lib_curses=no 1799]) 1800 1801 if test "$wi_cv_lib_curses" = yes ; then break ; fi 1802done 1803 1804# restore LIBS 1805LIBS="$ac_save_LIBS" 1806 1807if test "$wi_cv_lib_curses_result" != "no" ; then 1808 case "$LIBCURSES" in 1809 "-lncurses") 1810 AC_DEFINE(HAVE_LIBNCURSES) 1811 ;; 1812 "-lcurses") 1813 AC_DEFINE(HAVE_LIBCURSES) 1814 ;; 1815 "-lcurses -ltermcap") 1816 AC_DEFINE(HAVE_LIBCURSES) 1817 ;; 1818 "-ltermcap -lcurses") 1819 AC_DEFINE(HAVE_LIBCURSES) 1820 ;; 1821 esac 1822else 1823 LIBCURSES='' 1824fi 1825 1826AC_SUBST(LIBCURSES) 1827AC_MSG_RESULT([$wi_cv_lib_curses_result]) 1828]) 1829dnl 1830dnl 1831dnl 1832dnl 1833AC_DEFUN(wi_CURSES_FEATURES, [ 1834if test "$wi_cv_lib_curses" = "yes" ; then 1835 # Then $LIBCURSES is a list of curses and support libraries. 1836 ac_save_LIBS="$LIBS"; 1837 LIBS="$LIBS $LIBCURSES"; 1838 1839 1840 # maxx or _maxx 1841 AC_MSG_CHECKING([whether curses structure has maxx or _maxx field]) 1842 AC_TRY_COMPILE([ 1843 /* includes */ 1844#ifdef HAVE_UNISTD_H 1845# include <unistd.h> 1846#endif 1847#include <sys/types.h> 1848#include <stdio.h> 1849#include <string.h> 1850#include <stdlib.h> 1851 1852#ifdef HAVE_NCURSES_H 1853# include <ncurses.h> 1854#else 1855# include <curses.h> 1856#endif 1857],[ 1858 WINDOW *w; 1859 1860 w = newwin(10, 10, 1, 1); 1861 w->maxx = 0; 1862],[ 1863AC_MSG_RESULT([maxx]) 1864],[ 1865AC_DEFINE(HAVE__MAXX) 1866AC_MSG_RESULT([_maxx]) 1867]) 1868 1869 AC_CHECK_FUNCS(__getmaxx __getmaxy __getbegx __getbegy) 1870 1871 # getbegx 1872 AC_MSG_CHECKING([for getbegx() functionality in curses library]) 1873 AC_TRY_LINK([ 1874 /* includes */ 1875#ifdef HAVE_UNISTD_H 1876# include <unistd.h> 1877#endif 1878#include <sys/types.h> 1879#include <stdio.h> 1880#include <string.h> 1881#include <stdlib.h> 1882 1883#ifdef HAVE_NCURSES_H 1884# include <ncurses.h> 1885#else 1886# include <curses.h> 1887#endif 1888 1889],[ 1890 /* function-body */ 1891 WINDOW *junk = 0; 1892 int mx = 0; 1893 1894 mx = getbegx(junk); 1895 exit(0); 1896],[ 1897 AC_DEFINE(HAVE_GETBEGX) 1898 AC_MSG_RESULT([yes]) 1899],[ 1900 AC_MSG_RESULT([no]) 1901]) 1902 1903 1904 # getmaxx 1905 AC_MSG_CHECKING([for getmaxx() functionality in curses library]) 1906 AC_TRY_LINK([ 1907 /* includes */ 1908#ifdef HAVE_UNISTD_H 1909# include <unistd.h> 1910#endif 1911#include <sys/types.h> 1912#include <stdio.h> 1913#include <string.h> 1914#include <stdlib.h> 1915 1916#ifdef HAVE_NCURSES_H 1917# include <ncurses.h> 1918#else 1919# include <curses.h> 1920#endif 1921],[ 1922 /* function-body */ 1923 WINDOW *junk = 0; 1924 int mx = 0; 1925 1926 mx = getmaxx(junk); 1927 exit(0); 1928],[ 1929 AC_DEFINE(HAVE_GETMAXX) 1930 AC_MSG_RESULT([yes]) 1931],[ 1932 AC_MSG_RESULT([no]) 1933]) 1934 1935 # getmaxyx 1936 AC_MSG_CHECKING([for getmaxyx() functionality in curses library]) 1937 AC_TRY_LINK([ 1938 /* includes */ 1939#ifdef HAVE_UNISTD_H 1940# include <unistd.h> 1941#endif 1942#include <sys/types.h> 1943#include <stdio.h> 1944#include <string.h> 1945#include <stdlib.h> 1946 1947#ifdef HAVE_NCURSES_H 1948# include <ncurses.h> 1949#else 1950# include <curses.h> 1951#endif 1952],[ 1953 /* function-body */ 1954 WINDOW *junk = 0; 1955 int mx = 0, my = 0; 1956 1957 getmaxyx(junk, my, mx); 1958 exit(my < 0 ? my : 0); 1959],[ 1960 AC_DEFINE(HAVE_GETMAXYX) 1961 AC_MSG_RESULT([yes]) 1962],[ 1963 AC_MSG_RESULT([no]) 1964]) 1965 1966 # touchwin 1967 AC_MSG_CHECKING([for touchwin() functionality in curses library]) 1968 AC_TRY_LINK([ 1969 /* includes */ 1970#ifdef HAVE_UNISTD_H 1971# include <unistd.h> 1972#endif 1973#include <sys/types.h> 1974#include <stdio.h> 1975#include <string.h> 1976#include <stdlib.h> 1977 1978#ifdef HAVE_NCURSES_H 1979# include <ncurses.h> 1980#else 1981# include <curses.h> 1982#endif 1983],[ 1984 /* function-body */ 1985 WINDOW *junk = 0; 1986 touchwin(junk); 1987 exit(0); 1988],[ 1989 AC_DEFINE(HAVE_TOUCHWIN) 1990 AC_MSG_RESULT([yes]) 1991],[ 1992 AC_MSG_RESULT([no]) 1993]) 1994 1995 # beep 1996 AC_MSG_CHECKING([for beep() functionality in curses library]) 1997 AC_TRY_LINK([ 1998 /* includes */ 1999#ifdef HAVE_UNISTD_H 2000# include <unistd.h> 2001#endif 2002#include <sys/types.h> 2003#include <stdio.h> 2004#include <string.h> 2005#include <stdlib.h> 2006 2007#ifdef HAVE_NCURSES_H 2008# include <ncurses.h> 2009#else 2010# include <curses.h> 2011#endif 2012],[ 2013 /* function-body */ 2014 beep(); 2015 exit(getpid() & 1); 2016],[ 2017 AC_DEFINE(HAVE_BEEP) 2018 AC_MSG_RESULT([yes]) 2019],[ 2020 AC_MSG_RESULT([no]) 2021]) 2022 2023 AC_CHECK_FUNCS(keypad nodelay curs_set doupdate wnoutrefresh) 2024 2025 LIBS="$ac_save_LIBS"; 2026fi 2027]) 2028dnl 2029dnl 2030dnl 2031AC_DEFUN(wi_SHADOW_FUNCS, [ 2032AC_CHECK_FUNCS(md5_crypt md5crypt bcrypt getspnam) 2033 2034# UnixWare 7 2035if test "$ac_cv_func_getspnam" = no ; then 2036 unset ac_cv_func_getspnam 2037 AC_CHECK_LIB(gen,getspnam) 2038 if test "$ac_cv_lib_gen_getspnam" = yes ; then 2039 AC_CHECK_FUNCS(getspnam) 2040 fi 2041fi 2042 2043# AIX 2044# 2045case "$SYS" in 2046 "aix"|"") 2047 AC_CHECK_FUNCS(getuserpw) 2048 ;; 2049 *) 2050 ;; 2051esac 2052 2053# C2: SCO Open Server 5; Digital UNIX 2054AC_CHECK_FUNCS(set_auth_parameters bigcrypt) 2055 2056# C2: Digital UNIX 3.2, 4.0; SCO Open Server 5; HP-UX 11 2057AC_CHECK_FUNCS(getprpwnam) 2058 2059# Digital UNIX 4.0 2060AC_CHECK_FUNCS(getespwnam get_num_crypts get_crypt_name) 2061 2062# Digital Unix 4.0 2063AC_CHECK_FUNCS(dispcrypt) 2064 2065# SunOS 2066AC_CHECK_FUNCS(getpwanam) 2067]) 2068dnl 2069dnl 2070dnl 2071AC_DEFUN(wi_SHADOW_HEADERS, [ 2072AC_CHECK_HEADERS(shadow.h crypt.h) 2073 2074# AIX 2075AC_CHECK_HEADERS(userpw.h) 2076 2077# SunOS 2078AC_CHECK_HEADERS(pwdadj.h) 2079 2080# HP-UX 2081# 2082# Bug in header on these version 10 which cause is it not 2083# to get detected. 2084# 2085wi_HEADER_HPSECURITY_H 2086 2087# SCO Open Server, Digital UNIX 2088AC_CHECK_HEADERS(sys/security.h sys/audit.h krb.h prot.h) 2089 2090# Digital UNIX 2091AC_CHECK_HEADERS(sys/secdefines.h) 2092 2093# Digital UNIX 2094wi_PR_PASSWD_FG_OLDCRYPT 2095]) 2096dnl 2097dnl 2098dnl 2099AC_DEFUN(wi_SHADOW_LIBS, [ 2100check_for_libcrypt=yes 2101 2102# AIX security library is libs.a 2103AC_CHECK_LIB(s,getuserpw) 2104if test "$ac_cv_lib_s" = yes ; then 2105 check_for_libcrypt=no 2106elif test "$ac_cv_lib_s_getuserpw" = yes ; then 2107 check_for_libcrypt=no 2108fi 2109 2110# SCO OpenServer 5 stuff for shadow password 2111AC_CHECK_LIB(x,nap) 2112AC_CHECK_LIB(prot,getprpwnam) 2113 2114# Digital UNIX 2115AC_CHECK_LIB(security,endprpwent) 2116 2117# HP-UX 2118AC_CHECK_LIB(sec,getprpwnam) 2119 2120if test "$ac_cv_lib_sec_getprpwnam" = no ; then 2121 # DYNIX/ptx 2122 AC_CHECK_LIB(sec,getspnam) 2123fi 2124 2125if test "$check_for_libcrypt" = yes ; then 2126 wi_LIB_CRYPT 2127fi 2128AC_CHECK_FUNCS(crypt) 2129]) 2130dnl 2131dnl 2132dnl 2133AC_DEFUN(wi_OS_VAR, [ 2134changequote(!@, @!)dnl 2135if [ -x "$HOME/bin/OS" ] ; then 2136 HOME_OS=`$HOME/bin/OS` 2137 HOME_OS="$HOME/$HOME_OS" 2138fi 2139host=`uname -n 2>/dev/null | tr '[A-Z]' '[a-z]'` 2140os=`uname -s 2>/dev/null | tr '[A-Z]' '[a-z]'` 2141dnl work around inability to use $1 2142os_v=`uname -v 2>/dev/null | sed 's/^[^0-9.]*//;s/[^0-9.]*$//;s/pre.*//;s/test.*//' | awk '-F[-/: ]' '{n = 1; print $n; }'` 2143os_r=`uname -r 2>/dev/null | sed 's/^[^0-9.]*//;s/[^0-9.]*$//;s/pre.*//;s/test.*//' | awk '-F[-/: ]' '{n = 1; print $n; }'` 2144os_r1=`echo "${os_r}" | cut -c1` 2145arch=`uname -m 2>/dev/null | tr '[A-Z]' '[a-z]'` 2146archp=`uname -p 2>/dev/null | tr '[A-Z]' '[a-z]'` 2147OS='' 2148SYS='' 2149NDEFS='' 2150 2151# Special case a few systems where if your CFLAGS appear 2152# to want to generate for 32 bit, use that mode rather 2153# than 64 bit. 2154# 2155case "$os,$CFLAGS" in 2156 irix64,*-n32*) 2157 os=irix 2158 # then go to regular "irix" instead of "irix64" below. 2159 ;; 2160esac 2161 2162case "$os" in 2163 osf1) 2164 case "$os_r" in 2165 3*|4*) 2166 OS="digitalunix${os_r}-$arch" 2167 SYS=digitalunix 2168 ;; 2169 *) 2170 OS="tru64unix${os_r}-$arch" 2171 SYS=tru64unix 2172 ;; 2173 esac 2174 NDEFS="$NDEFS -DDIGITAL_UNIX=$os_r1" 2175 ;; 2176 aix) 2177 OS="aix${os_v}.${os_r}" 2178 SYS=aix 2179 NDEFS="$NDEFS -DAIX=${os_v}" 2180 ;; 2181 irix) 2182 OS="irix${os_r}" 2183 SYS=irix 2184 NDEFS="$NDEFS -DIRIX=$os_r1" 2185 ;; 2186 irix64) 2187 OS="irix64_${os_r}" 2188 SYS=irix64 2189 NDEFS="$NDEFS -DIRIX=$os_r1 -DIRIX64=$os_r1" 2190 ;; 2191 hp-ux) 2192 os_r=`echo "${os_r}" | cut -d. -f2-` 2193 os_r1=`echo "$os_r" | cut -d. -f1` 2194 os_r2=`echo "${os_r}" | cut -d. -f2` 2195 os_int=`expr "$os_r1" '*' 100 + "$os_r2"` 2196 OS="hpux${os_r}" 2197 SYS=hpux 2198 NDEFS="$NDEFS -DHPUX=$os_int" 2199 ;; 2200 freebsd) 2201 OS="freebsd${os_r}-$arch" 2202 os_r1=`echo "$os_r" | cut -d. -f1` 2203 os_r2=`echo "$os_r" | cut -d. -f2` 2204 os_r3=`echo "$os_r" | cut -d. -f3` 2205 if [ "$os_r3" = "" ] ; then os_r3=0 ; fi 2206 os_int=`expr "$os_r1" '*' 100 + "$os_r2" '*' 10 + "$os_r3"` 2207 SYS=freebsd 2208 NDEFS="$NDEFS -DFREEBSD=$os_int" 2209 ;; 2210 netbsd) 2211 OS="netbsd${os_r}-$arch" 2212 NDEFS="$NDEFS -DNETBSD=$os_r1" 2213 SYS=netbsd 2214 ;; 2215 openbsd) 2216 OS="openbsd${os_r}-$arch" 2217 SYS=openbsd 2218 NDEFS="$NDEFS -DOPENBSD=$os_r1" 2219 ;; 2220 sco*) 2221 OS=scosv 2222 SYS=sco 2223 NDEFS="$NDEFS -DSCO=$os_r1" 2224 ;; 2225 dynix*) 2226 OS="dynixptx${os_v}" 2227 SYS=dynixptx 2228 os_v1=`echo "$os_v" | cut -d. -f1` 2229 os_v2=`echo "$os_v" | cut -d. -f2` 2230 os_v3=`echo "$os_v" | cut -d. -f3` 2231 if [ "$os_v3" = "" ] ; then os_v3=0 ; fi 2232 os_int=`expr "$os_v1" '*' 100 + "$os_v2" '*' 10 + "$os_v3"` 2233 NDEFS="$NDEFS -DDYNIX=$os_int" 2234 ;; 2235 linux) 2236 case "$arch" in 2237 *86) 2238 arch=x86 2239 ;; 2240 esac 2241 2242 libc="" 2243 os_r1=`echo "$os_r" | cut -d. -f1` 2244 os_r2=`echo "$os_r" | cut -d. -f2` 2245 os_r3=`echo "$os_r" | cut -d- -f1 | cut -d. -f3` 2246 os_int=`expr "$os_r1" '*' 10000 + "$os_r2" '*' 1000 + "$os_r3"` 2247 NDEFS="$NDEFS -DLINUX=$os_int" 2248 2249 vertest="./vertest.$$" 2250 /bin/rm -f "$vertest" "$vertest.c" 2251 cat <<EOF > "$vertest.c" 2252#include <stdio.h> 2253#include <gnu/libc-version.h> 2254 2255main() 2256{ 2257 const char *ver = gnu_get_libc_version(); 2258 const char *rel = gnu_get_libc_release(); 2259 2260 fprintf(stdout, "glibc%s\n", ver); 2261 exit(0); 2262} 2263EOF 2264 echo $ac_n "checking version of C library""... $ac_c" 1>&6 2265 echo "configure:: checking version of C library" >&5 2266 ${CC-cc} $DEFS $CPPFLAGS $CFLAGS "$vertest.c" -o "$vertest" >/dev/null 2>&1 2267 if [ -x "$vertest" ] ; then libc=`$vertest` ; fi 2268 /bin/rm -f "$vertest" "$vertest.c" 2269 2270 case "$libc" in 2271 glibc*) 2272 echo "$libc" 1>&6 2273 glibc_r=`echo "$libc" | sed 's/glibc//'` 2274 glibc_r1=`echo "$glibc_r" | cut -d. -f1` 2275 glibc_r2=`echo "$glibc_r" | cut -d. -f2` 2276 glibc_r3=`echo "$glibc_r" | cut -d- -f1 | cut -d. -f3` 2277 glibc_int=`expr "$glibc_r1" '*' 10000 + "$glibc_r2" '*' 1000 + "$glibc_r3"` 2278 NDEFS="$NDEFS -DLINUX_GLIBC=$glibc_int" 2279 libc="glibc${glibc_r1}.${glibc_r2}" 2280 OS="linux-$arch" 2281 ;; 2282 *) 2283 if test -f /lib/libc-2.2.2.so ; then 2284 NDEFS="$NDEFS -DLINUX_GLIBC=22002" 2285 libc="glibc2.2" 2286 OS="linux-$arch" 2287 elif test -f /lib/libc-2.2.1.so ; then 2288 NDEFS="$NDEFS -DLINUX_GLIBC=22001" 2289 libc="glibc2.2" 2290 OS="linux-$arch" 2291 elif test -f /lib/libc-2.2.0.so ; then 2292 NDEFS="$NDEFS -DLINUX_GLIBC=22000" 2293 libc="glibc2.1" 2294 OS="linux-$arch" 2295 elif test -f /lib/libc-2.1.3.so ; then 2296 NDEFS="$NDEFS -DLINUX_GLIBC=21003" 2297 libc="glibc2.1" 2298 OS="linux-$arch" 2299 elif test -f /lib/libc-2.1.2.so ; then 2300 NDEFS="$NDEFS -DLINUX_GLIBC=21002" 2301 libc="glibc2.1" 2302 OS="linux-$arch" 2303 elif test -f /lib/libc-2.1.1.so ; then 2304 NDEFS="$NDEFS -DLINUX_GLIBC=21001" 2305 libc="glibc2.1" 2306 OS="linux-$arch" 2307 elif test -f /lib/libc.so.6 ; then 2308 NDEFS="$NDEFS -DLINUX_GLIBC=20000" 2309 libc="glibc2.0" 2310 OS="linux-$arch" 2311 elif test -f /lib/libc.so.6.1 ; then 2312 NDEFS="$NDEFS -DLINUX_GLIBC=20001" 2313 libc="glibc2.0" 2314 OS="linux-$arch" 2315 else 2316 NDEFS="$NDEFS -DLINUX_LIBC=5" 2317 libc="libc5" 2318 OS="linux-$arch" 2319 fi 2320 echo "$libc" 1>&6 2321 ;; 2322 esac 2323 SYS=linux 2324 ;; 2325 bsd/os) 2326 OS="bsdos${os_r}" 2327 SYS=bsdos 2328 NDEFS="$NDEFS -DBSDOS=$os_r1" 2329 ;; 2330 ultrix) 2331 OS="ultrix-$arch" 2332 SYS=ultrix 2333 ;; 2334 unixware|eeyore) 2335 OS="unixware${os_v}" 2336 SYS=unixware 2337 ;; 2338 macos*|darwin|rhapsody) 2339 OS="macosx" 2340 SYS="macosx" 2341 ;; 2342 sunos) 2343 if [ "$arch" = "" ] ; then arch="sparc" ; fi 2344 if [ "$archp" = "" ] ; then archp="$arch" ; fi 2345 case "$os_r" in 2346 5.[789]*) 2347 os_r=`echo "$os_r" | cut -c3-` 2348 OS="solaris${os_r}-$archp" 2349 NDEFS="$NDEFS -DSOLARIS=\\\"$os_r\\\"" 2350 SYS=solaris 2351 ;; 2352 5.[0123456]*) 2353 maj=`echo "$os_r" | cut -c1-1` 2354 maj=`expr "$maj" - 3` 2355 os_r=`echo "$os_r" | cut -c2-` 2356 os_r="${maj}${os_r}" 2357 OS="solaris${os_r}-$archp" 2358 NDEFS="$NDEFS -DSOLARIS=\\\"$os_r\\\"" 2359 SYS=solaris 2360 ;; 2361 4.*) 2362 OS="sunos${os_r}-sparc" 2363 NDEFS="$NDEFS -DSUNOS=\\\"$os_r\\\"" 2364 SYS=sunos 2365 ;; 2366 *) 2367 OS="solaris${os_r}-$archp" 2368 NDEFS="$NDEFS -DSOLARIS=\\\"$os_r\\\"" 2369 SYS=solaris 2370 ;; 2371 esac 2372 ;; 2373 *) 2374 OS="$os" 2375 SYS="$os" 2376 2377 if grep Novell /usr/include/sys/types.h ; then 2378 OS="unixware${os_v}" 2379 SYS="unixware" 2380 fi 2381 ;; 2382esac 2383 2384changequote([, ]) 2385 2386AC_SUBST(NDEFS) 2387AC_SUBST(OS) 2388AC_SUBST(host) 2389AC_SUBST(SYS) 2390AC_SUBST(HOME_OS) 2391]) 2392