diff options
author | Werner LEMBERG <wl@gnu.org> | 2006-01-03 23:57:03 +0000 |
---|---|---|
committer | Werner LEMBERG <wl@gnu.org> | 2006-01-03 23:57:03 +0000 |
commit | 3270bed1079c6653c9c83f2136cc1f24c337fb4f (patch) | |
tree | 0bb3f23e7f8b4ebe6475f935ed79f97c71302fae /m4/iconv.m4 | |
parent | eec4b208c691ab6028574e651d3f4e918a67fd1c (diff) | |
download | groff-git-3270bed1079c6653c9c83f2136cc1f24c337fb4f.tar.gz |
* m4/groff.m4: Renamed from aclocal.m4.
* m4/codeset.m4: New file, from gnulib.
* m4/iconv.m4: New file, from gnulib.
* m4/lib-ld.m4, m4/lib-link.m4, m4/lib-prefix.m4: New files, from
gnulib.
* config.rpath: New file, from gnulib.
* config.guess, config.sub: New files, from gnulib.
* Makefile.sub (M4MACROS): New variable.
(configure): Fix typo.
(aclocal.m4): New rule.
(stamp-h.in): Depend on aclocal.m4.
* configure.ac: Invoke AM_ICONV and AM_LANGINFO_CODESET.
* Makefile.in (LIBICONV): New variable.
(MDEFINES): Pass it to recursive makes.
* src/preproc/preconv/preconv.cpp: Use HAVE_LANGINFO_CODESET and
HAVE_ICONV instead of I18N macro.
* src/preproc/preconv/Makefile.sub (EXTRA_LDFLAGS): New variable.
* aclocal.m4, configure, src/include/config.hin: (Re)generated.
* doc/Makefile.in (webpage.html): Simplify.
* doc/Makefile.sub (webpage.html): Synchronize with doc/Makefile.in.
* doc/webpage.ms, tmac/groff_www.man, tmac/www.tmac: Minor updates.
Diffstat (limited to 'm4/iconv.m4')
-rw-r--r-- | m4/iconv.m4 | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/m4/iconv.m4 b/m4/iconv.m4 new file mode 100644 index 000000000..654c41589 --- /dev/null +++ b/m4/iconv.m4 @@ -0,0 +1,101 @@ +# iconv.m4 serial AM4 (gettext-0.11.3) +dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], +[ + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([iconv]) +]) + +AC_DEFUN([AM_ICONV_LINK], +[ + dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and + dnl those with the standalone portable GNU libiconv installed). + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) + + dnl Add $INCICONV to CPPFLAGS before performing the following checks, + dnl because if the user has installed libiconv and not disabled its use + dnl via --without-libiconv-prefix, he wants to use it. The first + dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. + am_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) + + AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + AC_TRY_LINK([#include <stdlib.h> +#include <iconv.h>], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_func_iconv=yes) + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + AC_TRY_LINK([#include <stdlib.h> +#include <iconv.h>], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_lib_iconv=yes + am_cv_func_iconv=yes) + LIBS="$am_save_LIBS" + fi + ]) + if test "$am_cv_func_iconv" = yes; then + AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) + fi + if test "$am_cv_lib_iconv" = yes; then + AC_MSG_CHECKING([how to link with libiconv]) + AC_MSG_RESULT([$LIBICONV]) + else + dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV + dnl either. + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + AC_SUBST(LIBICONV) + AC_SUBST(LTLIBICONV) +]) + +AC_DEFUN([AM_ICONV], +[ + AM_ICONV_LINK + if test "$am_cv_func_iconv" = yes; then + AC_MSG_CHECKING([for iconv declaration]) + AC_CACHE_VAL(am_cv_proto_iconv, [ + AC_TRY_COMPILE([ +#include <stdlib.h> +#include <iconv.h> +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif +], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) + am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + AC_MSG_RESULT([$]{ac_t:- + }[$]am_cv_proto_iconv) + AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, + [Define as const if the declaration of iconv() needs const.]) + fi +]) |