1 AC_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.
9 [ --enable-debug enable debugging symbols],
12 DEBUGCONFIGUREFLAG="--enable-debug"
22 AC_DEFUN(wi_EXTRA_IDIR, [
24 if test -r $incdir ; then
27 # echo " + already had $incdir" 1>&6
30 if test "$CPPFLAGS" = "" ; then
33 CPPFLAGS="$CPPFLAGS -I$incdir"
35 echo " + found $incdir" 1>&6
44 AC_DEFUN(wi_PROG_TAR, [
46 AC_PATH_PROG(TAR, "tar")
47 if test -x "$TAR" ; then
48 AC_DEFINE_UNQUOTED(TAR, "$TAR")
55 AC_DEFUN(wi_EXTRA_LDIR, [
57 if test -r $libdir ; then
60 # echo " + already had $libdir" 1>&6
63 if test "$LDFLAGS" = "" ; then
66 LDFLAGS="$LDFLAGS -L$libdir"
68 echo " + found $libdir" 1>&6
78 AC_MSG_CHECKING([for GNU ld])
81 x=`ld --version 2>/dev/null | fgrep GNU`
82 if test "$x" != "" ; then
86 AC_MSG_RESULT($result)
92 AC_DEFUN(wi_LD_READONLY_TEXT, [
93 if test "$SYS$wi_cv_prog_ld" = "linuxgld" ; then
94 LDFLAGS="$LDFLAGS -Xlinker -n"
101 AC_DEFUN(wi_EXTRA_SYSV_SUNOS_DIRS, [
102 AC_MSG_CHECKING([for System V compatibility directories])
104 wi_EXTRA_IDIR("/usr/5include")
105 wi_EXTRA_LDIR("/usr/5lib")
109 dnl If you want to also look for include and lib subdirectories in the
110 dnl $HOME tree, you supply "yes" as the first argument to this macro.
112 dnl If you want to look for subdirectories in include/lib directories,
113 dnl you pass the names in argument 3, otherwise pass a dash.
115 AC_DEFUN(wi_EXTRA_DIRS, [
116 AC_MSG_CHECKING([for extra include and lib directories])
118 ifelse([$1], yes, [dnl
121 exdirs="$HOME $j $b1 $b2 $prefix $2"
122 if test -x "$HOME/bin/OS" ; then
125 if test -d "$b3" ; then
133 if test "$subexdirs" = "" ; then
136 for subexdir in $subexdirs ; do
137 if test "$subexdir" = "-" ; then
140 subexdir="/$subexdir"
142 for exdir in $exdirs ; do
145 if test "$exdir" = "//" ; then exdir="/" ; fi
146 if test "$subexdir" != ""; then
147 incdir="${exdir}/include${subexdir}"
148 wi_EXTRA_IDIR($incdir)
150 libdir="${exdir}/lib${subexdir}"
151 wi_EXTRA_LDIR($libdir)
155 if test "$subexdir" = ""; then
156 incdir="${exdir}/include${subexdir}"
157 wi_EXTRA_IDIR($incdir)
159 libdir="${exdir}/lib${subexdir}"
160 wi_EXTRA_LDIR($libdir)
170 AC_DEFUN(wi_HPUX_CFLAGS,
171 [AC_MSG_CHECKING(if HP-UX ansi C compiler flags are needed)
172 AC_REQUIRE([AC_PROG_CC])
173 AC_REQUIRE([wi_OS_VAR])
175 if 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.
179 changequote(<<, >>)dnl
180 CFLAGS=`echo "$CFLAGS" | sed 's/-A[ae]//g'`
186 # This is required for the extended
189 CFLAGS="-D_HPUX_SOURCE $CFLAGS"
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
198 changequote(<<, >>)dnl
199 x=`echo "$CFLAGS" | grep 'A[ae]' 2>/dev/null`
201 if test "$x" = "" ; then
207 AC_MSG_RESULT($ac_cv_hpux_flags)
212 AC_DEFUN(wi_SFLAG, [AC_REQUIRE([AC_PROG_CC])
214 if test "$SFLAG" = "" ; then
223 # Was it ./configure --enable-debug ?
225 if test "$DEBUGBUILD" = yes ; then
230 "-g"|"-g "*|*" -g"|*" -g "*|*"-g"[0-9]*)
241 AC_DEFUN(wi_REQUEST_NO_Y2K_WARNINGS, [
242 wi_cv_request_no_y2k=yes
247 AC_DEFUN(wi_CFLAGS_NO_Y2K_WARNINGS, [AC_REQUIRE([AC_PROG_CC])
248 if test "$ac_cv_prog_gcc" = yes ; then
254 CFLAGS="$CFLAGS -Wno-format-y2k"
256 # Now check if this version of GCC
257 # accepts this flag...
259 AC_TRY_COMPILE([],[int junk;],[],[CFLAGS="$oldCFLAGS"])
268 AC_DEFUN(wi_CFLAGS, [AC_REQUIRE([AC_PROG_CC])
271 if test "$CFLAGS" = "" ; then
272 AC_MSG_WARN([Your CFLAGS environment variable was not set. A default of \"-g\" will be used.])
275 if test "x$wi_cv_request_no_y2k" = xyes ; then
276 wi_CFLAGS_NO_Y2K_WARNINGS
278 if test "$NOOPTCFLAGS" = "" ; then
279 changequote(<<, >>)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/\ *$//;'`
283 if test "$DEBUGCFLAGS" = "" ; then
284 DEBUGCFLAGS="-g $NOOPTCFLAGS"
287 # Was it ./configure --enable-debug ?
289 AC_MSG_CHECKING([if this is a debug build])
290 if test "$DEBUGBUILD" = yes ; then
292 CFLAGS="$DEBUGCFLAGS"
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)
309 AC_DEFUN(wi_CFLAGS_LFS64, [AC_REQUIRE([AC_PROG_CC])
310 AC_REQUIRE([wi_OS_VAR])
312 if test "os_${os}_gcc_${ac_cv_prog_gcc}" = os_hp-ux_gcc_yes ; then
317 # This is required for the extended
318 # namespace symbols for Large Files.
320 CFLAGS="-D__STDC_EXT__ $CFLAGS"
325 *-D_LARGEFILE64_SOURCE*)
328 CFLAGS="-D_LARGEFILE64_SOURCE $CFLAGS"
331 AC_MSG_CHECKING([additional CFLAGS for LFS64 support])
332 AC_MSG_RESULT($CFLAGS)
337 AC_DEFUN(wi_PROTOTYPES, [
338 AC_MSG_CHECKING(if the compiler supports function prototypes)
339 AC_TRY_COMPILE(,[extern void exit(int status);],[wi_cv_prototypes=yes
340 AC_DEFINE(PROTOTYPES)],wi_cv_prototypes=no)
341 AC_MSG_RESULT($wi_cv_prototypes)
346 AC_DEFUN(wi_INSECURE_CHOWN, [
347 AC_MSG_CHECKING(if chown can be used to subvert security)
349 #include <sys/types.h>
350 #include <sys/stat.h>
360 setuid(1); /* if you're root, try set to someone else. */
361 sprintf(fn, "/tmp/fu%06ld", (long) getpid());
365 exit(1); /* assume the worst */
366 fprintf(fp, "%s\n", "hello world");
369 result = chown(fn, 0, 0);
370 if (stat(fn, &st) < 0) {
372 exit((result == 0) ? 0 : 1);
376 /* exit(0) if the insecure chown to uid 0 succeeded. */
377 exit((st.st_uid == 0) ? 0 : 1);
380 wi_cv_insecure_chown=yes
381 AC_DEFINE(INSECURE_CHOWN)
384 wi_cv_insecure_chown=no
386 # action if cross-compiling, guess
387 wi_cv_insecure_chown=no
390 AC_MSG_RESULT($wi_cv_insecure_chown)
395 AC_DEFUN(wi_LIB_SNPRINTF, [
396 if 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)
407 AC_DEFUN(wi_SNPRINTF_TERMINATES, [
408 if test "$ac_cv_func_snprintf" != "no" ; then
409 AC_MSG_CHECKING(if snprintf always NUL terminates)
410 if test "$ac_cv_func_snprintf" = "no" ; then
411 AC_CHECK_LIB(snprintf,snprintf)
423 for (i=0; i<(int)(sizeof(s)/sizeof(char)); i++)
425 result = (int) snprintf(s, sizeof(s), "%s %s!", "hello", "world");
426 if (s[sizeof(s) - 1] == '\0')
433 wi_cv_snprintf_terminates=no
434 AC_DEFINE(SNPRINTF_TERMINATES)
438 wi_cv_snprintf_terminates=yes
441 # action if cross compiling
442 wi_cv_snprintf_terminates=no
451 AC_DEFUN(wi_SNPRINTF, [
453 dnl Uncache these -- config.cache doesn't cache it right for this case.
454 unset ac_cv_func_snprintf
455 unset ac_cv_func_vsnprintf
457 AC_CHECK_FUNCS(snprintf vsnprintf)
458 wi_SNPRINTF_TERMINATES
460 AC_CHECK_HEADERS(snprintf.h)
466 AC_DEFUN(wi_HEADER_HPSECURITY_H, [
467 AC_MSG_CHECKING(for hpsecurity.h)
468 wi_cv_header_hpsecurity_h=no
469 if test -f /usr/include/hpsecurity.h ; then
470 wi_cv_header_hpsecurity_h=yes
471 AC_DEFINE(HAVE_HPSECURITY_H)
473 AC_MSG_RESULT($wi_cv_header_hpsecurity_h)
478 AC_DEFUN(wi_HEADER_SYS_SELECT_H, [
479 # See if <sys/select.h> is includable after <sys/time.h>
480 if test "$ac_cv_header_sys_time_h" = no ; then
481 AC_CHECK_HEADERS(sys/time.h sys/select.h)
483 AC_CHECK_HEADERS(sys/select.h)
485 if test "$ac_cv_header_sys_select_h" = yes ; then
486 AC_MSG_CHECKING([if <sys/select.h> is compatible with <sys/time.h>])
488 if test "$ac_cv_header_sys_time_h" = yes ; then
490 #if defined(_AIX) || defined(__aix) || defined(__AIX)
491 # define _ALL_SOURCE 1
496 #include <sys/types.h>
497 #include <sys/time.h>
498 #include <sys/select.h>],[
500 struct timeval tmval;
502 tmval.tv_sec = 0;],selecth=yes,selecth=no)
504 if test "$selecth" = yes ; then
505 AC_DEFINE(CAN_USE_SYS_SELECT_H)
507 AC_MSG_RESULT($selecth)
513 AC_DEFUN(wi_LIB_44BSD, [
514 AC_CHECK_FUNC(strerror,[a=yes],[a=no])
515 if test "$a" = no ; then
516 # Not in libc, try lib44bsd.
517 AC_CHECK_LIB(44bsd,strerror)
523 AC_DEFUN(wi_LIB_NSL, [
524 dnl Note: Check for socket lib first, then nsl.
528 # HP-UX 11 uses NSL for YP services
529 AC_CHECK_LIB(nsl,getpwent)
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)
545 AC_DEFUN(wi_LIB_SOCKET, [
546 AC_CHECK_FUNC(socket,[a=yes],[a=no])
547 if test "$a" = no ; then
548 # Not in libc, try libsocket.
549 AC_CHECK_LIB(socket,socket)
555 AC_DEFUN(wi_LIB_RESOLV, [
556 # See if we could access two well-known sites without help of any special
557 # libraries, like resolv.
559 AC_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.])
561 AC_MSG_CHECKING([if we need to look for -lresolv])
563 #include <sys/types.h>
564 #include <sys/socket.h>
565 #include <netinet/in.h>
570 struct hostent *hp1, *hp2;
573 hp1 = gethostbyname("gatekeeper.dec.com");
574 hp2 = gethostbyname("ftp.ncsa.uiuc.edu");
575 result = ((hp1 != (struct hostent *) 0) && (hp2 != (struct hostent *) 0));
577 }],look_for_resolv=no,look_for_resolv=yes,look_for_resolv=yes)
579 AC_MSG_RESULT($look_for_resolv)
580 if test "$look_for_resolv" = yes ; then
581 AC_CHECK_LIB(resolv,main)
589 AC_DEFUN(wi_LIB_TCP_WRAPPERS, [
590 AC_MSG_CHECKING([for tcp wrappers library (libwrap)])
597 #include <sys/types.h>
600 /* These are needed if libwrap.a was compiled with
601 * PROCESS_OPTIONS defined.
603 int allow_severity = 1; /* arbitrary for this test */
604 int deny_severity = 2; /* arbitrary for this test */
608 exit((allow_severity == deny_severity) ? 1 : 0);
610 dnl ...Don't bother defining this symbol...
611 dnl ...Check for tcpd.h instead...
612 dnl AC_DEFINE(HAVE_LIBWRAP)
614 dnl ...Don't modify LIBS, instead set WRAPLIB...
615 dnl LIBS="-lwrap $LIBS"
618 wi_cv_lib_wrap_hosts_access=yes
621 wi_cv_lib_wrap_hosts_access=no
623 AC_MSG_RESULT($wi_cv_lib_wrap_hosts_access)
628 AC_DEFUN(wi_NET_LIBS, [
629 # Mostly for SunOS 4 -- needs to come first because other libs depend on it
634 if test "$SYS" = unixware ; then
635 # So far, only UnixWare needs this.
636 AC_CHECK_LIB(gen,syslog)
640 if test -f /usr/ucblib/libucb.a ; then
641 LDFLAGS="$LDFLAGS -L/usr/ucblib"
644 if test -f /usr/include/unistd.h ; then
645 ac_cv_header_unistd_h=yes
648 # UnixWare 2 needs both lsocket and lnsl, and configure
649 # script won't detect this condition properly because
650 # the libraries are interdependent.
652 LIBS="$LIBS -lsocket -lnsl"
654 # Now look for socket()
656 # AC_CHECK_FUNC(socket,[a=yes],[a=no])
658 AC_CHECK_FUNC(socket,[a=yes],[a=no])
665 dnl AC_CHECK_LIB(inet,main)
670 if test "$SYS" = dynixptx ; then
671 LIBS="$LIBS -lsocket -lnsl"
679 AC_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.
682 unam=`uname -a 2>/dev/null | cut -c1-127`
683 if test "$unam" != "" ; then
684 AC_DEFINE_UNQUOTED(UNAME, "$unam")
690 AC_DEFUN(wi_FUNC_SIGSETJMP, [
691 AC_MSG_CHECKING([for sigsetjmp and siglongjmp])
698 #include <sys/types.h>
706 if (sigsetjmp(sjb, 1) != 0)
707 siglongjmp(sjb, 1); /* bogus code, of course. */
710 AC_DEFINE(HAVE_SIGSETJMP)
711 wi_cv_func_sigsetjmp=yes
713 wi_cv_func_sigsetjmp=no
715 AC_MSG_RESULT($wi_cv_func_sigsetjmp)
720 AC_DEFUN(wi_UTMP_UT_NAME, [
721 AC_MSG_CHECKING([for ut_name field in struct utmp])
725 #include <sys/types.h>
731 exit(((int) &u.ut_name) & 0xff); /* bogus code, of course. */
733 wi_cv_utmp_ut_name=yes
734 AC_DEFINE(HAVE_UTMP_UT_NAME)
736 wi_cv_utmp_ut_name=no
738 AC_MSG_RESULT($wi_cv_utmp_ut_name)
743 AC_DEFUN(wi_UTMPX_UT_SYSLEN, [
744 AC_MSG_CHECKING([for ut_syslen field in struct utmpx])
748 #include <sys/types.h>
754 exit(((int) &u.ut_syslen) & 0xff); /* bogus code, of course. */
756 wi_cv_utmpx_ut_syslen=yes
757 AC_DEFINE(HAVE_UTMPX_UT_SYSLEN)
759 wi_cv_utmpx_ut_syslen=no
761 AC_MSG_RESULT($wi_cv_utmpx_ut_syslen)
766 AC_DEFUN(wi_UTMP_UT_USER, [
767 AC_MSG_CHECKING([for ut_user field in struct utmp])
771 #include <sys/types.h>
777 exit(((int) &u.ut_user) & 0xff); /* bogus code, of course. */
779 wi_cv_utmp_ut_user=yes
780 AC_DEFINE(HAVE_UTMP_UT_USER)
782 wi_cv_utmp_ut_user=no
784 AC_MSG_RESULT($wi_cv_utmp_ut_user)
789 AC_DEFUN(wi_UTMP_UT_PID, [
790 AC_MSG_CHECKING([for ut_pid field in struct utmp])
794 #include <sys/types.h>
800 exit(((int) &u.ut_pid) & 0xff); /* bogus code, of course. */
802 wi_cv_utmp_ut_pid=yes
803 AC_DEFINE(HAVE_UTMP_UT_PID)
807 AC_MSG_RESULT($wi_cv_utmp_ut_pid)
813 AC_DEFUN(wi_UTMP_UT_TIME, [
814 AC_MSG_CHECKING([for ut_time field in struct utmp])
818 #include <sys/types.h>
824 exit(((int) &u.ut_time) & 0xff); /* bogus code, of course. */
826 wi_cv_utmp_ut_time=yes
827 AC_DEFINE(HAVE_UTMP_UT_TIME)
829 wi_cv_utmp_ut_time=no
831 AC_MSG_RESULT($wi_cv_utmp_ut_time)
836 AC_DEFUN(wi_UTMP_UT_HOST, [
837 AC_MSG_CHECKING([for ut_host field in struct utmp])
841 #include <sys/types.h>
847 exit(((int) &u.ut_host) & 0xff); /* bogus code, of course. */
849 wi_cv_utmp_ut_host=yes
850 AC_DEFINE(HAVE_UTMP_UT_HOST)
852 wi_cv_utmp_ut_host=no
854 AC_MSG_RESULT($wi_cv_utmp_ut_host)
859 AC_DEFUN(wi_STRUCT_STAT64, [
860 AC_MSG_CHECKING([for struct stat64])
864 #include <sys/types.h>
865 #include <sys/stat.h>
870 exit(((int) &st.st_size) & 0xff); /* bogus code, of course. */
872 wi_cv_struct_stat64=yes
873 AC_DEFINE(HAVE_STRUCT_STAT64)
875 wi_cv_struct_stat64=no
877 AC_MSG_RESULT($wi_cv_struct_stat64)
882 AC_DEFUN(wi_STRUCT_CMSGHDR, [
883 AC_MSG_CHECKING([for struct cmsghdr])
887 #include <sys/types.h>
889 #include <sys/socket.h>
897 exit(((int) &cm.cmsg_type) & 0xff); /* bogus code, of course. */
899 wi_cv_struct_cmsghdr=yes
900 AC_DEFINE(HAVE_STRUCT_CMSGDHR)
902 wi_cv_struct_cmsghdr=no
904 AC_MSG_RESULT($wi_cv_struct_cmsghdr)
909 AC_DEFUN(wi_MSGHDR_CONTROL, [
910 AC_MSG_CHECKING([for msg_control field in struct msghdr])
914 #include <sys/types.h>
916 #include <sys/socket.h>
922 m.msg_controllen = sizeof(m);
923 exit(((int) &m.msg_control) & 0xff); /* bogus code, of course. */
925 wi_cv_msghdr_control=yes
926 AC_DEFINE(HAVE_MSGHDR_CONTROL)
928 wi_cv_msghdr_control=no
930 AC_MSG_RESULT($wi_cv_msghdr_control)
935 AC_DEFUN(wi_MSGHDR_ACCRIGHTS, [
936 AC_MSG_CHECKING([for msg_accrights field in struct msghdr])
940 #include <sys/types.h>
942 #include <sys/socket.h>
947 m.msg_accrights = &m;
948 m.msg_accrightslen = sizeof(m);
949 exit(((int) &m.msg_accrights) & 0xff); /* bogus code, of course. */
951 wi_cv_msghdr_accrights=yes
952 AC_DEFINE(HAVE_MSGHDR_ACCRIGHTS)
954 wi_cv_msghdr_accrights=no
956 AC_MSG_RESULT($wi_cv_msghdr_accrights)
961 AC_DEFUN(wi_PR_PASSWD_FG_OLDCRYPT, [
962 AC_MSG_CHECKING([for fg_oldcrypt field in struct pr_passwd])
966 #include <sys/types.h>
967 #include <sys/stat.h>
975 #if defined(HAVE_USERPW_H) && defined(HAVE_GETUSERPW) /* AIX */
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>
983 #elif defined(HAVE_GETESPWNAM) /* Digital UNIX 4 */
984 # ifdef HAVE_SYS_SECDEFINES_H
985 # include <sys/secdefines.h>
987 # ifdef HAVE_SYS_SECURITY_H
988 # include <sys/security.h>
990 # ifdef HAVE_SYS_AUDIT_H
991 # include <sys/audit.h>
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>
1003 # ifdef HAVE_SYS_SECURITY_H
1004 # include <sys/security.h>
1006 # ifdef HAVE_SYS_AUDIT_H
1007 # include <sys/audit.h>
1009 # ifdef HAVE_HPSECURITY_H
1010 # include <hpsecurity.h>
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 */
1026 wi_cv_pr_passwd_fg_oldcrypt=yes
1027 AC_DEFINE(HAVE_PR_PASSWD_FG_OLDCRYPT)
1029 wi_cv_pr_passwd_fg_oldcrypt=no
1031 AC_MSG_RESULT($wi_cv_pr_passwd_fg_oldcrypt)
1036 AC_DEFUN(wi_SOCKADDR_UN_SUN_LEN, [
1037 AC_MSG_CHECKING([for sun_len field in struct sockaddr_un])
1041 #include <sys/types.h>
1042 #include <sys/uio.h>
1043 #include <sys/socket.h>
1046 struct sockaddr_un uaddr;
1048 uaddr.sun_len = strlen("/tmp/test.sock");
1049 exit(((int) uaddr.sun_len); /* bogus code, of course. */
1051 wi_cv_sockaddr_un_sun_len=yes
1052 AC_DEFINE(HAVE_SOCKADDR_UN_SUN_LEN)
1054 wi_cv_sockaddr_un_sun_len=no
1056 AC_MSG_RESULT($wi_cv_sockaddr_un_sun_len)
1061 AC_DEFUN(wi_STATFS_F_BAVAIL, [
1062 AC_MSG_CHECKING([for f_bavail field in struct statfs])
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>
1076 exit((int) st.f_bavail); /* bogus code, of course. */
1078 wi_cv_statfs_f_bavail=yes
1079 AC_DEFINE(HAVE_STATFS_F_BAVAIL)
1081 wi_cv_statfs_f_bavail=no
1083 AC_MSG_RESULT($wi_cv_statfs_f_bavail)
1088 AC_DEFUN(wi_SPRINTF_RETVAL, [
1089 AC_MSG_CHECKING([what sprintf() returns])
1100 result = (int) sprintf(s, "%d", 22);
1108 wi_cv_sprintf_returns_ptr=no
1109 x="length of data written";
1112 wi_cv_sprintf_returns_ptr=yes
1113 AC_DEFINE(SPRINTF_RETURNS_PTR)
1114 x="pointer to data";
1116 # action if cross compiling
1117 wi_cv_sprintf_returns_ptr=no
1125 AC_DEFUN(wi_LIB_CRYPT, [
1126 AC_MSG_CHECKING([which library has usable crypt() function])
1127 ac_save_LIBS="$LIBS"
1130 for lib in "c" "crypt" "descrypt" "des"
1133 if test "$lib" = "c" ; then
1134 LIBS="$ac_save_LIBS"
1136 LIBS="$ac_save_LIBS -l${lib}"
1144 extern char *crypt(const char *key, const char *salt);
1148 char cleartext[256];
1151 memset(cleartext, 0, sizeof(cleartext));
1152 strcpy(cleartext, "password");
1154 cp = crypt(cleartext, "xx");
1155 if ((cp != NULL) && (strcmp(cp, "xxj31ZMTZzkVA") == 0)) {
1156 /* printf("PASS\n"); */
1159 /* printf("FAIL\n"); */
1169 # action if cross compiling
1174 if test "$crypt_lib" != NONE ; then
1181 LIBS="$ac_save_LIBS"
1183 if test "$crypt_lib" = NONE ; then
1185 AC_MSG_RESULT([none?])
1187 AC_MSG_RESULT([lib${crypt_lib}])
1189 if test "$crypt_lib" != c ; then
1190 AC_CHECK_LIB(${lib},crypt)
1197 changequote(<^, ^>)dnl
1198 changequote([, ])dnl
1203 AC_DEFUN(wi__RES_DEFDNAME, [
1204 AC_MSG_CHECKING([for useable _res global variable])
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>
1216 #ifdef HAVE_RESOLV_H
1217 # include <resolv.h>
1224 len = (int) strlen(_res.defdname);
1226 wi_cv__res_defdname=yes
1227 AC_DEFINE(HAVE__RES_DEFDNAME)
1229 wi_cv__res_defdname=no
1231 AC_MSG_RESULT($wi_cv__res_defdname)
1237 AC_DEFUN(wi_TYPE_SIG_ATOMIC_T, [
1238 AC_MSG_CHECKING([for sig_atomic_t])
1241 #ifdef HAVE_UNISTD_H
1244 #include <sys/types.h>
1245 #include <sys/signal.h>
1246 #include <signal.h> /* MG: for IRIX */
1253 sig_atomic_t sample;
1255 sample = (sig_atomic_t) getpid(); /* bogus code, of course */
1256 exit((sample > 0) ? 0 : 1);
1258 ac_cv_type_sig_atomic_t=yes
1260 ac_cv_type_sig_atomic_t=no
1262 AC_MSG_RESULT($ac_cv_type_sig_atomic_t)
1263 if test $ac_cv_type_sig_atomic_t = no ; then
1264 AC_DEFINE(sig_atomic_t, int)
1271 AC_DEFUN(wi_LIB_READLINE, [
1272 AC_MSG_CHECKING([for GNU Readline library, version 2.0 or newer])
1274 wi_cv_lib_readline=no
1275 wi_cv_lib_readline_result=no
1276 ac_save_LIBS="$LIBS"
1277 # Note: $LIBCURSES is permitted to be empty.
1278 for LIBREADLINE in "-lreadline" "-lreadline $LIBCURSES" "-lreadline -ltermcap" "-lreadline -lncurses" "-lreadline -lcurses"
1280 LIBS="$ac_save_LIBS $LIBREADLINE"
1286 main(int argc, char **argv)
1288 /* Note: don't actually call readline, since it may block;
1289 * We just want to see if it (dynamic) linked in okay.
1291 if (argc == 0) /* never true */
1297 wi_cv_lib_readline=yes
1300 wi_cv_lib_readline=no
1302 # action if cross compiling
1303 wi_cv_lib_readline=no
1306 if test "$wi_cv_lib_readline" = yes ; then break ; fi
1309 # Now try it again, to be sure it is recent enough.
1310 # rl_function_of_keyseq appeared in version 2.0
1312 dnl AC_CHECK_FUNC(rl_function_of_keyseq, [wi_cv_lib_readline=yes],[
1313 dnl wi_cv_lib_readline=no;wi_cv_lib_readline_result="no (it is present but too old to use)"
1320 rl_function_of_keyseq(0);
1322 wi_cv_lib_readline=yes
1324 wi_cv_lib_readline=no
1325 wi_cv_lib_readline_result="no (it is present but too old to use)"
1328 if test "$wi_cv_lib_readline" = no ; then
1331 LIBS="$ac_save_LIBS"
1333 /bin/rm -f readline.ver
1339 #include <sys/types.h>
1342 extern char *rl_library_version;
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);
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
1364 rl_library_version=''
1366 /bin/rm -f readline.ver
1368 # action if cross compiling
1369 rl_library_version=''
1371 /bin/rm -f readline.ver
1376 wi_cv_lib_readline_result="yes, installed version is $rl_library_version"
1379 # Test using current LIBS.
1382 extern int rl_completion_append_character;
1386 rl_completion_append_character = 0;
1393 if test "$rlver" = "210" ; then
1394 wi_cv_lib_readline_result="yes, version 2.1 or higher"
1396 wi_cv_lib_readline_result="yes, version 2.0"
1401 wi_cv_lib_readline=yes
1403 LIBS="$ac_save_LIBS"
1405 AC_MSG_RESULT($wi_cv_lib_readline_result)
1406 AC_SUBST(LIBREADLINE)
1408 if test "$wi_cv_lib_readline" = yes ; then
1409 # Now verify that all the headers are installed.
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])
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"
1426 if test "$xxwi" = no ; then
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)"
1436 AC_DEFINE_UNQUOTED(HAVE_LIBREADLINE, $rlver)
1443 AC_DEFUN(wi_USE_LONG_LONG, [
1444 AC_MSG_CHECKING([for 64-bit integral type: long long])
1449 #include <sys/types.h>
1452 long long hugeNumvar = 1;
1456 long long hugeNumtoo = 2;
1458 if (hugeNumtoo > hugeNumvar)
1460 if (sizeof(hugeNumvar) < 8)
1467 wi_cv_type_long_long=yes
1468 LONGEST_INT="long long"
1471 wi_cv_type_long_long=no
1473 # action if cross compiling
1474 wi_cv_type_long_long=no
1476 AC_MSG_RESULT($wi_cv_type_long_long)
1478 if test "$wi_cv_type_long_long" = yes ; then
1480 AC_MSG_CHECKING([how to print a 64-bit integral type])
1481 wi_cv_printf_long_long=fail
1486 #include <sys/types.h>
1496 hugeNum = (long long) 1000000000;
1497 hugeNum = hugeNum * (long long) 99;
1498 hugeNum = hugeNum + (long long) 1;
1500 (void) sprintf(s, "%lld", hugeNum);
1501 exit((strcmp(s, "99000000001") == 0) ? 0 : 1);
1505 wi_cv_printf_long_long="%lld"
1510 # action if cross compiling
1515 if test "$wi_cv_printf_long_long" = fail ; then
1520 #include <sys/types.h>
1530 hugeNum = (long long) 1000000000;
1531 hugeNum = hugeNum * (long long) 99;
1532 hugeNum = hugeNum + (long long) 1;
1534 (void) sprintf(s, "%qd", hugeNum);
1535 exit((strcmp(s, "99000000001") == 0) ? 0 : 1);
1539 wi_cv_printf_long_long="%qd"
1544 # action if cross compiling
1549 if test "$wi_cv_printf_long_long" = fail ; then
1550 wi_cv_printf_long_long_msg_result='cannot print'
1552 wi_cv_printf_long_long_msg_result="$wi_cv_printf_long_long"
1555 AC_MSG_RESULT($wi_cv_printf_long_long_msg_result)
1558 AC_MSG_CHECKING([how to scan a 64-bit integral type])
1559 wi_cv_scanf_long_long=fail
1564 #include <sys/types.h>
1571 long long hugeNum, justAsHugeNum;
1573 hugeNum = (long long) 1000000000;
1574 hugeNum = hugeNum * (long long) 99;
1575 hugeNum = hugeNum + (long long) 1;
1577 justAsHugeNum = (long long) 0;
1579 sscanf("99000000001", "%lld", &justAsHugeNum);
1580 if (memcmp(&hugeNum, &justAsHugeNum, sizeof(hugeNum)) == 0)
1586 wi_cv_scanf_long_long="%lld"
1591 # action if cross compiling
1596 if test "$wi_cv_scanf_long_long" = fail ; then
1601 #include <sys/types.h>
1608 long long hugeNum, justAsHugeNum;
1610 hugeNum = (long long) 1000000000;
1611 hugeNum = hugeNum * (long long) 99;
1612 hugeNum = hugeNum + (long long) 1;
1614 justAsHugeNum = (long long) 0;
1616 sscanf("99000000001", "%qd", &justAsHugeNum);
1617 if (memcmp(&hugeNum, &justAsHugeNum, sizeof(hugeNum)) == 0)
1623 wi_cv_scanf_long_long="%qd"
1628 # action if cross compiling
1633 if test "$wi_cv_scanf_long_long" = fail ; then
1634 wi_cv_scanf_long_long_msg_result='cannot scan'
1636 wi_cv_scanf_long_long_msg_result="$wi_cv_scanf_long_long"
1639 AC_MSG_RESULT($wi_cv_scanf_long_long_msg_result)
1643 AC_MSG_CHECKING([if everything was available to use the 64-bit integral type])
1645 if 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"
1651 elif 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"
1657 elif 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"
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.
1669 wi_cv_printf_long_long="%qd"
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)
1676 AC_DEFINE(PRINTF_LONG_LONG_LLD)
1678 if test "$wi_cv_scanf_long_long" = "%qd" ; then
1679 AC_DEFINE(SCANF_LONG_LONG_QD)
1681 AC_DEFINE(SCANF_LONG_LONG_LLD)
1683 wi_cv_use_long_long="yes"
1684 wi_cv_use_long_long_msg_result="yes"
1686 AC_MSG_RESULT($wi_cv_use_long_long_msg_result)
1692 AC_DEFUN(wi_CREATE_TAR_FILES, [
1693 AC_MSG_CHECKING([how to create TAR files])
1694 changequote(<<, >>)dnl
1696 if [ ! -f /usr/bin/tar ] && [ -f /bin/tar ] ; then
1700 if [ -x /usr/bin/what ] ; then
1701 x=`/usr/bin/what "$TAR" 2>&1 | sed -n 's/.*pax.*/pax/g;/pax/p'`
1702 elif [ -x /bin/what ] ; then
1703 x=`/bin/what "$TAR" 2>&1 | sed -n 's/.*pax.*/pax/g;/pax/p'`
1705 if [ "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".
1709 x=`$TAR --help 2>&1 | sed -n 's/.*owner=NAME.*/owner=NAME/g;/owner=NAME/p'`
1713 TARFLAGS="-c --owner=root --group=bin --verbose -f"
1717 x2=`gtar --help 2>&1 | sed -n 's/.*owner=NAME.*/owner=NAME/g;/owner=NAME/p'`
1720 TARFLAGS="-c --owner=root --group=bin --verbose -f"
1726 changequote([, ])dnl
1729 AC_MSG_RESULT([$TAR $TARFLAGS])
1735 AC_DEFUN(wi_HEADER_CURSES, [
1736 AC_MSG_CHECKING([for curses library headers])
1737 if test "$nc_cv_ncurses" != "no" ; then
1738 AC_CHECK_HEADERS(ncurses.h curses.h)
1740 AC_CHECK_HEADERS(curses.h)
1742 dnl needed for Solaris 7
1743 if 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
1754 AC_DEFUN(wi_LIB_CURSES, [
1756 AC_MSG_CHECKING([for curses library])
1759 wi_cv_lib_curses_result=no
1760 ac_save_LIBS="$LIBS"
1761 for LIBCURSES in "-lncurses" "-lcurses" "-lcurses -ltermcap" "-ltermcap -lcurses"
1763 if test "x$LIBCURSES-$nc_cv_ncurses" = "x-lncurses-no" ; then
1764 # This should never work
1765 LIBCURSES="-lkdfjkdjfs"
1767 LIBS="$ac_save_LIBS $LIBCURSES"
1773 #ifdef HAVE_NCURSES_H
1774 # include <ncurses.h>
1776 # include <curses.h>
1780 main(int argc, char **argv)
1782 /* Note: don't actually call curses, since it may block;
1783 * We just want to see if it (dynamic) linked in okay.
1791 wi_cv_lib_curses=yes
1792 wi_cv_lib_curses_result="yes"
1797 # action if cross compiling
1801 if test "$wi_cv_lib_curses" = yes ; then break ; fi
1805 LIBS="$ac_save_LIBS"
1807 if test "$wi_cv_lib_curses_result" != "no" ; then
1808 case "$LIBCURSES" in
1810 AC_DEFINE(HAVE_LIBNCURSES)
1813 AC_DEFINE(HAVE_LIBCURSES)
1815 "-lcurses -ltermcap")
1816 AC_DEFINE(HAVE_LIBCURSES)
1818 "-ltermcap -lcurses")
1819 AC_DEFINE(HAVE_LIBCURSES)
1827 AC_MSG_RESULT([$wi_cv_lib_curses_result])
1833 AC_DEFUN(wi_CURSES_FEATURES, [
1834 if 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";
1841 AC_MSG_CHECKING([whether curses structure has maxx or _maxx field])
1844 #ifdef HAVE_UNISTD_H
1845 # include <unistd.h>
1847 #include <sys/types.h>
1852 #ifdef HAVE_NCURSES_H
1853 # include <ncurses.h>
1855 # include <curses.h>
1860 w = newwin(10, 10, 1, 1);
1863 AC_MSG_RESULT([maxx])
1865 AC_DEFINE(HAVE__MAXX)
1866 AC_MSG_RESULT([_maxx])
1869 AC_CHECK_FUNCS(__getmaxx __getmaxy __getbegx __getbegy)
1872 AC_MSG_CHECKING([for getbegx() functionality in curses library])
1875 #ifdef HAVE_UNISTD_H
1876 # include <unistd.h>
1878 #include <sys/types.h>
1883 #ifdef HAVE_NCURSES_H
1884 # include <ncurses.h>
1886 # include <curses.h>
1897 AC_DEFINE(HAVE_GETBEGX)
1898 AC_MSG_RESULT([yes])
1905 AC_MSG_CHECKING([for getmaxx() functionality in curses library])
1908 #ifdef HAVE_UNISTD_H
1909 # include <unistd.h>
1911 #include <sys/types.h>
1916 #ifdef HAVE_NCURSES_H
1917 # include <ncurses.h>
1919 # include <curses.h>
1929 AC_DEFINE(HAVE_GETMAXX)
1930 AC_MSG_RESULT([yes])
1936 AC_MSG_CHECKING([for getmaxyx() functionality in curses library])
1939 #ifdef HAVE_UNISTD_H
1940 # include <unistd.h>
1942 #include <sys/types.h>
1947 #ifdef HAVE_NCURSES_H
1948 # include <ncurses.h>
1950 # include <curses.h>
1957 getmaxyx(junk, my, mx);
1958 exit(my < 0 ? my : 0);
1960 AC_DEFINE(HAVE_GETMAXYX)
1961 AC_MSG_RESULT([yes])
1967 AC_MSG_CHECKING([for touchwin() functionality in curses library])
1970 #ifdef HAVE_UNISTD_H
1971 # include <unistd.h>
1973 #include <sys/types.h>
1978 #ifdef HAVE_NCURSES_H
1979 # include <ncurses.h>
1981 # include <curses.h>
1989 AC_DEFINE(HAVE_TOUCHWIN)
1990 AC_MSG_RESULT([yes])
1996 AC_MSG_CHECKING([for beep() functionality in curses library])
1999 #ifdef HAVE_UNISTD_H
2000 # include <unistd.h>
2002 #include <sys/types.h>
2007 #ifdef HAVE_NCURSES_H
2008 # include <ncurses.h>
2010 # include <curses.h>
2017 AC_DEFINE(HAVE_BEEP)
2018 AC_MSG_RESULT([yes])
2023 AC_CHECK_FUNCS(keypad nodelay curs_set doupdate wnoutrefresh)
2025 LIBS="$ac_save_LIBS";
2031 AC_DEFUN(wi_SHADOW_FUNCS, [
2032 AC_CHECK_FUNCS(md5_crypt md5crypt bcrypt getspnam)
2035 if 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)
2047 AC_CHECK_FUNCS(getuserpw)
2053 # C2: SCO Open Server 5; Digital UNIX
2054 AC_CHECK_FUNCS(set_auth_parameters bigcrypt)
2056 # C2: Digital UNIX 3.2, 4.0; SCO Open Server 5; HP-UX 11
2057 AC_CHECK_FUNCS(getprpwnam)
2060 AC_CHECK_FUNCS(getespwnam get_num_crypts get_crypt_name)
2063 AC_CHECK_FUNCS(dispcrypt)
2066 AC_CHECK_FUNCS(getpwanam)
2071 AC_DEFUN(wi_SHADOW_HEADERS, [
2072 AC_CHECK_HEADERS(shadow.h crypt.h)
2075 AC_CHECK_HEADERS(userpw.h)
2078 AC_CHECK_HEADERS(pwdadj.h)
2082 # Bug in header on these version 10 which cause is it not
2085 wi_HEADER_HPSECURITY_H
2087 # SCO Open Server, Digital UNIX
2088 AC_CHECK_HEADERS(sys/security.h sys/audit.h krb.h prot.h)
2091 AC_CHECK_HEADERS(sys/secdefines.h)
2094 wi_PR_PASSWD_FG_OLDCRYPT
2099 AC_DEFUN(wi_SHADOW_LIBS, [
2100 check_for_libcrypt=yes
2102 # AIX security library is libs.a
2103 AC_CHECK_LIB(s,getuserpw)
2104 if test "$ac_cv_lib_s" = yes ; then
2105 check_for_libcrypt=no
2106 elif test "$ac_cv_lib_s_getuserpw" = yes ; then
2107 check_for_libcrypt=no
2110 # SCO OpenServer 5 stuff for shadow password
2112 AC_CHECK_LIB(prot,getprpwnam)
2115 AC_CHECK_LIB(security,endprpwent)
2118 AC_CHECK_LIB(sec,getprpwnam)
2120 if test "$ac_cv_lib_sec_getprpwnam" = no ; then
2122 AC_CHECK_LIB(sec,getspnam)
2125 if test "$check_for_libcrypt" = yes ; then
2128 AC_CHECK_FUNCS(crypt)
2133 AC_DEFUN(wi_OS_VAR, [
2134 changequote(!@, @!)dnl
2135 if [ -x "$HOME/bin/OS" ] ; then
2136 HOME_OS=`$HOME/bin/OS`
2137 HOME_OS="$HOME/$HOME_OS"
2139 host=`uname -n 2>/dev/null | tr '[A-Z]' '[a-z]'`
2140 os=`uname -s 2>/dev/null | tr '[A-Z]' '[a-z]'`
2141 dnl work around inability to use $1
2142 os_v=`uname -v 2>/dev/null | sed 's/^[^0-9.]*//;s/[^0-9.]*$//;s/pre.*//;s/test.*//' | awk '-F[-/: ]' '{n = 1; print $n; }'`
2143 os_r=`uname -r 2>/dev/null | sed 's/^[^0-9.]*//;s/[^0-9.]*$//;s/pre.*//;s/test.*//' | awk '-F[-/: ]' '{n = 1; print $n; }'`
2144 os_r1=`echo "${os_r}" | cut -c1`
2145 arch=`uname -m 2>/dev/null | tr '[A-Z]' '[a-z]'`
2146 archp=`uname -p 2>/dev/null | tr '[A-Z]' '[a-z]'`
2151 # Special case a few systems where if your CFLAGS appear
2152 # to want to generate for 32 bit, use that mode rather
2155 case "$os,$CFLAGS" in
2158 # then go to regular "irix" instead of "irix64" below.
2166 OS="digitalunix${os_r}-$arch"
2170 OS="tru64unix${os_r}-$arch"
2174 NDEFS="$NDEFS -DDIGITAL_UNIX=$os_r1"
2177 OS="aix${os_v}.${os_r}"
2179 NDEFS="$NDEFS -DAIX=${os_v}"
2184 NDEFS="$NDEFS -DIRIX=$os_r1"
2189 NDEFS="$NDEFS -DIRIX=$os_r1 -DIRIX64=$os_r1"
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"`
2198 NDEFS="$NDEFS -DHPUX=$os_int"
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"`
2208 NDEFS="$NDEFS -DFREEBSD=$os_int"
2211 OS="netbsd${os_r}-$arch"
2212 NDEFS="$NDEFS -DNETBSD=$os_r1"
2216 OS="openbsd${os_r}-$arch"
2218 NDEFS="$NDEFS -DOPENBSD=$os_r1"
2223 NDEFS="$NDEFS -DSCO=$os_r1"
2226 OS="dynixptx${os_v}"
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"
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"
2249 vertest="./vertest.$$"
2250 /bin/rm -f "$vertest" "$vertest.c"
2251 cat <<EOF > "$vertest.c"
2253 #include <gnu/libc-version.h>
2257 const char *ver = gnu_get_libc_version();
2258 const char *rel = gnu_get_libc_release();
2260 fprintf(stdout, "glibc%s\n", ver);
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"
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}"
2283 if test -f /lib/libc-2.2.2.so ; then
2284 NDEFS="$NDEFS -DLINUX_GLIBC=22002"
2287 elif test -f /lib/libc-2.2.1.so ; then
2288 NDEFS="$NDEFS -DLINUX_GLIBC=22001"
2291 elif test -f /lib/libc-2.2.0.so ; then
2292 NDEFS="$NDEFS -DLINUX_GLIBC=22000"
2295 elif test -f /lib/libc-2.1.3.so ; then
2296 NDEFS="$NDEFS -DLINUX_GLIBC=21003"
2299 elif test -f /lib/libc-2.1.2.so ; then
2300 NDEFS="$NDEFS -DLINUX_GLIBC=21002"
2303 elif test -f /lib/libc-2.1.1.so ; then
2304 NDEFS="$NDEFS -DLINUX_GLIBC=21001"
2307 elif test -f /lib/libc.so.6 ; then
2308 NDEFS="$NDEFS -DLINUX_GLIBC=20000"
2311 elif test -f /lib/libc.so.6.1 ; then
2312 NDEFS="$NDEFS -DLINUX_GLIBC=20001"
2316 NDEFS="$NDEFS -DLINUX_LIBC=5"
2328 NDEFS="$NDEFS -DBSDOS=$os_r1"
2335 OS="unixware${os_v}"
2338 macos*|darwin|rhapsody)
2343 if [ "$arch" = "" ] ; then arch="sparc" ; fi
2344 if [ "$archp" = "" ] ; then archp="$arch" ; fi
2347 os_r=`echo "$os_r" | cut -c3-`
2348 OS="solaris${os_r}-$archp"
2349 NDEFS="$NDEFS -DSOLARIS=\\\"$os_r\\\""
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\\\""
2362 OS="sunos${os_r}-sparc"
2363 NDEFS="$NDEFS -DSUNOS=\\\"$os_r\\\""
2367 OS="solaris${os_r}-$archp"
2368 NDEFS="$NDEFS -DSOLARIS=\\\"$os_r\\\""
2377 if grep Novell /usr/include/sys/types.h ; then
2378 OS="unixware${os_v}"