Merge commit 'upstream/1.8.3p1'
[debian/sudo] / configure.in
index d180df4a64f3cbbc94dfe856d9e641206344529d..bca3bf4a7808cc47d6122eb20c59d4258e312a7a 100644 (file)
@@ -3,7 +3,7 @@ dnl Process this file with GNU autoconf to produce a configure script.
 dnl
 dnl Copyright (c) 1994-1996,1998-2011 Todd C. Miller <Todd.Miller@courtesan.com>
 dnl
-AC_INIT([sudo], [1.8.1p2], [http://www.sudo.ws/bugs/], [sudo])
+AC_INIT([sudo], [1.8.3p1], [http://www.sudo.ws/bugs/], [sudo])
 AC_CONFIG_HEADER([config.h pathnames.h])
 dnl
 dnl Note: this must come after AC_INIT
@@ -64,6 +64,8 @@ AC_SUBST([ac_config_libobj_dir])
 AC_SUBST([CONFIGURE_ARGS])
 AC_SUBST([LIBDL])
 AC_SUBST([LT_STATIC])
+AC_SUBST([LIBINTL])
+AC_SUBST([SUDO_NLS])
 dnl
 dnl Variables that get substituted in docs (not overridden by environment)
 dnl
@@ -161,6 +163,7 @@ LDAP="#"
 BAMAN=0
 LCMAN=0
 SEMAN=0
+LIBINTL=
 ZLIB=
 ZLIB_SRC=
 AUTH_OBJS=
@@ -168,6 +171,7 @@ AUTH_REG=
 AUTH_EXCL=
 AUTH_EXCL_DEF=
 AUTH_DEF=passwd
+SUDO_NLS=disabled
 
 dnl
 dnl Other vaiables
@@ -220,11 +224,7 @@ esac])
 
 AC_ARG_WITH(CC, [AS_HELP_STRING([--with-CC], [C compiler to use])],
 [case $with_CC in
-    yes)       AC_MSG_ERROR(["must give --with-CC an argument."])
-               ;;
-    no)                AC_MSG_ERROR(["illegal argument: --without-CC."])
-               ;;
-    *)         CC=$with_CC
+    *)         AC_MSG_ERROR([the --with-CC option is no longer supported, please set the CC environment variable instead.])
                ;;
 esac])
 
@@ -1264,7 +1264,7 @@ AC_ARG_ENABLE(env_debug,
 
 AC_ARG_ENABLE(zlib,
 [AS_HELP_STRING([--enable-zlib[[=PATH]]], [Whether to enable or disable zlib])],
-[])
+[], [enable_zlib=yes])
 
 AC_MSG_CHECKING(whether to enable environment resetting by default)
 AC_ARG_ENABLE(env_reset,
@@ -1290,16 +1290,23 @@ fi
 AC_ARG_ENABLE(warnings,
 [AS_HELP_STRING([--enable-warnings], [Whether to enable compiler warnings])],
 [ case "$enableval" in
-    yes)    if test X"$with_devel" != X"yes" -a -n "$GCC"; then
-               CFLAGS="${CFLAGS} -Wall"
-           fi
-           ;;
+    yes)    ;;
     no)            ;;
     *)     AC_MSG_WARN([Ignoring unknown argument to --enable-warnings: $enableval])
            ;;
   esac
 ])
 
