aclocal.m4 revision 8b22bf3f
11.22Sitojun# generated automatically by aclocal 1.10 -*- Autoconf -*-
21.22Sitojun
31.3Sthorpej# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
41.2Sitojun# 2005, 2006  Free Software Foundation, Inc.
51.2Sitojun# This file is free software; the Free Software Foundation
61.2Sitojun# gives unlimited permission to copy and/or distribute it,
71.10Sitojun# with or without modifications, as long as this notice is preserved.
81.2Sitojun
91.2Sitojun# This program is distributed in the hope that it will be useful,
101.2Sitojun# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
111.2Sitojun# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
121.2Sitojun# PARTICULAR PURPOSE.
131.2Sitojun
141.2Sitojunm4_if(m4_PACKAGE_VERSION, [2.61],,
151.2Sitojun[m4_fatal([this file was generated for autoconf 2.61.
161.2SitojunYou have another version of autoconf.  If you want to use that,
171.2Sitojunyou should regenerate the build system entirely.], [63])])
181.2Sitojun
191.10Sitojun# Copyright (C) 2002, 2003, 2005, 2006  Free Software Foundation, Inc.
201.2Sitojun#
211.2Sitojun# This file is free software; the Free Software Foundation
221.2Sitojun# gives unlimited permission to copy and/or distribute it,
231.2Sitojun# with or without modifications, as long as this notice is preserved.
241.2Sitojun
251.2Sitojun# AM_AUTOMAKE_VERSION(VERSION)
261.2Sitojun# ----------------------------
271.2Sitojun# Automake X.Y traces this macro to ensure aclocal.m4 has been
281.2Sitojun# generated from the m4 files accompanying Automake X.Y.
291.2Sitojun# (This private macro should not be called outside this file.)
301.2SitojunAC_DEFUN([AM_AUTOMAKE_VERSION],
311.2Sitojun[am__api_version='1.10'
321.2Sitojundnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
331.15Sitojundnl require some minimum version.  Point them to the right macro.
341.20Sitojunm4_if([$1], [1.10], [],
351.15Sitojun      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
361.2Sitojun])
371.2Sitojun
381.2Sitojun# _AM_AUTOCONF_VERSION(VERSION)
391.2Sitojun# -----------------------------
401.2Sitojun# aclocal traces this macro to find the Autoconf version.
411.2Sitojun# This is a private macro too.  Using m4_define simplifies
421.2Sitojun# the logic in aclocal, which can simply ignore this definition.
431.2Sitojunm4_define([_AM_AUTOCONF_VERSION], [])
441.2Sitojun
451.2Sitojun# AM_SET_CURRENT_AUTOMAKE_VERSION
461.2Sitojun# -------------------------------
471.2Sitojun# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
481.2Sitojun# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
491.2SitojunAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
501.2Sitojun[AM_AUTOMAKE_VERSION([1.10])dnl
511.2Sitojun_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)])
521.2Sitojun
531.7Sitojun# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
541.8Sitojun
551.2Sitojun# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
561.8Sitojun#
571.5Sitojun# This file is free software; the Free Software Foundation
581.5Sitojun# gives unlimited permission to copy and/or distribute it,
591.15Sitojun# with or without modifications, as long as this notice is preserved.
601.5Sitojun
611.5Sitojun# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
621.15Sitojun# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
631.5Sitojun# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
641.20Sitojun#
651.20Sitojun# Of course, Automake must honor this variable whenever it calls a
661.20Sitojun# tool from the auxiliary directory.  The problem is that $srcdir (and
671.20Sitojun# therefore $ac_aux_dir as well) can be either absolute or relative,
681.5Sitojun# depending on how configure is run.  This is pretty annoying, since
691.2Sitojun# it makes $ac_aux_dir quite unusable in subdirectories: in the top
701.2Sitojun# source directory, any form will work fine, but in subdirectories a
711.2Sitojun# relative path needs to be adjusted first.
721.20Sitojun#
731.20Sitojun# $ac_aux_dir/missing
741.20Sitojun#    fails when called from a subdirectory if $ac_aux_dir is relative
751.20Sitojun# $top_srcdir/$ac_aux_dir/missing
761.2Sitojun#    fails if $ac_aux_dir is absolute,
771.2Sitojun#    fails when called from a subdirectory in a VPATH build with
781.2Sitojun#          a relative $ac_aux_dir
791.2Sitojun#
801.2Sitojun# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
811.2Sitojun# are both prefixed by $srcdir.  In an in-source build this is usually
821.2Sitojun# harmless because $srcdir is `.', but things will broke when you
831.2Sitojun# start a VPATH build or use an absolute $srcdir.
841.2Sitojun#
851.2Sitojun# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
861.2Sitojun# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
871.2Sitojun#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
881.2Sitojun# and then we would define $MISSING as
891.2Sitojun#   MISSING="\${SHELL} $am_aux_dir/missing"
901.2Sitojun# This will work as long as MISSING is not called from configure, because
911.2Sitojun# unfortunately $(top_srcdir) has no meaning in configure.
921.2Sitojun# However there are other variables, like CC, which are often used in
931.2Sitojun# configure, and could therefore not use this "fixed" $ac_aux_dir.
941.5Sitojun#
951.18Sitojun# Another solution, used here, is to always expand $ac_aux_dir to an
961.18Sitojun# absolute PATH.  The drawback is that using absolute paths prevent a
971.2Sitojun# configured tree to be moved without reconfiguration.
981.5Sitojun
991.10SitojunAC_DEFUN([AM_AUX_DIR_EXPAND],
1001.15Sitojun[dnl Rely on autoconf to set up CDPATH properly.
1011.5SitojunAC_PREREQ([2.50])dnl
1021.5Sitojun# expand $ac_aux_dir to an absolute path
1031.5Sitojunam_aux_dir=`cd $ac_aux_dir && pwd`
1041.5Sitojun])
1051.15Sitojun
1061.5Sitojun# AM_CONDITIONAL                                            -*- Autoconf -*-
1071.5Sitojun
1081.5Sitojun# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
1091.5Sitojun# Free Software Foundation, Inc.
1101.5Sitojun#
1111.5Sitojun# This file is free software; the Free Software Foundation
1121.5Sitojun# gives unlimited permission to copy and/or distribute it,
1131.5Sitojun# with or without modifications, as long as this notice is preserved.
1141.5Sitojun
1151.5Sitojun# serial 8
1161.5Sitojun
1171.5Sitojun# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1181.15Sitojun# -------------------------------------
1191.2Sitojun# Define a conditional.
1201.16SitojunAC_DEFUN([AM_CONDITIONAL],
1211.16Sitojun[AC_PREREQ(2.52)dnl
1221.16Sitojun ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1231.16Sitojun	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1241.16SitojunAC_SUBST([$1_TRUE])dnl
1251.16SitojunAC_SUBST([$1_FALSE])dnl
1261.9Sitojun_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1271.16Sitojun_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1281.16Sitojunif $2; then
1291.2Sitojun  $1_TRUE=
1301.5Sitojun  $1_FALSE='#'
1311.2Sitojunelse
1321.2Sitojun  $1_TRUE='#'
1331.2Sitojun  $1_FALSE=
1341.2Sitojunfi
1351.2SitojunAC_CONFIG_COMMANDS_PRE(
1361.9Sitojun[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1371.9Sitojun  AC_MSG_ERROR([[conditional "$1" was never defined.
1381.2SitojunUsually this means the macro was only invoked conditionally.]])
1391.5Sitojunfi])])
1401.2Sitojun
1411.2Sitojun# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
1421.2Sitojun# Free Software Foundation, Inc.
1431.2Sitojun#
1441.2Sitojun# This file is free software; the Free Software Foundation
1451.2Sitojun# gives unlimited permission to copy and/or distribute it,
1461.5Sitojun# with or without modifications, as long as this notice is preserved.
1471.2Sitojun
1481.2Sitojun# serial 9
1491.2Sitojun
1501.2Sitojun# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
1511.2Sitojun# written in clear, in which case automake, when reading aclocal.m4,
1521.2Sitojun# will think it sees a *use*, and therefore will trigger all it's
1531.5Sitojun# C support machinery.  Also note that it means that autoscan, seeing
1541.5Sitojun# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1551.5Sitojun
1561.5Sitojun
1571.5Sitojun# _AM_DEPENDENCIES(NAME)
1581.5Sitojun# ----------------------
1591.5Sitojun# See how the compiler implements dependency checking.
1601.5Sitojun# NAME is "CC", "CXX", "GCJ", or "OBJC".
1611.5Sitojun# We try a few techniques and use that to set a single cache variable.
1621.5Sitojun#
1631.5Sitojun# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1641.15Sitojun# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1651.5Sitojun# dependency, and given that the user is not expected to run this macro,
1661.17Sitojun# just rely on AC_PROG_CC.
1671.17SitojunAC_DEFUN([_AM_DEPENDENCIES],
1681.5Sitojun[AC_REQUIRE([AM_SET_DEPDIR])dnl
1691.5SitojunAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1701.5SitojunAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1711.5SitojunAC_REQUIRE([AM_DEP_TRACK])dnl
1721.5Sitojun
1731.5Sitojunifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
1741.5Sitojun       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
1751.5Sitojun       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1761.5Sitojun       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
1771.5Sitojun       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1781.5Sitojun                   [depcc="$$1"   am_compiler_list=])
1791.5Sitojun
1801.5SitojunAC_CACHE_CHECK([dependency style of $depcc],
1811.5Sitojun               [am_cv_$1_dependencies_compiler_type],
1821.5Sitojun[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1831.5Sitojun  # We make a subdir and do the tests there.  Otherwise we can end up
1841.5Sitojun  # making bogus files that we don't know about and never remove.  For
1851.5Sitojun  # instance it was reported that on HP-UX the gcc test will end up
1861.5Sitojun  # making a dummy file named `D' -- because `-MD' means `put the output
1871.5Sitojun  # in D'.
1881.5Sitojun  mkdir conftest.dir
1891.5Sitojun  # Copy depcomp to subdir because otherwise we won't find it if we're
1901.5Sitojun  # using a relative directory.
1911.5Sitojun  cp "$am_depcomp" conftest.dir
1921.5Sitojun  cd conftest.dir
1931.5Sitojun  # We will build objects and dependencies in a subdirectory because
1941.5Sitojun  # it helps to detect inapplicable dependency modes.  For instance
1951.5Sitojun  # both Tru64's cc and ICC support -MD to output dependencies as a
1961.5Sitojun  # side effect of compilation, but ICC will put the dependencies in
1971.5Sitojun  # the current directory while Tru64 will put them in the object
1981.5Sitojun  # directory.
1991.5Sitojun  mkdir sub
2001.5Sitojun
2011.5Sitojun  am_cv_$1_dependencies_compiler_type=none
2021.5Sitojun  if test "$am_compiler_list" = ""; then
2031.5Sitojun     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2041.5Sitojun  fi
2051.5Sitojun  for depmode in $am_compiler_list; do
2061.5Sitojun    # Setup a source with many dependencies, because some compilers
2071.5Sitojun    # like to wrap large dependency lists on column 80 (with \), and
2081.13Sitojun    # we should not choose a depcomp mode which is confused by this.
2091.5Sitojun    #
2101.5Sitojun    # We need to recreate these files for each test, as the compiler may
2111.5Sitojun    # overwrite some of them when testing with obscure command lines.
2121.5Sitojun    # This happens at least with the AIX C compiler.
2131.5Sitojun    : > sub/conftest.c
2141.5Sitojun    for i in 1 2 3 4 5 6; do
2151.5Sitojun      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2161.5Sitojun      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
2171.5Sitojun      # Solaris 8's {/usr,}/bin/sh.
2181.5Sitojun      touch sub/conftst$i.h
2191.5Sitojun    done
2201.5Sitojun    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2211.5Sitojun
2221.5Sitojun    case $depmode in
2231.5Sitojun    nosideeffect)
2241.5Sitojun      # after this tag, mechanisms are not by side-effect, so they'll
2251.5Sitojun      # only be used when explicitly requested
2261.5Sitojun      if test "x$enable_dependency_tracking" = xyes; then
2271.5Sitojun	continue
2281.5Sitojun      else
2291.5Sitojun	break
2301.5Sitojun      fi
2311.5Sitojun      ;;
2321.5Sitojun    none) break ;;
2331.5Sitojun    esac
2341.5Sitojun    # We check with `-c' and `-o' for the sake of the "dashmstdout"
2351.5Sitojun    # mode.  It turns out that the SunPro C++ compiler does not properly
2361.5Sitojun    # handle `-M -o', and we need to detect this.
2371.5Sitojun    if depmode=$depmode \
2381.5Sitojun       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
2391.5Sitojun       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2401.5Sitojun       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
2411.5Sitojun         >/dev/null 2>conftest.err &&
2421.5Sitojun       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2431.5Sitojun       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2441.5Sitojun       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
2451.5Sitojun       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2461.5Sitojun      # icc doesn't choke on unknown options, it will just issue warnings
2471.5Sitojun      # or remarks (even with -Werror).  So we grep stderr for any message
2481.5Sitojun      # that says an option was ignored or not supported.
2491.5Sitojun      # When given -MP, icc 7.0 and 7.1 complain thusly:
2501.5Sitojun      #   icc: Command line warning: ignoring option '-M'; no argument required
2511.5Sitojun      # The diagnosis changed in icc 8.0:
2521.5Sitojun      #   icc: Command line remark: option '-MP' not supported
2531.5Sitojun      if (grep 'ignoring option' conftest.err ||
2541.5Sitojun          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2551.5Sitojun        am_cv_$1_dependencies_compiler_type=$depmode
2561.5Sitojun        break
2571.5Sitojun      fi
2581.5Sitojun    fi
2591.5Sitojun  done
2601.5Sitojun
2611.5Sitojun  cd ..
2621.5Sitojun  rm -rf conftest.dir
2631.5Sitojunelse
2641.5Sitojun  am_cv_$1_dependencies_compiler_type=none
2651.5Sitojunfi
2661.5Sitojun])
2671.5SitojunAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2681.5SitojunAM_CONDITIONAL([am__fastdep$1], [
2691.5Sitojun  test "x$enable_dependency_tracking" != xno \
2701.5Sitojun  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2711.5Sitojun])
2721.5Sitojun
2731.5Sitojun
2741.5Sitojun# AM_SET_DEPDIR
2751.5Sitojun# -------------
2761.5Sitojun# Choose a directory name for dependency files.
2771.5Sitojun# This macro is AC_REQUIREd in _AM_DEPENDENCIES
2781.5SitojunAC_DEFUN([AM_SET_DEPDIR],
2791.5Sitojun[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
2801.5SitojunAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
2811.5Sitojun])
2821.5Sitojun
2831.5Sitojun
2841.5Sitojun# AM_DEP_TRACK
2851.5Sitojun# ------------
2861.5SitojunAC_DEFUN([AM_DEP_TRACK],
2871.5Sitojun[AC_ARG_ENABLE(dependency-tracking,
2881.5Sitojun[  --disable-dependency-tracking  speeds up one-time build
2891.5Sitojun  --enable-dependency-tracking   do not reject slow dependency extractors])
2901.15Sitojunif test "x$enable_dependency_tracking" != xno; then
2911.5Sitojun  am_depcomp="$ac_aux_dir/depcomp"
2921.2Sitojun  AMDEPBACKSLASH='\'
2931.2Sitojunfi
2941.2SitojunAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
2951.2SitojunAC_SUBST([AMDEPBACKSLASH])dnl
2961.2Sitojun_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
2971.2Sitojun])
2981.2Sitojun
2991.2Sitojun# Generate code to set up dependency tracking.              -*- Autoconf -*-
3001.2Sitojun
3011.2Sitojun# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
3021.2Sitojun# Free Software Foundation, Inc.
3031.2Sitojun#
3041.5Sitojun# This file is free software; the Free Software Foundation
3051.2Sitojun# gives unlimited permission to copy and/or distribute it,
3061.13Sitojun# with or without modifications, as long as this notice is preserved.
3071.2Sitojun
3081.2Sitojun#serial 3
3091.5Sitojun
3101.5Sitojun# _AM_OUTPUT_DEPENDENCY_COMMANDS
3111.5Sitojun# ------------------------------
3121.5SitojunAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3131.5Sitojun[for mf in $CONFIG_FILES; do
3141.5Sitojun  # Strip MF so we end up with the name of the file.
3151.2Sitojun  mf=`echo "$mf" | sed -e 's/:.*$//'`
3161.2Sitojun  # Check whether this is an Automake generated Makefile or not.
3171.2Sitojun  # We used to match only the files named `Makefile.in', but
3181.2Sitojun  # some people rename them; so instead we look at the file content.
3191.2Sitojun  # Grep'ing the first line is not enough: some people post-process
3201.2Sitojun  # each Makefile.in and add a new line on top of each file to say so.
3211.2Sitojun  # Grep'ing the whole file is not good either: AIX grep has a line
3221.2Sitojun  # limit of 2048, but all sed's we know have understand at least 4000.
3231.2Sitojun  if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
3241.2Sitojun    dirpart=`AS_DIRNAME("$mf")`
3251.2Sitojun  else
3261.2Sitojun    continue
3271.2Sitojun  fi
3281.2Sitojun  # Extract the definition of DEPDIR, am__include, and am__quote
3291.2Sitojun  # from the Makefile without running `make'.
3301.2Sitojun  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
3311.5Sitojun  test -z "$DEPDIR" && continue
3321.5Sitojun  am__include=`sed -n 's/^am__include = //p' < "$mf"`
3331.5Sitojun  test -z "am__include" && continue
3341.5Sitojun  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
3351.5Sitojun  # When using ansi2knr, U may be empty or an underscore; expand it
3361.5Sitojun  U=`sed -n 's/^U = //p' < "$mf"`
3371.2Sitojun  # Find all dependency output files, they are included files with
3381.2Sitojun  # $(DEPDIR) in their names.  We invoke sed twice because it is the
3391.2Sitojun  # simplest approach to changing $(DEPDIR) to its actual value in the
3401.2Sitojun  # expansion.
3411.9Sitojun  for file in `sed -n "
3421.9Sitojun    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
3431.9Sitojun       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
3441.9Sitojun    # Make sure the directory exists.
3451.9Sitojun    test -f "$dirpart/$file" && continue
3461.9Sitojun    fdir=`AS_DIRNAME(["$file"])`
3471.9Sitojun    AS_MKDIR_P([$dirpart/$fdir])
3481.9Sitojun    # echo "creating $dirpart/$file"
3491.9Sitojun    echo '# dummy' > "$dirpart/$file"
3501.9Sitojun  done
3511.9Sitojundone
3521.9Sitojun])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3531.9Sitojun
3541.9Sitojun
3551.9Sitojun# AM_OUTPUT_DEPENDENCY_COMMANDS
3561.9Sitojun# -----------------------------
3571.9Sitojun# This macro should only be invoked once -- use via AC_REQUIRE.
3581.9Sitojun#
3591.9Sitojun# This code is only required when automatic dependency tracking
3601.9Sitojun# is enabled.  FIXME.  This creates each `.P' file that we will
3611.9Sitojun# need in order to bootstrap the dependency handling code.
3621.9SitojunAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
3631.9Sitojun[AC_CONFIG_COMMANDS([depfiles],
3641.9Sitojun     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
3651.9Sitojun     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
3661.9Sitojun])
3671.9Sitojun
3681.9Sitojun# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
3691.9Sitojun# Free Software Foundation, Inc.
3701.9Sitojun#
3711.9Sitojun# This file is free software; the Free Software Foundation
3721.5Sitojun# gives unlimited permission to copy and/or distribute it,
3731.5Sitojun# with or without modifications, as long as this notice is preserved.
3741.5Sitojun
3751.5Sitojun# serial 8
3761.15Sitojun
3771.7Sitojun# AM_CONFIG_HEADER is obsolete.  It has been replaced by AC_CONFIG_HEADERS.
3781.7SitojunAU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
3791.7Sitojun
3801.7Sitojun# Do all the work for Automake.                             -*- Autoconf -*-
3811.5Sitojun
3821.5Sitojun# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
3831.15Sitojun# 2005, 2006 Free Software Foundation, Inc.
3841.7Sitojun#
3851.7Sitojun# This file is free software; the Free Software Foundation
3861.7Sitojun# gives unlimited permission to copy and/or distribute it,
3871.7Sitojun# with or without modifications, as long as this notice is preserved.
3881.7Sitojun
3891.7Sitojun# serial 12
3901.7Sitojun
3911.7Sitojun# This macro actually does too much.  Some checks are only needed if
3921.7Sitojun# your package does certain things.  But this isn't really a big deal.
3931.7Sitojun
3941.7Sitojun# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
3951.7Sitojun# AM_INIT_AUTOMAKE([OPTIONS])
3961.7Sitojun# -----------------------------------------------
3971.7Sitojun# The call with PACKAGE and VERSION arguments is the old style
3981.7Sitojun# call (pre autoconf-2.50), which is being phased out.  PACKAGE
3991.7Sitojun# and VERSION should now be passed to AC_INIT and removed from
4001.7Sitojun# the call to AM_INIT_AUTOMAKE.
4011.10Sitojun# We support both call styles for the transition.  After
4021.7Sitojun# the next Automake release, Autoconf can make the AC_INIT
4031.7Sitojun# arguments mandatory, and then we can depend on a new Autoconf
4041.7Sitojun# release and drop the old call support.
4051.7SitojunAC_DEFUN([AM_INIT_AUTOMAKE],
4061.7Sitojun[AC_PREREQ([2.60])dnl
4071.5Sitojundnl Autoconf wants to disallow AM_ names.  We explicitly allow
4081.5Sitojundnl the ones we care about.
4091.5Sitojunm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4101.2SitojunAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4111.2SitojunAC_REQUIRE([AC_PROG_INSTALL])dnl
4121.2Sitojunif test "`cd $srcdir && pwd`" != "`pwd`"; then
4131.2Sitojun  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4141.2Sitojun  # is not polluted with repeated "-I."
4151.2Sitojun  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4161.2Sitojun  # test to see if srcdir already configured
4171.2Sitojun  if test -f $srcdir/config.status; then
4181.2Sitojun    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4191.2Sitojun  fi
4201.2Sitojunfi
4211.2Sitojun
4221.2Sitojun# test whether we have cygpath
4231.2Sitojunif test -z "$CYGPATH_W"; then
4241.2Sitojun  if (cygpath --version) >/dev/null 2>/dev/null; then
4251.2Sitojun    CYGPATH_W='cygpath -w'
4261.22Sitojun  else
4271.22Sitojun    CYGPATH_W=echo
4281.22Sitojun  fi
4291.22Sitojunfi
4301.22SitojunAC_SUBST([CYGPATH_W])
4311.22Sitojun
4321.22Sitojun# Define the identity of the package.
4331.22Sitojundnl Distinguish between old-style and new-style calls.
4341.22Sitojunm4_ifval([$2],
4351.22Sitojun[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4361.22Sitojun AC_SUBST([PACKAGE], [$1])dnl
4371.22Sitojun AC_SUBST([VERSION], [$2])],
4381.22Sitojun[_AM_SET_OPTIONS([$1])dnl
4391.22Sitojundnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4401.22Sitojunm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
4411.22Sitojun  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4421.22Sitojun AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4431.2Sitojun AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4441.22Sitojun
4451.2Sitojun_AM_IF_OPTION([no-define],,
4461.10Sitojun[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
4471.10Sitojun AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
4481.10Sitojun
4491.10Sitojun# Some tools Automake needs.
4501.10SitojunAC_REQUIRE([AM_SANITY_CHECK])dnl
4511.18SitojunAC_REQUIRE([AC_ARG_PROGRAM])dnl
4521.18SitojunAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
4531.10SitojunAM_MISSING_PROG(AUTOCONF, autoconf)
4541.10SitojunAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
4551.10SitojunAM_MISSING_PROG(AUTOHEADER, autoheader)
4561.10SitojunAM_MISSING_PROG(MAKEINFO, makeinfo)
4571.10SitojunAM_PROG_INSTALL_SH
4581.10SitojunAM_PROG_INSTALL_STRIP
4591.10SitojunAC_REQUIRE([AM_PROG_MKDIR_P])dnl
4601.12Sitojun# We need awk for the "check" target.  The system "awk" is bad on
4611.13Sitojun# some platforms.
4621.13SitojunAC_REQUIRE([AC_PROG_AWK])dnl
4631.10SitojunAC_REQUIRE([AC_PROG_MAKE_SET])dnl
4641.13SitojunAC_REQUIRE([AM_SET_LEADING_DOT])dnl
4651.13Sitojun_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
4661.13Sitojun              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
4671.13Sitojun	      		     [_AM_PROG_TAR([v7])])])
4681.13Sitojun_AM_IF_OPTION([no-dependencies],,
4691.13Sitojun[AC_PROVIDE_IFELSE([AC_PROG_CC],
4701.12Sitojun                  [_AM_DEPENDENCIES(CC)],
4711.12Sitojun                  [define([AC_PROG_CC],
4721.12Sitojun                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
4731.12SitojunAC_PROVIDE_IFELSE([AC_PROG_CXX],
4741.12Sitojun                  [_AM_DEPENDENCIES(CXX)],
4751.12Sitojun                  [define([AC_PROG_CXX],
4761.12Sitojun                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
4771.13SitojunAC_PROVIDE_IFELSE([AC_PROG_OBJC],
4781.19Sitojun                  [_AM_DEPENDENCIES(OBJC)],
4791.19Sitojun                  [define([AC_PROG_OBJC],
4801.10Sitojun                          defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
4811.10Sitojun])
4821.10Sitojun])
4831.19Sitojun
4841.19Sitojun
4851.19Sitojun# When config.status generates a header, we must update the stamp-h file.
4861.19Sitojun# This file resides in the same directory as the config header
4871.10Sitojun# that is generated.  The stamp files are numbered to have different names.
4881.20Sitojun
4891.20Sitojun# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
4901.20Sitojun# loop where config.status creates the headers, so we can generate
4911.20Sitojun# our stamp files there.
4921.20SitojunAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
4931.20Sitojun[# Compute $1's index in $config_headers.
4941.20Sitojun_am_stamp_count=1
4951.20Sitojunfor _am_header in $config_headers :; do
4961.20Sitojun  case $_am_header in
4971.20Sitojun    $1 | $1:* )
4981.20Sitojun      break ;;
4991.20Sitojun    * )
5001.5Sitojun      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
5011.2Sitojun  esac
5021.2Sitojundone
5031.2Sitojunecho "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
5041.5Sitojun
5051.10Sitojun# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
5061.10Sitojun#
5071.5Sitojun# This file is free software; the Free Software Foundation
5081.5Sitojun# gives unlimited permission to copy and/or distribute it,
5091.2Sitojun# with or without modifications, as long as this notice is preserved.
5101.5Sitojun
5111.2Sitojun# AM_PROG_INSTALL_SH
5121.5Sitojun# ------------------
5131.2Sitojun# Define $install_sh.
5141.2SitojunAC_DEFUN([AM_PROG_INSTALL_SH],
5151.2Sitojun[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
5161.2Sitojuninstall_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
5171.2SitojunAC_SUBST(install_sh)])
5181.2Sitojun
5191.2Sitojun# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
5201.20Sitojun#
5211.21Smatt# This file is free software; the Free Software Foundation
5221.20Sitojun# gives unlimited permission to copy and/or distribute it,
5231.21Smatt# with or without modifications, as long as this notice is preserved.
5241.2Sitojun
5251.2Sitojun# serial 2
5261.2Sitojun
5271.2Sitojun# Check whether the underlying file-system supports filenames
5281.2Sitojun# with a leading dot.  For instance MS-DOS doesn't.
5291.2SitojunAC_DEFUN([AM_SET_LEADING_DOT],
5301.2Sitojun[rm -rf .tst 2>/dev/null
5311.2Sitojunmkdir .tst 2>/dev/null
5321.2Sitojunif test -d .tst; then
5331.2Sitojun  am__leading_dot=.
5341.2Sitojunelse
5351.2Sitojun  am__leading_dot=_
5361.2Sitojunfi
5371.2Sitojunrmdir .tst 2>/dev/null
5381.2SitojunAC_SUBST([am__leading_dot])])
5391.2Sitojun
5401.2Sitojun# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
5411.2Sitojun# From Jim Meyering
5421.2Sitojun
5431.2Sitojun# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
5441.2Sitojun# Free Software Foundation, Inc.
5451.2Sitojun#
5461.2Sitojun# This file is free software; the Free Software Foundation
5471.2Sitojun# gives unlimited permission to copy and/or distribute it,
5481.2Sitojun# with or without modifications, as long as this notice is preserved.
5491.2Sitojun
5501.2Sitojun# serial 4
5511.2Sitojun
5521.2SitojunAC_DEFUN([AM_MAINTAINER_MODE],
5531.2Sitojun[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
5541.2Sitojun  dnl maintainer-mode is disabled by default
5551.2Sitojun  AC_ARG_ENABLE(maintainer-mode,
5561.2Sitojun[  --enable-maintainer-mode  enable make rules and dependencies not useful
5571.2Sitojun			  (and sometimes confusing) to the casual installer],
5581.5Sitojun      USE_MAINTAINER_MODE=$enableval,
5591.2Sitojun      USE_MAINTAINER_MODE=no)
560  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
561  AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
562  MAINT=$MAINTAINER_MODE_TRUE
563  AC_SUBST(MAINT)dnl
564]
565)
566
567AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
568
569# Check to see how 'make' treats includes.	            -*- Autoconf -*-
570
571# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
572#
573# This file is free software; the Free Software Foundation
574# gives unlimited permission to copy and/or distribute it,
575# with or without modifications, as long as this notice is preserved.
576
577# serial 3
578
579# AM_MAKE_INCLUDE()
580# -----------------
581# Check to see how make treats includes.
582AC_DEFUN([AM_MAKE_INCLUDE],
583[am_make=${MAKE-make}
584cat > confinc << 'END'
585am__doit:
586	@echo done
587.PHONY: am__doit
588END
589# If we don't find an include directive, just comment out the code.
590AC_MSG_CHECKING([for style of include used by $am_make])
591am__include="#"
592am__quote=
593_am_result=none
594# First try GNU make style include.
595echo "include confinc" > confmf
596# We grep out `Entering directory' and `Leaving directory'
597# messages which can occur if `w' ends up in MAKEFLAGS.
598# In particular we don't look at `^make:' because GNU make might
599# be invoked under some other name (usually "gmake"), in which
600# case it prints its new name instead of `make'.
601if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
602   am__include=include
603   am__quote=
604   _am_result=GNU
605fi
606# Now try BSD make style include.
607if test "$am__include" = "#"; then
608   echo '.include "confinc"' > confmf
609   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
610      am__include=.include
611      am__quote="\""
612      _am_result=BSD
613   fi
614fi
615AC_SUBST([am__include])
616AC_SUBST([am__quote])
617AC_MSG_RESULT([$_am_result])
618rm -f confinc confmf
619])
620
621# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
622
623# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
624# Free Software Foundation, Inc.
625#
626# This file is free software; the Free Software Foundation
627# gives unlimited permission to copy and/or distribute it,
628# with or without modifications, as long as this notice is preserved.
629
630# serial 5
631
632# AM_MISSING_PROG(NAME, PROGRAM)
633# ------------------------------
634AC_DEFUN([AM_MISSING_PROG],
635[AC_REQUIRE([AM_MISSING_HAS_RUN])
636$1=${$1-"${am_missing_run}$2"}
637AC_SUBST($1)])
638
639
640# AM_MISSING_HAS_RUN
641# ------------------
642# Define MISSING if not defined so far and test if it supports --run.
643# If it does, set am_missing_run to use it, otherwise, to nothing.
644AC_DEFUN([AM_MISSING_HAS_RUN],
645[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
646AC_REQUIRE_AUX_FILE([missing])dnl
647test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
648# Use eval to expand $SHELL
649if eval "$MISSING --run true"; then
650  am_missing_run="$MISSING --run "
651else
652  am_missing_run=
653  AC_MSG_WARN([`missing' script is too old or missing])
654fi
655])
656
657# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
658#
659# This file is free software; the Free Software Foundation
660# gives unlimited permission to copy and/or distribute it,
661# with or without modifications, as long as this notice is preserved.
662
663# AM_PROG_MKDIR_P
664# ---------------
665# Check for `mkdir -p'.
666AC_DEFUN([AM_PROG_MKDIR_P],
667[AC_PREREQ([2.60])dnl
668AC_REQUIRE([AC_PROG_MKDIR_P])dnl
669dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
670dnl while keeping a definition of mkdir_p for backward compatibility.
671dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
672dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
673dnl Makefile.ins that do not define MKDIR_P, so we do our own
674dnl adjustment using top_builddir (which is defined more often than
675dnl MKDIR_P).
676AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
677case $mkdir_p in
678  [[\\/$]]* | ?:[[\\/]]*) ;;
679  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
680esac
681])
682
683# Helper functions for option handling.                     -*- Autoconf -*-
684
685# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
686#
687# This file is free software; the Free Software Foundation
688# gives unlimited permission to copy and/or distribute it,
689# with or without modifications, as long as this notice is preserved.
690
691# serial 3
692
693# _AM_MANGLE_OPTION(NAME)
694# -----------------------
695AC_DEFUN([_AM_MANGLE_OPTION],
696[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
697
698# _AM_SET_OPTION(NAME)
699# ------------------------------
700# Set option NAME.  Presently that only means defining a flag for this option.
701AC_DEFUN([_AM_SET_OPTION],
702[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
703
704# _AM_SET_OPTIONS(OPTIONS)
705# ----------------------------------
706# OPTIONS is a space-separated list of Automake options.
707AC_DEFUN([_AM_SET_OPTIONS],
708[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
709
710# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
711# -------------------------------------------
712# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
713AC_DEFUN([_AM_IF_OPTION],
714[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
715
716# Check to make sure that the build environment is sane.    -*- Autoconf -*-
717
718# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
719# Free Software Foundation, Inc.
720#
721# This file is free software; the Free Software Foundation
722# gives unlimited permission to copy and/or distribute it,
723# with or without modifications, as long as this notice is preserved.
724
725# serial 4
726
727# AM_SANITY_CHECK
728# ---------------
729AC_DEFUN([AM_SANITY_CHECK],
730[AC_MSG_CHECKING([whether build environment is sane])
731# Just in case
732sleep 1
733echo timestamp > conftest.file
734# Do `set' in a subshell so we don't clobber the current shell's
735# arguments.  Must try -L first in case configure is actually a
736# symlink; some systems play weird games with the mod time of symlinks
737# (eg FreeBSD returns the mod time of the symlink's containing
738# directory).
739if (
740   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
741   if test "$[*]" = "X"; then
742      # -L didn't work.
743      set X `ls -t $srcdir/configure conftest.file`
744   fi
745   rm -f conftest.file
746   if test "$[*]" != "X $srcdir/configure conftest.file" \
747      && test "$[*]" != "X conftest.file $srcdir/configure"; then
748
749      # If neither matched, then we have a broken ls.  This can happen
750      # if, for instance, CONFIG_SHELL is bash and it inherits a
751      # broken ls alias from the environment.  This has actually
752      # happened.  Such a system could not be considered "sane".
753      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
754alias in your environment])
755   fi
756
757   test "$[2]" = conftest.file
758   )
759then
760   # Ok.
761   :
762else
763   AC_MSG_ERROR([newly created file is older than distributed files!
764Check your system clock])
765fi
766AC_MSG_RESULT(yes)])
767
768# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
769#
770# This file is free software; the Free Software Foundation
771# gives unlimited permission to copy and/or distribute it,
772# with or without modifications, as long as this notice is preserved.
773
774# AM_PROG_INSTALL_STRIP
775# ---------------------
776# One issue with vendor `install' (even GNU) is that you can't
777# specify the program used to strip binaries.  This is especially
778# annoying in cross-compiling environments, where the build's strip
779# is unlikely to handle the host's binaries.
780# Fortunately install-sh will honor a STRIPPROG variable, so we
781# always use install-sh in `make install-strip', and initialize
782# STRIPPROG with the value of the STRIP variable (set by the user).
783AC_DEFUN([AM_PROG_INSTALL_STRIP],
784[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
785# Installed binaries are usually stripped using `strip' when the user
786# run `make install-strip'.  However `strip' might not be the right
787# tool to use in cross-compilation environments, therefore Automake
788# will honor the `STRIP' environment variable to overrule this program.
789dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
790if test "$cross_compiling" != no; then
791  AC_CHECK_TOOL([STRIP], [strip], :)
792fi
793INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
794AC_SUBST([INSTALL_STRIP_PROGRAM])])
795
796# Copyright (C) 2006  Free Software Foundation, Inc.
797#
798# This file is free software; the Free Software Foundation
799# gives unlimited permission to copy and/or distribute it,
800# with or without modifications, as long as this notice is preserved.
801
802# _AM_SUBST_NOTMAKE(VARIABLE)
803# ---------------------------
804# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in.
805# This macro is traced by Automake.
806AC_DEFUN([_AM_SUBST_NOTMAKE])
807
808# Check how to create a tarball.                            -*- Autoconf -*-
809
810# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
811#
812# This file is free software; the Free Software Foundation
813# gives unlimited permission to copy and/or distribute it,
814# with or without modifications, as long as this notice is preserved.
815
816# serial 2
817
818# _AM_PROG_TAR(FORMAT)
819# --------------------
820# Check how to create a tarball in format FORMAT.
821# FORMAT should be one of `v7', `ustar', or `pax'.
822#
823# Substitute a variable $(am__tar) that is a command
824# writing to stdout a FORMAT-tarball containing the directory
825# $tardir.
826#     tardir=directory && $(am__tar) > result.tar
827#
828# Substitute a variable $(am__untar) that extract such
829# a tarball read from stdin.
830#     $(am__untar) < result.tar
831AC_DEFUN([_AM_PROG_TAR],
832[# Always define AMTAR for backward compatibility.
833AM_MISSING_PROG([AMTAR], [tar])
834m4_if([$1], [v7],
835     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
836     [m4_case([$1], [ustar],, [pax],,
837              [m4_fatal([Unknown tar format])])
838AC_MSG_CHECKING([how to create a $1 tar archive])
839# Loop over all known methods to create a tar archive until one works.
840_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
841_am_tools=${am_cv_prog_tar_$1-$_am_tools}
842# Do not fold the above two line into one, because Tru64 sh and
843# Solaris sh will not grok spaces in the rhs of `-'.
844for _am_tool in $_am_tools
845do
846  case $_am_tool in
847  gnutar)
848    for _am_tar in tar gnutar gtar;
849    do
850      AM_RUN_LOG([$_am_tar --version]) && break
851    done
852    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
853    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
854    am__untar="$_am_tar -xf -"
855    ;;
856  plaintar)
857    # Must skip GNU tar: if it does not support --format= it doesn't create
858    # ustar tarball either.
859    (tar --version) >/dev/null 2>&1 && continue
860    am__tar='tar chf - "$$tardir"'
861    am__tar_='tar chf - "$tardir"'
862    am__untar='tar xf -'
863    ;;
864  pax)
865    am__tar='pax -L -x $1 -w "$$tardir"'
866    am__tar_='pax -L -x $1 -w "$tardir"'
867    am__untar='pax -r'
868    ;;
869  cpio)
870    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
871    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
872    am__untar='cpio -i -H $1 -d'
873    ;;
874  none)
875    am__tar=false
876    am__tar_=false
877    am__untar=false
878    ;;
879  esac
880
881  # If the value was cached, stop now.  We just wanted to have am__tar
882  # and am__untar set.
883  test -n "${am_cv_prog_tar_$1}" && break
884
885  # tar/untar a dummy directory, and stop if the command works
886  rm -rf conftest.dir
887  mkdir conftest.dir
888  echo GrepMe > conftest.dir/file
889  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
890  rm -rf conftest.dir
891  if test -s conftest.tar; then
892    AM_RUN_LOG([$am__untar <conftest.tar])
893    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
894  fi
895done
896rm -rf conftest.dir
897
898AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
899AC_MSG_RESULT([$am_cv_prog_tar_$1])])
900AC_SUBST([am__tar])
901AC_SUBST([am__untar])
902]) # _AM_PROG_TAR
903
904dnl
905dnl Copyright 2005-2006 Sun Microsystems, Inc.  All rights reserved.
906dnl 
907dnl Permission is hereby granted, free of charge, to any person obtaining a
908dnl copy of this software and associated documentation files (the
909dnl "Software"), to deal in the Software without restriction, including
910dnl without limitation the rights to use, copy, modify, merge, publish,
911dnl distribute, and/or sell copies of the Software, and to permit persons
912dnl to whom the Software is furnished to do so, provided that the above
913dnl copyright notice(s) and this permission notice appear in all copies of
914dnl the Software and that both the above copyright notice(s) and this
915dnl permission notice appear in supporting documentation.
916dnl
917dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
918dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
919dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
920dnl OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
921dnl HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
922dnl INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
923dnl FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
924dnl NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
925dnl WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
926dnl
927dnl Except as contained in this notice, the name of a copyright holder
928dnl shall not be used in advertising or otherwise to promote the sale, use
929dnl or other dealings in this Software without prior written authorization
930dnl of the copyright holder.
931
932# XORG_MACROS_VERSION(required-version)
933# -------------------------------------
934# Minimum version: 1.1.0
935#
936# If you're using a macro added in Version 1.1 or newer, include this in
937# your configure.ac with the minimum required version, such as:
938# XORG_MACROS_VERSION(1.1)
939#
940# To force at least a version with this macro defined, also add:
941# m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.1 or later before running autoconf/autogen])])
942#
943#
944# See the "minimum version" comment for each macro you use to see what 
945# version you require.
946AC_DEFUN([XORG_MACROS_VERSION],[
947	[XORG_MACROS_needed_version=$1
948	XORG_MACROS_needed_major=`echo $XORG_MACROS_needed_version | sed 's/\..*$//'`
949	XORG_MACROS_needed_minor=`echo $XORG_MACROS_needed_version | sed -e 's/^[0-9]*\.//' -e 's/\..*$//'`]
950	AC_MSG_CHECKING([if xorg-macros used to generate configure is at least ${XORG_MACROS_needed_major}.${XORG_MACROS_needed_minor}])
951	[XORG_MACROS_version=1.1.5
952	XORG_MACROS_major=`echo $XORG_MACROS_version | sed 's/\..*$//'`
953	XORG_MACROS_minor=`echo $XORG_MACROS_version | sed -e 's/^[0-9]*\.//' -e 's/\..*$//'`]
954	if test $XORG_MACROS_major -ne $XORG_MACROS_needed_major ; then
955		AC_MSG_ERROR([configure built with incompatible version of xorg-macros.m4 - requires version ${XORG_MACROS_major}.x])
956	fi
957	if test $XORG_MACROS_minor -lt $XORG_MACROS_needed_minor ; then
958		AC_MSG_ERROR([configure built with too old of a version of xorg-macros.m4 - requires version ${XORG_MACROS_major}.${XORG_MACROS_minor}.0 or newer])
959	fi
960	AC_MSG_RESULT([yes, $XORG_MACROS_version])
961]) # XORG_MACROS_VERSION
962
963# XORG_PROG_RAWCPP()
964# ------------------
965# Minimum version: 1.0.0
966#
967# Find cpp program and necessary flags for use in pre-processing text files
968# such as man pages and config files
969AC_DEFUN([XORG_PROG_RAWCPP],[
970AC_REQUIRE([AC_PROG_CPP])
971AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
972   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
973
974# Check for flag to avoid builtin definitions - assumes unix is predefined,
975# which is not the best choice for supporting other OS'es, but covers most
976# of the ones we need for now.
977AC_MSG_CHECKING([if $RAWCPP requires -undef])
978AC_LANG_CONFTEST([Does cpp redefine unix ?])
979if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
980	AC_MSG_RESULT([no])
981else
982	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
983		RAWCPPFLAGS=-undef
984		AC_MSG_RESULT([yes])
985	else
986		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
987	fi
988fi
989rm -f conftest.$ac_ext
990
991AC_MSG_CHECKING([if $RAWCPP requires -traditional])
992AC_LANG_CONFTEST([Does cpp preserve   "whitespace"?])
993if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
994	AC_MSG_RESULT([no])
995else
996	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
997		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
998		AC_MSG_RESULT([yes])
999	else
1000		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1001	fi
1002fi
1003rm -f conftest.$ac_ext
1004AC_SUBST(RAWCPPFLAGS)
1005]) # XORG_PROG_RAWCPP
1006
1007# XORG_MANPAGE_SECTIONS()
1008# -----------------------
1009# Minimum version: 1.0.0
1010#
1011# Determine which sections man pages go in for the different man page types
1012# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1013# Not sure if there's any better way than just hardcoding by OS name.
1014# Override default settings by setting environment variables
1015
1016AC_DEFUN([XORG_MANPAGE_SECTIONS],[
1017AC_REQUIRE([AC_CANONICAL_HOST])
1018
1019if test x$APP_MAN_SUFFIX = x    ; then
1020    APP_MAN_SUFFIX=1
1021fi
1022if test x$APP_MAN_DIR = x    ; then
1023    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1024fi
1025
1026if test x$LIB_MAN_SUFFIX = x    ; then
1027    LIB_MAN_SUFFIX=3
1028fi
1029if test x$LIB_MAN_DIR = x    ; then
1030    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1031fi
1032
1033if test x$FILE_MAN_SUFFIX = x    ; then
1034    case $host_os in
1035	solaris*)	FILE_MAN_SUFFIX=4  ;;
1036	*)		FILE_MAN_SUFFIX=5  ;;
1037    esac
1038fi
1039if test x$FILE_MAN_DIR = x    ; then
1040    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1041fi
1042
1043if test x$MISC_MAN_SUFFIX = x    ; then
1044    case $host_os in
1045	solaris*)	MISC_MAN_SUFFIX=5  ;;
1046	*)		MISC_MAN_SUFFIX=7  ;;
1047    esac
1048fi
1049if test x$MISC_MAN_DIR = x    ; then
1050    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1051fi
1052
1053if test x$DRIVER_MAN_SUFFIX = x    ; then
1054    case $host_os in
1055	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1056	*)		DRIVER_MAN_SUFFIX=4  ;;
1057    esac
1058fi
1059if test x$DRIVER_MAN_DIR = x    ; then
1060    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1061fi
1062
1063if test x$ADMIN_MAN_SUFFIX = x    ; then
1064    case $host_os in
1065	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1066	*)		ADMIN_MAN_SUFFIX=8  ;;
1067    esac
1068fi
1069if test x$ADMIN_MAN_DIR = x    ; then
1070    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1071fi
1072
1073
1074AC_SUBST([APP_MAN_SUFFIX])
1075AC_SUBST([LIB_MAN_SUFFIX])
1076AC_SUBST([FILE_MAN_SUFFIX])
1077AC_SUBST([MISC_MAN_SUFFIX])
1078AC_SUBST([DRIVER_MAN_SUFFIX])
1079AC_SUBST([ADMIN_MAN_SUFFIX])
1080AC_SUBST([APP_MAN_DIR])
1081AC_SUBST([LIB_MAN_DIR])
1082AC_SUBST([FILE_MAN_DIR])
1083AC_SUBST([MISC_MAN_DIR])
1084AC_SUBST([DRIVER_MAN_DIR])
1085AC_SUBST([ADMIN_MAN_DIR])
1086]) # XORG_MANPAGE_SECTIONS
1087
1088# XORG_CHECK_LINUXDOC
1089# -------------------
1090# Minimum version: 1.0.0
1091#
1092# Defines the variable MAKE_TEXT if the necessary tools and
1093# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1094# Whether or not the necessary tools and files are found can be checked
1095# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1096AC_DEFUN([XORG_CHECK_LINUXDOC],[
1097XORG_SGML_PATH=$prefix/share/sgml
1098HAVE_DEFS_ENT=
1099
1100if test x"$cross_compiling" = x"yes" ; then
1101  HAVE_DEFS_ENT=no
1102else
1103  AC_CHECK_FILE([$XORG_SGML_PATH/X11/defs.ent], [HAVE_DEFS_ENT=yes])
1104fi
1105
1106AC_PATH_PROG(LINUXDOC, linuxdoc)
1107AC_PATH_PROG(PS2PDF, ps2pdf)
1108
1109AC_MSG_CHECKING([Whether to build documentation])
1110
1111if test x$HAVE_DEFS_ENT != x && test x$LINUXDOC != x ; then
1112   BUILDDOC=yes
1113else
1114   BUILDDOC=no
1115fi
1116
1117AM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1118
1119AC_MSG_RESULT([$BUILDDOC])
1120
1121AC_MSG_CHECKING([Whether to build pdf documentation])
1122
1123if test x$PS2PDF != x && test x$BUILD_PDFDOC != xno; then
1124   BUILDPDFDOC=yes
1125else
1126   BUILDPDFDOC=no
1127fi
1128
1129AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1130
1131AC_MSG_RESULT([$BUILDPDFDOC])
1132
1133MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt"
1134MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1135MAKE_PDF="$PS2PDF"
1136MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1137
1138AC_SUBST(MAKE_TEXT)
1139AC_SUBST(MAKE_PS)
1140AC_SUBST(MAKE_PDF)
1141AC_SUBST(MAKE_HTML)
1142]) # XORG_CHECK_LINUXDOC
1143
1144# XORG_CHECK_DOCBOOK
1145# -------------------
1146# Minimum version: 1.0.0
1147#
1148# Checks for the ability to build output formats from SGML DocBook source.
1149# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1150# indicates whether the necessary tools and files are found and, if set,
1151# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1152AC_DEFUN([XORG_CHECK_DOCBOOK],[
1153XORG_SGML_PATH=$prefix/share/sgml
1154HAVE_DEFS_ENT=
1155BUILDTXTDOC=no
1156BUILDPDFDOC=no
1157BUILDPSDOC=no
1158BUILDHTMLDOC=no
1159
1160AC_CHECK_FILE([$XORG_SGML_PATH/X11/defs.ent], [HAVE_DEFS_ENT=yes])
1161
1162AC_PATH_PROG(DOCBOOKPS, docbook2ps)
1163AC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1164AC_PATH_PROG(DOCBOOKHTML, docbook2html)
1165AC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1166
1167AC_MSG_CHECKING([Whether to build text documentation])
1168if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKTXT != x &&
1169   test x$BUILD_TXTDOC != xno; then
1170	BUILDTXTDOC=yes
1171fi
1172AM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1173AC_MSG_RESULT([$BUILDTXTDOC])
1174
1175AC_MSG_CHECKING([Whether to build PDF documentation])
1176if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPDF != x &&
1177   test x$BUILD_PDFDOC != xno; then
1178	BUILDPDFDOC=yes
1179fi
1180AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1181AC_MSG_RESULT([$BUILDPDFDOC])
1182
1183AC_MSG_CHECKING([Whether to build PostScript documentation])
1184if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPS != x &&
1185   test x$BUILD_PSDOC != xno; then
1186	BUILDPSDOC=yes
1187fi
1188AM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1189AC_MSG_RESULT([$BUILDPSDOC])
1190
1191AC_MSG_CHECKING([Whether to build HTML documentation])
1192if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKHTML != x &&
1193   test x$BUILD_HTMLDOC != xno; then
1194	BUILDHTMLDOC=yes
1195fi
1196AM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1197AC_MSG_RESULT([$BUILDHTMLDOC])
1198
1199MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1200MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1201MAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1202MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1203
1204AC_SUBST(MAKE_TEXT)
1205AC_SUBST(MAKE_PS)
1206AC_SUBST(MAKE_PDF)
1207AC_SUBST(MAKE_HTML)
1208]) # XORG_CHECK_DOCBOOK
1209
1210# XORG_CHECK_MALLOC_ZERO
1211# ----------------------
1212# Minimum version: 1.0.0
1213#
1214# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
1215# malloc(0) returns NULL.  Packages should add one of these cflags to
1216# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
1217AC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
1218AC_ARG_ENABLE(malloc0returnsnull,
1219	AC_HELP_STRING([--enable-malloc0returnsnull],
1220		       [malloc(0) returns NULL (default: auto)]),
1221	[MALLOC_ZERO_RETURNS_NULL=$enableval],
1222	[MALLOC_ZERO_RETURNS_NULL=auto])
1223
1224AC_MSG_CHECKING([whether malloc(0) returns NULL])
1225if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
1226	AC_RUN_IFELSE([
1227char *malloc();
1228char *realloc();
1229char *calloc();
1230main() {
1231    char *m0, *r0, *c0, *p;
1232    m0 = malloc(0);
1233    p = malloc(10);
1234    r0 = realloc(p,0);
1235    c0 = calloc(0);
1236    exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1);
1237}],
1238		[MALLOC_ZERO_RETURNS_NULL=yes],
1239		[MALLOC_ZERO_RETURNS_NULL=no])
1240fi
1241AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
1242
1243if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
1244	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
1245	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
1246	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
1247else
1248	MALLOC_ZERO_CFLAGS=""
1249	XMALLOC_ZERO_CFLAGS=""
1250	XTMALLOC_ZERO_CFLAGS=""
1251fi
1252
1253AC_SUBST([MALLOC_ZERO_CFLAGS])
1254AC_SUBST([XMALLOC_ZERO_CFLAGS])
1255AC_SUBST([XTMALLOC_ZERO_CFLAGS])
1256]) # XORG_CHECK_MALLOC_ZERO
1257
1258# XORG_WITH_LINT()
1259# ----------------
1260# Minimum version: 1.1.0
1261#
1262# Sets up flags for source checkers such as lint and sparse if --with-lint
1263# is specified.   (Use --with-lint=sparse for sparse.)
1264# Sets $LINT to name of source checker passed with --with-lint (default: lint)
1265# Sets $LINT_FLAGS to flags to pass to source checker
1266# Sets LINT automake conditional if enabled (default: disabled)
1267#
1268AC_DEFUN([XORG_WITH_LINT],[
1269
1270# Allow checking code with lint, sparse, etc.
1271AC_ARG_WITH(lint, [AC_HELP_STRING([--with-lint],
1272		[Use a lint-style source code checker (default: disabled)])],
1273		[use_lint=$withval], [use_lint=no])
1274if test "x$use_lint" = "xyes" ; then
1275	LINT="lint"
1276else
1277	LINT="$use_lint"
1278fi
1279if test "x$LINT_FLAGS" = "x" -a "x$LINT" != "xno" ; then
1280    case $LINT in
1281	lint|*/lint)
1282	    case $host_os in
1283		solaris*)
1284			LINT_FLAGS="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
1285			;;
1286	    esac
1287	    ;;
1288    esac
1289fi
1290
1291AC_SUBST(LINT)
1292AC_SUBST(LINT_FLAGS)
1293AM_CONDITIONAL(LINT, [test x$LINT != xno])
1294
1295]) # XORG_WITH_LINT
1296
1297# XORG_LINT_LIBRARY(LIBNAME)
1298# --------------------------
1299# Minimum version: 1.1.0
1300#
1301# Sets up flags for building lint libraries for checking programs that call
1302# functions in the library.
1303# Disabled by default, enable with --enable-lint-library
1304# Sets: 
1305#	@LINTLIB@		- name of lint library file to make
1306#	MAKE_LINT_LIB		- automake conditional
1307#
1308
1309AC_DEFUN([XORG_LINT_LIBRARY],[
1310AC_REQUIRE([XORG_WITH_LINT])
1311# Build lint "library" for more indepth checks of programs calling this library
1312AC_ARG_ENABLE(lint-library, [AC_HELP_STRING([--enable-lint-library],
1313	[Create lint library (default: disabled)])],
1314	[make_lint_lib=$enableval], [make_lint_lib=no])
1315if test "x$make_lint_lib" != "xno" ; then
1316	if test "x$LINT" = "xno" ; then
1317		AC_MSG_ERROR([Cannot make lint library without --with-lint])
1318	fi
1319	if test "x$make_lint_lib" = "xyes" ; then
1320		LINTLIB=llib-l$1.ln
1321	else
1322		LINTLIB=$make_lint_lib
1323	fi
1324fi
1325AC_SUBST(LINTLIB)
1326AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
1327
1328]) # XORG_LINT_LIBRARY
1329
1330dnl Copyright 2005 Red Hat, Inc
1331dnl
1332dnl Permission to use, copy, modify, distribute, and sell this software and its
1333dnl documentation for any purpose is hereby granted without fee, provided that
1334dnl the above copyright notice appear in all copies and that both that
1335dnl copyright notice and this permission notice appear in supporting
1336dnl documentation.
1337dnl
1338dnl The above copyright notice and this permission notice shall be included
1339dnl in all copies or substantial portions of the Software.
1340dnl
1341dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1342dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1343dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1344dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
1345dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1346dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1347dnl OTHER DEALINGS IN THE SOFTWARE.
1348dnl
1349dnl Except as contained in this notice, the name of the copyright holders shall
1350dnl not be used in advertising or otherwise to promote the sale, use or
1351dnl other dealings in this Software without prior written authorization
1352dnl from the copyright holders.
1353dnl
1354
1355# XORG_RELEASE_VERSION
1356# --------------------
1357# Adds --with/without-release-string and changes the PACKAGE and
1358# PACKAGE_TARNAME to use "$PACKAGE{_TARNAME}-$RELEASE_VERSION".  If
1359# no option is given, PACKAGE and PACKAGE_TARNAME are unchanged.  Also
1360# defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
1361 
1362AC_DEFUN([XORG_RELEASE_VERSION],[
1363	AC_ARG_WITH(release-version,
1364			AC_HELP_STRING([--with-release-version=STRING],
1365				[Use release version string in package name]),
1366			[RELEASE_VERSION="$withval"],
1367			[RELEASE_VERSION=""])
1368	if test "x$RELEASE_VERSION" != "x"; then
1369		PACKAGE="$PACKAGE-$RELEASE_VERSION"
1370		PACKAGE_TARNAME="$PACKAGE_TARNAME-$RELEASE_VERSION"
1371		AC_MSG_NOTICE([Building with package name set to $PACKAGE])
1372	fi
1373	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
1374		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
1375		[Major version of this package])
1376	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2`
1377	if test "x$PVM" = "x"; then
1378		PVM="0"
1379	fi
1380	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
1381		[$PVM],
1382		[Minor version of this package])
1383	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3`
1384	if test "x$PVP" = "x"; then
1385		PVP="0"
1386	fi
1387	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
1388		[$PVP],
1389		[Patch version of this package])
1390])
1391
1392# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1393# 
1394# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1395#
1396# This program is free software; you can redistribute it and/or modify
1397# it under the terms of the GNU General Public License as published by
1398# the Free Software Foundation; either version 2 of the License, or
1399# (at your option) any later version.
1400#
1401# This program is distributed in the hope that it will be useful, but
1402# WITHOUT ANY WARRANTY; without even the implied warranty of
1403# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1404# General Public License for more details.
1405#
1406# You should have received a copy of the GNU General Public License
1407# along with this program; if not, write to the Free Software
1408# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1409#
1410# As a special exception to the GNU General Public License, if you
1411# distribute this file as part of a program that contains a
1412# configuration script generated by Autoconf, you may include it under
1413# the same distribution terms that you use for the rest of that program.
1414
1415# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1416# ----------------------------------
1417AC_DEFUN([PKG_PROG_PKG_CONFIG],
1418[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1419m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1420AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1421if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1422	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1423fi
1424if test -n "$PKG_CONFIG"; then
1425	_pkg_min_version=m4_ifval([$1], [$1], [0.9.0])
1426	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1427	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1428		AC_MSG_RESULT([yes])
1429	else
1430		AC_MSG_RESULT([no])
1431		PKG_CONFIG=""
1432	fi
1433		
1434fi[]dnl
1435])# PKG_PROG_PKG_CONFIG
1436
1437# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1438#
1439# Check to see whether a particular set of modules exists.  Similar
1440# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1441#
1442#
1443# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1444# this or PKG_CHECK_MODULES is called, or make sure to call
1445# PKG_CHECK_EXISTS manually
1446# --------------------------------------------------------------
1447AC_DEFUN([PKG_CHECK_EXISTS],
1448[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1449if test -n "$PKG_CONFIG" && \
1450    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1451  m4_ifval([$2], [$2], [:])
1452m4_ifvaln([$3], [else
1453  $3])dnl
1454fi])
1455
1456
1457# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1458# ---------------------------------------------
1459m4_define([_PKG_CONFIG],
1460[if test -n "$PKG_CONFIG"; then
1461        PKG_CHECK_EXISTS([$3],
1462                         [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1463			 [pkg_failed=yes])
1464else
1465	pkg_failed=untried
1466fi[]dnl
1467])# _PKG_CONFIG
1468
1469# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1470# [ACTION-IF-NOT-FOUND])
1471#
1472#
1473# Note that if there is a possibility the first call to
1474# PKG_CHECK_MODULES might not happen, you should be sure to include an
1475# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1476#
1477#
1478# --------------------------------------------------------------
1479AC_DEFUN([PKG_CHECK_MODULES],
1480[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1481AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1482AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1483
1484pkg_failed=no
1485AC_MSG_CHECKING([for $1])
1486
1487_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1488_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1489
1490if test $pkg_failed = yes; then
1491	$1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1492	# Put the nasty error message in config.log where it belongs
1493	echo "$$1[]_PKG_ERRORS" 1>&AS_MESSAGE_LOG_FD
1494
1495	ifelse([$4], , [AC_MSG_ERROR(dnl
1496[Package requirements ($2) were not met.
1497Consider adjusting the PKG_CONFIG_PATH environment variable if you
1498installed software in a non-standard prefix.
1499
1500Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables
1501to avoid the need to call pkg-config.  See the pkg-config man page for
1502more details.])],
1503		[$4])
1504elif test $pkg_failed = untried; then
1505	ifelse([$4], , [AC_MSG_FAILURE(dnl
1506[The pkg-config script could not be found or is too old.  Make sure it
1507is in your PATH or set the PKG_CONFIG environment variable to the full
1508path to pkg-config.
1509
1510Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables
1511to avoid the need to call pkg-config.  See the pkg-config man page for
1512more details.
1513
1514To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])],
1515		[$4])
1516else
1517	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1518	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1519        AC_MSG_RESULT([yes])
1520	ifelse([$3], , :, [$3])
1521fi[]dnl
1522])# PKG_CHECK_MODULES
1523
1524