Home | History | Annotate | Line # | Download | only in dist
      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 
     14 # Do all the work for Automake.  This macro actually does too much --
     15 # some checks are only needed if your package does certain things.
     16 # But this isn't really a big deal.
     17 
     18 # serial 5
     19 
     20 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
     21 # written in clear, in which case automake, when reading aclocal.m4,
     22 # will think it sees a *use*, and therefore will trigger all it's
     23 # C support machinery.  Also note that it means that autoscan, seeing
     24 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
     25 
     26 
     27 # We require 2.13 because we rely on SHELL being computed by configure.
     28 AC_PREREQ([2.13])
     29 
     30 # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
     31 # -----------------------------------------------------------
     32 # If MACRO-NAME is provided do IF-PROVIDED, else IF-NOT-PROVIDED.
     33 # The purpose of this macro is to provide the user with a means to
     34 # check macros which are provided without letting her know how the
     35 # information is coded.
     36 # If this macro is not defined by Autoconf, define it here.
     37 ifdef([AC_PROVIDE_IFELSE],
     38       [],
     39       [define([AC_PROVIDE_IFELSE],
     40               [ifdef([AC_PROVIDE_$1],
     41                      [$2], [$3])])])
     42 
     43 
     44 # AM_INIT_AUTOMAKE(PACKAGE,VERSION, [NO-DEFINE])
     45 # ----------------------------------------------
     46 AC_DEFUN([AM_INIT_AUTOMAKE],
     47 [AC_REQUIRE([AC_PROG_INSTALL])dnl
     48 # test to see if srcdir already configured
     49 if test "`CDPATH=:; cd $srcdir && pwd`" != "`pwd`" &&
     50    test -f $srcdir/config.status; then
     51   AC_MSG_ERROR([source directory already configured; run \"make distclean\" there first])
     52 fi
     53 
     54 # Define the identity of the package.
     55 PACKAGE=$1
     56 AC_SUBST(PACKAGE)dnl
     57 VERSION=$2
     58 AC_SUBST(VERSION)dnl
     59 ifelse([$3],,
     60 [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
     61 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])
     62 
     63 # Autoconf 2.50 wants to disallow AM_ names.  We explicitly allow
     64 # the ones we care about.
     65 ifdef([m4_pattern_allow],
     66       [m4_pattern_allow([^AM_[A-Z]+FLAGS])])dnl
     67 
     68 # Autoconf 2.50 always computes EXEEXT.  However we need to be
     69 # compatible with 2.13, for now.  So we always define EXEEXT, but we
     70 # don't compute it.
     71 AC_SUBST(EXEEXT)
     72 # Similar for OBJEXT -- only we only use OBJEXT if the user actually
     73 # requests that it be used.  This is a bit dumb.
     74 : ${OBJEXT=o}
     75 AC_SUBST(OBJEXT)
     76 
     77 # Some tools Automake needs.
     78 AC_REQUIRE([AM_SANITY_CHECK])dnl
     79 AC_REQUIRE([AC_ARG_PROGRAM])dnl
     80 AM_MISSING_PROG(ACLOCAL, aclocal)
     81 AM_MISSING_PROG(AUTOCONF, autoconf)
     82 AM_MISSING_PROG(AUTOMAKE, automake)
     83 AM_MISSING_PROG(AUTOHEADER, autoheader)
     84 AM_MISSING_PROG(MAKEINFO, makeinfo)
     85 AM_MISSING_PROG(AMTAR, tar)
     86 AM_PROG_INSTALL_SH
     87 AM_PROG_INSTALL_STRIP
     88 # We need awk for the "check" target.  The system "awk" is bad on
     89 # some platforms.
     90 AC_REQUIRE([AC_PROG_AWK])dnl
     91 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
     92 AC_REQUIRE([AM_DEP_TRACK])dnl
     93 AC_REQUIRE([AM_SET_DEPDIR])dnl
     94 AC_PROVIDE_IFELSE([AC_PROG_][CC],
     95                   [_AM_DEPENDENCIES(CC)],
     96                   [define([AC_PROG_][CC],
     97                           defn([AC_PROG_][CC])[_AM_DEPENDENCIES(CC)])])dnl
     98 AC_PROVIDE_IFELSE([AC_PROG_][CXX],
     99                   [_AM_DEPENDENCIES(CXX)],
    100                   [define([AC_PROG_][CXX],
    101                           defn([AC_PROG_][CXX])[_AM_DEPENDENCIES(CXX)])])dnl
    102 ])
    103 
    104 #
    105 # Check to make sure that the build environment is sane.
    106 #
    107 
    108 # serial 3
    109 
    110 # AM_SANITY_CHECK
    111 # ---------------
    112 AC_DEFUN([AM_SANITY_CHECK],
    113 [AC_MSG_CHECKING([whether build environment is sane])
    114 # Just in case
    115 sleep 1
    116 echo timestamp > conftest.file
    117 # Do `set' in a subshell so we don't clobber the current shell's
    118 # arguments.  Must try -L first in case configure is actually a
    119 # symlink; some systems play weird games with the mod time of symlinks
    120 # (eg FreeBSD returns the mod time of the symlink's containing
    121 # directory).
    122 if (
    123    set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
    124    if test "$[*]" = "X"; then
    125       # -L didn't work.
    126       set X `ls -t $srcdir/configure conftest.file`
    127    fi
    128    rm -f conftest.file
    129    if test "$[*]" != "X $srcdir/configure conftest.file" \
    130       && test "$[*]" != "X conftest.file $srcdir/configure"; then
    131 
    132       # If neither matched, then we have a broken ls.  This can happen
    133       # if, for instance, CONFIG_SHELL is bash and it inherits a
    134       # broken ls alias from the environment.  This has actually
    135       # happened.  Such a system could not be considered "sane".
    136       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
    137 alias in your environment])
    138    fi
    139 
    140    test "$[2]" = conftest.file
    141    )
    142 then
    143    # Ok.
    144    :
    145 else
    146    AC_MSG_ERROR([newly created file is older than distributed files!
    147 Check your system clock])
    148 fi
    149 AC_MSG_RESULT(yes)])
    150 
    151 
    152 # serial 2
    153 
    154 # AM_MISSING_PROG(NAME, PROGRAM)
    155 # ------------------------------
    156 AC_DEFUN([AM_MISSING_PROG],
    157 [AC_REQUIRE([AM_MISSING_HAS_RUN])
    158 $1=${$1-"${am_missing_run}$2"}
    159 AC_SUBST($1)])
    160 
    161 
    162 # AM_MISSING_HAS_RUN
    163 # ------------------
    164 # Define MISSING if not defined so far and test if it supports --run.
    165 # If it does, set am_missing_run to use it, otherwise, to nothing.
    166 AC_DEFUN([AM_MISSING_HAS_RUN],
    167 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
    168 test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
    169 # Use eval to expand $SHELL
    170 if eval "$MISSING --run true"; then
    171   am_missing_run="$MISSING --run "
    172 else
    173   am_missing_run=
    174   am_backtick='`'
    175   AC_MSG_WARN([${am_backtick}missing' script is too old or missing])
    176 fi
    177 ])
    178 
    179 # AM_AUX_DIR_EXPAND
    180 
    181 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
    182 # $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
    183 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
    184 #
    185 # Of course, Automake must honor this variable whenever it calls a
    186 # tool from the auxiliary directory.  The problem is that $srcdir (and
    187 # therefore $ac_aux_dir as well) can be either absolute or relative,
    188 # depending on how configure is run.  This is pretty annoying, since
    189 # it makes $ac_aux_dir quite unusable in subdirectories: in the top
    190 # source directory, any form will work fine, but in subdirectories a
    191 # relative path needs to be adjusted first.
    192 #
    193 # $ac_aux_dir/missing
    194 #    fails when called from a subdirectory if $ac_aux_dir is relative
    195 # $top_srcdir/$ac_aux_dir/missing
    196 #    fails if $ac_aux_dir is absolute,
    197 #    fails when called from a subdirectory in a VPATH build with
    198 #          a relative $ac_aux_dir
    199 #
    200 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
    201 # are both prefixed by $srcdir.  In an in-source build this is usually
    202 # harmless because $srcdir is `.', but things will broke when you
    203 # start a VPATH build or use an absolute $srcdir.
    204 #
    205 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
    206 # iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
    207 #   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
    208 # and then we would define $MISSING as
    209 #   MISSING="\${SHELL} $am_aux_dir/missing"
    210 # This will work as long as MISSING is not called from configure, because
    211 # unfortunately $(top_srcdir) has no meaning in configure.
    212 # However there are other variables, like CC, which are often used in
    213 # configure, and could therefore not use this "fixed" $ac_aux_dir.
    214 #
    215 # Another solution, used here, is to always expand $ac_aux_dir to an
    216 # absolute PATH.  The drawback is that using absolute paths prevent a
    217 # configured tree to be moved without reconfiguration.
    218 
    219 AC_DEFUN([AM_AUX_DIR_EXPAND], [
    220 # expand $ac_aux_dir to an absolute path
    221 am_aux_dir=`CDPATH=:; cd $ac_aux_dir && pwd`
    222 ])
    223 
    224 # AM_PROG_INSTALL_SH
    225 # ------------------
    226 # Define $install_sh.
    227 AC_DEFUN([AM_PROG_INSTALL_SH],
    228 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
    229 install_sh=${install_sh-"$am_aux_dir/install-sh"}
    230 AC_SUBST(install_sh)])
    231 
    232 # One issue with vendor `install' (even GNU) is that you can't
    233 # specify the program used to strip binaries.  This is especially
    234 # annoying in cross-compiling environments, where the build's strip
    235 # is unlikely to handle the host's binaries.
    236 # Fortunately install-sh will honor a STRIPPROG variable, so we
    237 # always use install-sh in `make install-strip', and initialize
    238 # STRIPPROG with the value of the STRIP variable (set by the user).
    239 AC_DEFUN([AM_PROG_INSTALL_STRIP],
    240 [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
    241 INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
    242 AC_SUBST([INSTALL_STRIP_PROGRAM])])
    243 
    244 # serial 4						-*- Autoconf -*-
    245 
    246 
    247 
    248 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
    249 # written in clear, in which case automake, when reading aclocal.m4,
    250 # will think it sees a *use*, and therefore will trigger all it's
    251 # C support machinery.  Also note that it means that autoscan, seeing
    252 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
    253 
    254 
    255 
    256 # _AM_DEPENDENCIES(NAME)
    257 # ---------------------
    258 # See how the compiler implements dependency checking.
    259 # NAME is "CC", "CXX" or "OBJC".
    260 # We try a few techniques and use that to set a single cache variable.
    261 #
    262 # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
    263 # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
    264 # dependency, and given that the user is not expected to run this macro,
    265 # just rely on AC_PROG_CC.
    266 AC_DEFUN([_AM_DEPENDENCIES],
    267 [AC_REQUIRE([AM_SET_DEPDIR])dnl
    268 AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
    269 AC_REQUIRE([AM_MAKE_INCLUDE])dnl
    270 AC_REQUIRE([AM_DEP_TRACK])dnl
    271 
    272 ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
    273        [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
    274        [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc']
    275        [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
    276                    [depcc="$$1"   am_compiler_list=])
    277 
    278 AC_CACHE_CHECK([dependency style of $depcc],
    279                [am_cv_$1_dependencies_compiler_type],
    280 [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
    281   # We make a subdir and do the tests there.  Otherwise we can end up
    282   # making bogus files that we don't know about and never remove.  For
    283   # instance it was reported that on HP-UX the gcc test will end up
    284   # making a dummy file named `D' -- because `-MD' means `put the output
    285   # in D'.
    286   mkdir conftest.dir
    287   # Copy depcomp to subdir because otherwise we won't find it if we're
    288   # using a relative directory.
    289   cp "$am_depcomp" conftest.dir
    290   cd conftest.dir
    291 
    292   am_cv_$1_dependencies_compiler_type=none
    293   if test "$am_compiler_list" = ""; then
    294      am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
    295   fi
    296   for depmode in $am_compiler_list; do
    297     # We need to recreate these files for each test, as the compiler may
    298     # overwrite some of them when testing with obscure command lines.
    299     # This happens at least with the AIX C compiler.
    300     echo '#include "conftest.h"' > conftest.c
    301     echo 'int i;' > conftest.h
    302     echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf
    303 
    304     case $depmode in
    305     nosideeffect)
    306       # after this tag, mechanisms are not by side-effect, so they'll
    307       # only be used when explicitly requested
    308       if test "x$enable_dependency_tracking" = xyes; then
    309 	continue
    310       else
    311 	break
    312       fi
    313       ;;
    314     none) break ;;
    315     esac
    316     # We check with `-c' and `-o' for the sake of the "dashmstdout"
    317     # mode.  It turns out that the SunPro C++ compiler does not properly
    318     # handle `-M -o', and we need to detect this.
    319     if depmode=$depmode \
    320        source=conftest.c object=conftest.o \
    321        depfile=conftest.Po tmpdepfile=conftest.TPo \
    322        $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
    323        grep conftest.h conftest.Po > /dev/null 2>&1 &&
    324        ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
    325       am_cv_$1_dependencies_compiler_type=$depmode
    326       break
    327     fi
    328   done
    329 
    330   cd ..
    331   rm -rf conftest.dir
    332 else
    333   am_cv_$1_dependencies_compiler_type=none
    334 fi
    335 ])
    336 $1DEPMODE="depmode=$am_cv_$1_dependencies_compiler_type"
    337 AC_SUBST([$1DEPMODE])
    338 ])
    339 
    340 
    341 # AM_SET_DEPDIR
    342 # -------------
    343 # Choose a directory name for dependency files.
    344 # This macro is AC_REQUIREd in _AM_DEPENDENCIES
    345 AC_DEFUN([AM_SET_DEPDIR],
    346 [rm -f .deps 2>/dev/null
    347 mkdir .deps 2>/dev/null
    348 if test -d .deps; then
    349   DEPDIR=.deps
    350 else
    351   # MS-DOS does not allow filenames that begin with a dot.
    352   DEPDIR=_deps
    353 fi
    354 rmdir .deps 2>/dev/null
    355 AC_SUBST(DEPDIR)
    356 ])
    357 
    358 
    359 # AM_DEP_TRACK
    360 # ------------
    361 AC_DEFUN([AM_DEP_TRACK],
    362 [AC_ARG_ENABLE(dependency-tracking,
    363 [  --disable-dependency-tracking Speeds up one-time builds
    364   --enable-dependency-tracking  Do not reject slow dependency extractors])
    365 if test "x$enable_dependency_tracking" != xno; then
    366   am_depcomp="$ac_aux_dir/depcomp"
    367   AMDEPBACKSLASH='\'
    368 fi
    369 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
    370 pushdef([subst], defn([AC_SUBST]))
    371 subst(AMDEPBACKSLASH)
    372 popdef([subst])
    373 ])
    374 
    375 # Generate code to set up dependency tracking.
    376 # This macro should only be invoked once -- use via AC_REQUIRE.
    377 # Usage:
    378 # AM_OUTPUT_DEPENDENCY_COMMANDS
    379 
    380 #
    381 # This code is only required when automatic dependency tracking
    382 # is enabled.  FIXME.  This creates each `.P' file that we will
    383 # need in order to bootstrap the dependency handling code.
    384 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],[
    385 AC_OUTPUT_COMMANDS([
    386 test x"$AMDEP_TRUE" != x"" ||
    387 for mf in $CONFIG_FILES; do
    388   case "$mf" in
    389   Makefile) dirpart=.;;
    390   */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;;
    391   *) continue;;
    392   esac
    393   grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue
    394   # Extract the definition of DEP_FILES from the Makefile without
    395   # running `make'.
    396   DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
    397   test -z "$DEPDIR" && continue
    398   # When using ansi2knr, U may be empty or an underscore; expand it
    399   U=`sed -n -e '/^U = / s///p' < "$mf"`
    400   test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
    401   # We invoke sed twice because it is the simplest approach to
    402   # changing $(DEPDIR) to its actual value in the expansion.
    403   for file in `sed -n -e '
    404     /^DEP_FILES = .*\\\\$/ {
    405       s/^DEP_FILES = //
    406       :loop
    407 	s/\\\\$//
    408 	p
    409 	n
    410 	/\\\\$/ b loop
    411       p
    412     }
    413     /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
    414        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
    415     # Make sure the directory exists.
    416     test -f "$dirpart/$file" && continue
    417     fdir=`echo "$file" | sed -e 's|/[^/]*$||'`
    418     $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1
    419     # echo "creating $dirpart/$file"
    420     echo '# dummy' > "$dirpart/$file"
    421   done
    422 done
    423 ], [AMDEP_TRUE="$AMDEP_TRUE"
    424 ac_aux_dir="$ac_aux_dir"])])
    425 
    426 # AM_MAKE_INCLUDE()
    427 # -----------------
    428 # Check to see how make treats includes.
    429 AC_DEFUN([AM_MAKE_INCLUDE],
    430 [am_make=${MAKE-make}
    431 cat > confinc << 'END'
    432 doit:
    433 	@echo done
    434 END
    435 # If we don't find an include directive, just comment out the code.
    436 AC_MSG_CHECKING([for style of include used by $am_make])
    437 am__include='#'
    438 am__quote=
    439 _am_result=none
    440 # First try GNU make style include.
    441 echo "include confinc" > confmf
    442 # We grep out `Entering directory' and `Leaving directory'
    443 # messages which can occur if `w' ends up in MAKEFLAGS.
    444 # In particular we don't look at `^make:' because GNU make might
    445 # be invoked under some other name (usually "gmake"), in which
    446 # case it prints its new name instead of `make'.
    447 if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then
    448    am__include=include
    449    am__quote=
    450    _am_result=GNU
    451 fi
    452 # Now try BSD make style include.
    453 if test "$am__include" = "#"; then
    454    echo '.include "confinc"' > confmf
    455    if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
    456       am__include=.include
    457       am__quote='"'
    458       _am_result=BSD
    459    fi
    460 fi
    461 AC_SUBST(am__include)
    462 AC_SUBST(am__quote)
    463 AC_MSG_RESULT($_am_result)
    464 rm -f confinc confmf
    465 ])
    466 
    467 # serial 3
    468 
    469 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
    470 # -------------------------------------
    471 # Define a conditional.
    472 #
    473 # FIXME: Once using 2.50, use this:
    474 # m4_match([$1], [^TRUE\|FALSE$], [AC_FATAL([$0: invalid condition: $1])])dnl
    475 AC_DEFUN([AM_CONDITIONAL],
    476 [ifelse([$1], [TRUE],
    477         [errprint(__file__:__line__: [$0: invalid condition: $1
    478 ])dnl
    479 m4exit(1)])dnl
    480 ifelse([$1], [FALSE],
    481        [errprint(__file__:__line__: [$0: invalid condition: $1
    482 ])dnl
    483 m4exit(1)])dnl
    484 AC_SUBST([$1_TRUE])
    485 AC_SUBST([$1_FALSE])
    486 if $2; then
    487   $1_TRUE=
    488   $1_FALSE='#'
    489 else
    490   $1_TRUE='#'
    491   $1_FALSE=
    492 fi])
    493 
    494 # Like AC_CONFIG_HEADER, but automatically create stamp file.
    495 
    496 # serial 3
    497 
    498 # When config.status generates a header, we must update the stamp-h file.
    499 # This file resides in the same directory as the config header
    500 # that is generated.  We must strip everything past the first ":",
    501 # and everything past the last "/".
    502 
    503 AC_PREREQ([2.12])
    504 
    505 AC_DEFUN([AM_CONFIG_HEADER],
    506 [ifdef([AC_FOREACH],dnl
    507 	 [dnl init our file count if it isn't already
    508 	 m4_ifndef([_AM_Config_Header_Index], m4_define([_AM_Config_Header_Index], [0]))
    509 	 dnl prepare to store our destination file list for use in config.status
    510 	 AC_FOREACH([_AM_File], [$1],
    511 		    [m4_pushdef([_AM_Dest], m4_patsubst(_AM_File, [:.*]))
    512 		    m4_define([_AM_Config_Header_Index], m4_incr(_AM_Config_Header_Index))
    513 		    dnl and add it to the list of files AC keeps track of, along
    514 		    dnl with our hook
    515 		    AC_CONFIG_HEADERS(_AM_File,
    516 dnl COMMANDS, [, INIT-CMDS]
    517 [# update the timestamp
    518 echo timestamp >"AS_ESCAPE(_AM_DIRNAME(]_AM_Dest[))/stamp-h]_AM_Config_Header_Index["
    519 ][$2]m4_ifval([$3], [, [$3]]))dnl AC_CONFIG_HEADERS
    520 		    m4_popdef([_AM_Dest])])],dnl
    521 [AC_CONFIG_HEADER([$1])
    522   AC_OUTPUT_COMMANDS(
    523    ifelse(patsubst([$1], [[^ ]], []),
    524 	  [],
    525 	  [test -z "$CONFIG_HEADERS" || echo timestamp >dnl
    526 	   patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]),dnl
    527 [am_indx=1
    528 for am_file in $1; do
    529   case " \$CONFIG_HEADERS " in
    530   *" \$am_file "*)
    531     am_dir=\`echo \$am_file |sed 's%:.*%%;s%[^/]*\$%%'\`
    532     if test -n "\$am_dir"; then
    533       am_tmpdir=\`echo \$am_dir |sed 's%^\(/*\).*\$%\1%'\`
    534       for am_subdir in \`echo \$am_dir |sed 's%/% %'\`; do
    535         am_tmpdir=\$am_tmpdir\$am_subdir/
    536         if test ! -d \$am_tmpdir; then
    537           mkdir \$am_tmpdir
    538         fi
    539       done
    540     fi
    541     echo timestamp > "\$am_dir"stamp-h\$am_indx
    542     ;;
    543   esac
    544   am_indx=\`expr \$am_indx + 1\`
    545 done])
    546 ])]) # AM_CONFIG_HEADER
    547 
    548 # _AM_DIRNAME(PATH)
    549 # -----------------
    550 # Like AS_DIRNAME, only do it during macro expansion
    551 AC_DEFUN([_AM_DIRNAME],
    552        [m4_if(m4_regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1,
    553 	      m4_if(m4_regexp([$1], [^//\([^/]\|$\)]), -1,
    554 		    m4_if(m4_regexp([$1], [^/.*]), -1,
    555 			  [.],
    556 			  m4_patsubst([$1], [^\(/\).*], [\1])),
    557 		    m4_patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])),
    558 	      m4_patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl
    559 ]) # _AM_DIRNAME
    560 
    561 #serial 6
    562 
    563 dnl By default, many hosts won't let programs access large files;
    564 dnl one must use special compiler options to get large-file access to work.
    565 dnl For more details about this brain damage please see:
    566 dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
    567 
    568 dnl Written by Paul Eggert <eggert (a] twinsun.com>.
    569 
    570 dnl Internal subroutine of AC_SYS_LARGEFILE.
    571 dnl AC_SYS_LARGEFILE_FLAGS(FLAGSNAME)
    572 AC_DEFUN([AC_SYS_LARGEFILE_FLAGS],
    573   [AC_CACHE_CHECK([for $1 value to request large file support],
    574      ac_cv_sys_largefile_$1,
    575      [if ($GETCONF LFS_$1) >conftest.1 2>conftest.2 && test ! -s conftest.2
    576       then
    577         ac_cv_sys_largefile_$1=`cat conftest.1`
    578       else
    579 	ac_cv_sys_largefile_$1=no
    580 	ifelse($1, CFLAGS,
    581 	  [case "$host_os" in
    582 	   # HP-UX 10.20 requires -D__STDC_EXT__ with gcc 2.95.1.
    583 changequote(, )dnl
    584 	   hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
    585 changequote([, ])dnl
    586 	     if test "$GCC" = yes; then
    587 	       ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__
    588 	     fi
    589 	     ;;
    590 	   # IRIX 6.2 and later require cc -n32.
    591 changequote(, )dnl
    592 	   irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)
    593 changequote([, ])dnl
    594 	     if test "$GCC" != yes; then
    595 	       ac_cv_sys_largefile_CFLAGS=-n32
    596 	     fi
    597 	   esac
    598 	   if test "$ac_cv_sys_largefile_CFLAGS" != no; then
    599 	     ac_save_CC="$CC"
    600 	     CC="$CC $ac_cv_sys_largefile_CFLAGS"
    601 	     AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no)
    602 	     CC="$ac_save_CC"
    603 	   fi])
    604       fi
    605       rm -f conftest*])])
    606 
    607 dnl Internal subroutine of AC_SYS_LARGEFILE.
    608 dnl AC_SYS_LARGEFILE_SPACE_APPEND(VAR, VAL)
    609 AC_DEFUN([AC_SYS_LARGEFILE_SPACE_APPEND],
    610   [case $2 in
    611    no) ;;
    612    ?*)
    613      case "[$]$1" in
    614      '') $1=$2 ;;
    615      *) $1=[$]$1' '$2 ;;
    616      esac ;;
    617    esac])
    618 
    619 dnl Internal subroutine of AC_SYS_LARGEFILE.
    620 dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT)
    621 AC_DEFUN([AC_SYS_LARGEFILE_MACRO_VALUE],
    622   [AC_CACHE_CHECK([for $1], $2,
    623      [$2=no
    624 changequote(, )dnl
    625       $4
    626       for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
    627 	case "$ac_flag" in
    628 	-D$1)
    629 	  $2=1 ;;
    630 	-D$1=*)
    631 	  $2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;;
    632 	esac
    633       done
    634 changequote([, ])dnl
    635       ])
    636    if test "[$]$2" != no; then
    637      AC_DEFINE_UNQUOTED([$1], [$]$2, [$3])
    638    fi])
    639 
    640 AC_DEFUN([AC_SYS_LARGEFILE],
    641   [AC_REQUIRE([AC_CANONICAL_HOST])
    642    AC_ARG_ENABLE(largefile,
    643      [  --disable-largefile     omit support for large files])
    644    if test "$enable_largefile" != no; then
    645      AC_CHECK_TOOL(GETCONF, getconf)
    646      AC_SYS_LARGEFILE_FLAGS(CFLAGS)
    647      AC_SYS_LARGEFILE_FLAGS(LDFLAGS)
    648      AC_SYS_LARGEFILE_FLAGS(LIBS)
    649 
    650      for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
    651        case "$ac_flag" in
    652        no) ;;
    653        -D_FILE_OFFSET_BITS=*) ;;
    654        -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
    655        -D_LARGE_FILES | -D_LARGE_FILES=*) ;;
    656        -D?* | -I?*)
    657 	 AC_SYS_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;;
    658        *)
    659 	 AC_SYS_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;;
    660        esac
    661      done
    662      AC_SYS_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS")
    663      AC_SYS_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS")
    664      AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
    665        ac_cv_sys_file_offset_bits,
    666        [Number of bits in a file offset, on hosts where this is settable.],
    667        [case "$host_os" in
    668 	# HP-UX 10.20 and later
    669 	hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
    670 	  ac_cv_sys_file_offset_bits=64 ;;
    671 	esac])
    672      AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
    673        ac_cv_sys_largefile_source,
    674        [Define to make fseeko etc. visible, on some hosts.],
    675        [case "$host_os" in
    676 	# HP-UX 10.20 and later
    677 	hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
    678 	  ac_cv_sys_largefile_source=1 ;;
    679 	esac])
    680      AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
    681        ac_cv_sys_large_files,
    682        [Define for large files, on AIX-style hosts.],
    683        [case "$host_os" in
    684 	# AIX 4.2 and later
    685 	aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
    686 	  ac_cv_sys_large_files=1 ;;
    687 	esac])
    688    fi
    689   ])
    690 
    691 
    692 # serial 1
    693 
    694 AC_DEFUN([AM_C_PROTOTYPES],
    695 [AC_REQUIRE([AM_PROG_CC_STDC])
    696 AC_REQUIRE([AC_PROG_CPP])
    697 AC_MSG_CHECKING([for function prototypes])
    698 if test "$am_cv_prog_cc_stdc" != no; then
    699   AC_MSG_RESULT(yes)
    700   AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes])
    701   U= ANSI2KNR=
    702 else
    703   AC_MSG_RESULT(no)
    704   U=_ ANSI2KNR=./ansi2knr
    705 fi
    706 # Ensure some checks needed by ansi2knr itself.
    707 AC_HEADER_STDC
    708 AC_CHECK_HEADERS(string.h)
    709 AC_SUBST(U)dnl
    710 AC_SUBST(ANSI2KNR)dnl
    711 ])
    712 
    713 
    714 # serial 1
    715 
    716 # @defmac AC_PROG_CC_STDC
    717 # @maindex PROG_CC_STDC
    718 # @ovindex CC
    719 # If the C compiler in not in ANSI C mode by default, try to add an option
    720 # to output variable @code{CC} to make it so.  This macro tries various
    721 # options that select ANSI C on some system or another.  It considers the
    722 # compiler to be in ANSI C mode if it handles function prototypes correctly.
    723 #
    724 # If you use this macro, you should check after calling it whether the C
    725 # compiler has been set to accept ANSI C; if not, the shell variable
    726 # @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
    727 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
    728 # program @code{ansi2knr}, which comes with Ghostscript.
    729 # @end defmac
    730 
    731 AC_DEFUN([AM_PROG_CC_STDC],
    732 [AC_REQUIRE([AC_PROG_CC])
    733 AC_BEFORE([$0], [AC_C_INLINE])
    734 AC_BEFORE([$0], [AC_C_CONST])
    735 dnl Force this before AC_PROG_CPP.  Some cpp's, eg on HPUX, require
    736 dnl a magic option to avoid problems with ANSI preprocessor commands
    737 dnl like #elif.
    738 dnl FIXME: can't do this because then AC_AIX won't work due to a
    739 dnl circular dependency.
    740 dnl AC_BEFORE([$0], [AC_PROG_CPP])
    741 AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C])
    742 AC_CACHE_VAL(am_cv_prog_cc_stdc,
    743 [am_cv_prog_cc_stdc=no
    744 ac_save_CC="$CC"
    745 # Don't try gcc -ansi; that turns off useful extensions and
    746 # breaks some systems' header files.
    747 # AIX			-qlanglvl=ansi
    748 # Ultrix and OSF/1	-std1
    749 # HP-UX 10.20 and later	-Ae
    750 # HP-UX older versions	-Aa -D_HPUX_SOURCE
    751 # SVR4			-Xc -D__EXTENSIONS__
    752 for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
    753 do
    754   CC="$ac_save_CC $ac_arg"
    755   AC_TRY_COMPILE(
    756 [#include <stdarg.h>
    757 #include <stdio.h>
    758 #include <sys/types.h>
    759 #include <sys/stat.h>
    760 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
    761 struct buf { int x; };
    762 FILE * (*rcsopen) (struct buf *, struct stat *, int);
    763 static char *e (p, i)
    764      char **p;
    765      int i;
    766 {
    767   return p[i];
    768 }
    769 static char *f (char * (*g) (char **, int), char **p, ...)
    770 {
    771   char *s;
    772   va_list v;
    773   va_start (v,p);
    774   s = g (p, va_arg (v,int));
    775   va_end (v);
    776   return s;
    777 }
    778 int test (int i, double x);
    779 struct s1 {int (*f) (int a);};
    780 struct s2 {int (*f) (double a);};
    781 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
    782 int argc;
    783 char **argv;
    784 ], [
    785 return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
    786 ],
    787 [am_cv_prog_cc_stdc="$ac_arg"; break])
    788 done
    789 CC="$ac_save_CC"
    790 ])
    791 if test -z "$am_cv_prog_cc_stdc"; then
    792   AC_MSG_RESULT([none needed])
    793 else
    794   AC_MSG_RESULT([$am_cv_prog_cc_stdc])
    795 fi
    796 case "x$am_cv_prog_cc_stdc" in
    797   x|xno) ;;
    798   *) CC="$CC $am_cv_prog_cc_stdc" ;;
    799 esac
    800 ])
    801 
    802 #serial 5
    803 
    804 dnl From Paul Eggert.
    805 
    806 AC_PREREQ(2.13)
    807 
    808 # Define uintmax_t to `unsigned long' or `unsigned long long'
    809 # if <inttypes.h> does not exist.
    810 
    811 AC_DEFUN(jm_AC_TYPE_UINTMAX_T,
    812 [
    813   AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
    814   if test $jm_ac_cv_header_inttypes_h = no; then
    815     AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
    816     test $ac_cv_type_unsigned_long_long = yes \
    817       && ac_type='unsigned long long' \
    818       || ac_type='unsigned long'
    819     AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
    820 [  Define to unsigned long or unsigned long long
    821    if <inttypes.h> doesn't define.])
    822   fi
    823 ])
    824 
    825 #serial 3
    826 
    827 dnl From Paul Eggert.
    828 
    829 # Define HAVE_INTTYPES_H if <inttypes.h> exists,
    830 # doesn't clash with <sys/types.h>, and declares uintmax_t.
    831 
    832 AC_DEFUN(jm_AC_HEADER_INTTYPES_H,
    833 [
    834   AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
    835   [AC_TRY_COMPILE(
    836     [#include <sys/types.h>
    837 #include <inttypes.h>],
    838     [uintmax_t i = (uintmax_t) -1;],
    839     jm_ac_cv_header_inttypes_h=yes,
    840     jm_ac_cv_header_inttypes_h=no)])
    841   if test $jm_ac_cv_header_inttypes_h = yes; then
    842     AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
    843 [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
    844    and declares uintmax_t. ])
    845   fi
    846 ])
    847 
    848 #serial 2
    849 
    850 dnl From Paul Eggert.
    851 
    852 AC_DEFUN(jm_AC_TYPE_UNSIGNED_LONG_LONG,
    853 [
    854   AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
    855   [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;],
    856     [unsigned long long ullmax = (unsigned long long) -1;
    857      return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
    858     ac_cv_type_unsigned_long_long=yes,
    859     ac_cv_type_unsigned_long_long=no)])
    860   if test $ac_cv_type_unsigned_long_long = yes; then
    861     AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
    862       [Define if you have the unsigned long long type.])
    863   fi
    864 ])
    865 
    866 # serial 8
    867 
    868 # From Paul Eggert.
    869 
    870 # BeOS 5 has <wchar.h> but does not define mbstate_t,
    871 # so you can't declare an object of that type.
    872 # Check for this incompatibility with Standard C.
    873 
    874 # Include stdlib.h first, because otherwise this test would fail on Linux
    875 # (at least glibc-2.1.3) because the "_XOPEN_SOURCE 500" definition elicits
    876 # a syntax error in wchar.h due to the use of undefined __int32_t.
    877 
    878 AC_DEFUN(AC_MBSTATE_T,
    879   [
    880    AC_CHECK_HEADERS(stdlib.h)
    881 
    882    AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t,
    883     [AC_TRY_COMPILE([
    884 #if HAVE_STDLIB_H
    885 # include <stdlib.h>
    886 #endif
    887 #include <wchar.h>],
    888       [mbstate_t x; return sizeof x;],
    889       ac_cv_type_mbstate_t=yes,
    890       ac_cv_type_mbstate_t=no)])
    891    if test $ac_cv_type_mbstate_t = no; then
    892      AC_DEFINE(mbstate_t, int,
    893 	       [Define to a type if <wchar.h> does not define.])
    894    fi])
    895 
    896 #serial 2
    897 
    898 # autoconf tests required for use of xstrtoumax.c
    899 
    900 AC_DEFUN(jm_AC_PREREQ_XSTRTOUMAX,
    901 [
    902   AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
    903   AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
    904   AC_CHECK_HEADERS(stdlib.h)
    905 
    906   AC_CACHE_CHECK([whether <inttypes.h> defines strtoumax as a macro],
    907     jm_cv_func_strtoumax_macro,
    908     AC_EGREP_CPP([inttypes_h_defines_strtoumax], [#include <inttypes.h>
    909 #ifdef strtoumax
    910  inttypes_h_defines_strtoumax
    911 #endif],
    912       jm_cv_func_strtoumax_macro=yes,
    913       jm_cv_func_strtoumax_macro=no))
    914 
    915   if test "$jm_cv_func_strtoumax_macro" != yes; then
    916     AC_REPLACE_FUNCS(strtoumax)
    917   fi
    918 
    919   dnl We don't need (and can't compile) the replacement strtoull
    920   dnl unless the type `unsigned long long' exists.
    921   dnl Also, only the replacement strtoumax invokes strtoull,
    922   dnl so we need the replacement strtoull only if strtoumax does not exist.
    923   case "$ac_cv_type_unsigned_long_long,$jm_cv_func_strtoumax_macro,$ac_cv_func_strtoumax" in
    924     yes,no,no)
    925       AC_REPLACE_FUNCS(strtoull)
    926       ;;
    927   esac
    928 
    929 ])
    930 
    931 #serial 5
    932 
    933 AC_DEFUN(jm_CHECK_DECLARATION,
    934 [
    935   AC_MSG_CHECKING([whether $1 is declared])
    936   AC_CACHE_VAL(jm_cv_func_decl_$1,
    937     [AC_TRY_COMPILE([$2],
    938       [
    939 #ifndef $1
    940 char *(*pfn) = (char *(*)) $1
    941 #endif
    942       ],
    943       eval "jm_cv_func_decl_$1=yes",
    944       eval "jm_cv_func_decl_$1=no")])
    945 
    946   if eval "test \"`echo '$jm_cv_func_decl_'$1`\" = yes"; then
    947     AC_MSG_RESULT(yes)
    948     ifelse([$3], , :, [$3])
    949   else
    950     AC_MSG_RESULT(no)
    951     ifelse([$4], , , [$4
    952 ])dnl
    953   fi
    954 ])dnl
    955 
    956 dnl jm_CHECK_DECLARATIONS(INCLUDES, FUNCTION... [, ACTION-IF-DECLARED
    957 dnl                       [, ACTION-IF-NOT-DECLARED]])
    958 AC_DEFUN(jm_CHECK_DECLARATIONS,
    959 [
    960   for jm_func in $2
    961   do
    962     jm_CHECK_DECLARATION($jm_func, [$1],
    963     [
    964       jm_tr_func=HAVE_DECL_`echo $jm_func | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
    965       AC_DEFINE_UNQUOTED($jm_tr_func, 1, [Define if your system declares $1]) $3], [$4])dnl
    966   done
    967 ])
    968 
    969 # Macro to add for using GNU gettext.
    970 # Ulrich Drepper <drepper (a] cygnus.com>, 1995.
    971 #
    972 # This file can be copied and used freely without restrictions.  It can
    973 # be used in projects which are not available under the GNU General Public
    974 # License or the GNU Library General Public License but which still want
    975 # to provide support for the GNU gettext functionality.
    976 # Please note that the actual code of the GNU gettext library is covered
    977 # by the GNU Library General Public License, and the rest of the GNU
    978 # gettext package package is covered by the GNU General Public License.
    979 # They are *not* in the public domain.
    980 
    981 # serial 10
    982 
    983 dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]).
    984 dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library
    985 dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
    986 dnl    depending on --{enable,disable}-{shared,static} and on the presence of
    987 dnl    AM-DISABLE-SHARED). Otherwise, a static library
    988 dnl    $(top_builddir)/intl/libintl.a will be created.
    989 dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
    990 dnl    implementations (in libc or libintl) without the ngettext() function
    991 dnl    will be ignored.
    992 dnl LIBDIR is used to find the intl libraries.  If empty,
    993 dnl    the value `$(top_builddir)/intl/' is used.
    994 dnl
    995 dnl The result of the configuration is one of three cases:
    996 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
    997 dnl    and used.
    998 dnl    Catalog format: GNU --> install in $(datadir)
    999 dnl    Catalog extension: .mo after installation, .gmo in source tree
   1000 dnl 2) GNU gettext has been found in the system's C library.
   1001 dnl    Catalog format: GNU --> install in $(datadir)
   1002 dnl    Catalog extension: .mo after installation, .gmo in source tree
   1003 dnl 3) No internationalization, always use English msgid.
   1004 dnl    Catalog format: none
   1005 dnl    Catalog extension: none
   1006 dnl The use of .gmo is historical (it was needed to avoid overwriting the
   1007 dnl GNU format catalogs when building on a platform with an X/Open gettext),
   1008 dnl but we keep it in order not to force irrelevant filename changes on the
   1009 dnl maintainers.
   1010 dnl
   1011 AC_DEFUN([AM_WITH_NLS],
   1012   [AC_MSG_CHECKING([whether NLS is requested])
   1013     dnl Default is enabled NLS
   1014     AC_ARG_ENABLE(nls,
   1015       [  --disable-nls           do not use Native Language Support],
   1016       USE_NLS=$enableval, USE_NLS=yes)
   1017     AC_MSG_RESULT($USE_NLS)
   1018     AC_SUBST(USE_NLS)
   1019 
   1020     BUILD_INCLUDED_LIBINTL=no
   1021     USE_INCLUDED_LIBINTL=no
   1022     INTLLIBS=
   1023 
   1024     dnl If we use NLS figure out what method
   1025     if test "$USE_NLS" = "yes"; then
   1026       AC_DEFINE(ENABLE_NLS, 1,
   1027         [Define to 1 if translation of program messages to the user's native language
   1028    is requested.])
   1029       AC_MSG_CHECKING([whether included gettext is requested])
   1030       AC_ARG_WITH(included-gettext,
   1031         [  --with-included-gettext use the GNU gettext library included here],
   1032         nls_cv_force_use_gnu_gettext=$withval,
   1033         nls_cv_force_use_gnu_gettext=no)
   1034       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
   1035 
   1036       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
   1037       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
   1038         dnl User does not insist on using GNU NLS library.  Figure out what
   1039         dnl to use.  If GNU gettext is available we use this.  Else we have
   1040         dnl to fall back to GNU NLS library.
   1041 	CATOBJEXT=NONE
   1042 
   1043         dnl Add a version number to the cache macros.
   1044         define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc])
   1045         define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl])
   1046 
   1047 	AC_CHECK_HEADER(libintl.h,
   1048 	  [AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
   1049 	    [AC_TRY_LINK([#include <libintl.h>
   1050 extern int _nl_msg_cat_cntr;],
   1051 	       [bindtextdomain ("", "");
   1052 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
   1053 	       gt_cv_func_gnugettext_libc=yes,
   1054 	       gt_cv_func_gnugettext_libc=no)])
   1055 
   1056 	   if test "$gt_cv_func_gnugettext_libc" != "yes"; then
   1057 	     AC_CACHE_CHECK([for GNU gettext in libintl],
   1058 	       gt_cv_func_gnugettext_libintl,
   1059 	       [gt_save_LIBS="$LIBS"
   1060 		LIBS="$LIBS -lintl $LIBICONV"
   1061 		AC_TRY_LINK([#include <libintl.h>
   1062 extern int _nl_msg_cat_cntr;],
   1063 		  [bindtextdomain ("", "");
   1064 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
   1065 		  gt_cv_func_gnugettext_libintl=yes,
   1066 		  gt_cv_func_gnugettext_libintl=no)
   1067 		LIBS="$gt_save_LIBS"])
   1068 	   fi
   1069 
   1070 	   dnl If an already present or preinstalled GNU gettext() is found,
   1071 	   dnl use it.  But if this macro is used in GNU gettext, and GNU
   1072 	   dnl gettext is already preinstalled in libintl, we update this
   1073 	   dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
   1074 	   if test "$gt_cv_func_gnugettext_libc" = "yes" \
   1075 	      || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
   1076 		   && test "$PACKAGE" != gettext; }; then
   1077 	     AC_DEFINE(HAVE_GETTEXT, 1,
   1078                [Define if the GNU gettext() function is already present or preinstalled.])
   1079 
   1080 	     if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
   1081 	       dnl If iconv() is in a separate libiconv library, then anyone
   1082 	       dnl linking with libintl{.a,.so} also needs to link with
   1083 	       dnl libiconv.
   1084 	       INTLLIBS="-lintl $LIBICONV"
   1085 	     fi
   1086 
   1087 	     gt_save_LIBS="$LIBS"
   1088 	     LIBS="$LIBS $INTLLIBS"
   1089 	     AC_CHECK_FUNCS(dcgettext)
   1090 	     LIBS="$gt_save_LIBS"
   1091 
   1092 	     dnl Search for GNU msgfmt in the PATH.
   1093 	     AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
   1094 	       [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
   1095 	     AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
   1096 
   1097 	     dnl Search for GNU xgettext in the PATH.
   1098 	     AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
   1099 	       [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
   1100 
   1101 	     CATOBJEXT=.gmo
   1102 	   fi
   1103 	])
   1104 
   1105         if test "$CATOBJEXT" = "NONE"; then
   1106 	  dnl GNU gettext is not found in the C library.
   1107 	  dnl Fall back on GNU gettext library.
   1108 	  nls_cv_use_gnu_gettext=yes
   1109         fi
   1110       fi
   1111 
   1112       if test "$nls_cv_use_gnu_gettext" = "yes"; then
   1113         dnl Mark actions used to generate GNU NLS library.
   1114         INTLOBJS="\$(GETTOBJS)"
   1115         AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
   1116 	  [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
   1117         AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
   1118         AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
   1119 	  [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
   1120         AC_SUBST(MSGFMT)
   1121 	BUILD_INCLUDED_LIBINTL=yes
   1122 	USE_INCLUDED_LIBINTL=yes
   1123         CATOBJEXT=.gmo
   1124 	INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV"
   1125 	LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
   1126       fi
   1127 
   1128       dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
   1129       dnl Test whether we really found GNU msgfmt.
   1130       if test "$GMSGFMT" != ":"; then
   1131 	dnl If it is no GNU msgfmt we define it as : so that the
   1132 	dnl Makefiles still can work.
   1133 	if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then
   1134 	  : ;
   1135 	else
   1136 	  AC_MSG_RESULT(
   1137 	    [found msgfmt program is not GNU msgfmt; ignore it])
   1138 	  GMSGFMT=":"
   1139 	fi
   1140       fi
   1141 
   1142       dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
   1143       dnl Test whether we really found GNU xgettext.
   1144       if test "$XGETTEXT" != ":"; then
   1145 	dnl If it is no GNU xgettext we define it as : so that the
   1146 	dnl Makefiles still can work.
   1147 	if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then
   1148 	  : ;
   1149 	else
   1150 	  AC_MSG_RESULT(
   1151 	    [found xgettext program is not GNU xgettext; ignore it])
   1152 	  XGETTEXT=":"
   1153 	fi
   1154       fi
   1155 
   1156       dnl We need to process the po/ directory.
   1157       POSUB=po
   1158     fi
   1159     AC_OUTPUT_COMMANDS(
   1160      [for ac_file in $CONFIG_FILES; do
   1161         # Support "outfile[:infile[:infile...]]"
   1162         case "$ac_file" in
   1163           *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
   1164         esac
   1165         # PO directories have a Makefile.in generated from Makefile.in.in.
   1166         case "$ac_file" in */Makefile.in)
   1167           # Adjust a relative srcdir.
   1168           ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
   1169           ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
   1170           ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
   1171           # In autoconf-2.13 it is called $ac_given_srcdir.
   1172           # In autoconf-2.50 it is called $srcdir.
   1173           test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
   1174           case "$ac_given_srcdir" in
   1175             .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
   1176             /*) top_srcdir="$ac_given_srcdir" ;;
   1177             *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
   1178           esac
   1179           if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
   1180             rm -f "$ac_dir/POTFILES"
   1181             test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
   1182             sed -e "/^#/d" -e "/^[ 	]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
   1183             test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
   1184             sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
   1185           fi
   1186           ;;
   1187         esac
   1188       done])
   1189 
   1190 
   1191     dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
   1192     dnl to 'yes' because some of the testsuite requires it.
   1193     if test "$PACKAGE" = gettext; then
   1194       BUILD_INCLUDED_LIBINTL=yes
   1195     fi
   1196 
   1197     dnl intl/plural.c is generated from intl/plural.y. It requires bison,
   1198     dnl because plural.y uses bison specific features. It requires at least
   1199     dnl bison-1.26 because earlier versions generate a plural.c that doesn't
   1200     dnl compile.
   1201     dnl bison is only needed for the maintainer (who touches plural.y). But in
   1202     dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
   1203     dnl the rule in general Makefile. Now, some people carelessly touch the
   1204     dnl files or have a broken "make" program, hence the plural.c rule will
   1205     dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
   1206     dnl present or too old.
   1207     AC_CHECK_PROGS([INTLBISON], [bison])
   1208     if test -z "$INTLBISON"; then
   1209       ac_verc_fail=yes
   1210     else
   1211       dnl Found it, now check the version.
   1212       AC_MSG_CHECKING([version of bison])
   1213 changequote(<<,>>)dnl
   1214       ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
   1215       case $ac_prog_version in
   1216         '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
   1217         1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
   1218 changequote([,])dnl
   1219            ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
   1220         *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
   1221       esac
   1222       AC_MSG_RESULT([$ac_prog_version])
   1223     fi
   1224     if test $ac_verc_fail = yes; then
   1225       INTLBISON=:
   1226     fi
   1227 
   1228     dnl These rules are solely for the distribution goal.  While doing this
   1229     dnl we only have to keep exactly one list of the available catalogs
   1230     dnl in configure.in.
   1231     for lang in $ALL_LINGUAS; do
   1232       GMOFILES="$GMOFILES $lang.gmo"
   1233       POFILES="$POFILES $lang.po"
   1234     done
   1235 
   1236     dnl Make all variables we use known to autoconf.
   1237     AC_SUBST(BUILD_INCLUDED_LIBINTL)
   1238     AC_SUBST(USE_INCLUDED_LIBINTL)
   1239     AC_SUBST(CATALOGS)
   1240     AC_SUBST(CATOBJEXT)
   1241     AC_SUBST(GMOFILES)
   1242     AC_SUBST(INTLLIBS)
   1243     AC_SUBST(INTLOBJS)
   1244     AC_SUBST(POFILES)
   1245     AC_SUBST(POSUB)
   1246 
   1247     dnl For backward compatibility. Some configure.ins may be using this.
   1248     nls_cv_header_intl=
   1249     nls_cv_header_libgt=
   1250 
   1251     dnl For backward compatibility. Some Makefiles may be using this.
   1252     DATADIRNAME=share
   1253     AC_SUBST(DATADIRNAME)
   1254 
   1255     dnl For backward compatibility. Some Makefiles may be using this.
   1256     INSTOBJEXT=.mo
   1257     AC_SUBST(INSTOBJEXT)
   1258 
   1259     dnl For backward compatibility. Some Makefiles may be using this.
   1260     GENCAT=gencat
   1261     AC_SUBST(GENCAT)
   1262   ])
   1263 
   1264 dnl Usage: Just like AM_WITH_NLS, which see.
   1265 AC_DEFUN([AM_GNU_GETTEXT],
   1266   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
   1267    AC_REQUIRE([AC_PROG_CC])dnl
   1268    AC_REQUIRE([AC_CANONICAL_HOST])dnl
   1269    AC_REQUIRE([AC_PROG_RANLIB])dnl
   1270    AC_REQUIRE([AC_ISC_POSIX])dnl
   1271    AC_REQUIRE([AC_HEADER_STDC])dnl
   1272    AC_REQUIRE([AC_C_CONST])dnl
   1273    AC_REQUIRE([AC_C_INLINE])dnl
   1274    AC_REQUIRE([AC_TYPE_OFF_T])dnl
   1275    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
   1276    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
   1277    AC_REQUIRE([AC_FUNC_MMAP])dnl
   1278    AC_REQUIRE([jm_GLIBC21])dnl
   1279 
   1280    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
   1281 stdlib.h string.h unistd.h sys/param.h])
   1282    AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \
   1283 getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \
   1284 strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
   1285 
   1286    AM_ICONV
   1287    AM_LANGINFO_CODESET
   1288    AM_LC_MESSAGES
   1289    AM_WITH_NLS([$1],[$2],[$3])
   1290 
   1291    if test "x$CATOBJEXT" != "x"; then
   1292      if test "x$ALL_LINGUAS" = "x"; then
   1293        LINGUAS=
   1294      else
   1295        AC_MSG_CHECKING(for catalogs to be installed)
   1296        NEW_LINGUAS=
   1297        for presentlang in $ALL_LINGUAS; do
   1298          useit=no
   1299          for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do
   1300            # Use the presentlang catalog if desiredlang is
   1301            #   a. equal to presentlang, or
   1302            #   b. a variant of presentlang (because in this case,
   1303            #      presentlang can be used as a fallback for messages
   1304            #      which are not translated in the desiredlang catalog).
   1305            case "$desiredlang" in
   1306              "$presentlang"*) useit=yes;;
   1307            esac
   1308          done
   1309          if test $useit = yes; then
   1310            NEW_LINGUAS="$NEW_LINGUAS $presentlang"
   1311          fi
   1312        done
   1313        LINGUAS=$NEW_LINGUAS
   1314        AC_MSG_RESULT($LINGUAS)
   1315      fi
   1316 
   1317      dnl Construct list of names of catalog files to be constructed.
   1318      if test -n "$LINGUAS"; then
   1319        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
   1320      fi
   1321    fi
   1322 
   1323    dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
   1324    dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
   1325    dnl Try to locate is.
   1326    MKINSTALLDIRS=
   1327    if test -n "$ac_aux_dir"; then
   1328      MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
   1329    fi
   1330    if test -z "$MKINSTALLDIRS"; then
   1331      MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
   1332    fi
   1333    AC_SUBST(MKINSTALLDIRS)
   1334 
   1335    dnl Enable libtool support if the surrounding package wishes it.
   1336    INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
   1337    AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
   1338   ])
   1339 
   1340 # Search path for a program which passes the given test.
   1341 # Ulrich Drepper <drepper (a] cygnus.com>, 1996.
   1342 #
   1343 # This file can be copied and used freely without restrictions.  It can
   1344 # be used in projects which are not available under the GNU General Public
   1345 # License or the GNU Library General Public License but which still want
   1346 # to provide support for the GNU gettext functionality.
   1347 # Please note that the actual code of the GNU gettext library is covered
   1348 # by the GNU Library General Public License, and the rest of the GNU
   1349 # gettext package package is covered by the GNU General Public License.
   1350 # They are *not* in the public domain.
   1351 
   1352 # serial 2
   1353 
   1354 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
   1355 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
   1356 AC_DEFUN([AM_PATH_PROG_WITH_TEST],
   1357 [# Extract the first word of "$2", so it can be a program name with args.
   1358 set dummy $2; ac_word=[$]2
   1359 AC_MSG_CHECKING([for $ac_word])
   1360 AC_CACHE_VAL(ac_cv_path_$1,
   1361 [case "[$]$1" in
   1362   /*)
   1363   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
   1364   ;;
   1365   *)
   1366   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
   1367   for ac_dir in ifelse([$5], , $PATH, [$5]); do
   1368     test -z "$ac_dir" && ac_dir=.
   1369     if test -f $ac_dir/$ac_word; then
   1370       if [$3]; then
   1371 	ac_cv_path_$1="$ac_dir/$ac_word"
   1372 	break
   1373       fi
   1374     fi
   1375   done
   1376   IFS="$ac_save_ifs"
   1377 dnl If no 4th arg is given, leave the cache variable unset,
   1378 dnl so AC_PATH_PROGS will keep looking.
   1379 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
   1380 ])dnl
   1381   ;;
   1382 esac])dnl
   1383 $1="$ac_cv_path_$1"
   1384 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
   1385   AC_MSG_RESULT([$]$1)
   1386 else
   1387   AC_MSG_RESULT(no)
   1388 fi
   1389 AC_SUBST($1)dnl
   1390 ])
   1391 
   1392 #serial 1
   1393 # This test replaces the one in autoconf.
   1394 # Currently this macro should have the same name as the autoconf macro
   1395 # because gettext's gettext.m4 (distributed in the automake package)
   1396 # still uses it.  Otherwise, the use in gettext.m4 makes autoheader
   1397 # give these diagnostics:
   1398 #   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
   1399 #   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
   1400 
   1401 undefine([AC_ISC_POSIX])
   1402 
   1403 AC_DEFUN([AC_ISC_POSIX],
   1404   [
   1405     dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
   1406     AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
   1407   ]
   1408 )
   1409 
   1410 #serial 2
   1411 
   1412 # Test for the GNU C Library, version 2.1 or newer.
   1413 # From Bruno Haible.
   1414 
   1415 AC_DEFUN([jm_GLIBC21],
   1416   [
   1417     AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
   1418       ac_cv_gnu_library_2_1,
   1419       [AC_EGREP_CPP([Lucky GNU user],
   1420 	[
   1421 #include <features.h>
   1422 #ifdef __GNU_LIBRARY__
   1423  #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
   1424   Lucky GNU user
   1425  #endif
   1426 #endif
   1427 	],
   1428 	ac_cv_gnu_library_2_1=yes,
   1429 	ac_cv_gnu_library_2_1=no)
   1430       ]
   1431     )
   1432     AC_SUBST(GLIBC21)
   1433     GLIBC21="$ac_cv_gnu_library_2_1"
   1434   ]
   1435 )
   1436 
   1437 #serial AM2
   1438 
   1439 dnl From Bruno Haible.
   1440 
   1441 AC_DEFUN([AM_ICONV],
   1442 [
   1443   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
   1444   dnl those with the standalone portable GNU libiconv installed).
   1445 
   1446   AC_ARG_WITH([libiconv-prefix],
   1447 [  --with-libiconv-prefix=DIR  search for libiconv in DIR/include and DIR/lib], [
   1448     for dir in `echo "$withval" | tr : ' '`; do
   1449       if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
   1450       if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
   1451     done
   1452    ])
   1453 
   1454   AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
   1455     am_cv_func_iconv="no, consider installing GNU libiconv"
   1456     am_cv_lib_iconv=no
   1457     AC_TRY_LINK([#include <stdlib.h>
   1458 #include <iconv.h>],
   1459       [iconv_t cd = iconv_open("","");
   1460        iconv(cd,NULL,NULL,NULL,NULL);
   1461        iconv_close(cd);],
   1462       am_cv_func_iconv=yes)
   1463     if test "$am_cv_func_iconv" != yes; then
   1464       am_save_LIBS="$LIBS"
   1465       LIBS="$LIBS -liconv"
   1466       AC_TRY_LINK([#include <stdlib.h>
   1467 #include <iconv.h>],
   1468         [iconv_t cd = iconv_open("","");
   1469          iconv(cd,NULL,NULL,NULL,NULL);
   1470          iconv_close(cd);],
   1471         am_cv_lib_iconv=yes
   1472         am_cv_func_iconv=yes)
   1473       LIBS="$am_save_LIBS"
   1474     fi
   1475   ])
   1476   if test "$am_cv_func_iconv" = yes; then
   1477     AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
   1478     AC_MSG_CHECKING([for iconv declaration])
   1479     AC_CACHE_VAL(am_cv_proto_iconv, [
   1480       AC_TRY_COMPILE([
   1481 #include <stdlib.h>
   1482 #include <iconv.h>
   1483 extern
   1484 #ifdef __cplusplus
   1485 "C"
   1486 #endif
   1487 #if defined(__STDC__) || defined(__cplusplus)
   1488 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
   1489 #else
   1490 size_t iconv();
   1491 #endif
   1492 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
   1493       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);"])
   1494     am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
   1495     AC_MSG_RESULT([$]{ac_t:-
   1496          }[$]am_cv_proto_iconv)
   1497     AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
   1498       [Define as const if the declaration of iconv() needs const.])
   1499   fi
   1500   LIBICONV=
   1501   if test "$am_cv_lib_iconv" = yes; then
   1502     LIBICONV="-liconv"
   1503   fi
   1504   AC_SUBST(LIBICONV)
   1505 ])
   1506 
   1507 #serial AM1
   1508 
   1509 dnl From Bruno Haible.
   1510 
   1511 AC_DEFUN([AM_LANGINFO_CODESET],
   1512 [
   1513   AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
   1514     [AC_TRY_LINK([#include <langinfo.h>],
   1515       [char* cs = nl_langinfo(CODESET);],
   1516       am_cv_langinfo_codeset=yes,
   1517       am_cv_langinfo_codeset=no)
   1518     ])
   1519   if test $am_cv_langinfo_codeset = yes; then
   1520     AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
   1521       [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
   1522   fi
   1523 ])
   1524 
   1525 # Check whether LC_MESSAGES is available in <locale.h>.
   1526 # Ulrich Drepper <drepper (a] cygnus.com>, 1995.
   1527 #
   1528 # This file can be copied and used freely without restrictions.  It can
   1529 # be used in projects which are not available under the GNU General Public
   1530 # License or the GNU Library General Public License but which still want
   1531 # to provide support for the GNU gettext functionality.
   1532 # Please note that the actual code of the GNU gettext library is covered
   1533 # by the GNU Library General Public License, and the rest of the GNU
   1534 # gettext package package is covered by the GNU General Public License.
   1535 # They are *not* in the public domain.
   1536 
   1537 # serial 2
   1538 
   1539 AC_DEFUN([AM_LC_MESSAGES],
   1540   [if test $ac_cv_header_locale_h = yes; then
   1541     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
   1542       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
   1543        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
   1544     if test $am_cv_val_LC_MESSAGES = yes; then
   1545       AC_DEFINE(HAVE_LC_MESSAGES, 1,
   1546         [Define if your <locale.h> file defines LC_MESSAGES.])
   1547     fi
   1548   fi])
   1549 
   1550 # Check to see if we use dir\file name conventtion
   1551 # If so, set macro HAVE_DOS_FILE_NAMES
   1552 # Also set the macro HAVE_DOS_FILE_CONTENTS for now,
   1553 # since don't know of a good way to independently check this.
   1554 dnl AC_DOSFILE()
   1555 AC_DEFUN(AC_DOSFILE,
   1556 [
   1557   AC_CACHE_CHECK([for dos file convention], ac_cv_dosfile,
   1558     [if test -d ".\."; then
   1559        ac_cv_dosfile=yes
   1560     else
   1561        ac_cv_dosfile=no
   1562     fi
   1563     ])
   1564 
   1565   if test $ac_cv_dosfile = yes; then
   1566     AC_DEFINE(HAVE_DOS_FILE_NAMES, 1, [Define if your OS uses backslashes as directory separators])
   1567     AC_DEFINE(HAVE_DOS_FILE_CONTENTS, 1,
   1568       [Define if text file lines end in CRLF.])
   1569   fi
   1570 ])
   1571 
   1572 # Check to see the separator for the environment variables
   1573 # and set SEP to ";" or default ":"
   1574 
   1575 dnl AM_SEP()
   1576 dnl SEP
   1577 AC_DEFUN(AM_SEP,
   1578 [AC_REQUIRE([AC_CYGWIN])
   1579 AC_REQUIRE([AC_MINGW32])
   1580 AC_REQUIRE([AC_DJGPP])
   1581 AC_MSG_CHECKING([for environ variable separator])
   1582 AC_CACHE_VAL(ac_cv_sep,
   1583 [if test "$CYGWIN" = yes || test "$MINGW32" = yes || test "$DJ_GPP" = yes ; then
   1584   ac_cv_sep=yes
   1585 else
   1586   ac_cv_sep=no
   1587 fi])
   1588 SEP=":"
   1589 test x"$ac_cv_sep" = xyes && SEP=";"
   1590 AC_MSG_RESULT(${SEP})
   1591 AC_SUBST(SEP)])
   1592 
   1593 dnl Check for DJGPP. we use DJ_GPP as the variable
   1594 dnl EXEEXXT
   1595 AC_DEFUN(AC_DJGPP,
   1596 [AC_CACHE_CHECK(for DJGPP environment, ac_cv_djgpp,
   1597 [AC_TRY_COMPILE(,[ return __DJGPP__;],
   1598 ac_cv_djgpp=yes, ac_cv_djgpp=no)
   1599 rm -f conftest*])
   1600 DJ_GPP=
   1601 test "$ac_cv_djgpp" = yes && DJ_GPP=yes])
   1602 
   1603 #serial 5001
   1604 
   1605 dnl Initially derived from code in GNU grep.
   1606 dnl Mostly written by Jim Meyering.
   1607 
   1608 dnl Usage: jm_INCLUDED_REGEX([lib/regex.c])
   1609 dnl
   1610 AC_DEFUN(jm_INCLUDED_REGEX,
   1611   [
   1612     dnl Even packages that don't use regex.c can use this macro.
   1613     dnl Of course, for them it doesn't do anything.
   1614 
   1615     # Assume we'll default to using the included regex.c.
   1616     ac_use_included_regex=yes
   1617 
   1618     # However, if the system regex support is good enough that it passes the
   1619     # the following run test, then default to *not* using the included regex.c.
   1620     # If cross compiling, assume the test would fail and use the included
   1621     # regex.c.  The first failing regular expression is from `Spencer ere
   1622     # test #75' in grep-2.3.
   1623     AC_CACHE_CHECK([for working re_compile_pattern],
   1624 		   jm_cv_func_working_re_compile_pattern,
   1625       AC_TRY_RUN(
   1626 	changequote(<<, >>)dnl
   1627 	<<
   1628 #include <stdio.h>
   1629 #include <regex.h>
   1630 	  int
   1631 	  main ()
   1632 	  {
   1633 	    static struct re_pattern_buffer regex;
   1634 	    const char *s;
   1635 	    re_set_syntax (RE_SYNTAX_POSIX_EGREP);
   1636 	    /* Add this third left square bracket, [, to balance the
   1637 	       three right ones below.  Otherwise autoconf-2.14 chokes.  */
   1638 	    s = re_compile_pattern ("a[[:]:]]b\n", 9, &regex);
   1639 	    /* This should fail with _Invalid character class name_ error.  */
   1640 	    if (!s)
   1641 	      exit (1);
   1642 
   1643 	    /* This should succeed, but doesn't for e.g. glibc-2.1.3.  */
   1644 	    s = re_compile_pattern ("{1", 2, &regex);
   1645 
   1646 	   exit (s ? 1 : 0);
   1647 	  }
   1648 	>>,
   1649 	changequote([, ])dnl
   1650 
   1651 	       jm_cv_func_working_re_compile_pattern=yes,
   1652 	       jm_cv_func_working_re_compile_pattern=no,
   1653 	       dnl When crosscompiling, assume it's broken.
   1654 	       jm_cv_func_working_re_compile_pattern=no))
   1655     if test $jm_cv_func_working_re_compile_pattern = yes; then
   1656       ac_use_included_regex=no
   1657     fi
   1658 
   1659     test -n "$1" || AC_MSG_ERROR([missing argument])
   1660     syscmd([test -f $1])
   1661     ifelse(sysval, 0,
   1662       [
   1663 
   1664 	AC_ARG_WITH(included-regex,
   1665 	[  --without-included-regex don't compile regex; this is the default on
   1666                           systems with version 2 of the GNU C library
   1667                           (use with caution on other system)],
   1668 		    jm_with_regex=$withval,
   1669 		    jm_with_regex=$ac_use_included_regex)
   1670 	if test "$jm_with_regex" = yes; then
   1671 	  AC_LIBOBJ(regex)
   1672 	fi
   1673       ],
   1674     )
   1675   ]
   1676 )
   1677 
   1678 #serial 1002, but ported to autoconf 2.13 by eggert
   1679 # Experimental replacement for the function in the latest CVS autoconf.
   1680 # If the compile-test says strerror_r doesn't work, then resort to a
   1681 # `run'-test that works on BeOS and segfaults on DEC Unix.
   1682 # Use with the error.c file in ../lib.
   1683 
   1684 undefine([AC_FUNC_STRERROR_R])
   1685 
   1686 # AC_FUNC_STRERROR_R
   1687 # ------------------
   1688 AC_DEFUN([AC_FUNC_STRERROR_R],
   1689 [jm_CHECK_DECLARATION(strerror_r, [#include <string.h>])
   1690 test $jm_cv_func_decl_strerror_r != yes
   1691 AC_DEFINE_UNQUOTED(HAVE_DECL_STRERROR_R, $?,
   1692   [Define to 1 if strerror_r is declared.])
   1693 AC_CHECK_FUNCS([strerror_r])
   1694 if test $ac_cv_func_strerror_r = yes; then
   1695   AC_CHECK_HEADERS(string.h)
   1696   AC_CACHE_CHECK([for working strerror_r],
   1697 		 ac_cv_func_strerror_r_works,
   1698    [
   1699     AC_TRY_COMPILE(
   1700      [
   1701 #       include <stdio.h>
   1702 #       if HAVE_STRING_H
   1703 #        include <string.h>
   1704 #       endif
   1705      ],
   1706      [
   1707        char buf[100];
   1708        char x = *strerror_r (0, buf, sizeof buf);
   1709      ],
   1710      ac_cv_func_strerror_r_works=yes,
   1711      ac_cv_func_strerror_r_works=no
   1712     )
   1713     if test $ac_cv_func_strerror_r_works = no; then
   1714       # strerror_r seems not to work, but now we have to choose between
   1715       # systems that have relatively inaccessible declarations for the
   1716       # function.  BeOS and DEC UNIX 4.0 fall in this category, but the
   1717       # former has a strerror_r that returns char*, while the latter
   1718       # has a strerror_r that returns int.
   1719       # This test should segfault on the DEC system.
   1720       AC_TRY_RUN(
   1721        [
   1722 #       include <stdio.h>
   1723 #       include <string.h>
   1724 #       include <ctype.h>
   1725 
   1726 	extern char *strerror_r ();
   1727 
   1728 	int
   1729 	main ()
   1730 	{
   1731 	  char buf[100];
   1732 	  char x = *strerror_r (0, buf, sizeof buf);
   1733 	  exit (!isalpha (x));
   1734 	}
   1735        ],
   1736        ac_cv_func_strerror_r_works=yes,
   1737        ac_cv_func_strerror_r_works=no,
   1738        ac_cv_func_strerror_r_works=no)
   1739     fi
   1740   ])
   1741   if test $ac_cv_func_strerror_r_works = yes; then
   1742     AC_DEFINE_UNQUOTED(HAVE_WORKING_STRERROR_R, 1,
   1743       [Define to 1 if strerror_r returns a string.])
   1744   fi
   1745 fi
   1746 ])# AC_FUNC_STRERROR_R
   1747 
   1748 #serial 1
   1749 
   1750 dnl FIXME: put these prerequisite-only *.m4 files in a separate
   1751 dnl directory -- otherwise, they'll conflict with existing files.
   1752 
   1753 dnl These are the prerequisite macros for GNU's error.c file.
   1754 AC_DEFUN(jm_PREREQ_ERROR,
   1755 [
   1756   AC_CHECK_FUNCS(strerror strerror_r vprintf doprnt)
   1757   AC_HEADER_STDC
   1758 ])
   1759 
   1760 #serial 3
   1761 
   1762 dnl From Jim Meyering.
   1763 dnl Determine whether malloc accepts 0 as its argument.
   1764 dnl If it doesn't, arrange to use the replacement function.
   1765 dnl
   1766 
   1767 AC_DEFUN(jm_FUNC_MALLOC,
   1768 [
   1769  dnl xmalloc.c requires that this symbol be defined so it doesn't
   1770  dnl mistakenly use a broken malloc -- as it might if this test were omitted.
   1771  AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_MALLOC_CHECK, 1,
   1772                     [Define if the malloc check has been performed. ])
   1773 
   1774  AC_CACHE_CHECK([for working malloc], jm_cv_func_working_malloc,
   1775   [AC_TRY_RUN([
   1776     char *malloc ();
   1777     int
   1778     main ()
   1779     {
   1780       exit (malloc (0) ? 0 : 1);
   1781     }
   1782 	  ],
   1783 	 jm_cv_func_working_malloc=yes,
   1784 	 jm_cv_func_working_malloc=no,
   1785 	 dnl When crosscompiling, assume malloc is broken.
   1786 	 jm_cv_func_working_malloc=no)
   1787   ])
   1788   if test $jm_cv_func_working_malloc = no; then
   1789     AC_LIBOBJ(malloc)
   1790     AC_DEFINE_UNQUOTED(malloc, rpl_malloc,
   1791       [Define to rpl_malloc if the replacement function should be used.])
   1792   fi
   1793 ])
   1794 
   1795 #serial 3
   1796 
   1797 dnl From Jim Meyering.
   1798 dnl Determine whether realloc works when both arguments are 0.
   1799 dnl If it doesn't, arrange to use the replacement function.
   1800 dnl
   1801 
   1802 AC_DEFUN(jm_FUNC_REALLOC,
   1803 [
   1804  dnl xmalloc.c requires that this symbol be defined so it doesn't
   1805  dnl mistakenly use a broken realloc -- as it might if this test were omitted.
   1806  AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_REALLOC_CHECK, 1,
   1807                     [Define if the realloc check has been performed. ])
   1808 
   1809  AC_CACHE_CHECK([for working realloc], jm_cv_func_working_realloc,
   1810   [AC_TRY_RUN([
   1811     char *realloc ();
   1812     int
   1813     main ()
   1814     {
   1815       exit (realloc (0, 0) ? 0 : 1);
   1816     }
   1817 	  ],
   1818 	 jm_cv_func_working_realloc=yes,
   1819 	 jm_cv_func_working_realloc=no,
   1820 	 dnl When crosscompiling, assume realloc is broken.
   1821 	 jm_cv_func_working_realloc=no)
   1822   ])
   1823   if test $jm_cv_func_working_realloc = no; then
   1824     AC_LIBOBJ(realloc)
   1825     AC_DEFINE_UNQUOTED(realloc, rpl_realloc,
   1826       [Define to rpl_realloc if the replacement function should be used.])
   1827   fi
   1828 ])
   1829 
   1830