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
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
BAMAN=0
LCMAN=0
SEMAN=0
+LIBINTL=
ZLIB=
ZLIB_SRC=
AUTH_OBJS=
AUTH_EXCL=
AUTH_EXCL_DEF=
AUTH_DEF=passwd
+SUDO_NLS=disabled
dnl
dnl Other vaiables
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])
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,
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
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]] "
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
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
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
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"
: ${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([[]], [[]])],
CFLAGS="$_CFLAGS"
fi
;;
- esac
- fi
+ esac
case "$host" in
- *-*-hpux[1-8].*)
+ *-*-hpux[[1-8]].*)
AC_DEFINE(BROKEN_SYSLOG)
;;
*-*-hpux9.*)
;;
*-*-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
SKIP_SETREUID=yes
;;
esac
+ OSDEFS="${OSDEFS} -D_BSD_SOURCE"
if test "${with_skey-'no'}" = "yes"; then
SUDOERS_LIBS="${SUDOERS_LIBS} -lmd"
fi
;;
*-*-*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
: ${with_logincap='maybe'}
;;
*-*-dragonfly*)
+ OSDEFS="${OSDEFS} -D_BSD_SOURCE"
if test "${with_skey-'no'}" = "yes"; then
SUDOERS_LIBS="${SUDOERS_LIBS} -lmd"
fi
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
])
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
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)
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";;
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])
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
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
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
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
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"
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"
#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"
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])
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"
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
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.])
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.])
#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 */