1 AC_DEFUN([wi_ARG_WITH_SOCKS5], [
2 AC_ARG_WITH(socks5,[ --with-socks5 try to find and use the SOCKS5 library],wi_want_socks5=$withval,wi_want_socks5=no)
8 AH_TEMPLATE([SOCKS], [define if using the socks library])
9 AC_DEFUN([wi_LIB_SOCKS5], [
10 if test "$wi_want_socks5" != yes ; then
11 ac_cv_lib_socks5_SOCKSinit=no
13 # Look for the "SOCKS" library for use with Firewalls/Gateways.
16 # First check for extra libraries that may be needed to
17 # link against socks. If we already checked for one or
18 # more of these libraries, we don't want to count them
19 # in the socks-only list.
21 if test "x$ac_cv_lib_db_main" = "x" ; then
22 AC_CHECK_LIB(db,main,[SOCKS_LIBS="$SOCKS_LIBS -ldb"])
24 if test "x$ac_cv_lib_isode_main" = "x" ; then
25 AC_CHECK_LIB(isode,main,[SOCKS_LIBS="$SOCKS_LIBS -lisode"])
27 if test "x$ac_cv_lib_com_err_main" = "x" ; then
28 AC_CHECK_LIB(com_err,main,[SOCKS_LIBS="$SOCKS_LIBS -lcom_err"])
30 if test "x$ac_cv_lib_crypto_main" = "x" ; then
31 AC_CHECK_LIB(crypto,main,[SOCKS_LIBS="$SOCKS_LIBS -lcrypto"])
33 if test "x$ac_cv_lib_krb5_main" = "x" ; then
34 AC_CHECK_LIB(krb5,main,[SOCKS_LIBS="$SOCKS_LIBS -lkrb5"])
36 if test "x$ac_cv_lib_gssapi_krb5_main" = "x" ; then
37 AC_CHECK_LIB(gssapi_krb5,main,[SOCKS_LIBS="$SOCKS_LIBS -lgssapi_krb5"])
40 AC_CHECK_LIB(socks5,SOCKSinit,[SOCKS_LIBS="$SOCKS_LIBS -lsocks5"])
41 AC_CHECK_HEADERS(socks.h socks5p.h)
43 if test "$ac_cv_lib_socks5_SOCKSinit" != yes ; then
44 ac_cv_lib_socks5_SOCKSinit=no
51 AC_MSG_CHECKING([if SOCKS5 will be used])
52 AC_MSG_RESULT([$ac_cv_lib_socks5_SOCKSinit])
58 AC_DEFUN([wi_ARG_ENABLE_DEBUG], [
59 # if DEBUGBUILD is yes, other macros try to set up a compilation environment
60 # with debugging symbols enabled. Example macros which are affected are
61 # wi_CFLAGS and wi_SFLAG.
64 [ --enable-debug enable debugging symbols],
68 if test "$enableval" != "no" ; then
70 DEBUGCONFIGUREFLAG="--enable-debug"
73 dnl # Argument not specified; default is disabled.
82 AC_DEFUN([wi_ARG_DISABLE_CCDV], [
83 AC_ARG_ENABLE(ccdv,[ --disable-ccdv disable use of ccdv program in Makefiles],use_ccdv="$enableval",use_ccdv=yes)
89 AC_DEFUN([wi_ARG_DISABLE_PRECOMP], [
90 AC_ARG_ENABLE(ccdv,[ --disable-precomp disable use of precompiled header files],use_precomp="$enableval",use_precomp=yes)
96 AH_TEMPLATE([PRAGMA_HDRSTOP], [])
97 AC_DEFUN([wi_CC_PRECOMP], [
98 AC_CACHE_CHECK([if the C compiler can use precompiled headers], [wi_cv_cc_precomp], [
100 if test "${use_precomp-yes}" != no ; then
101 wi_cv_cc_precomp_type="unknown"
102 /bin/rm -f pchtest.h pchtest.p pchtest.c pchtest.o pchtest csetc.pch pchtest.pch pchtest.h.gch
103 cat <<EOF > pchtest.h
108 #define FOOBAR 33 /* Make sure it can compile custom headers too */
110 cat <<EOF > pchtest.c
121 if test "$GCC" = yes ; then
123 # Try gcc 3.4's built-in implementation first
125 echo ${CC-cc} $CPPFLAGS pchtest.h -c >&5
126 ${CC-cc} $CPPFLAGS pchtest.h -c >&5 2>&5
127 if test -f pchtest.h.gch ; then
129 # Good, the .gch file was created.
130 # Odds are we're good to go.
132 echo "Successfully compiled pchtest.h into the precompiled header file pchtest.h.gch." >&5
133 AC_TRY_COMPILE([#include "pchtest.h"],[if (FOOBAR == 33) exit(0)],[result="yes" ; wi_cv_cc_precomp_type="gcc_gch_files"],[result="no"])
135 echo "This version of GCC did not compile pchtest.h into the precompiled header file pchtest.h.gch." >&5
137 # See if Apple's implementation works.
139 echo ${CC-cc} $CPPFLAGS -precomp pchtest.h -o pchtest.p >&5
140 ${CC-cc} $CPPFLAGS -precomp pchtest.h -o pchtest.p >&5 2>&5
141 if test -s pchtest.p ; then
142 AC_TRY_COMPILE([#include "pchtest.h"],[if (FOOBAR == 33) exit(0)],[result="yes" ; wi_cv_cc_precomp_type="gcc_dash_precomp"],[result="no"])
145 elif test "${result}_${SYS-aix}_${GCC}" = "no_aix_no" ; then
149 echo ${CC-cc} $CPPFLAGS -qusepcomp -qgenpcomp pchtest.c -o pchtest >&5
150 ${CC-cc} $CPPFLAGS -qusepcomp -qgenpcomp pchtest.c -o pchtest >&5 2>&5
151 if test -s pchtest ; then
153 wi_cv_cc_precomp_type="xlc"
154 wi_CFLAGS_TO_ADD_LATER="$wi_CFLAGS_TO_ADD_LATER -qusepcomp -qgenpcomp"
160 cat <<EOF > pchtest.c
167 for pchflags in "-pch -no_pch_messages" "-pch" "-LANG:pch"
169 /bin/rm -f pchtest.pch
170 echo ${CC-cc} $CPPFLAGS $pchflags pchtest.c -o pchtest >&5
171 ${CC-cc} $CPPFLAGS $pchflags pchtest.c -o pchtest >&5 2>&5
172 if test -f pchtest.pch ; then
174 wi_cv_cc_precomp_type="ccc"
175 wi_CFLAGS_TO_ADD_LATER="$wi_CFLAGS_TO_ADD_LATER $pchflags"
176 AC_DEFINE(PRAGMA_HDRSTOP)
182 /bin/rm -f pchtest.h pchtest.p pchtest.c pchtest.o pchtest csetc.pch pchtest.pch pchtest.h.gch
184 wi_cv_cc_precomp="$result"
191 AC_DEFUN([wi_TEST_DASH_L], [
192 AC_CACHE_CHECK([if shell can test for symlinks], [wi_cv_shell_test_symlinks], [
193 wi_cv_shell_test_symlinks="no"
196 /bin/rm -f config.lnk
197 if test ! -f "config.lnk" ; then
198 /bin/ln -s /bin/ln config.lnk
199 if test -f "config.lnk" ; then
200 ( if test -L config.lnk ; then /bin/rm -f config.lnk ; fi ) 2>/dev/null
201 if test ! -f "config.lnk" ; then
202 wi_cv_shell_test_symlinks="yes"
203 wi_cv_test_L='test -L'
204 wi_cv_test_not_L='test ! -L'
206 ( if test -h config.lnk ; then /bin/rm -f config.lnk ; fi ) 2>/dev/null
207 if test ! -f "config.lnk" ; then
208 wi_cv_shell_test_symlinks="yes"
209 wi_cv_test_L='test -h'
210 wi_cv_test_not_L='test ! -h'
214 /bin/rm -f config.lnk
217 test_L="$wi_cv_test_L"
218 test_not_L="$wi_cv_test_not_L"
224 AC_DEFUN([wi_EXTRA_IDIR], [
226 if test -r $incdir ; then
229 # echo " + already had $incdir" 1>&6
232 if test "$CPPFLAGS" = "" ; then
235 CPPFLAGS="$CPPFLAGS -I$incdir"
237 echo " + found $incdir" 1>&6
246 AC_DEFUN([wi_EXTRA_LDIR], [
248 if test -r $libdir ; then
251 # echo " + already had $libdir" 1>&6
254 if test "$LDFLAGS" = "" ; then
257 LDFLAGS="$LDFLAGS -L$libdir"
259 echo " + found $libdir" 1>&6
268 AC_DEFUN([wi_GNU_LD], [
269 AC_MSG_CHECKING([for GNU ld])
272 x=`ld --version 2>/dev/null | fgrep GNU`
273 if test "$x" != "" ; then
277 AC_MSG_RESULT($result)
283 AC_DEFUN([wi_LD_READONLY_TEXT], [
284 if test "$SYS$wi_cv_prog_ld" = "linuxgld" ; then
285 LDFLAGS="$LDFLAGS -Xlinker -n"
292 AC_DEFUN([wi_FUNC_STRSIGNAL], [
295 # It didn't appear until several ML packs
300 AC_CHECK_FUNCS(strsignal)
308 AC_DEFUN([wi_FUNC_GETCWD], [
309 if test "${SYS}" = sunos ; then
310 # Use getwd on SunOS -- getcwd does a "popen("/bin/pwd")" -- aaaccck.
312 AC_CHECK_FUNCS(getwd)
314 AC_CHECK_FUNCS(getcwd getwd)
316 if test "$ac_cv_func_getcwd" = no && test "$ac_cv_func_getwd" = no ; then
317 AC_WARN(This system does not have either getwd or getcwd?)
318 AC_WARN(I find that a little hard to believe.)
319 AC_WARN(You may want to try -DHAVE_GETWD anyway.)
321 This could also mean that your compiler isn't working])
322 AC_WARN(with this configure script. Check the ./config.log)
323 AC_WARN(and look for anomalies.)
330 AC_DEFUN([wi_EXTRA_SYSV_SUNOS_DIRS], [
331 if test "${SYS-sunos}" = sunos ; then
332 AC_MSG_CHECKING([for System V compatibility directories])
334 wi_EXTRA_IDIR("/usr/5include")
335 wi_EXTRA_LDIR("/usr/5lib")
340 dnl If you want to also look for include and lib subdirectories in the
341 dnl $HOME tree, you supply "yes" as the first argument to this macro.
343 dnl If you want to look for subdirectories in include/lib directories,
344 dnl you pass the names in argument 3, otherwise pass a dash.
346 AC_DEFUN([wi_EXTRA_DIRS], [
347 AC_MSG_CHECKING([for extra include and lib directories])
349 ifelse([$1], yes, [dnl
352 exdirs="$HOME $j $b1 $b2 $prefix $2"
353 if test -x "$HOME/bin/OS" ; then
356 if test -d "$b3" ; then
364 if test "$subexdirs" = "" ; then
367 for subexdir in $subexdirs ; do
368 if test "$subexdir" = "-" ; then
371 subexdir="/$subexdir"
373 for exdir in $exdirs ; do
376 if test "$exdir" = "//" ; then exdir="/" ; fi
377 if test "$subexdir" != ""; then
378 incdir="${exdir}/include${subexdir}"
379 wi_EXTRA_IDIR($incdir)
381 libdir="${exdir}/lib${subexdir}"
382 wi_EXTRA_LDIR($libdir)
386 if test "$subexdir" = ""; then
387 incdir="${exdir}/include${subexdir}"
388 wi_EXTRA_IDIR($incdir)
390 libdir="${exdir}/lib${subexdir}"
391 wi_EXTRA_LDIR($libdir)
401 AC_DEFUN([wi_HPUX_CFLAGS],
402 [AC_MSG_CHECKING(if HP-UX ansi C compiler flags are needed)
403 AC_REQUIRE([AC_PROG_CC])
404 AC_REQUIRE([wi_OS_VAR])
406 if test "$os" = hp-ux ; then
407 if test "$GCC" = yes ; then
408 if test "$CFLAGS" != "" ; then
409 # Shouldn't be in there.
410 changequote(<<, >>)dnl
411 CFLAGS=`echo "$CFLAGS" | sed 's/-A[ae]//g'`
417 # This is required for the extended
420 CFLAGS="-D_HPUX_SOURCE $CFLAGS"
425 # If you're not using gcc, then you better have a cc/c89
426 # that is usable. If you have the barebones compiler, it
427 # won't work. The good compiler uses -Aa for the ANSI
429 changequote(<<, >>)dnl
430 x=`echo "$CFLAGS" | grep 'A[ae]' 2>/dev/null`
432 if test "$x" = "" ; then
438 AC_MSG_RESULT($ac_cv_hpux_flags)
443 AC_DEFUN([wi_OS_DEFAULT_CFLAGS], [
444 AC_MSG_CHECKING(if we should customize your CFLAGS environment variable)
445 wi_replace_O_with_g="no"
446 case "$wi_orig_CFLAGS" in
448 wi_replace_O_with_g="no"
451 wi_replace_O_with_g="no"
454 wi_replace_O_with_g="no"
457 wi_replace_O_with_g="no"
460 wi_replace_O_with_g="no"
463 wi_replace_O_with_g="yes"
468 # See if your CFLAGS environment variable wasn't set or exported,
469 # or if you are using a conservative default. If so, we will
470 # add some additional flags for better performance, warning reporting,
473 # Note we are now checking the current value of CFLAGS, which may have
474 # been changed by configure.
476 wi_os_default_cflags="no"
479 wi_os_default_cflags="yes"
482 wi_os_default_cflags="yes"
485 wi_os_default_cflags="yes"
488 wi_os_default_cflags="yes"
491 wi_os_default_cflags="yes"
494 wi_os_default_cflags="yes"
497 wi_os_default_cflags="yes"
500 wi_os_default_cflags="yes"
504 if test "$wi_os_default_cflags" = yes ; then
505 if test "$GCC" = yes ; then
509 wi_gcc_optimizer_flags=''
510 case "$wi_cv_gcc_version" in
512 wi_os_default_cflags="-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wbad-function-cast -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wmissing-declarations -Winline"
515 wi_os_default_cflags="-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wbad-function-cast -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wmissing-declarations -Winline -Wmissing-format-attribute -Wformat-security"
516 wi_gcc_optimizer_flags='-Wdisabled-optimization'
519 wi_os_default_cflags="-W -Wall"
522 if test "$wi_replace_O_with_g" = yes ; then
523 wi_os_default_cflags="-g $wi_os_default_cflags"
525 wi_os_default_cflags="-O2 $wi_os_default_cflags"
526 if test "$wi_gcc_optimizer_flags" != "" ; then
527 wi_os_default_cflags="$wi_os_default_cflags $wi_gcc_optimizer_flags"
532 wi_os_default_cflags="-D_HPUX_SOURCE $wi_os_default_cflags"
535 wi_os_default_cflags=`echo "$wi_os_default_cflags" | sed 's/\ -Wcast-qual//g'` # avoid va_start() problem
536 wi_os_default_cflags=`echo "$wi_os_default_cflags" | sed 's/\ -Wredundant-decls//g'`
538 openbsd*|unixware*|openunix*)
539 wi_os_default_cflags=`echo "$wi_os_default_cflags" | sed 's/\ -Wredundant-decls//g'`
546 case "${wi_replace_O_with_g}_${OS}" in
548 wi_os_default_cflags="-O -qinfo=cmp:cnd:dcl:eff:gen:ini:par:pro:rea:use -qlonglong -qro -qroconst -qlanglvl=extended -qsrcmsg -qmaxmem=20480 -qsuppress=1506-469:1506-409"
551 wi_os_default_cflags="-g -qinfo=cmp:cnd:dcl:eff:gen:ini:par:pro:rea:use -qlonglong -qro -qroconst -qlanglvl=extended -qsrcmsg -qmaxmem=20480 -qsuppress=1506-469:1506-409"
553 no_irix[2345]*|no_irix6.[01234]*)
554 wi_os_default_cflags="-O2 -xansi -fullwarn -use_readonly_const -G0 -rdata_shared"
556 yes_irix[2345]*|yes_irix6.[01234]*)
557 wi_os_default_cflags="-g -xansi -fullwarn -use_readonly_const -G0 -rdata_shared"
560 wi_os_default_cflags="-O2 -IPA -xansi -fullwarn -use_readonly_const -G0 -rdata_shared -woff 1174"
563 wi_os_default_cflags="-g -xansi -fullwarn -use_readonly_const -G0 -rdata_shared -woff 1174"
566 wi_os_default_cflags="-O4 -std1 -portable -readonly_strings"
569 wi_os_default_cflags="-g -std1 -portable -readonly_strings"
572 wi_os_default_cflags="-Ae +O2 +Ovolatile +Olibcalls +ESlit +w1 +DAportable"
575 wi_os_default_cflags="-Ae -g +w1 +DAportable"
578 if test "$wi_cv_sunwspro_cc_version2" -ge 530 ; then
579 wi_os_default_cflags="-xipo -xO5 -xc99 -xbuiltin -xstrconst -dalign -Qn -errtags=yes -erroff=E_END_OF_LOOP_CODE_NOT_REACHED -mc"
581 wi_os_default_cflags="-xO4 -xstrconst -dalign -Qn"
585 if test "$wi_cv_sunwspro_cc_version2" -ge 530 ; then
586 wi_os_default_cflags="-g -xc99 -xstrconst -dalign -Qn -errtags=yes -erroff=E_END_OF_LOOP_CODE_NOT_REACHED"
588 wi_os_default_cflags="-g -xstrconst -dalign -Qn"
592 wi_os_default_cflags="-O4 -tune host -std1 -readonly_strings -portable -warnprotos -msg_enable level6 -msg_disable longlongtype,hexoctunsign,unusedincl,unnecincl,nestincl,unusedtop,unknownmacro,ignorecallval,strctpadding,truncintasn,truncintcast,trunclongcast,ansialiascast,conststocls,unrefsdecl,subscrbounds2"
595 wi_os_default_cflags="-g -std1 -readonly_strings -portable -warnprotos -msg_enable level6 -msg_disable longlongtype,hexoctunsign,unusedincl,unnecincl,nestincl,unusedtop,unknownmacro,ignorecallval,strctpadding,truncintasn,truncintcast,trunclongcast,ansialiascast,conststocls,unrefsdecl,subscrbounds2"
597 no_unixware*|no_openunix*)
598 wi_os_default_cflags='-O -K inline -K host -Q n'
600 yes_unixware*|yes_openunix*)
601 wi_os_default_cflags='-g -K host -Q n'
604 wi_os_default_cflags="no"
609 if test "$wi_os_default_cflags" != "no" ; then
610 CFLAGS="$wi_os_default_cflags"
612 AC_MSG_RESULT($wi_os_default_cflags)
617 AC_DEFUN([wi_SFLAG], [AC_REQUIRE([AC_PROG_CC])
619 if test "$SFLAG" = "" ; then
628 # Was it ./configure --enable-debug ?
630 if test "$DEBUGBUILD" = yes ; then
635 "-g"|"-g "*|*" -g"|*" -g "*|*"-g"[0-9]*)
646 AC_DEFUN([wi_PROG_SUN_WORKSHOP_CC_VERSION], [
647 AC_REQUIRE([AC_PROG_CC])
648 if test "${SYS}_${GCC}" != solaris_no ; then
649 wi_cv_cc_is_sunwspro_cc="no"
650 wi_cv_sunwspro_cc_version="0"
651 wi_cv_sunwspro_cc_version2="0"
653 AC_CACHE_CHECK([if the C compiler is Sun WorkShop C],[wi_cv_cc_is_sunwspro_cc], [
654 changequote(<<, >>)dnl
656 # cc: Sun WorkShop 6 update 2 C 5.3 2001/05/15
657 # usage: cc [ options] files. Use 'cc -flags' for details
659 # cc: WorkShop Compilers 4.2 30 Oct 1996 C 4.2
660 # usage: cc [ options] files. Use 'cc -flags' for details
662 wi_cv_sunwspro_cc_version=`$CC -V 2>&1 | sed -n '/WorkShop.*C\ [1-9]/{s/^.*C/C/;s/^C\ \([^\ ]*\).*/\1/;p;q;}'`
663 case "$wi_cv_sunwspro_cc_version" in
665 wi_cv_cc_is_sunwspro_cc="yes"
666 ver1=`echo "$wi_cv_sunwspro_cc_version" | cut -d. -f1`
667 ver2=`echo "$wi_cv_sunwspro_cc_version" | cut -d. -f2`
669 wi_cv_sunwspro_cc_version2=`expr "$ver1" '*' 100 + "$ver2" "*" 10 + "$ver3"`
673 wi_cv_cc_is_sunwspro_cc="no"
674 wi_cv_sunwspro_cc_version="0"
675 wi_cv_sunwspro_cc_version2="0"
680 if test "$wi_cv_cc_is_sunwspro_cc" = yes ; then
681 AC_MSG_CHECKING([output of "cc -V" to determine version of Sun WorkShop C])
682 AC_MSG_RESULT("version $wi_cv_sunwspro_cc_version")
689 AC_DEFUN([wi_PROG_GCC_VERSION], [
690 AC_REQUIRE([AC_PROG_CC])
691 if test "$GCC" = yes ; then
692 AC_CACHE_CHECK([the version of GCC],[wi_cv_gcc_version], [
693 changequote(<<, >>)dnl
694 wi_cv_gcc_version=`$CC -v 2>&1 | sed -n '/gcc version/{s/^.*gcc version//;s/^[^1-9]*//;s/\ .*//;p;q;}'`
698 wi_cv_gcc_version="0"
704 AC_DEFUN([wi_REQUEST_NO_Y2K_WARNINGS], [
705 wi_request_no_y2k_warnings=yes
710 AC_DEFUN([wi_CFLAGS_NO_Y2K_WARNINGS], [
711 AC_REQUIRE([AC_PROG_CC])
712 if test "x$wi_request_no_y2k_warnings" = xyes ; then
713 case "${wi_cv_gcc_version-0}" in
714 changequote(<<, >>)dnl
715 0|1.*|2.[012345678].*)
724 CFLAGS="$CFLAGS -Wno-format-y2k"
726 # Now check if this version of GCC
727 # accepts this flag...
729 AC_TRY_COMPILE([],[int junk;],[],[CFLAGS="$oldCFLAGS"])
740 AC_DEFUN([wi_CFLAGS], [AC_REQUIRE([AC_PROG_CC])
743 wi_PROG_SUN_WORKSHOP_CC_VERSION
745 wi_CFLAGS_NO_Y2K_WARNINGS
746 changequote(<<, >>)dnl
748 if [ "$NOOPTCFLAGS" = "" ] ; then
749 NOOPTCFLAGS=`echo "$CFLAGS" | sed 's/[-+]O[0-9A-Za-z]*//g;s/-xO[0-9]//g;s/-Wc,-O3//g;s/-IPA//g;s/-xipo//g;s/\ \ */ /g;s/^\ *//;s/\ *$//;'`
750 if [ "$GCC" = "yes" ] ; then
761 if [ "$DEBUGCFLAGS" = "" ] ; then
762 DEBUGCFLAGS="-g $NOOPTCFLAGS"
764 if [ "$add_O0" = yes ] ; then
765 NOOPTCFLAGS="-O0 $NOOPTCFLAGS"
769 # Was it ./configure --enable-debug ?
771 AC_MSG_CHECKING([if this is a debug build])
772 if test "$DEBUGBUILD" = yes ; then
774 CFLAGS="$DEBUGCFLAGS"
778 AC_MSG_CHECKING([NOOPTCFLAGS])
779 AC_MSG_RESULT($NOOPTCFLAGS)
780 AC_MSG_CHECKING([DEBUGCFLAGS])
781 AC_MSG_RESULT($DEBUGCFLAGS)
782 AC_MSG_CHECKING([CFLAGS])
783 AC_MSG_RESULT($CFLAGS)
788 AC_DEFUN([wi_HPUX_GCC___STDC_EXT__], [
789 AC_MSG_CHECKING([if -D__STDC_EXT__ is needed with GCC on HP-UX])
796 if (__STDC_EXT__ == 0)
797 exit(1); /* have __STDC_EXT__=0 */
798 exit(0); /* have __STDC_EXT__=1 */
800 exit(1); /* do not have __STDC_EXT__ */
805 # Already have it defined.
811 # Not defined -- we need to define it then.
812 # This is required for the extended
813 # namespace symbols for Large Files.
815 CFLAGS="-D__STDC_EXT__ $CFLAGS"
818 # action if cross-compiling, guess
819 CFLAGS="-D__STDC_EXT__ $CFLAGS"
826 AC_DEFUN([wi_ENV_VAR_MESSAGES], [
827 AC_MSG_CHECKING([if you set and exported the environment variable CC])
828 if test "x$CC" = x ; then
829 AC_MSG_RESULT([no (you may want to do that since configure scripts look for gcc first)])
833 AC_MSG_CHECKING([for environment variable CFLAGS])
834 if test "x$CFLAGS" = x ; then
835 AC_MSG_RESULT([no (we will choose a default set for you)])
837 AC_MSG_RESULT($CFLAGS)
839 AC_MSG_CHECKING([for environment variable CPPFLAGS])
840 AC_MSG_RESULT(${CPPFLAGS-no})
841 AC_MSG_CHECKING([for environment variable LDFLAGS])
842 AC_MSG_RESULT(${LDFLAGS-no})
843 AC_MSG_CHECKING([for environment variable LIBS])
844 AC_MSG_RESULT(${LIBS-no})
849 AC_DEFUN([wi_CFLAGS_LFS64], [AC_REQUIRE([AC_PROG_CC])
850 AC_REQUIRE([wi_OS_VAR])
852 if test "os_${os}_gcc_${GCC}" = os_hp-ux_gcc_yes ; then
853 wi_HPUX_GCC___STDC_EXT__
856 *-D_LARGEFILE64_SOURCE*)
859 CFLAGS="-D_LARGEFILE64_SOURCE $CFLAGS"
860 DEBUGCFLAGS="-D_LARGEFILE64_SOURCE $DEBUGCFLAGS"
861 NOOPTCFLAGS="-D_LARGEFILE64_SOURCE $NOOPTCFLAGS"
864 AC_MSG_CHECKING([if we should add to CFLAGS for LFS64 support])
865 AC_MSG_RESULT($CFLAGS)
870 AC_DEFUN([wi_CFLAGS_REENTRANT], [AC_REQUIRE([AC_PROG_CC])
875 CFLAGS="-D_REENTRANT $CFLAGS"
878 AC_MSG_CHECKING([if we should add -D_REENTRANT to CFLAGS])
879 AC_MSG_RESULT($CFLAGS)
884 AC_DEFUN([wi_PROTOTYPES], [
885 AC_MSG_CHECKING(if the compiler supports function prototypes)
886 AC_TRY_COMPILE(,[extern void exit(int status);],[wi_cv_prototypes=yes
887 AC_DEFINE(PROTOTYPES)],wi_cv_prototypes=no)
888 AC_MSG_RESULT($wi_cv_prototypes)
894 AH_TEMPLATE([tv_sec_t], [type of the tv_sec field of struct timeval])
895 AH_TEMPLATE([tv_usec_t], [type of the tv_usec field of struct timeval])
896 AC_DEFUN([wi_STRUCT_TIMEVAL_FIELD_TYPES], [
897 wi_struct_timeval_field_checks="cached"
898 AC_CACHE_CHECK([what type the tv_sec field of struct timeval is],[wi_cv_struct_timeval_tv_sec], [
899 wi_struct_timeval_field_checks="uncached"
900 wi_PREREQ_UNISTD_H([$0])
903 #if defined(AIX) || defined(_AIX) || defined(__HOS_AIX__)
904 # define _ALL_SOURCE 1
909 #include <sys/types.h>
910 #include <sys/time.h>
916 neg(void *dst0, size_t siz)
918 unsigned char *dst = (unsigned char *) dst0;
923 *dst++ = (unsigned char) 0xEE;
927 main(int argc, char **argv)
934 memset(&tv, 0, sizeof(tv));
937 fp = fopen("conftest.out", "w");
939 perror("could not write to ./conftest.out");
945 #ifdef HAVE_LONG_LONG
946 if (sizeof(x) == sizeof(long long)) {
950 if (sizeof(x) == sizeof(long)) {
955 (void) fprintf(fp, "%s%s\n", (x > 0) ? "unsigned " : "", typ);
960 #ifdef HAVE_LONG_LONG
961 if (sizeof(x) == sizeof(long long)) {
965 if (sizeof(x) == sizeof(long)) {
970 (void) fprintf(fp, "%s%s\n", (x > 0) ? "unsigned " : "", typ);
979 if test -f conftest.out ; then
980 wi_cv_struct_timeval_tv_sec="`sed -n '1,1p' conftest.out`"
981 wi_cv_struct_timeval_tv_usec="`sed -n '2,2p' conftest.out`"
985 wi_cv_struct_timeval_tv_sec="long"
986 wi_cv_struct_timeval_tv_usec="long"
988 # action if cross compiling
989 wi_cv_struct_timeval_tv_sec="long"
990 wi_cv_struct_timeval_tv_usec="long"
992 /bin/rm -f conftest.out
994 if test "$wi_struct_timeval_field_checks" = "uncached" ; then
995 AC_MSG_CHECKING([what type the tv_usec field of struct timeval is])
996 AC_MSG_RESULT([$wi_cv_struct_timeval_tv_usec])
998 AC_CACHE_CHECK([what type the tv_usec field of struct timeval is],[wi_cv_struct_timeval_tv_usec], [:])
1000 AC_DEFINE_UNQUOTED(tv_sec_t, $wi_cv_struct_timeval_tv_sec)
1001 AC_DEFINE_UNQUOTED(tv_usec_t, $wi_cv_struct_timeval_tv_usec)
1006 AH_TEMPLATE([main_void_return_t], [type that main() should return])
1007 AC_DEFUN([wi_VOID_MAIN_RETURN_TYPE], [
1008 AC_CACHE_CHECK([what type main() should return],[wi_cv_main_void_return_t], [
1009 wi_cv_main_void_return_t="int"
1010 case "${GCC}_${SYS}" in
1012 wi_cv_main_void_return_t="void"
1016 AC_DEFINE_UNQUOTED(main_void_return_t, $wi_cv_main_void_return_t)
1021 AH_TEMPLATE([INSECURE_CHOWN], [define if chown can be used to subvert security])
1022 AC_DEFUN([wi_INSECURE_CHOWN], [
1023 wi_PREREQ_UNISTD_H([$0])
1024 AC_MSG_CHECKING(if chown can be used to subvert security)
1026 #if defined(AIX) || defined(_AIX) || defined(__HOS_AIX__)
1027 # define _ALL_SOURCE 1
1029 #ifdef HAVE_UNISTD_H
1030 # include <unistd.h>
1032 #include <sys/types.h>
1033 #include <sys/stat.h>
1043 setuid(1); /* if you're root, try set to someone else. */
1044 sprintf(fn, "/tmp/fu%06ld", (long) getpid());
1046 fp = fopen(fn, "w");
1048 exit(1); /* assume the worst */
1049 fprintf(fp, "%s\n", "hello world");
1052 result = chown(fn, 0, 0);
1053 if (stat(fn, &st) < 0) {
1055 exit((result == 0) ? 0 : 1);
1059 /* exit(0) if the insecure chown to uid 0 succeeded. */
1060 exit((st.st_uid == 0) ? 0 : 1);
1063 wi_cv_insecure_chown=yes
1064 AC_DEFINE(INSECURE_CHOWN)
1067 wi_cv_insecure_chown=no
1069 # action if cross-compiling, guess
1070 wi_cv_insecure_chown=no
1073 AC_MSG_RESULT($wi_cv_insecure_chown)
1078 AC_DEFUN([wi_PREREQ_UNISTD_H], [
1079 if test "x$ac_cv_header_unistd_h" = x ; then
1080 AC_MSG_ERROR([Script needs to check for <unistd.h> before calling [$1].])
1084 AH_TEMPLATE([NEED_GETOPT_H], [define if we need to include <getopt.h> for the getopt() global variables])
1085 AH_TEMPLATE([NEED_GETOPT_EXTERN_DECLS], [define if we need extern declarations for the getopt() global variables])
1086 AC_DEFUN([wi_GETOPT], [
1087 AC_CACHE_CHECK([how to access getopt() global variables], [wi_cv_getopt_decl], [
1088 wi_PREREQ_UNISTD_H([$0])
1091 #if defined(AIX) || defined(_AIX) || defined(__HOS_AIX__)
1092 # define _ALL_SOURCE 1
1094 #ifdef HAVE_UNISTD_H
1095 # include <unistd.h>
1100 optind = (optarg == 0) ? 66 : 99;
1101 ],[wi_cv_getopt_decl="automatic"],[wi_cv_getopt_decl="unknown"])
1102 if test "$wi_cv_getopt_decl" = unknown ; then
1105 #if defined(AIX) || defined(_AIX) || defined(__HOS_AIX__)
1106 # define _ALL_SOURCE 1
1108 #ifdef HAVE_UNISTD_H
1109 # include <unistd.h>
1115 optind = (optarg == 0) ? 66 : 99;
1116 ],[wi_cv_getopt_decl="getopt.h"],[wi_cv_getopt_decl="manual"])
1119 if test "$wi_cv_getopt_decl" = "getopt.h" ; then
1120 AC_DEFINE(NEED_GETOPT_H)
1121 elif test "$wi_cv_getopt_decl" = "manual" ; then
1122 AC_DEFINE(NEED_GETOPT_EXTERN_DECLS)
1128 AC_DEFUN([wi_LIB_SNPRINTF], [
1129 if test "$ac_cv_func_snprintf" = "no" ; then
1130 AC_CHECK_LIB(snprintf,snprintf)
1131 if test "$ac_cv_lib_snprintf_snprintf" = yes ; then
1132 unset ac_cv_func_snprintf ac_cv_func_vsnprintf
1133 AC_CHECK_HEADERS(snprintf.h)
1134 AC_CHECK_FUNCS(snprintf vsnprintf)
1141 AH_TEMPLATE([SNPRINTF_TERMINATES], [define if snprintf works correctly])
1142 AC_DEFUN([wi_SNPRINTF_TERMINATES], [
1143 if test "$ac_cv_func_snprintf" != "no" ; then
1144 AC_MSG_CHECKING(if snprintf works correctly)
1145 if test "$ac_cv_func_snprintf" = "no" ; then
1146 AC_CHECK_LIB(snprintf,snprintf)
1148 wi_PREREQ_UNISTD_H([$0])
1151 #if defined(AIX) || defined(_AIX) || defined(__HOS_AIX__)
1152 # define _ALL_SOURCE 1
1154 #ifdef HAVE_UNISTD_H
1155 # include <unistd.h>
1159 #ifdef HAVE_STRINGS_H
1160 #include <strings.h>
1169 for (i=0; i<(int)(sizeof(s)/sizeof(char)); i++)
1171 result = (int) snprintf(s + 1, 10, "%s %s!", "hello", "world");
1173 exit(1); /* did not force termination! */
1175 exit(2); /* overflow! */
1177 exit(3); /* underflow! */
1182 wi_cv_snprintf_terminates=yes
1183 AC_DEFINE(SNPRINTF_TERMINATES)
1187 wi_cv_snprintf_terminates=no
1190 # action if cross compiling
1191 wi_cv_snprintf_terminates=no
1200 AC_DEFUN([wi_SNPRINTF], [
1202 dnl Uncache these -- config.cache doesn't cache it right for this case.
1203 unset ac_cv_func_snprintf
1204 unset ac_cv_func_vsnprintf
1206 AC_CHECK_FUNCS(snprintf vsnprintf)
1207 wi_SNPRINTF_TERMINATES
1214 AH_TEMPLATE([HAVE_HPSECURITY_H], [define if we have hpsecurity.h])
1215 AC_DEFUN([wi_HEADER_HPSECURITY_H], [
1216 AC_MSG_CHECKING(for hpsecurity.h)
1217 wi_cv_header_hpsecurity_h=no
1218 if test -f /usr/include/hpsecurity.h ; then
1219 wi_cv_header_hpsecurity_h=yes
1220 AC_DEFINE(HAVE_HPSECURITY_H)
1222 AC_MSG_RESULT($wi_cv_header_hpsecurity_h)
1227 AH_TEMPLATE([CAN_USE_SYS_SELECT_H], [define if we can use sys/select.h])
1228 AC_DEFUN([wi_HEADER_SYS_SELECT_H], [
1229 wi_PREREQ_UNISTD_H([$0])
1230 # See if <sys/select.h> is includable after <sys/time.h>
1231 if test "$ac_cv_header_sys_time_h" = no ; then
1232 wi_chk_headers="sys/time.h sys/select.h"
1234 wi_chk_headers="sys/time.h"
1236 AC_CHECK_HEADERS($wi_chk_headers)
1237 if test "$ac_cv_header_sys_select_h" = yes ; then
1238 AC_MSG_CHECKING([if <sys/select.h> is compatible with <sys/time.h>])
1240 if test "$ac_cv_header_sys_time_h" = yes ; then
1242 #if defined(AIX) || defined(_AIX) || defined(__HOS_AIX__)
1243 # define _ALL_SOURCE 1
1245 #ifdef HAVE_UNISTD_H
1246 # include <unistd.h>
1248 #include <sys/types.h>
1249 #include <sys/time.h>
1250 #include <sys/select.h>],[
1252 struct timeval tmval;
1254 tmval.tv_sec = 0;],selecth=yes,selecth=no)
1256 if test "$selecth" = yes ; then
1257 AC_DEFINE(CAN_USE_SYS_SELECT_H)
1259 AC_MSG_RESULT($selecth)
1265 AC_DEFUN([wi_LIB_44BSD], [
1266 AC_CHECK_FUNC(strerror,[a=yes],[a=no])
1267 if test "$a" = no ; then
1268 # Not in libc, try lib44bsd.
1269 AC_CHECK_LIB(44bsd,strerror)
1275 AH_TEMPLATE([HAVE_UNIX_DOMAIN_SOCKETS], [define if UNIX domain sockets are available])
1276 AC_DEFUN([wi_UNIX_DOMAIN_SOCKETS], [
1277 if test "x$want_unix_domain_sockets" != xno ; then
1278 wi_PREREQ_UNISTD_H([$0])
1279 AC_CHECK_HEADERS(sys/un.h)
1280 AC_CACHE_CHECK([for UNIX domain sockets], [wi_cv_unix_domain_sockets], [
1282 #if defined(AIX) || defined(_AIX) || defined(__HOS_AIX__)
1283 # define _ALL_SOURCE 1
1285 #ifdef HAVE_UNISTD_H
1286 # include <unistd.h>
1288 #include <sys/types.h>
1289 #include <sys/socket.h>
1290 #ifdef HAVE_SYS_UN_H
1298 sfd = socket(AF_UNIX, SOCK_STREAM, 0);
1300 exit(1); /* do not have UNIX domain sockets */
1302 exit(0); /* do have UNIX domain sockets */
1305 wi_cv_unix_domain_sockets=yes
1308 wi_cv_unix_domain_sockets=no
1310 # action if cross-compiling, guess
1311 wi_cv_unix_domain_sockets=yes
1314 if test "x$wi_cv_unix_domain_sockets" = xyes ; then
1315 AC_DEFINE(HAVE_UNIX_DOMAIN_SOCKETS)
1317 wi_SOCKADDR_UN_SUN_LEN
1323 AC_DEFUN([wi_LIB_NSL], [
1324 dnl Note: Check for socket lib first, then nsl.
1328 # HP-UX 11 uses NSL for YP services
1329 AC_CHECK_LIB(nsl,getpwent)
1333 AC_CHECK_FUNC(gethostbyname,[a=yes],[a=no])
1334 if test "$a" = no ; then
1335 # Not in libc, try libnsl.
1336 AC_CHECK_LIB(nsl,gethostbyname)
1345 AC_DEFUN([wi_LIB_SOCKET], [
1346 AC_CHECK_FUNC(socket,[a=yes],[a=no])
1347 if test "$a" = no ; then
1348 # Not in libc, try libsocket.
1349 AC_CHECK_LIB(socket,socket)
1355 AC_DEFUN([wi_LIB_RESOLV], [
1356 # See if we could access two well-known sites without help of any special
1357 # libraries, like resolv.
1359 dnl 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.])
1361 AC_CACHE_CHECK([if we need to look for -lresolv], [wi_cv_look_for_resolv], [
1362 wi_PREREQ_UNISTD_H([$0])
1364 #if defined(AIX) || defined(_AIX) || defined(__HOS_AIX__)
1365 # define _ALL_SOURCE 1
1367 #ifdef HAVE_UNISTD_H
1368 # include <unistd.h>
1370 #include <sys/types.h>
1371 #include <sys/socket.h>
1372 #include <netinet/in.h>
1377 struct hostent *hp1, *hp2;
1379 hp1 = gethostbyname("ftp.ncftp.com");
1380 if (hp1 == (struct hostent *) 0) {
1381 hp2 = gethostbyname("www.ibm.com");
1382 if (hp2 == (struct hostent *) 0)
1386 }],wi_cv_look_for_resolv=no,wi_cv_look_for_resolv=yes,wi_cv_look_for_resolv=yes)
1389 if test "$wi_cv_look_for_resolv" = yes ; then
1390 AC_CHECK_LIB(resolv,main)
1398 AC_DEFUN([wi_LIB_TCP_WRAPPERS], [
1399 wi_PREREQ_UNISTD_H([$0])
1400 AC_MSG_CHECKING([for tcp wrappers library (libwrap)])
1404 #ifdef HAVE_UNISTD_H
1405 # include <unistd.h>
1407 #include <sys/types.h>
1410 /* These are needed if libwrap.a was compiled with
1411 * PROCESS_OPTIONS defined.
1413 int allow_severity = 1; /* arbitrary for this test */
1414 int deny_severity = 2; /* arbitrary for this test */
1418 exit((allow_severity == deny_severity) ? 1 : 0);
1420 dnl ...Don't bother defining this symbol...
1421 dnl ...Check for tcpd.h instead...
1422 dnl AC_DEFINE(HAVE_LIBWRAP)
1424 dnl ...Don't modify LIBS, instead set WRAPLIB...
1425 dnl LIBS="-lwrap $LIBS"
1428 wi_cv_lib_wrap_hosts_access=yes
1431 wi_cv_lib_wrap_hosts_access=no
1433 AC_MSG_RESULT($wi_cv_lib_wrap_hosts_access)
1438 AC_DEFUN([wi_NET_LIBS], [
1439 # Mostly for SunOS 4 -- needs to come first because other libs depend on it
1444 if test "$SYS" = unixware ; then
1447 # So far, only UnixWare needs this.
1448 AC_CHECK_LIB(gen,syslog)
1450 if test -f /usr/ucblib/libucb.a ; then
1451 LDFLAGS="$LDFLAGS -L/usr/ucblib"
1454 if test -f /usr/include/unistd.h ; then
1455 ac_cv_header_unistd_h=yes
1458 # UnixWare 2 needs both lsocket and lnsl, and configure
1459 # script won't detect this condition properly because
1460 # the libraries are interdependent.
1462 LIBS="$LIBS -lsocket -lnsl"
1464 # Now look for socket()
1466 # AC_CHECK_FUNC(socket,[a=yes],[a=no])
1468 AC_CHECK_FUNC(socket,[a=yes],[a=no])
1475 dnl AC_CHECK_LIB(inet,main)
1480 if test "$SYS" = dynixptx ; then
1481 LIBS="$LIBS -lsocket -lnsl"
1489 AH_TEMPLATE([UNAME], [uname -a output])
1490 AC_DEFUN([wi_DEFINE_UNAME], [
1491 # Get first 127 chars of all uname information. Some folks have
1492 # way too much stuff there, so grab only the first 127.
1493 unam=`uname -a 2>/dev/null | cut -c1-127 | sed 's-"-\\"-g'`
1494 if test "$unam" != "" ; then
1495 AC_DEFINE_UNQUOTED(UNAME, "$unam")
1501 AH_TEMPLATE([HAVE_SIGSETJMP], [define if we have sigsetjmp and siglongjmp])
1502 AC_DEFUN([wi_FUNC_SIGSETJMP], [
1503 wi_PREREQ_UNISTD_H([$0])
1504 AC_CACHE_CHECK([for sigsetjmp and siglongjmp], [wi_cv_func_sigsetjmp], [
1508 #ifdef HAVE_UNISTD_H
1509 # include <unistd.h>
1511 #include <sys/types.h>
1519 if (sigsetjmp(sjb, 1) != 0)
1520 siglongjmp(sjb, 1); /* bogus code, of course. */
1523 wi_cv_func_sigsetjmp=yes
1525 wi_cv_func_sigsetjmp=no
1528 if test "$wi_cv_func_sigsetjmp" = yes ; then
1529 AC_DEFINE(HAVE_SIGSETJMP)
1535 AH_TEMPLATE([HAVE_UTMP_UT_NAME], [define if struct utmp has the ut_name field])
1536 AC_DEFUN([wi_UTMP_UT_NAME], [
1537 AC_MSG_CHECKING([for ut_name field in struct utmp])
1541 #include <sys/types.h>
1546 u.ut_name[0] = '\0';
1547 exit(((int) &u.ut_name) & 0xff); /* bogus code, of course. */
1549 wi_cv_utmp_ut_name=yes
1550 AC_DEFINE(HAVE_UTMP_UT_NAME)
1552 wi_cv_utmp_ut_name=no
1554 AC_MSG_RESULT($wi_cv_utmp_ut_name)
1559 AH_TEMPLATE([HAVE_UTMPX_UT_SYSLEN], [define if struct utmpx has the ut_syslen field])
1560 AC_DEFUN([wi_UTMPX_UT_SYSLEN], [
1561 AC_MSG_CHECKING([for ut_syslen field in struct utmpx])
1565 #include <sys/types.h>
1571 exit(((int) &u.ut_syslen) & 0xff); /* bogus code, of course. */
1573 wi_cv_utmpx_ut_syslen=yes
1574 AC_DEFINE(HAVE_UTMPX_UT_SYSLEN)
1576 wi_cv_utmpx_ut_syslen=no
1578 AC_MSG_RESULT($wi_cv_utmpx_ut_syslen)
1583 AH_TEMPLATE([HAVE_UTMP_UT_USER], [define if struct utmp has the ut_user field])
1584 AC_DEFUN([wi_UTMP_UT_USER], [
1585 AC_MSG_CHECKING([for ut_user field in struct utmp])
1589 #include <sys/types.h>
1594 u.ut_user[0] = '\0';
1595 exit(((int) &u.ut_user) & 0xff); /* bogus code, of course. */
1597 wi_cv_utmp_ut_user=yes
1598 AC_DEFINE(HAVE_UTMP_UT_USER)
1600 wi_cv_utmp_ut_user=no
1602 AC_MSG_RESULT($wi_cv_utmp_ut_user)
1607 AH_TEMPLATE([HAVE_UTMP_UT_PID], [define if struct utmp has the ut_pid field])
1608 AC_DEFUN([wi_UTMP_UT_PID], [
1609 AC_MSG_CHECKING([for ut_pid field in struct utmp])
1613 #include <sys/types.h>
1619 exit(((int) &u.ut_pid) & 0xff); /* bogus code, of course. */
1621 wi_cv_utmp_ut_pid=yes
1622 AC_DEFINE(HAVE_UTMP_UT_PID)
1624 wi_cv_utmp_ut_pid=no
1626 AC_MSG_RESULT($wi_cv_utmp_ut_pid)
1632 AH_TEMPLATE([HAVE_UTMP_UT_TIME], [define if struct utmp has the ut_time field])
1633 AC_DEFUN([wi_UTMP_UT_TIME], [
1634 AC_MSG_CHECKING([for ut_time field in struct utmp])
1638 #include <sys/types.h>
1644 exit(((int) &u.ut_time) & 0xff); /* bogus code, of course. */
1646 wi_cv_utmp_ut_time=yes
1647 AC_DEFINE(HAVE_UTMP_UT_TIME)
1649 wi_cv_utmp_ut_time=no
1651 AC_MSG_RESULT($wi_cv_utmp_ut_time)
1656 AH_TEMPLATE([HAVE_UTMP_UT_HOST], [define if struct utmp has the ut_host field])
1657 AC_DEFUN([wi_UTMP_UT_HOST], [
1658 AC_MSG_CHECKING([for ut_host field in struct utmp])
1662 #include <sys/types.h>
1667 u.ut_host[0] = '\0';
1668 exit(((int) &u.ut_host) & 0xff); /* bogus code, of course. */
1670 wi_cv_utmp_ut_host=yes
1671 AC_DEFINE(HAVE_UTMP_UT_HOST)
1673 wi_cv_utmp_ut_host=no
1675 AC_MSG_RESULT($wi_cv_utmp_ut_host)
1681 AH_TEMPLATE([HAVE_STRUCT_STAT64], [define if we have struct stat64])
1682 AC_DEFUN([wi_STRUCT_STAT64], [
1683 AC_MSG_CHECKING([for struct stat64])
1687 #include <sys/types.h>
1688 #include <sys/stat.h>
1693 exit(((int) &st.st_size) & 0xff); /* bogus code, of course. */
1695 wi_cv_struct_stat64=yes
1696 AC_DEFINE(HAVE_STRUCT_STAT64)
1698 wi_cv_struct_stat64=no
1700 AC_MSG_RESULT($wi_cv_struct_stat64)
1705 AH_TEMPLATE([HAVE_STRUCT_CMSGDHR], [define if we have struct cmsghdr])
1706 AC_DEFUN([wi_STRUCT_CMSGHDR], [
1707 AC_CACHE_CHECK([for struct cmsghdr],[wi_cv_struct_cmsghdr], [
1711 #include <sys/types.h>
1712 #include <sys/uio.h>
1713 #include <sys/socket.h>
1721 exit(((int) &cm.cmsg_type) & 0xff); /* bogus code, of course. */
1723 wi_cv_struct_cmsghdr=yes
1725 wi_cv_struct_cmsghdr=no
1728 if test "$wi_cv_struct_cmsghdr" = yes ; then
1729 AC_DEFINE(HAVE_STRUCT_CMSGDHR)
1735 AH_TEMPLATE([HAVE_MSGHDR_CONTROL], [define if struct msghdr has the msg_control field])
1736 AC_DEFUN([wi_MSGHDR_CONTROL], [
1737 AC_CACHE_CHECK([for msg_control field in struct msghdr],[wi_cv_msghdr_control], [
1741 #include <sys/types.h>
1742 #include <sys/uio.h>
1743 #include <sys/socket.h>
1749 m.msg_controllen = sizeof(m);
1750 exit(((int) &m.msg_control) & 0xff); /* bogus code, of course. */
1752 wi_cv_msghdr_control=yes
1754 wi_cv_msghdr_control=no
1757 if test "$wi_cv_msghdr_control" = yes ; then
1758 AC_DEFINE(HAVE_MSGHDR_CONTROL)
1764 AH_TEMPLATE([HAVE_MSGHDR_ACCRIGHTS], [define if struct msghdr has the msg_accrights field])
1765 AC_DEFUN([wi_MSGHDR_ACCRIGHTS], [
1766 AC_CACHE_CHECK([for msg_accrights field in struct msghdr], [wi_cv_msghdr_accrights], [
1770 #include <sys/types.h>
1771 #include <sys/uio.h>
1772 #include <sys/socket.h>
1777 m.msg_accrights = &m;
1778 m.msg_accrightslen = sizeof(m);
1779 exit(((int) &m.msg_accrights) & 0xff); /* bogus code, of course. */
1781 wi_cv_msghdr_accrights=yes
1783 wi_cv_msghdr_accrights=no
1786 if test "$wi_cv_msghdr_accrights" = yes ; then
1787 AC_DEFINE(HAVE_MSGHDR_ACCRIGHTS)
1793 AH_TEMPLATE([HAVE_PR_PASSWD_FG_OLDCRYPT], [define if struct pr_passwd has the fg_oldcrypt field])
1794 AC_DEFUN([wi_PR_PASSWD_FG_OLDCRYPT], [
1795 AC_MSG_CHECKING([for fg_oldcrypt field in struct pr_passwd])
1799 #include <sys/types.h>
1800 #include <sys/stat.h>
1808 #if defined(HAVE_USERPW_H) && defined(HAVE_GETUSERPW) /* AIX */
1809 # include <userpw.h>
1810 #elif defined(HAVE_PWDADJ_H) && defined(HAVE_GETPWANAM) /* SunOS */
1811 # include <sys/label.h>
1812 # ifdef HAVE_SYS_AUDIT_H
1813 # include <sys/audit.h>
1815 # include <pwdadj.h>
1816 #elif defined(HAVE_GETESPWNAM) /* Digital UNIX 4 */
1817 # ifdef HAVE_SYS_SECDEFINES_H
1818 # include <sys/secdefines.h>
1820 # ifdef HAVE_SYS_SECURITY_H
1821 # include <sys/security.h>
1823 # ifdef HAVE_SYS_AUDIT_H
1824 # include <sys/audit.h>
1832 #elif defined(HAVE_GETPRPWNAM) /* SCO Open Server V, Digital UNIX 3, HP-UX 10 */
1833 # ifdef HAVE_SYS_SECDEFINES_H
1834 # include <sys/secdefines.h>
1836 # ifdef HAVE_SYS_SECURITY_H
1837 # include <sys/security.h>
1839 # ifdef HAVE_SYS_AUDIT_H
1840 # include <sys/audit.h>
1842 # ifdef HAVE_HPSECURITY_H
1843 # include <hpsecurity.h>
1853 struct pr_passwd xu;
1854 memset(&xu, 0, sizeof(xu));
1855 if (xu.uflg.fg_oldcrypt != 0)
1856 xu.uflg.fg_oldcrypt++; /* bogus code, of course */
1859 wi_cv_pr_passwd_fg_oldcrypt=yes
1860 AC_DEFINE(HAVE_PR_PASSWD_FG_OLDCRYPT)
1862 wi_cv_pr_passwd_fg_oldcrypt=no
1864 AC_MSG_RESULT($wi_cv_pr_passwd_fg_oldcrypt)
1869 AH_TEMPLATE([HAVE_SOCKADDR_UN_SUN_LEN], [define if struct sockaddr_un has the sun_len field])
1870 AC_DEFUN([wi_SOCKADDR_UN_SUN_LEN], [
1871 AC_CACHE_CHECK([for sun_len field in struct sockaddr_un], [wi_cv_sockaddr_un_sun_len], [
1875 #include <sys/types.h>
1876 #include <sys/uio.h>
1877 #include <sys/socket.h>
1880 struct sockaddr_un uaddr;
1882 uaddr.sun_len = strlen("/tmp/test.sock");
1883 exit(((int) uaddr.sun_len); /* bogus code, of course. */
1885 wi_cv_sockaddr_un_sun_len=yes
1887 wi_cv_sockaddr_un_sun_len=no
1890 if test "$wi_cv_sockaddr_un_sun_len" = yes ; then
1891 AC_DEFINE(HAVE_SOCKADDR_UN_SUN_LEN)
1897 AH_TEMPLATE([HAVE_STATFS_F_BAVAIL], [define if struct statfs has the f_bavail field])
1898 AC_DEFUN([wi_STATFS_F_BAVAIL], [
1899 AC_MSG_CHECKING([for f_bavail field in struct statfs])
1903 #include <sys/types.h>
1904 #ifdef HAVE_SYS_STATFS_H
1905 # include <sys/statfs.h>
1906 #elif defined(HAVE_SYS_VFS_H)
1907 # include <sys/vfs.h>
1913 exit((int) st.f_bavail); /* bogus code, of course. */
1915 wi_cv_statfs_f_bavail=yes
1916 AC_DEFINE(HAVE_STATFS_F_BAVAIL)
1918 wi_cv_statfs_f_bavail=no
1920 AC_MSG_RESULT($wi_cv_statfs_f_bavail)
1925 AH_TEMPLATE([HAVE_STATVFS_F_FRSIZE], [define if struct statvfs has the f_frsize field])
1926 AC_DEFUN([wi_STATVFS_F_FRSIZE], [
1927 AC_MSG_CHECKING([for f_frsize field in struct statvfs])
1931 #include <sys/types.h>
1932 #include <sys/statvfs.h>
1937 exit((int) st.f_frsize); /* bogus code, of course. */
1939 wi_cv_statfs_f_frsize=yes
1940 AC_DEFINE(HAVE_STATVFS_F_FRSIZE)
1942 wi_cv_statfs_f_frsize=no
1944 AC_MSG_RESULT($wi_cv_statfs_f_frsize)
1949 AH_TEMPLATE([SPRINTF_RETURNS_PTR], [define if sprintf returns a pointer to the data])
1950 AC_DEFUN([wi_SPRINTF_RETVAL], [
1951 AC_MSG_CHECKING([what sprintf() returns])
1962 result = (int) sprintf(s, "%d", 22);
1970 wi_cv_sprintf_returns_ptr=no
1971 x="length of data written";
1974 wi_cv_sprintf_returns_ptr=yes
1975 AC_DEFINE(SPRINTF_RETURNS_PTR)
1976 x="pointer to data";
1978 # action if cross compiling
1979 wi_cv_sprintf_returns_ptr=no
1987 AC_DEFUN([wi_LIB_CRYPT], [
1988 AC_MSG_CHECKING([which library has usable crypt() function])
1989 ac_save_LIBS="$LIBS"
1992 for lib in "c" "crypt" "descrypt" "des"
1995 if test "$lib" = "c" ; then
1996 LIBS="$ac_save_LIBS"
1998 LIBS="$ac_save_LIBS -l${lib}"
2001 wi_PREREQ_UNISTD_H([$0])
2004 #if defined(AIX) || defined(_AIX) || defined(__HOS_AIX__)
2005 # define _ALL_SOURCE 1
2007 #ifdef HAVE_UNISTD_H
2008 # include <unistd.h>
2013 extern char *crypt(const char *key, const char *salt);
2017 char cleartext[256];
2020 memset(cleartext, 0, sizeof(cleartext));
2021 strcpy(cleartext, "password");
2023 cp = crypt(cleartext, "xx");
2024 if ((cp != NULL) && (strcmp(cp, "xxj31ZMTZzkVA") == 0)) {
2025 /* printf("PASS\n"); */
2028 /* printf("FAIL\n"); */
2038 # action if cross compiling
2043 if test "$crypt_lib" != NONE ; then
2050 LIBS="$ac_save_LIBS"
2052 if test "$crypt_lib" = NONE ; then
2054 AC_MSG_RESULT([none?])
2056 AC_MSG_RESULT([lib${crypt_lib}])
2058 if test "$crypt_lib" != c ; then
2059 AC_CHECK_LIB(${lib},crypt)
2065 AC_DEFUN([wi_TEST], [
2066 changequote(<^, ^>)dnl
2067 changequote([, ])dnl
2072 AH_TEMPLATE([HAVE__RES_DEFDNAME], [define if _res global variable is usable])
2073 AC_DEFUN([wi__RES_DEFDNAME], [
2074 AC_MSG_CHECKING([for useable _res global variable])
2078 #include <sys/types.h>
2079 #include <sys/stat.h>
2080 #include <sys/socket.h>
2081 #include <arpa/inet.h>
2082 #include <netinet/in.h>
2083 #ifdef HAVE_ARPA_NAMESER_H
2084 # include <arpa/nameser.h>
2086 #ifdef HAVE_RESOLV_H
2087 # include <resolv.h>
2094 len = (int) strlen(_res.defdname);
2096 wi_cv__res_defdname=yes
2097 AC_DEFINE(HAVE__RES_DEFDNAME)
2099 wi_cv__res_defdname=no
2101 AC_MSG_RESULT($wi_cv__res_defdname)
2107 AH_TEMPLATE([sig_atomic_t], [type to use for sig_atomic_t])
2108 AC_DEFUN([wi_TYPE_SIG_ATOMIC_T], [
2109 wi_PREREQ_UNISTD_H([$0])
2110 AC_MSG_CHECKING([for sig_atomic_t])
2113 #ifdef HAVE_UNISTD_H
2116 #include <sys/types.h>
2117 #include <sys/signal.h>
2118 #include <signal.h> /* MG: for IRIX */
2125 sig_atomic_t sample;
2127 sample = (sig_atomic_t) getpid(); /* bogus code, of course */
2128 exit((sample > 0) ? 0 : 1);
2130 ac_cv_type_sig_atomic_t=yes
2132 ac_cv_type_sig_atomic_t=no
2134 AC_MSG_RESULT($ac_cv_type_sig_atomic_t)
2135 if test $ac_cv_type_sig_atomic_t = no ; then
2136 AC_DEFINE(sig_atomic_t, int)
2143 AC_DEFUN([wi_LIB_READLINE], [
2144 AC_MSG_CHECKING([for GNU Readline library, version 2.0 or newer])
2146 wi_cv_lib_readline=no
2147 wi_cv_lib_readline_result=no
2148 ac_save_LIBS="$LIBS"
2149 # Note: $LIBCURSES is permitted to be empty.
2150 for LIBREADLINE in "-lreadline" "-lreadline $LIBCURSES" "-lreadline -ltermcap" "-lreadline -lncurses" "-lreadline -lcurses"
2152 LIBS="$ac_save_LIBS $LIBREADLINE"
2158 main(int argc, char **argv)
2160 /* Note: don't actually call readline, since it may block;
2161 * We just want to see if it (dynamic) linked in okay.
2163 if (argc == 0) /* never true */
2169 wi_cv_lib_readline=yes
2172 wi_cv_lib_readline=no
2174 # action if cross compiling
2175 wi_cv_lib_readline=no
2178 if test "$wi_cv_lib_readline" = yes ; then break ; fi
2181 # Now try it again, to be sure it is recent enough.
2182 # rl_function_of_keyseq appeared in version 2.0
2184 dnl AC_CHECK_FUNC(rl_function_of_keyseq, [wi_cv_lib_readline=yes],[
2185 dnl wi_cv_lib_readline=no;wi_cv_lib_readline_result="no (it is present but too old to use)"
2192 rl_function_of_keyseq(0);
2194 wi_cv_lib_readline=yes
2196 wi_cv_lib_readline=no
2197 wi_cv_lib_readline_result="no (it is present but too old to use)"
2200 if test "$wi_cv_lib_readline" = no ; then
2203 LIBS="$ac_save_LIBS"
2205 /bin/rm -f readline.ver
2211 #include <sys/types.h>
2214 extern char *rl_library_version;
2221 sscanf(rl_library_version, "%lf", &d);
2222 fp = fopen("readline.ver", "w");
2223 if (fp == NULL) exit(1);
2224 if (fprintf(fp, "%s\n", rl_library_version) < 0) exit(1);
2225 if (fprintf(fp, "%03d\n", (int) (d * 100.0)) < 0) exit(1);
2226 if (fclose(fp) < 0) exit(1);
2231 rl_library_version=`sed -n 1,1p readline.ver 2>/dev/null`
2232 rlver=`sed -n 2,2p readline.ver 2>/dev/null`
2233 /bin/rm -f readline.ver
2236 rl_library_version=''
2238 /bin/rm -f readline.ver
2240 # action if cross compiling
2241 rl_library_version=''
2243 /bin/rm -f readline.ver
2248 wi_cv_lib_readline_result="yes, installed version is $rl_library_version"
2251 # Test using current LIBS.
2254 extern int rl_completion_append_character;
2258 rl_completion_append_character = 0;
2265 if test "$rlver" = "210" ; then
2266 wi_cv_lib_readline_result="yes, version 2.1 or higher"
2268 wi_cv_lib_readline_result="yes, version 2.0"
2273 wi_cv_lib_readline=yes
2275 LIBS="$ac_save_LIBS"
2277 AC_MSG_RESULT($wi_cv_lib_readline_result)
2278 AC_SUBST(LIBREADLINE)
2280 if test "$wi_cv_lib_readline" = yes ; then
2281 # Now verify that all the headers are installed.
2284 unset ac_cv_header_readline_chardefs_h
2285 unset ac_cv_header_readline_history_h
2286 unset ac_cv_header_readline_keymaps_h
2287 unset ac_cv_header_readline_readline_h
2288 unset ac_cv_header_readline_tilde_h
2289 AC_CHECK_HEADERS([readline/chardefs.h readline/history.h readline/keymaps.h readline/readline.h readline/tilde.h])
2292 "$ac_cv_header_readline_chardefs_h" \
2293 "$ac_cv_header_readline_history_h" \
2294 "$ac_cv_header_readline_keymaps_h" \
2295 "$ac_cv_header_readline_readline_h" \
2296 "$ac_cv_header_readline_tilde_h"
2298 if test "$xxwi" = no ; then
2303 if test "$xxwi" = no ; then
2304 AC_MSG_WARN([GNU Readline headers are not installed or could not be found -- GNU Readline will not be used.])
2305 wi_cv_lib_readline=no
2306 wi_cv_lib_readline_result="no (headers not installed)"
2308 AC_DEFINE_UNQUOTED(HAVE_LIBREADLINE, $rlver)
2315 AH_TEMPLATE([HAVE_LONG_LONG], [define if we have the long long type])
2316 AH_TEMPLATE([PRINTF_LONG_LONG], [define if printf supports long long])
2317 AH_TEMPLATE([SCANF_LONG_LONG], [define if scanf supports long long])
2318 AH_TEMPLATE([PRINTF_ULONG_LONG], [define if printf supports unsigned long long])
2319 AH_TEMPLATE([SCANF_ULONG_LONG], [define if scanf supports unsigned long long])
2320 AH_TEMPLATE([PRINTF_LONG_LONG_QD], [define if using %qd for long long in printf])
2321 AH_TEMPLATE([SCANF_LONG_LONG_QD], [define if using %qd for long long in scanf])
2322 AH_TEMPLATE([PRINTF_LONG_LONG_LLD], [define if using %lld for long long in printf])
2323 AH_TEMPLATE([SCANF_LONG_LONG_LLD], [define if using %lld for long long in scanf])
2324 AC_DEFUN([wi_USE_LONG_LONG], [
2325 wi_PREREQ_UNISTD_H([$0])
2326 AC_MSG_CHECKING([for 64-bit integral type: long long])
2330 #if defined(AIX) || defined(_AIX) || defined(__HOS_AIX__)
2331 # define _ALL_SOURCE 1
2333 #ifdef HAVE_UNISTD_H
2334 # include <unistd.h>
2336 #include <sys/types.h>
2339 long long hugeNumvar = 1;
2343 long long hugeNumtoo = 2;
2345 if (hugeNumtoo > hugeNumvar)
2347 if (sizeof(hugeNumvar) < 8)
2354 wi_cv_type_long_long=yes
2355 LONGEST_INT="long long"
2358 wi_cv_type_long_long=no
2360 # action if cross compiling
2361 wi_cv_type_long_long=no
2363 AC_MSG_RESULT($wi_cv_type_long_long)
2365 if test "$wi_cv_type_long_long" = yes ; then
2367 AC_MSG_CHECKING([how to print a 64-bit integral type])
2368 wi_cv_printf_long_long=fail
2372 #if defined(AIX) || defined(_AIX) || defined(__HOS_AIX__)
2373 # define _ALL_SOURCE 1
2375 #ifdef HAVE_UNISTD_H
2376 # include <unistd.h>
2378 #include <sys/types.h>
2388 hugeNum = (long long) 1000000000;
2389 hugeNum = hugeNum * (long long) 99;
2390 hugeNum = hugeNum + (long long) 1;
2392 (void) sprintf(s, "%lld", hugeNum);
2393 exit((strcmp(s, "99000000001") == 0) ? 0 : 1);
2397 wi_cv_printf_long_long="%lld"
2402 # action if cross compiling
2407 if test "$wi_cv_printf_long_long" = fail ; then
2411 #if defined(AIX) || defined(_AIX) || defined(__HOS_AIX__)
2412 # define _ALL_SOURCE 1
2414 #ifdef HAVE_UNISTD_H
2415 # include <unistd.h>
2417 #include <sys/types.h>
2427 hugeNum = (long long) 1000000000;
2428 hugeNum = hugeNum * (long long) 99;
2429 hugeNum = hugeNum + (long long) 1;
2431 (void) sprintf(s, "%qd", hugeNum);
2432 exit((strcmp(s, "99000000001") == 0) ? 0 : 1);
2436 wi_cv_printf_long_long="%qd"
2441 # action if cross compiling
2446 if test "$wi_cv_printf_long_long" = fail ; then
2447 wi_cv_printf_long_long_msg_result='cannot print'
2449 wi_cv_printf_long_long_msg_result="$wi_cv_printf_long_long"
2452 AC_MSG_RESULT($wi_cv_printf_long_long_msg_result)
2455 AC_MSG_CHECKING([how to scan a 64-bit integral type])
2456 wi_cv_scanf_long_long=fail
2460 #if defined(AIX) || defined(_AIX) || defined(__HOS_AIX__)
2461 # define _ALL_SOURCE 1
2463 #ifdef HAVE_UNISTD_H
2464 # include <unistd.h>
2466 #include <sys/types.h>
2473 long long hugeNum, justAsHugeNum;
2475 hugeNum = (long long) 1000000000;
2476 hugeNum = hugeNum * (long long) 99;
2477 hugeNum = hugeNum + (long long) 1;
2479 justAsHugeNum = (long long) 0;
2481 sscanf("99000000001", "%lld", &justAsHugeNum);
2482 if (memcmp(&hugeNum, &justAsHugeNum, sizeof(hugeNum)) == 0)
2488 wi_cv_scanf_long_long="%lld"
2493 # action if cross compiling
2498 if test "$wi_cv_scanf_long_long" = fail ; then
2502 #if defined(AIX) || defined(_AIX) || defined(__HOS_AIX__)
2503 # define _ALL_SOURCE 1
2505 #ifdef HAVE_UNISTD_H
2506 # include <unistd.h>
2508 #include <sys/types.h>
2515 long long hugeNum, justAsHugeNum;
2517 hugeNum = (long long) 1000000000;
2518 hugeNum = hugeNum * (long long) 99;
2519 hugeNum = hugeNum + (long long) 1;
2521 justAsHugeNum = (long long) 0;
2523 sscanf("99000000001", "%qd", &justAsHugeNum);
2524 if (memcmp(&hugeNum, &justAsHugeNum, sizeof(hugeNum)) == 0)
2530 wi_cv_scanf_long_long="%qd"
2535 # action if cross compiling
2540 if test "$wi_cv_scanf_long_long" = fail ; then
2541 wi_cv_scanf_long_long_msg_result='cannot scan'
2543 wi_cv_scanf_long_long_msg_result="$wi_cv_scanf_long_long"
2546 AC_MSG_RESULT($wi_cv_scanf_long_long_msg_result)
2550 AC_MSG_CHECKING([if everything was available to use the 64-bit integral type])
2552 if test "$wi_cv_type_long_long" = no ; then
2553 wi_cv_use_long_long_msg_result="no (long long type not available)"
2554 wi_cv_use_long_long="no"
2555 wi_cv_scanf_long_long="fail"
2556 wi_cv_prihtf_long_long="fail"
2558 elif test "$wi_cv_printf_long_long" = fail ; then
2559 wi_cv_use_long_long_msg_result="no (libc printf() does not support them)"
2560 wi_cv_use_long_long="no"
2561 wi_cv_scanf_long_long="fail"
2562 wi_cv_prihtf_long_long="fail"
2564 elif test "$wi_cv_scanf_long_long" = fail ; then
2565 wi_cv_use_long_long_msg_result="no (libc scanf() does not support them)"
2566 wi_cv_use_long_long="no"
2567 wi_cv_scanf_long_long="fail"
2568 wi_cv_prihtf_long_long="fail"
2571 AC_DEFINE(HAVE_LONG_LONG)
2572 if test "$wi_cv_printf_long_long$wi_cv_scanf_long_long" = "%lld%qd" ; then
2573 # FreeBSD 3.2 has %lld and %qd, but we want to
2574 # run on 3.1 and 3.0.
2576 wi_cv_printf_long_long="%qd"
2578 wi_cv_printf_ulong_long=`echo "$wi_cv_printf_long_long" | sed 's/d$/u/;'`
2579 wi_cv_scanf_ulong_long=`echo "$wi_cv_scanf_long_long" | sed 's/d$/u/;'`
2580 AC_DEFINE_UNQUOTED(PRINTF_LONG_LONG, "$wi_cv_printf_long_long")
2581 AC_DEFINE_UNQUOTED(SCANF_LONG_LONG , "$wi_cv_scanf_long_long")
2582 AC_DEFINE_UNQUOTED(PRINTF_ULONG_LONG, "$wi_cv_printf_ulong_long")
2583 AC_DEFINE_UNQUOTED(SCANF_ULONG_LONG , "$wi_cv_scanf_ulong_long")
2584 if test "$wi_cv_printf_long_long" = "%qd" ; then
2585 AC_DEFINE(PRINTF_LONG_LONG_QD)
2587 AC_DEFINE(PRINTF_LONG_LONG_LLD)
2589 if test "$wi_cv_scanf_long_long" = "%qd" ; then
2590 AC_DEFINE(SCANF_LONG_LONG_QD)
2592 AC_DEFINE(SCANF_LONG_LONG_LLD)
2594 wi_cv_use_long_long="yes"
2595 wi_cv_use_long_long_msg_result="yes"
2597 AC_MSG_RESULT($wi_cv_use_long_long_msg_result)
2602 AC_DEFUN([wi_REMOVE_UNKNOWN_PREPROCESSING_DIRECTIVES_FROM_FILE], [
2603 AC_REQUIRE([wi_TEST_DASH_L])
2605 if test -f "$h_file" && $test_not_L "$h_file" ; then
2606 h_tmp=`echo "$h_file" | sed 's/\.h/.tmp/;'`
2608 changequote(<<, >>)dnl
2609 remove_cpp_warning=yes
2610 if [ "$SYS" = linux ] ; then
2612 # We need to retain #warning on Linux
2614 remove_cpp_warning=no
2616 if [ "$GCC" = yes ] ; then
2618 # GCC accepts #warning
2620 remove_cpp_warning=no
2623 if [ "$remove_cpp_warning" = yes ] ; then
2625 # Remove "#warning", since compiler will complain about it
2626 # not being recognized.
2628 sed 's/^\([\ \ ]*#[\ \ ]*warning.*\)/\/* \1 *\//;' "$h_file" > "$h_tmp"
2629 cmp -s "$h_file" "$h_tmp"
2630 if test $? -ne 0 ; then
2631 mv "$h_tmp" "$h_file"
2635 unset h_tmp longest_int_subst
2637 changequote([, ])dnl
2639 unset h_file remove_cpp_warning
2644 AC_DEFUN([wi_SUBST_LONGEST_INT_HEADER], [
2645 AC_REQUIRE([wi_TEST_DASH_L])
2647 if test -f "$h_file" && $test_not_L "$h_file" ; then
2648 h_tmp=`echo "$h_file" | sed 's/\.h/.tmp/;'`
2650 dnl LONGEST_INT should most often be "long long" if wi_USE_LONG_LONG has been run
2652 longest_int_subst="${LONGEST_INT-long}"
2654 if sed 's/^#define longest_int.*/#define longest_int '"$longest_int_subst"'/;s/^#define longest_uint.*/#define longest_uint unsigned '"$longest_int_subst"'/;' "$h_file" > "$h_tmp" ; then
2655 cmp -s "$h_file" "$h_tmp"
2656 if test $? -ne 0 ; then
2657 mv "$h_tmp" "$h_file"
2662 unset h_tmp longest_int_subst
2669 AC_DEFUN([wi_SUBST_STAT_HEADER], [
2670 AC_REQUIRE([wi_TEST_DASH_L])
2672 if test -f "$h_file" && $test_not_L "$h_file" ; then
2673 h_tmp=`echo "$h_file" | sed 's/\.h/.tmp/;'`
2675 dnl wi_cv_struct_stat64=yes
2677 if test "x$wi_cv_struct_stat64" = xyes ; then
2678 if sed 's/^#define Stat .*/#define Stat stat64/;s/^#define Lstat .*/#define Lstat lstat64/;s/^#define Fstat .*/#define Fstat fstat64/;' "$h_file" > "$h_tmp" ; then
2679 cmp -s "$h_file" "$h_tmp"
2680 if test $? -ne 0 ; then
2681 mv "$h_tmp" "$h_file"
2686 if sed 's/^#define Stat .*/#define Stat stat/;s/^#define Lstat .*/#define Lstat lstat/;s/^#define Fstat .*/#define Fstat fstat/;' "$h_file" > "$h_tmp" ; then
2687 cmp -s "$h_file" "$h_tmp"
2688 if test $? -ne 0 ; then
2689 mv "$h_tmp" "$h_file"
2695 unset h_tmp longest_int_subst
2703 AC_DEFUN([wi_MANDIR], [
2704 if test "x$mandir" = 'x${prefix}/man' ; then
2705 # Mandir is at default value -- try to see
2706 # if $prefix/share/man would be better.
2709 # $prefix is probably set to NONE.
2711 p=`cd / ; cd $prefix 2>/dev/null ; pwd`
2712 if test "x$p" = "x/" ; then
2715 if test -d "$p/share/man" ; then
2716 mandir="$p/share/man"
2724 AC_DEFUN([wi_BEAUTIFY_ENVIRONMENT_VARIABLES], [
2725 changequote(<<, >>)dnl
2726 LIBS=`echo "$LIBS" | sed 's/^ *//;s/ *$//;s/ */ /g'`
2727 LDFLAGS=`echo "$LDFLAGS" | sed 's/^ *//;s/ *$//;s/ */ /g'`
2728 CPPFLAGS=`echo "$CPPFLAGS" | sed 's/^ *//;s/ *$//;s/ */ /g'`
2729 CFLAGS=`echo "$CFLAGS $wi_CFLAGS_TO_ADD_LATER" | sed 's/^ *//;s/ *$//;s/ */ /g'`
2730 DEFS=`echo "$DEFS" | sed 's/^ *//;s/ *$//;s/ */ /g'`
2731 changequote([, ])dnl
2737 AC_DEFUN([wi_PATH_PWD], [
2738 AC_PATH_PROG(wi_PWD, "pwd", "pwd")
2744 AC_DEFUN([wi_BASENAME], [
2745 $1=`echo "[$]$1" | sed -n '
2757 AC_DEFUN([wi_DIRNAME], [
2758 changequote({{, }})dnl
2759 $1=`echo "{{$}}$1" | sed -n '
2779 changequote([, ])dnl
2785 AC_DEFUN([wi_RESOLVE_PATH], [
2786 AC_REQUIRE([wi_PATH_PWD])
2788 if test -d "$wi_path" ; then
2789 wi_resolved_path=`cd "$wi_path" ; $wi_PWD 2>/dev/null`
2790 elif test ! -f "$wi_path" ; then
2791 wi_resolved_path="$wi_path"
2793 wi_parent_dir="$wi_path"
2794 wi_file_name="$wi_path"
2795 wi_DIRNAME(wi_parent_dir)
2796 wi_BASENAME(wi_file_name)
2797 wi_resolved_path=`cd "$wi_parent_dir" ; $wi_PWD 2>/dev/null`
2798 if test "x$wi_resolved_path" != x ; then
2799 wi_resolved_path="$wi_resolved_path/$wi_file_name"
2801 unset wi_parent_dir wi_file_name
2803 if test "x$wi_resolved_path" = x ; then
2806 $2="$wi_resolved_path"
2808 unset wi_resolved_path wi_path
2814 AC_DEFUN([wi_PATH_MKTEMP], [
2815 AC_PATH_PROG(MKTEMP, "mktemp", "")
2821 AC_DEFUN([wi_PATH_PERL], [
2822 AC_PATH_PROG(PERL, "perl", "perl")
2828 AC_DEFUN([wi_PROG_PERL], [
2829 AC_REQUIRE([wi_PATH_PERL])
2830 if test "x$PERL" != "x" ; then
2831 AC_DEFINE_UNQUOTED(PERL, "$PERL")
2839 AC_DEFUN([wi_CREATE_AC_TMPDIR], [
2840 AC_REQUIRE([wi_PATH_MKTEMP])
2841 changequote({{, }})dnl
2843 if [ "x$MKTEMP" != "x" ] ; then
2844 # Ignore error from mktemp, since some old versions of Linux
2845 # print an error about not supporting -d.
2847 wi_tmpdir=`"$MKTEMP" -d /tmp/configure.XXXXXXXXXX 2>/dev/null`
2848 if [ $? -ne 0 ] ; then
2852 if [ "x$wi_tmpdir" = "x" ] ; then
2853 for wi_tmpdir in . $TMPDIR $TEMPDIR /tmp ABORT
2855 if [ "$wi_tmpdir" = ABORT ] ; then
2856 echo "Cannot create temporary directory."
2859 wi_tmpdir="$wi_tmpdir/config_tmp.$$"
2860 if [ -d "$wi_tmpdir" ] || [ -f "$wi_tmpdir" ] ; then
2861 echo "Will not create temporary directory."
2865 if [ $? -eq 0 ] && [ -d "$wi_tmpdir" ] ; then break ; fi
2868 changequote([, ])dnl
2870 # Use the temporary directory here...
2872 # Done using the temporary directory here.
2874 /bin/rm -r "$wi_tmpdir"
2881 AH_TEMPLATE([SELECT_TYPE_ARG1], [define this to the type of the first parameter to select()])
2882 AH_TEMPLATE([SELECT_TYPE_ARG234], [define this to the type of parameters 2, 3, and 4 to select()])
2883 AH_TEMPLATE([SELECT_TYPE_ARG5], [define this to the type of the fifth parameter to select()])
2884 AC_DEFUN([wi_FUNC_SELECT_ARGTYPES],
2886 wi_PREREQ_UNISTD_H([$0])
2887 AC_MSG_CHECKING([types of arguments for select()])
2888 AC_CACHE_VAL(ac_cv_func_select_arg234,dnl
2889 [AC_CACHE_VAL(ac_cv_func_select_arg1,dnl
2890 [AC_CACHE_VAL(ac_cv_func_select_arg5,dnl
2891 [for ac_cv_func_select_arg234 in 'fd_set *' 'int *' 'void *'; do
2892 for ac_cv_func_select_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do
2893 for ac_cv_func_select_arg5 in 'struct timeval *' 'const struct timeval *'; do
2895 [#if defined(AIX) || defined(_AIX) || defined(__HOS_AIX__) /* MG */
2896 # define _ALL_SOURCE 1 /* MG */
2898 #ifdef HAVE_UNISTD_H /* MG */
2901 #include <sys/types.h> /* MG: always incl */
2902 #include <sys/time.h> /* MG: always incl */
2903 #ifdef HAVE_SYS_SELECT_H
2904 #include <sys/select.h>
2906 #include <sys/socket.h> /* MG: always incl */
2907 extern select ($ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5);],,dnl
2908 [ac_not_found=no ; break 3],ac_not_found=yes)
2915 if test "$ac_not_found" = yes; then
2916 ac_cv_func_select_arg1=int
2917 ac_cv_func_select_arg234='int *'
2918 ac_cv_func_select_arg5='struct timeval *'
2920 AC_MSG_RESULT([$ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5])
2921 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1,$ac_cv_func_select_arg1)
2922 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234,($ac_cv_func_select_arg234))
2923 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5,($ac_cv_func_select_arg5))
2929 AC_DEFUN([wi_CREATE_PRPP_SCRIPT], [
2930 changequote({{, }})dnl
2931 cat << 'EOF' > "{{$1}}"
2936 # Feed the output of your CPP to this to print a list of function prototypes.
2946 my ($numclines) = 0;
2948 MAINLOOP: while (1) {
2949 if ($unputc ne "") {
2953 last unless (read(STDIN, $c, 1) == 1);
2957 } elsif ($c eq "}") {
2960 } elsif ($skipping) {
2962 } elsif ($c eq ";") {
2963 if ($line =~ m/^\s*(\S.*\S)\s*$/s) {
2967 if ($lines =~ m/^\s*(extern\s*)?(\S.*\S)\s*$/s) {
2969 $cline =~ s/\s+/\ /g;
2970 if ($cline =~ /^typedef/) {
2972 } elsif ($cline =~ /\(.*\)$/) {
2974 print $cline, ";\n";
2982 } elsif ($c eq "\n") {
2983 if ($line =~ m/^\s*(\S.*\S)\s*$/s) {
2984 $lines .= {{$}}1 . " ";
2987 } elsif (($c eq "#") && ($line eq "")) {
2988 # Looks like a preprocessor line, kill it
2990 last MAINLOOP if (read(STDIN, $c, 1) != 1);
2991 last if ($c eq "\n");
2994 } elsif ($c =~ /^\s$/) {
2995 $line .= " " if ($line ne "");
2996 } elsif (! $skipping) {
3000 exit(($numclines == 0) ? 1 : 0);
3003 changequote([, ])dnl
3009 AH_TEMPLATE([write_return_t], [return type from write])
3010 AH_TEMPLATE([write_size_t], [size parameter to write])
3011 AH_TEMPLATE([read_return_t], [return type from read])
3012 AH_TEMPLATE([read_size_t], [size parameter to read])
3013 AH_TEMPLATE([send_return_t], [return type from send])
3014 AH_TEMPLATE([send_size_t], [size parameter to send])
3015 AH_TEMPLATE([recv_return_t], [return type from recv])
3016 AH_TEMPLATE([recv_size_t], [size parameter to recv])
3017 AH_TEMPLATE([sockaddr_size_t], [size parameter to connect])
3018 AH_TEMPLATE([sockopt_size_t], [size parameter to setsockopt])
3019 AH_TEMPLATE([listen_backlog_t], [backlog parameter to write])
3020 AH_TEMPLATE([alarm_time_t], [seconds parameter to alarm])
3021 AH_TEMPLATE([gethost_addrptr_t], [address parameter to gethostbyaddr])
3022 AH_TEMPLATE([gethostname_size_t], [size parameter to gethostname])
3023 AC_DEFUN([wi_UNISTD_FUNC_PARAM_TYPES], [
3024 AC_REQUIRE([AC_PROG_CPP])
3025 AC_REQUIRE([wi_PATH_PERL])
3026 AC_REQUIRE([AC_TYPE_SIZE_T])
3027 AC_REQUIRE([wi_PATH_MKTEMP])
3028 wi_PREREQ_UNISTD_H([$0])
3029 AC_CACHE_CHECK([for return type from write], [wi_cv_write_return_t], [
3030 used_cache_for_wi_unistd_fpt="no"
3031 wi_CREATE_AC_TMPDIR([
3032 wi_CREATE_PRPP_SCRIPT([$wi_tmpdir/prpp.pl])
3034 changequote({{, }})dnl
3035 cat << 'EOF' > "$wi_tmpdir/unistd.c"
3036 #include <confdefs.h>
3039 #include <sys/types.h>
3040 #include <sys/socket.h>
3041 #include <netinet/in.h>
3042 #include <arpa/inet.h>
3051 cat << 'EOF' > "$wi_tmpdir/sed.sh"
3054 if [ {{$}}# -eq 0 ] ; then exit 1 ; fi
3057 sed -n 's/extern//;s/static//;
3086 }' | sed 's/int int/int/g'
3088 chmod 755 "$wi_tmpdir/sed.sh"
3091 cat << 'EOF' > "$wi_tmpdir/sed2.sh"
3094 if [ {{$}}# -eq 0 ] ; then exit 1 ; fi
3097 sed -n 's/extern//;s/static//;
3116 chmod 755 "$wi_tmpdir/sed2.sh"
3118 $CPP "-I${srcdir-.}" "$wi_tmpdir/unistd.c" > "$wi_tmpdir/unistd.i"
3119 if [ -s "$wi_tmpdir/unistd.i" ] ; then
3120 "$PERL" "$wi_tmpdir/prpp.pl" < "$wi_tmpdir/unistd.i" > "$wi_tmpdir/protos.h"
3122 if [ -f "$wi_tmpdir/protos.h" ] ; then
3124 # Check the return type of write()
3127 wi_cv_write_return_t=`sed -n 's/extern//;s/static//;
3128 s/__attribute__((__cdecl__))//;
3134 }' "$wi_tmpdir/protos.h"`
3136 # Check what type write() expects for the size parameter
3139 wi_cv_write_size_t=`/bin/sh "$wi_tmpdir/sed.sh" "$x" < "$wi_tmpdir/protos.h"`
3141 # Check the return type of send()
3144 wi_cv_send_return_t=`sed -n 's/extern//;s/static//;
3145 s/__attribute__((__cdecl__))//;
3151 }' "$wi_tmpdir/protos.h"`
3153 # Check what type send() expects for the size parameter
3154 # Tru64 is one example where send() differs from write() :-(
3157 wi_cv_send_size_t=`/bin/sh "$wi_tmpdir/sed.sh" "$x" < "$wi_tmpdir/protos.h"`
3159 # Check what type connect() expects for the size parameter
3162 wi_cv_sockaddr_size_t=`/bin/sh "$wi_tmpdir/sed.sh" "$x" < "$wi_tmpdir/protos.h"`
3164 # Check what type setsockopt() expects for the size parameter
3167 wi_cv_sockopt_size_t=`/bin/sh "$wi_tmpdir/sed.sh" "$x" < "$wi_tmpdir/protos.h"`
3169 # Check what type listen() expects for the backlog parameter
3172 wi_cv_listen_backlog_t=`/bin/sh "$wi_tmpdir/sed.sh" "$x" < "$wi_tmpdir/protos.h"`
3174 # Check what type alarm() expects for the seconds parameter
3177 wi_cv_alarm_time_t=`/bin/sh "$wi_tmpdir/sed.sh" "$x" < "$wi_tmpdir/protos.h"`
3179 # Check what type gethostbyaddr() expects for the addr parameter
3182 wi_cv_gethost_addrptr_t=`/bin/sh "$wi_tmpdir/sed2.sh" "$x" < "$wi_tmpdir/protos.h"`
3184 # Check what type gethostname() expects for the size parameter
3187 wi_cv_gethostname_size_t=`/bin/sh "$wi_tmpdir/sed.sh" "$x" < "$wi_tmpdir/protos.h"`
3189 if [ "x$wi_cv_write_return_t" = "x" ] ; then
3190 wi_cv_write_return_t="int"
3192 if [ "x$wi_cv_write_size_t" = "x" ] ; then
3193 wi_cv_write_size_t="int"
3195 if [ "x$wi_cv_send_return_t" = "x" ] ; then
3196 wi_cv_send_return_t="int"
3198 if [ "x$wi_cv_send_size_t" = "x" ] ; then
3199 wi_cv_send_size_t="int"
3201 if [ "x$wi_cv_sockaddr_size_t" = "x" ] ; then
3202 wi_cv_sockaddr_size_t="int"
3204 if [ "x$wi_cv_sockopt_size_t" = "x" ] ; then
3205 wi_cv_sockopt_size_t="int"
3207 if [ "x$wi_cv_listen_backlog_t" = "x" ] ; then
3208 wi_cv_listen_backlog_t="int"
3210 if [ "x$wi_cv_alarm_time_t" = "x" ] ; then
3211 wi_cv_alarm_time_t="int"
3213 if [ "x$wi_cv_gethost_addrptr_t" = "x" ] ; then
3214 wi_cv_gethost_addrptr_t="struct in_addr *"
3216 if [ "$wi_cv_gethost_addrptr_t" = "const void" ] ; then
3217 wi_cv_gethost_addrptr_t="const struct in_addr *"
3219 if [ "x$wi_cv_gethostname_size_t" = "x" ] ; then
3220 wi_cv_gethostname_size_t="int"
3222 changequote([, ])dnl
3225 if test "x$used_cache_for_wi_unistd_fpt" = "xno" ; then
3226 AC_MSG_CHECKING([for size parameter to write])
3227 AC_MSG_RESULT([$wi_cv_write_size_t])
3228 AC_MSG_CHECKING([for return type from send])
3229 AC_MSG_RESULT([$wi_cv_send_return_t])
3230 AC_MSG_CHECKING([for size parameter to send])
3231 AC_MSG_RESULT([$wi_cv_send_size_t])
3232 AC_MSG_CHECKING([for size parameter to connect])
3233 AC_MSG_RESULT([$wi_cv_sockaddr_size_t])
3234 AC_MSG_CHECKING([for size parameter to setsockopt])
3235 AC_MSG_RESULT([$wi_cv_sockopt_size_t])
3236 AC_MSG_CHECKING([for backlog parameter to listen])
3237 AC_MSG_RESULT([$wi_cv_listen_backlog_t])
3238 AC_MSG_CHECKING([for seconds parameter to alarm])
3239 AC_MSG_RESULT([$wi_cv_alarm_time_t])
3240 AC_MSG_CHECKING([for address parameter to gethostbyaddr])
3241 AC_MSG_RESULT([$wi_cv_gethost_addrptr_t])
3242 AC_MSG_CHECKING([for size parameter to gethostname])
3243 AC_MSG_RESULT([$wi_cv_gethostname_size_t])
3245 AC_CACHE_CHECK([for size parameter to write],[wi_cv_write_size_t],[:])
3246 AC_CACHE_CHECK([for return type from send],[wi_cv_send_return_t],[:])
3247 AC_CACHE_CHECK([for size parameter to send],[wi_cv_send_size_t],[:])
3248 AC_CACHE_CHECK([for size parameter to connect],[wi_cv_sockaddr_size_t],[:])
3249 AC_CACHE_CHECK([for size parameter to setsockopt],[wi_cv_sockopt_size_t],[:])
3250 AC_CACHE_CHECK([for backlog parameter to listen],[wi_cv_listen_backlog_t],[:])
3251 AC_CACHE_CHECK([for seconds parameter to alarm],[wi_cv_alarm_time_t],[:])
3252 AC_CACHE_CHECK([for address parameter to gethostbyaddr],[wi_cv_gethost_addrptr_t],[:])
3253 AC_CACHE_CHECK([for size parameter to gethostname],[wi_cv_gethostname_size_t],[:])
3255 unset used_cache_for_wi_unistd_fpt
3256 AC_DEFINE_UNQUOTED(write_return_t, $wi_cv_write_return_t)
3257 AC_DEFINE_UNQUOTED(write_size_t, $wi_cv_write_size_t)
3258 AC_DEFINE_UNQUOTED(read_return_t, $wi_cv_write_return_t)
3259 AC_DEFINE_UNQUOTED(read_size_t, $wi_cv_write_size_t)
3260 AC_DEFINE_UNQUOTED(send_return_t, $wi_cv_send_return_t)
3261 AC_DEFINE_UNQUOTED(send_size_t, $wi_cv_send_size_t)
3262 AC_DEFINE_UNQUOTED(recv_return_t, $wi_cv_send_return_t)
3263 AC_DEFINE_UNQUOTED(recv_size_t, $wi_cv_send_size_t)
3264 AC_DEFINE_UNQUOTED(sockaddr_size_t, $wi_cv_sockaddr_size_t)
3265 AC_DEFINE_UNQUOTED(sockopt_size_t, $wi_cv_sockopt_size_t)
3266 AC_DEFINE_UNQUOTED(listen_backlog_t, $wi_cv_listen_backlog_t)
3267 AC_DEFINE_UNQUOTED(alarm_time_t, $wi_cv_alarm_time_t)
3268 AC_DEFINE_UNQUOTED(gethost_addrptr_t, $wi_cv_gethost_addrptr_t)
3269 AC_DEFINE_UNQUOTED(gethostname_size_t, $wi_cv_gethostname_size_t)
3275 AC_DEFUN([wi_PATH_GNU_TAR_OR_TAR], [
3276 AC_PATH_PROG(TAR, "gtar", "")
3277 if test "x$TAR" = "x" ; then
3279 unset ac_cv_path_TAR
3280 AC_PATH_PROG(TAR, "tar", "")
3287 AH_TEMPLATE([TAR], [define to the tar command being used])
3288 AC_DEFUN([wi_PROG_TAR], [
3289 AC_REQUIRE([wi_PATH_GNU_TAR_OR_TAR])
3290 if test "x$TAR" != "x" ; then
3291 AC_DEFINE_UNQUOTED(TAR, "$TAR")
3299 AC_DEFUN([wi_CREATE_TAR_FILES], [
3300 AC_REQUIRE([wi_PATH_GNU_TAR_OR_TAR])
3301 AC_MSG_CHECKING([how to create TAR files])
3302 changequote(<<, >>)dnl
3304 if [ -x /usr/bin/what ] ; then
3305 x=`/usr/bin/what "$TAR" 2>&1 | sed -n 's/.*pax.*/pax/g;/pax/p'`
3306 elif [ -x /bin/what ] ; then
3307 x=`/bin/what "$TAR" 2>&1 | sed -n 's/.*pax.*/pax/g;/pax/p'`
3309 if [ "x$x" != "xpax" ] ; then
3310 # The junk above is because Mac OS X Server's tar freaks out
3311 # and does not exit if you do "tar --help".
3313 x=`"$TAR" --help 2>&1 | sed -n 's/.*owner=NAME.*/owner=NAME/g;/owner=NAME/p'`
3317 TARFLAGS="-c --owner=root --group=bin --verbose -f"
3323 changequote([, ])dnl
3325 AC_MSG_RESULT([$TAR $TARFLAGS])
3331 AC_DEFUN([wi_PROG_CCDV_NO_CREATE], [
3332 if test "x$use_ccdv" = "xno" ; then
3333 AC_MSG_CHECKING([for ccdv])
3334 AC_MSG_RESULT([(disabled)])
3336 AC_PATH_PROG(CCDV, "CCDV", "")
3337 CCDV="$wi_cv_path_ccdv"
3338 if test "x$CCDV" != x ; then
3339 CCDV="@$CCDV " # trailing space needed
3348 AC_DEFUN([wi_PROG_CCDV], [
3349 if test "x$use_ccdv" = "xno" ; then
3350 AC_MSG_CHECKING([for ccdv])
3351 AC_MSG_RESULT([(disabled)])
3353 unset wi_cv_path_ccdv # can't use cache if it was a temp prog last time
3354 wi_used_cache_path_ccdv="yes"
3355 AC_CACHE_CHECK([for ccdv], [wi_cv_path_ccdv], [
3356 wi_used_cache_path_ccdv="no"
3357 for CCDV in /usr/bin/ccdv /usr/local/bin/ccdv /usr/ccs/bin/ccdv NONE
3359 if test "$CCDV" = NONE ; then CCDV="" ; break ; fi
3360 $CCDV >/dev/null 2>&1
3361 if test $? -eq 96 ; then
3365 if test "x$CCDV" = "x" ; then
3366 changequote({{, }})dnl
3367 cat > ccdv.c << 'EOF'
3370 * Copyright (C) 2002-2003, by Mike Gleason, NcFTP Software.
3371 * All Rights Reserved.
3373 * Licensed under the GNU Public License.
3376 #include <sys/types.h>
3377 #include <sys/time.h>
3378 #include <sys/wait.h>
3385 #define SETCOLOR_SUCCESS (gANSIEscapes ? "\033\1331;32m" : "")
3386 #define SETCOLOR_FAILURE (gANSIEscapes ? "\033\1331;31m" : "")
3387 #define SETCOLOR_WARNING (gANSIEscapes ? "\033\1331;33m" : "")
3388 #define SETCOLOR_NORMAL (gANSIEscapes ? "\033\1330;39m" : "")
3390 #define TEXT_BLOCK_SIZE 8192
3393 #define TERMS "vt100:vt102:vt220:vt320:xterm:xterm-color:ansi:linux:scoterm:scoansi:dtterm:cons25:cygwin:screen"
3395 size_t gNBufUsed = 0, gNBufAllocated = 0;
3398 char gAction[64] = "";
3399 char gTarget[64] = "";
3401 char gArLibraryTarget[64] = "";
3402 int gDumpCmdArgs = 0;
3405 int gANSIEscapes = 0;
3406 int gExitStatus = 95;
3409 DumpFormattedOutput(void)
3412 char spaces[8 + 1] = " ";
3419 for (cp = gBuf + ((gDumpCmdArgs == 0) ? strlen(gArgsStr) : 0); ; cp++) {
3421 if (saved != NULL) {
3430 cp = spaces + 8 - (8 - ((curcol - INDENT - 1) % 8));
3433 for (i = INDENT; --i >= 0; )
3438 if (++curcol == (gColumns - 1)) {
3441 } else if (*cp == '\n')
3445 } /* DumpFormattedOutput */
3449 /* Difftime(), only for timeval structures. */
3450 static void TimeValSubtract(struct timeval *tdiff, struct timeval *t1, struct timeval *t0)
3452 tdiff->tv_sec = t1->tv_sec - t0->tv_sec;
3453 tdiff->tv_usec = t1->tv_usec - t0->tv_usec;
3454 if (tdiff->tv_usec < 0) {
3456 tdiff->tv_usec += 1000000;
3458 } /* TimeValSubtract */
3469 pid2 = (int) waitpid(gCCPID, &status, 0);
3470 } while (((pid2 >= 0) && (! WIFEXITED(status))) || ((pid2 < 0) && (errno == EINTR)));
3471 if (WIFEXITED(status))
3472 gExitStatus = WEXITSTATUS(status);
3478 SlurpProgress(int fd)
3485 struct timeval now, tnext, tleft;
3488 const char *trail = "/-\\|", *trailcp;
3491 snprintf(s1, sizeof(s1), "%s%s%s... ", gAction, gTarget[0] ? " " : "", gTarget);
3492 printf("\r%-70s%-9s", s1, "");
3495 gettimeofday(&now, NULL);
3503 if (gNBufUsed == (gNBufAllocated - 1)) {
3504 if ((newbuf = (char *) realloc(gBuf, gNBufAllocated + TEXT_BLOCK_SIZE)) == NULL) {
3505 perror("ccdv: realloc");
3508 gNBufAllocated += TEXT_BLOCK_SIZE;
3513 nready = select(fd + 1, &ss, NULL, NULL, &tleft);
3517 if (errno != EINTR) {
3518 perror("ccdv: select");
3523 gettimeofday(&now, NULL);
3524 if ((now.tv_sec > tnext.tv_sec) || ((now.tv_sec == tnext.tv_sec) && (now.tv_usec >= tnext.tv_usec))) {
3529 printf("\r%-71s%c%-7s", s1, *trailcp, "");
3531 if (*++trailcp == '\0')
3534 TimeValSubtract(&tleft, &tnext, &now);
3537 ntoread = (gNBufAllocated - gNBufUsed - 1);
3538 nread = read(fd, gBuf + gNBufUsed, ntoread);
3542 perror("ccdv: read");
3544 } else if (nread == 0) {
3548 gBuf[gNBufUsed] = '\0';
3550 snprintf(s1, sizeof(s1), "%s%s%s: ", gAction, gTarget[0] ? " " : "", gTarget);
3552 if (gExitStatus == 0) {
3553 printf("\r%-70s", s1);
3554 printf("[%s%s%s]", ((gNBufUsed - strlen(gArgsStr)) < 4) ? SETCOLOR_SUCCESS : SETCOLOR_WARNING, "OK", SETCOLOR_NORMAL);
3555 printf("%-5s\n", " ");
3557 printf("\r%-70s", s1);
3558 printf("[%s%s%s]", SETCOLOR_FAILURE, "ERROR", SETCOLOR_NORMAL);
3559 printf("%-2s\n", " ");
3560 gDumpCmdArgs = 1; /* print cmd when there are errors */
3564 } /* SlurpProgress */
3575 printf("%s%s%s.\n", gAction, gTarget[0] ? " " : "", gTarget);
3579 if (gNBufUsed == (gNBufAllocated - 1)) {
3580 if ((newbuf = (char *) realloc(gBuf, gNBufAllocated + TEXT_BLOCK_SIZE)) == NULL) {
3581 perror("ccdv: realloc");
3584 gNBufAllocated += TEXT_BLOCK_SIZE;
3587 ntoread = (gNBufAllocated - gNBufUsed - 1);
3588 nread = read(fd, gBuf + gNBufUsed, ntoread);
3592 perror("ccdv: read");
3594 } else if (nread == 0) {
3598 gBuf[gNBufUsed] = '\0';
3601 gDumpCmdArgs = (gExitStatus != 0); /* print cmd when there are errors */
3608 Basename(const char *path)
3611 cp = strrchr(path, '/');
3620 Extension(const char *path)
3622 const char *cp = path;
3623 cp = strrchr(path, '.');
3634 fprintf(stderr, "Usage: ccdv /path/to/cc CFLAGS...\n\n");
3635 fprintf(stderr, "I wrote this to reduce the deluge Make output to make finding actual problems\n");
3636 fprintf(stderr, "easier. It is intended to be invoked from Makefiles, like this. Instead of:\n\n");
3637 fprintf(stderr, "\t.c.o:\n");
3638 fprintf(stderr, "\t\t$(CC) $(CFLAGS) $(DEFS) $(CPPFLAGS) $< -c\n");
3639 fprintf(stderr, "\nRewrite your rule so it looks like:\n\n");
3640 fprintf(stderr, "\t.c.o:\n");
3641 fprintf(stderr, "\t\t@ccdv $(CC) $(CFLAGS) $(DEFS) $(CPPFLAGS) $< -c\n\n");
3642 fprintf(stderr, "ccdv 1.1.0 is Free under the GNU Public License. Enjoy!\n");
3643 fprintf(stderr, " -- Mike Gleason, NcFTP Software <http://www.ncftp.com>\n");
3650 main(int argc, char **argv)
3658 int cc = 0, pch = 0;
3664 snprintf(gAction, sizeof(gAction), "Running %s", Basename(argv[1]));
3665 memset(gArgsStr, 0, sizeof(gArgsStr));
3666 for (i = 1; i < argc; i++) {
3667 quote = (strchr(argv[i], ' ') != NULL) ? "\"" : "";
3668 snprintf(gArgsStr + strlen(gArgsStr), sizeof(gArgsStr) - strlen(gArgsStr), "%s%s%s%s%s", (i == 1) ? "" : " ", quote, argv[i], quote, (i == (argc - 1)) ? "\n" : "");
3669 if ((strcmp(argv[i], "-o") == 0) && ((i + 1) < argc)) {
3670 if (strcasecmp(Extension(argv[i + 1]), ".o") != 0) {
3671 strcpy(gAction, "Linking");
3672 snprintf(gTarget, sizeof(gTarget), "%s", Basename(argv[i + 1]));
3674 } else if (strchr("-+/", (int) argv[i][0]) != NULL) {
3676 } else if (strncasecmp(Extension(argv[i]), ".c", 2) == 0) {
3678 snprintf(gTarget, sizeof(gTarget), "%s", Basename(argv[i]));
3679 } else if ((strncasecmp(Extension(argv[i]), ".h", 2) == 0) && (cc == 0)) {
3681 snprintf(gTarget, sizeof(gTarget), "%s", Basename(argv[i]));
3682 } else if ((i == 1) && (strcmp(Basename(argv[i]), "ar") == 0)) {
3683 snprintf(gAr, sizeof(gAr), "%s", Basename(argv[i]));
3684 } else if ((gArLibraryTarget[0] == '\0') && (strcasecmp(Extension(argv[i]), ".a") == 0)) {
3685 snprintf(gArLibraryTarget, sizeof(gArLibraryTarget), "%s", Basename(argv[i]));
3688 if ((gAr[0] != '\0') && (gArLibraryTarget[0] != '\0')) {
3689 strcpy(gAction, "Creating library");
3690 snprintf(gTarget, sizeof(gTarget), "%s", gArLibraryTarget);
3691 } else if (pch > 0) {
3692 strcpy(gAction, "Precompiling");
3693 } else if (cc > 0) {
3694 strcpy(gAction, "Compiling");
3697 if (pipe(pipe1) < 0) {
3698 perror("ccdv: pipe");
3703 devnull = open("/dev/null", O_RDWR, 00666);
3704 if ((devnull != 0) && (dup2(devnull, 0) == 0))
3707 gCCPID = (int) fork();
3709 (void) close(pipe1[0]);
3710 (void) close(pipe1[1]);
3711 perror("ccdv: fork");
3713 } else if (gCCPID == 0) {
3715 (void) close(pipe1[0]); /* close read end */
3716 if (pipe1[1] != 1) { /* use write end on stdout */
3717 (void) dup2(pipe1[1], 1);
3718 (void) close(pipe1[1]);
3720 (void) dup2(1, 2); /* use write end on stderr */
3721 execvp(argv[1], argv + 1);
3727 (void) close(pipe1[1]); /* close write end */
3728 fd = pipe1[0]; /* use read end */
3730 gColumns = (getenv("COLUMNS") != NULL) ? atoi(getenv("COLUMNS")) : 80;
3731 gANSIEscapes = (getenv("TERM") != NULL) && (strstr(TERMS, getenv("TERM")) != NULL);
3732 gBuf = (char *) malloc(TEXT_BLOCK_SIZE);
3736 gNBufAllocated = TEXT_BLOCK_SIZE;
3737 if (strlen(gArgsStr) < (gNBufAllocated - 1)) {
3738 strcpy(gBuf, gArgsStr);
3739 gNBufUsed = strlen(gArgsStr);
3743 if (SlurpProgress(fd) < 0)
3746 if (SlurpAll(fd) < 0)
3749 DumpFormattedOutput();
3753 gDumpCmdArgs = 1; /* print cmd when there are errors */
3754 DumpFormattedOutput();
3755 while ((nread = read(fd, emerg, (size_t) sizeof(emerg))) > 0)
3756 (void) write(2, emerg, (size_t) nread);
3762 changequote([, ])dnl
3763 ${CC-cc} $DEFS $CPPFLAGS $CFLAGS "ccdv.c" -o "ccdv" >/dev/null 2>&1
3764 /bin/rm -f ccdv.c ccdv.o ccdv.c.gz.uu ccdv.c.gz
3765 strip ./ccdv >/dev/null 2>&1
3766 ./ccdv >/dev/null 2>&1
3767 if test $? -eq 96 ; then
3773 if test "x$CCDV" != x ; then
3774 wi_RESOLVE_PATH([$CCDV], [CCDV])
3775 wi_cv_path_ccdv="$CCDV"
3776 CCDV="@$CCDV " # trailing space needed
3781 if test "$wi_used_cache_path_ccdv" = yes ; then
3782 CCDV="$wi_cv_path_ccdv"
3783 if test "x$CCDV" != x ; then
3784 CCDV="@$CCDV " # trailing space needed
3794 AC_DEFUN([wi_HEADER_CURSES], [
3795 AC_MSG_CHECKING([for curses library headers])
3796 if test "$wi_cv_ncurses" != "no" ; then
3797 AC_CHECK_HEADERS(ncurses.h curses.h termios.h termio.h sgtty.h sys/ioctl.h)
3799 AC_CHECK_HEADERS(curses.h termios.h termio.h sgtty.h sys/ioctl.h)
3801 dnl needed for Solaris 7
3802 if test "$ac_cv_header_curses_h" = no ; then
3803 if test -f /usr/include/curses.h ; then
3804 AC_DEFINE(HAVE_CURSES_H)
3805 ac_cv_header_curses_h=yes
3813 AH_TEMPLATE([HAVE_LIBCURSES], [define if linking against libcurses])
3814 AH_TEMPLATE([HAVE_LIBNCURSES], [define if linking against libncurses])
3815 AC_DEFUN([wi_LIB_CURSES], [
3817 AC_MSG_CHECKING([for curses library])
3820 wi_cv_lib_curses_result=no
3821 ac_save_LIBS="$LIBS"
3822 for LIBCURSES in "-lncurses" "-lcurses" "-lcurses -ltermcap" "-ltermcap -lcurses"
3824 if test "x$LIBCURSES-$wi_cv_ncurses" = "x-lncurses-no" ; then
3825 # This should never work
3826 LIBCURSES="-lkdfjkdjfs"
3828 LIBS="$ac_save_LIBS $LIBCURSES"
3834 #ifdef HAVE_NCURSES_H
3835 # include <ncurses.h>
3837 # include <curses.h>
3841 main(int argc, char **argv)
3843 /* Note: don't actually call curses, since it may block;
3844 * We just want to see if it (dynamic) linked in okay.
3852 wi_cv_lib_curses=yes
3853 wi_cv_lib_curses_result="yes"
3858 # action if cross compiling
3862 if test "$wi_cv_lib_curses" = yes ; then break ; fi
3866 LIBS="$ac_save_LIBS"
3868 if test "$wi_cv_lib_curses_result" != "no" ; then
3869 case "$LIBCURSES" in
3871 AC_DEFINE(HAVE_LIBNCURSES)
3874 AC_DEFINE(HAVE_LIBCURSES)
3876 "-lcurses -ltermcap")
3877 AC_DEFINE(HAVE_LIBCURSES)
3879 "-ltermcap -lcurses")
3880 AC_DEFINE(HAVE_LIBCURSES)
3888 AC_MSG_RESULT([$wi_cv_lib_curses_result])
3894 AH_TEMPLATE([waddstr_str_t], [string parameter to waddstr])
3895 AH_TEMPLATE([WADDSTR_TYPE_ARG1_CONST], [define if first parameter to waddstr is const char *])
3896 AC_DEFUN([wi_CURSES_FUNC_PARAM_TYPES], [
3897 AC_REQUIRE([AC_PROG_CPP])
3898 AC_REQUIRE([wi_PATH_PERL])
3899 AC_REQUIRE([wi_PATH_MKTEMP])
3900 wi_PREREQ_UNISTD_H([$0])
3901 AC_CACHE_CHECK([string parameter to waddstr], [wi_cv_waddstr_str_t], [
3902 used_cache_for_wi_curses_fpt="no"
3903 wi_CREATE_AC_TMPDIR([
3904 wi_CREATE_PRPP_SCRIPT([$wi_tmpdir/prpp.pl])
3906 changequote({{, }})dnl
3907 cat << 'EOF' > "$wi_tmpdir/curses.c"
3908 #if defined(AIX) || defined(_AIX) || defined(__HOS_AIX__)
3909 # define _ALL_SOURCE 1
3911 #include <confdefs.h>
3912 #ifdef HAVE_UNISTD_H
3913 # include <unistd.h>
3915 #include <sys/types.h>
3920 #ifdef HAVE_NCURSES_H
3921 # include <ncurses.h>
3923 # include <curses.h>
3932 cat << 'EOF' > "$wi_tmpdir/sed2.sh"
3935 if [ {{$}}# -eq 0 ] ; then exit 1 ; fi
3938 sed -n 's/extern//;s/static//;
3957 chmod 755 "$wi_tmpdir/sed2.sh"
3959 $CPP "-I${srcdir-.}" "$wi_tmpdir/curses.c" > "$wi_tmpdir/curses.i"
3960 if [ -s "$wi_tmpdir/curses.i" ] ; then
3961 "$PERL" "$wi_tmpdir/prpp.pl" < "$wi_tmpdir/curses.i" > "$wi_tmpdir/protos.h"
3963 if [ -f "$wi_tmpdir/protos.h" ] ; then
3965 # Check what type waddstr() expects for the string parameter
3968 wi_cv_waddstr_str_t=`/bin/sh "$wi_tmpdir/sed2.sh" "$x" < "$wi_tmpdir/protos.h"`
3970 if [ "x$wi_cv_waddstr_str_t" = "x" ] ; then
3971 wi_cv_waddstr_str_t="const char *"
3973 changequote([, ])dnl
3976 dnl if test "x$used_cache_for_wi_curses_fpt" = "xno" ; then
3977 dnl AC_MSG_CHECKING([string parameter to waddstr])
3978 dnl AC_MSG_RESULT([$wi_cv_waddstr_str_t])
3980 dnl AC_CACHE_CHECK([string parameter to waddstr],[wi_cv_waddstr_str_t],[:])
3982 unset used_cache_for_wi_curses_fpt
3983 AC_DEFINE_UNQUOTED(waddstr_str_t, $wi_cv_waddstr_str_t)
3984 if test "$wi_cv_waddstr_str_t" = "const char *" ; then
3985 AC_DEFINE(WADDSTR_TYPE_ARG1_CONST)
3992 AH_TEMPLATE([HAVE_BEEP], [define if curses library has beep() functionality])
3993 AH_TEMPLATE([HAVE__MAXX], [define if curses structure has maxx or _maxx field])
3994 AH_TEMPLATE([HAVE_GETCURX], [define if curses library has getcurx() functionality])
3995 AH_TEMPLATE([HAVE_GETYX], [define if curses library has getyx() functionality])
3996 AH_TEMPLATE([HAVE_GETMAXX], [define if curses library has getmaxx() functionality])
3997 AH_TEMPLATE([HAVE_GETMAXYX], [define if curses library has getmaxyx() functionality])
3998 AH_TEMPLATE([HAVE_GETBEGX], [define if curses library has getbegx() functionality])
3999 AH_TEMPLATE([HAVE_GETBEGYX], [define if curses library has getbegyx() functionality])
4000 AH_TEMPLATE([HAVE_TOUCHWIN], [define if curses library has touchwin() functionality])
4001 AC_DEFUN([wi_CURSES_FEATURES], [
4002 if test "$wi_cv_lib_curses" = "yes" ; then
4003 wi_PREREQ_UNISTD_H([$0])
4004 # Then $LIBCURSES is a list of curses and support libraries.
4005 ac_save_LIBS="$LIBS";
4006 LIBS="$LIBS $LIBCURSES";
4008 wi_CURSES_FUNC_PARAM_TYPES
4011 AC_MSG_CHECKING([whether curses structure has maxx or _maxx field])
4014 #if defined(AIX) || defined(_AIX) || defined(__HOS_AIX__)
4015 # define _ALL_SOURCE 1
4017 #ifdef HAVE_UNISTD_H
4018 # include <unistd.h>
4020 #include <sys/types.h>
4025 #ifdef HAVE_NCURSES_H
4026 # include <ncurses.h>
4028 # include <curses.h>
4033 w = newwin(10, 10, 1, 1);
4036 AC_MSG_RESULT([maxx])
4038 AC_DEFINE(HAVE__MAXX)
4039 AC_MSG_RESULT([_maxx])
4042 if test "${SYS-hpux}" = hpux ; then
4043 AC_CHECK_FUNCS(__getcurx __getcury __getmaxx __getmaxy __getbegx __getbegy)
4047 AC_MSG_CHECKING([for getcurx() functionality in curses library])
4050 #ifdef HAVE_UNISTD_H
4051 # include <unistd.h>
4053 #include <sys/types.h>
4058 #ifdef HAVE_NCURSES_H
4059 # include <ncurses.h>
4061 # include <curses.h>
4072 AC_DEFINE(HAVE_GETCURX)
4073 AC_MSG_RESULT([yes])
4079 AC_MSG_CHECKING([for getyx() functionality in curses library])
4082 #ifdef HAVE_UNISTD_H
4083 # include <unistd.h>
4085 #include <sys/types.h>
4090 #ifdef HAVE_NCURSES_H
4091 # include <ncurses.h>
4093 # include <curses.h>
4101 getyx(junk, my, mx);
4104 AC_DEFINE(HAVE_GETYX)
4105 AC_MSG_RESULT([yes])
4111 AC_MSG_CHECKING([for getmaxx() functionality in curses library])
4114 #ifdef HAVE_UNISTD_H
4115 # include <unistd.h>
4117 #include <sys/types.h>
4122 #ifdef HAVE_NCURSES_H
4123 # include <ncurses.h>
4125 # include <curses.h>
4135 AC_DEFINE(HAVE_GETMAXX)
4136 AC_MSG_RESULT([yes])
4142 AC_MSG_CHECKING([for getmaxyx() functionality in curses library])
4145 #ifdef HAVE_UNISTD_H
4146 # include <unistd.h>
4148 #include <sys/types.h>
4153 #ifdef HAVE_NCURSES_H
4154 # include <ncurses.h>
4156 # include <curses.h>
4163 getmaxyx(junk, my, mx);
4164 exit(my < 0 ? my : 0);
4166 AC_DEFINE(HAVE_GETMAXYX)
4167 AC_MSG_RESULT([yes])
4173 AC_MSG_CHECKING([for getbegx() functionality in curses library])
4176 #ifdef HAVE_UNISTD_H
4177 # include <unistd.h>
4179 #include <sys/types.h>
4184 #ifdef HAVE_NCURSES_H
4185 # include <ncurses.h>
4187 # include <curses.h>
4198 AC_DEFINE(HAVE_GETBEGX)
4199 AC_MSG_RESULT([yes])
4205 AC_MSG_CHECKING([for getbegyx() functionality in curses library])
4208 #ifdef HAVE_UNISTD_H
4209 # include <unistd.h>
4211 #include <sys/types.h>
4216 #ifdef HAVE_NCURSES_H
4217 # include <ncurses.h>
4219 # include <curses.h>
4226 getbegyx(junk, my, mx);
4227 exit(my < 0 ? my : 0);
4229 AC_DEFINE(HAVE_GETBEGYX)
4230 AC_MSG_RESULT([yes])
4236 AC_MSG_CHECKING([for touchwin() functionality in curses library])
4239 #ifdef HAVE_UNISTD_H
4240 # include <unistd.h>
4242 #include <sys/types.h>
4247 #ifdef HAVE_NCURSES_H
4248 # include <ncurses.h>
4250 # include <curses.h>
4258 AC_DEFINE(HAVE_TOUCHWIN)
4259 AC_MSG_RESULT([yes])
4265 AC_MSG_CHECKING([for beep() functionality in curses library])
4268 #ifdef HAVE_UNISTD_H
4269 # include <unistd.h>
4271 #include <sys/types.h>
4276 #ifdef HAVE_NCURSES_H
4277 # include <ncurses.h>
4279 # include <curses.h>
4286 AC_DEFINE(HAVE_BEEP)
4287 AC_MSG_RESULT([yes])
4292 AC_CHECK_FUNCS(keypad nodelay curs_set doupdate wnoutrefresh)
4294 LIBS="$ac_save_LIBS";
4300 AC_DEFUN([wi_SHADOW_FUNCS], [
4301 AC_CHECK_FUNCS(md5_crypt md5crypt bcrypt getspnam crypt_set_format)
4303 if test "$ac_cv_func_getspnam" = no ; then
4304 unset ac_cv_func_getspnam
4305 AC_CHECK_LIB(gen,getspnam)
4306 if test "$ac_cv_lib_gen_getspnam" = yes ; then
4307 AC_CHECK_FUNCS(getspnam)
4309 elif test "$ac_cv_func_getspnam" = yes ; then
4310 # Special hack to be sure UnixWare 7.1 uses -lgen for getspnam.
4311 # The reason we do this is so that the binary can be used on
4312 # SCO 5.0.6 with the UDK compatibility libraries installed,
4313 # For some reason, on UW7.1 getspnam is in the standard library and
4314 # libgen, but on SCO/UDK it is only in libgen.
4320 AC_CHECK_LIB(gen,getspnam)
4329 AC_CHECK_FUNCS(getuserpw)
4335 # C2: SCO Open Server 5; Digital UNIX
4336 AC_CHECK_FUNCS(set_auth_parameters bigcrypt)
4338 # C2: Digital UNIX 3.2, 4.0; SCO Open Server 5; HP-UX 11
4339 AC_CHECK_FUNCS(getprpwnam)
4342 AC_CHECK_FUNCS(getespwnam get_num_crypts get_crypt_name)
4345 AC_CHECK_FUNCS(dispcrypt)
4348 AC_CHECK_FUNCS(getpwanam)
4353 AC_DEFUN([wi_SHADOW_HEADERS], [
4354 AC_CHECK_HEADERS(shadow.h crypt.h)
4357 AC_CHECK_HEADERS(userpw.h)
4360 AC_CHECK_HEADERS(pwdadj.h)
4364 # Bug in header on these version 10 which cause is it not
4367 wi_HEADER_HPSECURITY_H
4369 # SCO Open Server, Digital UNIX
4370 AC_CHECK_HEADERS(sys/security.h sys/audit.h krb.h prot.h)
4373 AC_CHECK_HEADERS(sys/secdefines.h)
4376 wi_PR_PASSWD_FG_OLDCRYPT
4381 AC_DEFUN([wi_SHADOW_LIBS], [
4382 check_for_libcrypt=yes
4384 # AIX security library is libs.a
4385 AC_CHECK_LIB(s,getuserpw)
4386 if test "$ac_cv_lib_s" = yes ; then
4387 check_for_libcrypt=no
4388 elif test "$ac_cv_lib_s_getuserpw" = yes ; then
4389 check_for_libcrypt=no
4392 # SCO OpenServer 5 stuff for shadow password
4394 AC_CHECK_LIB(prot,getprpwnam)
4397 AC_CHECK_LIB(security,endprpwent)
4400 AC_CHECK_LIB(sec,getprpwnam)
4402 if test "$ac_cv_lib_sec_getprpwnam" = no ; then
4404 AC_CHECK_LIB(sec,getspnam)
4407 if test "$check_for_libcrypt" = yes ; then
4410 AC_CHECK_FUNCS(crypt)
4415 AC_DEFUN([wi_OS_VAR], [
4417 # Take note if the user is or is not exporting a CFLAGS env var.
4419 wi_orig_CFLAGS="$CFLAGS"
4420 wi_CFLAGS_TO_ADD_LATER=""
4421 changequote(!@, @!)dnl
4422 if [ -x "$HOME/bin/OS" ] ; then
4423 HOME_OS=`$HOME/bin/OS`
4424 HOME_OS="$HOME/$HOME_OS"
4426 host=`uname -n 2>/dev/null | tr '[A-Z]' '[a-z]'`
4427 os=`uname -s 2>/dev/null | tr '[A-Z]' '[a-z]'`
4428 if [ "$os" = "TvoPT" ] ; then os="sunos" ; fi
4429 dnl work around inability to use $1
4430 os_v=`uname -v 2>/dev/null | sed 's/^[^0-9.]*//;s/[^0-9.].*$//;' | awk '-F[-/: ]' '{n = 1; print $n; }'`
4431 os_r=`uname -r 2>/dev/null | sed 's/^[^0-9.]*//;s/[^0-9.].*$//;' | awk '-F[-/: ]' '{n = 1; print $n; }'`
4432 os_r1=`echo "${os_r}" | cut -c1`
4433 arch=`uname -m 2>/dev/null | tr '[A-Z]' '[a-z]'`
4434 archp=`uname -p 2>/dev/null | tr '[A-Z]' '[a-z]'`
4439 # Special case a few systems where if your CFLAGS appear
4440 # to want to generate for 32 bit, use that mode rather
4443 case "$os,$CFLAGS" in
4446 # then go to regular "irix" instead of "irix64" below.
4454 OS="digitalunix${os_r}-$arch"
4456 NDEFS="$NDEFS -DDIGITAL_UNIX=$os_r1"
4459 OS="tru64unix${os_r}-$arch"
4461 NDEFS="$NDEFS -DTRU64UNIX=$os_r1"
4466 os_lev=`/usr/bin/oslevel 2>/dev/null`
4467 if [ "$os_lev" = "" ] ; then
4468 if [ "$os_r" = "" ] ; then os_r=0 ; fi
4469 OS="aix${os_v}.${os_r}"
4470 os_int=`expr $os_v$os_r '*' 10`
4472 os_v=`echo "$os_lev" | cut -d. -f1-3`
4473 os_v1=`echo "$os_v" | cut -d. -f1`
4474 os_v2=`echo "$os_v" | cut -d. -f2`
4475 if [ "$os_v2" = "" ] ; then os_v2=0 ; fi
4476 os_v3=`echo "$os_v" | cut -d. -f3`
4477 if [ "$os_v3" = "" ] ; then os_v3=0 ; fi
4478 os_int=`expr "$os_v1" '*' 100 + "$os_v2" '*' 10 + "$os_v3"`
4482 NDEFS="$NDEFS -DAIX=${os_int}"
4487 NDEFS="$NDEFS -DIRIX=$os_r1"
4492 NDEFS="$NDEFS -DIRIX=$os_r1 -DIRIX64=$os_r1"
4495 os_r=`echo "${os_r}" | cut -d. -f2-`
4496 os_r1=`echo "$os_r" | cut -d. -f1`
4497 os_r2=`echo "${os_r}" | cut -d. -f2`
4498 os_int=`expr "$os_r1" '*' 100 + "$os_r2"`
4501 NDEFS="$NDEFS -DHPUX=$os_int"
4504 OS="freebsd${os_r}-$arch"
4505 os_r1=`echo "$os_r" | cut -d. -f1`
4506 os_r2=`echo "$os_r" | cut -d. -f2`
4507 if [ "$os_r2" = "" ] ; then os_r2=0 ; fi
4508 os_r3=`echo "$os_r" | cut -d. -f3`
4509 if [ "$os_r3" = "" ] ; then os_r3=0 ; fi
4510 os_int=`expr "$os_r1" '*' 100 + "$os_r2" '*' 10 + "$os_r3"`
4512 NDEFS="$NDEFS -DFREEBSD=$os_int"
4515 OS="netbsd${os_r}-$arch"
4516 os_r1=`echo "$os_r" | cut -d. -f1`
4517 os_r2=`echo "$os_r" | cut -d. -f2`
4518 if [ "$os_r2" = "" ] ; then os_r2=0 ; fi
4519 os_r3=`echo "$os_r" | cut -d. -f3`
4520 if [ "$os_r3" = "" ] ; then os_r3=0 ; fi
4521 os_int=`expr "$os_r1" '*' 100 + "$os_r2" '*' 10 + "$os_r3"`
4522 NDEFS="$NDEFS -DNETBSD=$os_int"
4526 OS="openbsd${os_r}-$arch"
4527 os_r1=`echo "$os_r" | cut -d. -f1`
4528 os_r2=`echo "$os_r" | cut -d. -f2`
4529 if [ "$os_r2" = "" ] ; then os_r2=0 ; fi
4530 os_r3=`echo "$os_r" | cut -d. -f3`
4531 if [ "$os_r3" = "" ] ; then os_r3=0 ; fi
4532 os_int=`expr "$os_r1" '*' 100 + "$os_r2" '*' 10 + "$os_r3"`
4534 NDEFS="$NDEFS -DOPENBSD=$os_int"
4539 os_v1=`echo "$os_v" | cut -d. -f1`
4542 os_v2=`echo "$os_v" | cut -d. -f2`
4543 if [ "$os_v2" = "" ] ; then os_v2=0 ; fi
4544 os_v3=`echo "$os_v" | cut -d. -f3`
4545 if [ "$os_v3" = "" ] ; then os_v3=0 ; fi
4546 os_int=`expr "$os_v1" '*' 100 + "$os_v2" '*' 10 + "$os_v3"`
4547 NDEFS="$NDEFS -DSCO=$os_int"
4550 NDEFS="$NDEFS -DSCO=1"
4555 OS="dynixptx${os_v}"
4557 os_v1=`echo "$os_v" | cut -d. -f1`
4558 os_v2=`echo "$os_v" | cut -d. -f2`
4559 os_v3=`echo "$os_v" | cut -d. -f3`
4560 if [ "$os_v3" = "" ] ; then os_v3=0 ; fi
4561 os_int=`expr "$os_v1" '*' 100 + "$os_v2" '*' 10 + "$os_v3"`
4562 NDEFS="$NDEFS -DDYNIX=$os_int"
4572 os_r1=`echo "$os_r" | cut -d. -f1`
4573 os_r2=`echo "$os_r" | cut -d. -f2`
4574 os_r3=`echo "$os_r" | cut -d- -f1 | cut -d. -f3`
4575 os_int=`expr "$os_r1" '*' 10000 + "$os_r2" '*' 1000 + "$os_r3"`
4576 NDEFS="$NDEFS -DLINUX=$os_int"
4578 vertest="./vertest.$$"
4579 /bin/rm -f "$vertest" "$vertest.c"
4580 cat <<EOF > "$vertest.c"
4582 #include <gnu/libc-version.h>
4586 const char *ver = gnu_get_libc_version();
4587 const char *rel = gnu_get_libc_release();
4589 fprintf(stdout, "glibc%s\n", ver);
4593 echo $ac_n "checking version of C library""... $ac_c" 1>&6
4594 echo "configure:: checking version of C library" >&5
4595 ${CC-cc} $DEFS $CPPFLAGS $CFLAGS "$vertest.c" -o "$vertest" >/dev/null 2>&1
4596 if [ -x "$vertest" ] ; then libc=`$vertest` ; fi
4597 /bin/rm -f "$vertest" "$vertest.c"
4602 glibc_r=`echo "$libc" | sed 's/glibc//'`
4603 glibc_r1=`echo "$glibc_r" | cut -d. -f1`
4604 glibc_r2=`echo "$glibc_r" | cut -d. -f2`
4605 glibc_r3=`echo "$glibc_r" | cut -d- -f1 | cut -d. -f3`
4606 glibc_int=`expr "$glibc_r1" '*' 10000 + "$glibc_r2" '*' 1000 + "$glibc_r3"`
4607 NDEFS="$NDEFS -DLINUX_GLIBC=$glibc_int"
4608 libc="glibc${glibc_r1}.${glibc_r2}"
4612 if test -f /lib/libc-2.2.2.so ; then
4613 NDEFS="$NDEFS -DLINUX_GLIBC=22002"
4616 elif test -f /lib/libc-2.2.1.so ; then
4617 NDEFS="$NDEFS -DLINUX_GLIBC=22001"
4620 elif test -f /lib/libc-2.2.0.so ; then
4621 NDEFS="$NDEFS -DLINUX_GLIBC=22000"
4624 elif test -f /lib/libc-2.1.3.so ; then
4625 NDEFS="$NDEFS -DLINUX_GLIBC=21003"
4628 elif test -f /lib/libc-2.1.2.so ; then
4629 NDEFS="$NDEFS -DLINUX_GLIBC=21002"
4632 elif test -f /lib/libc-2.1.1.so ; then
4633 NDEFS="$NDEFS -DLINUX_GLIBC=21001"
4636 elif test -f /lib/libc.so.6 ; then
4637 NDEFS="$NDEFS -DLINUX_GLIBC=20000"
4640 elif test -f /lib/libc.so.6.1 ; then
4641 NDEFS="$NDEFS -DLINUX_GLIBC=20001"
4645 NDEFS="$NDEFS -DLINUX_LIBC=5"
4657 NDEFS="$NDEFS -DBSDOS=$os_r1"
4662 NDEFS="$NDEFS -DULTRIX"
4665 OS="unixware${os_v}"
4667 os_v1=`echo "$os_v" | cut -d. -f1`
4670 os_v2=`echo "$os_v" | cut -d. -f2`
4671 os_v3=`echo "$os_v" | cut -d. -f3`
4672 if [ "$os_v3" = "" ] ; then os_v3=0 ; fi
4673 os_int=`expr "$os_v1" '*' 100 + "$os_v2" '*' 10 + "$os_v3"`
4674 NDEFS="$NDEFS -DUNIXWARE=$os_int"
4677 NDEFS="$NDEFS -DUNIXWARE=1"
4682 OS="openunix${os_v}"
4684 os_v1=`echo "$os_v" | cut -d. -f1`
4685 os_v2=`echo "$os_v" | cut -d. -f2`
4686 os_v3=`echo "$os_v" | cut -d. -f3`
4687 if [ "$os_v3" = "" ] ; then os_v3=0 ; fi
4688 os_int=`expr "$os_v1" '*' 100 + "$os_v2" '*' 10 + "$os_v3"`
4689 NDEFS="$NDEFS -DOPENUNIX=$os_int -DUNIXWARE=$os_int"
4691 macos*|darwin|rhapsody)
4694 os_v=`perl -e '{open(F, "< /System/Library/CoreServices/SystemVersion.plist") or exit(2); my ($doc) = ""; my ($line); while (defined($line = <F>)) { $doc .= $line; } close(F); $doc =~ s/\s+//gs; if ($doc =~ /<key>ProductVersion<\/key><string>([^<]+)<\/string>/) { print $1, "\n"; exit(0); } exit(1); }' 2>/dev/null`
4695 if [ "$os_v" = "" ] && [ -x "$HOME/bin/macosver" ] ; then
4696 os_v=`"$HOME/bin/macosver" 2>/dev/null`
4698 if [ "$os_v" = "" ] ; then
4699 cat > "$HOME/macosver.c" <<EOF
4701 <?xml version="1.0" encoding="UTF-8"?>
4702 <!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
4703 <plist version="0.9">
4705 <key>ProductBuildVersion</key>
4706 <string>5S66</string>
4707 <key>ProductName</key>
4708 <string>Mac OS X</string>
4709 <key>ProductVersion</key>
4710 <string>10.1.5</string>
4722 char line[256], *cp, *cp2;
4725 fp = fopen("/System/Library/CoreServices/SystemVersion.plist", "r");
4728 memset(line, 0, sizeof(line));
4729 while (fgets(line, sizeof(line) - 1, fp) != NULL) {
4730 cp = strstr(line, "<key>ProductVersion</key>");
4732 memset(line, 0, sizeof(line));
4733 if (fgets(line, sizeof(line) - 2, fp) != NULL) {
4734 for (cp = line; ((*cp != '\0') && (! isdigit(*cp))); ) cp++;
4735 for (cp2 = cp; ((*cp2 != '\0') && (! isspace(*cp2)) && (*cp2 != '<') && (*cp2 != '>')); ) cp2++;
4738 fprintf(stdout, "%s\n", cp);
4748 ${CC-cc} "$HOME/macosver.c" -o "$HOME/macosver" > /dev/null 2>&1
4749 os_v=`"$HOME/macosver" 2>/dev/null`
4750 /bin/mv "$HOME/macosver" "$HOME/bin/macosver" 2>/dev/null
4751 /bin/rm -f "$HOME/macosver.c" "$HOME/macosver"
4753 if [ "$os_v" != "" ] ; then
4755 os_v1=`echo "$os_v" | cut -d. -f1`
4756 os_v2=`echo "$os_v" | cut -d. -f2`
4757 os_v3=`echo "$os_v" | cut -d. -f3`
4758 if [ "$os_v3" = "" ] ; then os_v3=0 ; fi
4759 os_int=`expr "$os_v1" '*' 1000 + "$os_v2" '*' 100 + "$os_v3"`
4760 NDEFS="$NDEFS -DMACOSX=$os_int"
4762 NDEFS="$NDEFS -DMACOSX"
4766 if [ "$arch" = "" ] ; then arch="sparc" ; fi
4767 if [ "$archp" = "" ] ; then archp="$arch" ; fi
4769 5.[789]*|5.1[0-9][0-9]*)
4770 os_r1=`echo "$os_r" | cut -d. -f2`
4771 os_r2=`echo "$os_r" | cut -d. -f3`
4772 if [ "$os_r2" = "" ] ; then os_r2=0 ; fi
4773 os_r3=`echo "$os_r" | cut -d. -f4`
4774 if [ "$os_r3" = "" ] ; then os_r3=0 ; fi
4775 os_int=`expr "$os_r1" '*' 100 + "$os_r2" '*' 10 + "$os_r3"`
4776 os_r=`echo "$os_r" | cut -c3-`
4777 OS="solaris${os_r}-$archp"
4778 NDEFS="$NDEFS -DSOLARIS=$os_int"
4782 os_r=`echo "$os_r" | sed 's/^5/2/;'`
4783 os_r1=`echo "$os_r" | cut -d. -f1`
4784 os_r2=`echo "$os_r" | cut -d. -f2`
4785 if [ "$os_r2" = "" ] ; then os_r2=0 ; fi
4786 os_r3=`echo "$os_r" | cut -d. -f3`
4787 if [ "$os_r3" = "" ] ; then os_r3=0 ; fi
4788 os_int=`expr "$os_r1" '*' 100 + "$os_r2" '*' 10 + "$os_r3"`
4789 OS="solaris${os_r}-$archp"
4790 NDEFS="$NDEFS -DSOLARIS=$os_int"
4794 OS="sunos${os_r}-sparc"
4795 NDEFS="$NDEFS -DSUNOS=\\\"$os_r\\\""
4799 os_r1=`echo "$os_r" | cut -d. -f1`
4800 if [ "$os_r1" = "" ] ; then os_r1=0 ; fi
4801 os_r2=`echo "$os_r" | cut -d. -f2`
4802 if [ "$os_r2" = "" ] ; then os_r2=0 ; fi
4803 os_r3=`echo "$os_r" | cut -d. -f3`
4804 if [ "$os_r3" = "" ] ; then os_r3=0 ; fi
4805 os_int=`expr "$os_r1" '*' 100 + "$os_r2" '*' 10 + "$os_r3"`
4806 OS="solaris${os_r}-$archp"
4807 NDEFS="$NDEFS -DSOLARIS=$os_int"
4816 if grep Novell /usr/include/sys/types.h ; then
4817 OS="unixware${os_v}"
4823 if [ "x$wi_cv_OS" != "x" ] && [ "$wi_cv_OS" != "$OS" ] ; then
4825 AC_MSG_ERROR([Your config.cache file is invalid. It was created on $wi_cv_OS, but this machine is running $OS. Remove the config.cache file if you wish to continue.])
4838 AC_DEFUN([wi_SIZEOF_STRUCT_STAT], [
4839 AC_MSG_CHECKING(size of struct stat)
4840 wi_PREREQ_UNISTD_H([$0])
4843 #if defined(AIX) || defined(_AIX) || defined(__HOS_AIX__)
4844 # define _ALL_SOURCE 1
4846 #ifdef HAVE_UNISTD_H
4847 # include <unistd.h>
4849 #include <sys/types.h>
4850 #include <sys/stat.h>
4859 fp = fopen("conftest.out", "w");
4861 fprintf(fp, "%u\n", (unsigned int) sizeof(x));
4865 exit(1); /* Not OK */
4869 x=`cat conftest.out`
4871 changequote(<<, >>)dnl
4873 changequote([, ])dnl
4874 AC_DEFINE_UNQUOTED(SIZEOF_STRUCT_STAT, $x)
4875 ac_cv_sizeof_struct_stat="$x"
4881 /bin/rm -f conftest.out
4885 /bin/rm -f conftest.out
4887 # action if cross compiling
4889 /bin/rm -f conftest.out
4896 AC_DEFUN([wi_SIZEOF_STRUCT_STAT64], [
4897 AC_MSG_CHECKING(size of struct stat64)
4898 wi_PREREQ_UNISTD_H([$0])
4901 #if defined(AIX) || defined(_AIX) || defined(__HOS_AIX__)
4902 # define _ALL_SOURCE 1
4904 #ifdef HAVE_UNISTD_H
4905 # include <unistd.h>
4907 #include <sys/types.h>
4908 #include <sys/stat.h>
4917 fp = fopen("conftest.out", "w");
4919 fprintf(fp, "%u\n", (unsigned int) sizeof(x));
4923 exit(1); /* Not OK */
4927 x=`cat conftest.out`
4929 changequote(<<, >>)dnl
4931 changequote([, ])dnl
4932 AC_DEFINE_UNQUOTED(SIZEOF_STRUCT_STAT64, $x)
4933 ac_cv_sizeof_struct_stat64="$x"
4939 /bin/rm -f conftest.out
4943 /bin/rm -f conftest.out
4945 # action if cross compiling
4947 /bin/rm -f conftest.out