]> Pileus Git - ~andy/gtk/blob - acinclude.m4
Make the gettext check for for libc5 systems.
[~andy/gtk] / acinclude.m4
1 ## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
2 ## Copyright (C) 1996-1998 Free Software Foundation, Inc.
3 ## Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
4 ##
5 ## This program is free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 2 of the License, or
8 ## (at your option) any later version.
9 ##
10 ## This program is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 ## General Public License for more details.
14 ##
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; if not, write to the Free Software
17 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 ##
19 ## As a special exception to the GNU General Public License, if you
20 ## distribute this file as part of a program that contains a
21 ## configuration script generated by Autoconf, you may include it under
22 ## the same distribution terms that you use for the rest of that program.
23
24 # serial 24 AM_PROG_LIBTOOL
25 AC_DEFUN(AM_PROG_LIBTOOL,
26 [AC_REQUIRE([AM_ENABLE_SHARED])dnl
27 AC_REQUIRE([AM_ENABLE_STATIC])dnl
28 AC_REQUIRE([AC_CANONICAL_HOST])dnl
29 AC_REQUIRE([AC_PROG_RANLIB])dnl
30 AC_REQUIRE([AC_PROG_CC])dnl
31 AC_REQUIRE([AM_PROG_LD])dnl
32 AC_REQUIRE([AM_PROG_NM])dnl
33 AC_REQUIRE([AC_PROG_LN_S])dnl
34 dnl
35 # Always use our own libtool.
36 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
37 AC_SUBST(LIBTOOL)dnl
38
39 # Check for any special flags to pass to ltconfig.
40 libtool_flags=
41 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
42 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
43 test "$silent" = yes && libtool_flags="$libtool_flags --silent"
44 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
45 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
46
47 # Some flags need to be propagated to the compiler or linker for good
48 # libtool support.
49 case "$host" in
50 *-*-irix6*)
51   # Find out which ABI we are using.
52   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
53   if AC_TRY_EVAL(ac_compile); then
54     case "`/usr/bin/file conftest.o`" in
55     *32-bit*)
56       LD="${LD-ld} -32"
57       ;;
58     *N32*)
59       LD="${LD-ld} -n32"
60       ;;
61     *64-bit*)
62       LD="${LD-ld} -64"
63       ;;
64     esac
65   fi
66   rm -rf conftest*
67   ;;
68
69 *-*-sco3.2v5*)
70   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
71   CFLAGS="$CFLAGS -belf"
72   ;;
73 esac
74
75 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
76 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
77 LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
78 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
79 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
80 || AC_MSG_ERROR([libtool configure failed])
81 ])
82
83 # AM_ENABLE_SHARED - implement the --enable-shared flag
84 # Usage: AM_ENABLE_SHARED[(DEFAULT)]
85 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
86 #   `yes'.
87 AC_DEFUN(AM_ENABLE_SHARED,
88 [define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
89 AC_ARG_ENABLE(shared,
90 changequote(<<, >>)dnl
91 <<  --enable-shared         build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT]
92 changequote([, ])dnl
93 [  --enable-shared=PKGS    only build shared libraries if the current package
94                           appears as an element in the PKGS list],
95 [p=${PACKAGE-default}
96 case "$enableval" in
97 yes) enable_shared=yes ;;
98 no) enable_shared=no ;;
99 *)
100   enable_shared=no
101   # Look at the argument we got.  We use all the common list separators.
102   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
103   for pkg in $enableval; do
104     if test "X$pkg" = "X$p"; then
105       enable_shared=yes
106     fi
107   done
108   IFS="$ac_save_ifs"
109   ;;
110 esac],
111 enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
112 ])
113
114 # AM_DISABLE_SHARED - set the default shared flag to --disable-shared
115 AC_DEFUN(AM_DISABLE_SHARED,
116 [AM_ENABLE_SHARED(no)])
117
118 # AM_DISABLE_STATIC - set the default static flag to --disable-static
119 AC_DEFUN(AM_DISABLE_STATIC,
120 [AM_ENABLE_STATIC(no)])
121
122 # AM_ENABLE_STATIC - implement the --enable-static flag
123 # Usage: AM_ENABLE_STATIC[(DEFAULT)]
124 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
125 #   `yes'.
126 AC_DEFUN(AM_ENABLE_STATIC,
127 [define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
128 AC_ARG_ENABLE(static,
129 changequote(<<, >>)dnl
130 <<  --enable-static         build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT]
131 changequote([, ])dnl
132 [  --enable-static=PKGS    only build shared libraries if the current package
133                           appears as an element in the PKGS list],
134 [p=${PACKAGE-default}
135 case "$enableval" in
136 yes) enable_static=yes ;;
137 no) enable_static=no ;;
138 *)
139   enable_static=no
140   # Look at the argument we got.  We use all the common list separators.
141   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
142   for pkg in $enableval; do
143     if test "X$pkg" = "X$p"; then
144       enable_static=yes
145     fi
146   done
147   IFS="$ac_save_ifs"
148   ;;
149 esac],
150 enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
151 ])
152
153
154 # AM_PROG_LD - find the path to the GNU or non-GNU linker
155 AC_DEFUN(AM_PROG_LD,
156 [AC_ARG_WITH(gnu-ld,
157 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
158 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
159 AC_REQUIRE([AC_PROG_CC])
160 ac_prog=ld
161 if test "$ac_cv_prog_gcc" = yes; then
162   # Check if gcc -print-prog-name=ld gives a path.
163   AC_MSG_CHECKING([for ld used by GCC])
164   ac_prog=`($CC -print-prog-name=ld) 2>&5`
165   case "$ac_prog" in
166   # Accept absolute paths.
167   /* | [A-Za-z]:\\*)
168     test -z "$LD" && LD="$ac_prog"
169     ;;
170   "")
171     # If it fails, then pretend we aren't using GCC.
172     ac_prog=ld
173     ;;
174   *)
175     # If it is relative, then search for the first ld in PATH.
176     with_gnu_ld=unknown
177     ;;
178   esac
179 elif test "$with_gnu_ld" = yes; then
180   AC_MSG_CHECKING([for GNU ld])
181 else
182   AC_MSG_CHECKING([for non-GNU ld])
183 fi
184 AC_CACHE_VAL(ac_cv_path_LD,
185 [if test -z "$LD"; then
186   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
187   for ac_dir in $PATH; do
188     test -z "$ac_dir" && ac_dir=.
189     if test -f "$ac_dir/$ac_prog"; then
190       ac_cv_path_LD="$ac_dir/$ac_prog"
191       # Check to see if the program is GNU ld.  I'd rather use --version,
192       # but apparently some GNU ld's only accept -v.
193       # Break only if it was the GNU/non-GNU ld that we prefer.
194       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
195         test "$with_gnu_ld" != no && break
196       else
197         test "$with_gnu_ld" != yes && break
198       fi
199     fi
200   done
201   IFS="$ac_save_ifs"
202 else
203   ac_cv_path_LD="$LD" # Let the user override the test with a path.
204 fi])
205 LD="$ac_cv_path_LD"
206 if test -n "$LD"; then
207   AC_MSG_RESULT($LD)
208 else
209   AC_MSG_RESULT(no)
210 fi
211 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
212 AC_SUBST(LD)
213 AM_PROG_LD_GNU
214 ])
215
216 AC_DEFUN(AM_PROG_LD_GNU,
217 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
218 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
219 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
220   ac_cv_prog_gnu_ld=yes
221 else
222   ac_cv_prog_gnu_ld=no
223 fi])
224 ])
225
226 # AM_PROG_NM - find the path to a BSD-compatible name lister
227 AC_DEFUN(AM_PROG_NM,
228 [AC_MSG_CHECKING([for BSD-compatible nm])
229 AC_CACHE_VAL(ac_cv_path_NM,
230 [case "$NM" in
231 /* | [A-Za-z]:\\*)
232   ac_cv_path_NM="$NM" # Let the user override the test with a path.
233   ;;
234 *)
235   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
236   for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
237     test -z "$ac_dir" && ac_dir=.
238     if test -f $ac_dir/nm; then
239       # Check to see if the nm accepts a BSD-compat flag.
240       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
241       #   nm: unknown option "B" ignored
242       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
243         ac_cv_path_NM="$ac_dir/nm -B"
244       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
245         ac_cv_path_NM="$ac_dir/nm -p"
246       else
247         ac_cv_path_NM="$ac_dir/nm"
248       fi
249       break
250     fi
251   done
252   IFS="$ac_save_ifs"
253   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
254   ;;
255 esac])
256 NM="$ac_cv_path_NM"
257 AC_MSG_RESULT([$NM])
258 AC_SUBST(NM)
259 ])
260
261 # Macro to add for using GNU gettext.
262 # Ulrich Drepper <drepper@cygnus.com>, 1995.
263 #
264 # Modified to never use included libintl. 
265 # Owen Taylor <otaylor@redhat.com>, 12/15/1998
266 #
267 #
268 # This file can be copied and used freely without restrictions.  It can
269 # be used in projects which are not available under the GNU Public License
270 # but which still want to provide support for the GNU gettext functionality.
271 # Please note that the actual code is *not* freely available.
272
273 # serial 5
274
275 AC_DEFUN(AM_GTK_WITH_NLS,
276   [AC_MSG_CHECKING([whether NLS is requested])
277     dnl Default is enabled NLS
278     AC_ARG_ENABLE(nls,
279       [  --disable-nls           do not use Native Language Support],
280       USE_NLS=$enableval, USE_NLS=yes)
281     AC_MSG_RESULT($USE_NLS)
282     AC_SUBST(USE_NLS)
283
284     USE_INCLUDED_LIBINTL=no
285
286     dnl If we use NLS figure out what method
287     if test "$USE_NLS" = "yes"; then
288       AC_DEFINE(ENABLE_NLS)
289 #      AC_MSG_CHECKING([whether included gettext is requested])
290 #      AC_ARG_WITH(included-gettext,
291 #        [  --with-included-gettext use the GNU gettext library included here],
292 #        nls_cv_force_use_gnu_gettext=$withval,
293 #        nls_cv_force_use_gnu_gettext=no)
294 #      AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
295       nls_cv_force_use_gnu_gettext="no"
296
297       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
298       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
299         dnl User does not insist on using GNU NLS library.  Figure out what
300         dnl to use.  If gettext or catgets are available (in this order) we
301         dnl use this.  Else we have to fall back to GNU NLS library.
302         dnl catgets is only used if permitted by option --with-catgets.
303         nls_cv_header_intl=
304         nls_cv_header_libgt=
305         CATOBJEXT=NONE
306
307         AC_CHECK_HEADER(libintl.h,
308           [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
309             [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
310                gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
311
312            if test "$gt_cv_func_gettext_libc" != "yes"; then
313              AC_CHECK_LIB(intl, bindtextdomain,
314                [AC_CACHE_CHECK([for gettext in libintl],
315                  gt_cv_func_gettext_libintl,
316                  [AC_CHECK_LIB(intl, gettext,
317                   gt_cv_func_gettext_libintl=yes,
318                   gt_cv_func_gettext_libintl=no)],
319                  gt_cv_func_gettext_libintl=no)])
320            fi
321
322            if test "$gt_cv_func_gettext_libc" = "yes" \
323               || test "$gt_cv_func_gettext_libintl" = "yes"; then
324               AC_DEFINE(HAVE_GETTEXT)
325               AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
326                 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
327               if test "$MSGFMT" != "no"; then
328                 AC_CHECK_FUNCS(dcgettext)
329                 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
330                 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
331                   [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
332                 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
333                                return _nl_msg_cat_cntr],
334                   [CATOBJEXT=.gmo
335                    DATADIRNAME=share],
336                   [CATOBJEXT=.mo
337                    DATADIRNAME=lib])
338                 INSTOBJEXT=.mo
339               fi
340             fi
341
342             # Added by Martin Baulig 12/15/98 for libc5 systems
343             if test "$gt_cv_func_gettext_libc" != "yes" \
344                && test "$gt_cv_func_gettext_libintl" = "yes"; then
345                INTLLIBS=-lintl
346                LIBS=`echo $LIBS | sed -e 's/-lintl//'`
347             fi
348         ])
349
350         if test "$CATOBJEXT" = "NONE"; then
351           AC_MSG_CHECKING([whether catgets can be used])
352           AC_ARG_WITH(catgets,
353             [  --with-catgets          use catgets functions if available],
354             nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
355           AC_MSG_RESULT($nls_cv_use_catgets)
356
357           if test "$nls_cv_use_catgets" = "yes"; then
358             dnl No gettext in C library.  Try catgets next.
359             AC_CHECK_LIB(i, main)
360             AC_CHECK_FUNC(catgets,
361               [AC_DEFINE(HAVE_CATGETS)
362                INTLOBJS="\$(CATOBJS)"
363                AC_PATH_PROG(GENCAT, gencat, no)dnl
364 #              if test "$GENCAT" != "no"; then
365 #                AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
366 #                if test "$GMSGFMT" = "no"; then
367 #                  AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
368 #                   [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
369 #                fi
370 #                AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
371 #                  [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
372 #                USE_INCLUDED_LIBINTL=yes
373 #                CATOBJEXT=.cat
374 #                INSTOBJEXT=.cat
375 #                DATADIRNAME=lib
376 #                INTLDEPS='$(top_builddir)/intl/libintl.a'
377 #                INTLLIBS=$INTLDEPS
378 #                LIBS=`echo $LIBS | sed -e 's/-lintl//'`
379 #                nls_cv_header_intl=intl/libintl.h
380 #                nls_cv_header_libgt=intl/libgettext.h
381 #              fi
382             ])
383           fi
384         fi
385
386         if test "$CATOBJEXT" = "NONE"; then
387           dnl Neither gettext nor catgets in included in the C library.
388           dnl Fall back on GNU gettext library.
389           nls_cv_use_gnu_gettext=yes
390         fi
391       fi
392
393       if test "$nls_cv_use_gnu_gettext" != "yes"; then
394         AC_DEFINE(ENABLE_NLS)
395 #      else
396 #        dnl Mark actions used to generate GNU NLS library.
397 #        INTLOBJS="\$(GETTOBJS)"
398 #        AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
399 #         [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
400 #        AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
401 #        AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
402 #         [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
403 #        AC_SUBST(MSGFMT)
404 #       USE_INCLUDED_LIBINTL=yes
405 #        CATOBJEXT=.gmo
406 #        INSTOBJEXT=.mo
407 #        DATADIRNAME=share
408 #       INTLDEPS='$(top_builddir)/intl/libintl.a'
409 #       INTLLIBS=$INTLDEPS
410 #       LIBS=`echo $LIBS | sed -e 's/-lintl//'`
411 #        nls_cv_header_intl=intl/libintl.h
412 #        nls_cv_header_libgt=intl/libgettext.h
413       fi
414
415       dnl Test whether we really found GNU xgettext.
416       if test "$XGETTEXT" != ":"; then
417         dnl If it is no GNU xgettext we define it as : so that the
418         dnl Makefiles still can work.
419         if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
420           : ;
421         else
422           AC_MSG_RESULT(
423             [found xgettext program is not GNU xgettext; ignore it])
424           XGETTEXT=":"
425         fi
426       fi
427
428       # We need to process the po/ directory.
429       POSUB=po
430     else
431       DATADIRNAME=share
432       nls_cv_header_intl=intl/libintl.h
433       nls_cv_header_libgt=intl/libgettext.h
434     fi
435     AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
436     AC_OUTPUT_COMMANDS(
437      [case "$CONFIG_FILES" in *po/Makefile.in*)
438         sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
439       esac])
440
441
442 #    # If this is used in GNU gettext we have to set USE_NLS to `yes'
443 #    # because some of the sources are only built for this goal.
444 #    if test "$PACKAGE" = gettext; then
445 #      USE_NLS=yes
446 #      USE_INCLUDED_LIBINTL=yes
447 #    fi
448
449     dnl These rules are solely for the distribution goal.  While doing this
450     dnl we only have to keep exactly one list of the available catalogs
451     dnl in configure.in.
452     for lang in $ALL_LINGUAS; do
453       GMOFILES="$GMOFILES $lang.gmo"
454       POFILES="$POFILES $lang.po"
455     done
456
457     dnl Make all variables we use known to autoconf.
458     AC_SUBST(USE_INCLUDED_LIBINTL)
459     AC_SUBST(CATALOGS)
460     AC_SUBST(CATOBJEXT)
461     AC_SUBST(DATADIRNAME)
462     AC_SUBST(GMOFILES)
463     AC_SUBST(INSTOBJEXT)
464     AC_SUBST(INTLDEPS)
465     AC_SUBST(INTLLIBS)
466     AC_SUBST(INTLOBJS)
467     AC_SUBST(POFILES)
468     AC_SUBST(POSUB)
469   ])
470
471 AC_DEFUN(AM_GTK_GNU_GETTEXT,
472   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
473    AC_REQUIRE([AC_PROG_CC])dnl
474    AC_REQUIRE([AC_PROG_RANLIB])dnl
475    AC_REQUIRE([AC_ISC_POSIX])dnl
476    AC_REQUIRE([AC_HEADER_STDC])dnl
477    AC_REQUIRE([AC_C_CONST])dnl
478    AC_REQUIRE([AC_C_INLINE])dnl
479    AC_REQUIRE([AC_TYPE_OFF_T])dnl
480    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
481    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
482    AC_REQUIRE([AC_FUNC_MMAP])dnl
483
484    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
485 unistd.h sys/param.h])
486    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
487 strdup __argz_count __argz_stringify __argz_next])
488
489    if test "${ac_cv_func_stpcpy+set}" != "set"; then
490      AC_CHECK_FUNCS(stpcpy)
491    fi
492    if test "${ac_cv_func_stpcpy}" = "yes"; then
493      AC_DEFINE(HAVE_STPCPY)
494    fi
495
496    AM_LC_MESSAGES
497    AM_GTK_WITH_NLS
498
499    if test "x$CATOBJEXT" != "x"; then
500      if test "x$ALL_LINGUAS" = "x"; then
501        LINGUAS=
502      else
503        AC_MSG_CHECKING(for catalogs to be installed)
504        NEW_LINGUAS=
505        for lang in ${LINGUAS=$ALL_LINGUAS}; do
506          case "$ALL_LINGUAS" in
507           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
508          esac
509        done
510        LINGUAS=$NEW_LINGUAS
511        AC_MSG_RESULT($LINGUAS)
512      fi
513
514      dnl Construct list of names of catalog files to be constructed.
515      if test -n "$LINGUAS"; then
516        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
517      fi
518    fi
519
520    dnl The reference to <locale.h> in the installed <libintl.h> file
521    dnl must be resolved because we cannot expect the users of this
522    dnl to define HAVE_LOCALE_H.
523    if test $ac_cv_header_locale_h = yes; then
524      INCLUDE_LOCALE_H="#include <locale.h>"
525    else
526      INCLUDE_LOCALE_H="\
527 /* The system does not provide the header <locale.h>.  Take care yourself.  */"
528    fi
529    AC_SUBST(INCLUDE_LOCALE_H)
530
531    dnl Determine which catalog format we have (if any is needed)
532    dnl For now we know about two different formats:
533    dnl   Linux libc-5 and the normal X/Open format
534    test -d intl || mkdir intl
535    if test "$CATOBJEXT" = ".cat"; then
536      AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
537
538      dnl Transform the SED scripts while copying because some dumb SEDs
539      dnl cannot handle comments.
540      sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
541    fi
542    dnl po2tbl.sed is always needed.
543    sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
544      $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
545
546    dnl In the intl/Makefile.in we have a special dependency which makes
547    dnl only sense for gettext.  We comment this out for non-gettext
548    dnl packages.
549    if test "$PACKAGE" = "gettext"; then
550      GT_NO="#NO#"
551      GT_YES=
552    else
553      GT_NO=
554      GT_YES="#YES#"
555    fi
556    AC_SUBST(GT_NO)
557    AC_SUBST(GT_YES)
558
559    dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
560    dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
561    dnl Try to locate is.
562    MKINSTALLDIRS=
563    if test -n "$ac_aux_dir"; then
564      MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
565    fi
566    if test -z "$MKINSTALLDIRS"; then
567      MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
568    fi
569    AC_SUBST(MKINSTALLDIRS)
570
571    dnl *** For now the libtool support in intl/Makefile is not for real.
572    l=
573    AC_SUBST(l)
574
575    dnl Generate list of files to be processed by xgettext which will
576    dnl be included in po/Makefile.
577    test -d po || mkdir po
578    if test "x$srcdir" != "x."; then
579      if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
580        posrcprefix="$srcdir/"
581      else
582        posrcprefix="../$srcdir/"
583      fi
584    else
585      posrcprefix="../"
586    fi
587    rm -f po/POTFILES
588    sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
589         < $srcdir/po/POTFILES.in > po/POTFILES
590   ])
591