+AC_ARG_ENABLE(werror,
+[AS_HELP_STRING([--enable-werror], [Whether to enable the -Werror compiler option])],
+[ case "$enableval" in
+    yes)    ;;
+    no)            ;;
+    *)     AC_MSG_WARN([Ignoring unknown argument to --enable-werror: $enableval])
+           ;;
+  esac
+])
+
 AC_ARG_ENABLE(admin-flag,
 [AS_HELP_STRING([--enable-admin-flag], [Whether to create a Ubuntu-style admin flag file])],
 [ case "$enableval" in
@@ -1311,6 +1318,10 @@ AC_ARG_ENABLE(admin-flag,
   esac
 ])
 
+AC_ARG_ENABLE(nls,
+[AS_HELP_STRING([--disable-nls], [Disable natural language support using gettext])],
+[], [enable_nls=yes])
+
 AC_ARG_WITH(selinux, [AS_HELP_STRING([--with-selinux], [enable SELinux support])],
 [case $with_selinux in
     yes)       SELINUX_USAGE="[[-r role]] [[-t type]] "
@@ -1349,6 +1360,15 @@ if test "x$ac_cv_prog_cc_c89" = "xno"; then
     AC_MSG_ERROR([Sudo version $PACKAGE_VERSION requires an ANSI C compiler to build.])
 fi
 
+dnl
+dnl If the user specified --disable-static, override them or we'll
+dnl be unable to build the executables in the sudoers plugin dir.
+dnl
+if test "$enable_static" = "no"; then
+    AC_MSG_WARN([Ignoring --disable-static, sudo does not install static libs])
+    enable_static=yes
+fi
+
 dnl
 dnl Libtool setup, we require libtool 2.2.6b or higher
 dnl
@@ -1386,20 +1406,36 @@ AC_MSG_RESULT($with_noexec)
 NOEXECFILE="sudo_noexec$_shrext"
 NOEXECDIR="`echo $with_noexec|sed 's:^\(.*\)/[[^/]]*:\1:'`"
 
-dnl
-dnl It is now safe to modify CFLAGS and CPPFLAGS
-dnl
-if test X"$with_devel" = X"yes" -a -n "$GCC"; then
-    CFLAGS="${CFLAGS} -Wall"
-fi
-
 dnl
 dnl Find programs we use
 dnl
 AC_CHECK_PROG(UNAMEPROG, [uname], [uname])
 AC_CHECK_PROG(TRPROG, [tr], [tr])
 AC_CHECK_PROGS(NROFFPROG, [nroff mandoc])
-if test -z "$NROFFPROG"; then
+if test -n "$NROFFPROG"; then
+    AC_CACHE_CHECK([whether $NROFFPROG supports the -c option],
+       [sudo_cv_var_nroff_opt_c],
+       [if $NROFFPROG -c </dev/null >/dev/null 2>&1; then
+           sudo_cv_var_nroff_opt_c=yes
+       else
+           sudo_cv_var_nroff_opt_c=no
+       fi]
+    )
+    if test "$sudo_cv_var_nroff_opt_c" = "yes"; then
+       NROFFPROG="$NROFFPROG -c"
+    fi
+    AC_CACHE_CHECK([whether $NROFFPROG supports the -Tascii option],
+       [sudo_cv_var_nroff_opt_Tascii],
+       [if $NROFFPROG -Tascii </dev/null >/dev/null 2>&1; then
+           sudo_cv_var_nroff_opt_Tascii=yes
+       else
+           sudo_cv_var_nroff_opt_Tascii=no
+       fi]
+    if test "$sudo_cv_var_nroff_opt_Tascii" = "yes"; then
+       NROFFPROG="$NROFFPROG -Tascii"
+    fi
+    )
+else
     MANTYPE="cat"
     mansrcdir='$(srcdir)'
 fi
@@ -1480,9 +1516,15 @@ case "$host" in
                fi
                LDFLAGS="$O_LDFLAGS"
 
-               # Use authenticate(3) as the default authentication method
-               if test X"$with_aixauth" = X""; then
-                   AC_CHECK_FUNCS(authenticate, [AUTH_EXCL_DEF="AIX_AUTH"])
+               # On AIX 6 and higher default to PAM, else default to LAM
+               if test $OSMAJOR -ge 6; then
+                   if test X"$with_pam" = X""; then
+                       AUTH_EXCL_DEF="PAM"
+                   fi
+               else
+                   if test X"$with_aixauth" = X""; then
+                       AC_CHECK_FUNCS(authenticate, [AUTH_EXCL_DEF="AIX_AUTH"])
+                   fi
                fi
 
                # AIX analog of nsswitch.conf, enabled by default
@@ -1497,6 +1539,14 @@ case "$host" in
                    with_netsvc="/etc/netsvc.conf"
                fi
 
+               # For implementing getgrouplist()
+               AC_CHECK_FUNCS(getgrset)
+
+               # LDR_PRELOAD is only supported in AIX 5.3 and later
+               if test $OSMAJOR -lt 5; then
+                   with_noexec=no
+               fi
+
                # AIX-specific functions
                AC_CHECK_FUNCS(getuserattr setauthdb)
                COMMON_OBJS="$COMMON_OBJS aix.lo"
@@ -1513,13 +1563,32 @@ case "$host" in
                : ${mansectsu='1m'}
                : ${mansectform='4'}
 
+               # The HP bundled compiler cannot generate shared libs
                if test -z "$GCC"; then
-                   # Use the +DAportable flag on hppa if it is supported
-                   case "$host_cpu" in
-                   hppa*)
+                   AC_CACHE_CHECK([for HP bundled C compiler],
+                       [sudo_cv_var_hpccbundled],
+                       [if $CC -V 2>&1 | grep '^(Bundled)' >/dev/null 2>&1; then
+                           sudo_cv_var_hpccbundled=yes
+                       else
+                           sudo_cv_var_hpccbundled=no
+                       fi]
+                   )
+                   if test "$sudo_cv_var_hpccbundled" = "yes"; then
+                       AC_MSG_ERROR([The HP bundled C compiler is unable to build Sudo, you must use gcc or the HP ANSI C compiler instead.])
+                   fi
+               fi
+
+               # Build PA-RISC1.1 objects for better portability
+               case "$host_cpu" in
+                   hppa[[2-9]]*)
                        _CFLAGS="$CFLAGS"
