+dnl For SunOS encryption compatibility
+dnl Never use CONF_LDADD here as it is used also for "generate_passwd"
+AC_MSG_CHECKING(whether to use SunOS encryption compatibility)
+cond=false
+AC_ARG_WITH(descrypt,
+[ --with-descrypt Be password encryption compatible with SunOS.],
+[ case "$withval" in
+ no)
+ AC_MSG_RESULT(no)
+ ;;
+ yes)
+ AC_MSG_RESULT(yes)
+ LIBS="-ldescrypt $LIBS"
+ ;;
+ *)
+ AC_MSG_RESULT(yes - $withval)
+ LIBS="$withval $LIBS"
+ ;;
+ esac ],
+ AC_MSG_RESULT(no)
+)
+
+AC_ARG_WITH(efence,
+[ --with-efence compile with efence support (for debugging)],,[
+ if test "x$USE_MAINTAINER_MODE" = "xyes"; then
+ with_efence=auto
+ else
+ with_efence=no
+ fi
+])
+if test "$with_efence" != no; then
+ AC_CHECK_LIB(efence,malloc,,[
+ if test "$with_efence" = yes; then
+ AC_MSG_ERROR(Unable to find efence library.)
+ fi
+ ])
+fi
+
+dnl Check for type in sys/socket.h
+AC_MSG_CHECKING([for parameter type of 3rd accept() arg])
+AC_CACHE_VAL(tac_plus_cv_accept_type, [
+ check_ok=false
+ for type in socklen_t size_t int; do
+ AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <sys/socket.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+],[
+ return 0;}
+ int accept(int s, struct sockaddr *addr, ]$type[ *addrlen)
+ { return 0; }
+ int discarded_main() {
+],
+ [check_ok=true;break],continue)
+ done
+ if $check_ok
+ then
+ tac_plus_cv_accept_type=$type
+ else
+ tac_plus_cv_accept_type=no
+ fi
+ ])
+if test "x$tac_plus_cv_accept_type" = "xno"
+then
+ AC_DEFINE(socklen_t,int)
+ AC_MSG_RESULT([failed to detect, will try int])
+else
+ AC_MSG_RESULT($tac_plus_cv_accept_type)
+ if test "x$tac_plus_cv_accept_type" != "xsocklen_t"
+ then
+ AC_DEFINE_UNQUOTED(socklen_t,$tac_plus_cv_accept_type)
+ fi
+fi
+
+dnl Check for system regex (stolen from "mutt" package)
+AC_ARG_WITH(included-regex, [ --with-included-regex Use the included regex library ],
+ [tac_plus_cv_included_regex=yes],
+ [AC_CHECK_FUNCS(regcomp, tac_plus_cv_included_regex=no, tac_plus_cv_included_regex=yes)])
+
+if test $tac_plus_cv_included_regex = no ; then
+AC_CACHE_CHECK([whether your system's regexp library is completely broken],
+ [tac_plus_cv_included_regex_broken],
+ AC_TRY_RUN([
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_REGEX_H
+#include <regex.h>
+#endif
+main() { regex_t blah ; regmatch_t p; p.rm_eo = p.rm_eo; return regcomp(&blah, "foo.*bar", REG_NOSUB) || regexec (&blah, "foobar", 0, NULL, 0); }],
+ tac_plus_cv_included_regex_broken=no, tac_plus_cv_included_regex_broken=yes, tac_plus_cv_included_regex_broken=yes))
+ if test $tac_plus_cv_included_regex_broken = yes ; then
+ echo "Using the included regex instead." >&AC_FD_MSG
+ tac_plus_cv_included_regex=yes
+ fi
+fi
+if test $tac_plus_cv_included_regex = yes; then
+ AC_DEFINE(WITH_INCLUDED_REGEX)
+ COND_USE="$COND_USE "'$(cond_WITH_INCLUDED_REGEX)'
+fi
+
+dnl Check for "struct passwd.pw_{age,comment}"
+dnl Stolen from Julianne Frances Haugh's login replacement.
+AC_CACHE_CHECK(for pw_age in struct passwd,
+tac_plus_cv_struct_passwd_pw_age, AC_TRY_COMPILE([#include <pwd.h>],
+[ struct passwd pw; pw.pw_age = "" ],
+tac_plus_cv_struct_passwd_pw_age=yes, tac_plus_cv_struct_passwd_pw_age=no))
+
+if test "$tac_plus_cv_struct_passwd_pw_age" = "yes"; then
+ AC_DEFINE(HAVE_PASSWD_PW_AGE)
+fi
+AC_CACHE_CHECK(for pw_comment in struct passwd,
+tac_plus_cv_struct_passwd_pw_comment, AC_TRY_COMPILE([#include <pwd.h>],
+[ struct passwd pw; pw.pw_comment = "" ],
+tac_plus_cv_struct_passwd_pw_comment=yes, tac_plus_cv_struct_passwd_pw_comment=no))
+
+if test "$tac_plus_cv_struct_passwd_pw_comment" = "yes"; then
+ AC_DEFINE(HAVE_PASSWD_PW_COMMENT)
+fi
+AC_CACHE_CHECK(for ut_host in struct utmp,
+tac_plus_cv_struct_utmp_ut_host, AC_TRY_COMPILE([#include <utmp.h>],
+[ struct utmp ut; ut.ut_host = "" ],
+tac_plus_cv_struct_utmp_ut_host=yes, tac_plus_cv_struct_utmp_ut_host=no))
+
+if test "$tac_plus_cv_struct_utmp_ut_host" = "yes"; then
+ AC_DEFINE(HAVE_UTMP_UT_HOST)
+fi
+
+CFLAGS="$final_CFLAGS"