diff --git a/INSTALL b/INSTALL index b8156e64c..ea3662b8e 100644 --- a/INSTALL +++ b/INSTALL @@ -638,6 +638,12 @@ The following options are also configurable at runtime: Disable environment resetting. This sets the default value of the "env_reset" Defaults option in sudoers to false. + --disable-nls + Disable natural language support. By default, sudo will + use the gettext() family of functions, if available, to + implement messages in the invoking user's native language. + Note that translations do not exist for all languages. + Shadow password and C2 support ============================== diff --git a/configure b/configure index e90e2a533..91205acac 100755 --- a/configure +++ b/configure @@ -862,6 +862,7 @@ enable_zlib enable_env_reset enable_warnings enable_admin_flag +enable_nls with_selinux enable_gss_krb5_ccache_name enable_shared @@ -1519,6 +1520,7 @@ Optional Features: --enable-env-reset Whether to enable environment resetting by default. --enable-warnings Whether to enable compiler warnings --enable-admin-flag Whether to create a Ubuntu-style admin flag file + --disable-nls Disable natural language support using gettext --enable-gss-krb5-ccache-name Use GSS-API to set the Kerberos V cred cache name --enable-shared[=PKGS] build shared libraries [default=yes] @@ -5489,6 +5491,21 @@ $as_echo "$as_me: WARNING: Ignoring unknown argument to --enable-admin-flag: $en fi +# Check whether --enable-nls was given. +if test "${enable_nls+set}" = set; then : + enableval=$enable_nls; case "$enableval" in + yes|no) enable_nls=$enableval + ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring unknown argument to --enable-nls: $enableval" >&5 +$as_echo "$as_me: WARNING: Ignoring unknown argument to --enable-nls: $enableval" >&2;} + ;; + esac + +else + enable_nls=yes +fi + + # Check whether --with-selinux was given. if test "${with_selinux+set}" = set; then : @@ -16691,22 +16708,28 @@ done # Since gcc prefers /usr/local/include to /usr/include, we need to # make sure we use the gettext() that matches the include file. # First check that it links w/o additional libs, then try with -lintl. -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +if test "$enable_nls" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + + #include int main () { -(void)gettext((char *)0, (char *)0); +(void)gettext((char *)0); ; return 0; } + _ACEOF if ac_fn_c_try_link "$LINENO"; then : - $as_echo "#define HAVE_LIBINTL_H 1" >>confdefs.h + + $as_echo "#define HAVE_LIBINTL_H 1" >>confdefs.h + else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gettext in -lintl" >&5 + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gettext in -lintl" >&5 $as_echo_n "checking for gettext in -lintl... " >&6; } if test "${ac_cv_lib_intl_gettext+set}" = set; then : $as_echo_n "(cached) " >&6 @@ -16744,13 +16767,60 @@ fi $as_echo "$ac_cv_lib_intl_gettext" >&6; } if test "x$ac_cv_lib_intl_gettext" = x""yes; then : LIBS="${LIBS} -lintl" - $as_echo "#define HAVE_LIBINTL_H 1" >>confdefs.h + $as_echo "#define HAVE_LIBINTL_H 1" >>confdefs.h + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gettext in -lintl" >&5 +$as_echo_n "checking for gettext in -lintl... " >&6; } +if test "${ac_cv_lib_intl_gettext_liconv+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lintl -liconv $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char gettext (); +int +main () +{ +return gettext (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_intl_gettext_liconv=yes +else + ac_cv_lib_intl_gettext_liconv=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_gettext_liconv" >&5 +$as_echo "$ac_cv_lib_intl_gettext_liconv" >&6; } +if test "x$ac_cv_lib_intl_gettext_liconv" = x""yes; then : + LIBS="${LIBS} -lintl -liconv" + $as_echo "#define HAVE_LIBINTL_H 1" >>confdefs.h fi + +fi + + fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext +fi case ${enable_zlib-"yes"} in yes) diff --git a/configure.in b/configure.in index daea5fd43..13f0870e7 100644 --- a/configure.in +++ b/configure.in @@ -1311,6 +1311,16 @@ AC_ARG_ENABLE(admin-flag, esac ]) +AC_ARG_ENABLE(nls, +[AS_HELP_STRING([--disable-nls], [Disable natural language support using gettext])], +[ case "$enableval" in + yes|no) enable_nls=$enableval + ;; + *) AC_MSG_WARN([Ignoring unknown argument to --enable-nls: $enableval]) + ;; + esac +], [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]] " @@ -2140,11 +2150,22 @@ AC_CHECK_FUNCS(getprogname, , [ # Since gcc prefers /usr/local/include to /usr/include, we need to # make sure we use the gettext() that matches the include file. # First check that it links w/o additional libs, then try with -lintl. -AC_LINK_IFELSE([AC_LANG_PROGRAM( -[[#include ]], [(void)gettext((char *)0, (char *)0);])], -[AC_DEFINE(HAVE_LIBINTL_H)], -[AC_CHECK_LIB(intl, gettext, [LIBS="${LIBS} -lintl"] - [AC_DEFINE(HAVE_LIBINTL_H)])]) +if test "$enable_nls" = "yes"; then + AC_LINK_IFELSE( + [ + AC_LANG_PROGRAM([[#include ]], [(void)gettext((char *)0);]) + ], [ + AC_DEFINE(HAVE_LIBINTL_H) + ], [ + AC_CHECK_LIB(intl, gettext, + [LIBS="${LIBS} -lintl"] + [AC_DEFINE(HAVE_LIBINTL_H)], + [ + AC_CHECK_LIB(intl, gettext, [LIBS="${LIBS} -lintl -liconv"] + AC_DEFINE(HAVE_LIBINTL_H), [], [-liconv]) + ]) + ]) +fi dnl dnl Deferred zlib option processing.