-                       CFLAGS="$CFLAGS +DAportable"
-                       AC_CACHE_CHECK([whether $CC understands +DAportable],
+                       if test -n "$GCC"; then
+                           portable_flag="-march=1.1"
+                       else
+                           portable_flag="+DAportable"
+                       fi
+                       CFLAGS="$CFLAGS $portable_flag"
+                       AC_CACHE_CHECK([whether $CC understands $portable_flag],
                            [sudo_cv_var_daportable],
                            [AC_LINK_IFELSE(
                                [AC_LANG_PROGRAM([[]], [[]])],
@@ -1532,11 +1601,10 @@ case "$host" in
                            CFLAGS="$_CFLAGS"
                        fi
                        ;;
-                   esac
-               fi
+               esac
 
                case "$host" in
-                       *-*-hpux[1-8].*)
+                       *-*-hpux[[1-8]].*)
                            AC_DEFINE(BROKEN_SYSLOG)
                        ;;
                        *-*-hpux9.*)
@@ -1713,16 +1781,7 @@ case "$host" in
                ;;
     *-*-bsdi*)
                SKIP_SETREUID=yes
-               # Use shlicc for BSD/OS [23].x unless asked to do otherwise
-               if test "${with_CC+set}" != set -a "$ac_cv_prog_CC" = gcc; then
-                   case "$OSMAJOR" in
-                       2|3)    AC_MSG_NOTICE([using shlicc as CC])
-                               ac_cv_prog_CC=shlicc
-                               CC="$ac_cv_prog_CC"
-                               ;;
-                   esac
-               fi
-               # Check for newer BSD auth API (just check for >= 3.0?)
+               # Check for newer BSD auth API
                if test -z "$with_bsdauth"; then
                    AC_CHECK_FUNCS(auth_challenge, [AUTH_EXCL_DEF="BSD_AUTH"])
                fi
@@ -1735,6 +1794,7 @@ case "$host" in
                    SKIP_SETREUID=yes
                    ;;
                esac
+               OSDEFS="${OSDEFS} -D_BSD_SOURCE"
                if test "${with_skey-'no'}" = "yes"; then
                     SUDOERS_LIBS="${SUDOERS_LIBS} -lmd"
                fi
@@ -1744,25 +1804,22 @@ case "$host" in
                ;;
     *-*-*openbsd*)
                # OpenBSD has a real setreuid(2) starting with 3.3 but
-               # we will use setreuid(2) instead.
+               # we will use setresuid(2) instead.
                SKIP_SETREUID=yes
+               OSDEFS="${OSDEFS} -D_BSD_SOURCE"
                CHECKSHADOW="false"
                # OpenBSD >= 3.0 supports BSD auth
                if test -z "$with_bsdauth"; then
