delete .cvsignore
[reactos.git] / rosapps / net / ncftp / autoconf / aclocal.m4
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.
5 #
6 DEBUGBUILD=no
7 DEBUGCONFIGUREFLAG=""
8 AC_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 ])
18 dnl
19 dnl
20 dnl
21 dnl
22 AC_DEFUN(wi_EXTRA_IDIR, [
23 incdir="$1"
24 if 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
38 fi
39 ])
40 dnl
41 dnl
42 dnl
43 dnl
44 AC_DEFUN(wi_PROG_TAR, [
45 TAR=""
46 AC_PATH_PROG(TAR, "tar")
47 if test -x "$TAR" ; then
48 AC_DEFINE_UNQUOTED(TAR, "$TAR")
49 fi
50 ])
51 dnl
52 dnl
53 dnl
54 dnl
55 AC_DEFUN(wi_EXTRA_LDIR, [
56 libdir="$1"
57 if 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
71 fi
72 ])
73 dnl
74 dnl
75 dnl
76 dnl
77 AC_DEFUN(wi_GNU_LD, [
78 AC_MSG_CHECKING([for GNU ld])
79 wi_cv_prog_ld="ld"
80 result="no"
81 x=`ld --version 2>/dev/null | fgrep GNU`
82 if test "$x" != "" ; then
83 wi_cv_prog_ld="gld"
84 result="yes"
85 fi
86 AC_MSG_RESULT($result)
87 ])
88 dnl
89 dnl
90 dnl
91 dnl
92 AC_DEFUN(wi_LD_READONLY_TEXT, [
93 if test "$SYS$wi_cv_prog_ld" = "linuxgld" ; then
94 LDFLAGS="$LDFLAGS -Xlinker -n"
95 fi
96 ])
97 dnl
98 dnl
99 dnl
100 dnl
101 AC_DEFUN(wi_EXTRA_SYSV_SUNOS_DIRS, [
102 AC_MSG_CHECKING([for System V compatibility directories])
103 AC_MSG_RESULT([])
104 wi_EXTRA_IDIR("/usr/5include")
105 wi_EXTRA_LDIR("/usr/5lib")
106 ])
107 dnl
108 dnl
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.
111 dnl
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.
114 dnl
115 AC_DEFUN(wi_EXTRA_DIRS, [
116 AC_MSG_CHECKING([for extra include and lib directories])
117 AC_MSG_RESULT([])
118 ifelse([$1], yes, [dnl
119 b1=`cd .. ; pwd`
120 b2=`cd ../.. ; pwd`
121 exdirs="$HOME $j $b1 $b2 $prefix $2"
122 if 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
128 fi
129 ],[dnl
130 exdirs="$prefix $2"
131 ])
132 subexdirs="$3"
133 if test "$subexdirs" = "" ; then
134 subexdirs="-"
135 fi
136 for subexdir in $subexdirs ; do
137 if test "$subexdir" = "-" ; then
138 subexdir=""
139 else
140 subexdir="/$subexdir"
141 fi
142 for 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
164 done
165 done
166 ])
167 dnl
168 dnl
169 dnl
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])
174 ac_cv_hpux_flags=no
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'`
181 changequote([, ])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.
198 changequote(<<, >>)dnl
199 x=`echo "$CFLAGS" | grep 'A[ae]' 2>/dev/null`
200 changequote([, ])dnl
201 if test "$x" = "" ; then
202 CFLAGS="$CFLAGS -Ae"
203 fi
204 fi
205 ac_cv_hpux_flags=yes
206 fi
207 AC_MSG_RESULT($ac_cv_hpux_flags)
208 ])
209 dnl
210 dnl
211 dnl
212 AC_DEFUN(wi_SFLAG, [AC_REQUIRE([AC_PROG_CC])
213 STRIP="strip"
214 if test "$SFLAG" = "" ; then
215 SFLAG="-s"
216 case "$OS" in
217 macosx*)
218 SFLAG='-Wl,-x'
219 ;;
220 esac
221 fi
222 #
223 # Was it ./configure --enable-debug ?
224 #
225 if test "$DEBUGBUILD" = yes ; then
226 SFLAG=""
227 STRIP=":"
228 fi
229 case "$CFLAGS" in
230 "-g"|"-g "*|*" -g"|*" -g "*|*"-g"[0-9]*)
231 # SFLAG="# $SFLAG"
232 SFLAG=""
233 STRIP=":"
234 ;;
235 esac
236 STRIPFLAG="$SFLAG"
237 ])
238 dnl
239 dnl
240 dnl
241 AC_DEFUN(wi_REQUEST_NO_Y2K_WARNINGS, [
242 wi_cv_request_no_y2k=yes
243 ])
244 dnl
245 dnl
246 dnl
247 AC_DEFUN(wi_CFLAGS_NO_Y2K_WARNINGS, [AC_REQUIRE([AC_PROG_CC])
248 if 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 #
259 AC_TRY_COMPILE([],[int junk;],[],[CFLAGS="$oldCFLAGS"])
260 unset oldCFLAGS
261 ;;
262 esac
263 fi
264 ])
265 dnl
266 dnl
267 dnl
268 AC_DEFUN(wi_CFLAGS, [AC_REQUIRE([AC_PROG_CC])
269 AC_REQUIRE_CPP()
270 wi_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
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/\ *$//;'`
281 changequote([, ])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 ])
306 dnl
307 dnl
308 dnl
309 AC_DEFUN(wi_CFLAGS_LFS64, [AC_REQUIRE([AC_PROG_CC])
310 AC_REQUIRE([wi_OS_VAR])
311 wi_CFLAGS
312 if 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
323 fi
324 case "$CFLAGS" in
325 *-D_LARGEFILE64_SOURCE*)
326 ;;
327 *)
328 CFLAGS="-D_LARGEFILE64_SOURCE $CFLAGS"
329 ;;
330 esac
331 AC_MSG_CHECKING([additional CFLAGS for LFS64 support])
332 AC_MSG_RESULT($CFLAGS)
333 ])
334 dnl
335 dnl
336 dnl
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)
342 ])
343 dnl
344 dnl
345 dnl
346 AC_DEFUN(wi_INSECURE_CHOWN, [
347 AC_MSG_CHECKING(if chown can be used to subvert security)
348 AC_TRY_RUN([
349 #include <sys/types.h>
350 #include <sys/stat.h>
351 #include <stdio.h>
352
353 main()
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
390 AC_MSG_RESULT($wi_cv_insecure_chown)
391 ])
392 dnl
393 dnl
394 dnl
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)
401 fi
402 fi
403 ])
404 dnl
405 dnl
406 dnl
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)
412 fi
413 AC_TRY_RUN([
414 /* program */
415 #include <stdio.h>
416 #include <string.h>
417
418 main()
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 ])
445 AC_MSG_RESULT($x)
446 fi
447 ])
448 dnl
449 dnl
450 dnl
451 AC_DEFUN(wi_SNPRINTF, [
452 wi_SPRINTF_RETVAL
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
456
457 AC_CHECK_FUNCS(snprintf vsnprintf)
458 wi_SNPRINTF_TERMINATES
459
460 AC_CHECK_HEADERS(snprintf.h)
461 wi_LIB_SNPRINTF
462 ])
463 dnl
464 dnl
465 dnl
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)
472 fi
473 AC_MSG_RESULT($wi_cv_header_hpsecurity_h)
474 ])
475 dnl
476 dnl
477 dnl
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)
482 else
483 AC_CHECK_HEADERS(sys/select.h)
484 fi
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>])
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)
508 fi
509 ])
510 dnl
511 dnl
512 dnl
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)
518 fi
519 ])
520 dnl
521 dnl
522 dnl
523 AC_DEFUN(wi_LIB_NSL, [
524 dnl Note: Check for socket lib first, then nsl.
525
526 case "$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 ;;
539 esac
540
541 ])
542 dnl
543 dnl
544 dnl
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)
550 fi
551 ])
552 dnl
553 dnl
554 dnl
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.
558 dnl
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.])
560 dnl
561 AC_MSG_CHECKING([if we need to look for -lresolv])
562 AC_TRY_RUN([
563 #include <sys/types.h>
564 #include <sys/socket.h>
565 #include <netinet/in.h>
566 #include <netdb.h>
567
568 main()
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
579 AC_MSG_RESULT($look_for_resolv)
580 if test "$look_for_resolv" = yes ; then
581 AC_CHECK_LIB(resolv,main)
582 else
583 ac_cv_lib_resolv=no
584 fi
585 ])
586 dnl
587 dnl
588 dnl
589 AC_DEFUN(wi_LIB_TCP_WRAPPERS, [
590 AC_MSG_CHECKING([for tcp wrappers library (libwrap)])
591
592 AC_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 */
603 int allow_severity = 1; /* arbitrary for this test */
604 int deny_severity = 2; /* arbitrary for this test */
605
606 ],[
607 /* function-body */
608 exit((allow_severity == deny_severity) ? 1 : 0);
609 ],[
610 dnl ...Don't bother defining this symbol...
611 dnl ...Check for tcpd.h instead...
612 dnl AC_DEFINE(HAVE_LIBWRAP)
613 dnl
614 dnl ...Don't modify LIBS, instead set WRAPLIB...
615 dnl LIBS="-lwrap $LIBS"
616 dnl
617 WRAPLIB="-lwrap"
618 wi_cv_lib_wrap_hosts_access=yes
619 ],[
620 WRAPLIB=""
621 wi_cv_lib_wrap_hosts_access=no
622 ])
623 AC_MSG_RESULT($wi_cv_lib_wrap_hosts_access)
624 ])
625 dnl
626 dnl
627 dnl
628 AC_DEFUN(wi_NET_LIBS, [
629 # Mostly for SunOS 4 -- needs to come first because other libs depend on it
630 wi_LIB_44BSD
631
632 wi_LIB_SOCKET
633
634 if 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
663 fi
664
665 dnl AC_CHECK_LIB(inet,main)
666
667 wi_LIB_NSL
668 wi_LIB_RESOLV
669
670 if test "$SYS" = dynixptx ; then
671 LIBS="$LIBS -lsocket -lnsl"
672 fi
673
674 ])
675 dnl
676 dnl
677 dnl
678 dnl
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")
685 fi
686 ])
687 dnl
688 dnl
689 dnl
690 AC_DEFUN(wi_FUNC_SIGSETJMP, [
691 AC_MSG_CHECKING([for sigsetjmp and siglongjmp])
692
693 AC_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 ])
715 AC_MSG_RESULT($wi_cv_func_sigsetjmp)
716 ])
717 dnl
718 dnl
719 dnl
720 AC_DEFUN(wi_UTMP_UT_NAME, [
721 AC_MSG_CHECKING([for ut_name field in struct utmp])
722 AC_TRY_LINK([
723 /* includes */
724 #include <unistd.h>
725 #include <sys/types.h>
726 #include <utmp.h>
727 ],[
728 struct utmp u;
729
730 u.ut_name[0] = '\0';
731 exit(((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 ])
738 AC_MSG_RESULT($wi_cv_utmp_ut_name)
739 ])
740 dnl
741 dnl
742 dnl
743 AC_DEFUN(wi_UTMPX_UT_SYSLEN, [
744 AC_MSG_CHECKING([for ut_syslen field in struct utmpx])
745 AC_TRY_LINK([
746 /* includes */
747 #include <unistd.h>
748 #include <sys/types.h>
749 #include <utmpx.h>
750 ],[
751 struct utmpx u;
752
753 u.ut_syslen = 0;
754 exit(((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 ])
761 AC_MSG_RESULT($wi_cv_utmpx_ut_syslen)
762 ])
763 dnl
764 dnl
765 dnl
766 AC_DEFUN(wi_UTMP_UT_USER, [
767 AC_MSG_CHECKING([for ut_user field in struct utmp])
768 AC_TRY_LINK([
769 /* includes */
770 #include <unistd.h>
771 #include <sys/types.h>
772 #include <utmp.h>
773 ],[
774 struct utmp u;
775
776 u.ut_user[0] = '\0';
777 exit(((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 ])
784 AC_MSG_RESULT($wi_cv_utmp_ut_user)
785 ])
786 dnl
787 dnl
788 dnl
789 AC_DEFUN(wi_UTMP_UT_PID, [
790 AC_MSG_CHECKING([for ut_pid field in struct utmp])
791 AC_TRY_LINK([
792 /* includes */
793 #include <unistd.h>
794 #include <sys/types.h>
795 #include <utmp.h>
796 ],[
797 struct utmp u;
798
799 u.ut_pid = 1;
800 exit(((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 ])
807 AC_MSG_RESULT($wi_cv_utmp_ut_pid)
808 ])
809
810 dnl
811 dnl
812 dnl
813 AC_DEFUN(wi_UTMP_UT_TIME, [
814 AC_MSG_CHECKING([for ut_time field in struct utmp])
815 AC_TRY_LINK([
816 /* includes */
817 #include <unistd.h>
818 #include <sys/types.h>
819 #include <utmp.h>
820 ],[
821 struct utmp u;
822
823 u.ut_time = 1;
824 exit(((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 ])
831 AC_MSG_RESULT($wi_cv_utmp_ut_time)
832 ])
833 dnl
834 dnl
835 dnl
836 AC_DEFUN(wi_UTMP_UT_HOST, [
837 AC_MSG_CHECKING([for ut_host field in struct utmp])
838 AC_TRY_LINK([
839 /* includes */
840 #include <unistd.h>
841 #include <sys/types.h>
842 #include <utmp.h>
843 ],[
844 struct utmp u;
845
846 u.ut_host[0] = '\0';
847 exit(((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 ])
854 AC_MSG_RESULT($wi_cv_utmp_ut_host)
855 ])
856 dnl
857 dnl
858 dnl
859 AC_DEFUN(wi_STRUCT_STAT64, [
860 AC_MSG_CHECKING([for struct stat64])
861 AC_TRY_LINK([
862 /* includes */
863 #include <unistd.h>
864 #include <sys/types.h>
865 #include <sys/stat.h>
866 ],[
867 struct stat64 st;
868
869 st.st_size = 0;
870 exit(((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 ])
877 AC_MSG_RESULT($wi_cv_struct_stat64)
878 ])
879 dnl
880 dnl
881 dnl
882 AC_DEFUN(wi_STRUCT_CMSGHDR, [
883 AC_MSG_CHECKING([for struct cmsghdr])
884 AC_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 ],[
892 struct cmsghdr cm;
893
894 cm.cmsg_len = 0;
895 cm.cmsg_level = 0;
896 cm.cmsg_type = 0;
897 exit(((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 ])
904 AC_MSG_RESULT($wi_cv_struct_cmsghdr)
905 ])
906 dnl
907 dnl
908 dnl
909 AC_DEFUN(wi_MSGHDR_CONTROL, [
910 AC_MSG_CHECKING([for msg_control field in struct msghdr])
911 AC_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 ],[
919 struct msghdr m;
920
921 m.msg_control = &m;
922 m.msg_controllen = sizeof(m);
923 exit(((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 ])
930 AC_MSG_RESULT($wi_cv_msghdr_control)
931 ])
932 dnl
933 dnl
934 dnl
935 AC_DEFUN(wi_MSGHDR_ACCRIGHTS, [
936 AC_MSG_CHECKING([for msg_accrights field in struct msghdr])
937 AC_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 ],[
945 struct msghdr m;
946
947 m.msg_accrights = &m;
948 m.msg_accrightslen = sizeof(m);
949 exit(((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 ])
956 AC_MSG_RESULT($wi_cv_msghdr_accrights)
957 ])
958 dnl
959 dnl
960 dnl
961 AC_DEFUN(wi_PR_PASSWD_FG_OLDCRYPT, [
962 AC_MSG_CHECKING([for fg_oldcrypt field in struct pr_passwd])
963 AC_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 ])
1031 AC_MSG_RESULT($wi_cv_pr_passwd_fg_oldcrypt)
1032 ])
1033 dnl
1034 dnl
1035 dnl
1036 AC_DEFUN(wi_SOCKADDR_UN_SUN_LEN, [
1037 AC_MSG_CHECKING([for sun_len field in struct sockaddr_un])
1038 AC_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 ],[
1046 struct sockaddr_un uaddr;
1047
1048 uaddr.sun_len = strlen("/tmp/test.sock");
1049 exit(((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 ])
1056 AC_MSG_RESULT($wi_cv_sockaddr_un_sun_len)
1057 ])
1058 dnl
1059 dnl
1060 dnl
1061 AC_DEFUN(wi_STATFS_F_BAVAIL, [
1062 AC_MSG_CHECKING([for f_bavail field in struct statfs])
1063 AC_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 ],[
1073 struct statfs st;
1074
1075 st.f_bavail = 1;
1076 exit((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 ])
1083 AC_MSG_RESULT($wi_cv_statfs_f_bavail)
1084 ])
1085 dnl
1086 dnl
1087 dnl
1088 AC_DEFUN(wi_SPRINTF_RETVAL, [
1089 AC_MSG_CHECKING([what sprintf() returns])
1090 AC_TRY_RUN([
1091 /* program */
1092 #include <stdio.h>
1093 #include <string.h>
1094
1095 main()
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 ])
1120 AC_MSG_RESULT($x)
1121 ])
1122 dnl
1123 dnl
1124 dnl
1125 AC_DEFUN(wi_LIB_CRYPT, [
1126 AC_MSG_CHECKING([which library has usable crypt() function])
1127 ac_save_LIBS="$LIBS"
1128 crypt_lib=NONE
1129
1130 for lib in "c" "crypt" "descrypt" "des"
1131 do
1132
1133 if test "$lib" = "c" ; then
1134 LIBS="$ac_save_LIBS"
1135 else
1136 LIBS="$ac_save_LIBS -l${lib}"
1137 fi
1138
1139 AC_TRY_RUN([
1140 /* program */
1141 #include <stdio.h>
1142 #include <string.h>
1143
1144 extern char *crypt(const char *key, const char *salt);
1145
1146 main()
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
1174 if test "$crypt_lib" != NONE ; then
1175 break
1176 fi
1177
1178 done
1179
1180
1181 LIBS="$ac_save_LIBS"
1182
1183 if test "$crypt_lib" = NONE ; then
1184 crypt_lib=c
1185 AC_MSG_RESULT([none?])
1186 else
1187 AC_MSG_RESULT([lib${crypt_lib}])
1188 fi
1189 if test "$crypt_lib" != c ; then
1190 AC_CHECK_LIB(${lib},crypt)
1191 fi
1192 ])
1193 dnl
1194 dnl
1195 dnl
1196 AC_DEFUN(wi_TEST, [
1197 changequote(<^, ^>)dnl
1198 changequote([, ])dnl
1199 ])
1200 dnl
1201 dnl
1202 dnl
1203 AC_DEFUN(wi__RES_DEFDNAME, [
1204 AC_MSG_CHECKING([for useable _res global variable])
1205 AC_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 ])
1231 AC_MSG_RESULT($wi_cv__res_defdname)
1232 ])
1233 dnl
1234 dnl
1235 dnl
1236 dnl
1237 AC_DEFUN(wi_TYPE_SIG_ATOMIC_T, [
1238 AC_MSG_CHECKING([for sig_atomic_t])
1239 AC_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 ])
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)
1265 fi
1266 ])
1267 dnl
1268 dnl
1269 dnl
1270 dnl
1271 AC_DEFUN(wi_LIB_READLINE, [
1272 AC_MSG_CHECKING([for GNU Readline library, version 2.0 or newer])
1273
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"
1279 do
1280 LIBS="$ac_save_LIBS $LIBREADLINE"
1281 AC_TRY_RUN([
1282 /* program */
1283 #include <stdio.h>
1284 #include <stdlib.h>
1285
1286 main(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
1307 done
1308
1309 # Now try it again, to be sure it is recent enough.
1310 # rl_function_of_keyseq appeared in version 2.0
1311 #
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)"
1314 dnl ])
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
1328 if test "$wi_cv_lib_readline" = no ; then
1329 LIBREADLINE=""
1330 # restore LIBS
1331 LIBS="$ac_save_LIBS"
1332 else
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
1342 extern char *rl_library_version;
1343
1344 main()
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"
1404 fi
1405 AC_MSG_RESULT($wi_cv_lib_readline_result)
1406 AC_SUBST(LIBREADLINE)
1407
1408 if 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
1438 fi
1439 ])
1440 dnl
1441 dnl
1442 dnl
1443 AC_DEFUN(wi_USE_LONG_LONG, [
1444 AC_MSG_CHECKING([for 64-bit integral type: long long])
1445 LONGEST_INT="long"
1446 AC_TRY_RUN([
1447 /* program */
1448 #include <unistd.h>
1449 #include <sys/types.h>
1450 #include <stdio.h>
1451
1452 long long hugeNumvar = 1;
1453
1454 main()
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 ])
1476 AC_MSG_RESULT($wi_cv_type_long_long)
1477
1478 if test "$wi_cv_type_long_long" = yes ; then
1479
1480 AC_MSG_CHECKING([how to print a 64-bit integral type])
1481 wi_cv_printf_long_long=fail
1482
1483 AC_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
1491 main()
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
1515 if test "$wi_cv_printf_long_long" = fail ; then
1516
1517 AC_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
1525 main()
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 ])
1547 fi
1548
1549 if test "$wi_cv_printf_long_long" = fail ; then
1550 wi_cv_printf_long_long_msg_result='cannot print'
1551 else
1552 wi_cv_printf_long_long_msg_result="$wi_cv_printf_long_long"
1553 fi
1554
1555 AC_MSG_RESULT($wi_cv_printf_long_long_msg_result)
1556
1557
1558 AC_MSG_CHECKING([how to scan a 64-bit integral type])
1559 wi_cv_scanf_long_long=fail
1560
1561 AC_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
1569 main()
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
1596 if test "$wi_cv_scanf_long_long" = fail ; then
1597
1598 AC_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
1606 main()
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 ])
1631 fi
1632
1633 if test "$wi_cv_scanf_long_long" = fail ; then
1634 wi_cv_scanf_long_long_msg_result='cannot scan'
1635 else
1636 wi_cv_scanf_long_long_msg_result="$wi_cv_scanf_long_long"
1637 fi
1638
1639 AC_MSG_RESULT($wi_cv_scanf_long_long_msg_result)
1640
1641 fi
1642
1643 AC_MSG_CHECKING([if everything was available to use the 64-bit integral type])
1644
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"
1650 LONGEST_INT="long"
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"
1656 LONGEST_INT="long"
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"
1662 LONGEST_INT="long"
1663 else
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"
1685 fi
1686 AC_MSG_RESULT($wi_cv_use_long_long_msg_result)
1687 ])
1688 dnl
1689 dnl
1690 dnl
1691 dnl
1692 AC_DEFUN(wi_CREATE_TAR_FILES, [
1693 AC_MSG_CHECKING([how to create TAR files])
1694 changequote(<<, >>)dnl
1695 TAR=/usr/bin/tar
1696 if [ ! -f /usr/bin/tar ] && [ -f /bin/tar ] ; then
1697 TAR=/bin/tar
1698 fi
1699 x=""
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'`
1704 fi
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".
1708 #
1709 x=`$TAR --help 2>&1 | sed -n 's/.*owner=NAME.*/owner=NAME/g;/owner=NAME/p'`
1710 fi
1711 case "$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 ;;
1725 esac
1726 changequote([, ])dnl
1727 AC_SUBST(TARFLAGS)
1728 AC_SUBST(TAR)
1729 AC_MSG_RESULT([$TAR $TARFLAGS])
1730 ])
1731 dnl
1732 dnl
1733 dnl
1734 dnl
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)
1739 else
1740 AC_CHECK_HEADERS(curses.h)
1741 fi
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
1747 fi
1748 fi
1749 ])
1750 dnl
1751 dnl
1752 dnl
1753 dnl
1754 AC_DEFUN(wi_LIB_CURSES, [
1755 wi_HEADER_CURSES
1756 AC_MSG_CHECKING([for curses library])
1757
1758 wi_cv_lib_curses=no
1759 wi_cv_lib_curses_result=no
1760 ac_save_LIBS="$LIBS"
1761 for LIBCURSES in "-lncurses" "-lcurses" "-lcurses -ltermcap" "-ltermcap -lcurses"
1762 do
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
1780 main(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
1802 done
1803
1804 # restore LIBS
1805 LIBS="$ac_save_LIBS"
1806
1807 if 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
1822 else
1823 LIBCURSES=''
1824 fi
1825
1826 AC_SUBST(LIBCURSES)
1827 AC_MSG_RESULT([$wi_cv_lib_curses_result])
1828 ])
1829 dnl
1830 dnl
1831 dnl
1832 dnl
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";
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 ],[
1863 AC_MSG_RESULT([maxx])
1864 ],[
1865 AC_DEFINE(HAVE__MAXX)
1866 AC_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";
2026 fi
2027 ])
2028 dnl
2029 dnl
2030 dnl
2031 AC_DEFUN(wi_SHADOW_FUNCS, [
2032 AC_CHECK_FUNCS(md5_crypt md5crypt bcrypt getspnam)
2033
2034 # UnixWare 7
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)
2040 fi
2041 fi
2042
2043 # AIX
2044 #
2045 case "$SYS" in
2046 "aix"|"")
2047 AC_CHECK_FUNCS(getuserpw)
2048 ;;
2049 *)
2050 ;;
2051 esac
2052
2053 # C2: SCO Open Server 5; Digital UNIX
2054 AC_CHECK_FUNCS(set_auth_parameters bigcrypt)
2055
2056 # C2: Digital UNIX 3.2, 4.0; SCO Open Server 5; HP-UX 11
2057 AC_CHECK_FUNCS(getprpwnam)
2058
2059 # Digital UNIX 4.0
2060 AC_CHECK_FUNCS(getespwnam get_num_crypts get_crypt_name)
2061
2062 # Digital Unix 4.0
2063 AC_CHECK_FUNCS(dispcrypt)
2064
2065 # SunOS
2066 AC_CHECK_FUNCS(getpwanam)
2067 ])
2068 dnl
2069 dnl
2070 dnl
2071 AC_DEFUN(wi_SHADOW_HEADERS, [
2072 AC_CHECK_HEADERS(shadow.h crypt.h)
2073
2074 # AIX
2075 AC_CHECK_HEADERS(userpw.h)
2076
2077 # SunOS
2078 AC_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 #
2085 wi_HEADER_HPSECURITY_H
2086
2087 # SCO Open Server, Digital UNIX
2088 AC_CHECK_HEADERS(sys/security.h sys/audit.h krb.h prot.h)
2089
2090 # Digital UNIX
2091 AC_CHECK_HEADERS(sys/secdefines.h)
2092
2093 # Digital UNIX
2094 wi_PR_PASSWD_FG_OLDCRYPT
2095 ])
2096 dnl
2097 dnl
2098 dnl
2099 AC_DEFUN(wi_SHADOW_LIBS, [
2100 check_for_libcrypt=yes
2101
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
2108 fi
2109
2110 # SCO OpenServer 5 stuff for shadow password
2111 AC_CHECK_LIB(x,nap)
2112 AC_CHECK_LIB(prot,getprpwnam)
2113
2114 # Digital UNIX
2115 AC_CHECK_LIB(security,endprpwent)
2116
2117 # HP-UX
2118 AC_CHECK_LIB(sec,getprpwnam)
2119
2120 if test "$ac_cv_lib_sec_getprpwnam" = no ; then
2121 # DYNIX/ptx
2122 AC_CHECK_LIB(sec,getspnam)
2123 fi
2124
2125 if test "$check_for_libcrypt" = yes ; then
2126 wi_LIB_CRYPT
2127 fi
2128 AC_CHECK_FUNCS(crypt)
2129 ])
2130 dnl
2131 dnl
2132 dnl
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"
2138 fi
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]'`
2147 OS=''
2148 SYS=''
2149 NDEFS=''
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 #
2155 case "$os,$CFLAGS" in
2156 irix64,*-n32*)
2157 os=irix
2158 # then go to regular "irix" instead of "irix64" below.
2159 ;;
2160 esac
2161
2162 case "$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
2255 main()
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 }
2263 EOF
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 ;;
2382 esac
2383
2384 changequote([, ])
2385
2386 AC_SUBST(NDEFS)
2387 AC_SUBST(OS)
2388 AC_SUBST(host)
2389 AC_SUBST(SYS)
2390 AC_SUBST(HOME_OS)
2391 ])