1# aclocal.m4 generated automatically by aclocal 1.5
2
3# Copyright 1996, 1997, 1998, 1999, 2000, 2001
4# Free Software Foundation, Inc.
5# This file is free software; the Free Software Foundation
6# gives unlimited permission to copy and/or distribute it,
7# with or without modifications, as long as this notice is preserved.
8
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12# PARTICULAR PURPOSE.
13
14dnl ACX_PTHREAD
15dnl Synopsis
16dnl
17dnl ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
18dnl Description
19dnl
20dnl This macro figures out how to build C programs using POSIX
21dnl threads. It sets the PTHREAD_LIBS output variable to the threads
22dnl library and linker flags, and the PTHREAD_CFLAGS output variable
23dnl to any special C compiler flags that are needed. (The user can
24dnl also force certain compiler flags/libs to be tested by setting
25dnl these environment variables.)
26dnl
27dnl Also sets PTHREAD_CC to any special C compiler that is needed
28dnl for multi-threaded programs (defaults to the value of CC
29dnl otherwise). (This is necessary on AIX to use the special
30dnl cc_r compiler alias.)
31dnl
32dnl NOTE: You are assumed to not only compile your program with
33dnl these flags, but also link it with them as well. e.g. you
34dnl should link with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS
35dnl ... $PTHREAD_LIBS $LIBS
36dnl
37dnl If you are only building threads programs, you may wish to use
38dnl these variables in your default LIBS, CFLAGS, and CC:
39dnl
40dnl       LIBS="$PTHREAD_LIBS $LIBS"
41dnl       CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
42dnl       CC="$PTHREAD_CC"
43dnl
44dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
45dnl constant has a nonstandard name, defines
46dnl PTHREAD_CREATE_JOINABLE to that name
47dnl (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
48dnl
49dnl ACTION-IF-FOUND is a list of shell commands to run if a
50dnl threads library is found, and ACTION-IF-NOT-FOUND is a list of
51dnl commands to run it if it is not found. If ACTION-IF-FOUND is
52dnl not specified, the default action will define HAVE_PTHREAD.
53dnl
54dnl Please let the authors know if this macro fails on any platform,
55dnl or if you have any other suggestions or comments. This macro was
56dnl based on work by SGJ on autoconf scripts for FFTW (www.fftw.org)
57dnl (with help from M. Frigo), as well as ac_pthread and
58dnl hb_pthread macros posted by AFC to the autoconf macro repository.
59dnl We are also grateful for the helpful feedback of numerous users.
60dnl
61dnl Version
62dnl
63dnl 1.8 (last modified: 2003-05-21)
64dnl Author
65dnl
66dnl Steven G. Johnson <stevenj@alum.mit.edu> and
67dnl Alejandro Forero Cuervo <bachue@bachue.com>
68dnl
69AC_DEFUN([ACX_PTHREAD], [
70AC_REQUIRE([AC_CANONICAL_HOST])
71AC_LANG_SAVE
72AC_LANG_C
73acx_pthread_ok=no
74
75# We used to check for pthread.h first, but this fails if pthread.h
76# requires special compiler flags (e.g. on True64 or Sequent).
77# It gets checked for in the link test anyway.
78
79# First of all, check if the user has set any of the PTHREAD_LIBS,
80# etcetera environment variables, and if threads linking works using
81# them:
82if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
83        save_CFLAGS="$CFLAGS"
84        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
85        save_LIBS="$LIBS"
86        LIBS="$PTHREAD_LIBS $LIBS"
87        AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
88        AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
89        AC_MSG_RESULT($acx_pthread_ok)
90        if test x"$acx_pthread_ok" = xno; then
91                PTHREAD_LIBS=""
92                PTHREAD_CFLAGS=""
93        fi
94        LIBS="$save_LIBS"
95        CFLAGS="$save_CFLAGS"
96fi
97
98# We must check for the threads library under a number of different
99# names; the ordering is very important because some systems
100# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
101# libraries is broken (non-POSIX).
102
103# Create a list of thread flags to try.  Items starting with a "-" are
104# C compiler flags, and other items are library names, except for "none"
105# which indicates that we try without any flags at all.
106
107acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt"
108
109# The ordering *is* (sometimes) important.  Some notes on the
110# individual items follow:
111
112# pthreads: AIX (must check this before -lpthread)
113# none: in case threads are in libc; should be tried before -Kthread and
114#       other compiler flags to prevent continual compiler warnings
115# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
116# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
117# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
118# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
119# -pthreads: Solaris/gcc
120# -mthreads: Mingw32/gcc, Lynx/gcc
121# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
122#      doesn't hurt to check since this sometimes defines pthreads too;
123#      also defines -D_REENTRANT)
124# pthread: Linux, etcetera
125# --thread-safe: KAI C++
126
127case "${host_cpu}-${host_os}" in
128        *solaris*)
129
130        # On Solaris (at least, for some versions), libc contains stubbed
131        # (non-functional) versions of the pthreads routines, so link-based
132        # tests will erroneously succeed.  (We need to link with -pthread or
133        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
134        # a function called by this macro, so we could check for that, but
135        # who knows whether they'll stub that too in a future libc.)  So,
136        # we'll just look for -pthreads and -lpthread first:
137
138        acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
139        ;;
140esac
141
142if test x"$acx_pthread_ok" = xno; then
143for flag in $acx_pthread_flags; do
144
145        case $flag in
146                none)
147                AC_MSG_CHECKING([whether pthreads work without any flags])
148                ;;
149
150                -*)
151                AC_MSG_CHECKING([whether pthreads work with $flag])
152                PTHREAD_CFLAGS="$flag"
153                ;;
154
155                *)
156                AC_MSG_CHECKING([for the pthreads library -l$flag])
157                PTHREAD_LIBS="-l$flag"
158                ;;
159        esac
160
161        save_LIBS="$LIBS"
162        save_CFLAGS="$CFLAGS"
163        LIBS="$PTHREAD_LIBS $LIBS"
164        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
165
166        # Check for various functions.  We must include pthread.h,
167        # since some functions may be macros.  (On the Sequent, we
168        # need a special flag -Kthread to make this header compile.)
169        # We check for pthread_join because it is in -lpthread on IRIX
170        # while pthread_create is in libc.  We check for pthread_attr_init
171        # due to DEC craziness with -lpthreads.  We check for
172        # pthread_cleanup_push because it is one of the few pthread
173        # functions on Solaris that doesn't have a non-functional libc stub.
174        # We try pthread_create on general principles.
175        AC_TRY_LINK([#include <pthread.h>],
176                    [pthread_t th; pthread_join(th, 0);
177                     pthread_attr_init(0); pthread_cleanup_push(0, 0);
178                     pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
179                    [acx_pthread_ok=yes])
180
181        LIBS="$save_LIBS"
182        CFLAGS="$save_CFLAGS"
183
184        AC_MSG_RESULT($acx_pthread_ok)
185        if test "x$acx_pthread_ok" = xyes; then
186                break;
187        fi
188
189        PTHREAD_LIBS=""
190        PTHREAD_CFLAGS=""
191done
192fi
193
194# Various other checks:
195if test "x$acx_pthread_ok" = xyes; then
196        save_LIBS="$LIBS"
197        LIBS="$PTHREAD_LIBS $LIBS"
198        save_CFLAGS="$CFLAGS"
199        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
200
201        # Detect AIX lossage: threads are created detached by default
202        # and the JOINABLE attribute has a nonstandard name (UNDETACHED).
203        AC_MSG_CHECKING([for joinable pthread attribute])
204        AC_TRY_LINK([#include <pthread.h>],
205                    [int attr=PTHREAD_CREATE_JOINABLE;],
206                    ok=PTHREAD_CREATE_JOINABLE, ok=unknown)
207        if test x"$ok" = xunknown; then
208                AC_TRY_LINK([#include <pthread.h>],
209                            [int attr=PTHREAD_CREATE_UNDETACHED;],
210                            ok=PTHREAD_CREATE_UNDETACHED, ok=unknown)
211        fi
212        if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then
213                AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok,
214                          [Define to the necessary symbol if this constant
215                           uses a non-standard name on your system.])
216        fi
217        AC_MSG_RESULT(${ok})
218        if test x"$ok" = xunknown; then
219                AC_MSG_WARN([we do not know how to create joinable pthreads])
220        fi
221
222        AC_MSG_CHECKING([if more special flags are required for pthreads])
223        flag=no
224        case "${host_cpu}-${host_os}" in
225                *-aix* | *-freebsd*)     flag="-D_THREAD_SAFE";;
226                *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
227        esac
228        AC_MSG_RESULT(${flag})
229        if test "x$flag" != xno; then
230                PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
231        fi
232
233        LIBS="$save_LIBS"
234        CFLAGS="$save_CFLAGS"
235
236        # More AIX lossage: must compile with cc_r
237        AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
238else
239        PTHREAD_CC="$CC"
240fi
241
242AC_SUBST(PTHREAD_LIBS)
243AC_SUBST(PTHREAD_CFLAGS)
244AC_SUBST(PTHREAD_CC)
245
246# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
247if test x"$acx_pthread_ok" = xyes; then
248        ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
249        :
250else
251        acx_pthread_ok=no
252        $2
253fi
254AC_LANG_RESTORE
255])dnl ACX_PTHREAD
256
257# Do all the work for Automake.  This macro actually does too much --
258# some checks are only needed if your package does certain things.
259# But this isn't really a big deal.
260
261# serial 5
262
263# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
264# written in clear, in which case automake, when reading aclocal.m4,
265# will think it sees a *use*, and therefore will trigger all it's
266# C support machinery.  Also note that it means that autoscan, seeing
267# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
268
269
270# We require 2.13 because we rely on SHELL being computed by configure.
271AC_PREREQ([2.13])
272
273# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
274# -----------------------------------------------------------
275# If MACRO-NAME is provided do IF-PROVIDED, else IF-NOT-PROVIDED.
276# The purpose of this macro is to provide the user with a means to
277# check macros which are provided without letting her know how the
278# information is coded.
279# If this macro is not defined by Autoconf, define it here.
280ifdef([AC_PROVIDE_IFELSE],
281      [],
282      [define([AC_PROVIDE_IFELSE],
283              [ifdef([AC_PROVIDE_$1],
284                     [$2], [$3])])])
285
286
287# AM_INIT_AUTOMAKE(PACKAGE,VERSION, [NO-DEFINE])
288# ----------------------------------------------
289AC_DEFUN([AM_INIT_AUTOMAKE],
290[AC_REQUIRE([AC_PROG_INSTALL])dnl
291# test to see if srcdir already configured
292if test "`CDPATH=:; cd $srcdir && pwd`" != "`pwd`" &&
293   test -f $srcdir/config.status; then
294  AC_MSG_ERROR([source directory already configured; run \"make distclean\" there first])
295fi
296
297# Define the identity of the package.
298PACKAGE=$1
299AC_SUBST(PACKAGE)dnl
300VERSION=$2
301AC_SUBST(VERSION)dnl
302ifelse([$3],,
303[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
304AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])
305
306# Autoconf 2.50 wants to disallow AM_ names.  We explicitly allow
307# the ones we care about.
308ifdef([m4_pattern_allow],
309      [m4_pattern_allow([^AM_[A-Z]+FLAGS])])dnl
310
311# Autoconf 2.50 always computes EXEEXT.  However we need to be
312# compatible with 2.13, for now.  So we always define EXEEXT, but we
313# don't compute it.
314AC_SUBST(EXEEXT)
315# Similar for OBJEXT -- only we only use OBJEXT if the user actually
316# requests that it be used.  This is a bit dumb.
317: ${OBJEXT=o}
318AC_SUBST(OBJEXT)
319
320# Some tools Automake needs.
321AC_REQUIRE([AM_SANITY_CHECK])dnl
322AC_REQUIRE([AC_ARG_PROGRAM])dnl
323AM_MISSING_PROG(ACLOCAL, aclocal)
324AM_MISSING_PROG(AUTOCONF, autoconf)
325AM_MISSING_PROG(AUTOMAKE, automake)
326AM_MISSING_PROG(AUTOHEADER, autoheader)
327AM_MISSING_PROG(MAKEINFO, makeinfo)
328AM_MISSING_PROG(AMTAR, tar)
329AM_PROG_INSTALL_SH
330AM_PROG_INSTALL_STRIP
331# We need awk for the "check" target.  The system "awk" is bad on
332# some platforms.
333AC_REQUIRE([AC_PROG_AWK])dnl
334AC_REQUIRE([AC_PROG_MAKE_SET])dnl
335AC_REQUIRE([AM_DEP_TRACK])dnl
336AC_REQUIRE([AM_SET_DEPDIR])dnl
337AC_PROVIDE_IFELSE([AC_PROG_][CC],
338                  [_AM_DEPENDENCIES(CC)],
339                  [define([AC_PROG_][CC],
340                          defn([AC_PROG_][CC])[_AM_DEPENDENCIES(CC)])])dnl
341AC_PROVIDE_IFELSE([AC_PROG_][CXX],
342                  [_AM_DEPENDENCIES(CXX)],
343                  [define([AC_PROG_][CXX],
344                          defn([AC_PROG_][CXX])[_AM_DEPENDENCIES(CXX)])])dnl
345])
346
347#
348# Check to make sure that the build environment is sane.
349#
350
351# serial 3
352
353# AM_SANITY_CHECK
354# ---------------
355AC_DEFUN([AM_SANITY_CHECK],
356[AC_MSG_CHECKING([whether build environment is sane])
357# Just in case
358sleep 1
359echo timestamp > conftest.file
360# Do `set' in a subshell so we don't clobber the current shell's
361# arguments.  Must try -L first in case configure is actually a
362# symlink; some systems play weird games with the mod time of symlinks
363# (eg FreeBSD returns the mod time of the symlink's containing
364# directory).
365if (
366   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
367   if test "$[*]" = "X"; then
368      # -L didn't work.
369      set X `ls -t $srcdir/configure conftest.file`
370   fi
371   rm -f conftest.file
372   if test "$[*]" != "X $srcdir/configure conftest.file" \
373      && test "$[*]" != "X conftest.file $srcdir/configure"; then
374
375      # If neither matched, then we have a broken ls.  This can happen
376      # if, for instance, CONFIG_SHELL is bash and it inherits a
377      # broken ls alias from the environment.  This has actually
378      # happened.  Such a system could not be considered "sane".
379      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
380alias in your environment])
381   fi
382
383   test "$[2]" = conftest.file
384   )
385then
386   # Ok.
387   :
388else
389   AC_MSG_ERROR([newly created file is older than distributed files!
390Check your system clock])
391fi
392AC_MSG_RESULT(yes)])
393
394
395# serial 2
396
397# AM_MISSING_PROG(NAME, PROGRAM)
398# ------------------------------
399AC_DEFUN([AM_MISSING_PROG],
400[AC_REQUIRE([AM_MISSING_HAS_RUN])
401$1=${$1-"${am_missing_run}$2"}
402AC_SUBST($1)])
403
404
405# AM_MISSING_HAS_RUN
406# ------------------
407# Define MISSING if not defined so far and test if it supports --run.
408# If it does, set am_missing_run to use it, otherwise, to nothing.
409AC_DEFUN([AM_MISSING_HAS_RUN],
410[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
411test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
412# Use eval to expand $SHELL
413if eval "$MISSING --run true"; then
414  am_missing_run="$MISSING --run "
415else
416  am_missing_run=
417  am_backtick='`'
418  AC_MSG_WARN([${am_backtick}missing' script is too old or missing])
419fi
420])
421
422# AM_AUX_DIR_EXPAND
423
424# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
425# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
426# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
427#
428# Of course, Automake must honor this variable whenever it calls a
429# tool from the auxiliary directory.  The problem is that $srcdir (and
430# therefore $ac_aux_dir as well) can be either absolute or relative,
431# depending on how configure is run.  This is pretty annoying, since
432# it makes $ac_aux_dir quite unusable in subdirectories: in the top
433# source directory, any form will work fine, but in subdirectories a
434# relative path needs to be adjusted first.
435#
436# $ac_aux_dir/missing
437#    fails when called from a subdirectory if $ac_aux_dir is relative
438# $top_srcdir/$ac_aux_dir/missing
439#    fails if $ac_aux_dir is absolute,
440#    fails when called from a subdirectory in a VPATH build with
441#          a relative $ac_aux_dir
442#
443# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
444# are both prefixed by $srcdir.  In an in-source build this is usually
445# harmless because $srcdir is `.', but things will broke when you
446# start a VPATH build or use an absolute $srcdir.
447#
448# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
449# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
450#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
451# and then we would define $MISSING as
452#   MISSING="\${SHELL} $am_aux_dir/missing"
453# This will work as long as MISSING is not called from configure, because
454# unfortunately $(top_srcdir) has no meaning in configure.
455# However there are other variables, like CC, which are often used in
456# configure, and could therefore not use this "fixed" $ac_aux_dir.
457#
458# Another solution, used here, is to always expand $ac_aux_dir to an
459# absolute PATH.  The drawback is that using absolute paths prevent a
460# configured tree to be moved without reconfiguration.
461
462AC_DEFUN([AM_AUX_DIR_EXPAND], [
463# expand $ac_aux_dir to an absolute path
464am_aux_dir=`CDPATH=:; cd $ac_aux_dir && pwd`
465])
466
467# AM_PROG_INSTALL_SH
468# ------------------
469# Define $install_sh.
470AC_DEFUN([AM_PROG_INSTALL_SH],
471[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
472install_sh=${install_sh-"$am_aux_dir/install-sh"}
473AC_SUBST(install_sh)])
474
475# One issue with vendor `install' (even GNU) is that you can't
476# specify the program used to strip binaries.  This is especially
477# annoying in cross-compiling environments, where the build's strip
478# is unlikely to handle the host's binaries.
479# Fortunately install-sh will honor a STRIPPROG variable, so we
480# always use install-sh in `make install-strip', and initialize
481# STRIPPROG with the value of the STRIP variable (set by the user).
482AC_DEFUN([AM_PROG_INSTALL_STRIP],
483[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
484INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
485AC_SUBST([INSTALL_STRIP_PROGRAM])])
486
487# serial 4						-*- Autoconf -*-
488
489
490
491# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
492# written in clear, in which case automake, when reading aclocal.m4,
493# will think it sees a *use*, and therefore will trigger all it's
494# C support machinery.  Also note that it means that autoscan, seeing
495# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
496
497
498
499# _AM_DEPENDENCIES(NAME)
500# ---------------------
501# See how the compiler implements dependency checking.
502# NAME is "CC", "CXX" or "OBJC".
503# We try a few techniques and use that to set a single cache variable.
504#
505# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
506# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
507# dependency, and given that the user is not expected to run this macro,
508# just rely on AC_PROG_CC.
509AC_DEFUN([_AM_DEPENDENCIES],
510[AC_REQUIRE([AM_SET_DEPDIR])dnl
511AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
512AC_REQUIRE([AM_MAKE_INCLUDE])dnl
513AC_REQUIRE([AM_DEP_TRACK])dnl
514
515ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
516       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
517       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc']
518       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
519                   [depcc="$$1"   am_compiler_list=])
520
521AC_CACHE_CHECK([dependency style of $depcc],
522               [am_cv_$1_dependencies_compiler_type],
523[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
524  # We make a subdir and do the tests there.  Otherwise we can end up
525  # making bogus files that we don't know about and never remove.  For
526  # instance it was reported that on HP-UX the gcc test will end up
527  # making a dummy file named `D' -- because `-MD' means `put the output
528  # in D'.
529  mkdir conftest.dir
530  # Copy depcomp to subdir because otherwise we won't find it if we're
531  # using a relative directory.
532  cp "$am_depcomp" conftest.dir
533  cd conftest.dir
534
535  am_cv_$1_dependencies_compiler_type=none
536  if test "$am_compiler_list" = ""; then
537     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
538  fi
539  for depmode in $am_compiler_list; do
540    # We need to recreate these files for each test, as the compiler may
541    # overwrite some of them when testing with obscure command lines.
542    # This happens at least with the AIX C compiler.
543    echo '#include "conftest.h"' > conftest.c
544    echo 'int i;' > conftest.h
545    echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf
546
547    case $depmode in
548    nosideeffect)
549      # after this tag, mechanisms are not by side-effect, so they'll
550      # only be used when explicitly requested
551      if test "x$enable_dependency_tracking" = xyes; then
552	continue
553      else
554	break
555      fi
556      ;;
557    none) break ;;
558    esac
559    # We check with `-c' and `-o' for the sake of the "dashmstdout"
560    # mode.  It turns out that the SunPro C++ compiler does not properly
561    # handle `-M -o', and we need to detect this.
562    if depmode=$depmode \
563       source=conftest.c object=conftest.o \
564       depfile=conftest.Po tmpdepfile=conftest.TPo \
565       $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
566       grep conftest.h conftest.Po > /dev/null 2>&1 &&
567       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
568      am_cv_$1_dependencies_compiler_type=$depmode
569      break
570    fi
571  done
572
573  cd ..
574  rm -rf conftest.dir
575else
576  am_cv_$1_dependencies_compiler_type=none
577fi
578])
579$1DEPMODE="depmode=$am_cv_$1_dependencies_compiler_type"
580AC_SUBST([$1DEPMODE])
581])
582
583
584# AM_SET_DEPDIR
585# -------------
586# Choose a directory name for dependency files.
587# This macro is AC_REQUIREd in _AM_DEPENDENCIES
588AC_DEFUN([AM_SET_DEPDIR],
589[rm -f .deps 2>/dev/null
590mkdir .deps 2>/dev/null
591if test -d .deps; then
592  DEPDIR=.deps
593else
594  # MS-DOS does not allow filenames that begin with a dot.
595  DEPDIR=_deps
596fi
597rmdir .deps 2>/dev/null
598AC_SUBST(DEPDIR)
599])
600
601
602# AM_DEP_TRACK
603# ------------
604AC_DEFUN([AM_DEP_TRACK],
605[AC_ARG_ENABLE(dependency-tracking,
606[  --disable-dependency-tracking Speeds up one-time builds
607  --enable-dependency-tracking  Do not reject slow dependency extractors])
608if test "x$enable_dependency_tracking" != xno; then
609  am_depcomp="$ac_aux_dir/depcomp"
610  AMDEPBACKSLASH='\'
611fi
612AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
613pushdef([subst], defn([AC_SUBST]))
614subst(AMDEPBACKSLASH)
615popdef([subst])
616])
617
618# Generate code to set up dependency tracking.
619# This macro should only be invoked once -- use via AC_REQUIRE.
620# Usage:
621# AM_OUTPUT_DEPENDENCY_COMMANDS
622
623#
624# This code is only required when automatic dependency tracking
625# is enabled.  FIXME.  This creates each `.P' file that we will
626# need in order to bootstrap the dependency handling code.
627AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],[
628AC_OUTPUT_COMMANDS([
629test x"$AMDEP_TRUE" != x"" ||
630for mf in $CONFIG_FILES; do
631  case "$mf" in
632  Makefile) dirpart=.;;
633  */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;;
634  *) continue;;
635  esac
636  grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue
637  # Extract the definition of DEP_FILES from the Makefile without
638  # running `make'.
639  DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
640  test -z "$DEPDIR" && continue
641  # When using ansi2knr, U may be empty or an underscore; expand it
642  U=`sed -n -e '/^U = / s///p' < "$mf"`
643  test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
644  # We invoke sed twice because it is the simplest approach to
645  # changing $(DEPDIR) to its actual value in the expansion.
646  for file in `sed -n -e '
647    /^DEP_FILES = .*\\\\$/ {
648      s/^DEP_FILES = //
649      :loop
650	s/\\\\$//
651	p
652	n
653	/\\\\$/ b loop
654      p
655    }
656    /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
657       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
658    # Make sure the directory exists.
659    test -f "$dirpart/$file" && continue
660    fdir=`echo "$file" | sed -e 's|/[^/]*$||'`
661    $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1
662    # echo "creating $dirpart/$file"
663    echo '# dummy' > "$dirpart/$file"
664  done
665done
666], [AMDEP_TRUE="$AMDEP_TRUE"
667ac_aux_dir="$ac_aux_dir"])])
668
669# AM_MAKE_INCLUDE()
670# -----------------
671# Check to see how make treats includes.
672AC_DEFUN([AM_MAKE_INCLUDE],
673[am_make=${MAKE-make}
674cat > confinc << 'END'
675doit:
676	@echo done
677END
678# If we don't find an include directive, just comment out the code.
679AC_MSG_CHECKING([for style of include used by $am_make])
680am__include='#'
681am__quote=
682_am_result=none
683# First try GNU make style include.
684echo "include confinc" > confmf
685# We grep out `Entering directory' and `Leaving directory'
686# messages which can occur if `w' ends up in MAKEFLAGS.
687# In particular we don't look at `^make:' because GNU make might
688# be invoked under some other name (usually "gmake"), in which
689# case it prints its new name instead of `make'.
690if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then
691   am__include=include
692   am__quote=
693   _am_result=GNU
694fi
695# Now try BSD make style include.
696if test "$am__include" = "#"; then
697   echo '.include "confinc"' > confmf
698   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
699      am__include=.include
700      am__quote='"'
701      _am_result=BSD
702   fi
703fi
704AC_SUBST(am__include)
705AC_SUBST(am__quote)
706AC_MSG_RESULT($_am_result)
707rm -f confinc confmf
708])
709
710# serial 3
711
712# AM_CONDITIONAL(NAME, SHELL-CONDITION)
713# -------------------------------------
714# Define a conditional.
715#
716# FIXME: Once using 2.50, use this:
717# m4_match([$1], [^TRUE\|FALSE$], [AC_FATAL([$0: invalid condition: $1])])dnl
718AC_DEFUN([AM_CONDITIONAL],
719[ifelse([$1], [TRUE],
720        [errprint(__file__:__line__: [$0: invalid condition: $1
721])dnl
722m4exit(1)])dnl
723ifelse([$1], [FALSE],
724       [errprint(__file__:__line__: [$0: invalid condition: $1
725])dnl
726m4exit(1)])dnl
727AC_SUBST([$1_TRUE])
728AC_SUBST([$1_FALSE])
729if $2; then
730  $1_TRUE=
731  $1_FALSE='#'
732else
733  $1_TRUE='#'
734  $1_FALSE=
735fi])
736
737# Like AC_CONFIG_HEADER, but automatically create stamp file.
738
739# serial 3
740
741# When config.status generates a header, we must update the stamp-h file.
742# This file resides in the same directory as the config header
743# that is generated.  We must strip everything past the first ":",
744# and everything past the last "/".
745
746AC_PREREQ([2.12])
747
748AC_DEFUN([AM_CONFIG_HEADER],
749[ifdef([AC_FOREACH],dnl
750	 [dnl init our file count if it isn't already
751	 m4_ifndef([_AM_Config_Header_Index], m4_define([_AM_Config_Header_Index], [0]))
752	 dnl prepare to store our destination file list for use in config.status
753	 AC_FOREACH([_AM_File], [$1],
754		    [m4_pushdef([_AM_Dest], m4_patsubst(_AM_File, [:.*]))
755		    m4_define([_AM_Config_Header_Index], m4_incr(_AM_Config_Header_Index))
756		    dnl and add it to the list of files AC keeps track of, along
757		    dnl with our hook
758		    AC_CONFIG_HEADERS(_AM_File,
759dnl COMMANDS, [, INIT-CMDS]
760[# update the timestamp
761echo timestamp >"AS_ESCAPE(_AM_DIRNAME(]_AM_Dest[))/stamp-h]_AM_Config_Header_Index["
762][$2]m4_ifval([$3], [, [$3]]))dnl AC_CONFIG_HEADERS
763		    m4_popdef([_AM_Dest])])],dnl
764[AC_CONFIG_HEADER([$1])
765  AC_OUTPUT_COMMANDS(
766   ifelse(patsubst([$1], [[^ ]], []),
767	  [],
768	  [test -z "$CONFIG_HEADERS" || echo timestamp >dnl
769	   patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]),dnl
770[am_indx=1
771for am_file in $1; do
772  case " \$CONFIG_HEADERS " in
773  *" \$am_file "*)
774    am_dir=\`echo \$am_file |sed 's%:.*%%;s%[^/]*\$%%'\`
775    if test -n "\$am_dir"; then
776      am_tmpdir=\`echo \$am_dir |sed 's%^\(/*\).*\$%\1%'\`
777      for am_subdir in \`echo \$am_dir |sed 's%/% %'\`; do
778        am_tmpdir=\$am_tmpdir\$am_subdir/
779        if test ! -d \$am_tmpdir; then
780          mkdir \$am_tmpdir
781        fi
782      done
783    fi
784    echo timestamp > "\$am_dir"stamp-h\$am_indx
785    ;;
786  esac
787  am_indx=\`expr \$am_indx + 1\`
788done])
789])]) # AM_CONFIG_HEADER
790
791# _AM_DIRNAME(PATH)
792# -----------------
793# Like AS_DIRNAME, only do it during macro expansion
794AC_DEFUN([_AM_DIRNAME],
795       [m4_if(m4_regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1,
796	      m4_if(m4_regexp([$1], [^//\([^/]\|$\)]), -1,
797		    m4_if(m4_regexp([$1], [^/.*]), -1,
798			  [.],
799			  m4_patsubst([$1], [^\(/\).*], [\1])),
800		    m4_patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])),
801	      m4_patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl
802]) # _AM_DIRNAME
803
804# isc-posix.m4 serial 2 (gettext-0.11.2)
805dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
806dnl This file is free software, distributed under the terms of the GNU
807dnl General Public License.  As a special exception to the GNU General
808dnl Public License, this file may be distributed as part of a program
809dnl that contains a configuration script generated by Autoconf, under
810dnl the same distribution terms as the rest of that program.
811
812# This file is not needed with autoconf-2.53 and newer.  Remove it in 2005.
813
814# This test replaces the one in autoconf.
815# Currently this macro should have the same name as the autoconf macro
816# because gettext's gettext.m4 (distributed in the automake package)
817# still uses it.  Otherwise, the use in gettext.m4 makes autoheader
818# give these diagnostics:
819#   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
820#   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
821
822undefine([AC_ISC_POSIX])
823
824AC_DEFUN([AC_ISC_POSIX],
825  [
826    dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
827    AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
828  ]
829)
830
831
832# serial 1
833
834# @defmac AC_PROG_CC_STDC
835# @maindex PROG_CC_STDC
836# @ovindex CC
837# If the C compiler in not in ANSI C mode by default, try to add an option
838# to output variable @code{CC} to make it so.  This macro tries various
839# options that select ANSI C on some system or another.  It considers the
840# compiler to be in ANSI C mode if it handles function prototypes correctly.
841#
842# If you use this macro, you should check after calling it whether the C
843# compiler has been set to accept ANSI C; if not, the shell variable
844# @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
845# code in ANSI C, you can make an un-ANSIfied copy of it by using the
846# program @code{ansi2knr}, which comes with Ghostscript.
847# @end defmac
848
849AC_DEFUN([AM_PROG_CC_STDC],
850[AC_REQUIRE([AC_PROG_CC])
851AC_BEFORE([$0], [AC_C_INLINE])
852AC_BEFORE([$0], [AC_C_CONST])
853dnl Force this before AC_PROG_CPP.  Some cpp's, eg on HPUX, require
854dnl a magic option to avoid problems with ANSI preprocessor commands
855dnl like #elif.
856dnl FIXME: can't do this because then AC_AIX won't work due to a
857dnl circular dependency.
858dnl AC_BEFORE([$0], [AC_PROG_CPP])
859AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C])
860AC_CACHE_VAL(am_cv_prog_cc_stdc,
861[am_cv_prog_cc_stdc=no
862ac_save_CC="$CC"
863# Don't try gcc -ansi; that turns off useful extensions and
864# breaks some systems' header files.
865# AIX			-qlanglvl=ansi
866# Ultrix and OSF/1	-std1
867# HP-UX 10.20 and later	-Ae
868# HP-UX older versions	-Aa -D_HPUX_SOURCE
869# SVR4			-Xc -D__EXTENSIONS__
870for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
871do
872  CC="$ac_save_CC $ac_arg"
873  AC_TRY_COMPILE(
874[#include <stdarg.h>
875#include <stdio.h>
876#include <sys/types.h>
877#include <sys/stat.h>
878/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
879struct buf { int x; };
880FILE * (*rcsopen) (struct buf *, struct stat *, int);
881static char *e (p, i)
882     char **p;
883     int i;
884{
885  return p[i];
886}
887static char *f (char * (*g) (char **, int), char **p, ...)
888{
889  char *s;
890  va_list v;
891  va_start (v,p);
892  s = g (p, va_arg (v,int));
893  va_end (v);
894  return s;
895}
896int test (int i, double x);
897struct s1 {int (*f) (int a);};
898struct s2 {int (*f) (double a);};
899int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
900int argc;
901char **argv;
902], [
903return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
904],
905[am_cv_prog_cc_stdc="$ac_arg"; break])
906done
907CC="$ac_save_CC"
908])
909if test -z "$am_cv_prog_cc_stdc"; then
910  AC_MSG_RESULT([none needed])
911else
912  AC_MSG_RESULT([$am_cv_prog_cc_stdc])
913fi
914case "x$am_cv_prog_cc_stdc" in
915  x|xno) ;;
916  *) CC="$CC $am_cv_prog_cc_stdc" ;;
917esac
918])
919
920
921# serial 40 AC_PROG_LIBTOOL
922AC_DEFUN(AC_PROG_LIBTOOL,
923[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
924
925# Save cache, so that ltconfig can load it
926AC_CACHE_SAVE
927
928# Actually configure libtool.  ac_aux_dir is where install-sh is found.
929CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
930LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
931LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
932DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
933${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
934$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
935|| AC_MSG_ERROR([libtool configure failed])
936
937# Reload cache, that may have been modified by ltconfig
938AC_CACHE_LOAD
939
940# This can be used to rebuild libtool when needed
941LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
942
943# Always use our own libtool.
944LIBTOOL='$(SHELL) $(top_builddir)/libtool'
945AC_SUBST(LIBTOOL)dnl
946
947# Redirect the config.log output again, so that the ltconfig log is not
948# clobbered by the next message.
949exec 5>>./config.log
950])
951
952AC_DEFUN(AC_LIBTOOL_SETUP,
953[AC_PREREQ(2.13)dnl
954AC_REQUIRE([AC_ENABLE_SHARED])dnl
955AC_REQUIRE([AC_ENABLE_STATIC])dnl
956AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
957AC_REQUIRE([AC_CANONICAL_HOST])dnl
958AC_REQUIRE([AC_CANONICAL_BUILD])dnl
959AC_REQUIRE([AC_PROG_RANLIB])dnl
960AC_REQUIRE([AC_PROG_CC])dnl
961AC_REQUIRE([AC_PROG_LD])dnl
962AC_REQUIRE([AC_PROG_NM])dnl
963AC_REQUIRE([AC_PROG_LN_S])dnl
964dnl
965
966case "$target" in
967NONE) lt_target="$host" ;;
968*) lt_target="$target" ;;
969esac
970
971# Check for any special flags to pass to ltconfig.
972libtool_flags="--cache-file=$cache_file"
973test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
974test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
975test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
976test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
977test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
978ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
979[libtool_flags="$libtool_flags --enable-dlopen"])
980ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
981[libtool_flags="$libtool_flags --enable-win32-dll"])
982AC_ARG_ENABLE(libtool-lock,
983  [  --disable-libtool-lock  avoid locking (might break parallel builds)])
984test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
985test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
986
987# Some flags need to be propagated to the compiler or linker for good
988# libtool support.
989case "$lt_target" in
990*-*-irix6*)
991  # Find out which ABI we are using.
992  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
993  if AC_TRY_EVAL(ac_compile); then
994    case "`/usr/bin/file conftest.o`" in
995    *32-bit*)
996      LD="${LD-ld} -32"
997      ;;
998    *N32*)
999      LD="${LD-ld} -n32"
1000      ;;
1001    *64-bit*)
1002      LD="${LD-ld} -64"
1003      ;;
1004    esac
1005  fi
1006  rm -rf conftest*
1007  ;;
1008
1009*-*-sco3.2v5*)
1010  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
1011  SAVE_CFLAGS="$CFLAGS"
1012  CFLAGS="$CFLAGS -belf"
1013  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
1014    [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
1015  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
1016    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
1017    CFLAGS="$SAVE_CFLAGS"
1018  fi
1019  ;;
1020
1021ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
1022[*-*-cygwin* | *-*-mingw*)
1023  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
1024  AC_CHECK_TOOL(AS, as, false)
1025  AC_CHECK_TOOL(OBJDUMP, objdump, false)
1026  ;;
1027])
1028esac
1029])
1030
1031# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
1032AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
1033
1034# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
1035AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
1036
1037# AC_ENABLE_SHARED - implement the --enable-shared flag
1038# Usage: AC_ENABLE_SHARED[(DEFAULT)]
1039#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
1040#   `yes'.
1041AC_DEFUN(AC_ENABLE_SHARED, [dnl
1042define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
1043AC_ARG_ENABLE(shared,
1044changequote(<<, >>)dnl
1045<<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
1046changequote([, ])dnl
1047[p=${PACKAGE-default}
1048case "$enableval" in
1049yes) enable_shared=yes ;;
1050no) enable_shared=no ;;
1051*)
1052  enable_shared=no
1053  # Look at the argument we got.  We use all the common list separators.
1054  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
1055  for pkg in $enableval; do
1056    if test "X$pkg" = "X$p"; then
1057      enable_shared=yes
1058    fi
1059  done
1060  IFS="$ac_save_ifs"
1061  ;;
1062esac],
1063enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
1064])
1065
1066# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
1067AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1068AC_ENABLE_SHARED(no)])
1069
1070# AC_ENABLE_STATIC - implement the --enable-static flag
1071# Usage: AC_ENABLE_STATIC[(DEFAULT)]
1072#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
1073#   `yes'.
1074AC_DEFUN(AC_ENABLE_STATIC, [dnl
1075define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
1076AC_ARG_ENABLE(static,
1077changequote(<<, >>)dnl
1078<<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
1079changequote([, ])dnl
1080[p=${PACKAGE-default}
1081case "$enableval" in
1082yes) enable_static=yes ;;
1083no) enable_static=no ;;
1084*)
1085  enable_static=no
1086  # Look at the argument we got.  We use all the common list separators.
1087  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
1088  for pkg in $enableval; do
1089    if test "X$pkg" = "X$p"; then
1090      enable_static=yes
1091    fi
1092  done
1093  IFS="$ac_save_ifs"
1094  ;;
1095esac],
1096enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
1097])
1098
1099# AC_DISABLE_STATIC - set the default static flag to --disable-static
1100AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1101AC_ENABLE_STATIC(no)])
1102
1103
1104# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
1105# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
1106#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
1107#   `yes'.
1108AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
1109define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
1110AC_ARG_ENABLE(fast-install,
1111changequote(<<, >>)dnl
1112<<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
1113changequote([, ])dnl
1114[p=${PACKAGE-default}
1115case "$enableval" in
1116yes) enable_fast_install=yes ;;
1117no) enable_fast_install=no ;;
1118*)
1119  enable_fast_install=no
1120  # Look at the argument we got.  We use all the common list separators.
1121  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
1122  for pkg in $enableval; do
1123    if test "X$pkg" = "X$p"; then
1124      enable_fast_install=yes
1125    fi
1126  done
1127  IFS="$ac_save_ifs"
1128  ;;
1129esac],
1130enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
1131])
1132
1133# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
1134AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1135AC_ENABLE_FAST_INSTALL(no)])
1136
1137# AC_PROG_LD - find the path to the GNU or non-GNU linker
1138AC_DEFUN(AC_PROG_LD,
1139[AC_ARG_WITH(gnu-ld,
1140[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
1141test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
1142AC_REQUIRE([AC_PROG_CC])dnl
1143AC_REQUIRE([AC_CANONICAL_HOST])dnl
1144AC_REQUIRE([AC_CANONICAL_BUILD])dnl
1145ac_prog=ld
1146if test "$ac_cv_prog_gcc" = yes; then
1147  # Check if gcc -print-prog-name=ld gives a path.
1148  AC_MSG_CHECKING([for ld used by GCC])
1149  ac_prog=`($CC -print-prog-name=ld) 2>&5`
1150  case "$ac_prog" in
1151    # Accept absolute paths.
1152changequote(,)dnl
1153    [\\/]* | [A-Za-z]:[\\/]*)
1154      re_direlt='/[^/][^/]*/\.\./'
1155changequote([,])dnl
1156      # Canonicalize the path of ld
1157      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
1158      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
1159	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
1160      done
1161      test -z "$LD" && LD="$ac_prog"
1162      ;;
1163  "")
1164    # If it fails, then pretend we aren't using GCC.
1165    ac_prog=ld
1166    ;;
1167  *)
1168    # If it is relative, then search for the first ld in PATH.
1169    with_gnu_ld=unknown
1170    ;;
1171  esac
1172elif test "$with_gnu_ld" = yes; then
1173  AC_MSG_CHECKING([for GNU ld])
1174else
1175  AC_MSG_CHECKING([for non-GNU ld])
1176fi
1177AC_CACHE_VAL(ac_cv_path_LD,
1178[if test -z "$LD"; then
1179  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
1180  for ac_dir in $PATH; do
1181    test -z "$ac_dir" && ac_dir=.
1182    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
1183      ac_cv_path_LD="$ac_dir/$ac_prog"
1184      # Check to see if the program is GNU ld.  I'd rather use --version,
1185      # but apparently some GNU ld's only accept -v.
1186      # Break only if it was the GNU/non-GNU ld that we prefer.
1187      if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
1188	test "$with_gnu_ld" != no && break
1189      else
1190	test "$with_gnu_ld" != yes && break
1191      fi
1192    fi
1193  done
1194  IFS="$ac_save_ifs"
1195else
1196  ac_cv_path_LD="$LD" # Let the user override the test with a path.
1197fi])
1198LD="$ac_cv_path_LD"
1199if test -n "$LD"; then
1200  AC_MSG_RESULT($LD)
1201else
1202  AC_MSG_RESULT(no)
1203fi
1204test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
1205AC_PROG_LD_GNU
1206])
1207
1208AC_DEFUN(AC_PROG_LD_GNU,
1209[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
1210[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
1211if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
1212  ac_cv_prog_gnu_ld=yes
1213else
1214  ac_cv_prog_gnu_ld=no
1215fi])
1216])
1217
1218# AC_PROG_NM - find the path to a BSD-compatible name lister
1219AC_DEFUN(AC_PROG_NM,
1220[AC_MSG_CHECKING([for BSD-compatible nm])
1221AC_CACHE_VAL(ac_cv_path_NM,
1222[if test -n "$NM"; then
1223  # Let the user override the test.
1224  ac_cv_path_NM="$NM"
1225else
1226  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
1227  for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
1228    test -z "$ac_dir" && ac_dir=.
1229    if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
1230      # Check to see if the nm accepts a BSD-compat flag.
1231      # Adding the `sed 1q' prevents false positives on HP-UX, which says:
1232      #   nm: unknown option "B" ignored
1233      if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
1234	ac_cv_path_NM="$ac_dir/nm -B"
1235	break
1236      elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
1237	ac_cv_path_NM="$ac_dir/nm -p"
1238	break
1239      else
1240	ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
1241	continue # so that we can try to find one that supports BSD flags
1242      fi
1243    fi
1244  done
1245  IFS="$ac_save_ifs"
1246  test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
1247fi])
1248NM="$ac_cv_path_NM"
1249AC_MSG_RESULT([$NM])
1250])
1251
1252# AC_CHECK_LIBM - check for math library
1253AC_DEFUN(AC_CHECK_LIBM,
1254[AC_REQUIRE([AC_CANONICAL_HOST])dnl
1255LIBM=
1256case "$lt_target" in
1257*-*-beos* | *-*-cygwin*)
1258  # These system don't have libm
1259  ;;
1260*-ncr-sysv4.3*)
1261  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
1262  AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
1263  ;;
1264*)
1265  AC_CHECK_LIB(m, main, LIBM="-lm")
1266  ;;
1267esac
1268])
1269
1270# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
1271# the libltdl convenience library and INCLTDL to the include flags for
1272# the libltdl header and adds --enable-ltdl-convenience to the
1273# configure arguments.  Note that LIBLTDL and INCLTDL are not
1274# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called.  If DIR is not
1275# provided, it is assumed to be `libltdl'.  LIBLTDL will be prefixed
1276# with '${top_builddir}/' and INCLTDL will be prefixed with
1277# '${top_srcdir}/' (note the single quotes!).  If your package is not
1278# flat and you're not using automake, define top_builddir and
1279# top_srcdir appropriately in the Makefiles.
1280AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1281  case "$enable_ltdl_convenience" in
1282  no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
1283  "") enable_ltdl_convenience=yes
1284      ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
1285  esac
1286  LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
1287  INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
1288])
1289
1290# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
1291# the libltdl installable library and INCLTDL to the include flags for
1292# the libltdl header and adds --enable-ltdl-install to the configure
1293# arguments.  Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
1294# AC_CONFIG_SUBDIRS called.  If DIR is not provided and an installed
1295# libltdl is not found, it is assumed to be `libltdl'.  LIBLTDL will
1296# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
1297# with '${top_srcdir}/' (note the single quotes!).  If your package is
1298# not flat and you're not using automake, define top_builddir and
1299# top_srcdir appropriately in the Makefiles.
1300# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
1301AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1302  AC_CHECK_LIB(ltdl, main,
1303  [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
1304  [if test x"$enable_ltdl_install" = xno; then
1305     AC_MSG_WARN([libltdl not installed, but installation disabled])
1306   else
1307     enable_ltdl_install=yes
1308   fi
1309  ])
1310  if test x"$enable_ltdl_install" = x"yes"; then
1311    ac_configure_args="$ac_configure_args --enable-ltdl-install"
1312    LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
1313    INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
1314  else
1315    ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
1316    LIBLTDL="-lltdl"
1317    INCLTDL=
1318  fi
1319])
1320
1321dnl old names
1322AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
1323AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
1324AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
1325AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
1326AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
1327AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
1328AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
1329
1330dnl This is just to silence aclocal about the macro not being used
1331ifelse([AC_DISABLE_FAST_INSTALL])dnl
1332
1333# gettext.m4 serial 28 (gettext-0.13)
1334dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
1335dnl This file is free software, distributed under the terms of the GNU
1336dnl General Public License.  As a special exception to the GNU General
1337dnl Public License, this file may be distributed as part of a program
1338dnl that contains a configuration script generated by Autoconf, under
1339dnl the same distribution terms as the rest of that program.
1340dnl
1341dnl This file can can be used in projects which are not available under
1342dnl the GNU General Public License or the GNU Library General Public
1343dnl License but which still want to provide support for the GNU gettext
1344dnl functionality.
1345dnl Please note that the actual code of the GNU gettext library is covered
1346dnl by the GNU Library General Public License, and the rest of the GNU
1347dnl gettext package package is covered by the GNU General Public License.
1348dnl They are *not* in the public domain.
1349
1350dnl Authors:
1351dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
1352dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
1353
1354dnl Macro to add for using GNU gettext.
1355
1356dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
1357dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
1358dnl    default (if it is not specified or empty) is 'no-libtool'.
1359dnl    INTLSYMBOL should be 'external' for packages with no intl directory,
1360dnl    and 'no-libtool' or 'use-libtool' for packages with an intl directory.
1361dnl    If INTLSYMBOL is 'use-libtool', then a libtool library
1362dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
1363dnl    depending on --{enable,disable}-{shared,static} and on the presence of
1364dnl    AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
1365dnl    $(top_builddir)/intl/libintl.a will be created.
1366dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
1367dnl    implementations (in libc or libintl) without the ngettext() function
1368dnl    will be ignored.  If NEEDSYMBOL is specified and is
1369dnl    'need-formatstring-macros', then GNU gettext implementations that don't
1370dnl    support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
1371dnl INTLDIR is used to find the intl libraries.  If empty,
1372dnl    the value `$(top_builddir)/intl/' is used.
1373dnl
1374dnl The result of the configuration is one of three cases:
1375dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
1376dnl    and used.
1377dnl    Catalog format: GNU --> install in $(datadir)
1378dnl    Catalog extension: .mo after installation, .gmo in source tree
1379dnl 2) GNU gettext has been found in the system's C library.
1380dnl    Catalog format: GNU --> install in $(datadir)
1381dnl    Catalog extension: .mo after installation, .gmo in source tree
1382dnl 3) No internationalization, always use English msgid.
1383dnl    Catalog format: none
1384dnl    Catalog extension: none
1385dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
1386dnl The use of .gmo is historical (it was needed to avoid overwriting the
1387dnl GNU format catalogs when building on a platform with an X/Open gettext),
1388dnl but we keep it in order not to force irrelevant filename changes on the
1389dnl maintainers.
1390dnl
1391AC_DEFUN([AM_GNU_GETTEXT],
1392[
1393  dnl Argument checking.
1394  ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
1395    [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
1396])])])])])
1397  ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
1398    [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
1399])])])])
1400  define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
1401  define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
1402
1403  AC_REQUIRE([AM_PO_SUBDIRS])dnl
1404  ifelse(gt_included_intl, yes, [
1405    AC_REQUIRE([AM_INTL_SUBDIR])dnl
1406  ])
1407
1408  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
1409  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1410  AC_REQUIRE([AC_LIB_RPATH])
1411
1412  dnl Sometimes libintl requires libiconv, so first search for libiconv.
1413  dnl Ideally we would do this search only after the
1414  dnl      if test "$USE_NLS" = "yes"; then
1415  dnl        if test "$gt_cv_func_gnugettext_libc" != "yes"; then
1416  dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
1417  dnl the configure script would need to contain the same shell code
1418  dnl again, outside any 'if'. There are two solutions:
1419  dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
1420  dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
1421  dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
1422  dnl documented, we avoid it.
1423  ifelse(gt_included_intl, yes, , [
1424    AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
1425  ])
1426
1427  dnl Set USE_NLS.
1428  AM_NLS
1429
1430  ifelse(gt_included_intl, yes, [
1431    BUILD_INCLUDED_LIBINTL=no
1432    USE_INCLUDED_LIBINTL=no
1433  ])
1434  LIBINTL=
1435  LTLIBINTL=
1436  POSUB=
1437
1438  dnl If we use NLS figure out what method
1439  if test "$USE_NLS" = "yes"; then
1440    gt_use_preinstalled_gnugettext=no
1441    ifelse(gt_included_intl, yes, [
1442      AC_MSG_CHECKING([whether included gettext is requested])
1443      AC_ARG_WITH(included-gettext,
1444        [  --with-included-gettext use the GNU gettext library included here],
1445        nls_cv_force_use_gnu_gettext=$withval,
1446        nls_cv_force_use_gnu_gettext=no)
1447      AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
1448
1449      nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
1450      if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
1451    ])
1452        dnl User does not insist on using GNU NLS library.  Figure out what
1453        dnl to use.  If GNU gettext is available we use this.  Else we have
1454        dnl to fall back to GNU NLS library.
1455
1456        dnl Add a version number to the cache macros.
1457        define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
1458        define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
1459        define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
1460
1461        AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
1462         [AC_TRY_LINK([#include <libintl.h>
1463]ifelse([$2], [need-formatstring-macros],
1464[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
1465#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
1466#endif
1467changequote(,)dnl
1468typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
1469changequote([,])dnl
1470], [])[extern int _nl_msg_cat_cntr;
1471extern int *_nl_domain_bindings;],
1472            [bindtextdomain ("", "");
1473return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
1474            gt_cv_func_gnugettext_libc=yes,
1475            gt_cv_func_gnugettext_libc=no)])
1476
1477        if test "$gt_cv_func_gnugettext_libc" != "yes"; then
1478          dnl Sometimes libintl requires libiconv, so first search for libiconv.
1479          ifelse(gt_included_intl, yes, , [
1480            AM_ICONV_LINK
1481          ])
1482          dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
1483          dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
1484          dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
1485          dnl even if libiconv doesn't exist.
1486          AC_LIB_LINKFLAGS_BODY([intl])
1487          AC_CACHE_CHECK([for GNU gettext in libintl],
1488            gt_cv_func_gnugettext_libintl,
1489           [gt_save_CPPFLAGS="$CPPFLAGS"
1490            CPPFLAGS="$CPPFLAGS $INCINTL"
1491            gt_save_LIBS="$LIBS"
1492            LIBS="$LIBS $LIBINTL"
1493            dnl Now see whether libintl exists and does not depend on libiconv.
1494            AC_TRY_LINK([#include <libintl.h>
1495]ifelse([$2], [need-formatstring-macros],
1496[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
1497#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
1498#endif
1499changequote(,)dnl
1500typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
1501changequote([,])dnl
1502], [])[extern int _nl_msg_cat_cntr;
1503extern
1504#ifdef __cplusplus
1505"C"
1506#endif
1507const char *_nl_expand_alias ();],
1508              [bindtextdomain ("", "");
1509return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
1510              gt_cv_func_gnugettext_libintl=yes,
1511              gt_cv_func_gnugettext_libintl=no)
1512            dnl Now see whether libintl exists and depends on libiconv.
1513            if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
1514              LIBS="$LIBS $LIBICONV"
1515              AC_TRY_LINK([#include <libintl.h>
1516]ifelse([$2], [need-formatstring-macros],
1517[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
1518#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
1519#endif
1520changequote(,)dnl
1521typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
1522changequote([,])dnl
1523], [])[extern int _nl_msg_cat_cntr;
1524extern
1525#ifdef __cplusplus
1526"C"
1527#endif
1528const char *_nl_expand_alias ();],
1529                [bindtextdomain ("", "");
1530return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
1531               [LIBINTL="$LIBINTL $LIBICONV"
1532                LTLIBINTL="$LTLIBINTL $LTLIBICONV"
1533                gt_cv_func_gnugettext_libintl=yes
1534               ])
1535            fi
1536            CPPFLAGS="$gt_save_CPPFLAGS"
1537            LIBS="$gt_save_LIBS"])
1538        fi
1539
1540        dnl If an already present or preinstalled GNU gettext() is found,
1541        dnl use it.  But if this macro is used in GNU gettext, and GNU
1542        dnl gettext is already preinstalled in libintl, we update this
1543        dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
1544        if test "$gt_cv_func_gnugettext_libc" = "yes" \
1545           || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
1546                && test "$PACKAGE" != gettext-runtime \
1547                && test "$PACKAGE" != gettext-tools; }; then
1548          gt_use_preinstalled_gnugettext=yes
1549        else
1550          dnl Reset the values set by searching for libintl.
1551          LIBINTL=
1552          LTLIBINTL=
1553          INCINTL=
1554        fi
1555
1556    ifelse(gt_included_intl, yes, [
1557        if test "$gt_use_preinstalled_gnugettext" != "yes"; then
1558          dnl GNU gettext is not found in the C library.
1559          dnl Fall back on included GNU gettext library.
1560          nls_cv_use_gnu_gettext=yes
1561        fi
1562      fi
1563
1564      if test "$nls_cv_use_gnu_gettext" = "yes"; then
1565        dnl Mark actions used to generate GNU NLS library.
1566        BUILD_INCLUDED_LIBINTL=yes
1567        USE_INCLUDED_LIBINTL=yes
1568        LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
1569        LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
1570        LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
1571      fi
1572
1573      if test "$gt_use_preinstalled_gnugettext" = "yes" \
1574         || test "$nls_cv_use_gnu_gettext" = "yes"; then
1575        dnl Mark actions to use GNU gettext tools.
1576        CATOBJEXT=.gmo
1577      fi
1578    ])
1579
1580    if test "$gt_use_preinstalled_gnugettext" = "yes" \
1581       || test "$nls_cv_use_gnu_gettext" = "yes"; then
1582      AC_DEFINE(ENABLE_NLS, 1,
1583        [Define to 1 if translation of program messages to the user's native language
1584   is requested.])
1585    else
1586      USE_NLS=no
1587    fi
1588  fi
1589
1590  AC_MSG_CHECKING([whether to use NLS])
1591  AC_MSG_RESULT([$USE_NLS])
1592  if test "$USE_NLS" = "yes"; then
1593    AC_MSG_CHECKING([where the gettext function comes from])
1594    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
1595      if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
1596        gt_source="external libintl"
1597      else
1598        gt_source="libc"
1599      fi
1600    else
1601      gt_source="included intl directory"
1602    fi
1603    AC_MSG_RESULT([$gt_source])
1604  fi
1605
1606  if test "$USE_NLS" = "yes"; then
1607
1608    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
1609      if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
1610        AC_MSG_CHECKING([how to link with libintl])
1611        AC_MSG_RESULT([$LIBINTL])
1612        AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
1613      fi
1614
1615      dnl For backward compatibility. Some packages may be using this.
1616      AC_DEFINE(HAVE_GETTEXT, 1,
1617       [Define if the GNU gettext() function is already present or preinstalled.])
1618      AC_DEFINE(HAVE_DCGETTEXT, 1,
1619       [Define if the GNU dcgettext() function is already present or preinstalled.])
1620    fi
1621
1622    dnl We need to process the po/ directory.
1623    POSUB=po
1624  fi
1625
1626  ifelse(gt_included_intl, yes, [
1627    dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
1628    dnl to 'yes' because some of the testsuite requires it.
1629    if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
1630      BUILD_INCLUDED_LIBINTL=yes
1631    fi
1632
1633    dnl Make all variables we use known to autoconf.
1634    AC_SUBST(BUILD_INCLUDED_LIBINTL)
1635    AC_SUBST(USE_INCLUDED_LIBINTL)
1636    AC_SUBST(CATOBJEXT)
1637
1638    dnl For backward compatibility. Some configure.ins may be using this.
1639    nls_cv_header_intl=
1640    nls_cv_header_libgt=
1641
1642    dnl For backward compatibility. Some Makefiles may be using this.
1643    DATADIRNAME=share
1644    AC_SUBST(DATADIRNAME)
1645
1646    dnl For backward compatibility. Some Makefiles may be using this.
1647    INSTOBJEXT=.mo
1648    AC_SUBST(INSTOBJEXT)
1649
1650    dnl For backward compatibility. Some Makefiles may be using this.
1651    GENCAT=gencat
1652    AC_SUBST(GENCAT)
1653
1654    dnl For backward compatibility. Some Makefiles may be using this.
1655    if test "$USE_INCLUDED_LIBINTL" = yes; then
1656      INTLOBJS="\$(GETTOBJS)"
1657    fi
1658    AC_SUBST(INTLOBJS)
1659
1660    dnl Enable libtool support if the surrounding package wishes it.
1661    INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
1662    AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
1663  ])
1664
1665  dnl For backward compatibility. Some Makefiles may be using this.
1666  INTLLIBS="$LIBINTL"
1667  AC_SUBST(INTLLIBS)
1668
1669  dnl Make all documented variables known to autoconf.
1670  AC_SUBST(LIBINTL)
1671  AC_SUBST(LTLIBINTL)
1672  AC_SUBST(POSUB)
1673])
1674
1675
1676dnl Checks for all prerequisites of the intl subdirectory,
1677dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
1678dnl            USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
1679AC_DEFUN([AM_INTL_SUBDIR],
1680[
1681  AC_REQUIRE([AC_PROG_INSTALL])dnl
1682  AC_REQUIRE([AM_MKINSTALLDIRS])dnl
1683  AC_REQUIRE([AC_PROG_CC])dnl
1684  AC_REQUIRE([AC_CANONICAL_HOST])dnl
1685  AC_REQUIRE([AC_PROG_RANLIB])dnl
1686  AC_REQUIRE([AC_ISC_POSIX])dnl
1687  AC_REQUIRE([AC_HEADER_STDC])dnl
1688  AC_REQUIRE([AC_C_CONST])dnl
1689  AC_REQUIRE([bh_C_SIGNED])dnl
1690  AC_REQUIRE([AC_C_INLINE])dnl
1691  AC_REQUIRE([AC_TYPE_OFF_T])dnl
1692  AC_REQUIRE([AC_TYPE_SIZE_T])dnl
1693  AC_REQUIRE([jm_AC_TYPE_LONG_LONG])dnl
1694  AC_REQUIRE([gt_TYPE_LONGDOUBLE])dnl
1695  AC_REQUIRE([gt_TYPE_WCHAR_T])dnl
1696  AC_REQUIRE([gt_TYPE_WINT_T])dnl
1697  AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
1698  AC_REQUIRE([jm_AC_HEADER_STDINT_H])
1699  AC_REQUIRE([gt_TYPE_INTMAX_T])
1700  AC_REQUIRE([gt_PRINTF_POSIX])
1701  AC_REQUIRE([AC_FUNC_ALLOCA])dnl
1702  AC_REQUIRE([AC_FUNC_MMAP])dnl
1703  AC_REQUIRE([jm_GLIBC21])dnl
1704  AC_REQUIRE([gt_INTDIV0])dnl
1705  AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl
1706  AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl
1707  AC_REQUIRE([gt_INTTYPES_PRI])dnl
1708  AC_REQUIRE([gl_XSIZE])dnl
1709
1710  AC_CHECK_TYPE([ptrdiff_t], ,
1711    [AC_DEFINE([ptrdiff_t], [long],
1712       [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
1713    ])
1714  AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
1715stdlib.h string.h unistd.h sys/param.h])
1716  AC_CHECK_FUNCS([asprintf fwprintf getcwd getegid geteuid getgid getuid \
1717mempcpy munmap putenv setenv setlocale snprintf stpcpy strcasecmp strdup \
1718strtoul tsearch wcslen __argz_count __argz_stringify __argz_next \
1719__fsetlocking])
1720
1721  dnl Use the _snprintf function only if it is declared (because on NetBSD it
1722  dnl is defined as a weak alias of snprintf; we prefer to use the latter).
1723  gt_CHECK_DECL(_snprintf, [#include <stdio.h>])
1724  gt_CHECK_DECL(_snwprintf, [#include <stdio.h>])
1725
1726  dnl Use the *_unlocked functions only if they are declared.
1727  dnl (because some of them were defined without being declared in Solaris
1728  dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
1729  dnl on Solaris 2.5.1 to run on Solaris 2.6).
1730  dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13.
1731  gt_CHECK_DECL(feof_unlocked, [#include <stdio.h>])
1732  gt_CHECK_DECL(fgets_unlocked, [#include <stdio.h>])
1733  gt_CHECK_DECL(getc_unlocked, [#include <stdio.h>])
1734
1735  case $gt_cv_func_printf_posix in
1736    *yes) HAVE_POSIX_PRINTF=1 ;;
1737    *) HAVE_POSIX_PRINTF=0 ;;
1738  esac
1739  AC_SUBST([HAVE_POSIX_PRINTF])
1740  if test "$ac_cv_func_asprintf" = yes; then
1741    HAVE_ASPRINTF=1
1742  else
1743    HAVE_ASPRINTF=0
1744  fi
1745  AC_SUBST([HAVE_ASPRINTF])
1746  if test "$ac_cv_func_snprintf" = yes; then
1747    HAVE_SNPRINTF=1
1748  else
1749    HAVE_SNPRINTF=0
1750  fi
1751  AC_SUBST([HAVE_SNPRINTF])
1752  if test "$ac_cv_func_wprintf" = yes; then
1753    HAVE_WPRINTF=1
1754  else
1755    HAVE_WPRINTF=0
1756  fi
1757  AC_SUBST([HAVE_WPRINTF])
1758
1759  AM_ICONV
1760  AM_LANGINFO_CODESET
1761  if test $ac_cv_header_locale_h = yes; then
1762    AM_LC_MESSAGES
1763  fi
1764
1765  dnl intl/plural.c is generated from intl/plural.y. It requires bison,
1766  dnl because plural.y uses bison specific features. It requires at least
1767  dnl bison-1.26 because earlier versions generate a plural.c that doesn't
1768  dnl compile.
1769  dnl bison is only needed for the maintainer (who touches plural.y). But in
1770  dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
1771  dnl the rule in general Makefile. Now, some people carelessly touch the
1772  dnl files or have a broken "make" program, hence the plural.c rule will
1773  dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
1774  dnl present or too old.
1775  AC_CHECK_PROGS([INTLBISON], [bison])
1776  if test -z "$INTLBISON"; then
1777    ac_verc_fail=yes
1778  else
1779    dnl Found it, now check the version.
1780    AC_MSG_CHECKING([version of bison])
1781changequote(<<,>>)dnl
1782    ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
1783    case $ac_prog_version in
1784      '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
1785      1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
1786changequote([,])dnl
1787         ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
1788      *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
1789    esac
1790    AC_MSG_RESULT([$ac_prog_version])
1791  fi
1792  if test $ac_verc_fail = yes; then
1793    INTLBISON=:
1794  fi
1795])
1796
1797
1798dnl gt_CHECK_DECL(FUNC, INCLUDES)
1799dnl Check whether a function is declared.
1800AC_DEFUN([gt_CHECK_DECL],
1801[
1802  AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1,
1803    [AC_TRY_COMPILE([$2], [
1804#ifndef $1
1805  char *p = (char *) $1;
1806#endif
1807], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)])
1808  if test $ac_cv_have_decl_$1 = yes; then
1809    gt_value=1
1810  else
1811    gt_value=0
1812  fi
1813  AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value],
1814    [Define to 1 if you have the declaration of `$1', and to 0 if you don't.])
1815])
1816
1817
1818dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
1819AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
1820
1821# po.m4 serial 2 (gettext-0.13)
1822dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
1823dnl This file is free software, distributed under the terms of the GNU
1824dnl General Public License.  As a special exception to the GNU General
1825dnl Public License, this file may be distributed as part of a program
1826dnl that contains a configuration script generated by Autoconf, under
1827dnl the same distribution terms as the rest of that program.
1828dnl
1829dnl This file can can be used in projects which are not available under
1830dnl the GNU General Public License or the GNU Library General Public
1831dnl License but which still want to provide support for the GNU gettext
1832dnl functionality.
1833dnl Please note that the actual code of the GNU gettext library is covered
1834dnl by the GNU Library General Public License, and the rest of the GNU
1835dnl gettext package package is covered by the GNU General Public License.
1836dnl They are *not* in the public domain.
1837
1838dnl Authors:
1839dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
1840dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
1841
1842dnl Checks for all prerequisites of the po subdirectory.
1843AC_DEFUN([AM_PO_SUBDIRS],
1844[
1845  AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1846  AC_REQUIRE([AC_PROG_INSTALL])dnl
1847  AC_REQUIRE([AM_MKINSTALLDIRS])dnl
1848  AC_REQUIRE([AM_NLS])dnl
1849
1850  dnl Perform the following tests also if --disable-nls has been given,
1851  dnl because they are needed for "make dist" to work.
1852
1853  dnl Search for GNU msgfmt in the PATH.
1854  dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
1855  dnl The second test excludes FreeBSD msgfmt.
1856  AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
1857    [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
1858     (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
1859    :)
1860  AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
1861
1862  dnl Search for GNU xgettext 0.12 or newer in the PATH.
1863  dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
1864  dnl The second test excludes FreeBSD xgettext.
1865  AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
1866    [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
1867     (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
1868    :)
1869  dnl Remove leftover from FreeBSD xgettext call.
1870  rm -f messages.po
1871
1872  dnl Search for GNU msgmerge 0.11 or newer in the PATH.
1873  AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
1874    [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :)
1875
1876  dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
1877  dnl Test whether we really found GNU msgfmt.
1878  if test "$GMSGFMT" != ":"; then
1879    dnl If it is no GNU msgfmt we define it as : so that the
1880    dnl Makefiles still can work.
1881    if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
1882       (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
1883      : ;
1884    else
1885      GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
1886      AC_MSG_RESULT(
1887        [found $GMSGFMT program is not GNU msgfmt; ignore it])
1888      GMSGFMT=":"
1889    fi
1890  fi
1891
1892  dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
1893  dnl Test whether we really found GNU xgettext.
1894  if test "$XGETTEXT" != ":"; then
1895    dnl If it is no GNU xgettext we define it as : so that the
1896    dnl Makefiles still can work.
1897    if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
1898       (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
1899      : ;
1900    else
1901      AC_MSG_RESULT(
1902        [found xgettext program is not GNU xgettext; ignore it])
1903      XGETTEXT=":"
1904    fi
1905    dnl Remove leftover from FreeBSD xgettext call.
1906    rm -f messages.po
1907  fi
1908
1909  AC_OUTPUT_COMMANDS([
1910    for ac_file in $CONFIG_FILES; do
1911      # Support "outfile[:infile[:infile...]]"
1912      case "$ac_file" in
1913        *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
1914      esac
1915      # PO directories have a Makefile.in generated from Makefile.in.in.
1916      case "$ac_file" in */Makefile.in)
1917        # Adjust a relative srcdir.
1918        ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
1919        ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
1920        ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
1921        # In autoconf-2.13 it is called $ac_given_srcdir.
1922        # In autoconf-2.50 it is called $srcdir.
1923        test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
1924        case "$ac_given_srcdir" in
1925          .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
1926          /*) top_srcdir="$ac_given_srcdir" ;;
1927          *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
1928        esac
1929        if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
1930          rm -f "$ac_dir/POTFILES"
1931          test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
1932          cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ 	]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
1933          POMAKEFILEDEPS="POTFILES.in"
1934          # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
1935          # on $ac_dir but don't depend on user-specified configuration
1936          # parameters.
1937          if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
1938            # The LINGUAS file contains the set of available languages.
1939            if test -n "$OBSOLETE_ALL_LINGUAS"; then
1940              test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
1941            fi
1942            ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
1943            # Hide the ALL_LINGUAS assigment from automake.
1944            eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
1945            POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
1946          else
1947            # The set of available languages was given in configure.in.
1948            eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
1949          fi
1950          # Compute POFILES
1951          # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
1952          # Compute UPDATEPOFILES
1953          # as      $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
1954          # Compute DUMMYPOFILES
1955          # as      $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
1956          # Compute GMOFILES
1957          # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
1958          case "$ac_given_srcdir" in
1959            .) srcdirpre= ;;
1960            *) srcdirpre='$(srcdir)/' ;;
1961          esac
1962          POFILES=
1963          UPDATEPOFILES=
1964          DUMMYPOFILES=
1965          GMOFILES=
1966          for lang in $ALL_LINGUAS; do
1967            POFILES="$POFILES $srcdirpre$lang.po"
1968            UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
1969            DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
1970            GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
1971          done
1972          # CATALOGS depends on both $ac_dir and the user's LINGUAS
1973          # environment variable.
1974          INST_LINGUAS=
1975          if test -n "$ALL_LINGUAS"; then
1976            for presentlang in $ALL_LINGUAS; do
1977              useit=no
1978              if test "%UNSET%" != "$LINGUAS"; then
1979                desiredlanguages="$LINGUAS"
1980              else
1981                desiredlanguages="$ALL_LINGUAS"
1982              fi
1983              for desiredlang in $desiredlanguages; do
1984                # Use the presentlang catalog if desiredlang is
1985                #   a. equal to presentlang, or
1986                #   b. a variant of presentlang (because in this case,
1987                #      presentlang can be used as a fallback for messages
1988                #      which are not translated in the desiredlang catalog).
1989                case "$desiredlang" in
1990                  "$presentlang"*) useit=yes;;
1991                esac
1992              done
1993              if test $useit = yes; then
1994                INST_LINGUAS="$INST_LINGUAS $presentlang"
1995              fi
1996            done
1997          fi
1998          CATALOGS=
1999          if test -n "$INST_LINGUAS"; then
2000            for lang in $INST_LINGUAS; do
2001              CATALOGS="$CATALOGS $lang.gmo"
2002            done
2003          fi
2004          test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
2005          sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
2006          for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
2007            if test -f "$f"; then
2008              case "$f" in
2009                *.orig | *.bak | *~) ;;
2010                *) cat "$f" >> "$ac_dir/Makefile" ;;
2011              esac
2012            fi
2013          done
2014        fi
2015        ;;
2016      esac
2017    done],
2018   [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
2019    # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it
2020    # from automake.
2021    eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
2022    # Capture the value of LINGUAS because we need it to compute CATALOGS.
2023    LINGUAS="${LINGUAS-%UNSET%}"
2024   ])
2025])
2026
2027dnl Postprocesses a Makefile in a directory containing PO files.
2028AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE],
2029[
2030  # When this code is run, in config.status, two variables have already been
2031  # set:
2032  # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in,
2033  # - LINGUAS is the value of the environment variable LINGUAS at configure
2034  #   time.
2035
2036changequote(,)dnl
2037  # Adjust a relative srcdir.
2038  ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
2039  ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
2040  ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
2041  # In autoconf-2.13 it is called $ac_given_srcdir.
2042  # In autoconf-2.50 it is called $srcdir.
2043  test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
2044  case "$ac_given_srcdir" in
2045    .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
2046    /*) top_srcdir="$ac_given_srcdir" ;;
2047    *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
2048  esac
2049
2050  # Find a way to echo strings without interpreting backslash.
2051  if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then
2052    gt_echo='echo'
2053  else
2054    if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then
2055      gt_echo='printf %s\n'
2056    else
2057      echo_func () {
2058        cat <<EOT
2059$*
2060EOT
2061      }
2062      gt_echo='echo_func'
2063    fi
2064  fi
2065
2066  # A sed script that extracts the value of VARIABLE from a Makefile.
2067  sed_x_variable='
2068# Test if the hold space is empty.
2069x
2070s/P/P/
2071x
2072ta
2073# Yes it was empty. Look if we have the expected variable definition.
2074/^[	 ]*VARIABLE[	 ]*=/{
2075  # Seen the first line of the variable definition.
2076  s/^[	 ]*VARIABLE[	 ]*=//
2077  ba
2078}
2079bd
2080:a
2081# Here we are processing a line from the variable definition.
2082# Remove comment, more precisely replace it with a space.
2083s/#.*$/ /
2084# See if the line ends in a backslash.
2085tb
2086:b
2087s/\\$//
2088# Print the line, without the trailing backslash.
2089p
2090tc
2091# There was no trailing backslash. The end of the variable definition is
2092# reached. Clear the hold space.
2093s/^.*$//
2094x
2095bd
2096:c
2097# A trailing backslash means that the variable definition continues in the
2098# next line. Put a nonempty string into the hold space to indicate this.
2099s/^.*$/P/
2100x
2101:d
2102'
2103changequote([,])dnl
2104
2105  # Set POTFILES to the value of the Makefile variable POTFILES.
2106  sed_x_POTFILES="`$gt_echo \"$sed_x_variable\" | sed -e '/^ *#/d' -e 's/VARIABLE/POTFILES/g'`"
2107  POTFILES=`sed -n -e "$sed_x_POTFILES" < "$ac_file"`
2108  # Compute POTFILES_DEPS as
2109  #   $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
2110  POTFILES_DEPS=
2111  for file in $POTFILES; do
2112    POTFILES_DEPS="$POTFILES_DEPS "'$(top_srcdir)/'"$file"
2113  done
2114  POMAKEFILEDEPS=""
2115
2116  if test -n "$OBSOLETE_ALL_LINGUAS"; then
2117    test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
2118  fi
2119  if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
2120    # The LINGUAS file contains the set of available languages.
2121    ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
2122    POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
2123  else
2124    # Set ALL_LINGUAS to the value of the Makefile variable LINGUAS.
2125    sed_x_LINGUAS="`$gt_echo \"$sed_x_variable\" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'`"
2126    ALL_LINGUAS_=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"`
2127  fi
2128  # Hide the ALL_LINGUAS assigment from automake.
2129  eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
2130  # Compute POFILES
2131  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
2132  # Compute UPDATEPOFILES
2133  # as      $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
2134  # Compute DUMMYPOFILES
2135  # as      $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
2136  # Compute GMOFILES
2137  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
2138  # Compute PROPERTIESFILES
2139  # as      $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).properties)
2140  # Compute CLASSFILES
2141  # as      $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).class)
2142  # Compute QMFILES
2143  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm)
2144  # Compute MSGFILES
2145  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang)).msg)
2146  case "$ac_given_srcdir" in
2147    .) srcdirpre= ;;
2148    *) srcdirpre='$(srcdir)/' ;;
2149  esac
2150  POFILES=
2151  UPDATEPOFILES=
2152  DUMMYPOFILES=
2153  GMOFILES=
2154  PROPERTIESFILES=
2155  CLASSFILES=
2156  QMFILES=
2157  MSGFILES=
2158  for lang in $ALL_LINGUAS; do
2159    POFILES="$POFILES $srcdirpre$lang.po"
2160    UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
2161    DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
2162    GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
2163    PROPERTIESFILES="$PROPERTIESFILES \$(top_srcdir)/\$(DOMAIN)_$lang.properties"
2164    CLASSFILES="$CLASSFILES \$(top_srcdir)/\$(DOMAIN)_$lang.class"
2165    QMFILES="$QMFILES $srcdirpre$lang.qm"
2166    frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
2167    MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg"
2168  done
2169  # CATALOGS depends on both $ac_dir and the user's LINGUAS
2170  # environment variable.
2171  INST_LINGUAS=
2172  if test -n "$ALL_LINGUAS"; then
2173    for presentlang in $ALL_LINGUAS; do
2174      useit=no
2175      if test "%UNSET%" != "$LINGUAS"; then
2176        desiredlanguages="$LINGUAS"
2177      else
2178        desiredlanguages="$ALL_LINGUAS"
2179      fi
2180      for desiredlang in $desiredlanguages; do
2181        # Use the presentlang catalog if desiredlang is
2182        #   a. equal to presentlang, or
2183        #   b. a variant of presentlang (because in this case,
2184        #      presentlang can be used as a fallback for messages
2185        #      which are not translated in the desiredlang catalog).
2186        case "$desiredlang" in
2187          "$presentlang"*) useit=yes;;
2188        esac
2189      done
2190      if test $useit = yes; then
2191        INST_LINGUAS="$INST_LINGUAS $presentlang"
2192      fi
2193    done
2194  fi
2195  CATALOGS=
2196  JAVACATALOGS=
2197  QTCATALOGS=
2198  TCLCATALOGS=
2199  if test -n "$INST_LINGUAS"; then
2200    for lang in $INST_LINGUAS; do
2201      CATALOGS="$CATALOGS $lang.gmo"
2202      JAVACATALOGS="$JAVACATALOGS \$(DOMAIN)_$lang.properties"
2203      QTCATALOGS="$QTCATALOGS $lang.qm"
2204      frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
2205      TCLCATALOGS="$TCLCATALOGS $frobbedlang.msg"
2206    done
2207  fi
2208
2209  sed -e "s|@POTFILES_DEPS@|$POTFILES_DEPS|g" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@PROPERTIESFILES@|$PROPERTIESFILES|g" -e "s|@CLASSFILES@|$CLASSFILES|g" -e "s|@QMFILES@|$QMFILES|g" -e "s|@MSGFILES@|$MSGFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@JAVACATALOGS@|$JAVACATALOGS|g" -e "s|@QTCATALOGS@|$QTCATALOGS|g" -e "s|@TCLCATALOGS@|$TCLCATALOGS|g" -e 's,^#distdir:,distdir:,' < "$ac_file" > "$ac_file.tmp"
2210  if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then
2211    # Add dependencies that cannot be formulated as a simple suffix rule.
2212    for lang in $ALL_LINGUAS; do
2213      frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
2214      cat >> "$ac_file.tmp" <<EOF
2215$frobbedlang.msg: $lang.po
2216	@echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \
2217	\$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
2218EOF
2219    done
2220  fi
2221  if test -n "$POMAKEFILEDEPS"; then
2222    cat >> "$ac_file.tmp" <<EOF
2223Makefile: $POMAKEFILEDEPS
2224EOF
2225  fi
2226  mv "$ac_file.tmp" "$ac_file"
2227])
2228
2229# nls.m4 serial 1 (gettext-0.12)
2230dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
2231dnl This file is free software, distributed under the terms of the GNU
2232dnl General Public License.  As a special exception to the GNU General
2233dnl Public License, this file may be distributed as part of a program
2234dnl that contains a configuration script generated by Autoconf, under
2235dnl the same distribution terms as the rest of that program.
2236dnl
2237dnl This file can can be used in projects which are not available under
2238dnl the GNU General Public License or the GNU Library General Public
2239dnl License but which still want to provide support for the GNU gettext
2240dnl functionality.
2241dnl Please note that the actual code of the GNU gettext library is covered
2242dnl by the GNU Library General Public License, and the rest of the GNU
2243dnl gettext package package is covered by the GNU General Public License.
2244dnl They are *not* in the public domain.
2245
2246dnl Authors:
2247dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
2248dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
2249
2250AC_DEFUN([AM_NLS],
2251[
2252  AC_MSG_CHECKING([whether NLS is requested])
2253  dnl Default is enabled NLS
2254  AC_ARG_ENABLE(nls,
2255    [  --disable-nls           do not use Native Language Support],
2256    USE_NLS=$enableval, USE_NLS=yes)
2257  AC_MSG_RESULT($USE_NLS)
2258  AC_SUBST(USE_NLS)
2259])
2260
2261AC_DEFUN([AM_MKINSTALLDIRS],
2262[
2263  dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
2264  dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
2265  dnl Try to locate it.
2266  MKINSTALLDIRS=
2267  if test -n "$ac_aux_dir"; then
2268    case "$ac_aux_dir" in
2269      /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;;
2270      *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;;
2271    esac
2272  fi
2273  if test -z "$MKINSTALLDIRS"; then
2274    MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
2275  fi
2276  AC_SUBST(MKINSTALLDIRS)
2277])
2278
2279# progtest.m4 serial 3 (gettext-0.12)
2280dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
2281dnl This file is free software, distributed under the terms of the GNU
2282dnl General Public License.  As a special exception to the GNU General
2283dnl Public License, this file may be distributed as part of a program
2284dnl that contains a configuration script generated by Autoconf, under
2285dnl the same distribution terms as the rest of that program.
2286dnl
2287dnl This file can can be used in projects which are not available under
2288dnl the GNU General Public License or the GNU Library General Public
2289dnl License but which still want to provide support for the GNU gettext
2290dnl functionality.
2291dnl Please note that the actual code of the GNU gettext library is covered
2292dnl by the GNU Library General Public License, and the rest of the GNU
2293dnl gettext package package is covered by the GNU General Public License.
2294dnl They are *not* in the public domain.
2295
2296dnl Authors:
2297dnl   Ulrich Drepper <drepper@cygnus.com>, 1996.
2298
2299# Search path for a program which passes the given test.
2300
2301dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
2302dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
2303AC_DEFUN([AM_PATH_PROG_WITH_TEST],
2304[
2305# Prepare PATH_SEPARATOR.
2306# The user is always right.
2307if test "${PATH_SEPARATOR+set}" != set; then
2308  echo "#! /bin/sh" >conf$$.sh
2309  echo  "exit 0"   >>conf$$.sh
2310  chmod +x conf$$.sh
2311  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
2312    PATH_SEPARATOR=';'
2313  else
2314    PATH_SEPARATOR=:
2315  fi
2316  rm -f conf$$.sh
2317fi
2318
2319# Find out how to test for executable files. Don't use a zero-byte file,
2320# as systems may use methods other than mode bits to determine executability.
2321cat >conf$$.file <<_ASEOF
2322#! /bin/sh
2323exit 0
2324_ASEOF
2325chmod +x conf$$.file
2326if test -x conf$$.file >/dev/null 2>&1; then
2327  ac_executable_p="test -x"
2328else
2329  ac_executable_p="test -f"
2330fi
2331rm -f conf$$.file
2332
2333# Extract the first word of "$2", so it can be a program name with args.
2334set dummy $2; ac_word=[$]2
2335AC_MSG_CHECKING([for $ac_word])
2336AC_CACHE_VAL(ac_cv_path_$1,
2337[case "[$]$1" in
2338  [[\\/]]* | ?:[[\\/]]*)
2339    ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
2340    ;;
2341  *)
2342    ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
2343    for ac_dir in ifelse([$5], , $PATH, [$5]); do
2344      IFS="$ac_save_IFS"
2345      test -z "$ac_dir" && ac_dir=.
2346      for ac_exec_ext in '' $ac_executable_extensions; do
2347        if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
2348          if [$3]; then
2349            ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
2350            break 2
2351          fi
2352        fi
2353      done
2354    done
2355    IFS="$ac_save_IFS"
2356dnl If no 4th arg is given, leave the cache variable unset,
2357dnl so AC_PATH_PROGS will keep looking.
2358ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
2359])dnl
2360    ;;
2361esac])dnl
2362$1="$ac_cv_path_$1"
2363if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
2364  AC_MSG_RESULT([$]$1)
2365else
2366  AC_MSG_RESULT(no)
2367fi
2368AC_SUBST($1)dnl
2369])
2370
2371# lib-prefix.m4 serial 3 (gettext-0.13)
2372dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
2373dnl This file is free software, distributed under the terms of the GNU
2374dnl General Public License.  As a special exception to the GNU General
2375dnl Public License, this file may be distributed as part of a program
2376dnl that contains a configuration script generated by Autoconf, under
2377dnl the same distribution terms as the rest of that program.
2378
2379dnl From Bruno Haible.
2380
2381dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
2382dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
2383dnl require excessive bracketing.
2384ifdef([AC_HELP_STRING],
2385[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
2386[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
2387
2388dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
2389dnl to access previously installed libraries. The basic assumption is that
2390dnl a user will want packages to use other packages he previously installed
2391dnl with the same --prefix option.
2392dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
2393dnl libraries, but is otherwise very convenient.
2394AC_DEFUN([AC_LIB_PREFIX],
2395[
2396  AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
2397  AC_REQUIRE([AC_PROG_CC])
2398  AC_REQUIRE([AC_CANONICAL_HOST])
2399  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
2400  dnl By default, look in $includedir and $libdir.
2401  use_additional=yes
2402  AC_LIB_WITH_FINAL_PREFIX([
2403    eval additional_includedir=\"$includedir\"
2404    eval additional_libdir=\"$libdir\"
2405  ])
2406  AC_LIB_ARG_WITH([lib-prefix],
2407[  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
2408  --without-lib-prefix    don't search for libraries in includedir and libdir],
2409[
2410    if test "X$withval" = "Xno"; then
2411      use_additional=no
2412    else
2413      if test "X$withval" = "X"; then
2414        AC_LIB_WITH_FINAL_PREFIX([
2415          eval additional_includedir=\"$includedir\"
2416          eval additional_libdir=\"$libdir\"
2417        ])
2418      else
2419        additional_includedir="$withval/include"
2420        additional_libdir="$withval/lib"
2421      fi
2422    fi
2423])
2424  if test $use_additional = yes; then
2425    dnl Potentially add $additional_includedir to $CPPFLAGS.
2426    dnl But don't add it
2427    dnl   1. if it's the standard /usr/include,
2428    dnl   2. if it's already present in $CPPFLAGS,
2429    dnl   3. if it's /usr/local/include and we are using GCC on Linux,
2430    dnl   4. if it doesn't exist as a directory.
2431    if test "X$additional_includedir" != "X/usr/include"; then
2432      haveit=
2433      for x in $CPPFLAGS; do
2434        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2435        if test "X$x" = "X-I$additional_includedir"; then
2436          haveit=yes
2437          break
2438        fi
2439      done
2440      if test -z "$haveit"; then
2441        if test "X$additional_includedir" = "X/usr/local/include"; then
2442          if test -n "$GCC"; then
2443            case $host_os in
2444              linux*) haveit=yes;;
2445            esac
2446          fi
2447        fi
2448        if test -z "$haveit"; then
2449          if test -d "$additional_includedir"; then
2450            dnl Really add $additional_includedir to $CPPFLAGS.
2451            CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
2452          fi
2453        fi
2454      fi
2455    fi
2456    dnl Potentially add $additional_libdir to $LDFLAGS.
2457    dnl But don't add it
2458    dnl   1. if it's the standard /usr/lib,
2459    dnl   2. if it's already present in $LDFLAGS,
2460    dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
2461    dnl   4. if it doesn't exist as a directory.
2462    if test "X$additional_libdir" != "X/usr/lib"; then
2463      haveit=
2464      for x in $LDFLAGS; do
2465        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2466        if test "X$x" = "X-L$additional_libdir"; then
2467          haveit=yes
2468          break
2469        fi
2470      done
2471      if test -z "$haveit"; then
2472        if test "X$additional_libdir" = "X/usr/local/lib"; then
2473          if test -n "$GCC"; then
2474            case $host_os in
2475              linux*) haveit=yes;;
2476            esac
2477          fi
2478        fi
2479        if test -z "$haveit"; then
2480          if test -d "$additional_libdir"; then
2481            dnl Really add $additional_libdir to $LDFLAGS.
2482            LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
2483          fi
2484        fi
2485      fi
2486    fi
2487  fi
2488])
2489
2490dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
2491dnl acl_final_exec_prefix, containing the values to which $prefix and
2492dnl $exec_prefix will expand at the end of the configure script.
2493AC_DEFUN([AC_LIB_PREPARE_PREFIX],
2494[
2495  dnl Unfortunately, prefix and exec_prefix get only finally determined
2496  dnl at the end of configure.
2497  if test "X$prefix" = "XNONE"; then
2498    acl_final_prefix="$ac_default_prefix"
2499  else
2500    acl_final_prefix="$prefix"
2501  fi
2502  if test "X$exec_prefix" = "XNONE"; then
2503    acl_final_exec_prefix='${prefix}'
2504  else
2505    acl_final_exec_prefix="$exec_prefix"
2506  fi
2507  acl_save_prefix="$prefix"
2508  prefix="$acl_final_prefix"
2509  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
2510  prefix="$acl_save_prefix"
2511])
2512
2513dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
2514dnl variables prefix and exec_prefix bound to the values they will have
2515dnl at the end of the configure script.
2516AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
2517[
2518  acl_save_prefix="$prefix"
2519  prefix="$acl_final_prefix"
2520  acl_save_exec_prefix="$exec_prefix"
2521  exec_prefix="$acl_final_exec_prefix"
2522  $1
2523  exec_prefix="$acl_save_exec_prefix"
2524  prefix="$acl_save_prefix"
2525])
2526
2527# lib-link.m4 serial 4 (gettext-0.12)
2528dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
2529dnl This file is free software, distributed under the terms of the GNU
2530dnl General Public License.  As a special exception to the GNU General
2531dnl Public License, this file may be distributed as part of a program
2532dnl that contains a configuration script generated by Autoconf, under
2533dnl the same distribution terms as the rest of that program.
2534
2535dnl From Bruno Haible.
2536
2537dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
2538dnl the libraries corresponding to explicit and implicit dependencies.
2539dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
2540dnl augments the CPPFLAGS variable.
2541AC_DEFUN([AC_LIB_LINKFLAGS],
2542[
2543  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
2544  AC_REQUIRE([AC_LIB_RPATH])
2545  define([Name],[translit([$1],[./-], [___])])
2546  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
2547                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
2548  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
2549    AC_LIB_LINKFLAGS_BODY([$1], [$2])
2550    ac_cv_lib[]Name[]_libs="$LIB[]NAME"
2551    ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
2552    ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
2553  ])
2554  LIB[]NAME="$ac_cv_lib[]Name[]_libs"
2555  LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
2556  INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
2557  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
2558  AC_SUBST([LIB]NAME)
2559  AC_SUBST([LTLIB]NAME)
2560  dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
2561  dnl results of this search when this library appears as a dependency.
2562  HAVE_LIB[]NAME=yes
2563  undefine([Name])
2564  undefine([NAME])
2565])
2566
2567dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
2568dnl searches for libname and the libraries corresponding to explicit and
2569dnl implicit dependencies, together with the specified include files and
2570dnl the ability to compile and link the specified testcode. If found, it
2571dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
2572dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
2573dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
2574dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
2575AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
2576[
2577  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
2578  AC_REQUIRE([AC_LIB_RPATH])
2579  define([Name],[translit([$1],[./-], [___])])
2580  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
2581                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
2582
2583  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
2584  dnl accordingly.
2585  AC_LIB_LINKFLAGS_BODY([$1], [$2])
2586
2587  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
2588  dnl because if the user has installed lib[]Name and not disabled its use
2589  dnl via --without-lib[]Name-prefix, he wants to use it.
2590  ac_save_CPPFLAGS="$CPPFLAGS"
2591  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
2592
2593  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
2594    ac_save_LIBS="$LIBS"
2595    LIBS="$LIBS $LIB[]NAME"
2596    AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
2597    LIBS="$ac_save_LIBS"
2598  ])
2599  if test "$ac_cv_lib[]Name" = yes; then
2600    HAVE_LIB[]NAME=yes
2601    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
2602    AC_MSG_CHECKING([how to link with lib[]$1])
2603    AC_MSG_RESULT([$LIB[]NAME])
2604  else
2605    HAVE_LIB[]NAME=no
2606    dnl If $LIB[]NAME didn't lead to a usable library, we don't need
2607    dnl $INC[]NAME either.
2608    CPPFLAGS="$ac_save_CPPFLAGS"
2609    LIB[]NAME=
2610    LTLIB[]NAME=
2611  fi
2612  AC_SUBST([HAVE_LIB]NAME)
2613  AC_SUBST([LIB]NAME)
2614  AC_SUBST([LTLIB]NAME)
2615  undefine([Name])
2616  undefine([NAME])
2617])
2618
2619dnl Determine the platform dependent parameters needed to use rpath:
2620dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
2621dnl hardcode_direct, hardcode_minus_L.
2622AC_DEFUN([AC_LIB_RPATH],
2623[
2624  AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
2625  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
2626  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
2627  AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
2628  AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
2629    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
2630    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
2631    . ./conftest.sh
2632    rm -f ./conftest.sh
2633    acl_cv_rpath=done
2634  ])
2635  wl="$acl_cv_wl"
2636  libext="$acl_cv_libext"
2637  shlibext="$acl_cv_shlibext"
2638  hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
2639  hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
2640  hardcode_direct="$acl_cv_hardcode_direct"
2641  hardcode_minus_L="$acl_cv_hardcode_minus_L"
2642  dnl Determine whether the user wants rpath handling at all.
2643  AC_ARG_ENABLE(rpath,
2644    [  --disable-rpath         do not hardcode runtime library paths],
2645    :, enable_rpath=yes)
2646])
2647
2648dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
2649dnl the libraries corresponding to explicit and implicit dependencies.
2650dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
2651AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
2652[
2653  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
2654                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
2655  dnl By default, look in $includedir and $libdir.
2656  use_additional=yes
2657  AC_LIB_WITH_FINAL_PREFIX([
2658    eval additional_includedir=\"$includedir\"
2659    eval additional_libdir=\"$libdir\"
2660  ])
2661  AC_LIB_ARG_WITH([lib$1-prefix],
2662[  --with-lib$1-prefix[=DIR]  search for lib$1 in DIR/include and DIR/lib
2663  --without-lib$1-prefix     don't search for lib$1 in includedir and libdir],
2664[
2665    if test "X$withval" = "Xno"; then
2666      use_additional=no
2667    else
2668      if test "X$withval" = "X"; then
2669        AC_LIB_WITH_FINAL_PREFIX([
2670          eval additional_includedir=\"$includedir\"
2671          eval additional_libdir=\"$libdir\"
2672        ])
2673      else
2674        additional_includedir="$withval/include"
2675        additional_libdir="$withval/lib"
2676      fi
2677    fi
2678])
2679  dnl Search the library and its dependencies in $additional_libdir and
2680  dnl $LDFLAGS. Using breadth-first-seach.
2681  LIB[]NAME=
2682  LTLIB[]NAME=
2683  INC[]NAME=
2684  rpathdirs=
2685  ltrpathdirs=
2686  names_already_handled=
2687  names_next_round='$1 $2'
2688  while test -n "$names_next_round"; do
2689    names_this_round="$names_next_round"
2690    names_next_round=
2691    for name in $names_this_round; do
2692      already_handled=
2693      for n in $names_already_handled; do
2694        if test "$n" = "$name"; then
2695          already_handled=yes
2696          break
2697        fi
2698      done
2699      if test -z "$already_handled"; then
2700        names_already_handled="$names_already_handled $name"
2701        dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
2702        dnl or AC_LIB_HAVE_LINKFLAGS call.
2703        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
2704        eval value=\"\$HAVE_LIB$uppername\"
2705        if test -n "$value"; then
2706          if test "$value" = yes; then
2707            eval value=\"\$LIB$uppername\"
2708            test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
2709            eval value=\"\$LTLIB$uppername\"
2710            test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
2711          else
2712            dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
2713            dnl that this library doesn't exist. So just drop it.
2714            :
2715          fi
2716        else
2717          dnl Search the library lib$name in $additional_libdir and $LDFLAGS
2718          dnl and the already constructed $LIBNAME/$LTLIBNAME.
2719          found_dir=
2720          found_la=
2721          found_so=
2722          found_a=
2723          if test $use_additional = yes; then
2724            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
2725              found_dir="$additional_libdir"
2726              found_so="$additional_libdir/lib$name.$shlibext"
2727              if test -f "$additional_libdir/lib$name.la"; then
2728                found_la="$additional_libdir/lib$name.la"
2729              fi
2730            else
2731              if test -f "$additional_libdir/lib$name.$libext"; then
2732                found_dir="$additional_libdir"
2733                found_a="$additional_libdir/lib$name.$libext"
2734                if test -f "$additional_libdir/lib$name.la"; then
2735                  found_la="$additional_libdir/lib$name.la"
2736                fi
2737              fi
2738            fi
2739          fi
2740          if test "X$found_dir" = "X"; then
2741            for x in $LDFLAGS $LTLIB[]NAME; do
2742              AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2743              case "$x" in
2744                -L*)
2745                  dir=`echo "X$x" | sed -e 's/^X-L//'`
2746                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
2747                    found_dir="$dir"
2748                    found_so="$dir/lib$name.$shlibext"
2749                    if test -f "$dir/lib$name.la"; then
2750                      found_la="$dir/lib$name.la"
2751                    fi
2752                  else
2753                    if test -f "$dir/lib$name.$libext"; then
2754                      found_dir="$dir"
2755                      found_a="$dir/lib$name.$libext"
2756                      if test -f "$dir/lib$name.la"; then
2757                        found_la="$dir/lib$name.la"
2758                      fi
2759                    fi
2760                  fi
2761                  ;;
2762              esac
2763              if test "X$found_dir" != "X"; then
2764                break
2765              fi
2766            done
2767          fi
2768          if test "X$found_dir" != "X"; then
2769            dnl Found the library.
2770            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
2771            if test "X$found_so" != "X"; then
2772              dnl Linking with a shared library. We attempt to hardcode its
2773              dnl directory into the executable's runpath, unless it's the
2774              dnl standard /usr/lib.
2775              if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
2776                dnl No hardcoding is needed.
2777                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
2778              else
2779                dnl Use an explicit option to hardcode DIR into the resulting
2780                dnl binary.
2781                dnl Potentially add DIR to ltrpathdirs.
2782                dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
2783                haveit=
2784                for x in $ltrpathdirs; do
2785                  if test "X$x" = "X$found_dir"; then
2786                    haveit=yes
2787                    break
2788                  fi
2789                done
2790                if test -z "$haveit"; then
2791                  ltrpathdirs="$ltrpathdirs $found_dir"
2792                fi
2793                dnl The hardcoding into $LIBNAME is system dependent.
2794                if test "$hardcode_direct" = yes; then
2795                  dnl Using DIR/libNAME.so during linking hardcodes DIR into the
2796                  dnl resulting binary.
2797                  LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
2798                else
2799                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
2800                    dnl Use an explicit option to hardcode DIR into the resulting
2801                    dnl binary.
2802                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
2803                    dnl Potentially add DIR to rpathdirs.
2804                    dnl The rpathdirs will be appended to $LIBNAME at the end.
2805                    haveit=
2806                    for x in $rpathdirs; do
2807                      if test "X$x" = "X$found_dir"; then
2808                        haveit=yes
2809                        break
2810                      fi
2811                    done
2812                    if test -z "$haveit"; then
2813                      rpathdirs="$rpathdirs $found_dir"
2814                    fi
2815                  else
2816                    dnl Rely on "-L$found_dir".
2817                    dnl But don't add it if it's already contained in the LDFLAGS
2818                    dnl or the already constructed $LIBNAME
2819                    haveit=
2820                    for x in $LDFLAGS $LIB[]NAME; do
2821                      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2822                      if test "X$x" = "X-L$found_dir"; then
2823                        haveit=yes
2824                        break
2825                      fi
2826                    done
2827                    if test -z "$haveit"; then
2828                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
2829                    fi
2830                    if test "$hardcode_minus_L" != no; then
2831                      dnl FIXME: Not sure whether we should use
2832                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
2833                      dnl here.
2834                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
2835                    else
2836                      dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
2837                      dnl here, because this doesn't fit in flags passed to the
2838                      dnl compiler. So give up. No hardcoding. This affects only
2839                      dnl very old systems.
2840                      dnl FIXME: Not sure whether we should use
2841                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
2842                      dnl here.
2843                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
2844                    fi
2845                  fi
2846                fi
2847              fi
2848            else
2849              if test "X$found_a" != "X"; then
2850                dnl Linking with a static library.
2851                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
2852              else
2853                dnl We shouldn't come here, but anyway it's good to have a
2854                dnl fallback.
2855                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
2856              fi
2857            fi
2858            dnl Assume the include files are nearby.
2859            additional_includedir=
2860            case "$found_dir" in
2861              */lib | */lib/)
2862                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
2863                additional_includedir="$basedir/include"
2864                ;;
2865            esac
2866            if test "X$additional_includedir" != "X"; then
2867              dnl Potentially add $additional_includedir to $INCNAME.
2868              dnl But don't add it
2869              dnl   1. if it's the standard /usr/include,
2870              dnl   2. if it's /usr/local/include and we are using GCC on Linux,
2871              dnl   3. if it's already present in $CPPFLAGS or the already
2872              dnl      constructed $INCNAME,
2873              dnl   4. if it doesn't exist as a directory.
2874              if test "X$additional_includedir" != "X/usr/include"; then
2875                haveit=
2876                if test "X$additional_includedir" = "X/usr/local/include"; then
2877                  if test -n "$GCC"; then
2878                    case $host_os in
2879                      linux*) haveit=yes;;
2880                    esac
2881                  fi
2882                fi
2883                if test -z "$haveit"; then
2884                  for x in $CPPFLAGS $INC[]NAME; do
2885                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2886                    if test "X$x" = "X-I$additional_includedir"; then
2887                      haveit=yes
2888                      break
2889                    fi
2890                  done
2891                  if test -z "$haveit"; then
2892                    if test -d "$additional_includedir"; then
2893                      dnl Really add $additional_includedir to $INCNAME.
2894                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
2895                    fi
2896                  fi
2897                fi
2898              fi
2899            fi
2900            dnl Look for dependencies.
2901            if test -n "$found_la"; then
2902              dnl Read the .la file. It defines the variables
2903              dnl dlname, library_names, old_library, dependency_libs, current,
2904              dnl age, revision, installed, dlopen, dlpreopen, libdir.
2905              save_libdir="$libdir"
2906              case "$found_la" in
2907                */* | *\\*) . "$found_la" ;;
2908                *) . "./$found_la" ;;
2909              esac
2910              libdir="$save_libdir"
2911              dnl We use only dependency_libs.
2912              for dep in $dependency_libs; do
2913                case "$dep" in
2914                  -L*)
2915                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
2916                    dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
2917                    dnl But don't add it
2918                    dnl   1. if it's the standard /usr/lib,
2919                    dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
2920                    dnl   3. if it's already present in $LDFLAGS or the already
2921                    dnl      constructed $LIBNAME,
2922                    dnl   4. if it doesn't exist as a directory.
2923                    if test "X$additional_libdir" != "X/usr/lib"; then
2924                      haveit=
2925                      if test "X$additional_libdir" = "X/usr/local/lib"; then
2926                        if test -n "$GCC"; then
2927                          case $host_os in
2928                            linux*) haveit=yes;;
2929                          esac
2930                        fi
2931                      fi
2932                      if test -z "$haveit"; then
2933                        haveit=
2934                        for x in $LDFLAGS $LIB[]NAME; do
2935                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2936                          if test "X$x" = "X-L$additional_libdir"; then
2937                            haveit=yes
2938                            break
2939                          fi
2940                        done
2941                        if test -z "$haveit"; then
2942                          if test -d "$additional_libdir"; then
2943                            dnl Really add $additional_libdir to $LIBNAME.
2944                            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
2945                          fi
2946                        fi
2947                        haveit=
2948                        for x in $LDFLAGS $LTLIB[]NAME; do
2949                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2950                          if test "X$x" = "X-L$additional_libdir"; then
2951                            haveit=yes
2952                            break
2953                          fi
2954                        done
2955                        if test -z "$haveit"; then
2956                          if test -d "$additional_libdir"; then
2957                            dnl Really add $additional_libdir to $LTLIBNAME.
2958                            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
2959                          fi
2960                        fi
2961                      fi
2962                    fi
2963                    ;;
2964                  -R*)
2965                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
2966                    if test "$enable_rpath" != no; then
2967                      dnl Potentially add DIR to rpathdirs.
2968                      dnl The rpathdirs will be appended to $LIBNAME at the end.
2969                      haveit=
2970                      for x in $rpathdirs; do
2971                        if test "X$x" = "X$dir"; then
2972                          haveit=yes
2973                          break
2974                        fi
2975                      done
2976                      if test -z "$haveit"; then
2977                        rpathdirs="$rpathdirs $dir"
2978                      fi
2979                      dnl Potentially add DIR to ltrpathdirs.
2980                      dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
2981                      haveit=
2982                      for x in $ltrpathdirs; do
2983                        if test "X$x" = "X$dir"; then
2984                          haveit=yes
2985                          break
2986                        fi
2987                      done
2988                      if test -z "$haveit"; then
2989                        ltrpathdirs="$ltrpathdirs $dir"
2990                      fi
2991                    fi
2992                    ;;
2993                  -l*)
2994                    dnl Handle this in the next round.
2995                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
2996                    ;;
2997                  *.la)
2998                    dnl Handle this in the next round. Throw away the .la's
2999                    dnl directory; it is already contained in a preceding -L
3000                    dnl option.
3001                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
3002                    ;;
3003                  *)
3004                    dnl Most likely an immediate library name.
3005                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
3006                    LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
3007                    ;;
3008                esac
3009              done
3010            fi
3011          else
3012            dnl Didn't find the library; assume it is in the system directories
3013            dnl known to the linker and runtime loader. (All the system
3014            dnl directories known to the linker should also be known to the
3015            dnl runtime loader, otherwise the system is severely misconfigured.)
3016            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
3017            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
3018          fi
3019        fi
3020      fi
3021    done
3022  done
3023  if test "X$rpathdirs" != "X"; then
3024    if test -n "$hardcode_libdir_separator"; then
3025      dnl Weird platform: only the last -rpath option counts, the user must
3026      dnl pass all path elements in one option. We can arrange that for a
3027      dnl single library, but not when more than one $LIBNAMEs are used.
3028      alldirs=
3029      for found_dir in $rpathdirs; do
3030        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
3031      done
3032      dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
3033      acl_save_libdir="$libdir"
3034      libdir="$alldirs"
3035      eval flag=\"$hardcode_libdir_flag_spec\"
3036      libdir="$acl_save_libdir"
3037      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
3038    else
3039      dnl The -rpath options are cumulative.
3040      for found_dir in $rpathdirs; do
3041        acl_save_libdir="$libdir"
3042        libdir="$found_dir"
3043        eval flag=\"$hardcode_libdir_flag_spec\"
3044        libdir="$acl_save_libdir"
3045        LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
3046      done
3047    fi
3048  fi
3049  if test "X$ltrpathdirs" != "X"; then
3050    dnl When using libtool, the option that works for both libraries and
3051    dnl executables is -R. The -R options are cumulative.
3052    for found_dir in $ltrpathdirs; do
3053      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
3054    done
3055  fi
3056])
3057
3058dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
3059dnl unless already present in VAR.
3060dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
3061dnl contains two or three consecutive elements that belong together.
3062AC_DEFUN([AC_LIB_APPENDTOVAR],
3063[
3064  for element in [$2]; do
3065    haveit=
3066    for x in $[$1]; do
3067      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3068      if test "X$x" = "X$element"; then
3069        haveit=yes
3070        break
3071      fi
3072    done
3073    if test -z "$haveit"; then
3074      [$1]="${[$1]}${[$1]:+ }$element"
3075    fi
3076  done
3077])
3078
3079# lib-ld.m4 serial 3 (gettext-0.13)
3080dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
3081dnl This file is free software, distributed under the terms of the GNU
3082dnl General Public License.  As a special exception to the GNU General
3083dnl Public License, this file may be distributed as part of a program
3084dnl that contains a configuration script generated by Autoconf, under
3085dnl the same distribution terms as the rest of that program.
3086
3087dnl Subroutines of libtool.m4,
3088dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
3089dnl with libtool.m4.
3090
3091dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
3092AC_DEFUN([AC_LIB_PROG_LD_GNU],
3093[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
3094[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
3095case `$LD -v 2>&1 </dev/null` in
3096*GNU* | *'with BFD'*)
3097  acl_cv_prog_gnu_ld=yes ;;
3098*)
3099  acl_cv_prog_gnu_ld=no ;;
3100esac])
3101with_gnu_ld=$acl_cv_prog_gnu_ld
3102])
3103
3104dnl From libtool-1.4. Sets the variable LD.
3105AC_DEFUN([AC_LIB_PROG_LD],
3106[AC_ARG_WITH(gnu-ld,
3107[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
3108test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
3109AC_REQUIRE([AC_PROG_CC])dnl
3110AC_REQUIRE([AC_CANONICAL_HOST])dnl
3111# Prepare PATH_SEPARATOR.
3112# The user is always right.
3113if test "${PATH_SEPARATOR+set}" != set; then
3114  echo "#! /bin/sh" >conf$$.sh
3115  echo  "exit 0"   >>conf$$.sh
3116  chmod +x conf$$.sh
3117  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
3118    PATH_SEPARATOR=';'
3119  else
3120    PATH_SEPARATOR=:
3121  fi
3122  rm -f conf$$.sh
3123fi
3124ac_prog=ld
3125if test "$GCC" = yes; then
3126  # Check if gcc -print-prog-name=ld gives a path.
3127  AC_MSG_CHECKING([for ld used by GCC])
3128  case $host in
3129  *-*-mingw*)
3130    # gcc leaves a trailing carriage return which upsets mingw
3131    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
3132  *)
3133    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
3134  esac
3135  case $ac_prog in
3136    # Accept absolute paths.
3137    [[\\/]* | [A-Za-z]:[\\/]*)]
3138      [re_direlt='/[^/][^/]*/\.\./']
3139      # Canonicalize the path of ld
3140      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
3141      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
3142	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
3143      done
3144      test -z "$LD" && LD="$ac_prog"
3145      ;;
3146  "")
3147    # If it fails, then pretend we aren't using GCC.
3148    ac_prog=ld
3149    ;;
3150  *)
3151    # If it is relative, then search for the first ld in PATH.
3152    with_gnu_ld=unknown
3153    ;;
3154  esac
3155elif test "$with_gnu_ld" = yes; then
3156  AC_MSG_CHECKING([for GNU ld])
3157else
3158  AC_MSG_CHECKING([for non-GNU ld])
3159fi
3160AC_CACHE_VAL(acl_cv_path_LD,
3161[if test -z "$LD"; then
3162  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
3163  for ac_dir in $PATH; do
3164    test -z "$ac_dir" && ac_dir=.
3165    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
3166      acl_cv_path_LD="$ac_dir/$ac_prog"
3167      # Check to see if the program is GNU ld.  I'd rather use --version,
3168      # but apparently some GNU ld's only accept -v.
3169      # Break only if it was the GNU/non-GNU ld that we prefer.
3170      case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
3171      *GNU* | *'with BFD'*)
3172	test "$with_gnu_ld" != no && break ;;
3173      *)
3174	test "$with_gnu_ld" != yes && break ;;
3175      esac
3176    fi
3177  done
3178  IFS="$ac_save_ifs"
3179else
3180  acl_cv_path_LD="$LD" # Let the user override the test with a path.
3181fi])
3182LD="$acl_cv_path_LD"
3183if test -n "$LD"; then
3184  AC_MSG_RESULT($LD)
3185else
3186  AC_MSG_RESULT(no)
3187fi
3188test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
3189AC_LIB_PROG_LD_GNU
3190])
3191
3192# iconv.m4 serial AM4 (gettext-0.11.3)
3193dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
3194dnl This file is free software, distributed under the terms of the GNU
3195dnl General Public License.  As a special exception to the GNU General
3196dnl Public License, this file may be distributed as part of a program
3197dnl that contains a configuration script generated by Autoconf, under
3198dnl the same distribution terms as the rest of that program.
3199
3200dnl From Bruno Haible.
3201
3202AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
3203[
3204  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
3205  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
3206  AC_REQUIRE([AC_LIB_RPATH])
3207
3208  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
3209  dnl accordingly.
3210  AC_LIB_LINKFLAGS_BODY([iconv])
3211])
3212
3213AC_DEFUN([AM_ICONV_LINK],
3214[
3215  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
3216  dnl those with the standalone portable GNU libiconv installed).
3217
3218  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
3219  dnl accordingly.
3220  AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
3221
3222  dnl Add $INCICONV to CPPFLAGS before performing the following checks,
3223  dnl because if the user has installed libiconv and not disabled its use
3224  dnl via --without-libiconv-prefix, he wants to use it. The first
3225  dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
3226  am_save_CPPFLAGS="$CPPFLAGS"
3227  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
3228
3229  AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
3230    am_cv_func_iconv="no, consider installing GNU libiconv"
3231    am_cv_lib_iconv=no
3232    AC_TRY_LINK([#include <stdlib.h>
3233#include <iconv.h>],
3234      [iconv_t cd = iconv_open("","");
3235       iconv(cd,NULL,NULL,NULL,NULL);
3236       iconv_close(cd);],
3237      am_cv_func_iconv=yes)
3238    if test "$am_cv_func_iconv" != yes; then
3239      am_save_LIBS="$LIBS"
3240      LIBS="$LIBS $LIBICONV"
3241      AC_TRY_LINK([#include <stdlib.h>
3242#include <iconv.h>],
3243        [iconv_t cd = iconv_open("","");
3244         iconv(cd,NULL,NULL,NULL,NULL);
3245         iconv_close(cd);],
3246        am_cv_lib_iconv=yes
3247        am_cv_func_iconv=yes)
3248      LIBS="$am_save_LIBS"
3249    fi
3250  ])
3251  if test "$am_cv_func_iconv" = yes; then
3252    AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
3253  fi
3254  if test "$am_cv_lib_iconv" = yes; then
3255    AC_MSG_CHECKING([how to link with libiconv])
3256    AC_MSG_RESULT([$LIBICONV])
3257  else
3258    dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
3259    dnl either.
3260    CPPFLAGS="$am_save_CPPFLAGS"
3261    LIBICONV=
3262    LTLIBICONV=
3263  fi
3264  AC_SUBST(LIBICONV)
3265  AC_SUBST(LTLIBICONV)
3266])
3267
3268AC_DEFUN([AM_ICONV],
3269[
3270  AM_ICONV_LINK
3271  if test "$am_cv_func_iconv" = yes; then
3272    AC_MSG_CHECKING([for iconv declaration])
3273    AC_CACHE_VAL(am_cv_proto_iconv, [
3274      AC_TRY_COMPILE([
3275#include <stdlib.h>
3276#include <iconv.h>
3277extern
3278#ifdef __cplusplus
3279"C"
3280#endif
3281#if defined(__STDC__) || defined(__cplusplus)
3282size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
3283#else
3284size_t iconv();
3285#endif
3286], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
3287      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);"])
3288    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
3289    AC_MSG_RESULT([$]{ac_t:-
3290         }[$]am_cv_proto_iconv)
3291    AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
3292      [Define as const if the declaration of iconv() needs const.])
3293  fi
3294])
3295
3296# signed.m4 serial 1 (gettext-0.10.40)
3297dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
3298dnl This file is free software, distributed under the terms of the GNU
3299dnl General Public License.  As a special exception to the GNU General
3300dnl Public License, this file may be distributed as part of a program
3301dnl that contains a configuration script generated by Autoconf, under
3302dnl the same distribution terms as the rest of that program.
3303
3304dnl From Bruno Haible.
3305
3306AC_DEFUN([bh_C_SIGNED],
3307[
3308  AC_CACHE_CHECK([for signed], bh_cv_c_signed,
3309   [AC_TRY_COMPILE(, [signed char x;], bh_cv_c_signed=yes, bh_cv_c_signed=no)])
3310  if test $bh_cv_c_signed = no; then
3311    AC_DEFINE(signed, ,
3312              [Define to empty if the C compiler doesn't support this keyword.])
3313  fi
3314])
3315
3316# longlong.m4 serial 4
3317dnl Copyright (C) 1999-2003 Free Software Foundation, Inc.
3318dnl This file is free software, distributed under the terms of the GNU
3319dnl General Public License.  As a special exception to the GNU General
3320dnl Public License, this file may be distributed as part of a program
3321dnl that contains a configuration script generated by Autoconf, under
3322dnl the same distribution terms as the rest of that program.
3323
3324dnl From Paul Eggert.
3325
3326# Define HAVE_LONG_LONG if 'long long' works.
3327
3328AC_DEFUN([jm_AC_TYPE_LONG_LONG],
3329[
3330  AC_CACHE_CHECK([for long long], ac_cv_type_long_long,
3331  [AC_TRY_LINK([long long ll = 1LL; int i = 63;],
3332    [long long llmax = (long long) -1;
3333     return ll << i | ll >> i | llmax / ll | llmax % ll;],
3334    ac_cv_type_long_long=yes,
3335    ac_cv_type_long_long=no)])
3336  if test $ac_cv_type_long_long = yes; then
3337    AC_DEFINE(HAVE_LONG_LONG, 1,
3338      [Define if you have the 'long long' type.])
3339  fi
3340])
3341
3342# longdouble.m4 serial 1 (gettext-0.12)
3343dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
3344dnl This file is free software, distributed under the terms of the GNU
3345dnl General Public License.  As a special exception to the GNU General
3346dnl Public License, this file may be distributed as part of a program
3347dnl that contains a configuration script generated by Autoconf, under
3348dnl the same distribution terms as the rest of that program.
3349
3350dnl From Bruno Haible.
3351dnl Test whether the compiler supports the 'long double' type.
3352dnl Prerequisite: AC_PROG_CC
3353
3354AC_DEFUN([gt_TYPE_LONGDOUBLE],
3355[
3356  AC_CACHE_CHECK([for long double], gt_cv_c_long_double,
3357    [if test "$GCC" = yes; then
3358       gt_cv_c_long_double=yes
3359     else
3360       AC_TRY_COMPILE([
3361         /* The Stardent Vistra knows sizeof(long double), but does not support it.  */
3362         long double foo = 0.0;
3363         /* On Ultrix 4.3 cc, long double is 4 and double is 8.  */
3364         int array [2*(sizeof(long double) >= sizeof(double)) - 1];
3365         ], ,
3366         gt_cv_c_long_double=yes, gt_cv_c_long_double=no)
3367     fi])
3368  if test $gt_cv_c_long_double = yes; then
3369    AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.])
3370  fi
3371])
3372
3373# wchar_t.m4 serial 1 (gettext-0.12)
3374dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
3375dnl This file is free software, distributed under the terms of the GNU
3376dnl General Public License.  As a special exception to the GNU General
3377dnl Public License, this file may be distributed as part of a program
3378dnl that contains a configuration script generated by Autoconf, under
3379dnl the same distribution terms as the rest of that program.
3380
3381dnl From Bruno Haible.
3382dnl Test whether <stddef.h> has the 'wchar_t' type.
3383dnl Prerequisite: AC_PROG_CC
3384
3385AC_DEFUN([gt_TYPE_WCHAR_T],
3386[
3387  AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t,
3388    [AC_TRY_COMPILE([#include <stddef.h>
3389       wchar_t foo = (wchar_t)'\0';], ,
3390       gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)])
3391  if test $gt_cv_c_wchar_t = yes; then
3392    AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.])
3393  fi
3394])
3395
3396# wint_t.m4 serial 1 (gettext-0.12)
3397dnl Copyright (C) 2003 Free Software Foundation, Inc.
3398dnl This file is free software, distributed under the terms of the GNU
3399dnl General Public License.  As a special exception to the GNU General
3400dnl Public License, this file may be distributed as part of a program
3401dnl that contains a configuration script generated by Autoconf, under
3402dnl the same distribution terms as the rest of that program.
3403
3404dnl From Bruno Haible.
3405dnl Test whether <wchar.h> has the 'wint_t' type.
3406dnl Prerequisite: AC_PROG_CC
3407
3408AC_DEFUN([gt_TYPE_WINT_T],
3409[
3410  AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t,
3411    [AC_TRY_COMPILE([#include <wchar.h>
3412       wint_t foo = (wchar_t)'\0';], ,
3413       gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)])
3414  if test $gt_cv_c_wint_t = yes; then
3415    AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.])
3416  fi
3417])
3418
3419# inttypes_h.m4 serial 5 (gettext-0.12)
3420dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
3421dnl This file is free software, distributed under the terms of the GNU
3422dnl General Public License.  As a special exception to the GNU General
3423dnl Public License, this file may be distributed as part of a program
3424dnl that contains a configuration script generated by Autoconf, under
3425dnl the same distribution terms as the rest of that program.
3426
3427dnl From Paul Eggert.
3428
3429# Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
3430# doesn't clash with <sys/types.h>, and declares uintmax_t.
3431
3432AC_DEFUN([jm_AC_HEADER_INTTYPES_H],
3433[
3434  AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
3435  [AC_TRY_COMPILE(
3436    [#include <sys/types.h>
3437#include <inttypes.h>],
3438    [uintmax_t i = (uintmax_t) -1;],
3439    jm_ac_cv_header_inttypes_h=yes,
3440    jm_ac_cv_header_inttypes_h=no)])
3441  if test $jm_ac_cv_header_inttypes_h = yes; then
3442    AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1,
3443      [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
3444       and declares uintmax_t. ])
3445  fi
3446])
3447
3448# stdint_h.m4 serial 3 (gettext-0.12)
3449dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
3450dnl This file is free software, distributed under the terms of the GNU
3451dnl General Public License.  As a special exception to the GNU General
3452dnl Public License, this file may be distributed as part of a program
3453dnl that contains a configuration script generated by Autoconf, under
3454dnl the same distribution terms as the rest of that program.
3455
3456dnl From Paul Eggert.
3457
3458# Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
3459# doesn't clash with <sys/types.h>, and declares uintmax_t.
3460
3461AC_DEFUN([jm_AC_HEADER_STDINT_H],
3462[
3463  AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h,
3464  [AC_TRY_COMPILE(
3465    [#include <sys/types.h>
3466#include <stdint.h>],
3467    [uintmax_t i = (uintmax_t) -1;],
3468    jm_ac_cv_header_stdint_h=yes,
3469    jm_ac_cv_header_stdint_h=no)])
3470  if test $jm_ac_cv_header_stdint_h = yes; then
3471    AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1,
3472      [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
3473       and declares uintmax_t. ])
3474  fi
3475])
3476
3477# intmax.m4 serial 1 (gettext-0.12)
3478dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
3479dnl This file is free software, distributed under the terms of the GNU
3480dnl General Public License.  As a special exception to the GNU General
3481dnl Public License, this file may be distributed as part of a program
3482dnl that contains a configuration script generated by Autoconf, under
3483dnl the same distribution terms as the rest of that program.
3484
3485dnl From Bruno Haible.
3486dnl Test whether the system has the 'intmax_t' type, but don't attempt to
3487dnl find a replacement if it is lacking.
3488
3489AC_DEFUN([gt_TYPE_INTMAX_T],
3490[
3491  AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
3492  AC_REQUIRE([jm_AC_HEADER_STDINT_H])
3493  AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t,
3494    [AC_TRY_COMPILE([
3495#include <stddef.h>
3496#include <stdlib.h>
3497#if HAVE_STDINT_H_WITH_UINTMAX
3498#include <stdint.h>
3499#endif
3500#if HAVE_INTTYPES_H_WITH_UINTMAX
3501#include <inttypes.h>
3502#endif
3503], [intmax_t x = -1;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)])
3504  if test $gt_cv_c_intmax_t = yes; then
3505    AC_DEFINE(HAVE_INTMAX_T, 1,
3506      [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
3507  fi
3508])
3509
3510# printf-posix.m4 serial 2 (gettext-0.13.1)
3511dnl Copyright (C) 2003 Free Software Foundation, Inc.
3512dnl This file is free software, distributed under the terms of the GNU
3513dnl General Public License.  As a special exception to the GNU General
3514dnl Public License, this file may be distributed as part of a program
3515dnl that contains a configuration script generated by Autoconf, under
3516dnl the same distribution terms as the rest of that program.
3517
3518dnl From Bruno Haible.
3519dnl Test whether the printf() function supports POSIX/XSI format strings with
3520dnl positions.
3521
3522AC_DEFUN([gt_PRINTF_POSIX],
3523[
3524  AC_REQUIRE([AC_PROG_CC])
3525  AC_CACHE_CHECK([whether printf() supports POSIX/XSI format strings],
3526    gt_cv_func_printf_posix,
3527    [
3528      AC_TRY_RUN([
3529#include <stdio.h>
3530#include <string.h>
3531/* The string "%2$d %1$d", with dollar characters protected from the shell's
3532   dollar expansion (possibly an autoconf bug).  */
3533static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' };
3534static char buf[100];
3535int main ()
3536{
3537  sprintf (buf, format, 33, 55);
3538  return (strcmp (buf, "55 33") != 0);
3539}], gt_cv_func_printf_posix=yes, gt_cv_func_printf_posix=no,
3540      [
3541        AC_EGREP_CPP(notposix, [
3542#if defined __NetBSD__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__
3543  notposix
3544#endif
3545        ], gt_cv_func_printf_posix="guessing no",
3546           gt_cv_func_printf_posix="guessing yes")
3547      ])
3548    ])
3549  case $gt_cv_func_printf_posix in
3550    *yes)
3551      AC_DEFINE(HAVE_POSIX_PRINTF, 1,
3552        [Define if your printf() function supports format strings with positions.])
3553      ;;
3554  esac
3555])
3556
3557# glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40)
3558dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
3559dnl This file is free software, distributed under the terms of the GNU
3560dnl General Public License.  As a special exception to the GNU General
3561dnl Public License, this file may be distributed as part of a program
3562dnl that contains a configuration script generated by Autoconf, under
3563dnl the same distribution terms as the rest of that program.
3564
3565# Test for the GNU C Library, version 2.1 or newer.
3566# From Bruno Haible.
3567
3568AC_DEFUN([jm_GLIBC21],
3569  [
3570    AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
3571      ac_cv_gnu_library_2_1,
3572      [AC_EGREP_CPP([Lucky GNU user],
3573	[
3574#include <features.h>
3575#ifdef __GNU_LIBRARY__
3576 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
3577  Lucky GNU user
3578 #endif
3579#endif
3580	],
3581	ac_cv_gnu_library_2_1=yes,
3582	ac_cv_gnu_library_2_1=no)
3583      ]
3584    )
3585    AC_SUBST(GLIBC21)
3586    GLIBC21="$ac_cv_gnu_library_2_1"
3587  ]
3588)
3589
3590# intdiv0.m4 serial 1 (gettext-0.11.3)
3591dnl Copyright (C) 2002 Free Software Foundation, Inc.
3592dnl This file is free software, distributed under the terms of the GNU
3593dnl General Public License.  As a special exception to the GNU General
3594dnl Public License, this file may be distributed as part of a program
3595dnl that contains a configuration script generated by Autoconf, under
3596dnl the same distribution terms as the rest of that program.
3597
3598dnl From Bruno Haible.
3599
3600AC_DEFUN([gt_INTDIV0],
3601[
3602  AC_REQUIRE([AC_PROG_CC])dnl
3603  AC_REQUIRE([AC_CANONICAL_HOST])dnl
3604
3605  AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
3606    gt_cv_int_divbyzero_sigfpe,
3607    [
3608      AC_TRY_RUN([
3609#include <stdlib.h>
3610#include <signal.h>
3611
3612static void
3613#ifdef __cplusplus
3614sigfpe_handler (int sig)
3615#else
3616sigfpe_handler (sig) int sig;
3617#endif
3618{
3619  /* Exit with code 0 if SIGFPE, with code 1 if any other signal.  */
3620  exit (sig != SIGFPE);
3621}
3622
3623int x = 1;
3624int y = 0;
3625int z;
3626int nan;
3627
3628int main ()
3629{
3630  signal (SIGFPE, sigfpe_handler);
3631/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP.  */
3632#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
3633  signal (SIGTRAP, sigfpe_handler);
3634#endif
3635/* Linux/SPARC yields signal SIGILL.  */
3636#if defined (__sparc__) && defined (__linux__)
3637  signal (SIGILL, sigfpe_handler);
3638#endif
3639
3640  z = x / y;
3641  nan = y / y;
3642  exit (1);
3643}
3644], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no,
3645        [
3646          # Guess based on the CPU.
3647          case "$host_cpu" in
3648            alpha* | i[34567]86 | m68k | s390*)
3649              gt_cv_int_divbyzero_sigfpe="guessing yes";;
3650            *)
3651              gt_cv_int_divbyzero_sigfpe="guessing no";;
3652          esac
3653        ])
3654    ])
3655  case "$gt_cv_int_divbyzero_sigfpe" in
3656    *yes) value=1;;
3657    *) value=0;;
3658  esac
3659  AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value,
3660    [Define if integer division by zero raises signal SIGFPE.])
3661])
3662
3663# uintmax_t.m4 serial 7 (gettext-0.12)
3664dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
3665dnl This file is free software, distributed under the terms of the GNU
3666dnl General Public License.  As a special exception to the GNU General
3667dnl Public License, this file may be distributed as part of a program
3668dnl that contains a configuration script generated by Autoconf, under
3669dnl the same distribution terms as the rest of that program.
3670
3671dnl From Paul Eggert.
3672
3673AC_PREREQ(2.13)
3674
3675# Define uintmax_t to 'unsigned long' or 'unsigned long long'
3676# if it is not already defined in <stdint.h> or <inttypes.h>.
3677
3678AC_DEFUN([jm_AC_TYPE_UINTMAX_T],
3679[
3680  AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
3681  AC_REQUIRE([jm_AC_HEADER_STDINT_H])
3682  if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then
3683    AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
3684    test $ac_cv_type_unsigned_long_long = yes \
3685      && ac_type='unsigned long long' \
3686      || ac_type='unsigned long'
3687    AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
3688      [Define to unsigned long or unsigned long long
3689       if <stdint.h> and <inttypes.h> don't define.])
3690  else
3691    AC_DEFINE(HAVE_UINTMAX_T, 1,
3692      [Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>.])
3693  fi
3694])
3695
3696# ulonglong.m4 serial 3
3697dnl Copyright (C) 1999-2003 Free Software Foundation, Inc.
3698dnl This file is free software, distributed under the terms of the GNU
3699dnl General Public License.  As a special exception to the GNU General
3700dnl Public License, this file may be distributed as part of a program
3701dnl that contains a configuration script generated by Autoconf, under
3702dnl the same distribution terms as the rest of that program.
3703
3704dnl From Paul Eggert.
3705
3706# Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works.
3707
3708AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG],
3709[
3710  AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
3711  [AC_TRY_LINK([unsigned long long ull = 1ULL; int i = 63;],
3712    [unsigned long long ullmax = (unsigned long long) -1;
3713     return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
3714    ac_cv_type_unsigned_long_long=yes,
3715    ac_cv_type_unsigned_long_long=no)])
3716  if test $ac_cv_type_unsigned_long_long = yes; then
3717    AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
3718      [Define if you have the 'unsigned long long' type.])
3719  fi
3720])
3721
3722# inttypes.m4 serial 1 (gettext-0.11.4)
3723dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
3724dnl This file is free software, distributed under the terms of the GNU
3725dnl General Public License.  As a special exception to the GNU General
3726dnl Public License, this file may be distributed as part of a program
3727dnl that contains a configuration script generated by Autoconf, under
3728dnl the same distribution terms as the rest of that program.
3729
3730dnl From Paul Eggert.
3731
3732# Define HAVE_INTTYPES_H if <inttypes.h> exists and doesn't clash with
3733# <sys/types.h>.
3734
3735AC_DEFUN([gt_HEADER_INTTYPES_H],
3736[
3737  AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h,
3738  [
3739    AC_TRY_COMPILE(
3740      [#include <sys/types.h>
3741#include <inttypes.h>],
3742      [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no)
3743  ])
3744  if test $gt_cv_header_inttypes_h = yes; then
3745    AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
3746      [Define if <inttypes.h> exists and doesn't clash with <sys/types.h>.])
3747  fi
3748])
3749
3750# inttypes-pri.m4 serial 1 (gettext-0.11.4)
3751dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
3752dnl This file is free software, distributed under the terms of the GNU
3753dnl General Public License.  As a special exception to the GNU General
3754dnl Public License, this file may be distributed as part of a program
3755dnl that contains a configuration script generated by Autoconf, under
3756dnl the same distribution terms as the rest of that program.
3757
3758dnl From Bruno Haible.
3759
3760# Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI*
3761# macros to non-string values.  This is the case on AIX 4.3.3.
3762
3763AC_DEFUN([gt_INTTYPES_PRI],
3764[
3765  AC_REQUIRE([gt_HEADER_INTTYPES_H])
3766  if test $gt_cv_header_inttypes_h = yes; then
3767    AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken],
3768      gt_cv_inttypes_pri_broken,
3769      [
3770        AC_TRY_COMPILE([#include <inttypes.h>
3771#ifdef PRId32
3772char *p = PRId32;
3773#endif
3774], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes)
3775      ])
3776  fi
3777  if test "$gt_cv_inttypes_pri_broken" = yes; then
3778    AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1,
3779      [Define if <inttypes.h> exists and defines unusable PRI* macros.])
3780  fi
3781])
3782
3783# xsize.m4 serial 2
3784dnl Copyright (C) 2003 Free Software Foundation, Inc.
3785dnl This file is free software, distributed under the terms of the GNU
3786dnl General Public License.  As a special exception to the GNU General
3787dnl Public License, this file may be distributed as part of a program
3788dnl that contains a configuration script generated by Autoconf, under
3789dnl the same distribution terms as the rest of that program.
3790
3791AC_DEFUN([gl_XSIZE],
3792[
3793  dnl Prerequisites of lib/xsize.h.
3794  AC_REQUIRE([gl_SIZE_MAX])
3795  AC_CHECK_HEADERS(stdint.h)
3796])
3797
3798# size_max.m4 serial 2
3799dnl Copyright (C) 2003 Free Software Foundation, Inc.
3800dnl This file is free software, distributed under the terms of the GNU
3801dnl General Public License.  As a special exception to the GNU General
3802dnl Public License, this file may be distributed as part of a program
3803dnl that contains a configuration script generated by Autoconf, under
3804dnl the same distribution terms as the rest of that program.
3805
3806dnl From Bruno Haible.
3807
3808AC_DEFUN([gl_SIZE_MAX],
3809[
3810  AC_CHECK_HEADERS(stdint.h)
3811  dnl First test whether the system already has SIZE_MAX.
3812  AC_MSG_CHECKING([for SIZE_MAX])
3813  result=
3814  AC_EGREP_CPP([Found it], [
3815#include <limits.h>
3816#if HAVE_STDINT_H
3817#include <stdint.h>
3818#endif
3819#ifdef SIZE_MAX
3820Found it
3821#endif
3822], result=yes)
3823  if test -z "$result"; then
3824    dnl Define it ourselves. Here we assume that the type 'size_t' is not wider
3825    dnl than the type 'unsigned long'.
3826    dnl The _AC_COMPUTE_INT macro works up to LONG_MAX, since it uses 'expr',
3827    dnl which is guaranteed to work from LONG_MIN to LONG_MAX.
3828    _AC_COMPUTE_INT([~(size_t)0 / 10], res_hi,
3829      [#include <stddef.h>], result=?)
3830    _AC_COMPUTE_INT([~(size_t)0 % 10], res_lo,
3831      [#include <stddef.h>], result=?)
3832    _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint,
3833      [#include <stddef.h>], result=?)
3834    if test "$fits_in_uint" = 1; then
3835      dnl Even though SIZE_MAX fits in an unsigned int, it must be of type
3836      dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'.
3837      AC_TRY_COMPILE([#include <stddef.h>
3838        extern size_t foo;
3839        extern unsigned long foo;
3840        ], [], fits_in_uint=0)
3841    fi
3842    if test -z "$result"; then
3843      if test "$fits_in_uint" = 1; then
3844        result="$res_hi$res_lo"U
3845      else
3846        result="$res_hi$res_lo"UL
3847      fi
3848    else
3849      dnl Shouldn't happen, but who knows...
3850      result='~(size_t)0'
3851    fi
3852  fi
3853  AC_MSG_RESULT([$result])
3854  if test "$result" != yes; then
3855    AC_DEFINE_UNQUOTED([SIZE_MAX], [$result],
3856      [Define as the maximum value of type 'size_t', if the system doesn't define it.])
3857  fi
3858])
3859
3860# codeset.m4 serial AM1 (gettext-0.10.40)
3861dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
3862dnl This file is free software, distributed under the terms of the GNU
3863dnl General Public License.  As a special exception to the GNU General
3864dnl Public License, this file may be distributed as part of a program
3865dnl that contains a configuration script generated by Autoconf, under
3866dnl the same distribution terms as the rest of that program.
3867
3868dnl From Bruno Haible.
3869
3870AC_DEFUN([AM_LANGINFO_CODESET],
3871[
3872  AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
3873    [AC_TRY_LINK([#include <langinfo.h>],
3874      [char* cs = nl_langinfo(CODESET);],
3875      am_cv_langinfo_codeset=yes,
3876      am_cv_langinfo_codeset=no)
3877    ])
3878  if test $am_cv_langinfo_codeset = yes; then
3879    AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
3880      [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
3881  fi
3882])
3883
3884# lcmessage.m4 serial 3 (gettext-0.11.3)
3885dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
3886dnl This file is free software, distributed under the terms of the GNU
3887dnl General Public License.  As a special exception to the GNU General
3888dnl Public License, this file may be distributed as part of a program
3889dnl that contains a configuration script generated by Autoconf, under
3890dnl the same distribution terms as the rest of that program.
3891dnl
3892dnl This file can can be used in projects which are not available under
3893dnl the GNU General Public License or the GNU Library General Public
3894dnl License but which still want to provide support for the GNU gettext
3895dnl functionality.
3896dnl Please note that the actual code of the GNU gettext library is covered
3897dnl by the GNU Library General Public License, and the rest of the GNU
3898dnl gettext package package is covered by the GNU General Public License.
3899dnl They are *not* in the public domain.
3900
3901dnl Authors:
3902dnl   Ulrich Drepper <drepper@cygnus.com>, 1995.
3903
3904# Check whether LC_MESSAGES is available in <locale.h>.
3905
3906AC_DEFUN([AM_LC_MESSAGES],
3907[
3908  AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
3909    [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
3910       am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
3911  if test $am_cv_val_LC_MESSAGES = yes; then
3912    AC_DEFINE(HAVE_LC_MESSAGES, 1,
3913      [Define if your <locale.h> file defines LC_MESSAGES.])
3914  fi
3915])
3916
3917