summaryrefslogtreecommitdiffstats
path: root/m4
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2000-09-14 17:54:44 +0000
committerBruno Haible <bruno@clisp.org>2000-09-14 17:54:44 +0000
commit75cbb08e616b1d6e7d2a412997f291c6cd2dffc0 (patch)
tree7db01536e6b66a176f655beb1bfd80c1d53d4621 /m4
parent723b1a33d014845c77d9ad1ebd492c743512976d (diff)
downloadexternal_gettext-75cbb08e616b1d6e7d2a412997f291c6cd2dffc0.zip
external_gettext-75cbb08e616b1d6e7d2a412997f291c6cd2dffc0.tar.gz
external_gettext-75cbb08e616b1d6e7d2a412997f291c6cd2dffc0.tar.bz2
Deal with the case of a pre-existing GNU libintl.{a,so}.
Diffstat (limited to 'm4')
-rw-r--r--m4/ChangeLog7
-rw-r--r--m4/gettext.m430
2 files changed, 27 insertions, 10 deletions
diff --git a/m4/ChangeLog b/m4/ChangeLog
index 2e66947..8c46d58 100644
--- a/m4/ChangeLog
+++ b/m4/ChangeLog
@@ -1,3 +1,10 @@
+2000-09-14 Bruno Haible <haible@clisp.cons.org>
+
+ * gettext.m4 (AM_WITH_NLS): Make the tests for gettext in libc and
+ in libintl similar. If found in libintl, add "-lintl" to $LIBS during
+ subsequent AC_TRY_LINKs and later to INTLLIBS.
+ Reported by Gaël Roualland <gael.roualland@dial.oleane.com>.
+
2000-08-23 Bruno Haible <haible@clisp.cons.org>
* c-bs-a.m4: New file, from sh-utils-2.0j.
diff --git a/m4/gettext.m4 b/m4/gettext.m4
index 87e868d..b3a9485 100644
--- a/m4/gettext.m4
+++ b/m4/gettext.m4
@@ -69,17 +69,19 @@ AC_DEFUN(AM_WITH_NLS,
AC_CHECK_HEADER(libintl.h,
[AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
- [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
+ [AC_TRY_LINK([#include <libintl.h>],
+ [bindtextdomain ("", ""); return (int) gettext ("")],
gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
if test "$gt_cv_func_gettext_libc" != "yes"; then
- AC_CHECK_LIB(intl, bindtextdomain,
- [AC_CACHE_CHECK([for gettext in libintl],
- gt_cv_func_gettext_libintl,
- [AC_CHECK_LIB(intl, gettext,
- gt_cv_func_gettext_libintl=yes,
- gt_cv_func_gettext_libintl=no)],
- gt_cv_func_gettext_libintl=no)])
+ AC_CACHE_CHECK([for gettext in libintl],
+ gt_cv_func_gettext_libintl,
+ [gt_save_LIBS="$LIBS"
+ LIBS="$LIBS -lintl"
+ AC_TRY_LINK([#include <libintl.h>],
+ [bindtextdomain ("", ""); return (int) gettext ("")],
+ gt_cv_func_gettext_libintl=yes, gt_cv_func_gettext_libintl=no)
+ LIBS="$gt_save_LIBS"])
fi
if test "$gt_cv_func_gettext_libc" = "yes" \
@@ -92,14 +94,22 @@ AC_DEFUN(AM_WITH_NLS,
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
+ gt_save_LIBS="$LIBS"
+ if test "$gt_cv_func_gettext_libintl" = "yes"; then
+ LIBS="$LIBS -lintl"
+ fi
AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
return _nl_msg_cat_cntr],
[CATOBJEXT=.gmo
DATADIRNAME=share],
[CATOBJEXT=.mo
DATADIRNAME=lib])
+ LIBS="$gt_save_LIBS"
INSTOBJEXT=.mo
fi
+ if test "$gt_cv_func_gettext_libintl" = "yes"; then
+ INTLLIBS="-lintl"
+ fi
fi
])
@@ -132,7 +142,7 @@ ifelse([$1], no-catgets, ,[
DATADIRNAME=lib
INTLDEPS='ifelse([$2],[],$(top_builddir)/intl/libintl.a,[$2])'
INTLLIBS=$INTLDEPS
- LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+ LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
nls_cv_header_intl=ifelse([$3],[],intl,[$3])/libintl.h
nls_cv_header_libgt=ifelse([$3],[],intl,[$3])/libgettext.h
fi])
@@ -162,7 +172,7 @@ ifelse([$1], no-catgets, ,[
DATADIRNAME=share
INTLDEPS='ifelse([$2],[],$(top_builddir)/intl/libintl.a,[$2])'
INTLLIBS=$INTLDEPS
- LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+ LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
nls_cv_header_intl=ifelse([$3],[],intl,[$3])/libintl.h
nls_cv_header_libgt=ifelse([$3],[],intl,[$3])/libgettext.h
fi