aclocal.m4 revision 77683534
1dbe7da2eSmrg# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
2a8fdb4bcSmrg
3a8fdb4bcSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4dbe7da2eSmrg# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
5a8fdb4bcSmrg# This file is free software; the Free Software Foundation
6a8fdb4bcSmrg# gives unlimited permission to copy and/or distribute it,
7a8fdb4bcSmrg# with or without modifications, as long as this notice is preserved.
8a8fdb4bcSmrg
9a8fdb4bcSmrg# This program is distributed in the hope that it will be useful,
10a8fdb4bcSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11a8fdb4bcSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12a8fdb4bcSmrg# PARTICULAR PURPOSE.
13a8fdb4bcSmrg
14a8fdb4bcSmrgm4_ifndef([AC_AUTOCONF_VERSION],
15a8fdb4bcSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1677683534Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
1777683534Smrg[m4_warning([this file was generated for autoconf 2.68.
18a8fdb4bcSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
19a8fdb4bcSmrgIf you have problems, you may need to regenerate the build system entirely.
20a8fdb4bcSmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
21a8fdb4bcSmrg
2277683534Smrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
23a8fdb4bcSmrg#
2477683534Smrg# This file is free software; the Free Software Foundation
2577683534Smrg# gives unlimited permission to copy and/or distribute it,
2677683534Smrg# with or without modifications, as long as this notice is preserved.
27a8fdb4bcSmrg
2877683534Smrg# AM_AUTOMAKE_VERSION(VERSION)
2977683534Smrg# ----------------------------
3077683534Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3177683534Smrg# generated from the m4 files accompanying Automake X.Y.
3277683534Smrg# (This private macro should not be called outside this file.)
3377683534SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3477683534Smrg[am__api_version='1.11'
3577683534Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3677683534Smrgdnl require some minimum version.  Point them to the right macro.
3777683534Smrgm4_if([$1], [1.11.1], [],
3877683534Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
3977683534Smrg])
40a8fdb4bcSmrg
4177683534Smrg# _AM_AUTOCONF_VERSION(VERSION)
4277683534Smrg# -----------------------------
4377683534Smrg# aclocal traces this macro to find the Autoconf version.
4477683534Smrg# This is a private macro too.  Using m4_define simplifies
4577683534Smrg# the logic in aclocal, which can simply ignore this definition.
4677683534Smrgm4_define([_AM_AUTOCONF_VERSION], [])
47a8fdb4bcSmrg
4877683534Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
4977683534Smrg# -------------------------------
5077683534Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5177683534Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5277683534SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5377683534Smrg[AM_AUTOMAKE_VERSION([1.11.1])dnl
5477683534Smrgm4_ifndef([AC_AUTOCONF_VERSION],
5577683534Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5677683534Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
57a8fdb4bcSmrg
5877683534Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
59a8fdb4bcSmrg
6077683534Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
6177683534Smrg#
6277683534Smrg# This file is free software; the Free Software Foundation
6377683534Smrg# gives unlimited permission to copy and/or distribute it,
6477683534Smrg# with or without modifications, as long as this notice is preserved.
65a8fdb4bcSmrg
6677683534Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6777683534Smrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
6877683534Smrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
6977683534Smrg#
7077683534Smrg# Of course, Automake must honor this variable whenever it calls a
7177683534Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7277683534Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7377683534Smrg# depending on how configure is run.  This is pretty annoying, since
7477683534Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7577683534Smrg# source directory, any form will work fine, but in subdirectories a
7677683534Smrg# relative path needs to be adjusted first.
77a8fdb4bcSmrg#
7877683534Smrg# $ac_aux_dir/missing
7977683534Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8077683534Smrg# $top_srcdir/$ac_aux_dir/missing
8177683534Smrg#    fails if $ac_aux_dir is absolute,
8277683534Smrg#    fails when called from a subdirectory in a VPATH build with
8377683534Smrg#          a relative $ac_aux_dir
84a8fdb4bcSmrg#
8577683534Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8677683534Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
8777683534Smrg# harmless because $srcdir is `.', but things will broke when you
8877683534Smrg# start a VPATH build or use an absolute $srcdir.
89a8fdb4bcSmrg#
9077683534Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9177683534Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9277683534Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9377683534Smrg# and then we would define $MISSING as
9477683534Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9577683534Smrg# This will work as long as MISSING is not called from configure, because
9677683534Smrg# unfortunately $(top_srcdir) has no meaning in configure.
9777683534Smrg# However there are other variables, like CC, which are often used in
9877683534Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
99a8fdb4bcSmrg#
10077683534Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
10177683534Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
10277683534Smrg# configured tree to be moved without reconfiguration.
103a8fdb4bcSmrg
10477683534SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10577683534Smrg[dnl Rely on autoconf to set up CDPATH properly.
10677683534SmrgAC_PREREQ([2.50])dnl
10777683534Smrg# expand $ac_aux_dir to an absolute path
10877683534Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
10977683534Smrg])
110a8fdb4bcSmrg
11177683534Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112a8fdb4bcSmrg
11377683534Smrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
11477683534Smrg# Free Software Foundation, Inc.
11577683534Smrg#
11677683534Smrg# This file is free software; the Free Software Foundation
11777683534Smrg# gives unlimited permission to copy and/or distribute it,
11877683534Smrg# with or without modifications, as long as this notice is preserved.
119a8fdb4bcSmrg
12077683534Smrg# serial 9
121a8fdb4bcSmrg
12277683534Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12377683534Smrg# -------------------------------------
12477683534Smrg# Define a conditional.
12577683534SmrgAC_DEFUN([AM_CONDITIONAL],
12677683534Smrg[AC_PREREQ(2.52)dnl
12777683534Smrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12877683534Smrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12977683534SmrgAC_SUBST([$1_TRUE])dnl
13077683534SmrgAC_SUBST([$1_FALSE])dnl
13177683534Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
13277683534Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13377683534Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13477683534Smrgif $2; then
13577683534Smrg  $1_TRUE=
13677683534Smrg  $1_FALSE='#'
13777683534Smrgelse
13877683534Smrg  $1_TRUE='#'
13977683534Smrg  $1_FALSE=
14077683534Smrgfi
14177683534SmrgAC_CONFIG_COMMANDS_PRE(
14277683534Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14377683534Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14477683534SmrgUsually this means the macro was only invoked conditionally.]])
14577683534Smrgfi])])
146a8fdb4bcSmrg
14777683534Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
14877683534Smrg# Free Software Foundation, Inc.
14977683534Smrg#
15077683534Smrg# This file is free software; the Free Software Foundation
15177683534Smrg# gives unlimited permission to copy and/or distribute it,
15277683534Smrg# with or without modifications, as long as this notice is preserved.
153a8fdb4bcSmrg
15477683534Smrg# serial 10
155a8fdb4bcSmrg
15677683534Smrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
15777683534Smrg# written in clear, in which case automake, when reading aclocal.m4,
15877683534Smrg# will think it sees a *use*, and therefore will trigger all it's
15977683534Smrg# C support machinery.  Also note that it means that autoscan, seeing
16077683534Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
161a8fdb4bcSmrg
162a8fdb4bcSmrg
16377683534Smrg# _AM_DEPENDENCIES(NAME)
16477683534Smrg# ----------------------
16577683534Smrg# See how the compiler implements dependency checking.
16677683534Smrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
16777683534Smrg# We try a few techniques and use that to set a single cache variable.
168a8fdb4bcSmrg#
16977683534Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
17077683534Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
17177683534Smrg# dependency, and given that the user is not expected to run this macro,
17277683534Smrg# just rely on AC_PROG_CC.
17377683534SmrgAC_DEFUN([_AM_DEPENDENCIES],
17477683534Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17577683534SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17677683534SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17777683534SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
178a8fdb4bcSmrg
17977683534Smrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
18077683534Smrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
18177683534Smrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
18277683534Smrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
18377683534Smrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18477683534Smrg                   [depcc="$$1"   am_compiler_list=])
185a8fdb4bcSmrg
18677683534SmrgAC_CACHE_CHECK([dependency style of $depcc],
18777683534Smrg               [am_cv_$1_dependencies_compiler_type],
18877683534Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18977683534Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
19077683534Smrg  # making bogus files that we don't know about and never remove.  For
19177683534Smrg  # instance it was reported that on HP-UX the gcc test will end up
19277683534Smrg  # making a dummy file named `D' -- because `-MD' means `put the output
19377683534Smrg  # in D'.
19477683534Smrg  mkdir conftest.dir
19577683534Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19677683534Smrg  # using a relative directory.
19777683534Smrg  cp "$am_depcomp" conftest.dir
19877683534Smrg  cd conftest.dir
19977683534Smrg  # We will build objects and dependencies in a subdirectory because
20077683534Smrg  # it helps to detect inapplicable dependency modes.  For instance
20177683534Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
20277683534Smrg  # side effect of compilation, but ICC will put the dependencies in
20377683534Smrg  # the current directory while Tru64 will put them in the object
20477683534Smrg  # directory.
20577683534Smrg  mkdir sub
20677683534Smrg
20777683534Smrg  am_cv_$1_dependencies_compiler_type=none
20877683534Smrg  if test "$am_compiler_list" = ""; then
20977683534Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
21077683534Smrg  fi
21177683534Smrg  am__universal=false
21277683534Smrg  m4_case([$1], [CC],
21377683534Smrg    [case " $depcc " in #(
21477683534Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21577683534Smrg     esac],
21677683534Smrg    [CXX],
21777683534Smrg    [case " $depcc " in #(
21877683534Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21977683534Smrg     esac])
22077683534Smrg
22177683534Smrg  for depmode in $am_compiler_list; do
22277683534Smrg    # Setup a source with many dependencies, because some compilers
22377683534Smrg    # like to wrap large dependency lists on column 80 (with \), and
22477683534Smrg    # we should not choose a depcomp mode which is confused by this.
22577683534Smrg    #
22677683534Smrg    # We need to recreate these files for each test, as the compiler may
22777683534Smrg    # overwrite some of them when testing with obscure command lines.
22877683534Smrg    # This happens at least with the AIX C compiler.
22977683534Smrg    : > sub/conftest.c
23077683534Smrg    for i in 1 2 3 4 5 6; do
23177683534Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
23277683534Smrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
23377683534Smrg      # Solaris 8's {/usr,}/bin/sh.
23477683534Smrg      touch sub/conftst$i.h
23577683534Smrg    done
23677683534Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
23777683534Smrg
23877683534Smrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
23977683534Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
24077683534Smrg    # handle `-M -o', and we need to detect this.  Also, some Intel
24177683534Smrg    # versions had trouble with output in subdirs
24277683534Smrg    am__obj=sub/conftest.${OBJEXT-o}
24377683534Smrg    am__minus_obj="-o $am__obj"
24477683534Smrg    case $depmode in
24577683534Smrg    gcc)
24677683534Smrg      # This depmode causes a compiler race in universal mode.
24777683534Smrg      test "$am__universal" = false || continue
24877683534Smrg      ;;
24977683534Smrg    nosideeffect)
25077683534Smrg      # after this tag, mechanisms are not by side-effect, so they'll
25177683534Smrg      # only be used when explicitly requested
25277683534Smrg      if test "x$enable_dependency_tracking" = xyes; then
25377683534Smrg	continue
25477683534Smrg      else
25577683534Smrg	break
25677683534Smrg      fi
25777683534Smrg      ;;
25877683534Smrg    msvisualcpp | msvcmsys)
25977683534Smrg      # This compiler won't grok `-c -o', but also, the minuso test has
26077683534Smrg      # not run yet.  These depmodes are late enough in the game, and
26177683534Smrg      # so weak that their functioning should not be impacted.
26277683534Smrg      am__obj=conftest.${OBJEXT-o}
26377683534Smrg      am__minus_obj=
26477683534Smrg      ;;
26577683534Smrg    none) break ;;
26677683534Smrg    esac
26777683534Smrg    if depmode=$depmode \
26877683534Smrg       source=sub/conftest.c object=$am__obj \
26977683534Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
27077683534Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
27177683534Smrg         >/dev/null 2>conftest.err &&
27277683534Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27377683534Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27477683534Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27577683534Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27677683534Smrg      # icc doesn't choke on unknown options, it will just issue warnings
27777683534Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
27877683534Smrg      # that says an option was ignored or not supported.
27977683534Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
28077683534Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
28177683534Smrg      # The diagnosis changed in icc 8.0:
28277683534Smrg      #   icc: Command line remark: option '-MP' not supported
28377683534Smrg      if (grep 'ignoring option' conftest.err ||
28477683534Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28577683534Smrg        am_cv_$1_dependencies_compiler_type=$depmode
28677683534Smrg        break
28777683534Smrg      fi
28877683534Smrg    fi
28977683534Smrg  done
29077683534Smrg
29177683534Smrg  cd ..
29277683534Smrg  rm -rf conftest.dir
293a8fdb4bcSmrgelse
29477683534Smrg  am_cv_$1_dependencies_compiler_type=none
295a8fdb4bcSmrgfi
29677683534Smrg])
29777683534SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29877683534SmrgAM_CONDITIONAL([am__fastdep$1], [
29977683534Smrg  test "x$enable_dependency_tracking" != xno \
30077683534Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
30177683534Smrg])
302a8fdb4bcSmrg
30377683534Smrg
30477683534Smrg# AM_SET_DEPDIR
30577683534Smrg# -------------
30677683534Smrg# Choose a directory name for dependency files.
30777683534Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
30877683534SmrgAC_DEFUN([AM_SET_DEPDIR],
30977683534Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
31077683534SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
31177683534Smrg])
31277683534Smrg
31377683534Smrg
31477683534Smrg# AM_DEP_TRACK
31577683534Smrg# ------------
31677683534SmrgAC_DEFUN([AM_DEP_TRACK],
31777683534Smrg[AC_ARG_ENABLE(dependency-tracking,
31877683534Smrg[  --disable-dependency-tracking  speeds up one-time build
31977683534Smrg  --enable-dependency-tracking   do not reject slow dependency extractors])
32077683534Smrgif test "x$enable_dependency_tracking" != xno; then
32177683534Smrg  am_depcomp="$ac_aux_dir/depcomp"
32277683534Smrg  AMDEPBACKSLASH='\'
323a8fdb4bcSmrgfi
32477683534SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32577683534SmrgAC_SUBST([AMDEPBACKSLASH])dnl
32677683534Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32777683534Smrg])
328a8fdb4bcSmrg
32977683534Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
33077683534Smrg
33177683534Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
33277683534Smrg# Free Software Foundation, Inc.
333a8fdb4bcSmrg#
33477683534Smrg# This file is free software; the Free Software Foundation
33577683534Smrg# gives unlimited permission to copy and/or distribute it,
33677683534Smrg# with or without modifications, as long as this notice is preserved.
337a8fdb4bcSmrg
33877683534Smrg#serial 5
339a8fdb4bcSmrg
34077683534Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34177683534Smrg# ------------------------------
34277683534SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34377683534Smrg[{
34477683534Smrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
34577683534Smrg  # are listed without --file.  Let's play safe and only enable the eval
34677683534Smrg  # if we detect the quoting.
34777683534Smrg  case $CONFIG_FILES in
34877683534Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
34977683534Smrg  *)   set x $CONFIG_FILES ;;
35077683534Smrg  esac
35177683534Smrg  shift
35277683534Smrg  for mf
35377683534Smrg  do
35477683534Smrg    # Strip MF so we end up with the name of the file.
35577683534Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
35677683534Smrg    # Check whether this is an Automake generated Makefile or not.
35777683534Smrg    # We used to match only the files named `Makefile.in', but
35877683534Smrg    # some people rename them; so instead we look at the file content.
35977683534Smrg    # Grep'ing the first line is not enough: some people post-process
36077683534Smrg    # each Makefile.in and add a new line on top of each file to say so.
36177683534Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
36277683534Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
36377683534Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
36477683534Smrg      dirpart=`AS_DIRNAME("$mf")`
36577683534Smrg    else
36677683534Smrg      continue
36777683534Smrg    fi
36877683534Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
36977683534Smrg    # from the Makefile without running `make'.
37077683534Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
37177683534Smrg    test -z "$DEPDIR" && continue
37277683534Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
37377683534Smrg    test -z "am__include" && continue
37477683534Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
37577683534Smrg    # When using ansi2knr, U may be empty or an underscore; expand it
37677683534Smrg    U=`sed -n 's/^U = //p' < "$mf"`
37777683534Smrg    # Find all dependency output files, they are included files with
37877683534Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
37977683534Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
38077683534Smrg    # expansion.
38177683534Smrg    for file in `sed -n "
38277683534Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
38377683534Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
38477683534Smrg      # Make sure the directory exists.
38577683534Smrg      test -f "$dirpart/$file" && continue
38677683534Smrg      fdir=`AS_DIRNAME(["$file"])`
38777683534Smrg      AS_MKDIR_P([$dirpart/$fdir])
38877683534Smrg      # echo "creating $dirpart/$file"
38977683534Smrg      echo '# dummy' > "$dirpart/$file"
39077683534Smrg    done
39177683534Smrg  done
39277683534Smrg}
39377683534Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
394a8fdb4bcSmrg
395a8fdb4bcSmrg
39677683534Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39777683534Smrg# -----------------------------
39877683534Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
39977683534Smrg#
40077683534Smrg# This code is only required when automatic dependency tracking
40177683534Smrg# is enabled.  FIXME.  This creates each `.P' file that we will
40277683534Smrg# need in order to bootstrap the dependency handling code.
40377683534SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
40477683534Smrg[AC_CONFIG_COMMANDS([depfiles],
40577683534Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
40677683534Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
40777683534Smrg])
408a8fdb4bcSmrg
40977683534Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
41077683534Smrg# Free Software Foundation, Inc.
41177683534Smrg#
41277683534Smrg# This file is free software; the Free Software Foundation
41377683534Smrg# gives unlimited permission to copy and/or distribute it,
41477683534Smrg# with or without modifications, as long as this notice is preserved.
415a8fdb4bcSmrg
41677683534Smrg# serial 8
417a8fdb4bcSmrg
41877683534Smrg# AM_CONFIG_HEADER is obsolete.  It has been replaced by AC_CONFIG_HEADERS.
41977683534SmrgAU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
42077683534Smrg
42177683534Smrg# Do all the work for Automake.                             -*- Autoconf -*-
42277683534Smrg
42377683534Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
42477683534Smrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
42577683534Smrg#
42677683534Smrg# This file is free software; the Free Software Foundation
42777683534Smrg# gives unlimited permission to copy and/or distribute it,
42877683534Smrg# with or without modifications, as long as this notice is preserved.
42977683534Smrg
43077683534Smrg# serial 16
43177683534Smrg
43277683534Smrg# This macro actually does too much.  Some checks are only needed if
43377683534Smrg# your package does certain things.  But this isn't really a big deal.
43477683534Smrg
43577683534Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
43677683534Smrg# AM_INIT_AUTOMAKE([OPTIONS])
43777683534Smrg# -----------------------------------------------
43877683534Smrg# The call with PACKAGE and VERSION arguments is the old style
43977683534Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
44077683534Smrg# and VERSION should now be passed to AC_INIT and removed from
44177683534Smrg# the call to AM_INIT_AUTOMAKE.
44277683534Smrg# We support both call styles for the transition.  After
44377683534Smrg# the next Automake release, Autoconf can make the AC_INIT
44477683534Smrg# arguments mandatory, and then we can depend on a new Autoconf
44577683534Smrg# release and drop the old call support.
44677683534SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
44777683534Smrg[AC_PREREQ([2.62])dnl
44877683534Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
44977683534Smrgdnl the ones we care about.
45077683534Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
45177683534SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
45277683534SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
45377683534Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
45477683534Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
45577683534Smrg  # is not polluted with repeated "-I."
45677683534Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
45777683534Smrg  # test to see if srcdir already configured
45877683534Smrg  if test -f $srcdir/config.status; then
45977683534Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
46077683534Smrg  fi
461a8fdb4bcSmrgfi
46277683534Smrg
46377683534Smrg# test whether we have cygpath
46477683534Smrgif test -z "$CYGPATH_W"; then
46577683534Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
46677683534Smrg    CYGPATH_W='cygpath -w'
46777683534Smrg  else
46877683534Smrg    CYGPATH_W=echo
46977683534Smrg  fi
470a8fdb4bcSmrgfi
47177683534SmrgAC_SUBST([CYGPATH_W])
472a8fdb4bcSmrg
47377683534Smrg# Define the identity of the package.
47477683534Smrgdnl Distinguish between old-style and new-style calls.
47577683534Smrgm4_ifval([$2],
47677683534Smrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
47777683534Smrg AC_SUBST([PACKAGE], [$1])dnl
47877683534Smrg AC_SUBST([VERSION], [$2])],
47977683534Smrg[_AM_SET_OPTIONS([$1])dnl
48077683534Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
48177683534Smrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
48277683534Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
48377683534Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
48477683534Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
485a8fdb4bcSmrg
48677683534Smrg_AM_IF_OPTION([no-define],,
48777683534Smrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
48877683534Smrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
48977683534Smrg
49077683534Smrg# Some tools Automake needs.
49177683534SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
49277683534SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
49377683534SmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
49477683534SmrgAM_MISSING_PROG(AUTOCONF, autoconf)
49577683534SmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
49677683534SmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
49777683534SmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
49877683534SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
49977683534SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
50077683534SmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
50177683534Smrg# We need awk for the "check" target.  The system "awk" is bad on
50277683534Smrg# some platforms.
50377683534SmrgAC_REQUIRE([AC_PROG_AWK])dnl
50477683534SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50577683534SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50677683534Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50777683534Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50877683534Smrg			     [_AM_PROG_TAR([v7])])])
50977683534Smrg_AM_IF_OPTION([no-dependencies],,
51077683534Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
51177683534Smrg		  [_AM_DEPENDENCIES(CC)],
51277683534Smrg		  [define([AC_PROG_CC],
51377683534Smrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
51477683534SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51577683534Smrg		  [_AM_DEPENDENCIES(CXX)],
51677683534Smrg		  [define([AC_PROG_CXX],
51777683534Smrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
51877683534SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51977683534Smrg		  [_AM_DEPENDENCIES(OBJC)],
52077683534Smrg		  [define([AC_PROG_OBJC],
52177683534Smrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
52277683534Smrg])
52377683534Smrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
52477683534Smrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
52577683534Smrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
52677683534Smrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
52777683534SmrgAC_CONFIG_COMMANDS_PRE(dnl
52877683534Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
52977683534Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
53077683534Smrg])
531a8fdb4bcSmrg
53277683534Smrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
53377683534Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
53477683534Smrgdnl mangled by Autoconf and run in a shell conditional statement.
53577683534Smrgm4_define([_AC_COMPILER_EXEEXT],
53677683534Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
537a8fdb4bcSmrg
538a8fdb4bcSmrg
53977683534Smrg# When config.status generates a header, we must update the stamp-h file.
54077683534Smrg# This file resides in the same directory as the config header
54177683534Smrg# that is generated.  The stamp files are numbered to have different names.
542a8fdb4bcSmrg
54377683534Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
54477683534Smrg# loop where config.status creates the headers, so we can generate
54577683534Smrg# our stamp files there.
54677683534SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
54777683534Smrg[# Compute $1's index in $config_headers.
54877683534Smrg_am_arg=$1
54977683534Smrg_am_stamp_count=1
55077683534Smrgfor _am_header in $config_headers :; do
55177683534Smrg  case $_am_header in
55277683534Smrg    $_am_arg | $_am_arg:* )
55377683534Smrg      break ;;
55477683534Smrg    * )
55577683534Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
55677683534Smrg  esac
55777683534Smrgdone
55877683534Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
559a8fdb4bcSmrg
56077683534Smrg# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
56177683534Smrg#
56277683534Smrg# This file is free software; the Free Software Foundation
56377683534Smrg# gives unlimited permission to copy and/or distribute it,
56477683534Smrg# with or without modifications, as long as this notice is preserved.
565a8fdb4bcSmrg
56677683534Smrg# AM_PROG_INSTALL_SH
56777683534Smrg# ------------------
56877683534Smrg# Define $install_sh.
56977683534SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
57077683534Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
57177683534Smrgif test x"${install_sh}" != xset; then
57277683534Smrg  case $am_aux_dir in
57377683534Smrg  *\ * | *\	*)
57477683534Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
57577683534Smrg  *)
57677683534Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
57777683534Smrg  esac
57877683534Smrgfi
57977683534SmrgAC_SUBST(install_sh)])
580a8fdb4bcSmrg
58177683534Smrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
58277683534Smrg#
58377683534Smrg# This file is free software; the Free Software Foundation
58477683534Smrg# gives unlimited permission to copy and/or distribute it,
58577683534Smrg# with or without modifications, as long as this notice is preserved.
586a8fdb4bcSmrg
58777683534Smrg# serial 2
588a8fdb4bcSmrg
58977683534Smrg# Check whether the underlying file-system supports filenames
59077683534Smrg# with a leading dot.  For instance MS-DOS doesn't.
59177683534SmrgAC_DEFUN([AM_SET_LEADING_DOT],
59277683534Smrg[rm -rf .tst 2>/dev/null
59377683534Smrgmkdir .tst 2>/dev/null
59477683534Smrgif test -d .tst; then
59577683534Smrg  am__leading_dot=.
596a8fdb4bcSmrgelse
59777683534Smrg  am__leading_dot=_
598a8fdb4bcSmrgfi
59977683534Smrgrmdir .tst 2>/dev/null
60077683534SmrgAC_SUBST([am__leading_dot])])
601a8fdb4bcSmrg
60277683534Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
60377683534Smrg# From Jim Meyering
604a8fdb4bcSmrg
60577683534Smrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
60677683534Smrg# Free Software Foundation, Inc.
607a8fdb4bcSmrg#
60877683534Smrg# This file is free software; the Free Software Foundation
60977683534Smrg# gives unlimited permission to copy and/or distribute it,
61077683534Smrg# with or without modifications, as long as this notice is preserved.
611a8fdb4bcSmrg
61277683534Smrg# serial 5
613a8fdb4bcSmrg
61477683534Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
61577683534Smrg# ----------------------------------
61677683534Smrg# Control maintainer-specific portions of Makefiles.
61777683534Smrg# Default is to disable them, unless `enable' is passed literally.
61877683534Smrg# For symmetry, `disable' may be passed as well.  Anyway, the user
61977683534Smrg# can override the default with the --enable/--disable switch.
62077683534SmrgAC_DEFUN([AM_MAINTAINER_MODE],
62177683534Smrg[m4_case(m4_default([$1], [disable]),
62277683534Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
62377683534Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
62477683534Smrg       [m4_define([am_maintainer_other], [enable])
62577683534Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
62677683534SmrgAC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
62777683534Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
62877683534Smrg  AC_ARG_ENABLE([maintainer-mode],
62977683534Smrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
63077683534Smrg			  (and sometimes confusing) to the casual installer],
63177683534Smrg      [USE_MAINTAINER_MODE=$enableval],
63277683534Smrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
63377683534Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
63477683534Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
63577683534Smrg  MAINT=$MAINTAINER_MODE_TRUE
63677683534Smrg  AC_SUBST([MAINT])dnl
63777683534Smrg]
63877683534Smrg)
639a8fdb4bcSmrg
64077683534SmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
641a8fdb4bcSmrg
64277683534Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
643a8fdb4bcSmrg
64477683534Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
645dbe7da2eSmrg#
64677683534Smrg# This file is free software; the Free Software Foundation
64777683534Smrg# gives unlimited permission to copy and/or distribute it,
64877683534Smrg# with or without modifications, as long as this notice is preserved.
649dbe7da2eSmrg
65077683534Smrg# serial 4
65177683534Smrg
65277683534Smrg# AM_MAKE_INCLUDE()
65377683534Smrg# -----------------
65477683534Smrg# Check to see how make treats includes.
65577683534SmrgAC_DEFUN([AM_MAKE_INCLUDE],
65677683534Smrg[am_make=${MAKE-make}
65777683534Smrgcat > confinc << 'END'
65877683534Smrgam__doit:
65977683534Smrg	@echo this is the am__doit target
66077683534Smrg.PHONY: am__doit
66177683534SmrgEND
66277683534Smrg# If we don't find an include directive, just comment out the code.
66377683534SmrgAC_MSG_CHECKING([for style of include used by $am_make])
66477683534Smrgam__include="#"
66577683534Smrgam__quote=
66677683534Smrg_am_result=none
66777683534Smrg# First try GNU make style include.
66877683534Smrgecho "include confinc" > confmf
66977683534Smrg# Ignore all kinds of additional output from `make'.
67077683534Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
67177683534Smrg*the\ am__doit\ target*)
67277683534Smrg  am__include=include
67377683534Smrg  am__quote=
67477683534Smrg  _am_result=GNU
67577683534Smrg  ;;
67677683534Smrgesac
67777683534Smrg# Now try BSD make style include.
67877683534Smrgif test "$am__include" = "#"; then
67977683534Smrg   echo '.include "confinc"' > confmf
68077683534Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
68177683534Smrg   *the\ am__doit\ target*)
68277683534Smrg     am__include=.include
68377683534Smrg     am__quote="\""
68477683534Smrg     _am_result=BSD
68577683534Smrg     ;;
68677683534Smrg   esac
687dbe7da2eSmrgfi
68877683534SmrgAC_SUBST([am__include])
68977683534SmrgAC_SUBST([am__quote])
69077683534SmrgAC_MSG_RESULT([$_am_result])
69177683534Smrgrm -f confinc confmf
69277683534Smrg])
693dbe7da2eSmrg
69477683534Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
69577683534Smrg
69677683534Smrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
69777683534Smrg# Free Software Foundation, Inc.
698dbe7da2eSmrg#
69977683534Smrg# This file is free software; the Free Software Foundation
70077683534Smrg# gives unlimited permission to copy and/or distribute it,
70177683534Smrg# with or without modifications, as long as this notice is preserved.
702dbe7da2eSmrg
70377683534Smrg# serial 6
704dbe7da2eSmrg
70577683534Smrg# AM_MISSING_PROG(NAME, PROGRAM)
70677683534Smrg# ------------------------------
70777683534SmrgAC_DEFUN([AM_MISSING_PROG],
70877683534Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
70977683534Smrg$1=${$1-"${am_missing_run}$2"}
71077683534SmrgAC_SUBST($1)])
711dbe7da2eSmrg
71277683534Smrg
71377683534Smrg# AM_MISSING_HAS_RUN
71477683534Smrg# ------------------
71577683534Smrg# Define MISSING if not defined so far and test if it supports --run.
71677683534Smrg# If it does, set am_missing_run to use it, otherwise, to nothing.
71777683534SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
71877683534Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
71977683534SmrgAC_REQUIRE_AUX_FILE([missing])dnl
72077683534Smrgif test x"${MISSING+set}" != xset; then
72177683534Smrg  case $am_aux_dir in
72277683534Smrg  *\ * | *\	*)
72377683534Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
72477683534Smrg  *)
72577683534Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
72677683534Smrg  esac
72777683534Smrgfi
72877683534Smrg# Use eval to expand $SHELL
72977683534Smrgif eval "$MISSING --run true"; then
73077683534Smrg  am_missing_run="$MISSING --run "
731dbe7da2eSmrgelse
73277683534Smrg  am_missing_run=
73377683534Smrg  AC_MSG_WARN([`missing' script is too old or missing])
734dbe7da2eSmrgfi
73577683534Smrg])
736dbe7da2eSmrg
73777683534Smrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
738a8fdb4bcSmrg#
73977683534Smrg# This file is free software; the Free Software Foundation
74077683534Smrg# gives unlimited permission to copy and/or distribute it,
74177683534Smrg# with or without modifications, as long as this notice is preserved.
742a8fdb4bcSmrg
74377683534Smrg# AM_PROG_MKDIR_P
74477683534Smrg# ---------------
74577683534Smrg# Check for `mkdir -p'.
74677683534SmrgAC_DEFUN([AM_PROG_MKDIR_P],
74777683534Smrg[AC_PREREQ([2.60])dnl
74877683534SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
74977683534Smrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
75077683534Smrgdnl while keeping a definition of mkdir_p for backward compatibility.
75177683534Smrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
75277683534Smrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
75377683534Smrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
75477683534Smrgdnl adjustment using top_builddir (which is defined more often than
75577683534Smrgdnl MKDIR_P).
75677683534SmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
75777683534Smrgcase $mkdir_p in
75877683534Smrg  [[\\/$]]* | ?:[[\\/]]*) ;;
75977683534Smrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
76077683534Smrgesac
76177683534Smrg])
762a8fdb4bcSmrg
76377683534Smrg# Helper functions for option handling.                     -*- Autoconf -*-
764a8fdb4bcSmrg
76577683534Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
766a8fdb4bcSmrg#
76777683534Smrg# This file is free software; the Free Software Foundation
76877683534Smrg# gives unlimited permission to copy and/or distribute it,
76977683534Smrg# with or without modifications, as long as this notice is preserved.
770a8fdb4bcSmrg
77177683534Smrg# serial 4
77277683534Smrg
77377683534Smrg# _AM_MANGLE_OPTION(NAME)
77477683534Smrg# -----------------------
77577683534SmrgAC_DEFUN([_AM_MANGLE_OPTION],
77677683534Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
77777683534Smrg
77877683534Smrg# _AM_SET_OPTION(NAME)
77977683534Smrg# ------------------------------
78077683534Smrg# Set option NAME.  Presently that only means defining a flag for this option.
78177683534SmrgAC_DEFUN([_AM_SET_OPTION],
78277683534Smrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
783a8fdb4bcSmrg
78477683534Smrg# _AM_SET_OPTIONS(OPTIONS)
78577683534Smrg# ----------------------------------
78677683534Smrg# OPTIONS is a space-separated list of Automake options.
78777683534SmrgAC_DEFUN([_AM_SET_OPTIONS],
78877683534Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
78977683534Smrg
79077683534Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
79177683534Smrg# -------------------------------------------
79277683534Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
79377683534SmrgAC_DEFUN([_AM_IF_OPTION],
79477683534Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
795a8fdb4bcSmrg
79677683534Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
797a8fdb4bcSmrg
79877683534Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
79977683534Smrg# Free Software Foundation, Inc.
800a8fdb4bcSmrg#
80177683534Smrg# This file is free software; the Free Software Foundation
80277683534Smrg# gives unlimited permission to copy and/or distribute it,
80377683534Smrg# with or without modifications, as long as this notice is preserved.
804a8fdb4bcSmrg
80577683534Smrg# serial 5
806a8fdb4bcSmrg
80777683534Smrg# AM_SANITY_CHECK
808dbe7da2eSmrg# ---------------
80977683534SmrgAC_DEFUN([AM_SANITY_CHECK],
81077683534Smrg[AC_MSG_CHECKING([whether build environment is sane])
81177683534Smrg# Just in case
81277683534Smrgsleep 1
81377683534Smrgecho timestamp > conftest.file
81477683534Smrg# Reject unsafe characters in $srcdir or the absolute working directory
81577683534Smrg# name.  Accept space and tab only in the latter.
81677683534Smrgam_lf='
81777683534Smrg'
81877683534Smrgcase `pwd` in
81977683534Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
82077683534Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
82177683534Smrgesac
82277683534Smrgcase $srcdir in
82377683534Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
82477683534Smrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
82577683534Smrgesac
826dbe7da2eSmrg
82777683534Smrg# Do `set' in a subshell so we don't clobber the current shell's
82877683534Smrg# arguments.  Must try -L first in case configure is actually a
82977683534Smrg# symlink; some systems play weird games with the mod time of symlinks
83077683534Smrg# (eg FreeBSD returns the mod time of the symlink's containing
83177683534Smrg# directory).
83277683534Smrgif (
83377683534Smrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
83477683534Smrg   if test "$[*]" = "X"; then
83577683534Smrg      # -L didn't work.
83677683534Smrg      set X `ls -t "$srcdir/configure" conftest.file`
83777683534Smrg   fi
83877683534Smrg   rm -f conftest.file
83977683534Smrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
84077683534Smrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
841dbe7da2eSmrg
84277683534Smrg      # If neither matched, then we have a broken ls.  This can happen
84377683534Smrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
84477683534Smrg      # broken ls alias from the environment.  This has actually
84577683534Smrg      # happened.  Such a system could not be considered "sane".
84677683534Smrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
84777683534Smrgalias in your environment])
84877683534Smrg   fi
84977683534Smrg
85077683534Smrg   test "$[2]" = conftest.file
85177683534Smrg   )
85277683534Smrgthen
85377683534Smrg   # Ok.
85477683534Smrg   :
85577683534Smrgelse
85677683534Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
85777683534SmrgCheck your system clock])
858dbe7da2eSmrgfi
85977683534SmrgAC_MSG_RESULT(yes)])
860dbe7da2eSmrg
86177683534Smrg# Copyright (C) 2009  Free Software Foundation, Inc.
862dbe7da2eSmrg#
86377683534Smrg# This file is free software; the Free Software Foundation
86477683534Smrg# gives unlimited permission to copy and/or distribute it,
86577683534Smrg# with or without modifications, as long as this notice is preserved.
866dbe7da2eSmrg
86777683534Smrg# serial 1
868a8fdb4bcSmrg
86977683534Smrg# AM_SILENT_RULES([DEFAULT])
87077683534Smrg# --------------------------
87177683534Smrg# Enable less verbose build rules; with the default set to DEFAULT
87277683534Smrg# (`yes' being less verbose, `no' or empty being verbose).
87377683534SmrgAC_DEFUN([AM_SILENT_RULES],
87477683534Smrg[AC_ARG_ENABLE([silent-rules],
87577683534Smrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
87677683534Smrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
87777683534Smrgcase $enable_silent_rules in
87877683534Smrgyes) AM_DEFAULT_VERBOSITY=0;;
87977683534Smrgno)  AM_DEFAULT_VERBOSITY=1;;
88077683534Smrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
88177683534Smrgesac
88277683534SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
88377683534SmrgAM_BACKSLASH='\'
88477683534SmrgAC_SUBST([AM_BACKSLASH])dnl
88577683534Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
886a8fdb4bcSmrg])
887a8fdb4bcSmrg
88877683534Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
889dbe7da2eSmrg#
89077683534Smrg# This file is free software; the Free Software Foundation
89177683534Smrg# gives unlimited permission to copy and/or distribute it,
89277683534Smrg# with or without modifications, as long as this notice is preserved.
89377683534Smrg
89477683534Smrg# AM_PROG_INSTALL_STRIP
89577683534Smrg# ---------------------
89677683534Smrg# One issue with vendor `install' (even GNU) is that you can't
89777683534Smrg# specify the program used to strip binaries.  This is especially
89877683534Smrg# annoying in cross-compiling environments, where the build's strip
89977683534Smrg# is unlikely to handle the host's binaries.
90077683534Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
90177683534Smrg# always use install-sh in `make install-strip', and initialize
90277683534Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
90377683534SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
90477683534Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
90577683534Smrg# Installed binaries are usually stripped using `strip' when the user
90677683534Smrg# run `make install-strip'.  However `strip' might not be the right
90777683534Smrg# tool to use in cross-compilation environments, therefore Automake
90877683534Smrg# will honor the `STRIP' environment variable to overrule this program.
90977683534Smrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
91077683534Smrgif test "$cross_compiling" != no; then
91177683534Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
91277683534Smrgfi
91377683534SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
91477683534SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
915dbe7da2eSmrg
91677683534Smrg# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
917a8fdb4bcSmrg#
918a8fdb4bcSmrg# This file is free software; the Free Software Foundation
919a8fdb4bcSmrg# gives unlimited permission to copy and/or distribute it,
920a8fdb4bcSmrg# with or without modifications, as long as this notice is preserved.
921a8fdb4bcSmrg
92277683534Smrg# serial 2
923a8fdb4bcSmrg
92477683534Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
92577683534Smrg# ---------------------------
92677683534Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
92777683534Smrg# This macro is traced by Automake.
92877683534SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
929a8fdb4bcSmrg
93077683534Smrg# AM_SUBST_NOTMAKE(VARIABLE)
93177683534Smrg# ---------------------------
93277683534Smrg# Public sister of _AM_SUBST_NOTMAKE.
93377683534SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
934a8fdb4bcSmrg
93577683534Smrg# Check how to create a tarball.                            -*- Autoconf -*-
936a8fdb4bcSmrg
93777683534Smrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
938a8fdb4bcSmrg#
939a8fdb4bcSmrg# This file is free software; the Free Software Foundation
940a8fdb4bcSmrg# gives unlimited permission to copy and/or distribute it,
941a8fdb4bcSmrg# with or without modifications, as long as this notice is preserved.
942a8fdb4bcSmrg
94377683534Smrg# serial 2
94477683534Smrg
94577683534Smrg# _AM_PROG_TAR(FORMAT)
94677683534Smrg# --------------------
94777683534Smrg# Check how to create a tarball in format FORMAT.
94877683534Smrg# FORMAT should be one of `v7', `ustar', or `pax'.
949a8fdb4bcSmrg#
95077683534Smrg# Substitute a variable $(am__tar) that is a command
95177683534Smrg# writing to stdout a FORMAT-tarball containing the directory
95277683534Smrg# $tardir.
95377683534Smrg#     tardir=directory && $(am__tar) > result.tar
954a8fdb4bcSmrg#
95577683534Smrg# Substitute a variable $(am__untar) that extract such
95677683534Smrg# a tarball read from stdin.
95777683534Smrg#     $(am__untar) < result.tar
95877683534SmrgAC_DEFUN([_AM_PROG_TAR],
95977683534Smrg[# Always define AMTAR for backward compatibility.
96077683534SmrgAM_MISSING_PROG([AMTAR], [tar])
96177683534Smrgm4_if([$1], [v7],
96277683534Smrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
96377683534Smrg     [m4_case([$1], [ustar],, [pax],,
96477683534Smrg              [m4_fatal([Unknown tar format])])
96577683534SmrgAC_MSG_CHECKING([how to create a $1 tar archive])
96677683534Smrg# Loop over all known methods to create a tar archive until one works.
96777683534Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
96877683534Smrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
96977683534Smrg# Do not fold the above two line into one, because Tru64 sh and
97077683534Smrg# Solaris sh will not grok spaces in the rhs of `-'.
97177683534Smrgfor _am_tool in $_am_tools
97277683534Smrgdo
97377683534Smrg  case $_am_tool in
97477683534Smrg  gnutar)
97577683534Smrg    for _am_tar in tar gnutar gtar;
97677683534Smrg    do
97777683534Smrg      AM_RUN_LOG([$_am_tar --version]) && break
97877683534Smrg    done
97977683534Smrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
98077683534Smrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
98177683534Smrg    am__untar="$_am_tar -xf -"
98277683534Smrg    ;;
98377683534Smrg  plaintar)
98477683534Smrg    # Must skip GNU tar: if it does not support --format= it doesn't create
98577683534Smrg    # ustar tarball either.
98677683534Smrg    (tar --version) >/dev/null 2>&1 && continue
98777683534Smrg    am__tar='tar chf - "$$tardir"'
98877683534Smrg    am__tar_='tar chf - "$tardir"'
98977683534Smrg    am__untar='tar xf -'
99077683534Smrg    ;;
99177683534Smrg  pax)
99277683534Smrg    am__tar='pax -L -x $1 -w "$$tardir"'
99377683534Smrg    am__tar_='pax -L -x $1 -w "$tardir"'
99477683534Smrg    am__untar='pax -r'
99577683534Smrg    ;;
99677683534Smrg  cpio)
99777683534Smrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
99877683534Smrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
99977683534Smrg    am__untar='cpio -i -H $1 -d'
100077683534Smrg    ;;
100177683534Smrg  none)
100277683534Smrg    am__tar=false
100377683534Smrg    am__tar_=false
100477683534Smrg    am__untar=false
100577683534Smrg    ;;
100677683534Smrg  esac
100777683534Smrg
100877683534Smrg  # If the value was cached, stop now.  We just wanted to have am__tar
100977683534Smrg  # and am__untar set.
101077683534Smrg  test -n "${am_cv_prog_tar_$1}" && break
101177683534Smrg
101277683534Smrg  # tar/untar a dummy directory, and stop if the command works
101377683534Smrg  rm -rf conftest.dir
101477683534Smrg  mkdir conftest.dir
101577683534Smrg  echo GrepMe > conftest.dir/file
101677683534Smrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
101777683534Smrg  rm -rf conftest.dir
101877683534Smrg  if test -s conftest.tar; then
101977683534Smrg    AM_RUN_LOG([$am__untar <conftest.tar])
102077683534Smrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
102177683534Smrg  fi
102277683534Smrgdone
102377683534Smrgrm -rf conftest.dir
102477683534Smrg
102577683534SmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
102677683534SmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
102777683534SmrgAC_SUBST([am__tar])
102877683534SmrgAC_SUBST([am__untar])
102977683534Smrg]) # _AM_PROG_TAR
103077683534Smrg
103177683534Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
103277683534Smrgdnl
103377683534Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
103477683534Smrgdnl 
103577683534Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
103677683534Smrgdnl copy of this software and associated documentation files (the "Software"),
103777683534Smrgdnl to deal in the Software without restriction, including without limitation
103877683534Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
103977683534Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
104077683534Smrgdnl Software is furnished to do so, subject to the following conditions:
104177683534Smrgdnl
104277683534Smrgdnl The above copyright notice and this permission notice (including the next
104377683534Smrgdnl paragraph) shall be included in all copies or substantial portions of the
104477683534Smrgdnl Software.
104577683534Smrgdnl
104677683534Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
104777683534Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
104877683534Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
104977683534Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
105077683534Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
105177683534Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
105277683534Smrgdnl DEALINGS IN THE SOFTWARE.
105377683534Smrg
105477683534Smrg# XORG_MACROS_VERSION(required-version)
105577683534Smrg# -------------------------------------
105677683534Smrg# Minimum version: 1.1.0
1057a8fdb4bcSmrg#
105877683534Smrg# If you're using a macro added in Version 1.1 or newer, include this in
105977683534Smrg# your configure.ac with the minimum required version, such as:
106077683534Smrg# XORG_MACROS_VERSION(1.1)
1061a8fdb4bcSmrg#
106277683534Smrg# To ensure that this macro is defined, also add:
106377683534Smrg# m4_ifndef([XORG_MACROS_VERSION],
106477683534Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1065a8fdb4bcSmrg#
106677683534Smrg#
106777683534Smrg# See the "minimum version" comment for each macro you use to see what 
106877683534Smrg# version you require.
106977683534Smrgm4_defun([XORG_MACROS_VERSION],[
107077683534Smrgm4_define([vers_have], [1.10.1])
107177683534Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
107277683534Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
107377683534Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
107477683534Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
107577683534Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
107677683534Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
107777683534Smrgm4_undefine([vers_have])
107877683534Smrgm4_undefine([maj_have])
107977683534Smrgm4_undefine([maj_needed])
108077683534Smrg]) # XORG_MACROS_VERSION
108177683534Smrg
108277683534Smrg# XORG_PROG_RAWCPP()
108377683534Smrg# ------------------
108477683534Smrg# Minimum version: 1.0.0
108577683534Smrg#
108677683534Smrg# Find cpp program and necessary flags for use in pre-processing text files
108777683534Smrg# such as man pages and config files
108877683534SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
108977683534SmrgAC_REQUIRE([AC_PROG_CPP])
109077683534SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
109177683534Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
109277683534Smrg
109377683534Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
109477683534Smrg# which is not the best choice for supporting other OS'es, but covers most
109577683534Smrg# of the ones we need for now.
109677683534SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
109777683534SmrgAC_LANG_CONFTEST([Does cpp redefine unix ?])
109877683534Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
109977683534Smrg	AC_MSG_RESULT([no])
110077683534Smrgelse
110177683534Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
110277683534Smrg		RAWCPPFLAGS=-undef
110377683534Smrg		AC_MSG_RESULT([yes])
110477683534Smrg	# under Cygwin unix is still defined even with -undef
110577683534Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
110677683534Smrg		RAWCPPFLAGS="-undef -ansi"
110777683534Smrg		AC_MSG_RESULT([yes, with -ansi])
110877683534Smrg	else
110977683534Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
111077683534Smrg	fi
111177683534Smrgfi
111277683534Smrgrm -f conftest.$ac_ext
111377683534Smrg
111477683534SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
111577683534SmrgAC_LANG_CONFTEST([Does cpp preserve   "whitespace"?])
111677683534Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
111777683534Smrg	AC_MSG_RESULT([no])
111877683534Smrgelse
111977683534Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
112077683534Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
112177683534Smrg		AC_MSG_RESULT([yes])
112277683534Smrg	else
112377683534Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
112477683534Smrg	fi
112577683534Smrgfi
112677683534Smrgrm -f conftest.$ac_ext
112777683534SmrgAC_SUBST(RAWCPPFLAGS)
112877683534Smrg]) # XORG_PROG_RAWCPP
1129a8fdb4bcSmrg
113077683534Smrg# XORG_MANPAGE_SECTIONS()
113177683534Smrg# -----------------------
113277683534Smrg# Minimum version: 1.0.0
113377683534Smrg#
113477683534Smrg# Determine which sections man pages go in for the different man page types
113577683534Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
113677683534Smrg# Not sure if there's any better way than just hardcoding by OS name.
113777683534Smrg# Override default settings by setting environment variables
113877683534Smrg# Added MAN_SUBSTS in version 1.8
113977683534Smrg# Added AC_PROG_SED in version 1.8
1140a8fdb4bcSmrg
114177683534SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
114277683534SmrgAC_REQUIRE([AC_CANONICAL_HOST])
114377683534SmrgAC_REQUIRE([AC_PROG_SED])
1144a8fdb4bcSmrg
114577683534Smrgif test x$APP_MAN_SUFFIX = x    ; then
114677683534Smrg    APP_MAN_SUFFIX=1
114777683534Smrgfi
114877683534Smrgif test x$APP_MAN_DIR = x    ; then
114977683534Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
115077683534Smrgfi
1151a8fdb4bcSmrg
115277683534Smrgif test x$LIB_MAN_SUFFIX = x    ; then
115377683534Smrg    LIB_MAN_SUFFIX=3
115477683534Smrgfi
115577683534Smrgif test x$LIB_MAN_DIR = x    ; then
115677683534Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
115777683534Smrgfi
1158a8fdb4bcSmrg
115977683534Smrgif test x$FILE_MAN_SUFFIX = x    ; then
116077683534Smrg    case $host_os in
116177683534Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
116277683534Smrg	*)		FILE_MAN_SUFFIX=5  ;;
116377683534Smrg    esac
116477683534Smrgfi
116577683534Smrgif test x$FILE_MAN_DIR = x    ; then
116677683534Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1167a8fdb4bcSmrgfi
1168a8fdb4bcSmrg
116977683534Smrgif test x$MISC_MAN_SUFFIX = x    ; then
117077683534Smrg    case $host_os in
117177683534Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
117277683534Smrg	*)		MISC_MAN_SUFFIX=7  ;;
117377683534Smrg    esac
117477683534Smrgfi
117577683534Smrgif test x$MISC_MAN_DIR = x    ; then
117677683534Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
117777683534Smrgfi
1178a8fdb4bcSmrg
117977683534Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
118077683534Smrg    case $host_os in
118177683534Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
118277683534Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
118377683534Smrg    esac
118477683534Smrgfi
118577683534Smrgif test x$DRIVER_MAN_DIR = x    ; then
118677683534Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
118777683534Smrgfi
1188a8fdb4bcSmrg
118977683534Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
119077683534Smrg    case $host_os in
119177683534Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
119277683534Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
119377683534Smrg    esac
119477683534Smrgfi
119577683534Smrgif test x$ADMIN_MAN_DIR = x    ; then
119677683534Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
119777683534Smrgfi
1198a8fdb4bcSmrg
1199a8fdb4bcSmrg
120077683534SmrgAC_SUBST([APP_MAN_SUFFIX])
120177683534SmrgAC_SUBST([LIB_MAN_SUFFIX])
120277683534SmrgAC_SUBST([FILE_MAN_SUFFIX])
120377683534SmrgAC_SUBST([MISC_MAN_SUFFIX])
120477683534SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
120577683534SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
120677683534SmrgAC_SUBST([APP_MAN_DIR])
120777683534SmrgAC_SUBST([LIB_MAN_DIR])
120877683534SmrgAC_SUBST([FILE_MAN_DIR])
120977683534SmrgAC_SUBST([MISC_MAN_DIR])
121077683534SmrgAC_SUBST([DRIVER_MAN_DIR])
121177683534SmrgAC_SUBST([ADMIN_MAN_DIR])
1212a8fdb4bcSmrg
121377683534SmrgXORG_MAN_PAGE="X Version 11"
121477683534SmrgAC_SUBST([XORG_MAN_PAGE])
121577683534SmrgMAN_SUBSTS="\
121677683534Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
121777683534Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
121877683534Smrg	-e 's|__xservername__|Xorg|g' \
121977683534Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
122077683534Smrg	-e 's|__projectroot__|\$(prefix)|g' \
122177683534Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
122277683534Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
122377683534Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
122477683534Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
122577683534Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
122677683534Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
122777683534Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
122877683534SmrgAC_SUBST([MAN_SUBSTS])
1229a8fdb4bcSmrg
123077683534Smrg]) # XORG_MANPAGE_SECTIONS
1231a8fdb4bcSmrg
123277683534Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
123377683534Smrg# ------------------------
123477683534Smrg# Minimum version: 1.7.0
123577683534Smrg#
123677683534Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
123777683534Smrg# provided by xorg-sgml-doctools, if installed.
123877683534SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
123977683534SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
124077683534SmrgXORG_SGML_PATH=
124177683534SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
124277683534Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
124377683534Smrg    [m4_ifval([$1],[:],
124477683534Smrg        [if test x"$cross_compiling" != x"yes" ; then
124577683534Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
124677683534Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
124777683534Smrg         fi])
124877683534Smrg    ])
124977683534Smrg
125077683534Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
125177683534Smrg# the path and the name of the doc stylesheet
125277683534Smrgif test "x$XORG_SGML_PATH" != "x" ; then
125377683534Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
125477683534Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
125577683534Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
125677683534Smrgelse
125777683534Smrg   AC_MSG_RESULT([no])
125877683534Smrgfi
1259dbe7da2eSmrg
126077683534SmrgAC_SUBST(XORG_SGML_PATH)
126177683534SmrgAC_SUBST(STYLESHEET_SRCDIR)
126277683534SmrgAC_SUBST(XSL_STYLESHEET)
126377683534SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
126477683534Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1265a8fdb4bcSmrg
126677683534Smrg# XORG_CHECK_LINUXDOC
126777683534Smrg# -------------------
126877683534Smrg# Minimum version: 1.0.0
126977683534Smrg#
127077683534Smrg# Defines the variable MAKE_TEXT if the necessary tools and
127177683534Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
127277683534Smrg# Whether or not the necessary tools and files are found can be checked
127377683534Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
127477683534SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
127577683534SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
127677683534SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1277a8fdb4bcSmrg
127877683534SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
127977683534Smrg
128077683534SmrgAC_MSG_CHECKING([whether to build documentation])
128177683534Smrg
128277683534Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
128377683534Smrg   BUILDDOC=yes
1284a8fdb4bcSmrgelse
128577683534Smrg   BUILDDOC=no
1286a8fdb4bcSmrgfi
1287a8fdb4bcSmrg
128877683534SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1289a8fdb4bcSmrg
129077683534SmrgAC_MSG_RESULT([$BUILDDOC])
1291a8fdb4bcSmrg
129277683534SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1293a8fdb4bcSmrg
129477683534Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
129577683534Smrg   BUILDPDFDOC=yes
129677683534Smrgelse
129777683534Smrg   BUILDPDFDOC=no
1298a8fdb4bcSmrgfi
1299a8fdb4bcSmrg
130077683534SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1301a8fdb4bcSmrg
130277683534SmrgAC_MSG_RESULT([$BUILDPDFDOC])
130377683534Smrg
130477683534SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
130577683534SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
130677683534SmrgMAKE_PDF="$PS2PDF"
130777683534SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
130877683534Smrg
130977683534SmrgAC_SUBST(MAKE_TEXT)
131077683534SmrgAC_SUBST(MAKE_PS)
131177683534SmrgAC_SUBST(MAKE_PDF)
131277683534SmrgAC_SUBST(MAKE_HTML)
131377683534Smrg]) # XORG_CHECK_LINUXDOC
131477683534Smrg
131577683534Smrg# XORG_CHECK_DOCBOOK
131677683534Smrg# -------------------
131777683534Smrg# Minimum version: 1.0.0
1318a8fdb4bcSmrg#
131977683534Smrg# Checks for the ability to build output formats from SGML DocBook source.
132077683534Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
132177683534Smrg# indicates whether the necessary tools and files are found and, if set,
132277683534Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
132377683534SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
132477683534SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1325a8fdb4bcSmrg
132677683534SmrgBUILDTXTDOC=no
132777683534SmrgBUILDPDFDOC=no
132877683534SmrgBUILDPSDOC=no
132977683534SmrgBUILDHTMLDOC=no
1330a8fdb4bcSmrg
133177683534SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
133277683534SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
133377683534SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
133477683534SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
133577683534Smrg
133677683534SmrgAC_MSG_CHECKING([whether to build text documentation])
133777683534Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
133877683534Smrg   test x$BUILD_TXTDOC != xno; then
133977683534Smrg	BUILDTXTDOC=yes
134077683534Smrgfi
134177683534SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
134277683534SmrgAC_MSG_RESULT([$BUILDTXTDOC])
134377683534Smrg
134477683534SmrgAC_MSG_CHECKING([whether to build PDF documentation])
134577683534Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
134677683534Smrg   test x$BUILD_PDFDOC != xno; then
134777683534Smrg	BUILDPDFDOC=yes
134877683534Smrgfi
134977683534SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
135077683534SmrgAC_MSG_RESULT([$BUILDPDFDOC])
135177683534Smrg
135277683534SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
135377683534Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
135477683534Smrg   test x$BUILD_PSDOC != xno; then
135577683534Smrg	BUILDPSDOC=yes
135677683534Smrgfi
135777683534SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
135877683534SmrgAC_MSG_RESULT([$BUILDPSDOC])
135977683534Smrg
136077683534SmrgAC_MSG_CHECKING([whether to build HTML documentation])
136177683534Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
136277683534Smrg   test x$BUILD_HTMLDOC != xno; then
136377683534Smrg	BUILDHTMLDOC=yes
136477683534Smrgfi
136577683534SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
136677683534SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
136777683534Smrg
136877683534SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
136977683534SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
137077683534SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
137177683534SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
137277683534Smrg
137377683534SmrgAC_SUBST(MAKE_TEXT)
137477683534SmrgAC_SUBST(MAKE_PS)
137577683534SmrgAC_SUBST(MAKE_PDF)
137677683534SmrgAC_SUBST(MAKE_HTML)
137777683534Smrg]) # XORG_CHECK_DOCBOOK
137877683534Smrg
137977683534Smrg# XORG_WITH_XMLTO([MIN-VERSION])
138077683534Smrg# ----------------
138177683534Smrg# Minimum version: 1.5.0
138277683534Smrg#
138377683534Smrg# Documentation tools are not always available on all platforms and sometimes
138477683534Smrg# not at the appropriate level. This macro enables a module to test for the
138577683534Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
138677683534Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
138777683534Smrg# as whether or not to use the xmlto package.
138877683534Smrg#
138977683534Smrg# Interface to module:
139077683534Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
139177683534Smrg# XMLTO:	returns the path of the xmlto program found
139277683534Smrg#		returns the path set by the user in the environment
139377683534Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
139477683534Smrg#		'no' user instructs the module not to use xmlto
139577683534Smrg#
139677683534Smrg# Added in version 1.10.0
139777683534Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
139877683534Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
139977683534Smrg#
140077683534Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
140177683534Smrg#
140277683534SmrgAC_DEFUN([XORG_WITH_XMLTO],[
140377683534SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
140477683534SmrgAC_ARG_WITH(xmlto,
140577683534Smrg	AS_HELP_STRING([--with-xmlto],
140677683534Smrg	   [Use xmlto to regenerate documentation (default: yes, if installed)]),
140777683534Smrg	   [use_xmlto=$withval], [use_xmlto=auto])
1408a8fdb4bcSmrg
140977683534Smrgif test "x$use_xmlto" = x"auto"; then
141077683534Smrg   AC_PATH_PROG([XMLTO], [xmlto])
141177683534Smrg   if test "x$XMLTO" = "x"; then
141277683534Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
141377683534Smrg	have_xmlto=no
141477683534Smrg   else
141577683534Smrg        have_xmlto=yes
141677683534Smrg   fi
141777683534Smrgelif test "x$use_xmlto" = x"yes" ; then
141877683534Smrg   AC_PATH_PROG([XMLTO], [xmlto])
141977683534Smrg   if test "x$XMLTO" = "x"; then
142077683534Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
142177683534Smrg   fi
142277683534Smrg   have_xmlto=yes
142377683534Smrgelif test "x$use_xmlto" = x"no" ; then
142477683534Smrg   if test "x$XMLTO" != "x"; then
142577683534Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
142677683534Smrg   fi
142777683534Smrg   have_xmlto=no
142877683534Smrgelse
142977683534Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
143077683534Smrgfi
143177683534Smrg
143277683534Smrg# Test for a minimum version of xmlto, if provided.
143377683534Smrgm4_ifval([$1],
143477683534Smrg[if test "$have_xmlto" = yes; then
143577683534Smrg    # scrape the xmlto version
143677683534Smrg    AC_MSG_CHECKING([the xmlto version])
143777683534Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
143877683534Smrg    AC_MSG_RESULT([$xmlto_version])
143977683534Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
144077683534Smrg        [if test "x$use_xmlto" = xauto; then
144177683534Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
144277683534Smrg            have_xmlto=no
144377683534Smrg        else
144477683534Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
144577683534Smrg        fi])
144677683534Smrgfi])
144777683534Smrg
144877683534Smrg# Test for the ability of xmlto to generate a text target
144977683534Smrghave_xmlto_text=no
145077683534Smrgcat > conftest.xml << "EOF"
145177683534SmrgEOF
145277683534SmrgAS_IF([test "$have_xmlto" = yes],
145377683534Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
145477683534Smrg             [have_xmlto_text=yes],
145577683534Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
145677683534Smrgrm -f conftest.xml
145777683534SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
145877683534SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
145977683534Smrg]) # XORG_WITH_XMLTO
146077683534Smrg
146177683534Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION])
146277683534Smrg# ----------------
146377683534Smrg# Minimum version: 1.5.0
146477683534Smrg#
146577683534Smrg# Documentation tools are not always available on all platforms and sometimes
146677683534Smrg# not at the appropriate level. This macro enables a module to test for the
146777683534Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
146877683534Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
146977683534Smrg# as whether or not to use the asciidoc package.
147077683534Smrg#
147177683534Smrg# Interface to module:
147277683534Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
147377683534Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
147477683534Smrg#		 returns the path set by the user in the environment
147577683534Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
147677683534Smrg#		  'no' user instructs the module not to use asciidoc
147777683534Smrg#
147877683534Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
147977683534Smrg#
148077683534SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
148177683534SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
148277683534SmrgAC_ARG_WITH(asciidoc,
148377683534Smrg	AS_HELP_STRING([--with-asciidoc],
148477683534Smrg	   [Use asciidoc to regenerate documentation (default: yes, if installed)]),
148577683534Smrg	   [use_asciidoc=$withval], [use_asciidoc=auto])
148677683534Smrg
148777683534Smrgif test "x$use_asciidoc" = x"auto"; then
148877683534Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
148977683534Smrg   if test "x$ASCIIDOC" = "x"; then
149077683534Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
149177683534Smrg	have_asciidoc=no
149277683534Smrg   else
149377683534Smrg        have_asciidoc=yes
149477683534Smrg   fi
149577683534Smrgelif test "x$use_asciidoc" = x"yes" ; then
149677683534Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
149777683534Smrg   if test "x$ASCIIDOC" = "x"; then
149877683534Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
149977683534Smrg   fi
150077683534Smrg   have_asciidoc=yes
150177683534Smrgelif test "x$use_asciidoc" = x"no" ; then
150277683534Smrg   if test "x$ASCIIDOC" != "x"; then
150377683534Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
150477683534Smrg   fi
150577683534Smrg   have_asciidoc=no
150677683534Smrgelse
150777683534Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
150877683534Smrgfi
150977683534Smrgm4_ifval([$1],
151077683534Smrg[if test "$have_asciidoc" = yes; then
151177683534Smrg    # scrape the asciidoc version
151277683534Smrg    AC_MSG_CHECKING([the asciidoc version])
151377683534Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
151477683534Smrg    AC_MSG_RESULT([$asciidoc_version])
151577683534Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
151677683534Smrg        [if test "x$use_asciidoc" = xauto; then
151777683534Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
151877683534Smrg            have_asciidoc=no
151977683534Smrg        else
152077683534Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
152177683534Smrg        fi])
152277683534Smrgfi])
152377683534SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
152477683534Smrg]) # XORG_WITH_ASCIIDOC
1525a8fdb4bcSmrg
152677683534Smrg# XORG_WITH_DOXYGEN([MIN-VERSION])
152777683534Smrg# --------------------------------
152877683534Smrg# Minimum version: 1.5.0
1529a8fdb4bcSmrg#
153077683534Smrg# Documentation tools are not always available on all platforms and sometimes
153177683534Smrg# not at the appropriate level. This macro enables a module to test for the
153277683534Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
153377683534Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
153477683534Smrg# as whether or not to use the doxygen package.
1535a8fdb4bcSmrg#
153677683534Smrg# Interface to module:
153777683534Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
153877683534Smrg# DOXYGEN:	 returns the path of the doxygen program found
153977683534Smrg#		 returns the path set by the user in the environment
154077683534Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
154177683534Smrg#		  'no' user instructs the module not to use doxygen
1542a8fdb4bcSmrg#
154377683534Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
154477683534Smrg#
154577683534SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
154677683534SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
154777683534SmrgAC_ARG_WITH(doxygen,
154877683534Smrg	AS_HELP_STRING([--with-doxygen],
154977683534Smrg	   [Use doxygen to regenerate documentation (default: yes, if installed)]),
155077683534Smrg	   [use_doxygen=$withval], [use_doxygen=auto])
1551a8fdb4bcSmrg
155277683534Smrgif test "x$use_doxygen" = x"auto"; then
155377683534Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
155477683534Smrg   if test "x$DOXYGEN" = "x"; then
155577683534Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
155677683534Smrg	have_doxygen=no
155777683534Smrg   else
155877683534Smrg        have_doxygen=yes
155977683534Smrg   fi
156077683534Smrgelif test "x$use_doxygen" = x"yes" ; then
156177683534Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
156277683534Smrg   if test "x$DOXYGEN" = "x"; then
156377683534Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
156477683534Smrg   fi
156577683534Smrg   have_doxygen=yes
156677683534Smrgelif test "x$use_doxygen" = x"no" ; then
156777683534Smrg   if test "x$DOXYGEN" != "x"; then
156877683534Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
156977683534Smrg   fi
157077683534Smrg   have_doxygen=no
157177683534Smrgelse
157277683534Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1573a8fdb4bcSmrgfi
157477683534Smrgm4_ifval([$1],
157577683534Smrg[if test "$have_doxygen" = yes; then
157677683534Smrg    # scrape the doxygen version
157777683534Smrg    AC_MSG_CHECKING([the doxygen version])
157877683534Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
157977683534Smrg    AC_MSG_RESULT([$doxygen_version])
158077683534Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
158177683534Smrg        [if test "x$use_doxygen" = xauto; then
158277683534Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
158377683534Smrg            have_doxygen=no
158477683534Smrg        else
158577683534Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
158677683534Smrg        fi])
158777683534Smrgfi])
158877683534SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
158977683534Smrg]) # XORG_WITH_DOXYGEN
1590a8fdb4bcSmrg
159177683534Smrg# XORG_WITH_GROFF
159277683534Smrg# ----------------
159377683534Smrg# Minimum version: 1.6.0
159477683534Smrg#
159577683534Smrg# Documentation tools are not always available on all platforms and sometimes
159677683534Smrg# not at the appropriate level. This macro enables a module to test for the
159777683534Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
159877683534Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
159977683534Smrg# as whether or not to use the groff package.
160077683534Smrg#
160177683534Smrg# Interface to module:
160277683534Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
160377683534Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
160477683534Smrg# HAVE_GROFF_MS: the -ms macros package
160577683534Smrg# GROFF:	 returns the path of the groff program found
160677683534Smrg#		 returns the path set by the user in the environment
160777683534Smrg# --with-groff:	 'yes' user instructs the module to use groff
160877683534Smrg#		 'no' user instructs the module not to use groff
160977683534Smrg#
161077683534Smrg# Added in version 1.9.0:
161177683534Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
161277683534Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
161377683534Smrg#		   psselect from the psutils package.
161477683534Smrg#		   the ghostcript package. Refer to the grohtml man pages
161577683534Smrg#
161677683534Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
161777683534Smrg#
161877683534Smrg# OS and distros often splits groff in a basic and full package, the former
161977683534Smrg# having the groff program and the later having devices, fonts and macros
162077683534Smrg# Checking for the groff executable is not enough.
162177683534Smrg#
162277683534Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
162377683534Smrg# unset HAVE_GROFF or GROFF env variables.
162477683534Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
162577683534Smrg#
162677683534SmrgAC_DEFUN([XORG_WITH_GROFF],[
162777683534SmrgAC_ARG_VAR([GROFF], [Path to groff command])
162877683534SmrgAC_ARG_WITH(groff,
162977683534Smrg	AS_HELP_STRING([--with-groff],
163077683534Smrg	   [Use groff to regenerate documentation (default: yes, if installed)]),
163177683534Smrg	   [use_groff=$withval], [use_groff=auto])
163277683534Smrg
163377683534Smrgif test "x$use_groff" = x"auto"; then
163477683534Smrg   AC_PATH_PROG([GROFF], [groff])
163577683534Smrg   if test "x$GROFF" = "x"; then
163677683534Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
163777683534Smrg	have_groff=no
163877683534Smrg   else
163977683534Smrg        have_groff=yes
164077683534Smrg   fi
164177683534Smrgelif test "x$use_groff" = x"yes" ; then
164277683534Smrg   AC_PATH_PROG([GROFF], [groff])
164377683534Smrg   if test "x$GROFF" = "x"; then
164477683534Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
164577683534Smrg   fi
164677683534Smrg   have_groff=yes
164777683534Smrgelif test "x$use_groff" = x"no" ; then
164877683534Smrg   if test "x$GROFF" != "x"; then
164977683534Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
165077683534Smrg   fi
165177683534Smrg   have_groff=no
165277683534Smrgelse
165377683534Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1654a8fdb4bcSmrgfi
1655dbe7da2eSmrg
165677683534Smrg# We have groff, test for the presence of the macro packages
165777683534Smrgif test "x$have_groff" = x"yes"; then
165877683534Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
165977683534Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
166077683534Smrg        groff_ms_works=yes
166177683534Smrg    else
166277683534Smrg        groff_ms_works=no
166377683534Smrg    fi
166477683534Smrg    AC_MSG_RESULT([$groff_ms_works])
166577683534Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
166677683534Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
166777683534Smrg        groff_mm_works=yes
166877683534Smrg    else
166977683534Smrg        groff_mm_works=no
167077683534Smrg    fi
167177683534Smrg    AC_MSG_RESULT([$groff_mm_works])
167277683534Smrgfi
1673a8fdb4bcSmrg
167477683534Smrg# We have groff, test for HTML dependencies, one command per package
167577683534Smrgif test "x$have_groff" = x"yes"; then
167677683534Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
167777683534Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
167877683534Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
167977683534Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
168077683534Smrg      have_groff_html=yes
168177683534Smrg   else
168277683534Smrg      have_groff_html=no
168377683534Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
168477683534Smrg   fi
168577683534Smrgfi
1686a8fdb4bcSmrg
168777683534Smrg# Set Automake conditionals for Makefiles
168877683534SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
168977683534SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
169077683534SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
169177683534SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
169277683534Smrg]) # XORG_WITH_GROFF
1693a8fdb4bcSmrg
169477683534Smrg# XORG_WITH_FOP
169577683534Smrg# ----------------
169677683534Smrg# Minimum version: 1.6.0
1697a8fdb4bcSmrg#
169877683534Smrg# Documentation tools are not always available on all platforms and sometimes
169977683534Smrg# not at the appropriate level. This macro enables a module to test for the
170077683534Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
170177683534Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
170277683534Smrg# as whether or not to use the fop package.
170377683534Smrg#
170477683534Smrg# Interface to module:
170577683534Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
170677683534Smrg# FOP:	 	returns the path of the fop program found
170777683534Smrg#		returns the path set by the user in the environment
170877683534Smrg# --with-fop: 	'yes' user instructs the module to use fop
170977683534Smrg#		'no' user instructs the module not to use fop
171077683534Smrg#
171177683534Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
171277683534Smrg#
171377683534SmrgAC_DEFUN([XORG_WITH_FOP],[
171477683534SmrgAC_ARG_VAR([FOP], [Path to fop command])
171577683534SmrgAC_ARG_WITH(fop,
171677683534Smrg	AS_HELP_STRING([--with-fop],
171777683534Smrg	   [Use fop to regenerate documentation (default: yes, if installed)]),
171877683534Smrg	   [use_fop=$withval], [use_fop=auto])
171977683534Smrg
172077683534Smrgif test "x$use_fop" = x"auto"; then
172177683534Smrg   AC_PATH_PROG([FOP], [fop])
172277683534Smrg   if test "x$FOP" = "x"; then
172377683534Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
172477683534Smrg	have_fop=no
172577683534Smrg   else
172677683534Smrg        have_fop=yes
172777683534Smrg   fi
172877683534Smrgelif test "x$use_fop" = x"yes" ; then
172977683534Smrg   AC_PATH_PROG([FOP], [fop])
173077683534Smrg   if test "x$FOP" = "x"; then
173177683534Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
173277683534Smrg   fi
173377683534Smrg   have_fop=yes
173477683534Smrgelif test "x$use_fop" = x"no" ; then
173577683534Smrg   if test "x$FOP" != "x"; then
173677683534Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
173777683534Smrg   fi
173877683534Smrg   have_fop=no
173977683534Smrgelse
174077683534Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
1741dbe7da2eSmrgfi
174277683534SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
174377683534Smrg]) # XORG_WITH_FOP
1744a8fdb4bcSmrg
174577683534Smrg# XORG_WITH_PS2PDF
174677683534Smrg# ----------------
174777683534Smrg# Minimum version: 1.6.0
1748a8fdb4bcSmrg#
174977683534Smrg# Documentation tools are not always available on all platforms and sometimes
175077683534Smrg# not at the appropriate level. This macro enables a module to test for the
175177683534Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
175277683534Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
175377683534Smrg# as whether or not to use the ps2pdf package.
175477683534Smrg#
175577683534Smrg# Interface to module:
175677683534Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
175777683534Smrg# PS2PDF:	returns the path of the ps2pdf program found
175877683534Smrg#		returns the path set by the user in the environment
175977683534Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
176077683534Smrg#		 'no' user instructs the module not to use ps2pdf
176177683534Smrg#
176277683534Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
176377683534Smrg#
176477683534SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
176577683534SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
176677683534SmrgAC_ARG_WITH(ps2pdf,
176777683534Smrg	AS_HELP_STRING([--with-ps2pdf],
176877683534Smrg	   [Use ps2pdf to regenerate documentation (default: yes, if installed)]),
176977683534Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=auto])
177077683534Smrg
177177683534Smrgif test "x$use_ps2pdf" = x"auto"; then
177277683534Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
177377683534Smrg   if test "x$PS2PDF" = "x"; then
177477683534Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
177577683534Smrg	have_ps2pdf=no
177677683534Smrg   else
177777683534Smrg        have_ps2pdf=yes
177877683534Smrg   fi
177977683534Smrgelif test "x$use_ps2pdf" = x"yes" ; then
178077683534Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
178177683534Smrg   if test "x$PS2PDF" = "x"; then
178277683534Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
178377683534Smrg   fi
178477683534Smrg   have_ps2pdf=yes
178577683534Smrgelif test "x$use_ps2pdf" = x"no" ; then
178677683534Smrg   if test "x$PS2PDF" != "x"; then
178777683534Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
178877683534Smrg   fi
178977683534Smrg   have_ps2pdf=no
1790a8fdb4bcSmrgelse
179177683534Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
1792a8fdb4bcSmrgfi
179377683534SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
179477683534Smrg]) # XORG_WITH_PS2PDF
1795a8fdb4bcSmrg
179677683534Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
179777683534Smrg# ----------------
179877683534Smrg# Minimum version: 1.6.0
1799a8fdb4bcSmrg#
180077683534Smrg# Documentation tools are not always available on all platforms and sometimes
180177683534Smrg# not at the appropriate level. This macro enables a builder to skip all
180277683534Smrg# documentation targets except traditional man pages.
180377683534Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
180477683534Smrg# maximum flexibilty in controlling documentation building.
180577683534Smrg# Refer to:
180677683534Smrg# XORG_WITH_XMLTO         --with-xmlto
180777683534Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
180877683534Smrg# XORG_WITH_DOXYGEN       --with-doxygen
180977683534Smrg# XORG_WITH_FOP           --with-fop
181077683534Smrg# XORG_WITH_GROFF         --with-groff
181177683534Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
181277683534Smrg#
181377683534Smrg# Interface to module:
181477683534Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
181577683534Smrg# --enable-docs: 'yes' user instructs the module to generate docs
181677683534Smrg#		 'no' user instructs the module not to generate docs
181777683534Smrg# parm1:	specify the default value, yes or no.
181877683534Smrg#
181977683534SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
182077683534Smrgdefault=$1
182177683534Smrgif test "x$default" = x ; then
182277683534Smrg  default="yes"
182377683534Smrgfi
182477683534SmrgAC_ARG_ENABLE(docs,
182577683534Smrg	AS_HELP_STRING([--enable-docs],
182677683534Smrg	   [Enable building the documentation (default: yes)]),
182777683534Smrg	   [build_docs=$enableval], [build_docs=$default])
182877683534SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
182977683534SmrgAC_MSG_CHECKING([whether to build documentation])
183077683534SmrgAC_MSG_RESULT([$build_docs])
183177683534Smrg]) # XORG_ENABLE_DOCS
183277683534Smrg
183377683534Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
183477683534Smrg# ----------------
183577683534Smrg# Minimum version: 1.6.0
183677683534Smrg#
183777683534Smrg# This macro enables a builder to skip all developer documentation.
183877683534Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
183977683534Smrg# maximum flexibilty in controlling documentation building.
184077683534Smrg# Refer to:
184177683534Smrg# XORG_WITH_XMLTO         --with-xmlto
184277683534Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
184377683534Smrg# XORG_WITH_DOXYGEN       --with-doxygen
184477683534Smrg# XORG_WITH_FOP           --with-fop
184577683534Smrg# XORG_WITH_GROFF         --with-groff
184677683534Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
184777683534Smrg#
184877683534Smrg# Interface to module:
184977683534Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
185077683534Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
185177683534Smrg#			'no' user instructs the module not to generate developer docs
185277683534Smrg# parm1:		specify the default value, yes or no.
185377683534Smrg#
185477683534SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
185577683534Smrgdevel_default=$1
185677683534Smrgif test "x$devel_default" = x ; then
185777683534Smrg  devel_default="yes"
185877683534Smrgfi
185977683534SmrgAC_ARG_ENABLE(devel-docs,
186077683534Smrg	AS_HELP_STRING([--enable-devel-docs],
186177683534Smrg	   [Enable building the developer documentation (default: yes)]),
186277683534Smrg	   [build_devel_docs=$enableval], [build_devel_docs=$devel_default])
186377683534SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
186477683534SmrgAC_MSG_CHECKING([whether to build developer documentation])
186577683534SmrgAC_MSG_RESULT([$build_devel_docs])
186677683534Smrg]) # XORG_ENABLE_DEVEL_DOCS
186777683534Smrg
186877683534Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
186977683534Smrg# ----------------
187077683534Smrg# Minimum version: 1.6.0
187177683534Smrg#
187277683534Smrg# This macro enables a builder to skip all functional specification targets.
187377683534Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
187477683534Smrg# maximum flexibilty in controlling documentation building.
187577683534Smrg# Refer to:
187677683534Smrg# XORG_WITH_XMLTO         --with-xmlto
187777683534Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
187877683534Smrg# XORG_WITH_DOXYGEN       --with-doxygen
187977683534Smrg# XORG_WITH_FOP           --with-fop
188077683534Smrg# XORG_WITH_GROFF         --with-groff
188177683534Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
188277683534Smrg#
188377683534Smrg# Interface to module:
188477683534Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
188577683534Smrg# --enable-specs:	'yes' user instructs the module to generate specs
188677683534Smrg#			'no' user instructs the module not to generate specs
188777683534Smrg# parm1:		specify the default value, yes or no.
188877683534Smrg#
188977683534SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
189077683534Smrgspec_default=$1
189177683534Smrgif test "x$spec_default" = x ; then
189277683534Smrg  spec_default="yes"
189377683534Smrgfi
189477683534SmrgAC_ARG_ENABLE(specs,
189577683534Smrg	AS_HELP_STRING([--enable-specs],
189677683534Smrg	   [Enable building the specs (default: yes)]),
189777683534Smrg	   [build_specs=$enableval], [build_specs=$spec_default])
189877683534SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
189977683534SmrgAC_MSG_CHECKING([whether to build functional specifications])
190077683534SmrgAC_MSG_RESULT([$build_specs])
190177683534Smrg]) # XORG_ENABLE_SPECS
1902a8fdb4bcSmrg
190377683534Smrg# XORG_CHECK_MALLOC_ZERO
190477683534Smrg# ----------------------
190577683534Smrg# Minimum version: 1.0.0
1906a8fdb4bcSmrg#
190777683534Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
190877683534Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
190977683534Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
191077683534SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
191177683534SmrgAC_ARG_ENABLE(malloc0returnsnull,
191277683534Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
191377683534Smrg		       [malloc(0) returns NULL (default: auto)]),
191477683534Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
191577683534Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
1916a8fdb4bcSmrg
191777683534SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
191877683534Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
191977683534Smrg	AC_RUN_IFELSE([
192077683534Smrgchar *malloc();
192177683534Smrgchar *realloc();
192277683534Smrgchar *calloc();
192377683534Smrgmain() {
192477683534Smrg    char *m0, *r0, *c0, *p;
192577683534Smrg    m0 = malloc(0);
192677683534Smrg    p = malloc(10);
192777683534Smrg    r0 = realloc(p,0);
192877683534Smrg    c0 = calloc(0);
192977683534Smrg    exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1);
193077683534Smrg}],
193177683534Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
193277683534Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
193377683534Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
193477683534Smrgfi
193577683534SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
1936a8fdb4bcSmrg
193777683534Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
193877683534Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
193977683534Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
194077683534Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
194177683534Smrgelse
194277683534Smrg	MALLOC_ZERO_CFLAGS=""
194377683534Smrg	XMALLOC_ZERO_CFLAGS=""
194477683534Smrg	XTMALLOC_ZERO_CFLAGS=""
1945a8fdb4bcSmrgfi
1946a8fdb4bcSmrg
194777683534SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
194877683534SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
194977683534SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
195077683534Smrg]) # XORG_CHECK_MALLOC_ZERO
1951a8fdb4bcSmrg
195277683534Smrg# XORG_WITH_LINT()
195377683534Smrg# ----------------
195477683534Smrg# Minimum version: 1.1.0
1955a8fdb4bcSmrg#
195677683534Smrg# This macro enables the use of a tool that flags some suspicious and
195777683534Smrg# non-portable constructs (likely to be bugs) in C language source code.
195877683534Smrg# It will attempt to locate the tool and use appropriate options.
195977683534Smrg# There are various lint type tools on different platforms.
196077683534Smrg#
196177683534Smrg# Interface to module:
196277683534Smrg# LINT:		returns the path to the tool found on the platform
196377683534Smrg#		or the value set to LINT on the configure cmd line
196477683534Smrg#		also an Automake conditional
196577683534Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
196677683534Smrg#
196777683534Smrg# --with-lint:	'yes' user instructs the module to use lint
196877683534Smrg#		'no' user instructs the module not to use lint (default)
196977683534Smrg#
197077683534Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
197177683534Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
197277683534Smrg#
197377683534SmrgAC_DEFUN([XORG_WITH_LINT],[
1974a8fdb4bcSmrg
197577683534SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
197677683534SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
197777683534SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
197877683534Smrg		[Use a lint-style source code checker (default: disabled)])],
197977683534Smrg		[use_lint=$withval], [use_lint=no])
1980a8fdb4bcSmrg
198177683534Smrg# Obtain platform specific info like program name and options
198277683534Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
198377683534Smrgcase $host_os in
198477683534Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
198577683534Smrg	lint_name=splint
198677683534Smrg	lint_options="-badflag"
198777683534Smrg	;;
198877683534Smrg  *freebsd* | *netbsd*)
198977683534Smrg	lint_name=lint
199077683534Smrg	lint_options="-u -b"
199177683534Smrg	;;
199277683534Smrg  *solaris*)
199377683534Smrg	lint_name=lint
199477683534Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
199577683534Smrg	;;
199677683534Smrgesac
1997a8fdb4bcSmrg
199877683534Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
199977683534Smrgif test "x$use_lint" = x"yes" ; then
200077683534Smrg   AC_PATH_PROG([LINT], [$lint_name])
200177683534Smrg   if test "x$LINT" = "x"; then
200277683534Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
200377683534Smrg   fi
200477683534Smrgelif test "x$use_lint" = x"no" ; then
200577683534Smrg   if test "x$LINT" != "x"; then
200677683534Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
200777683534Smrg   fi
2008a8fdb4bcSmrgelse
200977683534Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2010a8fdb4bcSmrgfi
2011a8fdb4bcSmrg
201277683534Smrg# User supplied flags override default flags
201377683534Smrgif test "x$LINT_FLAGS" != "x"; then
201477683534Smrg   lint_options=$LINT_FLAGS
201577683534Smrgfi
2016a8fdb4bcSmrg
201777683534SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
201877683534SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2019a8fdb4bcSmrg
202077683534Smrg]) # XORG_WITH_LINT
2021a8fdb4bcSmrg
202277683534Smrg# XORG_LINT_LIBRARY(LIBNAME)
202377683534Smrg# --------------------------
202477683534Smrg# Minimum version: 1.1.0
2025a8fdb4bcSmrg#
202677683534Smrg# Sets up flags for building lint libraries for checking programs that call
202777683534Smrg# functions in the library.
202877683534Smrg#
202977683534Smrg# Interface to module:
203077683534Smrg# LINTLIB		- Automake variable with the name of lint library file to make
203177683534Smrg# MAKE_LINT_LIB		- Automake conditional
203277683534Smrg#
203377683534Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
203477683534Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2035a8fdb4bcSmrg
203677683534SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
203777683534SmrgAC_REQUIRE([XORG_WITH_LINT])
203877683534SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
203977683534Smrg	[Create lint library (default: disabled)])],
204077683534Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2041a8fdb4bcSmrg
204277683534Smrgif test "x$make_lint_lib" = x"yes" ; then
204377683534Smrg   LINTLIB=llib-l$1.ln
204477683534Smrg   if test "x$LINT" = "x"; then
204577683534Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
204677683534Smrg   fi
204777683534Smrgelif test "x$make_lint_lib" != x"no" ; then
204877683534Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
204977683534Smrgfi
2050a8fdb4bcSmrg
205177683534SmrgAC_SUBST(LINTLIB)
205277683534SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2053a8fdb4bcSmrg
205477683534Smrg]) # XORG_LINT_LIBRARY
2055a8fdb4bcSmrg
205677683534Smrg# XORG_CWARNFLAGS
205777683534Smrg# ---------------
205877683534Smrg# Minimum version: 1.2.0
205977683534Smrg#
206077683534Smrg# Defines CWARNFLAGS to enable C compiler warnings.
206177683534Smrg#
206277683534SmrgAC_DEFUN([XORG_CWARNFLAGS], [
206377683534SmrgAC_REQUIRE([AC_PROG_CC_C99])
206477683534Smrgif  test "x$GCC" = xyes ; then
206577683534Smrg    CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
206677683534Smrg-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
206777683534Smrg-Wbad-function-cast -Wformat=2"
206877683534Smrg    case `$CC -dumpversion` in
206977683534Smrg    3.4.* | 4.*)
207077683534Smrg	CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
207177683534Smrg	;;
207277683534Smrg    esac
207377683534Smrgelse
207477683534Smrg    AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
207577683534Smrg    if test "x$SUNCC" = "xyes"; then
207677683534Smrg	CWARNFLAGS="-v"
207777683534Smrg    fi
207877683534Smrgfi
207977683534SmrgAC_SUBST(CWARNFLAGS)
208077683534Smrg]) # XORG_CWARNFLAGS
2081a8fdb4bcSmrg
208277683534Smrg# XORG_STRICT_OPTION
208377683534Smrg# -----------------------
208477683534Smrg# Minimum version: 1.3.0
208577683534Smrg#
208677683534Smrg# Add configure option to enable strict compilation
208777683534SmrgAC_DEFUN([XORG_STRICT_OPTION], [
208877683534Smrg# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
208977683534SmrgAC_REQUIRE([AC_PROG_CC_C99])
209077683534SmrgAC_REQUIRE([XORG_CWARNFLAGS])
2091a8fdb4bcSmrg
209277683534SmrgAC_ARG_ENABLE(strict-compilation,
209377683534Smrg			  AS_HELP_STRING([--enable-strict-compilation],
209477683534Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
209577683534Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
209677683534Smrgif test "x$STRICT_COMPILE" = "xyes"; then
209777683534Smrg	AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
209877683534Smrg	AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
209977683534Smrg	if test "x$GCC" = xyes ; then
210077683534Smrg		STRICT_CFLAGS="-pedantic -Werror"
210177683534Smrg	elif test "x$SUNCC" = "xyes"; then
210277683534Smrg		STRICT_CFLAGS="-errwarn"
210377683534Smrg    elif test "x$INTELCC" = "xyes"; then
210477683534Smrg		STRICT_CFLAGS="-Werror"
210577683534Smrg	fi
210677683534Smrgfi
210777683534SmrgCWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
210877683534SmrgAC_SUBST([CWARNFLAGS])
210977683534Smrg]) # XORG_STRICT_OPTION
211077683534Smrg
211177683534Smrg# XORG_DEFAULT_OPTIONS
211277683534Smrg# --------------------
211377683534Smrg# Minimum version: 1.3.0
2114a8fdb4bcSmrg#
211577683534Smrg# Defines default options for X.Org modules.
211677683534Smrg#
211777683534SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
211877683534SmrgAC_REQUIRE([AC_PROG_INSTALL])
211977683534SmrgXORG_CWARNFLAGS
212077683534SmrgXORG_STRICT_OPTION
212177683534SmrgXORG_RELEASE_VERSION
212277683534SmrgXORG_CHANGELOG
212377683534SmrgXORG_INSTALL
212477683534SmrgXORG_MANPAGE_SECTIONS
212577683534Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
212677683534Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
212777683534Smrg]) # XORG_DEFAULT_OPTIONS
2128a8fdb4bcSmrg
212977683534Smrg# XORG_INSTALL()
213077683534Smrg# ----------------
213177683534Smrg# Minimum version: 1.4.0
213277683534Smrg#
213377683534Smrg# Defines the variable INSTALL_CMD as the command to copy
213477683534Smrg# INSTALL from $prefix/share/util-macros.
213577683534Smrg#
213677683534SmrgAC_DEFUN([XORG_INSTALL], [
213777683534SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
213877683534Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
213977683534SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
214077683534Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
214177683534Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
214277683534Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
214377683534SmrgAC_SUBST([INSTALL_CMD])
214477683534Smrg]) # XORG_INSTALL
214577683534Smrgdnl Copyright 2005 Red Hat, Inc
214677683534Smrgdnl
214777683534Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
214877683534Smrgdnl documentation for any purpose is hereby granted without fee, provided that
214977683534Smrgdnl the above copyright notice appear in all copies and that both that
215077683534Smrgdnl copyright notice and this permission notice appear in supporting
215177683534Smrgdnl documentation.
215277683534Smrgdnl
215377683534Smrgdnl The above copyright notice and this permission notice shall be included
215477683534Smrgdnl in all copies or substantial portions of the Software.
215577683534Smrgdnl
215677683534Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
215777683534Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
215877683534Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
215977683534Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
216077683534Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
216177683534Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
216277683534Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
216377683534Smrgdnl
216477683534Smrgdnl Except as contained in this notice, the name of the copyright holders shall
216577683534Smrgdnl not be used in advertising or otherwise to promote the sale, use or
216677683534Smrgdnl other dealings in this Software without prior written authorization
216777683534Smrgdnl from the copyright holders.
216877683534Smrgdnl
2169a8fdb4bcSmrg
217077683534Smrg# XORG_RELEASE_VERSION
217177683534Smrg# --------------------
217277683534Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
217377683534Smrg 
217477683534SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
217577683534Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
217677683534Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
217777683534Smrg		[Major version of this package])
217877683534Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
217977683534Smrg	if test "x$PVM" = "x"; then
218077683534Smrg		PVM="0"
218177683534Smrg	fi
218277683534Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
218377683534Smrg		[$PVM],
218477683534Smrg		[Minor version of this package])
218577683534Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
218677683534Smrg	if test "x$PVP" = "x"; then
218777683534Smrg		PVP="0"
218877683534Smrg	fi
218977683534Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
219077683534Smrg		[$PVP],
219177683534Smrg		[Patch version of this package])
219277683534Smrg])
2193dbe7da2eSmrg
219477683534Smrg# XORG_CHANGELOG()
219577683534Smrg# ----------------
219677683534Smrg# Minimum version: 1.2.0
219777683534Smrg#
219877683534Smrg# Defines the variable CHANGELOG_CMD as the command to generate
219977683534Smrg# ChangeLog from git.
220077683534Smrg#
220177683534Smrg#
220277683534SmrgAC_DEFUN([XORG_CHANGELOG], [
220377683534SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
220477683534Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
220577683534Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
220677683534Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
220777683534SmrgAC_SUBST([CHANGELOG_CMD])
220877683534Smrg]) # XORG_CHANGELOG
2209a8fdb4bcSmrg
221077683534Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
221177683534Smrg# 
221277683534Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
221377683534Smrg#
221477683534Smrg# This program is free software; you can redistribute it and/or modify
221577683534Smrg# it under the terms of the GNU General Public License as published by
221677683534Smrg# the Free Software Foundation; either version 2 of the License, or
221777683534Smrg# (at your option) any later version.
221877683534Smrg#
221977683534Smrg# This program is distributed in the hope that it will be useful, but
222077683534Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
222177683534Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
222277683534Smrg# General Public License for more details.
222377683534Smrg#
222477683534Smrg# You should have received a copy of the GNU General Public License
222577683534Smrg# along with this program; if not, write to the Free Software
222677683534Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
222777683534Smrg#
222877683534Smrg# As a special exception to the GNU General Public License, if you
222977683534Smrg# distribute this file as part of a program that contains a
223077683534Smrg# configuration script generated by Autoconf, you may include it under
223177683534Smrg# the same distribution terms that you use for the rest of that program.
2232a8fdb4bcSmrg
223377683534Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
223477683534Smrg# ----------------------------------
223577683534SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
223677683534Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
223777683534Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
223877683534SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
223977683534Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
224077683534Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
2241a8fdb4bcSmrgfi
224277683534Smrgif test -n "$PKG_CONFIG"; then
224377683534Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
224477683534Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
224577683534Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
224677683534Smrg		AC_MSG_RESULT([yes])
224777683534Smrg	else
224877683534Smrg		AC_MSG_RESULT([no])
224977683534Smrg		PKG_CONFIG=""
225077683534Smrg	fi
225177683534Smrg		
225277683534Smrgfi[]dnl
225377683534Smrg])# PKG_PROG_PKG_CONFIG
2254a8fdb4bcSmrg
225577683534Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2256dbe7da2eSmrg#
225777683534Smrg# Check to see whether a particular set of modules exists.  Similar
225877683534Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
225977683534Smrg#
226077683534Smrg#
226177683534Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
226277683534Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
226377683534Smrg# PKG_CHECK_EXISTS manually
226477683534Smrg# --------------------------------------------------------------
226577683534SmrgAC_DEFUN([PKG_CHECK_EXISTS],
226677683534Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
226777683534Smrgif test -n "$PKG_CONFIG" && \
226877683534Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
226977683534Smrg  m4_ifval([$2], [$2], [:])
227077683534Smrgm4_ifvaln([$3], [else
227177683534Smrg  $3])dnl
227277683534Smrgfi])
2273dbe7da2eSmrg
2274dbe7da2eSmrg
227577683534Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
227677683534Smrg# ---------------------------------------------
227777683534Smrgm4_define([_PKG_CONFIG],
227877683534Smrg[if test -n "$$1"; then
227977683534Smrg    pkg_cv_[]$1="$$1"
228077683534Smrg elif test -n "$PKG_CONFIG"; then
228177683534Smrg    PKG_CHECK_EXISTS([$3],
228277683534Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
228377683534Smrg		     [pkg_failed=yes])
228477683534Smrg else
228577683534Smrg    pkg_failed=untried
228677683534Smrgfi[]dnl
228777683534Smrg])# _PKG_CONFIG
2288dbe7da2eSmrg
228977683534Smrg# _PKG_SHORT_ERRORS_SUPPORTED
229077683534Smrg# -----------------------------
229177683534SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
229277683534Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
229377683534Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
229477683534Smrg        _pkg_short_errors_supported=yes
229577683534Smrgelse
229677683534Smrg        _pkg_short_errors_supported=no
229777683534Smrgfi[]dnl
229877683534Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
2299a8fdb4bcSmrg
2300a8fdb4bcSmrg
230177683534Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
230277683534Smrg# [ACTION-IF-NOT-FOUND])
2303a8fdb4bcSmrg#
230477683534Smrg#
230577683534Smrg# Note that if there is a possibility the first call to
230677683534Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
230777683534Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
230877683534Smrg#
230977683534Smrg#
231077683534Smrg# --------------------------------------------------------------
231177683534SmrgAC_DEFUN([PKG_CHECK_MODULES],
231277683534Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
231377683534SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
231477683534SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
2315a8fdb4bcSmrg
231677683534Smrgpkg_failed=no
231777683534SmrgAC_MSG_CHECKING([for $1])
2318dbe7da2eSmrg
231977683534Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
232077683534Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
2321a8fdb4bcSmrg
232277683534Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
232377683534Smrgand $1[]_LIBS to avoid the need to call pkg-config.
232477683534SmrgSee the pkg-config man page for more details.])
2325dbe7da2eSmrg
232677683534Smrgif test $pkg_failed = yes; then
232777683534Smrg        _PKG_SHORT_ERRORS_SUPPORTED
232877683534Smrg        if test $_pkg_short_errors_supported = yes; then
232977683534Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
233077683534Smrg        else 
233177683534Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
233277683534Smrg        fi
233377683534Smrg	# Put the nasty error message in config.log where it belongs
233477683534Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
2335a8fdb4bcSmrg
233677683534Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
233777683534Smrg[Package requirements ($2) were not met:
2338a8fdb4bcSmrg
233977683534Smrg$$1_PKG_ERRORS
2340a8fdb4bcSmrg
234177683534SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
234277683534Smrginstalled software in a non-standard prefix.
2343a8fdb4bcSmrg
234477683534Smrg_PKG_TEXT
234577683534Smrg])],
234677683534Smrg		[AC_MSG_RESULT([no])
234777683534Smrg                $4])
234877683534Smrgelif test $pkg_failed = untried; then
234977683534Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
235077683534Smrg[The pkg-config script could not be found or is too old.  Make sure it
235177683534Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
235277683534Smrgpath to pkg-config.
2353a8fdb4bcSmrg
235477683534Smrg_PKG_TEXT
2355a8fdb4bcSmrg
235677683534SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
235777683534Smrg		[$4])
235877683534Smrgelse
235977683534Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
236077683534Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
236177683534Smrg        AC_MSG_RESULT([yes])
236277683534Smrg	ifelse([$3], , :, [$3])
236377683534Smrgfi[]dnl
236477683534Smrg])# PKG_CHECK_MODULES
2365a8fdb4bcSmrg
236677683534Smrgm4_include([acinclude.m4])
2367