-                   case "$OSREV" in
-                   [0-2].*)
-                       ;;
-                   *)
+                   if test "$OSMAJOR" -ge 3; then
                        AUTH_EXCL_DEF="BSD_AUTH"
-                       ;;
-                   esac
+                   fi
                fi
                : ${with_logincap='maybe'}
                ;;
     *-*-*netbsd*)
                # NetBSD has a real setreuid(2) starting with 1.3.2
                case "$OSREV" in
-               0.9*|1.[012]*|1.3|1.3.1)
+               0.9*|1.[[012]]*|1.3|1.3.1)
                    SKIP_SETREUID=yes
                    ;;
                esac
@@ -1771,6 +1828,7 @@ case "$host" in
                : ${with_logincap='maybe'}
                ;;
     *-*-dragonfly*)
+               OSDEFS="${OSDEFS} -D_BSD_SOURCE"
                if test "${with_skey-'no'}" = "yes"; then
                     SUDOERS_LIBS="${SUDOERS_LIBS} -lmd"
                fi
@@ -1863,7 +1921,21 @@ AC_PROG_GCC_TRADITIONAL
 AC_C_CONST
 AC_C_VOLATILE
 if test X"$with_gnu_ld" != "yes" -a -n "$GCC"; then
-    LTLDFLAGS="$LTLDFLAGS -Wc,-static-libgcc"
+    _CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS -static-libgcc"
+    AC_CACHE_CHECK([whether $CC understands -static-libgcc],
+       [sudo_cv_var_gcc_static_libgcc],
+       [AC_LINK_IFELSE(
+           [AC_LANG_PROGRAM([[]], [[]])],
+               [sudo_cv_var_gcc_static_libgcc=yes],
+               [sudo_cv_var_gcc_static_libgcc=no]
+           )
+       ]
+    )
+    CFLAGS="$_CFLAGS"
+    if test "$sudo_cv_var_gcc_static_libgcc" = "yes"; then
+       LTLDFLAGS="$LTLDFLAGS -Wc,-static-libgcc"
+    fi
 fi
 dnl
 dnl Program checks
@@ -1929,8 +2001,12 @@ if test ${with_logincap-'no'} != "no"; then
     ])
 fi
 if test ${with_project-'no'} != "no"; then
-    AC_CHECK_HEADER(project.h, AC_DEFINE(HAVE_PROJECT_H)
-       [SUDO_LIBS="${SUDO_LIBS} -lproject"], -)
+    AC_CHECK_HEADER(project.h, [
+       AC_CHECK_LIB(project, setproject, [
+           AC_DEFINE(HAVE_PROJECT_H)
+           SUDO_LIBS="${SUDO_LIBS} -lproject"
+       ])
+    ], [])
 fi
 dnl
 dnl typedef checks
@@ -2005,9 +2081,10 @@ dnl
 dnl Function checks
 dnl
 AC_FUNC_GETGROUPS
