]> git.sesse.net Git - vlc/blob - aclocal.m4
f03dc8a6eb2f067de4faf5b7dfaa7b6a1294b2a1
[vlc] / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4-p4
2
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
12
13 # Macro to add for using GNU gettext.
14 # Ulrich Drepper <drepper@cygnus.com>, 1995.
15 #
16 # This file can be copied and used freely without restrictions.  It can
17 # be used in projects which are not available under the GNU General Public
18 # License or the GNU Library General Public License but which still want
19 # to provide support for the GNU gettext functionality.
20 # Please note that the actual code of the GNU gettext library is covered
21 # by the GNU Library General Public License, and the rest of the GNU
22 # gettext package package is covered by the GNU General Public License.
23 # They are *not* in the public domain.
24
25 # serial 10
26
27 dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]).
28 dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library
29 dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
30 dnl    depending on --{enable,disable}-{shared,static} and on the presence of
31 dnl    AM-DISABLE-SHARED). Otherwise, a static library
32 dnl    $(top_builddir)/intl/libintl.a will be created.
33 dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
34 dnl    implementations (in libc or libintl) without the ngettext() function
35 dnl    will be ignored.
36 dnl LIBDIR is used to find the intl libraries.  If empty,
37 dnl    the value `$(top_builddir)/intl/' is used.
38 dnl
39 dnl The result of the configuration is one of three cases:
40 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
41 dnl    and used.
42 dnl    Catalog format: GNU --> install in $(datadir)
43 dnl    Catalog extension: .mo after installation, .gmo in source tree
44 dnl 2) GNU gettext has been found in the system's C library.
45 dnl    Catalog format: GNU --> install in $(datadir)
46 dnl    Catalog extension: .mo after installation, .gmo in source tree
47 dnl 3) No internationalization, always use English msgid.
48 dnl    Catalog format: none
49 dnl    Catalog extension: none
50 dnl The use of .gmo is historical (it was needed to avoid overwriting the
51 dnl GNU format catalogs when building on a platform with an X/Open gettext),
52 dnl but we keep it in order not to force irrelevant filename changes on the
53 dnl maintainers.
54 dnl
55 AC_DEFUN([AM_WITH_NLS],
56   [AC_MSG_CHECKING([whether NLS is requested])
57     dnl Default is enabled NLS
58     AC_ARG_ENABLE(nls,
59       [  --disable-nls           do not use Native Language Support],
60       USE_NLS=$enableval, USE_NLS=yes)
61     AC_MSG_RESULT($USE_NLS)
62     AC_SUBST(USE_NLS)
63
64     BUILD_INCLUDED_LIBINTL=no
65     USE_INCLUDED_LIBINTL=no
66     INTLLIBS=
67
68     dnl If we use NLS figure out what method
69     if test "$USE_NLS" = "yes"; then
70       AC_DEFINE(ENABLE_NLS, 1,
71         [Define to 1 if translation of program messages to the user's native language
72    is requested.])
73       AC_MSG_CHECKING([whether included gettext is requested])
74       AC_ARG_WITH(included-gettext,
75         [  --with-included-gettext use the GNU gettext library included here],
76         nls_cv_force_use_gnu_gettext=$withval,
77         nls_cv_force_use_gnu_gettext=no)
78       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
79
80       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
81       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
82         dnl User does not insist on using GNU NLS library.  Figure out what
83         dnl to use.  If GNU gettext is available we use this.  Else we have
84         dnl to fall back to GNU NLS library.
85         CATOBJEXT=NONE
86
87         dnl Add a version number to the cache macros.
88         define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc])
89         define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl])
90
91         AC_CHECK_HEADER(libintl.h,
92           [AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
93             [AC_TRY_LINK([#include <libintl.h>
94 extern int _nl_msg_cat_cntr;],
95                [bindtextdomain ("", "");
96 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
97                gt_cv_func_gnugettext_libc=yes,
98                gt_cv_func_gnugettext_libc=no)])
99
100            if test "$gt_cv_func_gnugettext_libc" != "yes"; then
101              AC_CACHE_CHECK([for GNU gettext in libintl],
102                gt_cv_func_gnugettext_libintl,
103                [gt_save_LIBS="$LIBS"
104                 LIBS="$LIBS -lintl $LIBICONV"
105                 AC_TRY_LINK([#include <libintl.h>
106 extern int _nl_msg_cat_cntr;],
107                   [bindtextdomain ("", "");
108 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
109                   gt_cv_func_gnugettext_libintl=yes,
110                   gt_cv_func_gnugettext_libintl=no)
111                 LIBS="$gt_save_LIBS"])
112            fi
113
114            dnl If an already present or preinstalled GNU gettext() is found,
115            dnl use it.  But if this macro is used in GNU gettext, and GNU
116            dnl gettext is already preinstalled in libintl, we update this
117            dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
118            if test "$gt_cv_func_gnugettext_libc" = "yes" \
119               || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
120                    && test "$PACKAGE" != gettext; }; then
121              AC_DEFINE(HAVE_GETTEXT, 1,
122                [Define if the GNU gettext() function is already present or preinstalled.])
123
124              if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
125                dnl If iconv() is in a separate libiconv library, then anyone
126                dnl linking with libintl{.a,.so} also needs to link with
127                dnl libiconv.
128                INTLLIBS="-lintl $LIBICONV"
129              fi
130
131              gt_save_LIBS="$LIBS"
132              LIBS="$LIBS $INTLLIBS"
133              AC_CHECK_FUNCS(dcgettext)
134              LIBS="$gt_save_LIBS"
135
136              dnl Search for GNU msgfmt in the PATH.
137              AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
138                [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
139              AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
140
141              dnl Search for GNU xgettext in the PATH.
142              AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
143                [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
144
145              CATOBJEXT=.gmo
146            fi
147         ])
148
149         if test "$CATOBJEXT" = "NONE"; then
150           dnl GNU gettext is not found in the C library.
151           dnl Fall back on GNU gettext library.
152           nls_cv_use_gnu_gettext=yes
153         fi
154       fi
155
156       if test "$nls_cv_use_gnu_gettext" = "yes"; then
157         dnl Mark actions used to generate GNU NLS library.
158         INTLOBJS="\$(GETTOBJS)"
159         AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
160           [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
161         AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
162         AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
163           [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
164         AC_SUBST(MSGFMT)
165         BUILD_INCLUDED_LIBINTL=yes
166         USE_INCLUDED_LIBINTL=yes
167         CATOBJEXT=.gmo
168         INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV"
169         LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
170       fi
171
172       dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
173       dnl Test whether we really found GNU msgfmt.
174       if test "$GMSGFMT" != ":"; then
175         dnl If it is no GNU msgfmt we define it as : so that the
176         dnl Makefiles still can work.
177         if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then
178           : ;
179         else
180           AC_MSG_RESULT(
181             [found msgfmt program is not GNU msgfmt; ignore it])
182           GMSGFMT=":"
183         fi
184       fi
185
186       dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
187       dnl Test whether we really found GNU xgettext.
188       if test "$XGETTEXT" != ":"; then
189         dnl If it is no GNU xgettext we define it as : so that the
190         dnl Makefiles still can work.
191         if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then
192           : ;
193         else
194           AC_MSG_RESULT(
195             [found xgettext program is not GNU xgettext; ignore it])
196           XGETTEXT=":"
197         fi
198       fi
199
200       dnl We need to process the po/ directory.
201       POSUB=po
202     fi
203     AC_OUTPUT_COMMANDS(
204      [for ac_file in $CONFIG_FILES; do
205         # Support "outfile[:infile[:infile...]]"
206         case "$ac_file" in
207           *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
208         esac
209         # PO directories have a Makefile.in generated from Makefile.in.in.
210         case "$ac_file" in */Makefile.in)
211           # Adjust a relative srcdir.
212           ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
213           ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
214           ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
215           # In autoconf-2.13 it is called $ac_given_srcdir.
216           # In autoconf-2.50 it is called $srcdir.
217           test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
218           case "$ac_given_srcdir" in
219             .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
220             /*) top_srcdir="$ac_given_srcdir" ;;
221             *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
222           esac
223           if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
224             rm -f "$ac_dir/POTFILES"
225             test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
226             sed -e "/^#/d" -e "/^[      ]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
227             test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
228             sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
229           fi
230           ;;
231         esac
232       done])
233
234
235     dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
236     dnl to 'yes' because some of the testsuite requires it.
237     if test "$PACKAGE" = gettext; then
238       BUILD_INCLUDED_LIBINTL=yes
239     fi
240
241     dnl intl/plural.c is generated from intl/plural.y. It requires bison,
242     dnl because plural.y uses bison specific features. It requires at least
243     dnl bison-1.26 because earlier versions generate a plural.c that doesn't
244     dnl compile.
245     dnl bison is only needed for the maintainer (who touches plural.y). But in
246     dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
247     dnl the rule in general Makefile. Now, some people carelessly touch the
248     dnl files or have a broken "make" program, hence the plural.c rule will
249     dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
250     dnl present or too old.
251     AC_CHECK_PROGS([INTLBISON], [bison])
252     if test -z "$INTLBISON"; then
253       ac_verc_fail=yes
254     else
255       dnl Found it, now check the version.
256       AC_MSG_CHECKING([version of bison])
257 changequote(<<,>>)dnl
258       ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
259       case $ac_prog_version in
260         '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
261         1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
262 changequote([,])dnl
263            ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
264         *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
265       esac
266       AC_MSG_RESULT([$ac_prog_version])
267     fi
268     if test $ac_verc_fail = yes; then
269       INTLBISON=:
270     fi
271
272     dnl These rules are solely for the distribution goal.  While doing this
273     dnl we only have to keep exactly one list of the available catalogs
274     dnl in configure.in.
275     for lang in $ALL_LINGUAS; do
276       GMOFILES="$GMOFILES $lang.gmo"
277       POFILES="$POFILES $lang.po"
278     done
279
280     dnl Make all variables we use known to autoconf.
281     AC_SUBST(BUILD_INCLUDED_LIBINTL)
282     AC_SUBST(USE_INCLUDED_LIBINTL)
283     AC_SUBST(CATALOGS)
284     AC_SUBST(CATOBJEXT)
285     AC_SUBST(GMOFILES)
286     AC_SUBST(INTLLIBS)
287     AC_SUBST(INTLOBJS)
288     AC_SUBST(POFILES)
289     AC_SUBST(POSUB)
290
291     dnl For backward compatibility. Some configure.ins may be using this.
292     nls_cv_header_intl=
293     nls_cv_header_libgt=
294
295     dnl For backward compatibility. Some Makefiles may be using this.
296     DATADIRNAME=share
297     AC_SUBST(DATADIRNAME)
298
299     dnl For backward compatibility. Some Makefiles may be using this.
300     INSTOBJEXT=.mo
301     AC_SUBST(INSTOBJEXT)
302
303     dnl For backward compatibility. Some Makefiles may be using this.
304     GENCAT=gencat
305     AC_SUBST(GENCAT)
306   ])
307
308 dnl Usage: Just like AM_WITH_NLS, which see.
309 AC_DEFUN([AM_GNU_GETTEXT],
310   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
311    AC_REQUIRE([AC_PROG_CC])dnl
312    AC_REQUIRE([AC_CANONICAL_HOST])dnl
313    AC_REQUIRE([AC_PROG_RANLIB])dnl
314    AC_REQUIRE([AC_ISC_POSIX])dnl
315    AC_REQUIRE([AC_HEADER_STDC])dnl
316    AC_REQUIRE([AC_C_CONST])dnl
317    AC_REQUIRE([AC_C_INLINE])dnl
318    AC_REQUIRE([AC_TYPE_OFF_T])dnl
319    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
320    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
321    AC_REQUIRE([AC_FUNC_MMAP])dnl
322    AC_REQUIRE([jm_GLIBC21])dnl
323
324    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
325 stdlib.h string.h unistd.h sys/param.h])
326    AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \
327 getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \
328 strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
329
330    AM_ICONV
331    AM_LANGINFO_CODESET
332    AM_LC_MESSAGES
333    AM_WITH_NLS([$1],[$2],[$3])
334
335    if test "x$CATOBJEXT" != "x"; then
336      if test "x$ALL_LINGUAS" = "x"; then
337        LINGUAS=
338      else
339        AC_MSG_CHECKING(for catalogs to be installed)
340        NEW_LINGUAS=
341        for presentlang in $ALL_LINGUAS; do
342          useit=no
343          for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do
344            # Use the presentlang catalog if desiredlang is
345            #   a. equal to presentlang, or
346            #   b. a variant of presentlang (because in this case,
347            #      presentlang can be used as a fallback for messages
348            #      which are not translated in the desiredlang catalog).
349            case "$desiredlang" in
350              "$presentlang"*) useit=yes;;
351            esac
352          done
353          if test $useit = yes; then
354            NEW_LINGUAS="$NEW_LINGUAS $presentlang"
355          fi
356        done
357        LINGUAS=$NEW_LINGUAS
358        AC_MSG_RESULT($LINGUAS)
359      fi
360
361      dnl Construct list of names of catalog files to be constructed.
362      if test -n "$LINGUAS"; then
363        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
364      fi
365    fi
366
367    dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
368    dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
369    dnl Try to locate is.
370    MKINSTALLDIRS=
371    if test -n "$ac_aux_dir"; then
372      MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
373    fi
374    if test -z "$MKINSTALLDIRS"; then
375      MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
376    fi
377    AC_SUBST(MKINSTALLDIRS)
378
379    dnl Enable libtool support if the surrounding package wishes it.
380    INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
381    AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
382   ])
383
384 # Search path for a program which passes the given test.
385 # Ulrich Drepper <drepper@cygnus.com>, 1996.
386 #
387 # This file can be copied and used freely without restrictions.  It can
388 # be used in projects which are not available under the GNU General Public
389 # License or the GNU Library General Public License but which still want
390 # to provide support for the GNU gettext functionality.
391 # Please note that the actual code of the GNU gettext library is covered
392 # by the GNU Library General Public License, and the rest of the GNU
393 # gettext package package is covered by the GNU General Public License.
394 # They are *not* in the public domain.
395
396 # serial 2
397
398 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
399 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
400 AC_DEFUN([AM_PATH_PROG_WITH_TEST],
401 [# Extract the first word of "$2", so it can be a program name with args.
402 set dummy $2; ac_word=[$]2
403 AC_MSG_CHECKING([for $ac_word])
404 AC_CACHE_VAL(ac_cv_path_$1,
405 [case "[$]$1" in
406   /*)
407   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
408   ;;
409   *)
410   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
411   for ac_dir in ifelse([$5], , $PATH, [$5]); do
412     test -z "$ac_dir" && ac_dir=.
413     if test -f $ac_dir/$ac_word; then
414       if [$3]; then
415         ac_cv_path_$1="$ac_dir/$ac_word"
416         break
417       fi
418     fi
419   done
420   IFS="$ac_save_ifs"
421 dnl If no 4th arg is given, leave the cache variable unset,
422 dnl so AC_PATH_PROGS will keep looking.
423 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
424 ])dnl
425   ;;
426 esac])dnl
427 $1="$ac_cv_path_$1"
428 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
429   AC_MSG_RESULT([$]$1)
430 else
431   AC_MSG_RESULT(no)
432 fi
433 AC_SUBST($1)dnl
434 ])
435
436 #serial 1
437 # This test replaces the one in autoconf.
438 # Currently this macro should have the same name as the autoconf macro
439 # because gettext's gettext.m4 (distributed in the automake package)
440 # still uses it.  Otherwise, the use in gettext.m4 makes autoheader
441 # give these diagnostics:
442 #   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
443 #   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
444
445 undefine([AC_ISC_POSIX])
446
447 AC_DEFUN([AC_ISC_POSIX],
448   [
449     dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
450     AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
451   ]
452 )
453
454 #serial 2
455
456 # Test for the GNU C Library, version 2.1 or newer.
457 # From Bruno Haible.
458
459 AC_DEFUN([jm_GLIBC21],
460   [
461     AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
462       ac_cv_gnu_library_2_1,
463       [AC_EGREP_CPP([Lucky GNU user],
464         [
465 #include <features.h>
466 #ifdef __GNU_LIBRARY__
467  #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
468   Lucky GNU user
469  #endif
470 #endif
471         ],
472         ac_cv_gnu_library_2_1=yes,
473         ac_cv_gnu_library_2_1=no)
474       ]
475     )
476     AC_SUBST(GLIBC21)
477     GLIBC21="$ac_cv_gnu_library_2_1"
478   ]
479 )
480
481 #serial AM2
482
483 dnl From Bruno Haible.
484
485 AC_DEFUN([AM_ICONV],
486 [
487   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
488   dnl those with the standalone portable GNU libiconv installed).
489
490   AC_ARG_WITH([libiconv-prefix],
491 [  --with-libiconv-prefix=DIR  search for libiconv in DIR/include and DIR/lib], [
492     for dir in `echo "$withval" | tr : ' '`; do
493       if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
494       if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
495     done
496    ])
497
498   AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
499     am_cv_func_iconv="no, consider installing GNU libiconv"
500     am_cv_lib_iconv=no
501     AC_TRY_LINK([#include <stdlib.h>
502 #include <iconv.h>],
503       [iconv_t cd = iconv_open("","");
504        iconv(cd,NULL,NULL,NULL,NULL);
505        iconv_close(cd);],
506       am_cv_func_iconv=yes)
507     if test "$am_cv_func_iconv" != yes; then
508       am_save_LIBS="$LIBS"
509       LIBS="$LIBS -liconv"
510       AC_TRY_LINK([#include <stdlib.h>
511 #include <iconv.h>],
512         [iconv_t cd = iconv_open("","");
513          iconv(cd,NULL,NULL,NULL,NULL);
514          iconv_close(cd);],
515         am_cv_lib_iconv=yes
516         am_cv_func_iconv=yes)
517       LIBS="$am_save_LIBS"
518     fi
519   ])
520   if test "$am_cv_func_iconv" = yes; then
521     AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
522     AC_MSG_CHECKING([for iconv declaration])
523     AC_CACHE_VAL(am_cv_proto_iconv, [
524       AC_TRY_COMPILE([
525 #include <stdlib.h>
526 #include <iconv.h>
527 extern
528 #ifdef __cplusplus
529 "C"
530 #endif
531 #if defined(__STDC__) || defined(__cplusplus)
532 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
533 #else
534 size_t iconv();
535 #endif
536 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
537       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);"])
538     am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
539     AC_MSG_RESULT([$]{ac_t:-
540          }[$]am_cv_proto_iconv)
541     AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
542       [Define as const if the declaration of iconv() needs const.])
543   fi
544   LIBICONV=
545   if test "$am_cv_lib_iconv" = yes; then
546     LIBICONV="-liconv"
547   fi
548   AC_SUBST(LIBICONV)
549 ])
550
551 #serial AM1
552
553 dnl From Bruno Haible.
554
555 AC_DEFUN([AM_LANGINFO_CODESET],
556 [
557   AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
558     [AC_TRY_LINK([#include <langinfo.h>],
559       [char* cs = nl_langinfo(CODESET);],
560       am_cv_langinfo_codeset=yes,
561       am_cv_langinfo_codeset=no)
562     ])
563   if test $am_cv_langinfo_codeset = yes; then
564     AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
565       [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
566   fi
567 ])
568
569 # Check whether LC_MESSAGES is available in <locale.h>.
570 # Ulrich Drepper <drepper@cygnus.com>, 1995.
571 #
572 # This file can be copied and used freely without restrictions.  It can
573 # be used in projects which are not available under the GNU General Public
574 # License or the GNU Library General Public License but which still want
575 # to provide support for the GNU gettext functionality.
576 # Please note that the actual code of the GNU gettext library is covered
577 # by the GNU Library General Public License, and the rest of the GNU
578 # gettext package package is covered by the GNU General Public License.
579 # They are *not* in the public domain.
580
581 # serial 2
582
583 AC_DEFUN([AM_LC_MESSAGES],
584   [if test $ac_cv_header_locale_h = yes; then
585     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
586       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
587        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
588     if test $am_cv_val_LC_MESSAGES = yes; then
589       AC_DEFINE(HAVE_LC_MESSAGES, 1,
590         [Define if your <locale.h> file defines LC_MESSAGES.])
591     fi
592   fi])
593