Better handling of libintl header and library mismatch.
This commit is contained in:
132
configure
vendored
132
configure
vendored
@@ -17554,7 +17554,6 @@ done
|
|||||||
# gettext() will be defined to gettext_libintl in libintl.h.
|
# gettext() will be defined to gettext_libintl in libintl.h.
|
||||||
# Since gcc prefers /usr/local/include to /usr/include, we need to
|
# Since gcc prefers /usr/local/include to /usr/include, we need to
|
||||||
# make sure we use the gettext() that matches the include file.
|
# 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" != "no"; then
|
if test "$enable_nls" != "no"; then
|
||||||
if test "$enable_nls" != "yes"; then
|
if test "$enable_nls" != "yes"; then
|
||||||
CPPFLAGS="${CPPFLAGS} -I${enable_nls}/include"
|
CPPFLAGS="${CPPFLAGS} -I${enable_nls}/include"
|
||||||
@@ -17574,16 +17573,22 @@ if test "$enable_nls" != "no"; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gettext" >&5
|
OLIBS="$LIBS"
|
||||||
$as_echo_n "checking for gettext... " >&6; }
|
for l in "libc" "-lintl" "-lintl -liconv"; do
|
||||||
if ${sudo_cv_gettext+:} false; then :
|
if test "$l" = "libc"; then
|
||||||
$as_echo_n "(cached) " >&6
|
# If user specified a dir for libintl ignore libc
|
||||||
else
|
if test "$enable_nls" != "yes"; then
|
||||||
|
continue
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
fi
|
||||||
|
else
|
||||||
|
LIBS="$OLIBS $l"
|
||||||
|
fi
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gettext in $l" >&5
|
||||||
|
$as_echo_n "checking for gettext in $l... " >&6; }
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
/* end confdefs.h. */
|
/* end confdefs.h. */
|
||||||
|
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
int
|
int
|
||||||
main ()
|
main ()
|
||||||
{
|
{
|
||||||
@@ -17594,108 +17599,27 @@ main ()
|
|||||||
|
|
||||||
_ACEOF
|
_ACEOF
|
||||||
if ac_fn_c_try_link "$LINENO"; then :
|
if ac_fn_c_try_link "$LINENO"; then :
|
||||||
sudo_cv_gettext=yes
|
enable_nls=yes
|
||||||
else
|
|
||||||
sudo_cv_gettext=no
|
|
||||||
fi
|
|
||||||
rm -f core conftest.err conftest.$ac_objext \
|
|
||||||
conftest$ac_exeext conftest.$ac_ext
|
|
||||||
|
|
||||||
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 "$as_me:${as_lineno-$LINENO}: checking for gettext in -lintl" >&5
|
|
||||||
$as_echo_n "checking for gettext in -lintl... " >&6; }
|
|
||||||
if ${ac_cv_lib_intl_gettext+:} false; then :
|
|
||||||
$as_echo_n "(cached) " >&6
|
|
||||||
else
|
|
||||||
ac_check_lib_save_LIBS=$LIBS
|
|
||||||
LIBS="-lintl $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=yes
|
|
||||||
else
|
|
||||||
ac_cv_lib_intl_gettext=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" >&5
|
|
||||||
$as_echo "$ac_cv_lib_intl_gettext" >&6; }
|
|
||||||
if test "x$ac_cv_lib_intl_gettext" = xyes; then :
|
|
||||||
LIBINTL="-lintl"
|
|
||||||
else
|
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gettext in -lintl" >&5
|
|
||||||
$as_echo_n "checking for gettext in -lintl... " >&6; }
|
|
||||||
if ${ac_cv_lib_intl_gettext_liconv+:} false; 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" = xyes; then :
|
|
||||||
LIBINTL="-lintl -liconv"
|
|
||||||
else
|
else
|
||||||
enable_nls=no
|
enable_nls=no
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext \
|
||||||
fi
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
if test "$enable_nls" != "no"; then
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_nls" >&5
|
||||||
|
$as_echo "$enable_nls" >&6; }
|
||||||
|
if test "$enable_nls" = "yes"; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
LIBS="$OLIBS"
|
||||||
|
if test "$enable_nls" = "yes"; then
|
||||||
$as_echo "#define HAVE_LIBINTL_H 1" >>confdefs.h
|
$as_echo "#define HAVE_LIBINTL_H 1" >>confdefs.h
|
||||||
|
|
||||||
SUDO_NLS=enabled
|
SUDO_NLS=enabled
|
||||||
|
if test "$l" != "libc"; then
|
||||||
|
LIBINTL="$l"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
44
configure.in
44
configure.in
@@ -2212,31 +2212,39 @@ AC_CHECK_FUNCS(getprogname, , [
|
|||||||
# gettext() will be defined to gettext_libintl in libintl.h.
|
# gettext() will be defined to gettext_libintl in libintl.h.
|
||||||
# Since gcc prefers /usr/local/include to /usr/include, we need to
|
# Since gcc prefers /usr/local/include to /usr/include, we need to
|
||||||
# make sure we use the gettext() that matches the include file.
|
# 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" != "no"; then
|
if test "$enable_nls" != "no"; then
|
||||||
if test "$enable_nls" != "yes"; then
|
if test "$enable_nls" != "yes"; then
|
||||||
CPPFLAGS="${CPPFLAGS} -I${enable_nls}/include"
|
CPPFLAGS="${CPPFLAGS} -I${enable_nls}/include"
|
||||||
SUDO_APPEND_LIBPATH(LDFLAGS, [$enable_nls/lib])
|
SUDO_APPEND_LIBPATH(LDFLAGS, [$enable_nls/lib])
|
||||||
fi
|
fi
|
||||||
AC_MSG_CHECKING([for gettext])
|
OLIBS="$LIBS"
|
||||||
AC_CACHE_VAL(sudo_cv_gettext, [
|
for l in "libc" "-lintl" "-lintl -liconv"; do
|
||||||
AC_LINK_IFELSE(
|
if test "$l" = "libc"; then
|
||||||
[
|
# If user specified a dir for libintl ignore libc
|
||||||
AC_LANG_PROGRAM([[#include <libintl.h>]], [(void)gettext((char *)0);])
|
if test "$enable_nls" != "yes"; then
|
||||||
], [sudo_cv_gettext=yes], [sudo_cv_gettext=no])
|
continue
|
||||||
])
|
fi
|
||||||
AC_MSG_RESULT($sudo_cv_gettext)
|
else
|
||||||
if test "$sudo_cv_gettext" != "yes"; then
|
LIBS="$OLIBS $l"
|
||||||
AC_CHECK_LIB(intl, gettext,
|
fi
|
||||||
[LIBINTL="-lintl"],
|
AC_MSG_CHECKING([for gettext in $l])
|
||||||
[
|
AC_LINK_IFELSE(
|
||||||
AC_CHECK_LIB(intl, gettext, [LIBINTL="-lintl -liconv"],
|
[
|
||||||
[enable_nls=no], [-liconv])
|
AC_LANG_PROGRAM([[#include <libintl.h>]], [(void)gettext((char *)0);])
|
||||||
])
|
], [enable_nls=yes], [enable_nls=no]
|
||||||
fi
|
)
|
||||||
if test "$enable_nls" != "no"; then
|
AC_MSG_RESULT($enable_nls)
|
||||||
|
if test "$enable_nls" = "yes"; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
LIBS="$OLIBS"
|
||||||
|
if test "$enable_nls" = "yes"; then
|
||||||
AC_DEFINE(HAVE_LIBINTL_H)
|
AC_DEFINE(HAVE_LIBINTL_H)
|
||||||
SUDO_NLS=enabled
|
SUDO_NLS=enabled
|
||||||
|
if test "$l" != "libc"; then
|
||||||
|
LIBINTL="$l"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user