From 88cfbd51a591793bace07e7602778946f8cba186 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sun, 29 May 2011 14:33:18 -0400 Subject: [PATCH] Add support for --enable-nls[=location] --- INSTALL | 9 +++++++++ configure | 46 +++++++++++++++++++++++++++------------------- configure.in | 32 ++++++++++++++------------------ 3 files changed, 50 insertions(+), 37 deletions(-) diff --git a/INSTALL b/INSTALL index fddbfdd41..44c29f796 100644 --- a/INSTALL +++ b/INSTALL @@ -638,6 +638,15 @@ 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. + --enable-nls[=location] + Enable natural language support using the gettext() family + of functions. If specified, location is the base directory + containing the libintl include and lib directories. If + this option is not specified, configure will look for the + gettext() family of functions in the standard C library + first, then check for a standalone libintl (linking with + libiconv as needed). + --disable-nls Disable natural language support. By default, sudo will use the gettext() family of functions, if available, to diff --git a/configure b/configure index 9e5fc03eb..8a0d0d397 100755 --- a/configure +++ b/configure @@ -5434,6 +5434,8 @@ fi # Check whether --enable-zlib was given. if test "${enable_zlib+set}" = set; then : enableval=$enable_zlib; +else + enable_zlib=yes fi @@ -5499,14 +5501,7 @@ 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 - + enableval=$enable_nls; else enable_nls=yes fi @@ -16770,7 +16765,25 @@ 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. -if test "$enable_nls" = "yes"; then +if test "$enable_nls" != "no"; then + if test "$enable_nls" != "yes"; then + CPPFLAGS="${CPPFLAGS} -I${enable_nls}/include" + + if test X"$with_rpath" = X"yes"; then + case "$host" in + *-*-hpux*) LDFLAGS="${LDFLAGS} -L$enable_nls/lib -Wl,+b,$enable_nls/lib" + ;; + *) LDFLAGS="${LDFLAGS} -L$enable_nls/lib -Wl,-R$enable_nls/lib" + ;; + esac + else + LDFLAGS="${LDFLAGS} -L$enable_nls/lib" + fi + if test X"$blibpath" != X"" -a "LDFLAGS" = "SUDO_LDFLAGS"; then + blibpath_add="${blibpath_add}:$enable_nls/lib" + fi + + fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gettext" >&5 $as_echo_n "checking for gettext... " >&6; } if test "${sudo_cv_gettext+set}" = set; then : @@ -16802,10 +16815,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_gettext" >&5 $as_echo "$sudo_cv_gettext" >&6; } - if test "$sudo_cv_gettext" = "yes"; then - $as_echo "#define HAVE_LIBINTL_H 1" >>confdefs.h - - else + if test "$sudo_cv_gettext" != "yes"; then { $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 : @@ -16844,8 +16854,6 @@ fi $as_echo "$ac_cv_lib_intl_gettext" >&6; } if test "x$ac_cv_lib_intl_gettext" = x""yes; then : LIBINTL="-lintl" - $as_echo "#define HAVE_LIBINTL_H 1" >>confdefs.h - else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gettext in -lintl" >&5 @@ -16886,8 +16894,6 @@ fi $as_echo "$ac_cv_lib_intl_gettext_liconv" >&6; } if test "x$ac_cv_lib_intl_gettext_liconv" = x""yes; then : LIBINTL="-lintl -liconv" - $as_echo "#define HAVE_LIBINTL_H 1" >>confdefs.h - else enable_nls=no fi @@ -16896,13 +16902,15 @@ fi fi fi - if test "$enable_nls" = "yes"; then + if test "$enable_nls" != "no"; then + $as_echo "#define HAVE_LIBINTL_H 1" >>confdefs.h + # List of available translations LINGUAS="uk zh_CN" fi fi -case ${enable_zlib-"yes"} in +case "$enable_zlib" in yes) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gzdopen in -lz" >&5 $as_echo_n "checking for gzdopen in -lz... " >&6; } diff --git a/configure.in b/configure.in index f971d50ee..ff5a26851 100644 --- a/configure.in +++ b/configure.in @@ -1268,7 +1268,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, @@ -1317,13 +1317,7 @@ AC_ARG_ENABLE(admin-flag, 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]) +[], [enable_nls=yes]) AC_ARG_WITH(selinux, [AS_HELP_STRING([--with-selinux], [enable SELinux support])], [case $with_selinux in @@ -2192,7 +2186,11 @@ 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. -if test "$enable_nls" = "yes"; then +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 AC_MSG_CHECKING([for gettext]) AC_CACHE_VAL(sudo_cv_gettext, [ AC_LINK_IFELSE( @@ -2201,18 +2199,16 @@ if test "$enable_nls" = "yes"; then ], [sudo_cv_gettext=yes], [sudo_cv_gettext=no]) ]) AC_MSG_RESULT($sudo_cv_gettext) - if test "$sudo_cv_gettext" = "yes"; then - AC_DEFINE(HAVE_LIBINTL_H) - else + if test "$sudo_cv_gettext" != "yes"; then AC_CHECK_LIB(intl, gettext, - [LIBINTL="-lintl"] - [AC_DEFINE(HAVE_LIBINTL_H)], + [LIBINTL="-lintl"], [ - AC_CHECK_LIB(intl, gettext, [LIBINTL="-lintl -liconv"] - AC_DEFINE(HAVE_LIBINTL_H), [enable_nls=no], [-liconv]) + AC_CHECK_LIB(intl, gettext, [LIBINTL="-lintl -liconv"], + [enable_nls=no], [-liconv]) ]) fi - if test "$enable_nls" = "yes"; then + if test "$enable_nls" != "no"; then + AC_DEFINE(HAVE_LIBINTL_H) # List of available translations LINGUAS="uk zh_CN" fi @@ -2222,7 +2218,7 @@ 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]) -- 2.40.0