source: trunk/third/gtk/acinclude.m4 @ 14482

Revision 14482, 25.3 KB checked in by ghudson, 25 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r14481, which included commits to RCS files with non-trunk default branches.
Line 
1## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
2## Copyright (C) 1996-1999 Free Software Foundation, Inc.
3## Originally by 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 40 AC_PROG_LIBTOOL
25AC_DEFUN(AC_PROG_LIBTOOL,
26[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
27
28# Save cache, so that ltconfig can load it
29AC_CACHE_SAVE
30
31# Actually configure libtool.  ac_aux_dir is where install-sh is found.
32CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
33LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
34LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
35DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
36${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
37$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
38|| AC_MSG_ERROR([libtool configure failed])
39
40# Reload cache, that may have been modified by ltconfig
41AC_CACHE_LOAD
42
43# This can be used to rebuild libtool when needed
44LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
45
46# Always use our own libtool.
47LIBTOOL='$(SHELL) $(top_builddir)/libtool'
48AC_SUBST(LIBTOOL)dnl
49
50# Redirect the config.log output again, so that the ltconfig log is not
51# clobbered by the next message.
52exec 5>>./config.log
53])
54
55AC_DEFUN(AC_LIBTOOL_SETUP,
56[AC_PREREQ(2.13)dnl
57AC_REQUIRE([AC_ENABLE_SHARED])dnl
58AC_REQUIRE([AC_ENABLE_STATIC])dnl
59AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
60AC_REQUIRE([AC_CANONICAL_HOST])dnl
61AC_REQUIRE([AC_CANONICAL_BUILD])dnl
62AC_REQUIRE([AC_PROG_RANLIB])dnl
63AC_REQUIRE([AC_PROG_CC])dnl
64AC_REQUIRE([AC_PROG_LD])dnl
65AC_REQUIRE([AC_PROG_NM])dnl
66AC_REQUIRE([AC_PROG_LN_S])dnl
67dnl
68
69case "$target" in
70NONE) lt_target="$host" ;;
71*) lt_target="$target" ;;
72esac
73
74# Check for any special flags to pass to ltconfig.
75libtool_flags="--cache-file=$cache_file"
76test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
77test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
78test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
79test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
80test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
81ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
82[libtool_flags="$libtool_flags --enable-dlopen"])
83ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
84[libtool_flags="$libtool_flags --enable-win32-dll"])
85AC_ARG_ENABLE(libtool-lock,
86  [  --disable-libtool-lock  avoid locking (might break parallel builds)])
87test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
88test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
89
90# Some flags need to be propagated to the compiler or linker for good
91# libtool support.
92case "$lt_target" in
93*-*-irix6*)
94  # Find out which ABI we are using.
95  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
96  if AC_TRY_EVAL(ac_compile); then
97    case "`/usr/bin/file conftest.o`" in
98    *32-bit*)
99      LD="${LD-ld} -32"
100      ;;
101    *N32*)
102      LD="${LD-ld} -n32"
103      ;;
104    *64-bit*)
105      LD="${LD-ld} -64"
106      ;;
107    esac
108  fi
109  rm -rf conftest*
110  ;;
111
112*-*-sco3.2v5*)
113  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
114  SAVE_CFLAGS="$CFLAGS"
115  CFLAGS="$CFLAGS -belf"
116  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
117    [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
118  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
119    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
120    CFLAGS="$SAVE_CFLAGS"
121  fi
122  ;;
123
124ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
125[*-*-cygwin* | *-*-mingw*)
126  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
127  AC_CHECK_TOOL(AS, as, false)
128  AC_CHECK_TOOL(OBJDUMP, objdump, false)
129  ;;
130])
131esac
132])
133
134# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
135AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
136
137# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
138AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
139
140# AC_ENABLE_SHARED - implement the --enable-shared flag
141# Usage: AC_ENABLE_SHARED[(DEFAULT)]
142#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
143#   `yes'.
144AC_DEFUN(AC_ENABLE_SHARED, [dnl
145define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
146AC_ARG_ENABLE(shared,
147changequote(<<, >>)dnl
148<<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
149changequote([, ])dnl
150[p=${PACKAGE-default}
151case "$enableval" in
152yes) enable_shared=yes ;;
153no) enable_shared=no ;;
154*)
155  enable_shared=no
156  # Look at the argument we got.  We use all the common list separators.
157  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
158  for pkg in $enableval; do
159    if test "X$pkg" = "X$p"; then
160      enable_shared=yes
161    fi
162  done
163  IFS="$ac_save_ifs"
164  ;;
165esac],
166enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
167])
168
169# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
170AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
171AC_ENABLE_SHARED(no)])
172
173# AC_ENABLE_STATIC - implement the --enable-static flag
174# Usage: AC_ENABLE_STATIC[(DEFAULT)]
175#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
176#   `yes'.
177AC_DEFUN(AC_ENABLE_STATIC, [dnl
178define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
179AC_ARG_ENABLE(static,
180changequote(<<, >>)dnl
181<<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
182changequote([, ])dnl
183[p=${PACKAGE-default}
184case "$enableval" in
185yes) enable_static=yes ;;
186no) enable_static=no ;;
187*)
188  enable_static=no
189  # Look at the argument we got.  We use all the common list separators.
190  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
191  for pkg in $enableval; do
192    if test "X$pkg" = "X$p"; then
193      enable_static=yes
194    fi
195  done
196  IFS="$ac_save_ifs"
197  ;;
198esac],
199enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
200])
201
202# AC_DISABLE_STATIC - set the default static flag to --disable-static
203AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
204AC_ENABLE_STATIC(no)])
205
206
207# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
208# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
209#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
210#   `yes'.
211AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
212define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
213AC_ARG_ENABLE(fast-install,
214changequote(<<, >>)dnl
215<<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
216changequote([, ])dnl
217[p=${PACKAGE-default}
218case "$enableval" in
219yes) enable_fast_install=yes ;;
220no) enable_fast_install=no ;;
221*)
222  enable_fast_install=no
223  # Look at the argument we got.  We use all the common list separators.
224  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
225  for pkg in $enableval; do
226    if test "X$pkg" = "X$p"; then
227      enable_fast_install=yes
228    fi
229  done
230  IFS="$ac_save_ifs"
231  ;;
232esac],
233enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
234])
235
236# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
237AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
238AC_ENABLE_FAST_INSTALL(no)])
239
240# AC_PROG_LD - find the path to the GNU or non-GNU linker
241AC_DEFUN(AC_PROG_LD,
242[AC_ARG_WITH(gnu-ld,
243[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
244test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
245AC_REQUIRE([AC_PROG_CC])dnl
246AC_REQUIRE([AC_CANONICAL_HOST])dnl
247AC_REQUIRE([AC_CANONICAL_BUILD])dnl
248ac_prog=ld
249if test "$ac_cv_prog_gcc" = yes; then
250  # Check if gcc -print-prog-name=ld gives a path.
251  AC_MSG_CHECKING([for ld used by GCC])
252  ac_prog=`($CC -print-prog-name=ld) 2>&5`
253  case "$ac_prog" in
254    # Accept absolute paths.
255changequote(,)dnl
256    [\\/]* | [A-Za-z]:[\\/]*)
257      re_direlt='/[^/][^/]*/\.\./'
258changequote([,])dnl
259      # Canonicalize the path of ld
260      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
261      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
262        ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
263      done
264      test -z "$LD" && LD="$ac_prog"
265      ;;
266  "")
267    # If it fails, then pretend we aren't using GCC.
268    ac_prog=ld
269    ;;
270  *)
271    # If it is relative, then search for the first ld in PATH.
272    with_gnu_ld=unknown
273    ;;
274  esac
275elif test "$with_gnu_ld" = yes; then
276  AC_MSG_CHECKING([for GNU ld])
277else
278  AC_MSG_CHECKING([for non-GNU ld])
279fi
280AC_CACHE_VAL(ac_cv_path_LD,
281[if test -z "$LD"; then
282  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
283  for ac_dir in $PATH; do
284    test -z "$ac_dir" && ac_dir=.
285    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
286      ac_cv_path_LD="$ac_dir/$ac_prog"
287      # Check to see if the program is GNU ld.  I'd rather use --version,
288      # but apparently some GNU ld's only accept -v.
289      # Break only if it was the GNU/non-GNU ld that we prefer.
290      if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
291        test "$with_gnu_ld" != no && break
292      else
293        test "$with_gnu_ld" != yes && break
294      fi
295    fi
296  done
297  IFS="$ac_save_ifs"
298else
299  ac_cv_path_LD="$LD" # Let the user override the test with a path.
300fi])
301LD="$ac_cv_path_LD"
302if test -n "$LD"; then
303  AC_MSG_RESULT($LD)
304else
305  AC_MSG_RESULT(no)
306fi
307test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
308AC_PROG_LD_GNU
309])
310
311AC_DEFUN(AC_PROG_LD_GNU,
312[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
313[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
314if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
315  ac_cv_prog_gnu_ld=yes
316else
317  ac_cv_prog_gnu_ld=no
318fi])
319])
320
321# AC_PROG_NM - find the path to a BSD-compatible name lister
322AC_DEFUN(AC_PROG_NM,
323[AC_MSG_CHECKING([for BSD-compatible nm])
324AC_CACHE_VAL(ac_cv_path_NM,
325[if test -n "$NM"; then
326  # Let the user override the test.
327  ac_cv_path_NM="$NM"
328else
329  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
330  for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
331    test -z "$ac_dir" && ac_dir=.
332    if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
333      # Check to see if the nm accepts a BSD-compat flag.
334      # Adding the `sed 1q' prevents false positives on HP-UX, which says:
335      #   nm: unknown option "B" ignored
336      if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
337        ac_cv_path_NM="$ac_dir/nm -B"
338        break
339      elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
340        ac_cv_path_NM="$ac_dir/nm -p"
341        break
342      else
343        ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
344        continue # so that we can try to find one that supports BSD flags
345      fi
346    fi
347  done
348  IFS="$ac_save_ifs"
349  test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
350fi])
351NM="$ac_cv_path_NM"
352AC_MSG_RESULT([$NM])
353])
354
355# AC_CHECK_LIBM - check for math library
356AC_DEFUN(AC_CHECK_LIBM,
357[AC_REQUIRE([AC_CANONICAL_HOST])dnl
358LIBM=
359case "$lt_target" in
360*-*-beos* | *-*-cygwin*)
361  # These system don't have libm
362  ;;
363*-ncr-sysv4.3*)
364  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
365  AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
366  ;;
367*)
368  AC_CHECK_LIB(m, main, LIBM="-lm")
369  ;;
370esac
371])
372
373# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
374# the libltdl convenience library, adds --enable-ltdl-convenience to
375# the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
376# is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
377# to be `${top_builddir}/libltdl'.  Make sure you start DIR with
378# '${top_builddir}/' (note the single quotes!) if your package is not
379# flat, and, if you're not using automake, define top_builddir as
380# appropriate in the Makefiles.
381AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
382  case "$enable_ltdl_convenience" in
383  no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
384  "") enable_ltdl_convenience=yes
385      ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
386  esac
387  LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
388  INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
389])
390
391# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
392# the libltdl installable library, and adds --enable-ltdl-install to
393# the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
394# is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
395# to be `${top_builddir}/libltdl'.  Make sure you start DIR with
396# '${top_builddir}/' (note the single quotes!) if your package is not
397# flat, and, if you're not using automake, define top_builddir as
398# appropriate in the Makefiles.
399# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
400AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
401  AC_CHECK_LIB(ltdl, main,
402  [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
403  [if test x"$enable_ltdl_install" = xno; then
404     AC_MSG_WARN([libltdl not installed, but installation disabled])
405   else
406     enable_ltdl_install=yes
407   fi
408  ])
409  if test x"$enable_ltdl_install" = x"yes"; then
410    ac_configure_args="$ac_configure_args --enable-ltdl-install"
411    LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
412    INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
413  else
414    ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
415    LIBLTDL="-lltdl"
416    INCLTDL=
417  fi
418])
419
420dnl old names
421AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
422AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
423AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
424AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
425AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
426AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
427AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
428
429dnl This is just to silence aclocal about the macro not being used
430ifelse([AC_DISABLE_FAST_INSTALL])dnl
431
432# Macro to add for using GNU gettext.
433# Ulrich Drepper <drepper@cygnus.com>, 1995.
434#
435# Modified to never use included libintl.
436# Owen Taylor <otaylor@redhat.com>, 12/15/1998
437#
438#
439# This file can be copied and used freely without restrictions.  It can
440# be used in projects which are not available under the GNU Public License
441# but which still want to provide support for the GNU gettext functionality.
442# Please note that the actual code is *not* freely available.
443
444# serial 5
445
446AC_DEFUN(AM_GTK_WITH_NLS,
447  [AC_MSG_CHECKING([whether NLS is requested])
448    dnl Default is enabled NLS
449    AC_ARG_ENABLE(nls,
450      [  --disable-nls           do not use Native Language Support],
451      USE_NLS=$enableval, USE_NLS=yes)
452    AC_MSG_RESULT($USE_NLS)
453    AC_SUBST(USE_NLS)
454
455    USE_INCLUDED_LIBINTL=no
456
457    dnl If we use NLS figure out what method
458    if test "$USE_NLS" = "yes"; then
459#      AC_DEFINE(ENABLE_NLS)
460#      AC_MSG_CHECKING([whether included gettext is requested])
461#      AC_ARG_WITH(included-gettext,
462#        [  --with-included-gettext use the GNU gettext library included here],
463#        nls_cv_force_use_gnu_gettext=$withval,
464#        nls_cv_force_use_gnu_gettext=no)
465#      AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
466      nls_cv_force_use_gnu_gettext="no"
467
468      nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
469      if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
470        dnl User does not insist on using GNU NLS library.  Figure out what
471        dnl to use.  If gettext or catgets are available (in this order) we
472        dnl use this.  Else we have to fall back to GNU NLS library.
473        dnl catgets is only used if permitted by option --with-catgets.
474        nls_cv_header_intl=
475        nls_cv_header_libgt=
476        CATOBJEXT=NONE
477
478        AC_CHECK_HEADER(libintl.h,
479          [AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc,
480            [AC_TRY_LINK([#include <libintl.h>], [return (int) dgettext ("","")],
481               gt_cv_func_dgettext_libc=yes, gt_cv_func_dgettext_libc=no)])
482
483           if test "$gt_cv_func_dgettext_libc" != "yes"; then
484             AC_CHECK_LIB(intl, bindtextdomain,
485               [AC_CACHE_CHECK([for dgettext in libintl],
486                 gt_cv_func_dgettext_libintl,
487                 [AC_CHECK_LIB(intl, dgettext,
488                  gt_cv_func_dgettext_libintl=yes,
489                  gt_cv_func_dgettext_libintl=no)],
490                 gt_cv_func_dgettext_libintl=no)])
491           fi
492
493           if test "$gt_cv_func_dgettext_libintl" = "yes"; then
494             LIBS="$LIBS -lintl";
495           fi
496
497           if test "$gt_cv_func_dgettext_libc" = "yes" \
498              || test "$gt_cv_func_dgettext_libintl" = "yes"; then
499              AC_DEFINE(HAVE_GETTEXT)
500              AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
501                [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
502              if test "$MSGFMT" != "no"; then
503                AC_CHECK_FUNCS(dcgettext)
504                AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
505                AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
506                  [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
507                AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
508                               return _nl_msg_cat_cntr],
509                  [CATOBJEXT=.gmo
510                   DATADIRNAME=share],
511                  [CATOBJEXT=.mo
512                   DATADIRNAME=lib])
513                INSTOBJEXT=.mo
514              fi
515            fi
516
517            # Added by Martin Baulig 12/15/98 for libc5 systems
518            if test "$gt_cv_func_dgettext_libc" != "yes" \
519               && test "$gt_cv_func_dgettext_libintl" = "yes"; then
520               INTLLIBS=-lintl
521               LIBS=`echo $LIBS | sed -e 's/-lintl//'`
522            fi
523        ])
524
525        if test "$CATOBJEXT" = "NONE"; then
526          AC_MSG_CHECKING([whether catgets can be used])
527          AC_ARG_WITH(catgets,
528            [  --with-catgets          use catgets functions if available],
529            nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
530          AC_MSG_RESULT($nls_cv_use_catgets)
531
532          if test "$nls_cv_use_catgets" = "yes"; then
533            dnl No gettext in C library.  Try catgets next.
534            AC_CHECK_LIB(i, main)
535            AC_CHECK_FUNC(catgets,
536              [AC_DEFINE(HAVE_CATGETS)
537               INTLOBJS="\$(CATOBJS)"
538               AC_PATH_PROG(GENCAT, gencat, no)dnl
539#              if test "$GENCAT" != "no"; then
540#                AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
541#                if test "$GMSGFMT" = "no"; then
542#                  AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
543#                   [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
544#                fi
545#                AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
546#                  [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
547#                USE_INCLUDED_LIBINTL=yes
548#                CATOBJEXT=.cat
549#                INSTOBJEXT=.cat
550#                DATADIRNAME=lib
551#                INTLDEPS='$(top_builddir)/intl/libintl.a'
552#                INTLLIBS=$INTLDEPS
553#                LIBS=`echo $LIBS | sed -e 's/-lintl//'`
554#                nls_cv_header_intl=intl/libintl.h
555#                nls_cv_header_libgt=intl/libgettext.h
556#              fi
557            ])
558          fi
559        fi
560
561        if test "$CATOBJEXT" = "NONE"; then
562          dnl Neither gettext nor catgets in included in the C library.
563          dnl Fall back on GNU gettext library.
564          nls_cv_use_gnu_gettext=yes
565        fi
566      fi
567
568      if test "$nls_cv_use_gnu_gettext" != "yes"; then
569        AC_DEFINE(ENABLE_NLS)
570      else
571         # Unset this variable since we use the non-zero value as a flag.
572         CATOBJEXT=
573#        dnl Mark actions used to generate GNU NLS library.
574#        INTLOBJS="\$(GETTOBJS)"
575#        AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
576#         [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
577#        AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
578#        AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
579#         [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
580#        AC_SUBST(MSGFMT)
581#       USE_INCLUDED_LIBINTL=yes
582#        CATOBJEXT=.gmo
583#        INSTOBJEXT=.mo
584#        DATADIRNAME=share
585#       INTLDEPS='$(top_builddir)/intl/libintl.a'
586#       INTLLIBS=$INTLDEPS
587#       LIBS=`echo $LIBS | sed -e 's/-lintl//'`
588#        nls_cv_header_intl=intl/libintl.h
589#        nls_cv_header_libgt=intl/libgettext.h
590      fi
591
592      dnl Test whether we really found GNU xgettext.
593      if test "$XGETTEXT" != ":"; then
594        dnl If it is no GNU xgettext we define it as : so that the
595        dnl Makefiles still can work.
596        if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
597          : ;
598        else
599          AC_MSG_RESULT(
600            [found xgettext program is not GNU xgettext; ignore it])
601          XGETTEXT=":"
602        fi
603      fi
604
605      # We need to process the po/ directory.
606      POSUB=po
607    else
608      DATADIRNAME=share
609      nls_cv_header_intl=intl/libintl.h
610      nls_cv_header_libgt=intl/libgettext.h
611    fi
612    AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
613    AC_OUTPUT_COMMANDS(
614     [case "$CONFIG_FILES" in *po/Makefile.in*)
615        sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
616      esac])
617
618
619#    # If this is used in GNU gettext we have to set USE_NLS to `yes'
620#    # because some of the sources are only built for this goal.
621#    if test "$PACKAGE" = gettext; then
622#      USE_NLS=yes
623#      USE_INCLUDED_LIBINTL=yes
624#    fi
625
626    dnl These rules are solely for the distribution goal.  While doing this
627    dnl we only have to keep exactly one list of the available catalogs
628    dnl in configure.in.
629    for lang in $ALL_LINGUAS; do
630      GMOFILES="$GMOFILES $lang.gmo"
631      POFILES="$POFILES $lang.po"
632    done
633
634    dnl Make all variables we use known to autoconf.
635    AC_SUBST(USE_INCLUDED_LIBINTL)
636    AC_SUBST(CATALOGS)
637    AC_SUBST(CATOBJEXT)
638    AC_SUBST(DATADIRNAME)
639    AC_SUBST(GMOFILES)
640    AC_SUBST(INSTOBJEXT)
641    AC_SUBST(INTLDEPS)
642    AC_SUBST(INTLLIBS)
643    AC_SUBST(INTLOBJS)
644    AC_SUBST(POFILES)
645    AC_SUBST(POSUB)
646  ])
647
648AC_DEFUN(AM_GTK_GNU_GETTEXT,
649  [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
650   AC_REQUIRE([AC_PROG_CC])dnl
651   AC_REQUIRE([AC_PROG_RANLIB])dnl
652   AC_REQUIRE([AC_ISC_POSIX])dnl
653   AC_REQUIRE([AC_HEADER_STDC])dnl
654   AC_REQUIRE([AC_C_CONST])dnl
655   AC_REQUIRE([AC_C_INLINE])dnl
656   AC_REQUIRE([AC_TYPE_OFF_T])dnl
657   AC_REQUIRE([AC_TYPE_SIZE_T])dnl
658   AC_REQUIRE([AC_FUNC_ALLOCA])dnl
659   AC_REQUIRE([AC_FUNC_MMAP])dnl
660
661   AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
662unistd.h sys/param.h])
663   AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
664strdup __argz_count __argz_stringify __argz_next])
665
666   if test "${ac_cv_func_stpcpy+set}" != "set"; then
667     AC_CHECK_FUNCS(stpcpy)
668   fi
669   if test "${ac_cv_func_stpcpy}" = "yes"; then
670     AC_DEFINE(HAVE_STPCPY)
671   fi
672
673   AM_LC_MESSAGES
674   AM_GTK_WITH_NLS
675
676   if test "x$CATOBJEXT" != "x"; then
677     if test "x$ALL_LINGUAS" = "x"; then
678       LINGUAS=
679     else
680       AC_MSG_CHECKING(for catalogs to be installed)
681       NEW_LINGUAS=
682       for lang in ${LINGUAS=$ALL_LINGUAS}; do
683         case "$ALL_LINGUAS" in
684          *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
685         esac
686       done
687       LINGUAS=$NEW_LINGUAS
688       AC_MSG_RESULT($LINGUAS)
689     fi
690
691     dnl Construct list of names of catalog files to be constructed.
692     if test -n "$LINGUAS"; then
693       for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
694     fi
695   fi
696
697   dnl The reference to <locale.h> in the installed <libintl.h> file
698   dnl must be resolved because we cannot expect the users of this
699   dnl to define HAVE_LOCALE_H.
700   if test $ac_cv_header_locale_h = yes; then
701     INCLUDE_LOCALE_H="#include <locale.h>"
702   else
703     INCLUDE_LOCALE_H="\
704/* The system does not provide the header <locale.h>.  Take care yourself.  */"
705   fi
706   AC_SUBST(INCLUDE_LOCALE_H)
707
708   dnl Determine which catalog format we have (if any is needed)
709   dnl For now we know about two different formats:
710   dnl   Linux libc-5 and the normal X/Open format
711   test -d intl || mkdir intl
712   if test "$CATOBJEXT" = ".cat"; then
713     AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
714
715     dnl Transform the SED scripts while copying because some dumb SEDs
716     dnl cannot handle comments.
717     sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
718   fi
719   dnl po2tbl.sed is always needed.
720   sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
721     $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
722
723   dnl In the intl/Makefile.in we have a special dependency which makes
724   dnl only sense for gettext.  We comment this out for non-gettext
725   dnl packages.
726   if test "$PACKAGE" = "gettext"; then
727     GT_NO="#NO#"
728     GT_YES=
729   else
730     GT_NO=
731     GT_YES="#YES#"
732   fi
733   AC_SUBST(GT_NO)
734   AC_SUBST(GT_YES)
735
736   dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
737   dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
738   dnl Try to locate is.
739   MKINSTALLDIRS=
740   if test -n "$ac_aux_dir"; then
741     MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
742   fi
743   if test -z "$MKINSTALLDIRS"; then
744     MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
745   fi
746   AC_SUBST(MKINSTALLDIRS)
747
748   dnl *** For now the libtool support in intl/Makefile is not for real.
749   l=
750   AC_SUBST(l)
751
752   dnl Generate list of files to be processed by xgettext which will
753   dnl be included in po/Makefile.
754   test -d po || mkdir po
755   if test "x$srcdir" != "x."; then
756     if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
757       posrcprefix="$srcdir/"
758     else
759       posrcprefix="../$srcdir/"
760     fi
761   else
762     posrcprefix="../"
763   fi
764   rm -f po/POTFILES
765   sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
766        < $srcdir/po/POTFILES.in > po/POTFILES
767  ])
768
Note: See TracBrowser for help on using the repository browser.