/[bison]/bison/m4/iconv.m4
ViewVC logotype

Diff of /bison/m4/iconv.m4

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by akim, Sat Jul 14 17:27:59 2001 UTC revision 1.2 by akim, Thu Mar 14 18:31:14 2002 UTC
# Line 1  Line 1 
1  #serial AM2  # iconv.m4 serial AM3 (gettext-0.11)
2    dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
3    dnl This file is free software, distributed under the terms of the GNU
4    dnl General Public License.  As a special exception to the GNU General
5    dnl Public License, this file may be distributed as part of a program
6    dnl that contains a configuration script generated by Autoconf, under
7    dnl the same distribution terms as the rest of that program.
8    
9  dnl From Bruno Haible.  dnl From Bruno Haible.
10    
11  AC_DEFUN([AM_ICONV],  AC_DEFUN([AM_ICONV_LINK],
12  [  [
13    dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and    dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
14    dnl those with the standalone portable GNU libiconv installed).    dnl those with the standalone portable GNU libiconv installed).
15    
16    AC_ARG_WITH([libiconv-prefix],    dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
17  [  --with-libiconv-prefix=DIR  search for libiconv in DIR/include and DIR/lib], [    AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
18      for dir in `echo "$withval" | tr : ' '`; do    AC_REQUIRE([AC_LIB_RPATH])
19        if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi  
20        if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi    dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
21      done    dnl accordingly.
22     ])    AC_LIB_LINKFLAGS_BODY([iconv])
23    
24      dnl Add $INCICONV to CPPFLAGS before performing the following checks,
25      dnl because if the user has installed libiconv and not disabled its use
26      dnl via --without-libiconv-prefix, he wants to use it. The first
27      dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
28      am_save_CPPFLAGS="$CPPFLAGS"
29      AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
30    
31    AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [    AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
32      am_cv_func_iconv="no, consider installing GNU libiconv"      am_cv_func_iconv="no, consider installing GNU libiconv"
# Line 26  AC_DEFUN([AM_ICONV], Line 39  AC_DEFUN([AM_ICONV],
39        am_cv_func_iconv=yes)        am_cv_func_iconv=yes)
40      if test "$am_cv_func_iconv" != yes; then      if test "$am_cv_func_iconv" != yes; then
41        am_save_LIBS="$LIBS"        am_save_LIBS="$LIBS"
42        LIBS="$LIBS -liconv"        LIBS="$LIBS $LIBICONV"
43        AC_TRY_LINK([#include <stdlib.h>        AC_TRY_LINK([#include <stdlib.h>
44  #include <iconv.h>],  #include <iconv.h>],
45          [iconv_t cd = iconv_open("","");          [iconv_t cd = iconv_open("","");
# Line 39  AC_DEFUN([AM_ICONV], Line 52  AC_DEFUN([AM_ICONV],
52    ])    ])
53    if test "$am_cv_func_iconv" = yes; then    if test "$am_cv_func_iconv" = yes; then
54      AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])      AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
55      fi
56      if test "$am_cv_lib_iconv" = yes; then
57        AC_MSG_CHECKING([how to link with libiconv])
58        AC_MSG_RESULT([$LIBICONV])
59      else
60        dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
61        dnl either.
62        CPPFLAGS="$am_save_CPPFLAGS"
63        LIBICONV=
64        LTLIBICONV=
65      fi
66      AC_SUBST(LIBICONV)
67      AC_SUBST(LTLIBICONV)
68    ])
69    
70    AC_DEFUN([AM_ICONV],
71    [
72      AC_REQUIRE([AM_ICONV_LINK])
73      if test "$am_cv_func_iconv" = yes; then
74      AC_MSG_CHECKING([for iconv declaration])      AC_MSG_CHECKING([for iconv declaration])
75      AC_CACHE_VAL(am_cv_proto_iconv, [      AC_CACHE_VAL(am_cv_proto_iconv, [
76        AC_TRY_COMPILE([        AC_TRY_COMPILE([
# Line 61  size_t iconv(); Line 93  size_t iconv();
93      AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,      AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
94        [Define as const if the declaration of iconv() needs const.])        [Define as const if the declaration of iconv() needs const.])
95    fi    fi
   LIBICONV=  
   if test "$am_cv_lib_iconv" = yes; then  
     LIBICONV="-liconv"  
   fi  
   AC_SUBST(LIBICONV)  
96  ])  ])

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26