From 26be1019b1db0ddba7b1271bb6becfb057fe907c Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Tue, 21 May 2002 19:09:17 +0000 Subject: [PATCH] Move iconv tests before gettext checks. (#81999) Mon May 20 18:02:46 2002 Owen Taylor * configure.in: Move iconv tests before gettext checks. (#81999) * m4macros/glib-gettext.m4 acinclude.m4: If we can't link to gettext, try adding in -liconv. (#80076, Boyd Lynn Gerber) * m4macros/glib-gettext.m4 acinclude.m4: Suppress warnings about xgettext not being GNU gettext when libintl wasn't found at all. (#79016, Andrew P. Lentvorski, Jr.) --- ChangeLog | 14 ++++++ ChangeLog.pre-2-10 | 14 ++++++ ChangeLog.pre-2-12 | 14 ++++++ ChangeLog.pre-2-2 | 14 ++++++ ChangeLog.pre-2-4 | 14 ++++++ ChangeLog.pre-2-6 | 14 ++++++ ChangeLog.pre-2-8 | 14 ++++++ acinclude.m4 | 37 ++++++++------ configure.in | 105 +++++++++++++++++++++------------------ m4macros/glib-gettext.m4 | 28 +++++++---- 10 files changed, 196 insertions(+), 72 deletions(-) diff --git a/ChangeLog b/ChangeLog index a92ca1fbe..9105a1936 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +Mon May 20 18:02:46 2002 Owen Taylor + + * configure.in: Move iconv tests before gettext + checks. (#81999) + + * m4macros/glib-gettext.m4 acinclude.m4: If we can't + link to gettext, try adding in -liconv. (#80076, + Boyd Lynn Gerber) + + * m4macros/glib-gettext.m4 acinclude.m4: Suppress + warnings about xgettext not being GNU gettext when + libintl wasn't found at all. + (#79016, Andrew P. Lentvorski, Jr.) + 2002-05-21 Matthias Clasen * glib/gmarkup.c (g_markup_parse_context_parse): Add my gmarkup diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index a92ca1fbe..9105a1936 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,17 @@ +Mon May 20 18:02:46 2002 Owen Taylor + + * configure.in: Move iconv tests before gettext + checks. (#81999) + + * m4macros/glib-gettext.m4 acinclude.m4: If we can't + link to gettext, try adding in -liconv. (#80076, + Boyd Lynn Gerber) + + * m4macros/glib-gettext.m4 acinclude.m4: Suppress + warnings about xgettext not being GNU gettext when + libintl wasn't found at all. + (#79016, Andrew P. Lentvorski, Jr.) + 2002-05-21 Matthias Clasen * glib/gmarkup.c (g_markup_parse_context_parse): Add my gmarkup diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index a92ca1fbe..9105a1936 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,17 @@ +Mon May 20 18:02:46 2002 Owen Taylor + + * configure.in: Move iconv tests before gettext + checks. (#81999) + + * m4macros/glib-gettext.m4 acinclude.m4: If we can't + link to gettext, try adding in -liconv. (#80076, + Boyd Lynn Gerber) + + * m4macros/glib-gettext.m4 acinclude.m4: Suppress + warnings about xgettext not being GNU gettext when + libintl wasn't found at all. + (#79016, Andrew P. Lentvorski, Jr.) + 2002-05-21 Matthias Clasen * glib/gmarkup.c (g_markup_parse_context_parse): Add my gmarkup diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index a92ca1fbe..9105a1936 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,17 @@ +Mon May 20 18:02:46 2002 Owen Taylor + + * configure.in: Move iconv tests before gettext + checks. (#81999) + + * m4macros/glib-gettext.m4 acinclude.m4: If we can't + link to gettext, try adding in -liconv. (#80076, + Boyd Lynn Gerber) + + * m4macros/glib-gettext.m4 acinclude.m4: Suppress + warnings about xgettext not being GNU gettext when + libintl wasn't found at all. + (#79016, Andrew P. Lentvorski, Jr.) + 2002-05-21 Matthias Clasen * glib/gmarkup.c (g_markup_parse_context_parse): Add my gmarkup diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index a92ca1fbe..9105a1936 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,17 @@ +Mon May 20 18:02:46 2002 Owen Taylor + + * configure.in: Move iconv tests before gettext + checks. (#81999) + + * m4macros/glib-gettext.m4 acinclude.m4: If we can't + link to gettext, try adding in -liconv. (#80076, + Boyd Lynn Gerber) + + * m4macros/glib-gettext.m4 acinclude.m4: Suppress + warnings about xgettext not being GNU gettext when + libintl wasn't found at all. + (#79016, Andrew P. Lentvorski, Jr.) + 2002-05-21 Matthias Clasen * glib/gmarkup.c (g_markup_parse_context_parse): Add my gmarkup diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index a92ca1fbe..9105a1936 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,17 @@ +Mon May 20 18:02:46 2002 Owen Taylor + + * configure.in: Move iconv tests before gettext + checks. (#81999) + + * m4macros/glib-gettext.m4 acinclude.m4: If we can't + link to gettext, try adding in -liconv. (#80076, + Boyd Lynn Gerber) + + * m4macros/glib-gettext.m4 acinclude.m4: Suppress + warnings about xgettext not being GNU gettext when + libintl wasn't found at all. + (#79016, Andrew P. Lentvorski, Jr.) + 2002-05-21 Matthias Clasen * glib/gmarkup.c (g_markup_parse_context_parse): Add my gmarkup diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index a92ca1fbe..9105a1936 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,17 @@ +Mon May 20 18:02:46 2002 Owen Taylor + + * configure.in: Move iconv tests before gettext + checks. (#81999) + + * m4macros/glib-gettext.m4 acinclude.m4: If we can't + link to gettext, try adding in -liconv. (#80076, + Boyd Lynn Gerber) + + * m4macros/glib-gettext.m4 acinclude.m4: Suppress + warnings about xgettext not being GNU gettext when + libintl wasn't found at all. + (#79016, Andrew P. Lentvorski, Jr.) + 2002-05-21 Matthias Clasen * glib/gmarkup.c (g_markup_parse_context_parse): Add my gmarkup diff --git a/acinclude.m4 b/acinclude.m4 index e4b70de97..54f0f75ed 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -85,29 +85,38 @@ AC_DEFUN(AM_GLIB_WITH_NLS, nls_cv_header_intl= nls_cv_header_libgt= CATOBJEXT=NONE + XGETTEXT=: AC_CHECK_HEADER(libintl.h, [AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc, [AC_TRY_LINK([#include ], [return (int) dgettext ("","")], gt_cv_func_dgettext_libc=yes, gt_cv_func_dgettext_libc=no)]) - if test "$gt_cv_func_dgettext_libc" != "yes"; then + gt_cv_func_dgettext_libintl="no" + libintl_extra_libs="" + + if test "$gt_cv_func_dgettext_libc" != "yes" ; then AC_CHECK_LIB(intl, bindtextdomain, - [AC_CACHE_CHECK([for dgettext in libintl], - gt_cv_func_dgettext_libintl, - [AC_CHECK_LIB(intl, dgettext, - gt_cv_func_dgettext_libintl=yes, - gt_cv_func_dgettext_libintl=no)], - gt_cv_func_dgettext_libintl=no)]) - fi + [AC_CHECK_LIB(intl, dgettext, + gt_cv_func_dgettext_libintl=yes)]) + + if test "$gt_cv_func_dgettext_libc" != "yes" ; then + AC_MSG_NOTICE([Seeing if -liconv is needed to use gettext]) + AC_CHECK_LIB(intl, dcgettext, + [gt_cv_func_dgettext_libintl=yes + libintl_extra_libs=-liconv], + :,-liconv) + fi + fi if test "$gt_cv_func_dgettext_libintl" = "yes"; then - LIBS="$LIBS -lintl"; + LIBS="$LIBS -lintl $libintl_extra_libs"; fi if test "$gt_cv_func_dgettext_libc" = "yes" \ || test "$gt_cv_func_dgettext_libintl" = "yes"; then - AC_DEFINE(HAVE_GETTEXT) + AC_DEFINE(HAVE_GETTEXT,1, + [Define if the GNU gettext() function is already present or preinstalled.]) AM_GLIB_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl if test "$MSGFMT" != "no"; then @@ -128,7 +137,7 @@ AC_DEFUN(AM_GLIB_WITH_NLS, # Added by Martin Baulig 12/15/98 for libc5 systems if test "$gt_cv_func_dgettext_libc" != "yes" \ && test "$gt_cv_func_dgettext_libintl" = "yes"; then - INTLLIBS=-lintl + INTLLIBS="-lintl $libintl_extra_libs" LIBS=`echo $LIBS | sed -e 's/-lintl//'` fi ]) @@ -141,7 +150,8 @@ AC_DEFUN(AM_GLIB_WITH_NLS, fi if test "$nls_cv_use_gnu_gettext" != "yes"; then - AC_DEFINE(ENABLE_NLS) + AC_DEFINE(ENABLE_NLS, 1, + [always defined to indicate that i18n is enabled]) else dnl Unset this variable since we use the non-zero value as a flag. CATOBJEXT= @@ -241,9 +251,6 @@ strdup __argz_count __argz_stringify __argz_next]) dnl cannot handle comments. sed -e '/^#/d' $srcdir/po/$msgformat-msg.sed > po/po2msg.sed fi - dnl po2tbl.sed is always needed. - sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \ - $srcdir/po/po2tbl.sed.in > po/po2tbl.sed dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly dnl find the mkinstalldirs script in another subdir but ($top_srcdir). diff --git a/configure.in b/configure.in index 94126de4d..c40f7c227 100644 --- a/configure.in +++ b/configure.in @@ -264,6 +264,43 @@ else fi AC_SUBST(PERL_PATH) +dnl *********************** +dnl *** Tests for iconv *** +dnl *********************** +dnl +dnl We do this before the gettext checks, to avoid distortion + +AC_ARG_WITH(libiconv, [ --with-libiconv=[no/gnu/native] use the libiconv library ],,with_libiconv=maybe) + +found_iconv=no +case $with_libiconv in + maybe) + # Check in the C library first + AC_CHECK_FUNC(iconv_open, with_libiconv=no; found_iconv=yes) + # Check if we have GNU libiconv + if test $found_iconv = "no"; then + AC_CHECK_LIB(iconv, libiconv_open, with_libiconv=gnu; found_iconv=yes) + fi + # Check if we have a iconv in -liconv, possibly from vendor + if test $found_iconv = "no"; then + AC_CHECK_LIB(iconv, iconv_open, with_libiconv=native; found_iconv=yes) + fi + ;; + no) + AC_CHECK_FUNC(iconv_open, with_libiconv=no; found_iconv=yes) + ;; + gnu|yes) + AC_CHECK_LIB(iconv, libiconv_open, with_libiconv=gnu; found_iconv=yes) + ;; + native) + AC_CHECK_LIB(iconv, iconv_open, with_libiconv=native; found_iconv=yes) + ;; +esac + +if test "x$found_iconv" = "xno" ; then + AC_MSG_ERROR([*** No iconv() implementation found in C library or libiconv]) +fi + dnl dnl gettext support dnl @@ -293,6 +330,27 @@ AC_DEFINE_UNQUOTED(GLIB_LOCALE_DIR,"$GLIB_LOCALE_DIR") AC_CHECK_FUNCS(bind_textdomain_codeset) +dnl +dnl Now we are done with gettext checks, figure out ICONV_LIBS +dnl + +if test x$with_iconv != xno ; then + case " $INTLLIBS " in + *[[\ \ ]]-liconv[[\ \ ]]*) ;; + *) ICONV_LIBS="-liconv" ;; + esac +fi +AC_SUBST(ICONV_LIBS) + +case $with_libiconv in + gnu) + AC_DEFINE(USE_LIBICONV_GNU, [Using GNU libiconv]) + ;; + native) + AC_DEFINE(USE_LIBICONV_NATIVE, [Using a native implementation of iconv in a separate library]) + ;; +esac + dnl Initialize libtool AM_DISABLE_STATIC AC_LIBTOOL_WIN32_DLL @@ -1568,53 +1626,6 @@ case $host in esac AC_SUBST(G_LIBS_EXTRA) -dnl *********************** -dnl *** Tests for iconv *** -dnl *********************** - -AC_ARG_WITH(libiconv, [ --with-libiconv=[no/gnu/native] use the libiconv library ],,with_libiconv=maybe) - -found_iconv=no -case $with_libiconv in - maybe) - # Check in the C library first - AC_CHECK_FUNC(iconv_open, with_libiconv=no; found_iconv=yes) - # Check if we have GNU libiconv - if test $found_iconv = "no"; then - AC_CHECK_LIB(iconv, libiconv_open, with_libiconv=gnu; found_iconv=yes) - fi - # Check if we have a iconv in -liconv, possibly from vendor - if test $found_iconv = "no"; then - AC_CHECK_LIB(iconv, iconv_open, with_libiconv=native; found_iconv=yes) - fi - ;; - no) - AC_CHECK_FUNC(iconv_open, with_libiconv=no; found_iconv=yes) - ;; - gnu|yes) - AC_CHECK_LIB(iconv, libiconv_open, with_libiconv=gnu; found_iconv=yes) - ;; - native) - AC_CHECK_LIB(iconv, iconv_open, with_libiconv=native; found_iconv=yes) - ;; -esac - -if test "x$found_iconv" = "xno" ; then - AC_MSG_ERROR([*** No iconv() implementation found in C library or libiconv]) -fi - -case $with_libiconv in - gnu) - ICONV_LIBS="-liconv" - AC_DEFINE(USE_LIBICONV_GNU, [Using GNU libiconv]) - ;; - native) - ICONV_LIBS="-liconv" - AC_DEFINE(USE_LIBICONV_NATIVE, [Using a native implementation of iconv in a separate library]) - ;; -esac -AC_SUBST(ICONV_LIBS) - dnl If the system doesn't define EILSEQ, we should define EILSEQ ourselves dnl since we need it for g_iconv() diff --git a/m4macros/glib-gettext.m4 b/m4macros/glib-gettext.m4 index 1be1ec6a4..fb4f36105 100644 --- a/m4macros/glib-gettext.m4 +++ b/m4macros/glib-gettext.m4 @@ -85,24 +85,32 @@ AC_DEFUN(AM_GLIB_WITH_NLS, nls_cv_header_intl= nls_cv_header_libgt= CATOBJEXT=NONE + XGETTEXT=: AC_CHECK_HEADER(libintl.h, [AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc, [AC_TRY_LINK([#include ], [return (int) dgettext ("","")], gt_cv_func_dgettext_libc=yes, gt_cv_func_dgettext_libc=no)]) - if test "$gt_cv_func_dgettext_libc" != "yes"; then + gt_cv_func_dgettext_libintl="no" + libintl_extra_libs="" + + if test "$gt_cv_func_dgettext_libc" != "yes" ; then AC_CHECK_LIB(intl, bindtextdomain, - [AC_CACHE_CHECK([for dgettext in libintl], - gt_cv_func_dgettext_libintl, - [AC_CHECK_LIB(intl, dgettext, - gt_cv_func_dgettext_libintl=yes, - gt_cv_func_dgettext_libintl=no)], - gt_cv_func_dgettext_libintl=no)]) - fi + [AC_CHECK_LIB(intl, dgettext, + gt_cv_func_dgettext_libintl=yes)]) + + if test "$gt_cv_func_dgettext_libc" != "yes" ; then + AC_MSG_NOTICE([Seeing if -liconv is needed to use gettext]) + AC_CHECK_LIB(intl, dcgettext, + [gt_cv_func_dgettext_libintl=yes + libintl_extra_libs=-liconv], + :,-liconv) + fi + fi if test "$gt_cv_func_dgettext_libintl" = "yes"; then - LIBS="$LIBS -lintl"; + LIBS="$LIBS -lintl $libintl_extra_libs"; fi if test "$gt_cv_func_dgettext_libc" = "yes" \ @@ -129,7 +137,7 @@ AC_DEFUN(AM_GLIB_WITH_NLS, # Added by Martin Baulig 12/15/98 for libc5 systems if test "$gt_cv_func_dgettext_libc" != "yes" \ && test "$gt_cv_func_dgettext_libintl" = "yes"; then - INTLLIBS=-lintl + INTLLIBS="-lintl $libintl_extra_libs" LIBS=`echo $LIBS | sed -e 's/-lintl//'` fi ])