-AC_CHECK_FUNCS(strrchr sysconf tzset strftime initgroups getgroups fstat \
+AC_CHECK_FUNCS(strrchr sysconf tzset strftime \
               regcomp setlocale nl_langinfo getaddrinfo mbr_check_membership \
               setrlimit64 sysctl)
+AC_REPLACE_FUNCS(getgrouplist)
 AC_CHECK_FUNCS(getline, [], [
     AC_LIBOBJ(getline)
     AC_CHECK_FUNCS(fgetln)
@@ -2018,9 +2095,9 @@ if test "$utmp_style" = "LEGACY"; then
     AC_CHECK_FUNCS(getttyent ttyslot, [break])
 fi
 
-AC_CHECK_FUNCS(openpty, [AC_CHECK_HEADERS(util.h pty.h, [break])], [
+AC_CHECK_FUNCS(openpty, [AC_CHECK_HEADERS(libutil.h util.h pty.h, [break])], [
     AC_CHECK_LIB(util, openpty, [
-       AC_CHECK_HEADERS(util.h pty.h, [break])
+       AC_CHECK_HEADERS(libutil.h util.h pty.h, [break])
        case "$SUDO_LIBS" in
            *-lutil*) ;;
            *) SUDO_LIBS="${SUDO_LIBS} -lutil";;
@@ -2130,11 +2207,63 @@ AC_CHECK_FUNCS(getprogname, , [
     AC_MSG_RESULT($sudo_cv___progname)
 ])
 
+# gettext() and friends may be located in libc (Linux and Solaris)
+# or in libintl.  However, it is possible to have libintl installed
+# even when gettext() is present in libc.  In the case of GNU libintl,
+# gettext() will be defined to gettext_libintl in libintl.h.
+# Since gcc prefers /usr/local/include to /usr/include, we need to
+# make sure we use the gettext() that matches the include file.
+if test "$enable_nls" != "no"; then
+    if test "$enable_nls" != "yes"; then
+       CPPFLAGS="${CPPFLAGS} -I${enable_nls}/include"
+       SUDO_APPEND_LIBPATH(LDFLAGS, [$enable_nls/lib])
+    fi
+    OLIBS="$LIBS"
+    for l in "libc" "-lintl" "-lintl -liconv"; do
+       if test "$l" = "libc"; then
+           # If user specified a dir for libintl ignore libc
+           if test "$enable_nls" != "yes"; then
+               continue
+           fi
+           gettext_name=sudo_cv_gettext
+           AC_MSG_CHECKING([for gettext])
+       else
+           LIBS="$OLIBS $l"
+           gettext_name=sudo_cv_gettext"`echo $l|sed -e 's/ //g' -e 's/-/_/g'`"
+           AC_MSG_CHECKING([for gettext in $l])
+       fi
+       AC_CACHE_VAL($gettext_name, [
+               AC_LINK_IFELSE(
+                   [
+                       AC_LANG_PROGRAM([[#include <libintl.h>]], [(void)gettext((char *)0);])
+                   ], [eval $gettext_name=yes], [eval $gettext_name=no]
+               )
+       ])
+       eval gettext_result="\$$gettext_name"
+       AC_MSG_RESULT($gettext_result)
+       test "$gettext_result" = "yes" && break
+    done
+    LIBS="$OLIBS"
+
+    if test "$sudo_cv_gettext" = "yes"; then
+       AC_DEFINE(HAVE_LIBINTL_H)
+       SUDO_NLS=enabled
+    elif test "$sudo_cv_gettext_lintl" = "yes"; then
+       AC_DEFINE(HAVE_LIBINTL_H)
+       SUDO_NLS=enabled
+       LIBINTL="-lintl"
+    elif test "$sudo_cv_gettext_lintl_liconv" = "yes"; then
+       AC_DEFINE(HAVE_LIBINTL_H)
+       SUDO_NLS=enabled
+       LIBINTL="-lintl -liconv"
+    fi
+fi
+
 dnl
 dnl Deferred zlib option processing.
 dnl By default we use the system zlib if it is present.
 dnl
-case ${enable_zlib-"yes"} in
+case "$enable_zlib" in
     yes)
        AC_CHECK_LIB(z, gzdopen, [
            AC_CHECK_HEADERS(zlib.h, [ZLIB="-lz"], [enable_zlib=builtin])
@@ -2165,6 +2294,14 @@ if test X"$enable_zlib" = X"builtin"; then
     AC_CONFIG_FILES([zlib/Makefile])
 fi
 
+dnl
+dnl Check for errno declaration in errno.h
+dnl
+AC_CHECK_DECLS([errno], [], [], [
+AC_INCLUDES_DEFAULT
+#include <errno.h>
+])
+
 dnl
 dnl Check for strsignal() or sys_siglist
 dnl
@@ -2219,7 +2356,7 @@ dnl PAM support.  Systems that use PAM by default set with_pam=default
 dnl and we do the actual tests here.
 dnl
 if test ${with_pam-"no"} != "no"; then
-    # Note: we already link the main sudo program with -ldl as needed
+    # We already link with -ldl (see LIBDL below) so no need for that here.
     SUDOERS_LIBS="${SUDOERS_LIBS} -lpam"
 
     dnl
@@ -2256,19 +2393,6 @@ if test ${with_pam-"no"} != "no"; then
                            AC_MSG_WARN([Ignoring unknown argument to --enable-pam-session: $enableval])
                            ;;
            esac], AC_MSG_RESULT(yes))
-
-       case $host in
-           *-*-linux*|*-*-solaris*)
-                   # dgettext() may be defined to dgettext_libintl in the
-                   # header file, so first check that it links w/ additional
-                   # libs, then try with -lintl
-                   AC_LINK_IFELSE([AC_LANG_PROGRAM(
-                   [[#include <libintl.h>]], [(void)dgettext((char *)0, (char *)0);])],
-                   [AC_DEFINE(HAVE_DGETTEXT)],
-                   [AC_CHECK_LIB(intl, dgettext, [LIBS="${LIBS} -lintl"]
-                       [AC_DEFINE(HAVE_DGETTEXT)])])
-                   ;;
-       esac
     fi
 fi
 
@@ -2388,7 +2512,7 @@ if test ${with_kerb4-'no'} != "no"; then
        O_CPPFLAGS="$CPPFLAGS"
        for dir in "" "kerberosIV/" "krb4/" "kerberos4/" "kerberosv4/"; do
            CPPFLAGS="$O_CPPFLAGS -I/usr/include/${dir}"
-           AC_PREPROC_IFELSE([#include <krb.h>], [found=yes; break])
+           AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[#include <krb.h>]])], [found=yes; break])
        done
        test X"$found" = X"no" && CPPFLAGS="$O_CPPFLAGS"
     else
@@ -2465,7 +2589,7 @@ if test ${with_kerb5-'no'} != "no"; then
            O_CPPFLAGS="$CPPFLAGS"
            for dir in "" "kerberosV/" "krb5/" "kerberos5/" "kerberosv5/"; do
                CPPFLAGS="$O_CPPFLAGS -I/usr/include/${dir}"
-               AC_PREPROC_IFELSE([#include <krb5.h>], [found=yes; break])
+               AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[#include <krb5.h>]])], [found=yes; break])
            done
            if test X"$found" = X"no"; then
                CPPFLAGS="$O_CPPFLAGS"
@@ -2633,13 +2757,13 @@ if test "${with_opie-'no'}" = "yes"; then
        CPPFLAGS="${CPPFLAGS} -I${with_opie}/include"
        SUDO_APPEND_LIBPATH(LDFLAGS, [${with_opie}/lib])
        SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [${with_opie}/lib])
-       AC_PREPROC_IFELSE([#include <opie.h>], [found=yes], [found=no])
+       AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[#include <opie.h>]])], [found=yes], [found=no])
     else
        found=no
        O_CPPFLAGS="$CPPFLAGS"
        for dir in "" "/usr/local" "/usr/contrib"; do
            test -n "$dir" && CPPFLAGS="$O_CPPFLAGS -I${dir}/include"
-           AC_PREPROC_IFELSE([#include <opie.h>], [found=yes; break])
+           AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[#include <opie.h>]])], [found=yes; break])
        done
        if test "$found" = "no" -o -z "$dir"; then
            CPPFLAGS="$O_CPPFLAGS"
@@ -2733,6 +2857,17 @@ if test ${with_ldap-'no'} != "no"; then
        #include <lber.h>
        #include <ldap.h>]], [[(void)ldap_init(0, 0)]])], [found=yes; break])
     done
+    if test "$found" = "no"; then
+       LDAP_LIBS=""
+       LIBS="$_LIBS"
+       for l in -libmldap -lidsldif; do
+           LIBS="${LIBS} $l"
+           LDAP_LIBS="${LDAP_LIBS} $l"
+           AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+           #include <lber.h>
+           #include <ldap.h>]], [[(void)ldap_init(0, 0)]])], [found=yes; break])
+       done
+    fi
     dnl if nothing linked just try with -lldap
     if test "$found" = "no"; then
        LIBS="${_LIBS} -lldap"
@@ -2773,7 +2908,7 @@ if test ${with_ldap-'no'} != "no"; then
        O_CPPFLAGS="$CPPFLAGS"
        for dir in "" "kerberosV" "krb5" "kerberos5" "kerberosv5"; do
            test X"$dir" != X"" && CPPFLAGS="$O_CPPFLAGS -I/usr/include/${dir}"
-           AC_PREPROC_IFELSE([#include <gssapi/gssapi.h>], [found="gssapi/gssapi.h"; break], [AC_PREPROC_IFELSE([#include <gssapi.h>], [found="gssapi.h"; break])])
+           AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[#include <gssapi/gssapi.h>]])], [found="gssapi/gssapi.h"; break], [AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[#include <gssapi.h>]])], [found="gssapi.h"; break])])
        done
        if test X"$found" != X"no"; then
            AC_CHECK_HEADERS([$found])
@@ -2808,6 +2943,9 @@ case "$lt_cv_dlopen" in
        AC_LIBOBJ(dlopen)
        ;;
     *)
+       if test X"${ac_cv_func_dlopen}" = X"yes"; then
+           AC_MSG_ERROR(["dlopen present but libtool doesn't appear to support your platform."])
+       fi
        # Preload sudoers module symbols
        SUDO_OBJS="${SUDO_OBJS} preload.o"
        SUDO_LIBS="${SUDO_LIBS} \$(top_builddir)/plugins/sudoers/sudoers.la"
@@ -2891,6 +3029,18 @@ if test -n "$LIBS"; then
     done
 fi
 
+dnl
+dnl We add -Wall and -Werror after all tests so they don't cause failures
+dnl
+if test -n "$GCC"; then
+    if test X"$enable_warnings" = X"yes" -o X"$with_devel" = X"yes"; then
+       CFLAGS="${CFLAGS} -Wall"
+    fi
+    if test X"$enable_werror" = X"yes"; then
+       CFLAGS="${CFLAGS} -Werror"
+    fi
+fi
+
 dnl
 dnl Set exec_prefix
 dnl
@@ -2981,7 +3131,6 @@ AH_TEMPLATE(HAVE_BSM_AUDIT, [Define to 1 to enable BSM audit support.])
 AH_TEMPLATE(HAVE_DCE, [Define to 1 if you use OSF DCE.])
 AH_TEMPLATE(HAVE_DD_FD, [Define to 1 if your `DIR' contains dd_fd.])
 AH_TEMPLATE(HAVE_DIRFD, [Define to 1 if you have the `dirfd' function or macro.])
-AH_TEMPLATE(HAVE_DGETTEXT, [Define to 1 if you have the `dgettext' function.])
 AH_TEMPLATE(HAVE_DISPCRYPT, [Define to 1 if you have the `dispcrypt' function.])
 AH_TEMPLATE(HAVE_DLOPEN, [Define to 1 if you have the `dlopen' function.])
 AH_TEMPLATE(HAVE_EXTENDED_GLOB, [Define to 1 if your glob.h defines the GLOB_BRACE and GLOB_TILDE flags.])
@@ -3006,6 +3155,7 @@ AH_TEMPLATE(HAVE_KRB5_INIT_SECURE_CONTEXT, [Define to 1 if you have the `krb5_in
 AH_TEMPLATE(HAVE_KRB5_VERIFY_USER, [Define to 1 if you have the `krb5_verify_user' function.])
 AH_TEMPLATE(HAVE_LBER_H, [Define to 1 if your LDAP needs <lber.h>. (OpenLDAP does not)])
 AH_TEMPLATE(HAVE_LDAP, [Define to 1 if you use LDAP for sudoers.])
+AH_TEMPLATE(HAVE_LIBINTL_H, [Define to 1 if you have the <libintl.h> header file.])
 AH_TEMPLATE(HAVE_LINUX_AUDIT, [Define to 1 to enable Linux audit support.])
 AH_TEMPLATE(HAVE_OPIE, [Define to 1 if you use NRL OPIE.])
 AH_TEMPLATE(HAVE_PAM, [Define to 1 if you use PAM authentication.])
@@ -3099,7 +3249,7 @@ AH_BOTTOM([/*
 #undef ISSET
 #define ISSET(t, f)     ((t) & (f))
 
-/* New ANSI-style OS defs for HP-UX and ConvexOS. */
+/* ANSI-style OS defs for HP-UX and ConvexOS. */
 #if defined(hpux) && !defined(__hpux)
 # define __hpux                1
 #endif /* hpux */