aclocal.m4 revision 6a45684f
16a45684fSmrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
26a45684fSmrg
36a45684fSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
4e6232409Smrg
5e6232409Smrg# This file is free software; the Free Software Foundation
6e6232409Smrg# gives unlimited permission to copy and/or distribute it,
7e6232409Smrg# with or without modifications, as long as this notice is preserved.
8e6232409Smrg
9e6232409Smrg# This program is distributed in the hope that it will be useful,
10e6232409Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11e6232409Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12e6232409Smrg# PARTICULAR PURPOSE.
13e6232409Smrg
146a45684fSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
158fff3f40Smrgm4_ifndef([AC_AUTOCONF_VERSION],
168fff3f40Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
176a45684fSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
186a45684fSmrg[m4_warning([this file was generated for autoconf 2.69.
198fff3f40SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
208fff3f40SmrgIf you have problems, you may need to regenerate the build system entirely.
216a45684fSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22e6232409Smrg
236a45684fSmrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
248fff3f40Smrg#
2594a251fdSmrg# This file is free software; the Free Software Foundation
2694a251fdSmrg# gives unlimited permission to copy and/or distribute it,
2794a251fdSmrg# with or without modifications, as long as this notice is preserved.
28e6232409Smrg
2994a251fdSmrg# AM_AUTOMAKE_VERSION(VERSION)
3094a251fdSmrg# ----------------------------
3194a251fdSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3294a251fdSmrg# generated from the m4 files accompanying Automake X.Y.
3394a251fdSmrg# (This private macro should not be called outside this file.)
3494a251fdSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
356a45684fSmrg[am__api_version='1.15'
3694a251fdSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3794a251fdSmrgdnl require some minimum version.  Point them to the right macro.
386a45684fSmrgm4_if([$1], [1.15], [],
3994a251fdSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4094a251fdSmrg])
41e6232409Smrg
4294a251fdSmrg# _AM_AUTOCONF_VERSION(VERSION)
4394a251fdSmrg# -----------------------------
4494a251fdSmrg# aclocal traces this macro to find the Autoconf version.
4594a251fdSmrg# This is a private macro too.  Using m4_define simplifies
4694a251fdSmrg# the logic in aclocal, which can simply ignore this definition.
4794a251fdSmrgm4_define([_AM_AUTOCONF_VERSION], [])
488fff3f40Smrg
4994a251fdSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5094a251fdSmrg# -------------------------------
5194a251fdSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5294a251fdSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5394a251fdSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
546a45684fSmrg[AM_AUTOMAKE_VERSION([1.15])dnl
5594a251fdSmrgm4_ifndef([AC_AUTOCONF_VERSION],
5694a251fdSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5794a251fdSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
588fff3f40Smrg
5994a251fdSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
608fff3f40Smrg
616a45684fSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
6294a251fdSmrg#
6394a251fdSmrg# This file is free software; the Free Software Foundation
6494a251fdSmrg# gives unlimited permission to copy and/or distribute it,
6594a251fdSmrg# with or without modifications, as long as this notice is preserved.
668fff3f40Smrg
6794a251fdSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
686a45684fSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
696a45684fSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70e6232409Smrg#
7194a251fdSmrg# Of course, Automake must honor this variable whenever it calls a
7294a251fdSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7394a251fdSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7494a251fdSmrg# depending on how configure is run.  This is pretty annoying, since
7594a251fdSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7694a251fdSmrg# source directory, any form will work fine, but in subdirectories a
7794a251fdSmrg# relative path needs to be adjusted first.
78e6232409Smrg#
7994a251fdSmrg# $ac_aux_dir/missing
8094a251fdSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8194a251fdSmrg# $top_srcdir/$ac_aux_dir/missing
8294a251fdSmrg#    fails if $ac_aux_dir is absolute,
8394a251fdSmrg#    fails when called from a subdirectory in a VPATH build with
8494a251fdSmrg#          a relative $ac_aux_dir
85e6232409Smrg#
8694a251fdSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8794a251fdSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
886a45684fSmrg# harmless because $srcdir is '.', but things will broke when you
8994a251fdSmrg# start a VPATH build or use an absolute $srcdir.
90e6232409Smrg#
9194a251fdSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9294a251fdSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9394a251fdSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9494a251fdSmrg# and then we would define $MISSING as
9594a251fdSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9694a251fdSmrg# This will work as long as MISSING is not called from configure, because
9794a251fdSmrg# unfortunately $(top_srcdir) has no meaning in configure.
9894a251fdSmrg# However there are other variables, like CC, which are often used in
9994a251fdSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10094a251fdSmrg#
10194a251fdSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
10294a251fdSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
10394a251fdSmrg# configured tree to be moved without reconfiguration.
104e6232409Smrg
10594a251fdSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1066a45684fSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1076a45684fSmrg# Expand $ac_aux_dir to an absolute path.
1086a45684fSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10994a251fdSmrg])
110e6232409Smrg
11194a251fdSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112e6232409Smrg
1136a45684fSmrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
11494a251fdSmrg#
11594a251fdSmrg# This file is free software; the Free Software Foundation
11694a251fdSmrg# gives unlimited permission to copy and/or distribute it,
11794a251fdSmrg# with or without modifications, as long as this notice is preserved.
118e6232409Smrg
11994a251fdSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12094a251fdSmrg# -------------------------------------
12194a251fdSmrg# Define a conditional.
12294a251fdSmrgAC_DEFUN([AM_CONDITIONAL],
1236a45684fSmrg[AC_PREREQ([2.52])dnl
1246a45684fSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1256a45684fSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12694a251fdSmrgAC_SUBST([$1_TRUE])dnl
12794a251fdSmrgAC_SUBST([$1_FALSE])dnl
12894a251fdSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
12994a251fdSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13094a251fdSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13194a251fdSmrgif $2; then
13294a251fdSmrg  $1_TRUE=
13394a251fdSmrg  $1_FALSE='#'
13494a251fdSmrgelse
13594a251fdSmrg  $1_TRUE='#'
13694a251fdSmrg  $1_FALSE=
13794a251fdSmrgfi
13894a251fdSmrgAC_CONFIG_COMMANDS_PRE(
13994a251fdSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14094a251fdSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14194a251fdSmrgUsually this means the macro was only invoked conditionally.]])
14294a251fdSmrgfi])])
143e6232409Smrg
1446a45684fSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
14594a251fdSmrg#
14694a251fdSmrg# This file is free software; the Free Software Foundation
14794a251fdSmrg# gives unlimited permission to copy and/or distribute it,
14894a251fdSmrg# with or without modifications, as long as this notice is preserved.
149e6232409Smrg
150e6232409Smrg
1516a45684fSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
15294a251fdSmrg# written in clear, in which case automake, when reading aclocal.m4,
15394a251fdSmrg# will think it sees a *use*, and therefore will trigger all it's
15494a251fdSmrg# C support machinery.  Also note that it means that autoscan, seeing
15594a251fdSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156e6232409Smrg
157e6232409Smrg
15894a251fdSmrg# _AM_DEPENDENCIES(NAME)
15994a251fdSmrg# ----------------------
16094a251fdSmrg# See how the compiler implements dependency checking.
1616a45684fSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
16294a251fdSmrg# We try a few techniques and use that to set a single cache variable.
16394a251fdSmrg#
16494a251fdSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
16594a251fdSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
16694a251fdSmrg# dependency, and given that the user is not expected to run this macro,
16794a251fdSmrg# just rely on AC_PROG_CC.
16894a251fdSmrgAC_DEFUN([_AM_DEPENDENCIES],
16994a251fdSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17094a251fdSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17194a251fdSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17294a251fdSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173e6232409Smrg
1746a45684fSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1756a45684fSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1766a45684fSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1776a45684fSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1786a45684fSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1796a45684fSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1806a45684fSmrg                    [depcc="$$1"   am_compiler_list=])
181e6232409Smrg
18294a251fdSmrgAC_CACHE_CHECK([dependency style of $depcc],
18394a251fdSmrg               [am_cv_$1_dependencies_compiler_type],
18494a251fdSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18594a251fdSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
18694a251fdSmrg  # making bogus files that we don't know about and never remove.  For
18794a251fdSmrg  # instance it was reported that on HP-UX the gcc test will end up
1886a45684fSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1896a45684fSmrg  # in D".
19094a251fdSmrg  rm -rf conftest.dir
19194a251fdSmrg  mkdir conftest.dir
19294a251fdSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19394a251fdSmrg  # using a relative directory.
19494a251fdSmrg  cp "$am_depcomp" conftest.dir
19594a251fdSmrg  cd conftest.dir
19694a251fdSmrg  # We will build objects and dependencies in a subdirectory because
19794a251fdSmrg  # it helps to detect inapplicable dependency modes.  For instance
19894a251fdSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
19994a251fdSmrg  # side effect of compilation, but ICC will put the dependencies in
20094a251fdSmrg  # the current directory while Tru64 will put them in the object
20194a251fdSmrg  # directory.
20294a251fdSmrg  mkdir sub
203e6232409Smrg
20494a251fdSmrg  am_cv_$1_dependencies_compiler_type=none
20594a251fdSmrg  if test "$am_compiler_list" = ""; then
20694a251fdSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
20794a251fdSmrg  fi
20894a251fdSmrg  am__universal=false
20994a251fdSmrg  m4_case([$1], [CC],
21094a251fdSmrg    [case " $depcc " in #(
21194a251fdSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21294a251fdSmrg     esac],
21394a251fdSmrg    [CXX],
21494a251fdSmrg    [case " $depcc " in #(
21594a251fdSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21694a251fdSmrg     esac])
217e6232409Smrg
21894a251fdSmrg  for depmode in $am_compiler_list; do
21994a251fdSmrg    # Setup a source with many dependencies, because some compilers
22094a251fdSmrg    # like to wrap large dependency lists on column 80 (with \), and
22194a251fdSmrg    # we should not choose a depcomp mode which is confused by this.
22294a251fdSmrg    #
22394a251fdSmrg    # We need to recreate these files for each test, as the compiler may
22494a251fdSmrg    # overwrite some of them when testing with obscure command lines.
22594a251fdSmrg    # This happens at least with the AIX C compiler.
22694a251fdSmrg    : > sub/conftest.c
22794a251fdSmrg    for i in 1 2 3 4 5 6; do
22894a251fdSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2296a45684fSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2306a45684fSmrg      # Solaris 10 /bin/sh.
2316a45684fSmrg      echo '/* dummy */' > sub/conftst$i.h
23294a251fdSmrg    done
23394a251fdSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234e6232409Smrg
2356a45684fSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
23694a251fdSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2376a45684fSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2386a45684fSmrg    # versions had trouble with output in subdirs.
23994a251fdSmrg    am__obj=sub/conftest.${OBJEXT-o}
24094a251fdSmrg    am__minus_obj="-o $am__obj"
24194a251fdSmrg    case $depmode in
24294a251fdSmrg    gcc)
24394a251fdSmrg      # This depmode causes a compiler race in universal mode.
24494a251fdSmrg      test "$am__universal" = false || continue
24594a251fdSmrg      ;;
24694a251fdSmrg    nosideeffect)
2476a45684fSmrg      # After this tag, mechanisms are not by side-effect, so they'll
2486a45684fSmrg      # only be used when explicitly requested.
24994a251fdSmrg      if test "x$enable_dependency_tracking" = xyes; then
25094a251fdSmrg	continue
25194a251fdSmrg      else
25294a251fdSmrg	break
25394a251fdSmrg      fi
25494a251fdSmrg      ;;
25594a251fdSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2566a45684fSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
25794a251fdSmrg      # not run yet.  These depmodes are late enough in the game, and
25894a251fdSmrg      # so weak that their functioning should not be impacted.
25994a251fdSmrg      am__obj=conftest.${OBJEXT-o}
26094a251fdSmrg      am__minus_obj=
26194a251fdSmrg      ;;
26294a251fdSmrg    none) break ;;
26394a251fdSmrg    esac
26494a251fdSmrg    if depmode=$depmode \
26594a251fdSmrg       source=sub/conftest.c object=$am__obj \
26694a251fdSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
26794a251fdSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
26894a251fdSmrg         >/dev/null 2>conftest.err &&
26994a251fdSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27094a251fdSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27194a251fdSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27294a251fdSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27394a251fdSmrg      # icc doesn't choke on unknown options, it will just issue warnings
27494a251fdSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
27594a251fdSmrg      # that says an option was ignored or not supported.
27694a251fdSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
27794a251fdSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
27894a251fdSmrg      # The diagnosis changed in icc 8.0:
27994a251fdSmrg      #   icc: Command line remark: option '-MP' not supported
28094a251fdSmrg      if (grep 'ignoring option' conftest.err ||
28194a251fdSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28294a251fdSmrg        am_cv_$1_dependencies_compiler_type=$depmode
28394a251fdSmrg        break
28494a251fdSmrg      fi
28594a251fdSmrg    fi
28694a251fdSmrg  done
28794a251fdSmrg
28894a251fdSmrg  cd ..
28994a251fdSmrg  rm -rf conftest.dir
290e6232409Smrgelse
29194a251fdSmrg  am_cv_$1_dependencies_compiler_type=none
292e6232409Smrgfi
29394a251fdSmrg])
29494a251fdSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29594a251fdSmrgAM_CONDITIONAL([am__fastdep$1], [
29694a251fdSmrg  test "x$enable_dependency_tracking" != xno \
29794a251fdSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
29894a251fdSmrg])
299e6232409Smrg
300e6232409Smrg
30194a251fdSmrg# AM_SET_DEPDIR
30294a251fdSmrg# -------------
30394a251fdSmrg# Choose a directory name for dependency files.
3046a45684fSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
30594a251fdSmrgAC_DEFUN([AM_SET_DEPDIR],
30694a251fdSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
30794a251fdSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
30894a251fdSmrg])
309e6232409Smrg
310e6232409Smrg
31194a251fdSmrg# AM_DEP_TRACK
31294a251fdSmrg# ------------
31394a251fdSmrgAC_DEFUN([AM_DEP_TRACK],
3146a45684fSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3156a45684fSmrgAS_HELP_STRING(
3166a45684fSmrg  [--enable-dependency-tracking],
3176a45684fSmrg  [do not reject slow dependency extractors])
3186a45684fSmrgAS_HELP_STRING(
3196a45684fSmrg  [--disable-dependency-tracking],
3206a45684fSmrg  [speeds up one-time build])])
32194a251fdSmrgif test "x$enable_dependency_tracking" != xno; then
32294a251fdSmrg  am_depcomp="$ac_aux_dir/depcomp"
32394a251fdSmrg  AMDEPBACKSLASH='\'
32494a251fdSmrg  am__nodep='_no'
325e6232409Smrgfi
32694a251fdSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32794a251fdSmrgAC_SUBST([AMDEPBACKSLASH])dnl
32894a251fdSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32994a251fdSmrgAC_SUBST([am__nodep])dnl
33094a251fdSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33194a251fdSmrg])
332e6232409Smrg
33394a251fdSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334e6232409Smrg
3356a45684fSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
33694a251fdSmrg#
33794a251fdSmrg# This file is free software; the Free Software Foundation
33894a251fdSmrg# gives unlimited permission to copy and/or distribute it,
33994a251fdSmrg# with or without modifications, as long as this notice is preserved.
340e6232409Smrg
341e6232409Smrg
34294a251fdSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34394a251fdSmrg# ------------------------------
34494a251fdSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34594a251fdSmrg[{
3466a45684fSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
34794a251fdSmrg  # are listed without --file.  Let's play safe and only enable the eval
34894a251fdSmrg  # if we detect the quoting.
34994a251fdSmrg  case $CONFIG_FILES in
35094a251fdSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
35194a251fdSmrg  *)   set x $CONFIG_FILES ;;
35294a251fdSmrg  esac
35394a251fdSmrg  shift
35494a251fdSmrg  for mf
35594a251fdSmrg  do
35694a251fdSmrg    # Strip MF so we end up with the name of the file.
35794a251fdSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
35894a251fdSmrg    # Check whether this is an Automake generated Makefile or not.
3596a45684fSmrg    # We used to match only the files named 'Makefile.in', but
36094a251fdSmrg    # some people rename them; so instead we look at the file content.
36194a251fdSmrg    # Grep'ing the first line is not enough: some people post-process
36294a251fdSmrg    # each Makefile.in and add a new line on top of each file to say so.
36394a251fdSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
36494a251fdSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
36594a251fdSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
36694a251fdSmrg      dirpart=`AS_DIRNAME("$mf")`
36794a251fdSmrg    else
36894a251fdSmrg      continue
36994a251fdSmrg    fi
37094a251fdSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
3716a45684fSmrg    # from the Makefile without running 'make'.
37294a251fdSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
37394a251fdSmrg    test -z "$DEPDIR" && continue
37494a251fdSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
3756a45684fSmrg    test -z "$am__include" && continue
37694a251fdSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
37794a251fdSmrg    # Find all dependency output files, they are included files with
37894a251fdSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
37994a251fdSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
38094a251fdSmrg    # expansion.
38194a251fdSmrg    for file in `sed -n "
38294a251fdSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
3836a45684fSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
38494a251fdSmrg      # Make sure the directory exists.
38594a251fdSmrg      test -f "$dirpart/$file" && continue
38694a251fdSmrg      fdir=`AS_DIRNAME(["$file"])`
38794a251fdSmrg      AS_MKDIR_P([$dirpart/$fdir])
38894a251fdSmrg      # echo "creating $dirpart/$file"
38994a251fdSmrg      echo '# dummy' > "$dirpart/$file"
39094a251fdSmrg    done
39194a251fdSmrg  done
39294a251fdSmrg}
39394a251fdSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
394e6232409Smrg
395e6232409Smrg
39694a251fdSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39794a251fdSmrg# -----------------------------
39894a251fdSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
399e6232409Smrg#
40094a251fdSmrg# This code is only required when automatic dependency tracking
4016a45684fSmrg# is enabled.  FIXME.  This creates each '.P' file that we will
40294a251fdSmrg# need in order to bootstrap the dependency handling code.
40394a251fdSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
40494a251fdSmrg[AC_CONFIG_COMMANDS([depfiles],
40594a251fdSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
40694a251fdSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
40794a251fdSmrg])
408e6232409Smrg
40994a251fdSmrg# Do all the work for Automake.                             -*- Autoconf -*-
410e6232409Smrg
4116a45684fSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
412e6232409Smrg#
41394a251fdSmrg# This file is free software; the Free Software Foundation
41494a251fdSmrg# gives unlimited permission to copy and/or distribute it,
41594a251fdSmrg# with or without modifications, as long as this notice is preserved.
416e6232409Smrg
41794a251fdSmrg# This macro actually does too much.  Some checks are only needed if
41894a251fdSmrg# your package does certain things.  But this isn't really a big deal.
419e6232409Smrg
4206a45684fSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4216a45684fSmrgm4_define([AC_PROG_CC],
4226a45684fSmrgm4_defn([AC_PROG_CC])
4236a45684fSmrg[_AM_PROG_CC_C_O
4246a45684fSmrg])
4256a45684fSmrg
42694a251fdSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
42794a251fdSmrg# AM_INIT_AUTOMAKE([OPTIONS])
42894a251fdSmrg# -----------------------------------------------
42994a251fdSmrg# The call with PACKAGE and VERSION arguments is the old style
43094a251fdSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
43194a251fdSmrg# and VERSION should now be passed to AC_INIT and removed from
43294a251fdSmrg# the call to AM_INIT_AUTOMAKE.
43394a251fdSmrg# We support both call styles for the transition.  After
43494a251fdSmrg# the next Automake release, Autoconf can make the AC_INIT
43594a251fdSmrg# arguments mandatory, and then we can depend on a new Autoconf
43694a251fdSmrg# release and drop the old call support.
43794a251fdSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4386a45684fSmrg[AC_PREREQ([2.65])dnl
43994a251fdSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
44094a251fdSmrgdnl the ones we care about.
44194a251fdSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
44294a251fdSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
44394a251fdSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44494a251fdSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44594a251fdSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44694a251fdSmrg  # is not polluted with repeated "-I."
44794a251fdSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44894a251fdSmrg  # test to see if srcdir already configured
44994a251fdSmrg  if test -f $srcdir/config.status; then
45094a251fdSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
45194a251fdSmrg  fi
452e6232409Smrgfi
453e6232409Smrg
45494a251fdSmrg# test whether we have cygpath
45594a251fdSmrgif test -z "$CYGPATH_W"; then
45694a251fdSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45794a251fdSmrg    CYGPATH_W='cygpath -w'
45894a251fdSmrg  else
45994a251fdSmrg    CYGPATH_W=echo
46094a251fdSmrg  fi
46194a251fdSmrgfi
46294a251fdSmrgAC_SUBST([CYGPATH_W])
463e6232409Smrg
46494a251fdSmrg# Define the identity of the package.
46594a251fdSmrgdnl Distinguish between old-style and new-style calls.
46694a251fdSmrgm4_ifval([$2],
4676a45684fSmrg[AC_DIAGNOSE([obsolete],
4686a45684fSmrg             [$0: two- and three-arguments forms are deprecated.])
4696a45684fSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
47094a251fdSmrg AC_SUBST([PACKAGE], [$1])dnl
47194a251fdSmrg AC_SUBST([VERSION], [$2])],
47294a251fdSmrg[_AM_SET_OPTIONS([$1])dnl
47394a251fdSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4746a45684fSmrgm4_if(
4756a45684fSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
4766a45684fSmrg  [ok:ok],,
47794a251fdSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47894a251fdSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47994a251fdSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
480e6232409Smrg
48194a251fdSmrg_AM_IF_OPTION([no-define],,
4826a45684fSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4836a45684fSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
484e6232409Smrg
48594a251fdSmrg# Some tools Automake needs.
48694a251fdSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48794a251fdSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4886a45684fSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4896a45684fSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4906a45684fSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4916a45684fSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4926a45684fSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
49394a251fdSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
49494a251fdSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4956a45684fSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4966a45684fSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
4976a45684fSmrg# dies out for good.  For more background, see:
4986a45684fSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
4996a45684fSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
5006a45684fSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
5016a45684fSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
5026a45684fSmrg# system "awk" is bad on some platforms.
50394a251fdSmrgAC_REQUIRE([AC_PROG_AWK])dnl
50494a251fdSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50594a251fdSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50694a251fdSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50794a251fdSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50894a251fdSmrg			     [_AM_PROG_TAR([v7])])])
50994a251fdSmrg_AM_IF_OPTION([no-dependencies],,
51094a251fdSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5116a45684fSmrg		  [_AM_DEPENDENCIES([CC])],
5126a45684fSmrg		  [m4_define([AC_PROG_CC],
5136a45684fSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
51494a251fdSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5156a45684fSmrg		  [_AM_DEPENDENCIES([CXX])],
5166a45684fSmrg		  [m4_define([AC_PROG_CXX],
5176a45684fSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
51894a251fdSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5196a45684fSmrg		  [_AM_DEPENDENCIES([OBJC])],
5206a45684fSmrg		  [m4_define([AC_PROG_OBJC],
5216a45684fSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5226a45684fSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5236a45684fSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
5246a45684fSmrg		  [m4_define([AC_PROG_OBJCXX],
5256a45684fSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52694a251fdSmrg])
5276a45684fSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
5286a45684fSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
5296a45684fSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5306a45684fSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
53194a251fdSmrgAC_CONFIG_COMMANDS_PRE(dnl
53294a251fdSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
53394a251fdSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5346a45684fSmrg
5356a45684fSmrg# POSIX will say in a future version that running "rm -f" with no argument
5366a45684fSmrg# is OK; and we want to be able to make that assumption in our Makefile
5376a45684fSmrg# recipes.  So use an aggressive probe to check that the usage we want is
5386a45684fSmrg# actually supported "in the wild" to an acceptable degree.
5396a45684fSmrg# See automake bug#10828.
5406a45684fSmrg# To make any issue more visible, cause the running configure to be aborted
5416a45684fSmrg# by default if the 'rm' program in use doesn't match our expectations; the
5426a45684fSmrg# user can still override this though.
5436a45684fSmrgif rm -f && rm -fr && rm -rf; then : OK; else
5446a45684fSmrg  cat >&2 <<'END'
5456a45684fSmrgOops!
5466a45684fSmrg
5476a45684fSmrgYour 'rm' program seems unable to run without file operands specified
5486a45684fSmrgon the command line, even when the '-f' option is present.  This is contrary
5496a45684fSmrgto the behaviour of most rm programs out there, and not conforming with
5506a45684fSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
5516a45684fSmrg
5526a45684fSmrgPlease tell bug-automake@gnu.org about your system, including the value
5536a45684fSmrgof your $PATH and any error possibly output before this message.  This
5546a45684fSmrgcan help us improve future automake versions.
5556a45684fSmrg
5566a45684fSmrgEND
5576a45684fSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
5586a45684fSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
5596a45684fSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
5606a45684fSmrg    echo >&2
5616a45684fSmrg  else
5626a45684fSmrg    cat >&2 <<'END'
5636a45684fSmrgAborting the configuration process, to ensure you take notice of the issue.
5646a45684fSmrg
5656a45684fSmrgYou can download and install GNU coreutils to get an 'rm' implementation
5666a45684fSmrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
5676a45684fSmrg
5686a45684fSmrgIf you want to complete the configuration process using your problematic
5696a45684fSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
5706a45684fSmrgto "yes", and re-run configure.
5716a45684fSmrg
5726a45684fSmrgEND
5736a45684fSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
5746a45684fSmrg  fi
5756a45684fSmrgfi
5766a45684fSmrgdnl The trailing newline in this macro's definition is deliberate, for
5776a45684fSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
5786a45684fSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
57994a251fdSmrg])
580e6232409Smrg
5816a45684fSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
58294a251fdSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
58394a251fdSmrgdnl mangled by Autoconf and run in a shell conditional statement.
58494a251fdSmrgm4_define([_AC_COMPILER_EXEEXT],
58594a251fdSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
586e6232409Smrg
58794a251fdSmrg# When config.status generates a header, we must update the stamp-h file.
58894a251fdSmrg# This file resides in the same directory as the config header
58994a251fdSmrg# that is generated.  The stamp files are numbered to have different names.
590e6232409Smrg
59194a251fdSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
59294a251fdSmrg# loop where config.status creates the headers, so we can generate
59394a251fdSmrg# our stamp files there.
59494a251fdSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
59594a251fdSmrg[# Compute $1's index in $config_headers.
59694a251fdSmrg_am_arg=$1
59794a251fdSmrg_am_stamp_count=1
59894a251fdSmrgfor _am_header in $config_headers :; do
59994a251fdSmrg  case $_am_header in
60094a251fdSmrg    $_am_arg | $_am_arg:* )
60194a251fdSmrg      break ;;
60294a251fdSmrg    * )
60394a251fdSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
60494a251fdSmrg  esac
60594a251fdSmrgdone
60694a251fdSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
607e6232409Smrg
6086a45684fSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
609e6232409Smrg#
61094a251fdSmrg# This file is free software; the Free Software Foundation
61194a251fdSmrg# gives unlimited permission to copy and/or distribute it,
61294a251fdSmrg# with or without modifications, as long as this notice is preserved.
613e6232409Smrg
61494a251fdSmrg# AM_PROG_INSTALL_SH
61594a251fdSmrg# ------------------
61694a251fdSmrg# Define $install_sh.
61794a251fdSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
61894a251fdSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6196a45684fSmrgif test x"${install_sh+set}" != xset; then
62094a251fdSmrg  case $am_aux_dir in
62194a251fdSmrg  *\ * | *\	*)
62294a251fdSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
62394a251fdSmrg  *)
62494a251fdSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
62594a251fdSmrg  esac
6268fff3f40Smrgfi
6276a45684fSmrgAC_SUBST([install_sh])])
628e6232409Smrg
6296a45684fSmrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
63094a251fdSmrg#
63194a251fdSmrg# This file is free software; the Free Software Foundation
63294a251fdSmrg# gives unlimited permission to copy and/or distribute it,
63394a251fdSmrg# with or without modifications, as long as this notice is preserved.
634e6232409Smrg
63594a251fdSmrg# Check whether the underlying file-system supports filenames
63694a251fdSmrg# with a leading dot.  For instance MS-DOS doesn't.
63794a251fdSmrgAC_DEFUN([AM_SET_LEADING_DOT],
63894a251fdSmrg[rm -rf .tst 2>/dev/null
63994a251fdSmrgmkdir .tst 2>/dev/null
64094a251fdSmrgif test -d .tst; then
64194a251fdSmrg  am__leading_dot=.
64294a251fdSmrgelse
64394a251fdSmrg  am__leading_dot=_
6448fff3f40Smrgfi
64594a251fdSmrgrmdir .tst 2>/dev/null
64694a251fdSmrgAC_SUBST([am__leading_dot])])
647e6232409Smrg
64894a251fdSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
64994a251fdSmrg
6506a45684fSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
6518fff3f40Smrg#
65294a251fdSmrg# This file is free software; the Free Software Foundation
65394a251fdSmrg# gives unlimited permission to copy and/or distribute it,
65494a251fdSmrg# with or without modifications, as long as this notice is preserved.
6558fff3f40Smrg
65694a251fdSmrg# AM_MAKE_INCLUDE()
65794a251fdSmrg# -----------------
65894a251fdSmrg# Check to see how make treats includes.
65994a251fdSmrgAC_DEFUN([AM_MAKE_INCLUDE],
66094a251fdSmrg[am_make=${MAKE-make}
66194a251fdSmrgcat > confinc << 'END'
66294a251fdSmrgam__doit:
66394a251fdSmrg	@echo this is the am__doit target
66494a251fdSmrg.PHONY: am__doit
66594a251fdSmrgEND
66694a251fdSmrg# If we don't find an include directive, just comment out the code.
66794a251fdSmrgAC_MSG_CHECKING([for style of include used by $am_make])
66894a251fdSmrgam__include="#"
66994a251fdSmrgam__quote=
67094a251fdSmrg_am_result=none
67194a251fdSmrg# First try GNU make style include.
67294a251fdSmrgecho "include confinc" > confmf
6736a45684fSmrg# Ignore all kinds of additional output from 'make'.
67494a251fdSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
67594a251fdSmrg*the\ am__doit\ target*)
67694a251fdSmrg  am__include=include
67794a251fdSmrg  am__quote=
67894a251fdSmrg  _am_result=GNU
67994a251fdSmrg  ;;
68094a251fdSmrgesac
68194a251fdSmrg# Now try BSD make style include.
68294a251fdSmrgif test "$am__include" = "#"; then
68394a251fdSmrg   echo '.include "confinc"' > confmf
68494a251fdSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
68594a251fdSmrg   *the\ am__doit\ target*)
68694a251fdSmrg     am__include=.include
68794a251fdSmrg     am__quote="\""
68894a251fdSmrg     _am_result=BSD
68994a251fdSmrg     ;;
69094a251fdSmrg   esac
691e6232409Smrgfi
69294a251fdSmrgAC_SUBST([am__include])
69394a251fdSmrgAC_SUBST([am__quote])
69494a251fdSmrgAC_MSG_RESULT([$_am_result])
69594a251fdSmrgrm -f confinc confmf
69694a251fdSmrg])
697e6232409Smrg
69894a251fdSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
69994a251fdSmrg
7006a45684fSmrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
701e6232409Smrg#
70294a251fdSmrg# This file is free software; the Free Software Foundation
70394a251fdSmrg# gives unlimited permission to copy and/or distribute it,
70494a251fdSmrg# with or without modifications, as long as this notice is preserved.
7058fff3f40Smrg
70694a251fdSmrg# AM_MISSING_PROG(NAME, PROGRAM)
70794a251fdSmrg# ------------------------------
70894a251fdSmrgAC_DEFUN([AM_MISSING_PROG],
70994a251fdSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
71094a251fdSmrg$1=${$1-"${am_missing_run}$2"}
71194a251fdSmrgAC_SUBST($1)])
71294a251fdSmrg
71394a251fdSmrg# AM_MISSING_HAS_RUN
71494a251fdSmrg# ------------------
7156a45684fSmrg# Define MISSING if not defined so far and test if it is modern enough.
7166a45684fSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
71794a251fdSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
71894a251fdSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
71994a251fdSmrgAC_REQUIRE_AUX_FILE([missing])dnl
72094a251fdSmrgif test x"${MISSING+set}" != xset; then
72194a251fdSmrg  case $am_aux_dir in
72294a251fdSmrg  *\ * | *\	*)
72394a251fdSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
72494a251fdSmrg  *)
72594a251fdSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
72694a251fdSmrg  esac
72794a251fdSmrgfi
72894a251fdSmrg# Use eval to expand $SHELL
7296a45684fSmrgif eval "$MISSING --is-lightweight"; then
7306a45684fSmrg  am_missing_run="$MISSING "
731e6232409Smrgelse
73294a251fdSmrg  am_missing_run=
7336a45684fSmrg  AC_MSG_WARN(['missing' script is too old or missing])
734e6232409Smrgfi
73594a251fdSmrg])
736e6232409Smrg
73794a251fdSmrg# Helper functions for option handling.                     -*- Autoconf -*-
73894a251fdSmrg
7396a45684fSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
7408fff3f40Smrg#
74194a251fdSmrg# This file is free software; the Free Software Foundation
74294a251fdSmrg# gives unlimited permission to copy and/or distribute it,
74394a251fdSmrg# with or without modifications, as long as this notice is preserved.
74494a251fdSmrg
74594a251fdSmrg# _AM_MANGLE_OPTION(NAME)
74694a251fdSmrg# -----------------------
74794a251fdSmrgAC_DEFUN([_AM_MANGLE_OPTION],
74894a251fdSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
74994a251fdSmrg
75094a251fdSmrg# _AM_SET_OPTION(NAME)
75194a251fdSmrg# --------------------
75294a251fdSmrg# Set option NAME.  Presently that only means defining a flag for this option.
75394a251fdSmrgAC_DEFUN([_AM_SET_OPTION],
7546a45684fSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
75594a251fdSmrg
75694a251fdSmrg# _AM_SET_OPTIONS(OPTIONS)
75794a251fdSmrg# ------------------------
75894a251fdSmrg# OPTIONS is a space-separated list of Automake options.
75994a251fdSmrgAC_DEFUN([_AM_SET_OPTIONS],
76094a251fdSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
76194a251fdSmrg
76294a251fdSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
76394a251fdSmrg# -------------------------------------------
76494a251fdSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
76594a251fdSmrgAC_DEFUN([_AM_IF_OPTION],
76694a251fdSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
76794a251fdSmrg
7686a45684fSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
7696a45684fSmrg#
7706a45684fSmrg# This file is free software; the Free Software Foundation
7716a45684fSmrg# gives unlimited permission to copy and/or distribute it,
7726a45684fSmrg# with or without modifications, as long as this notice is preserved.
77394a251fdSmrg
7746a45684fSmrg# _AM_PROG_CC_C_O
7756a45684fSmrg# ---------------
7766a45684fSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
7776a45684fSmrg# to automatically call this.
7786a45684fSmrgAC_DEFUN([_AM_PROG_CC_C_O],
7796a45684fSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7806a45684fSmrgAC_REQUIRE_AUX_FILE([compile])dnl
7816a45684fSmrgAC_LANG_PUSH([C])dnl
7826a45684fSmrgAC_CACHE_CHECK(
7836a45684fSmrg  [whether $CC understands -c and -o together],
7846a45684fSmrg  [am_cv_prog_cc_c_o],
7856a45684fSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
7866a45684fSmrg  # Make sure it works both with $CC and with simple cc.
7876a45684fSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
7886a45684fSmrg  # compilers refuse to overwrite an existing .o file with -o,
7896a45684fSmrg  # though they will create one.
7906a45684fSmrg  am_cv_prog_cc_c_o=yes
7916a45684fSmrg  for am_i in 1 2; do
7926a45684fSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
7936a45684fSmrg         && test -f conftest2.$ac_objext; then
7946a45684fSmrg      : OK
7956a45684fSmrg    else
7966a45684fSmrg      am_cv_prog_cc_c_o=no
7976a45684fSmrg      break
7986a45684fSmrg    fi
7996a45684fSmrg  done
8006a45684fSmrg  rm -f core conftest*
8016a45684fSmrg  unset am_i])
8026a45684fSmrgif test "$am_cv_prog_cc_c_o" != yes; then
8036a45684fSmrg   # Losing compiler, so override with the script.
8046a45684fSmrg   # FIXME: It is wrong to rewrite CC.
8056a45684fSmrg   # But if we don't then we get into trouble of one sort or another.
8066a45684fSmrg   # A longer-term fix would be to have automake use am__CC in this case,
8076a45684fSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
8086a45684fSmrg   CC="$am_aux_dir/compile $CC"
8096a45684fSmrgfi
8106a45684fSmrgAC_LANG_POP([C])])
8116a45684fSmrg
8126a45684fSmrg# For backward compatibility.
8136a45684fSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8146a45684fSmrg
8156a45684fSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
8168fff3f40Smrg#
81794a251fdSmrg# This file is free software; the Free Software Foundation
81894a251fdSmrg# gives unlimited permission to copy and/or distribute it,
81994a251fdSmrg# with or without modifications, as long as this notice is preserved.
8208fff3f40Smrg
8216a45684fSmrg# AM_RUN_LOG(COMMAND)
8226a45684fSmrg# -------------------
8236a45684fSmrg# Run COMMAND, save the exit status in ac_status, and log it.
8246a45684fSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8256a45684fSmrgAC_DEFUN([AM_RUN_LOG],
8266a45684fSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8276a45684fSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8286a45684fSmrg   ac_status=$?
8296a45684fSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8306a45684fSmrg   (exit $ac_status); }])
8316a45684fSmrg
8326a45684fSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8336a45684fSmrg
8346a45684fSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
8356a45684fSmrg#
8366a45684fSmrg# This file is free software; the Free Software Foundation
8376a45684fSmrg# gives unlimited permission to copy and/or distribute it,
8386a45684fSmrg# with or without modifications, as long as this notice is preserved.
83994a251fdSmrg
84094a251fdSmrg# AM_SANITY_CHECK
84194a251fdSmrg# ---------------
84294a251fdSmrgAC_DEFUN([AM_SANITY_CHECK],
84394a251fdSmrg[AC_MSG_CHECKING([whether build environment is sane])
84494a251fdSmrg# Reject unsafe characters in $srcdir or the absolute working directory
84594a251fdSmrg# name.  Accept space and tab only in the latter.
84694a251fdSmrgam_lf='
84794a251fdSmrg'
84894a251fdSmrgcase `pwd` in
84994a251fdSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
85094a251fdSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
85194a251fdSmrgesac
85294a251fdSmrgcase $srcdir in
85394a251fdSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8546a45684fSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
85594a251fdSmrgesac
85694a251fdSmrg
8576a45684fSmrg# Do 'set' in a subshell so we don't clobber the current shell's
85894a251fdSmrg# arguments.  Must try -L first in case configure is actually a
85994a251fdSmrg# symlink; some systems play weird games with the mod time of symlinks
86094a251fdSmrg# (eg FreeBSD returns the mod time of the symlink's containing
86194a251fdSmrg# directory).
86294a251fdSmrgif (
8636a45684fSmrg   am_has_slept=no
8646a45684fSmrg   for am_try in 1 2; do
8656a45684fSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
8666a45684fSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8676a45684fSmrg     if test "$[*]" = "X"; then
8686a45684fSmrg	# -L didn't work.
8696a45684fSmrg	set X `ls -t "$srcdir/configure" conftest.file`
8706a45684fSmrg     fi
8716a45684fSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
8726a45684fSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
8736a45684fSmrg
8746a45684fSmrg	# If neither matched, then we have a broken ls.  This can happen
8756a45684fSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
8766a45684fSmrg	# broken ls alias from the environment.  This has actually
8776a45684fSmrg	# happened.  Such a system could not be considered "sane".
8786a45684fSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8796a45684fSmrg  alias in your environment])
8806a45684fSmrg     fi
8816a45684fSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
8826a45684fSmrg       break
8836a45684fSmrg     fi
8846a45684fSmrg     # Just in case.
8856a45684fSmrg     sleep 1
8866a45684fSmrg     am_has_slept=yes
8876a45684fSmrg   done
88894a251fdSmrg   test "$[2]" = conftest.file
88994a251fdSmrg   )
89094a251fdSmrgthen
89194a251fdSmrg   # Ok.
89294a251fdSmrg   :
893e6232409Smrgelse
89494a251fdSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
89594a251fdSmrgCheck your system clock])
896e6232409Smrgfi
8976a45684fSmrgAC_MSG_RESULT([yes])
8986a45684fSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
8996a45684fSmrg# generated files are strictly newer.
9006a45684fSmrgam_sleep_pid=
9016a45684fSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
9026a45684fSmrg  ( sleep 1 ) &
9036a45684fSmrg  am_sleep_pid=$!
9046a45684fSmrgfi
9056a45684fSmrgAC_CONFIG_COMMANDS_PRE(
9066a45684fSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
9076a45684fSmrg   if test -n "$am_sleep_pid"; then
9086a45684fSmrg     # Hide warnings about reused PIDs.
9096a45684fSmrg     wait $am_sleep_pid 2>/dev/null
9106a45684fSmrg   fi
9116a45684fSmrg   AC_MSG_RESULT([done])])
9126a45684fSmrgrm -f conftest.file
9136a45684fSmrg])
914e6232409Smrg
9156a45684fSmrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
916e6232409Smrg#
91794a251fdSmrg# This file is free software; the Free Software Foundation
91894a251fdSmrg# gives unlimited permission to copy and/or distribute it,
91994a251fdSmrg# with or without modifications, as long as this notice is preserved.
9208fff3f40Smrg
92194a251fdSmrg# AM_SILENT_RULES([DEFAULT])
92294a251fdSmrg# --------------------------
92394a251fdSmrg# Enable less verbose build rules; with the default set to DEFAULT
9246a45684fSmrg# ("yes" being less verbose, "no" or empty being verbose).
92594a251fdSmrgAC_DEFUN([AM_SILENT_RULES],
9266a45684fSmrg[AC_ARG_ENABLE([silent-rules], [dnl
9276a45684fSmrgAS_HELP_STRING(
9286a45684fSmrg  [--enable-silent-rules],
9296a45684fSmrg  [less verbose build output (undo: "make V=1")])
9306a45684fSmrgAS_HELP_STRING(
9316a45684fSmrg  [--disable-silent-rules],
9326a45684fSmrg  [verbose build output (undo: "make V=0")])dnl
9336a45684fSmrg])
9346a45684fSmrgcase $enable_silent_rules in @%:@ (((
9356a45684fSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
9366a45684fSmrg   no) AM_DEFAULT_VERBOSITY=1;;
9376a45684fSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
93894a251fdSmrgesac
9396a45684fSmrgdnl
9406a45684fSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
9416a45684fSmrgdnl do not support nested variable expansions.
9426a45684fSmrgdnl See automake bug#9928 and bug#10237.
9436a45684fSmrgam_make=${MAKE-make}
9446a45684fSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
9456a45684fSmrg   [am_cv_make_support_nested_variables],
9466a45684fSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
9476a45684fSmrgBAR0=false
9486a45684fSmrgBAR1=true
9496a45684fSmrgV=1
9506a45684fSmrgam__doit:
9516a45684fSmrg	@$(TRUE)
9526a45684fSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
9536a45684fSmrg  am_cv_make_support_nested_variables=yes
9546a45684fSmrgelse
9556a45684fSmrg  am_cv_make_support_nested_variables=no
9566a45684fSmrgfi])
9576a45684fSmrgif test $am_cv_make_support_nested_variables = yes; then
9586a45684fSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
9596a45684fSmrg  AM_V='$(V)'
9606a45684fSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
9616a45684fSmrgelse
9626a45684fSmrg  AM_V=$AM_DEFAULT_VERBOSITY
9636a45684fSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
9646a45684fSmrgfi
9656a45684fSmrgAC_SUBST([AM_V])dnl
9666a45684fSmrgAM_SUBST_NOTMAKE([AM_V])dnl
9676a45684fSmrgAC_SUBST([AM_DEFAULT_V])dnl
9686a45684fSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
96994a251fdSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
97094a251fdSmrgAM_BACKSLASH='\'
97194a251fdSmrgAC_SUBST([AM_BACKSLASH])dnl
97294a251fdSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
97394a251fdSmrg])
97494a251fdSmrg
9756a45684fSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
9768fff3f40Smrg#
97794a251fdSmrg# This file is free software; the Free Software Foundation
97894a251fdSmrg# gives unlimited permission to copy and/or distribute it,
97994a251fdSmrg# with or without modifications, as long as this notice is preserved.
9808fff3f40Smrg
98194a251fdSmrg# AM_PROG_INSTALL_STRIP
98294a251fdSmrg# ---------------------
9836a45684fSmrg# One issue with vendor 'install' (even GNU) is that you can't
98494a251fdSmrg# specify the program used to strip binaries.  This is especially
98594a251fdSmrg# annoying in cross-compiling environments, where the build's strip
98694a251fdSmrg# is unlikely to handle the host's binaries.
98794a251fdSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
9886a45684fSmrg# always use install-sh in "make install-strip", and initialize
98994a251fdSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
99094a251fdSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
99194a251fdSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
9926a45684fSmrg# Installed binaries are usually stripped using 'strip' when the user
9936a45684fSmrg# run "make install-strip".  However 'strip' might not be the right
99494a251fdSmrg# tool to use in cross-compilation environments, therefore Automake
9956a45684fSmrg# will honor the 'STRIP' environment variable to overrule this program.
9966a45684fSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
99794a251fdSmrgif test "$cross_compiling" != no; then
99894a251fdSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
9998fff3f40Smrgfi
100094a251fdSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
100194a251fdSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1002e6232409Smrg
10036a45684fSmrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
10048fff3f40Smrg#
100594a251fdSmrg# This file is free software; the Free Software Foundation
100694a251fdSmrg# gives unlimited permission to copy and/or distribute it,
100794a251fdSmrg# with or without modifications, as long as this notice is preserved.
10088fff3f40Smrg
100994a251fdSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
101094a251fdSmrg# ---------------------------
101194a251fdSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
101294a251fdSmrg# This macro is traced by Automake.
101394a251fdSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
101494a251fdSmrg
101594a251fdSmrg# AM_SUBST_NOTMAKE(VARIABLE)
101694a251fdSmrg# --------------------------
101794a251fdSmrg# Public sister of _AM_SUBST_NOTMAKE.
101894a251fdSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
101994a251fdSmrg
102094a251fdSmrg# Check how to create a tarball.                            -*- Autoconf -*-
102194a251fdSmrg
10226a45684fSmrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
10238fff3f40Smrg#
102494a251fdSmrg# This file is free software; the Free Software Foundation
102594a251fdSmrg# gives unlimited permission to copy and/or distribute it,
102694a251fdSmrg# with or without modifications, as long as this notice is preserved.
102794a251fdSmrg
102894a251fdSmrg# _AM_PROG_TAR(FORMAT)
102994a251fdSmrg# --------------------
103094a251fdSmrg# Check how to create a tarball in format FORMAT.
10316a45684fSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10328fff3f40Smrg#
103394a251fdSmrg# Substitute a variable $(am__tar) that is a command
103494a251fdSmrg# writing to stdout a FORMAT-tarball containing the directory
103594a251fdSmrg# $tardir.
103694a251fdSmrg#     tardir=directory && $(am__tar) > result.tar
10378fff3f40Smrg#
103894a251fdSmrg# Substitute a variable $(am__untar) that extract such
103994a251fdSmrg# a tarball read from stdin.
104094a251fdSmrg#     $(am__untar) < result.tar
10416a45684fSmrg#
104294a251fdSmrgAC_DEFUN([_AM_PROG_TAR],
10436a45684fSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
10446a45684fSmrg# in the wild :-(  We should find a proper way to deprecate it ...
10456a45684fSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
10466a45684fSmrg
10476a45684fSmrg# We'll loop over all known methods to create a tar archive until one works.
104894a251fdSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
10498fff3f40Smrg
10506a45684fSmrgm4_if([$1], [v7],
10516a45684fSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
10526a45684fSmrg
10536a45684fSmrg  [m4_case([$1],
10546a45684fSmrg    [ustar],
10556a45684fSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
10566a45684fSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
10576a45684fSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
10586a45684fSmrg      # and bug#13588).
10596a45684fSmrg      am_max_uid=2097151 # 2^21 - 1
10606a45684fSmrg      am_max_gid=$am_max_uid
10616a45684fSmrg      # The $UID and $GID variables are not portable, so we need to resort
10626a45684fSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
10636a45684fSmrg      # below are definitely unexpected, so allow the users to see them
10646a45684fSmrg      # (that is, avoid stderr redirection).
10656a45684fSmrg      am_uid=`id -u || echo unknown`
10666a45684fSmrg      am_gid=`id -g || echo unknown`
10676a45684fSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
10686a45684fSmrg      if test $am_uid -le $am_max_uid; then
10696a45684fSmrg         AC_MSG_RESULT([yes])
10706a45684fSmrg      else
10716a45684fSmrg         AC_MSG_RESULT([no])
10726a45684fSmrg         _am_tools=none
10736a45684fSmrg      fi
10746a45684fSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
10756a45684fSmrg      if test $am_gid -le $am_max_gid; then
10766a45684fSmrg         AC_MSG_RESULT([yes])
10776a45684fSmrg      else
10786a45684fSmrg        AC_MSG_RESULT([no])
10796a45684fSmrg        _am_tools=none
10806a45684fSmrg      fi],
10816a45684fSmrg
10826a45684fSmrg  [pax],
10836a45684fSmrg    [],
10846a45684fSmrg
10856a45684fSmrg  [m4_fatal([Unknown tar format])])
10866a45684fSmrg
10876a45684fSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
10886a45684fSmrg
10896a45684fSmrg  # Go ahead even if we have the value already cached.  We do so because we
10906a45684fSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
10916a45684fSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
10926a45684fSmrg
10936a45684fSmrg  for _am_tool in $_am_tools; do
10946a45684fSmrg    case $_am_tool in
10956a45684fSmrg    gnutar)
10966a45684fSmrg      for _am_tar in tar gnutar gtar; do
10976a45684fSmrg        AM_RUN_LOG([$_am_tar --version]) && break
10986a45684fSmrg      done
10996a45684fSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
11006a45684fSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
11016a45684fSmrg      am__untar="$_am_tar -xf -"
11026a45684fSmrg      ;;
11036a45684fSmrg    plaintar)
11046a45684fSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
11056a45684fSmrg      # ustar tarball either.
11066a45684fSmrg      (tar --version) >/dev/null 2>&1 && continue
11076a45684fSmrg      am__tar='tar chf - "$$tardir"'
11086a45684fSmrg      am__tar_='tar chf - "$tardir"'
11096a45684fSmrg      am__untar='tar xf -'
11106a45684fSmrg      ;;
11116a45684fSmrg    pax)
11126a45684fSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
11136a45684fSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
11146a45684fSmrg      am__untar='pax -r'
11156a45684fSmrg      ;;
11166a45684fSmrg    cpio)
11176a45684fSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
11186a45684fSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
11196a45684fSmrg      am__untar='cpio -i -H $1 -d'
11206a45684fSmrg      ;;
11216a45684fSmrg    none)
11226a45684fSmrg      am__tar=false
11236a45684fSmrg      am__tar_=false
11246a45684fSmrg      am__untar=false
11256a45684fSmrg      ;;
11266a45684fSmrg    esac
112794a251fdSmrg
11286a45684fSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
11296a45684fSmrg    # and am__untar set.
11306a45684fSmrg    test -n "${am_cv_prog_tar_$1}" && break
11316a45684fSmrg
11326a45684fSmrg    # tar/untar a dummy directory, and stop if the command works.
11336a45684fSmrg    rm -rf conftest.dir
11346a45684fSmrg    mkdir conftest.dir
11356a45684fSmrg    echo GrepMe > conftest.dir/file
11366a45684fSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
11376a45684fSmrg    rm -rf conftest.dir
11386a45684fSmrg    if test -s conftest.tar; then
11396a45684fSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
11406a45684fSmrg      AM_RUN_LOG([cat conftest.dir/file])
11416a45684fSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
11426a45684fSmrg    fi
11436a45684fSmrg  done
114494a251fdSmrg  rm -rf conftest.dir
114594a251fdSmrg
11466a45684fSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
11476a45684fSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
11486a45684fSmrg
114994a251fdSmrgAC_SUBST([am__tar])
115094a251fdSmrgAC_SUBST([am__untar])
115194a251fdSmrg]) # _AM_PROG_TAR
115294a251fdSmrg
115394a251fdSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
115494a251fdSmrg# 
115594a251fdSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
11568fff3f40Smrg#
115794a251fdSmrg# This program is free software; you can redistribute it and/or modify
115894a251fdSmrg# it under the terms of the GNU General Public License as published by
115994a251fdSmrg# the Free Software Foundation; either version 2 of the License, or
116094a251fdSmrg# (at your option) any later version.
11618fff3f40Smrg#
116294a251fdSmrg# This program is distributed in the hope that it will be useful, but
116394a251fdSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
116494a251fdSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
116594a251fdSmrg# General Public License for more details.
11668fff3f40Smrg#
116794a251fdSmrg# You should have received a copy of the GNU General Public License
116894a251fdSmrg# along with this program; if not, write to the Free Software
116994a251fdSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
117094a251fdSmrg#
117194a251fdSmrg# As a special exception to the GNU General Public License, if you
117294a251fdSmrg# distribute this file as part of a program that contains a
117394a251fdSmrg# configuration script generated by Autoconf, you may include it under
117494a251fdSmrg# the same distribution terms that you use for the rest of that program.
117594a251fdSmrg
117694a251fdSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
117794a251fdSmrg# ----------------------------------
117894a251fdSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
117994a251fdSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
118094a251fdSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
118194a251fdSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
118294a251fdSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
118394a251fdSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
11848fff3f40Smrgfi
118594a251fdSmrgif test -n "$PKG_CONFIG"; then
118694a251fdSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
118794a251fdSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
118894a251fdSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
118994a251fdSmrg		AC_MSG_RESULT([yes])
119094a251fdSmrg	else
119194a251fdSmrg		AC_MSG_RESULT([no])
119294a251fdSmrg		PKG_CONFIG=""
119394a251fdSmrg	fi
119494a251fdSmrg		
119594a251fdSmrgfi[]dnl
119694a251fdSmrg])# PKG_PROG_PKG_CONFIG
11978fff3f40Smrg
119894a251fdSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
11998fff3f40Smrg#
120094a251fdSmrg# Check to see whether a particular set of modules exists.  Similar
120194a251fdSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
12028fff3f40Smrg#
1203e6232409Smrg#
120494a251fdSmrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
120594a251fdSmrg# this or PKG_CHECK_MODULES is called, or make sure to call
120694a251fdSmrg# PKG_CHECK_EXISTS manually
120794a251fdSmrg# --------------------------------------------------------------
120894a251fdSmrgAC_DEFUN([PKG_CHECK_EXISTS],
120994a251fdSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
121094a251fdSmrgif test -n "$PKG_CONFIG" && \
121194a251fdSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
121294a251fdSmrg  m4_ifval([$2], [$2], [:])
121394a251fdSmrgm4_ifvaln([$3], [else
121494a251fdSmrg  $3])dnl
121594a251fdSmrgfi])
1216e6232409Smrg
1217e6232409Smrg
121894a251fdSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
121994a251fdSmrg# ---------------------------------------------
122094a251fdSmrgm4_define([_PKG_CONFIG],
122194a251fdSmrg[if test -n "$$1"; then
122294a251fdSmrg    pkg_cv_[]$1="$$1"
122394a251fdSmrg elif test -n "$PKG_CONFIG"; then
122494a251fdSmrg    PKG_CHECK_EXISTS([$3],
122594a251fdSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
122694a251fdSmrg		     [pkg_failed=yes])
122794a251fdSmrg else
122894a251fdSmrg    pkg_failed=untried
122994a251fdSmrgfi[]dnl
123094a251fdSmrg])# _PKG_CONFIG
123194a251fdSmrg
123294a251fdSmrg# _PKG_SHORT_ERRORS_SUPPORTED
123394a251fdSmrg# -----------------------------
123494a251fdSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
123594a251fdSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
123694a251fdSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
123794a251fdSmrg        _pkg_short_errors_supported=yes
12388fff3f40Smrgelse
123994a251fdSmrg        _pkg_short_errors_supported=no
124094a251fdSmrgfi[]dnl
124194a251fdSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
1242e6232409Smrg
1243e6232409Smrg
124494a251fdSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
124594a251fdSmrg# [ACTION-IF-NOT-FOUND])
12468fff3f40Smrg#
12478fff3f40Smrg#
124894a251fdSmrg# Note that if there is a possibility the first call to
124994a251fdSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
125094a251fdSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
125194a251fdSmrg#
125294a251fdSmrg#
125394a251fdSmrg# --------------------------------------------------------------
125494a251fdSmrgAC_DEFUN([PKG_CHECK_MODULES],
125594a251fdSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
125694a251fdSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
125794a251fdSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
12588fff3f40Smrg
125994a251fdSmrgpkg_failed=no
126094a251fdSmrgAC_MSG_CHECKING([for $1])
1261e6232409Smrg
126294a251fdSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
126394a251fdSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
12648fff3f40Smrg
126594a251fdSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
126694a251fdSmrgand $1[]_LIBS to avoid the need to call pkg-config.
126794a251fdSmrgSee the pkg-config man page for more details.])
12688fff3f40Smrg
126994a251fdSmrgif test $pkg_failed = yes; then
127094a251fdSmrg        _PKG_SHORT_ERRORS_SUPPORTED
127194a251fdSmrg        if test $_pkg_short_errors_supported = yes; then
127294a251fdSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
127394a251fdSmrg        else 
127494a251fdSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
127594a251fdSmrg        fi
127694a251fdSmrg	# Put the nasty error message in config.log where it belongs
127794a251fdSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1278e6232409Smrg
127994a251fdSmrg	ifelse([$4], , [AC_MSG_ERROR(dnl
128094a251fdSmrg[Package requirements ($2) were not met:
1281e6232409Smrg
128294a251fdSmrg$$1_PKG_ERRORS
1283e6232409Smrg
128494a251fdSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
128594a251fdSmrginstalled software in a non-standard prefix.
1286e6232409Smrg
128794a251fdSmrg_PKG_TEXT
128894a251fdSmrg])],
128994a251fdSmrg		[AC_MSG_RESULT([no])
129094a251fdSmrg                $4])
129194a251fdSmrgelif test $pkg_failed = untried; then
129294a251fdSmrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
129394a251fdSmrg[The pkg-config script could not be found or is too old.  Make sure it
129494a251fdSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
129594a251fdSmrgpath to pkg-config.
12968fff3f40Smrg
129794a251fdSmrg_PKG_TEXT
1298e6232409Smrg
129994a251fdSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
130094a251fdSmrg		[$4])
130194a251fdSmrgelse
130294a251fdSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
130394a251fdSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
130494a251fdSmrg        AC_MSG_RESULT([yes])
130594a251fdSmrg	ifelse([$3], , :, [$3])
130694a251fdSmrgfi[]dnl
130794a251fdSmrg])# PKG_CHECK_MODULES
13088fff3f40Smrg
130994a251fdSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1310e6232409Smrgdnl
131194a251fdSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
13126a45684fSmrgdnl
131394a251fdSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
131494a251fdSmrgdnl copy of this software and associated documentation files (the "Software"),
131594a251fdSmrgdnl to deal in the Software without restriction, including without limitation
131694a251fdSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
131794a251fdSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
131894a251fdSmrgdnl Software is furnished to do so, subject to the following conditions:
13198fff3f40Smrgdnl
132094a251fdSmrgdnl The above copyright notice and this permission notice (including the next
132194a251fdSmrgdnl paragraph) shall be included in all copies or substantial portions of the
132294a251fdSmrgdnl Software.
1323e6232409Smrgdnl
132494a251fdSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
132594a251fdSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
132694a251fdSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
132794a251fdSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
132894a251fdSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
132994a251fdSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
133094a251fdSmrgdnl DEALINGS IN THE SOFTWARE.
1331e6232409Smrg
133294a251fdSmrg# XORG_MACROS_VERSION(required-version)
133394a251fdSmrg# -------------------------------------
133494a251fdSmrg# Minimum version: 1.1.0
133594a251fdSmrg#
133694a251fdSmrg# If you're using a macro added in Version 1.1 or newer, include this in
133794a251fdSmrg# your configure.ac with the minimum required version, such as:
133894a251fdSmrg# XORG_MACROS_VERSION(1.1)
133994a251fdSmrg#
134094a251fdSmrg# To ensure that this macro is defined, also add:
134194a251fdSmrg# m4_ifndef([XORG_MACROS_VERSION],
134294a251fdSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
134394a251fdSmrg#
134494a251fdSmrg#
13456a45684fSmrg# See the "minimum version" comment for each macro you use to see what
134694a251fdSmrg# version you require.
134794a251fdSmrgm4_defun([XORG_MACROS_VERSION],[
13486a45684fSmrgm4_define([vers_have], [1.19.0])
134994a251fdSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
135094a251fdSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
135194a251fdSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
135294a251fdSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
135394a251fdSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
135494a251fdSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
135594a251fdSmrgm4_undefine([vers_have])
135694a251fdSmrgm4_undefine([maj_have])
135794a251fdSmrgm4_undefine([maj_needed])
135894a251fdSmrg]) # XORG_MACROS_VERSION
135994a251fdSmrg
136094a251fdSmrg# XORG_PROG_RAWCPP()
136194a251fdSmrg# ------------------
136294a251fdSmrg# Minimum version: 1.0.0
136394a251fdSmrg#
136494a251fdSmrg# Find cpp program and necessary flags for use in pre-processing text files
136594a251fdSmrg# such as man pages and config files
136694a251fdSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
136794a251fdSmrgAC_REQUIRE([AC_PROG_CPP])
13686a45684fSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
136994a251fdSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
137094a251fdSmrg
137194a251fdSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
137294a251fdSmrg# which is not the best choice for supporting other OS'es, but covers most
137394a251fdSmrg# of the ones we need for now.
137494a251fdSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
137594a251fdSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
137694a251fdSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
137794a251fdSmrg	AC_MSG_RESULT([no])
137894a251fdSmrgelse
137994a251fdSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
138094a251fdSmrg		RAWCPPFLAGS=-undef
138194a251fdSmrg		AC_MSG_RESULT([yes])
138294a251fdSmrg	# under Cygwin unix is still defined even with -undef
138394a251fdSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
138494a251fdSmrg		RAWCPPFLAGS="-undef -ansi"
138594a251fdSmrg		AC_MSG_RESULT([yes, with -ansi])
138694a251fdSmrg	else
138794a251fdSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1388e6232409Smrg	fi
138994a251fdSmrgfi
139094a251fdSmrgrm -f conftest.$ac_ext
139194a251fdSmrg
139294a251fdSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
139394a251fdSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
139494a251fdSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
139594a251fdSmrg	AC_MSG_RESULT([no])
139694a251fdSmrgelse
139794a251fdSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
13986a45684fSmrg		TRADITIONALCPPFLAGS="-traditional"
139994a251fdSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
140094a251fdSmrg		AC_MSG_RESULT([yes])
140194a251fdSmrg	else
140294a251fdSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1403e6232409Smrg	fi
140494a251fdSmrgfi
140594a251fdSmrgrm -f conftest.$ac_ext
140694a251fdSmrgAC_SUBST(RAWCPPFLAGS)
14076a45684fSmrgAC_SUBST(TRADITIONALCPPFLAGS)
140894a251fdSmrg]) # XORG_PROG_RAWCPP
1409e6232409Smrg
141094a251fdSmrg# XORG_MANPAGE_SECTIONS()
141194a251fdSmrg# -----------------------
141294a251fdSmrg# Minimum version: 1.0.0
14138fff3f40Smrg#
141494a251fdSmrg# Determine which sections man pages go in for the different man page types
141594a251fdSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
141694a251fdSmrg# Not sure if there's any better way than just hardcoding by OS name.
141794a251fdSmrg# Override default settings by setting environment variables
141894a251fdSmrg# Added MAN_SUBSTS in version 1.8
141994a251fdSmrg# Added AC_PROG_SED in version 1.8
14208fff3f40Smrg
142194a251fdSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
142294a251fdSmrgAC_REQUIRE([AC_CANONICAL_HOST])
142394a251fdSmrgAC_REQUIRE([AC_PROG_SED])
1424e6232409Smrg
142594a251fdSmrgif test x$APP_MAN_SUFFIX = x    ; then
142694a251fdSmrg    APP_MAN_SUFFIX=1
142794a251fdSmrgfi
142894a251fdSmrgif test x$APP_MAN_DIR = x    ; then
142994a251fdSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
143094a251fdSmrgfi
1431e6232409Smrg
143294a251fdSmrgif test x$LIB_MAN_SUFFIX = x    ; then
143394a251fdSmrg    LIB_MAN_SUFFIX=3
143494a251fdSmrgfi
143594a251fdSmrgif test x$LIB_MAN_DIR = x    ; then
143694a251fdSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
143794a251fdSmrgfi
1438e6232409Smrg
143994a251fdSmrgif test x$FILE_MAN_SUFFIX = x    ; then
144094a251fdSmrg    case $host_os in
144194a251fdSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
144294a251fdSmrg	*)		FILE_MAN_SUFFIX=5  ;;
144394a251fdSmrg    esac
144494a251fdSmrgfi
144594a251fdSmrgif test x$FILE_MAN_DIR = x    ; then
144694a251fdSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
144794a251fdSmrgfi
1448e6232409Smrg
144994a251fdSmrgif test x$MISC_MAN_SUFFIX = x    ; then
145094a251fdSmrg    case $host_os in
145194a251fdSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
145294a251fdSmrg	*)		MISC_MAN_SUFFIX=7  ;;
145394a251fdSmrg    esac
145494a251fdSmrgfi
145594a251fdSmrgif test x$MISC_MAN_DIR = x    ; then
145694a251fdSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
145794a251fdSmrgfi
1458e6232409Smrg
145994a251fdSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
146094a251fdSmrg    case $host_os in
146194a251fdSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
146294a251fdSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
146394a251fdSmrg    esac
146494a251fdSmrgfi
146594a251fdSmrgif test x$DRIVER_MAN_DIR = x    ; then
146694a251fdSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
146794a251fdSmrgfi
1468e6232409Smrg
146994a251fdSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
147094a251fdSmrg    case $host_os in
147194a251fdSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
147294a251fdSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
147394a251fdSmrg    esac
147494a251fdSmrgfi
147594a251fdSmrgif test x$ADMIN_MAN_DIR = x    ; then
147694a251fdSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
147794a251fdSmrgfi
147894a251fdSmrg
147994a251fdSmrg
148094a251fdSmrgAC_SUBST([APP_MAN_SUFFIX])
148194a251fdSmrgAC_SUBST([LIB_MAN_SUFFIX])
148294a251fdSmrgAC_SUBST([FILE_MAN_SUFFIX])
148394a251fdSmrgAC_SUBST([MISC_MAN_SUFFIX])
148494a251fdSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
148594a251fdSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
148694a251fdSmrgAC_SUBST([APP_MAN_DIR])
148794a251fdSmrgAC_SUBST([LIB_MAN_DIR])
148894a251fdSmrgAC_SUBST([FILE_MAN_DIR])
148994a251fdSmrgAC_SUBST([MISC_MAN_DIR])
149094a251fdSmrgAC_SUBST([DRIVER_MAN_DIR])
149194a251fdSmrgAC_SUBST([ADMIN_MAN_DIR])
149294a251fdSmrg
149394a251fdSmrgXORG_MAN_PAGE="X Version 11"
149494a251fdSmrgAC_SUBST([XORG_MAN_PAGE])
149594a251fdSmrgMAN_SUBSTS="\
149694a251fdSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
149794a251fdSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
149894a251fdSmrg	-e 's|__xservername__|Xorg|g' \
149994a251fdSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
150094a251fdSmrg	-e 's|__projectroot__|\$(prefix)|g' \
150194a251fdSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
150294a251fdSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
150394a251fdSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
150494a251fdSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
150594a251fdSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
150694a251fdSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
150794a251fdSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
150894a251fdSmrgAC_SUBST([MAN_SUBSTS])
150994a251fdSmrg
151094a251fdSmrg]) # XORG_MANPAGE_SECTIONS
151194a251fdSmrg
151294a251fdSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
151394a251fdSmrg# ------------------------
151494a251fdSmrg# Minimum version: 1.7.0
15158fff3f40Smrg#
151694a251fdSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
151794a251fdSmrg# provided by xorg-sgml-doctools, if installed.
151894a251fdSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
151994a251fdSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
152094a251fdSmrgXORG_SGML_PATH=
152194a251fdSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
152294a251fdSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
152394a251fdSmrg    [m4_ifval([$1],[:],
152494a251fdSmrg        [if test x"$cross_compiling" != x"yes" ; then
152594a251fdSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
152694a251fdSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
152794a251fdSmrg         fi])
152894a251fdSmrg    ])
152994a251fdSmrg
153094a251fdSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
153194a251fdSmrg# the path and the name of the doc stylesheet
153294a251fdSmrgif test "x$XORG_SGML_PATH" != "x" ; then
153394a251fdSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
153494a251fdSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
153594a251fdSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
153694a251fdSmrgelse
153794a251fdSmrg   AC_MSG_RESULT([no])
153894a251fdSmrgfi
153994a251fdSmrg
154094a251fdSmrgAC_SUBST(XORG_SGML_PATH)
154194a251fdSmrgAC_SUBST(STYLESHEET_SRCDIR)
154294a251fdSmrgAC_SUBST(XSL_STYLESHEET)
154394a251fdSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
154494a251fdSmrg]) # XORG_CHECK_SGML_DOCTOOLS
154594a251fdSmrg
154694a251fdSmrg# XORG_CHECK_LINUXDOC
154794a251fdSmrg# -------------------
154894a251fdSmrg# Minimum version: 1.0.0
15498fff3f40Smrg#
155094a251fdSmrg# Defines the variable MAKE_TEXT if the necessary tools and
155194a251fdSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
155294a251fdSmrg# Whether or not the necessary tools and files are found can be checked
155394a251fdSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
155494a251fdSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
155594a251fdSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
155694a251fdSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1557e6232409Smrg
155894a251fdSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1559e6232409Smrg
156094a251fdSmrgAC_MSG_CHECKING([whether to build documentation])
1561e6232409Smrg
156294a251fdSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
156394a251fdSmrg   BUILDDOC=yes
156494a251fdSmrgelse
156594a251fdSmrg   BUILDDOC=no
156694a251fdSmrgfi
1567e6232409Smrg
156894a251fdSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1569e6232409Smrg
157094a251fdSmrgAC_MSG_RESULT([$BUILDDOC])
157194a251fdSmrg
157294a251fdSmrgAC_MSG_CHECKING([whether to build pdf documentation])
157394a251fdSmrg
157494a251fdSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
157594a251fdSmrg   BUILDPDFDOC=yes
1576e6232409Smrgelse
157794a251fdSmrg   BUILDPDFDOC=no
1578e6232409Smrgfi
1579e6232409Smrg
158094a251fdSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1581e6232409Smrg
158294a251fdSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1583e6232409Smrg
158494a251fdSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
158594a251fdSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
158694a251fdSmrgMAKE_PDF="$PS2PDF"
158794a251fdSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1588e6232409Smrg
158994a251fdSmrgAC_SUBST(MAKE_TEXT)
159094a251fdSmrgAC_SUBST(MAKE_PS)
159194a251fdSmrgAC_SUBST(MAKE_PDF)
159294a251fdSmrgAC_SUBST(MAKE_HTML)
159394a251fdSmrg]) # XORG_CHECK_LINUXDOC
1594e6232409Smrg
159594a251fdSmrg# XORG_CHECK_DOCBOOK
159694a251fdSmrg# -------------------
159794a251fdSmrg# Minimum version: 1.0.0
15988fff3f40Smrg#
159994a251fdSmrg# Checks for the ability to build output formats from SGML DocBook source.
160094a251fdSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
160194a251fdSmrg# indicates whether the necessary tools and files are found and, if set,
160294a251fdSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
160394a251fdSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
160494a251fdSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1605e6232409Smrg
160694a251fdSmrgBUILDTXTDOC=no
160794a251fdSmrgBUILDPDFDOC=no
160894a251fdSmrgBUILDPSDOC=no
160994a251fdSmrgBUILDHTMLDOC=no
1610e6232409Smrg
161194a251fdSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
161294a251fdSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
161394a251fdSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
161494a251fdSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1615e6232409Smrg
161694a251fdSmrgAC_MSG_CHECKING([whether to build text documentation])
161794a251fdSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
161894a251fdSmrg   test x$BUILD_TXTDOC != xno; then
161994a251fdSmrg	BUILDTXTDOC=yes
162094a251fdSmrgfi
162194a251fdSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
162294a251fdSmrgAC_MSG_RESULT([$BUILDTXTDOC])
1623e6232409Smrg
162494a251fdSmrgAC_MSG_CHECKING([whether to build PDF documentation])
162594a251fdSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
162694a251fdSmrg   test x$BUILD_PDFDOC != xno; then
162794a251fdSmrg	BUILDPDFDOC=yes
162894a251fdSmrgfi
162994a251fdSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
163094a251fdSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1631e6232409Smrg
163294a251fdSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
163394a251fdSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
163494a251fdSmrg   test x$BUILD_PSDOC != xno; then
163594a251fdSmrg	BUILDPSDOC=yes
163694a251fdSmrgfi
163794a251fdSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
163894a251fdSmrgAC_MSG_RESULT([$BUILDPSDOC])
163994a251fdSmrg
164094a251fdSmrgAC_MSG_CHECKING([whether to build HTML documentation])
164194a251fdSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
164294a251fdSmrg   test x$BUILD_HTMLDOC != xno; then
164394a251fdSmrg	BUILDHTMLDOC=yes
164494a251fdSmrgfi
164594a251fdSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
164694a251fdSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
164794a251fdSmrg
164894a251fdSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
164994a251fdSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
165094a251fdSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
165194a251fdSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
165294a251fdSmrg
165394a251fdSmrgAC_SUBST(MAKE_TEXT)
165494a251fdSmrgAC_SUBST(MAKE_PS)
165594a251fdSmrgAC_SUBST(MAKE_PDF)
165694a251fdSmrgAC_SUBST(MAKE_HTML)
165794a251fdSmrg]) # XORG_CHECK_DOCBOOK
165894a251fdSmrg
165994a251fdSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
166094a251fdSmrg# ----------------
166194a251fdSmrg# Minimum version: 1.5.0
166294a251fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
166394a251fdSmrg#
166494a251fdSmrg# Documentation tools are not always available on all platforms and sometimes
166594a251fdSmrg# not at the appropriate level. This macro enables a module to test for the
166694a251fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
166794a251fdSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
166894a251fdSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
166994a251fdSmrg# --with-xmlto assumes 'auto'.
167094a251fdSmrg#
167194a251fdSmrg# Interface to module:
167294a251fdSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
167394a251fdSmrg# XMLTO:	returns the path of the xmlto program found
167494a251fdSmrg#		returns the path set by the user in the environment
167594a251fdSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
167694a251fdSmrg#		'no' user instructs the module not to use xmlto
167794a251fdSmrg#
167894a251fdSmrg# Added in version 1.10.0
167994a251fdSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
168094a251fdSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
168194a251fdSmrg#
168294a251fdSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
168394a251fdSmrg#
168494a251fdSmrgAC_DEFUN([XORG_WITH_XMLTO],[
168594a251fdSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
168694a251fdSmrgm4_define([_defopt], m4_default([$2], [auto]))
168794a251fdSmrgAC_ARG_WITH(xmlto,
168894a251fdSmrg	AS_HELP_STRING([--with-xmlto],
168994a251fdSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
169094a251fdSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
169194a251fdSmrgm4_undefine([_defopt])
169294a251fdSmrg
169394a251fdSmrgif test "x$use_xmlto" = x"auto"; then
169494a251fdSmrg   AC_PATH_PROG([XMLTO], [xmlto])
169594a251fdSmrg   if test "x$XMLTO" = "x"; then
169694a251fdSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
169794a251fdSmrg	have_xmlto=no
169894a251fdSmrg   else
169994a251fdSmrg        have_xmlto=yes
170094a251fdSmrg   fi
170194a251fdSmrgelif test "x$use_xmlto" = x"yes" ; then
170294a251fdSmrg   AC_PATH_PROG([XMLTO], [xmlto])
170394a251fdSmrg   if test "x$XMLTO" = "x"; then
170494a251fdSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
170594a251fdSmrg   fi
170694a251fdSmrg   have_xmlto=yes
170794a251fdSmrgelif test "x$use_xmlto" = x"no" ; then
170894a251fdSmrg   if test "x$XMLTO" != "x"; then
170994a251fdSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
171094a251fdSmrg   fi
171194a251fdSmrg   have_xmlto=no
171294a251fdSmrgelse
171394a251fdSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
171494a251fdSmrgfi
171594a251fdSmrg
171694a251fdSmrg# Test for a minimum version of xmlto, if provided.
171794a251fdSmrgm4_ifval([$1],
171894a251fdSmrg[if test "$have_xmlto" = yes; then
171994a251fdSmrg    # scrape the xmlto version
172094a251fdSmrg    AC_MSG_CHECKING([the xmlto version])
172194a251fdSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
172294a251fdSmrg    AC_MSG_RESULT([$xmlto_version])
172394a251fdSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
172494a251fdSmrg        [if test "x$use_xmlto" = xauto; then
172594a251fdSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
172694a251fdSmrg            have_xmlto=no
172794a251fdSmrg        else
172894a251fdSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
172994a251fdSmrg        fi])
173094a251fdSmrgfi])
1731e6232409Smrg
173294a251fdSmrg# Test for the ability of xmlto to generate a text target
173394a251fdSmrghave_xmlto_text=no
173494a251fdSmrgcat > conftest.xml << "EOF"
173594a251fdSmrgEOF
173694a251fdSmrgAS_IF([test "$have_xmlto" = yes],
173794a251fdSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
173894a251fdSmrg             [have_xmlto_text=yes],
173994a251fdSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
174094a251fdSmrgrm -f conftest.xml
174194a251fdSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
174294a251fdSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
174394a251fdSmrg]) # XORG_WITH_XMLTO
174494a251fdSmrg
174594a251fdSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
174694a251fdSmrg# --------------------------------------------
174794a251fdSmrg# Minimum version: 1.12.0
174894a251fdSmrg# Minimum version for optional DEFAULT argument: 1.12.0
174994a251fdSmrg#
175094a251fdSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
175194a251fdSmrg# XML-based language used for the transformation of XML documents.
175294a251fdSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
175394a251fdSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
175494a251fdSmrg# The XSLT processor is often used as a standalone tool for transformations.
175594a251fdSmrg# It should not be assumed that this tool is used only to work with documnetation.
175694a251fdSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
175794a251fdSmrg#
175894a251fdSmrg# Interface to module:
175994a251fdSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
176094a251fdSmrg# XSLTPROC:	 returns the path of the xsltproc program found
176194a251fdSmrg#		 returns the path set by the user in the environment
176294a251fdSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
176394a251fdSmrg#		  'no' user instructs the module not to use xsltproc
176494a251fdSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
176594a251fdSmrg#
176694a251fdSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
176794a251fdSmrg#
176894a251fdSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
176994a251fdSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
177094a251fdSmrg# Preserves the interface, should it be implemented later
177194a251fdSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
177294a251fdSmrgm4_define([_defopt], m4_default([$2], [auto]))
177394a251fdSmrgAC_ARG_WITH(xsltproc,
177494a251fdSmrg	AS_HELP_STRING([--with-xsltproc],
177594a251fdSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
177694a251fdSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
177794a251fdSmrgm4_undefine([_defopt])
177894a251fdSmrg
177994a251fdSmrgif test "x$use_xsltproc" = x"auto"; then
178094a251fdSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
178194a251fdSmrg   if test "x$XSLTPROC" = "x"; then
178294a251fdSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
178394a251fdSmrg	have_xsltproc=no
178494a251fdSmrg   else
178594a251fdSmrg        have_xsltproc=yes
178694a251fdSmrg   fi
178794a251fdSmrgelif test "x$use_xsltproc" = x"yes" ; then
178894a251fdSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
178994a251fdSmrg   if test "x$XSLTPROC" = "x"; then
179094a251fdSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
179194a251fdSmrg   fi
179294a251fdSmrg   have_xsltproc=yes
179394a251fdSmrgelif test "x$use_xsltproc" = x"no" ; then
179494a251fdSmrg   if test "x$XSLTPROC" != "x"; then
179594a251fdSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
179694a251fdSmrg   fi
179794a251fdSmrg   have_xsltproc=no
17988fff3f40Smrgelse
179994a251fdSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1800e6232409Smrgfi
1801e6232409Smrg
180294a251fdSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
180394a251fdSmrg]) # XORG_WITH_XSLTPROC
1804e6232409Smrg
180594a251fdSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
180694a251fdSmrg# ----------------------------------------
180794a251fdSmrg# Minimum version: 1.15.0
180894a251fdSmrg#
180994a251fdSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
181094a251fdSmrg# scanning arbitrary text files, extracting information from those text files,
181194a251fdSmrg# and printing reports based on that information.
181294a251fdSmrg#
181394a251fdSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
181494a251fdSmrg#
181594a251fdSmrg# Interface to module:
181694a251fdSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
181794a251fdSmrg# PERL:	     returns the path of the perl program found
181894a251fdSmrg#	     returns the path set by the user in the environment
181994a251fdSmrg# --with-perl: 'yes' user instructs the module to use perl
182094a251fdSmrg#	       'no' user instructs the module not to use perl
182194a251fdSmrg# have_perl: returns yes if perl found in PATH or no
182294a251fdSmrg#
182394a251fdSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
182494a251fdSmrg#
182594a251fdSmrgAC_DEFUN([XORG_WITH_PERL],[
182694a251fdSmrgAC_ARG_VAR([PERL], [Path to perl command])
182794a251fdSmrg# Preserves the interface, should it be implemented later
182894a251fdSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
182994a251fdSmrgm4_define([_defopt], m4_default([$2], [auto]))
183094a251fdSmrgAC_ARG_WITH(perl,
183194a251fdSmrg	AS_HELP_STRING([--with-perl],
183294a251fdSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
183394a251fdSmrg	   [use_perl=$withval], [use_perl=]_defopt)
183494a251fdSmrgm4_undefine([_defopt])
183594a251fdSmrg
183694a251fdSmrgif test "x$use_perl" = x"auto"; then
183794a251fdSmrg   AC_PATH_PROG([PERL], [perl])
183894a251fdSmrg   if test "x$PERL" = "x"; then
183994a251fdSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
184094a251fdSmrg	have_perl=no
184194a251fdSmrg   else
184294a251fdSmrg        have_perl=yes
184394a251fdSmrg   fi
184494a251fdSmrgelif test "x$use_perl" = x"yes" ; then
184594a251fdSmrg   AC_PATH_PROG([PERL], [perl])
184694a251fdSmrg   if test "x$PERL" = "x"; then
184794a251fdSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
184894a251fdSmrg   fi
184994a251fdSmrg   have_perl=yes
185094a251fdSmrgelif test "x$use_perl" = x"no" ; then
185194a251fdSmrg   if test "x$PERL" != "x"; then
185294a251fdSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
185394a251fdSmrg   fi
185494a251fdSmrg   have_perl=no
185594a251fdSmrgelse
185694a251fdSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
18578fff3f40Smrgfi
1858e6232409Smrg
185994a251fdSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
186094a251fdSmrg]) # XORG_WITH_PERL
1861e6232409Smrg
186294a251fdSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
186394a251fdSmrg# ----------------
186494a251fdSmrg# Minimum version: 1.5.0
186594a251fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1866e6232409Smrg#
186794a251fdSmrg# Documentation tools are not always available on all platforms and sometimes
186894a251fdSmrg# not at the appropriate level. This macro enables a module to test for the
186994a251fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
187094a251fdSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
187194a251fdSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
187294a251fdSmrg# --with-asciidoc assumes 'auto'.
187394a251fdSmrg#
187494a251fdSmrg# Interface to module:
187594a251fdSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
187694a251fdSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
187794a251fdSmrg#		 returns the path set by the user in the environment
187894a251fdSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
187994a251fdSmrg#		  'no' user instructs the module not to use asciidoc
188094a251fdSmrg#
188194a251fdSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
188294a251fdSmrg#
188394a251fdSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
188494a251fdSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
188594a251fdSmrgm4_define([_defopt], m4_default([$2], [auto]))
188694a251fdSmrgAC_ARG_WITH(asciidoc,
188794a251fdSmrg	AS_HELP_STRING([--with-asciidoc],
188894a251fdSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
188994a251fdSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
189094a251fdSmrgm4_undefine([_defopt])
1891e6232409Smrg
189294a251fdSmrgif test "x$use_asciidoc" = x"auto"; then
189394a251fdSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
189494a251fdSmrg   if test "x$ASCIIDOC" = "x"; then
189594a251fdSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
189694a251fdSmrg	have_asciidoc=no
189794a251fdSmrg   else
189894a251fdSmrg        have_asciidoc=yes
189994a251fdSmrg   fi
190094a251fdSmrgelif test "x$use_asciidoc" = x"yes" ; then
190194a251fdSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
190294a251fdSmrg   if test "x$ASCIIDOC" = "x"; then
190394a251fdSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
190494a251fdSmrg   fi
190594a251fdSmrg   have_asciidoc=yes
190694a251fdSmrgelif test "x$use_asciidoc" = x"no" ; then
190794a251fdSmrg   if test "x$ASCIIDOC" != "x"; then
190894a251fdSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
190994a251fdSmrg   fi
191094a251fdSmrg   have_asciidoc=no
191194a251fdSmrgelse
191294a251fdSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
191394a251fdSmrgfi
191494a251fdSmrgm4_ifval([$1],
191594a251fdSmrg[if test "$have_asciidoc" = yes; then
191694a251fdSmrg    # scrape the asciidoc version
191794a251fdSmrg    AC_MSG_CHECKING([the asciidoc version])
191894a251fdSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
191994a251fdSmrg    AC_MSG_RESULT([$asciidoc_version])
192094a251fdSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
192194a251fdSmrg        [if test "x$use_asciidoc" = xauto; then
192294a251fdSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
192394a251fdSmrg            have_asciidoc=no
192494a251fdSmrg        else
192594a251fdSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
192694a251fdSmrg        fi])
192794a251fdSmrgfi])
192894a251fdSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
192994a251fdSmrg]) # XORG_WITH_ASCIIDOC
1930e6232409Smrg
193194a251fdSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
19326a45684fSmrg# -------------------------------------------
193394a251fdSmrg# Minimum version: 1.5.0
193494a251fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
19356a45684fSmrg# Minimum version for optional DOT checking: 1.18.0
193694a251fdSmrg#
193794a251fdSmrg# Documentation tools are not always available on all platforms and sometimes
193894a251fdSmrg# not at the appropriate level. This macro enables a module to test for the
193994a251fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
194094a251fdSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
194194a251fdSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
194294a251fdSmrg# --with-doxygen assumes 'auto'.
194394a251fdSmrg#
194494a251fdSmrg# Interface to module:
194594a251fdSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
194694a251fdSmrg# DOXYGEN:	 returns the path of the doxygen program found
194794a251fdSmrg#		 returns the path set by the user in the environment
194894a251fdSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
194994a251fdSmrg#		  'no' user instructs the module not to use doxygen
195094a251fdSmrg#
195194a251fdSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
195294a251fdSmrg#
195394a251fdSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
195494a251fdSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
19556a45684fSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
195694a251fdSmrgm4_define([_defopt], m4_default([$2], [auto]))
195794a251fdSmrgAC_ARG_WITH(doxygen,
195894a251fdSmrg	AS_HELP_STRING([--with-doxygen],
195994a251fdSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
196094a251fdSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
196194a251fdSmrgm4_undefine([_defopt])
1962e6232409Smrg
196394a251fdSmrgif test "x$use_doxygen" = x"auto"; then
196494a251fdSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
196594a251fdSmrg   if test "x$DOXYGEN" = "x"; then
196694a251fdSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
196794a251fdSmrg	have_doxygen=no
196894a251fdSmrg   else
196994a251fdSmrg        have_doxygen=yes
197094a251fdSmrg   fi
197194a251fdSmrgelif test "x$use_doxygen" = x"yes" ; then
197294a251fdSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
197394a251fdSmrg   if test "x$DOXYGEN" = "x"; then
197494a251fdSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
197594a251fdSmrg   fi
197694a251fdSmrg   have_doxygen=yes
197794a251fdSmrgelif test "x$use_doxygen" = x"no" ; then
197894a251fdSmrg   if test "x$DOXYGEN" != "x"; then
197994a251fdSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
198094a251fdSmrg   fi
198194a251fdSmrg   have_doxygen=no
198294a251fdSmrgelse
198394a251fdSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
198494a251fdSmrgfi
198594a251fdSmrgm4_ifval([$1],
198694a251fdSmrg[if test "$have_doxygen" = yes; then
198794a251fdSmrg    # scrape the doxygen version
198894a251fdSmrg    AC_MSG_CHECKING([the doxygen version])
198994a251fdSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
199094a251fdSmrg    AC_MSG_RESULT([$doxygen_version])
199194a251fdSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
199294a251fdSmrg        [if test "x$use_doxygen" = xauto; then
199394a251fdSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
199494a251fdSmrg            have_doxygen=no
199594a251fdSmrg        else
199694a251fdSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
199794a251fdSmrg        fi])
199894a251fdSmrgfi])
19996a45684fSmrg
20006a45684fSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
20016a45684fSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
20026a45684fSmrgdnl 	HAVE_DOT = @HAVE_DOT@
20036a45684fSmrgHAVE_DOT=no
20046a45684fSmrgif test "x$have_doxygen" = "xyes"; then
20056a45684fSmrg  AC_PATH_PROG([DOT], [dot])
20066a45684fSmrg    if test "x$DOT" != "x"; then
20076a45684fSmrg      HAVE_DOT=yes
20086a45684fSmrg    fi
20096a45684fSmrgfi
20106a45684fSmrg
20116a45684fSmrgAC_SUBST([HAVE_DOT])
20126a45684fSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
201394a251fdSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
201494a251fdSmrg]) # XORG_WITH_DOXYGEN
2015e6232409Smrg
201694a251fdSmrg# XORG_WITH_GROFF([DEFAULT])
201794a251fdSmrg# ----------------
201894a251fdSmrg# Minimum version: 1.6.0
201994a251fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
202094a251fdSmrg#
202194a251fdSmrg# Documentation tools are not always available on all platforms and sometimes
202294a251fdSmrg# not at the appropriate level. This macro enables a module to test for the
202394a251fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
202494a251fdSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
202594a251fdSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
202694a251fdSmrg# --with-groff assumes 'auto'.
202794a251fdSmrg#
202894a251fdSmrg# Interface to module:
202994a251fdSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
203094a251fdSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
203194a251fdSmrg# HAVE_GROFF_MS: the -ms macros package
203294a251fdSmrg# GROFF:	 returns the path of the groff program found
203394a251fdSmrg#		 returns the path set by the user in the environment
203494a251fdSmrg# --with-groff:	 'yes' user instructs the module to use groff
203594a251fdSmrg#		 'no' user instructs the module not to use groff
2036e6232409Smrg#
203794a251fdSmrg# Added in version 1.9.0:
203894a251fdSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
203994a251fdSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
204094a251fdSmrg#		   psselect from the psutils package.
204194a251fdSmrg#		   the ghostcript package. Refer to the grohtml man pages
2042e6232409Smrg#
204394a251fdSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2044e6232409Smrg#
204594a251fdSmrg# OS and distros often splits groff in a basic and full package, the former
204694a251fdSmrg# having the groff program and the later having devices, fonts and macros
204794a251fdSmrg# Checking for the groff executable is not enough.
204894a251fdSmrg#
204994a251fdSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
205094a251fdSmrg# unset HAVE_GROFF or GROFF env variables.
205194a251fdSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
205294a251fdSmrg#
205394a251fdSmrgAC_DEFUN([XORG_WITH_GROFF],[
205494a251fdSmrgAC_ARG_VAR([GROFF], [Path to groff command])
205594a251fdSmrgm4_define([_defopt], m4_default([$1], [auto]))
205694a251fdSmrgAC_ARG_WITH(groff,
205794a251fdSmrg	AS_HELP_STRING([--with-groff],
205894a251fdSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
205994a251fdSmrg	   [use_groff=$withval], [use_groff=]_defopt)
206094a251fdSmrgm4_undefine([_defopt])
20618fff3f40Smrg
206294a251fdSmrgif test "x$use_groff" = x"auto"; then
206394a251fdSmrg   AC_PATH_PROG([GROFF], [groff])
206494a251fdSmrg   if test "x$GROFF" = "x"; then
206594a251fdSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
206694a251fdSmrg	have_groff=no
206794a251fdSmrg   else
206894a251fdSmrg        have_groff=yes
206994a251fdSmrg   fi
207094a251fdSmrgelif test "x$use_groff" = x"yes" ; then
207194a251fdSmrg   AC_PATH_PROG([GROFF], [groff])
207294a251fdSmrg   if test "x$GROFF" = "x"; then
207394a251fdSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
207494a251fdSmrg   fi
207594a251fdSmrg   have_groff=yes
207694a251fdSmrgelif test "x$use_groff" = x"no" ; then
207794a251fdSmrg   if test "x$GROFF" != "x"; then
207894a251fdSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
207994a251fdSmrg   fi
208094a251fdSmrg   have_groff=no
208194a251fdSmrgelse
208294a251fdSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2083e6232409Smrgfi
2084e6232409Smrg
208594a251fdSmrg# We have groff, test for the presence of the macro packages
208694a251fdSmrgif test "x$have_groff" = x"yes"; then
208794a251fdSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
208894a251fdSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
208994a251fdSmrg        groff_ms_works=yes
209094a251fdSmrg    else
209194a251fdSmrg        groff_ms_works=no
209294a251fdSmrg    fi
209394a251fdSmrg    AC_MSG_RESULT([$groff_ms_works])
209494a251fdSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
209594a251fdSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
209694a251fdSmrg        groff_mm_works=yes
209794a251fdSmrg    else
209894a251fdSmrg        groff_mm_works=no
209994a251fdSmrg    fi
210094a251fdSmrg    AC_MSG_RESULT([$groff_mm_works])
21018fff3f40Smrgfi
21028fff3f40Smrg
210394a251fdSmrg# We have groff, test for HTML dependencies, one command per package
210494a251fdSmrgif test "x$have_groff" = x"yes"; then
210594a251fdSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
210694a251fdSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
210794a251fdSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
210894a251fdSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
210994a251fdSmrg      have_groff_html=yes
211094a251fdSmrg   else
211194a251fdSmrg      have_groff_html=no
211294a251fdSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
211394a251fdSmrg   fi
211494a251fdSmrgfi
21158fff3f40Smrg
211694a251fdSmrg# Set Automake conditionals for Makefiles
211794a251fdSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
211894a251fdSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
211994a251fdSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
212094a251fdSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
212194a251fdSmrg]) # XORG_WITH_GROFF
21228fff3f40Smrg
212394a251fdSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
212494a251fdSmrg# ---------------------------------------
212594a251fdSmrg# Minimum version: 1.6.0
212694a251fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
212794a251fdSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2128e6232409Smrg#
212994a251fdSmrg# Documentation tools are not always available on all platforms and sometimes
213094a251fdSmrg# not at the appropriate level. This macro enables a module to test for the
213194a251fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
213294a251fdSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
213394a251fdSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
213494a251fdSmrg# --with-fop assumes 'auto'.
213594a251fdSmrg#
213694a251fdSmrg# Interface to module:
213794a251fdSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
213894a251fdSmrg# FOP:	 	returns the path of the fop program found
213994a251fdSmrg#		returns the path set by the user in the environment
214094a251fdSmrg# --with-fop: 	'yes' user instructs the module to use fop
214194a251fdSmrg#		'no' user instructs the module not to use fop
214294a251fdSmrg#
214394a251fdSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
214494a251fdSmrg#
214594a251fdSmrgAC_DEFUN([XORG_WITH_FOP],[
214694a251fdSmrgAC_ARG_VAR([FOP], [Path to fop command])
214794a251fdSmrgm4_define([_defopt], m4_default([$2], [auto]))
214894a251fdSmrgAC_ARG_WITH(fop,
214994a251fdSmrg	AS_HELP_STRING([--with-fop],
215094a251fdSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
215194a251fdSmrg	   [use_fop=$withval], [use_fop=]_defopt)
215294a251fdSmrgm4_undefine([_defopt])
21538fff3f40Smrg
215494a251fdSmrgif test "x$use_fop" = x"auto"; then
215594a251fdSmrg   AC_PATH_PROG([FOP], [fop])
215694a251fdSmrg   if test "x$FOP" = "x"; then
215794a251fdSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
215894a251fdSmrg	have_fop=no
215994a251fdSmrg   else
216094a251fdSmrg        have_fop=yes
216194a251fdSmrg   fi
216294a251fdSmrgelif test "x$use_fop" = x"yes" ; then
216394a251fdSmrg   AC_PATH_PROG([FOP], [fop])
216494a251fdSmrg   if test "x$FOP" = "x"; then
216594a251fdSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
216694a251fdSmrg   fi
216794a251fdSmrg   have_fop=yes
216894a251fdSmrgelif test "x$use_fop" = x"no" ; then
216994a251fdSmrg   if test "x$FOP" != "x"; then
217094a251fdSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
217194a251fdSmrg   fi
217294a251fdSmrg   have_fop=no
217394a251fdSmrgelse
217494a251fdSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
21758fff3f40Smrgfi
21768fff3f40Smrg
217794a251fdSmrg# Test for a minimum version of fop, if provided.
217894a251fdSmrgm4_ifval([$1],
217994a251fdSmrg[if test "$have_fop" = yes; then
218094a251fdSmrg    # scrape the fop version
218194a251fdSmrg    AC_MSG_CHECKING([for fop minimum version])
218294a251fdSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
218394a251fdSmrg    AC_MSG_RESULT([$fop_version])
218494a251fdSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
218594a251fdSmrg        [if test "x$use_fop" = xauto; then
218694a251fdSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
218794a251fdSmrg            have_fop=no
218894a251fdSmrg        else
218994a251fdSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
219094a251fdSmrg        fi])
219194a251fdSmrgfi])
219294a251fdSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
219394a251fdSmrg]) # XORG_WITH_FOP
21948fff3f40Smrg
21956a45684fSmrg# XORG_WITH_M4([MIN-VERSION])
21966a45684fSmrg# ---------------------------
21976a45684fSmrg# Minimum version: 1.19.0
21986a45684fSmrg#
21996a45684fSmrg# This macro attempts to locate an m4 macro processor which supports
22006a45684fSmrg# -I option and is only useful for modules relying on M4 in order to
22016a45684fSmrg# expand macros in source code files.
22026a45684fSmrg#
22036a45684fSmrg# Interface to module:
22046a45684fSmrg# M4:	 	returns the path of the m4 program found
22056a45684fSmrg#		returns the path set by the user in the environment
22066a45684fSmrg#
22076a45684fSmrgAC_DEFUN([XORG_WITH_M4], [
22086a45684fSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
22096a45684fSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
22106a45684fSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
22116a45684fSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
22126a45684fSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
22136a45684fSmrg   [$PATH:/usr/gnu/bin])])
22146a45684fSmrg
22156a45684fSmrgAC_SUBST([M4], [$ac_cv_path_M4])
22166a45684fSmrg]) # XORG_WITH_M4
22176a45684fSmrg
221894a251fdSmrg# XORG_WITH_PS2PDF([DEFAULT])
221994a251fdSmrg# ----------------
222094a251fdSmrg# Minimum version: 1.6.0
222194a251fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
222294a251fdSmrg#
222394a251fdSmrg# Documentation tools are not always available on all platforms and sometimes
222494a251fdSmrg# not at the appropriate level. This macro enables a module to test for the
222594a251fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
222694a251fdSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
222794a251fdSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
222894a251fdSmrg# --with-ps2pdf assumes 'auto'.
222994a251fdSmrg#
223094a251fdSmrg# Interface to module:
223194a251fdSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
223294a251fdSmrg# PS2PDF:	returns the path of the ps2pdf program found
223394a251fdSmrg#		returns the path set by the user in the environment
223494a251fdSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
223594a251fdSmrg#		 'no' user instructs the module not to use ps2pdf
223694a251fdSmrg#
223794a251fdSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
223894a251fdSmrg#
223994a251fdSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
224094a251fdSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
224194a251fdSmrgm4_define([_defopt], m4_default([$1], [auto]))
224294a251fdSmrgAC_ARG_WITH(ps2pdf,
224394a251fdSmrg	AS_HELP_STRING([--with-ps2pdf],
224494a251fdSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
224594a251fdSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
224694a251fdSmrgm4_undefine([_defopt])
22478fff3f40Smrg
224894a251fdSmrgif test "x$use_ps2pdf" = x"auto"; then
224994a251fdSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
225094a251fdSmrg   if test "x$PS2PDF" = "x"; then
225194a251fdSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
225294a251fdSmrg	have_ps2pdf=no
225394a251fdSmrg   else
225494a251fdSmrg        have_ps2pdf=yes
225594a251fdSmrg   fi
225694a251fdSmrgelif test "x$use_ps2pdf" = x"yes" ; then
225794a251fdSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
225894a251fdSmrg   if test "x$PS2PDF" = "x"; then
225994a251fdSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
226094a251fdSmrg   fi
226194a251fdSmrg   have_ps2pdf=yes
226294a251fdSmrgelif test "x$use_ps2pdf" = x"no" ; then
226394a251fdSmrg   if test "x$PS2PDF" != "x"; then
226494a251fdSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
226594a251fdSmrg   fi
226694a251fdSmrg   have_ps2pdf=no
22678fff3f40Smrgelse
226894a251fdSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
22698fff3f40Smrgfi
227094a251fdSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
227194a251fdSmrg]) # XORG_WITH_PS2PDF
22728fff3f40Smrg
227394a251fdSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
227494a251fdSmrg# ----------------
227594a251fdSmrg# Minimum version: 1.6.0
2276e6232409Smrg#
227794a251fdSmrg# Documentation tools are not always available on all platforms and sometimes
227894a251fdSmrg# not at the appropriate level. This macro enables a builder to skip all
227994a251fdSmrg# documentation targets except traditional man pages.
228094a251fdSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
228194a251fdSmrg# maximum flexibilty in controlling documentation building.
228294a251fdSmrg# Refer to:
228394a251fdSmrg# XORG_WITH_XMLTO         --with-xmlto
228494a251fdSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
228594a251fdSmrg# XORG_WITH_DOXYGEN       --with-doxygen
228694a251fdSmrg# XORG_WITH_FOP           --with-fop
228794a251fdSmrg# XORG_WITH_GROFF         --with-groff
228894a251fdSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
22898fff3f40Smrg#
229094a251fdSmrg# Interface to module:
229194a251fdSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
229294a251fdSmrg# --enable-docs: 'yes' user instructs the module to generate docs
229394a251fdSmrg#		 'no' user instructs the module not to generate docs
229494a251fdSmrg# parm1:	specify the default value, yes or no.
229594a251fdSmrg#
229694a251fdSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
229794a251fdSmrgm4_define([docs_default], m4_default([$1], [yes]))
229894a251fdSmrgAC_ARG_ENABLE(docs,
229994a251fdSmrg	AS_HELP_STRING([--enable-docs],
230094a251fdSmrg	   [Enable building the documentation (default: ]docs_default[)]),
230194a251fdSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
230294a251fdSmrgm4_undefine([docs_default])
230394a251fdSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
230494a251fdSmrgAC_MSG_CHECKING([whether to build documentation])
230594a251fdSmrgAC_MSG_RESULT([$build_docs])
230694a251fdSmrg]) # XORG_ENABLE_DOCS
23078fff3f40Smrg
230894a251fdSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
230994a251fdSmrg# ----------------
231094a251fdSmrg# Minimum version: 1.6.0
231194a251fdSmrg#
231294a251fdSmrg# This macro enables a builder to skip all developer documentation.
231394a251fdSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
231494a251fdSmrg# maximum flexibilty in controlling documentation building.
231594a251fdSmrg# Refer to:
231694a251fdSmrg# XORG_WITH_XMLTO         --with-xmlto
231794a251fdSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
231894a251fdSmrg# XORG_WITH_DOXYGEN       --with-doxygen
231994a251fdSmrg# XORG_WITH_FOP           --with-fop
232094a251fdSmrg# XORG_WITH_GROFF         --with-groff
232194a251fdSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
232294a251fdSmrg#
232394a251fdSmrg# Interface to module:
232494a251fdSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
232594a251fdSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
232694a251fdSmrg#			'no' user instructs the module not to generate developer docs
232794a251fdSmrg# parm1:		specify the default value, yes or no.
232894a251fdSmrg#
232994a251fdSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
233094a251fdSmrgm4_define([devel_default], m4_default([$1], [yes]))
233194a251fdSmrgAC_ARG_ENABLE(devel-docs,
233294a251fdSmrg	AS_HELP_STRING([--enable-devel-docs],
233394a251fdSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
233494a251fdSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
233594a251fdSmrgm4_undefine([devel_default])
233694a251fdSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
233794a251fdSmrgAC_MSG_CHECKING([whether to build developer documentation])
233894a251fdSmrgAC_MSG_RESULT([$build_devel_docs])
233994a251fdSmrg]) # XORG_ENABLE_DEVEL_DOCS
2340e6232409Smrg
234194a251fdSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
234294a251fdSmrg# ----------------
234394a251fdSmrg# Minimum version: 1.6.0
234494a251fdSmrg#
234594a251fdSmrg# This macro enables a builder to skip all functional specification targets.
234694a251fdSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
234794a251fdSmrg# maximum flexibilty in controlling documentation building.
234894a251fdSmrg# Refer to:
234994a251fdSmrg# XORG_WITH_XMLTO         --with-xmlto
235094a251fdSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
235194a251fdSmrg# XORG_WITH_DOXYGEN       --with-doxygen
235294a251fdSmrg# XORG_WITH_FOP           --with-fop
235394a251fdSmrg# XORG_WITH_GROFF         --with-groff
235494a251fdSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
235594a251fdSmrg#
235694a251fdSmrg# Interface to module:
235794a251fdSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
235894a251fdSmrg# --enable-specs:	'yes' user instructs the module to generate specs
235994a251fdSmrg#			'no' user instructs the module not to generate specs
236094a251fdSmrg# parm1:		specify the default value, yes or no.
236194a251fdSmrg#
236294a251fdSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
236394a251fdSmrgm4_define([spec_default], m4_default([$1], [yes]))
236494a251fdSmrgAC_ARG_ENABLE(specs,
236594a251fdSmrg	AS_HELP_STRING([--enable-specs],
236694a251fdSmrg	   [Enable building the specs (default: ]spec_default[)]),
236794a251fdSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
236894a251fdSmrgm4_undefine([spec_default])
236994a251fdSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
237094a251fdSmrgAC_MSG_CHECKING([whether to build functional specifications])
237194a251fdSmrgAC_MSG_RESULT([$build_specs])
237294a251fdSmrg]) # XORG_ENABLE_SPECS
23738fff3f40Smrg
237494a251fdSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
237594a251fdSmrg# ----------------------------------------------
237694a251fdSmrg# Minimum version: 1.13.0
2377e6232409Smrg#
237894a251fdSmrg# This macro enables a builder to enable/disable unit testing
237994a251fdSmrg# It makes no assumption about the test cases implementation
238094a251fdSmrg# Test cases may or may not use Automake "Support for test suites"
238194a251fdSmrg# They may or may not use the software utility library GLib
238294a251fdSmrg#
238394a251fdSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
238494a251fdSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
238594a251fdSmrg# The variable enable_unit_tests is used by other macros in this file.
238694a251fdSmrg#
238794a251fdSmrg# Interface to module:
238894a251fdSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
238994a251fdSmrg# enable_unit_tests:    used in configure.ac for additional configuration
239094a251fdSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
239194a251fdSmrg#			'no' user instructs the module not to build tests
239294a251fdSmrg# parm1:		specify the default value, yes or no.
239394a251fdSmrg#
239494a251fdSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
239594a251fdSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
239694a251fdSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
239794a251fdSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
239894a251fdSmrgm4_define([_defopt], m4_default([$1], [auto]))
239994a251fdSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
240094a251fdSmrg	[Enable building unit test cases (default: ]_defopt[)]),
240194a251fdSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
240294a251fdSmrgm4_undefine([_defopt])
240394a251fdSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
240494a251fdSmrgAC_MSG_CHECKING([whether to build unit test cases])
240594a251fdSmrgAC_MSG_RESULT([$enable_unit_tests])
240694a251fdSmrg]) # XORG_ENABLE_UNIT_TESTS
240794a251fdSmrg
240894a251fdSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
240994a251fdSmrg# ------------------------------------------------------
241094a251fdSmrg# Minimum version: 1.17.0
241194a251fdSmrg#
241294a251fdSmrg# This macro enables a builder to enable/disable integration testing
241394a251fdSmrg# It makes no assumption about the test cases' implementation
241494a251fdSmrg# Test cases may or may not use Automake "Support for test suites"
241594a251fdSmrg#
241694a251fdSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
241794a251fdSmrg# usually requires less dependencies and may be built and run under less
241894a251fdSmrg# stringent environments than integration tests.
241994a251fdSmrg#
242094a251fdSmrg# Interface to module:
242194a251fdSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
242294a251fdSmrg# enable_integration_tests:   used in configure.ac for additional configuration
242394a251fdSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
242494a251fdSmrg#                             'no' user instructs the module not to build tests
242594a251fdSmrg# parm1:                      specify the default value, yes or no.
242694a251fdSmrg#
242794a251fdSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
242894a251fdSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
242994a251fdSmrgm4_define([_defopt], m4_default([$1], [auto]))
243094a251fdSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
243194a251fdSmrg	[Enable building integration test cases (default: ]_defopt[)]),
243294a251fdSmrg	[enable_integration_tests=$enableval],
243394a251fdSmrg	[enable_integration_tests=]_defopt)
243494a251fdSmrgm4_undefine([_defopt])
243594a251fdSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
243694a251fdSmrg	[test "x$enable_integration_tests" != xno])
243794a251fdSmrgAC_MSG_CHECKING([whether to build unit test cases])
243894a251fdSmrgAC_MSG_RESULT([$enable_integration_tests])
243994a251fdSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
244094a251fdSmrg
244194a251fdSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
244294a251fdSmrg# ----------------------------------------
244394a251fdSmrg# Minimum version: 1.13.0
244494a251fdSmrg#
244594a251fdSmrg# GLib is a library which provides advanced data structures and functions.
244694a251fdSmrg# This macro enables a module to test for the presence of Glib.
244794a251fdSmrg#
244894a251fdSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
244994a251fdSmrg# Otherwise the value of $enable_unit_tests is blank.
245094a251fdSmrg#
245194a251fdSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
245294a251fdSmrg# test support usually requires less dependencies and may be built and run under
245394a251fdSmrg# less stringent environments than integration tests.
245494a251fdSmrg#
245594a251fdSmrg# Interface to module:
245694a251fdSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
245794a251fdSmrg# with_glib: used in configure.ac to know if GLib has been found
245894a251fdSmrg# --with-glib:	'yes' user instructs the module to use glib
245994a251fdSmrg#		'no' user instructs the module not to use glib
246094a251fdSmrg#
246194a251fdSmrgAC_DEFUN([XORG_WITH_GLIB],[
246294a251fdSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
246394a251fdSmrgm4_define([_defopt], m4_default([$2], [auto]))
246494a251fdSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
246594a251fdSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
246694a251fdSmrg	[with_glib=$withval], [with_glib=]_defopt)
246794a251fdSmrgm4_undefine([_defopt])
246894a251fdSmrg
246994a251fdSmrghave_glib=no
247094a251fdSmrg# Do not probe GLib if user explicitly disabled unit testing
247194a251fdSmrgif test "x$enable_unit_tests" != x"no"; then
247294a251fdSmrg  # Do not probe GLib if user explicitly disabled it
247394a251fdSmrg  if test "x$with_glib" != x"no"; then
247494a251fdSmrg    m4_ifval(
247594a251fdSmrg      [$1],
247694a251fdSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
247794a251fdSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
247894a251fdSmrg    )
247994a251fdSmrg  fi
248094a251fdSmrgfi
24818fff3f40Smrg
248294a251fdSmrg# Not having GLib when unit testing has been explicitly requested is an error
248394a251fdSmrgif test "x$enable_unit_tests" = x"yes"; then
248494a251fdSmrg  if test "x$have_glib" = x"no"; then
248594a251fdSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
248694a251fdSmrg  fi
248794a251fdSmrgfi
24888fff3f40Smrg
248994a251fdSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
249094a251fdSmrgif test "x$enable_unit_tests" = x"no"; then
249194a251fdSmrg  if test "x$with_glib" = x"yes"; then
249294a251fdSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
249394a251fdSmrg  fi
249494a251fdSmrgfi
249594a251fdSmrg
249694a251fdSmrg# Not having GLib when it has been explicitly requested is an error
249794a251fdSmrgif test "x$with_glib" = x"yes"; then
249894a251fdSmrg  if test "x$have_glib" = x"no"; then
249994a251fdSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
250094a251fdSmrg  fi
250194a251fdSmrgfi
25028fff3f40Smrg
250394a251fdSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
250494a251fdSmrg]) # XORG_WITH_GLIB
25058fff3f40Smrg
250694a251fdSmrg# XORG_LD_WRAP([required|optional])
250794a251fdSmrg# ---------------------------------
250894a251fdSmrg# Minimum version: 1.13.0
250994a251fdSmrg#
251094a251fdSmrg# Check if linker supports -wrap, passed via compiler flags
251194a251fdSmrg#
251294a251fdSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
251394a251fdSmrg# Otherwise the value of $enable_unit_tests is blank.
251494a251fdSmrg#
251594a251fdSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
251694a251fdSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
251794a251fdSmrg# available, an argument of "optional" allows use when some unit tests require
251894a251fdSmrg# ld -wrap and others do not.
251994a251fdSmrg#
252094a251fdSmrgAC_DEFUN([XORG_LD_WRAP],[
252194a251fdSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
252294a251fdSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
252394a251fdSmrg                      void __wrap_exit(int status) { return; }],
252494a251fdSmrg                     [exit(0);])])
252594a251fdSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
252694a251fdSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
252794a251fdSmrg  if test "x$have_ld_wrap" = x"no"; then
252894a251fdSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
252994a251fdSmrg  fi
25308fff3f40Smrgfi
253194a251fdSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
253294a251fdSmrg#
253394a251fdSmrg]) # XORG_LD_WRAP
253494a251fdSmrg
253594a251fdSmrg# XORG_CHECK_LINKER_FLAGS
253694a251fdSmrg# -----------------------
253794a251fdSmrg# SYNOPSIS
253894a251fdSmrg#
253994a251fdSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
254094a251fdSmrg#
254194a251fdSmrg# DESCRIPTION
254294a251fdSmrg#
254394a251fdSmrg#   Check whether the given linker FLAGS work with the current language's
254494a251fdSmrg#   linker, or whether they give an error.
254594a251fdSmrg#
254694a251fdSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
254794a251fdSmrg#   success/failure.
254894a251fdSmrg#
254994a251fdSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
255094a251fdSmrg#
255194a251fdSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
255294a251fdSmrg#
255394a251fdSmrg# LICENSE
255494a251fdSmrg#
255594a251fdSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
255694a251fdSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
255794a251fdSmrg#   Copyright (c) 2009 Matteo Frigo
255894a251fdSmrg#
255994a251fdSmrg#   This program is free software: you can redistribute it and/or modify it
256094a251fdSmrg#   under the terms of the GNU General Public License as published by the
256194a251fdSmrg#   Free Software Foundation, either version 3 of the License, or (at your
256294a251fdSmrg#   option) any later version.
256394a251fdSmrg#
256494a251fdSmrg#   This program is distributed in the hope that it will be useful, but
256594a251fdSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
256694a251fdSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
256794a251fdSmrg#   Public License for more details.
256894a251fdSmrg#
256994a251fdSmrg#   You should have received a copy of the GNU General Public License along
257094a251fdSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
257194a251fdSmrg#
257294a251fdSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
257394a251fdSmrg#   gives unlimited permission to copy, distribute and modify the configure
257494a251fdSmrg#   scripts that are the output of Autoconf when processing the Macro. You
257594a251fdSmrg#   need not follow the terms of the GNU General Public License when using
257694a251fdSmrg#   or distributing such scripts, even though portions of the text of the
257794a251fdSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
257894a251fdSmrg#   all other use of the material that constitutes the Autoconf Macro.
257994a251fdSmrg#
258094a251fdSmrg#   This special exception to the GPL applies to versions of the Autoconf
258194a251fdSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
258294a251fdSmrg#   modified version of the Autoconf Macro, you may extend this special
258394a251fdSmrg#   exception to the GPL to apply to your modified version as well.#
258494a251fdSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
258594a251fdSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
258694a251fdSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
258794a251fdSmrgAS_LITERAL_IF([$1],
258894a251fdSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
258994a251fdSmrg      ax_save_FLAGS=$LDFLAGS
259094a251fdSmrg      LDFLAGS="$1"
259194a251fdSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
259294a251fdSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
259394a251fdSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
259494a251fdSmrg      LDFLAGS=$ax_save_FLAGS])],
259594a251fdSmrg  [ax_save_FLAGS=$LDFLAGS
259694a251fdSmrg   LDFLAGS="$1"
259794a251fdSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
259894a251fdSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
259994a251fdSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
260094a251fdSmrg   LDFLAGS=$ax_save_FLAGS])
260194a251fdSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
260294a251fdSmrgAC_MSG_RESULT($xorg_check_linker_flags)
260394a251fdSmrgif test "x$xorg_check_linker_flags" = xyes; then
260494a251fdSmrg	m4_default([$2], :)
26058fff3f40Smrgelse
260694a251fdSmrg	m4_default([$3], :)
26078fff3f40Smrgfi
260894a251fdSmrg]) # XORG_CHECK_LINKER_FLAGS
26098fff3f40Smrg
261094a251fdSmrg# XORG_MEMORY_CHECK_FLAGS
261194a251fdSmrg# -----------------------
261294a251fdSmrg# Minimum version: 1.16.0
2613e6232409Smrg#
261494a251fdSmrg# This macro attempts to find appropriate memory checking functionality
261594a251fdSmrg# for various platforms which unit testing code may use to catch various
261694a251fdSmrg# forms of memory allocation and access errors in testing.
261794a251fdSmrg#
261894a251fdSmrg# Interface to module:
261994a251fdSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
262094a251fdSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
262194a251fdSmrg#
262294a251fdSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
262394a251fdSmrg#
262494a251fdSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
26258fff3f40Smrg
262694a251fdSmrgAC_REQUIRE([AC_CANONICAL_HOST])
262794a251fdSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
262894a251fdSmrg           [Environment variables to enable memory checking in tests])
262994a251fdSmrg
263094a251fdSmrg# Check for different types of support on different platforms
263194a251fdSmrgcase $host_os in
263294a251fdSmrg    solaris*)
263394a251fdSmrg        AC_CHECK_LIB([umem], [umem_alloc],
263494a251fdSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
263594a251fdSmrg        ;;
263694a251fdSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
263794a251fdSmrg        # both directly and inverted, so should not be 0 or 255.
263894a251fdSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
263994a251fdSmrg        ;;
264094a251fdSmrg    darwin*)
264194a251fdSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
264294a251fdSmrg        ;;
264394a251fdSmrg    *bsd*)
264494a251fdSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
264594a251fdSmrg        ;;
26468fff3f40Smrgesac
26478fff3f40Smrg
264894a251fdSmrg# User supplied flags override default flags
264994a251fdSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
265094a251fdSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
265194a251fdSmrgfi
2652e6232409Smrg
265394a251fdSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
265494a251fdSmrg]) # XORG_WITH_LINT
2655e6232409Smrg
265694a251fdSmrg# XORG_CHECK_MALLOC_ZERO
265794a251fdSmrg# ----------------------
265894a251fdSmrg# Minimum version: 1.0.0
265994a251fdSmrg#
266094a251fdSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
266194a251fdSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
266294a251fdSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
266394a251fdSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
266494a251fdSmrgAC_ARG_ENABLE(malloc0returnsnull,
266594a251fdSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
266694a251fdSmrg		       [malloc(0) returns NULL (default: auto)]),
266794a251fdSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
266894a251fdSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
26698fff3f40Smrg
267094a251fdSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
267194a251fdSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
26726a45684fSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
26736a45684fSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
267494a251fdSmrg#include <stdlib.h>
267594a251fdSmrg],[
267694a251fdSmrg    char *m0, *r0, *c0, *p;
267794a251fdSmrg    m0 = malloc(0);
267894a251fdSmrg    p = malloc(10);
267994a251fdSmrg    r0 = realloc(p,0);
268094a251fdSmrg    c0 = calloc(0,10);
268194a251fdSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
268294a251fdSmrg])],
26836a45684fSmrg		[xorg_cv_malloc0_returns_null=yes],
26846a45684fSmrg		[xorg_cv_malloc0_returns_null=no])])
26856a45684fSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
268694a251fdSmrgfi
268794a251fdSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
26888fff3f40Smrg
268994a251fdSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
269094a251fdSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
269194a251fdSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
269294a251fdSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
269394a251fdSmrgelse
269494a251fdSmrg	MALLOC_ZERO_CFLAGS=""
269594a251fdSmrg	XMALLOC_ZERO_CFLAGS=""
269694a251fdSmrg	XTMALLOC_ZERO_CFLAGS=""
269794a251fdSmrgfi
26988fff3f40Smrg
269994a251fdSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
270094a251fdSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
270194a251fdSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
270294a251fdSmrg]) # XORG_CHECK_MALLOC_ZERO
27038fff3f40Smrg
270494a251fdSmrg# XORG_WITH_LINT()
270594a251fdSmrg# ----------------
270694a251fdSmrg# Minimum version: 1.1.0
2707e6232409Smrg#
270894a251fdSmrg# This macro enables the use of a tool that flags some suspicious and
270994a251fdSmrg# non-portable constructs (likely to be bugs) in C language source code.
271094a251fdSmrg# It will attempt to locate the tool and use appropriate options.
271194a251fdSmrg# There are various lint type tools on different platforms.
271294a251fdSmrg#
271394a251fdSmrg# Interface to module:
271494a251fdSmrg# LINT:		returns the path to the tool found on the platform
271594a251fdSmrg#		or the value set to LINT on the configure cmd line
271694a251fdSmrg#		also an Automake conditional
271794a251fdSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
271894a251fdSmrg#
271994a251fdSmrg# --with-lint:	'yes' user instructs the module to use lint
272094a251fdSmrg#		'no' user instructs the module not to use lint (default)
272194a251fdSmrg#
272294a251fdSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
272394a251fdSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
272494a251fdSmrg#
272594a251fdSmrgAC_DEFUN([XORG_WITH_LINT],[
27268fff3f40Smrg
272794a251fdSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
272894a251fdSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
272994a251fdSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
273094a251fdSmrg		[Use a lint-style source code checker (default: disabled)])],
273194a251fdSmrg		[use_lint=$withval], [use_lint=no])
27328fff3f40Smrg
273394a251fdSmrg# Obtain platform specific info like program name and options
273494a251fdSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
273594a251fdSmrgcase $host_os in
273694a251fdSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
273794a251fdSmrg	lint_name=splint
273894a251fdSmrg	lint_options="-badflag"
273994a251fdSmrg	;;
274094a251fdSmrg  *freebsd* | *netbsd*)
274194a251fdSmrg	lint_name=lint
274294a251fdSmrg	lint_options="-u -b"
274394a251fdSmrg	;;
274494a251fdSmrg  *solaris*)
274594a251fdSmrg	lint_name=lint
274694a251fdSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
274794a251fdSmrg	;;
27488fff3f40Smrgesac
27498fff3f40Smrg
275094a251fdSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
275194a251fdSmrgif test "x$use_lint" = x"yes" ; then
275294a251fdSmrg   AC_PATH_PROG([LINT], [$lint_name])
275394a251fdSmrg   if test "x$LINT" = "x"; then
275494a251fdSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
27558fff3f40Smrg   fi
275694a251fdSmrgelif test "x$use_lint" = x"no" ; then
275794a251fdSmrg   if test "x$LINT" != "x"; then
275894a251fdSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
27598fff3f40Smrg   fi
27608fff3f40Smrgelse
276194a251fdSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
27628fff3f40Smrgfi
27638fff3f40Smrg
276494a251fdSmrg# User supplied flags override default flags
276594a251fdSmrgif test "x$LINT_FLAGS" != "x"; then
276694a251fdSmrg   lint_options=$LINT_FLAGS
276794a251fdSmrgfi
27688fff3f40Smrg
276994a251fdSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
277094a251fdSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
27718fff3f40Smrg
277294a251fdSmrg]) # XORG_WITH_LINT
277394a251fdSmrg
277494a251fdSmrg# XORG_LINT_LIBRARY(LIBNAME)
27758fff3f40Smrg# --------------------------
277694a251fdSmrg# Minimum version: 1.1.0
277794a251fdSmrg#
277894a251fdSmrg# Sets up flags for building lint libraries for checking programs that call
277994a251fdSmrg# functions in the library.
278094a251fdSmrg#
278194a251fdSmrg# Interface to module:
278294a251fdSmrg# LINTLIB		- Automake variable with the name of lint library file to make
278394a251fdSmrg# MAKE_LINT_LIB		- Automake conditional
278494a251fdSmrg#
278594a251fdSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
278694a251fdSmrg#			  - 'no' user instructs the module not to create a lint library (default)
278794a251fdSmrg
278894a251fdSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
278994a251fdSmrgAC_REQUIRE([XORG_WITH_LINT])
279094a251fdSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
279194a251fdSmrg	[Create lint library (default: disabled)])],
279294a251fdSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
279394a251fdSmrg
279494a251fdSmrgif test "x$make_lint_lib" = x"yes" ; then
279594a251fdSmrg   LINTLIB=llib-l$1.ln
279694a251fdSmrg   if test "x$LINT" = "x"; then
279794a251fdSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
279894a251fdSmrg   fi
279994a251fdSmrgelif test "x$make_lint_lib" != x"no" ; then
280094a251fdSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
280194a251fdSmrgfi
280294a251fdSmrg
280394a251fdSmrgAC_SUBST(LINTLIB)
280494a251fdSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
280594a251fdSmrg
280694a251fdSmrg]) # XORG_LINT_LIBRARY
280794a251fdSmrg
280894a251fdSmrg# XORG_COMPILER_BRAND
280994a251fdSmrg# -------------------
281094a251fdSmrg# Minimum version: 1.14.0
281194a251fdSmrg#
281294a251fdSmrg# Checks for various brands of compilers and sets flags as appropriate:
281394a251fdSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
281494a251fdSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
281594a251fdSmrg#   clang compiler - sets CLANGCC to "yes"
281694a251fdSmrg#   Intel compiler - sets INTELCC to "yes"
281794a251fdSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
281894a251fdSmrg#
281994a251fdSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
282094a251fdSmrgAC_LANG_CASE(
282194a251fdSmrg	[C], [
282294a251fdSmrg		AC_REQUIRE([AC_PROG_CC_C99])
282394a251fdSmrg	],
282494a251fdSmrg	[C++], [
282594a251fdSmrg		AC_REQUIRE([AC_PROG_CXX])
282694a251fdSmrg	]
282794a251fdSmrg)
282894a251fdSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
282994a251fdSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
283094a251fdSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
283194a251fdSmrg]) # XORG_COMPILER_BRAND
283294a251fdSmrg
283394a251fdSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
283494a251fdSmrg# ---------------
283594a251fdSmrg# Minimum version: 1.16.0
283694a251fdSmrg#
283794a251fdSmrg# Test if the compiler works when passed the given flag as a command line argument.
283894a251fdSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
283994a251fdSmrg# next flag in the list until there are no more options.
284094a251fdSmrg#
284194a251fdSmrg# Note that this does not guarantee that the compiler supports the flag as some
284294a251fdSmrg# compilers will simply ignore arguments that they do not understand, but we do
284394a251fdSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
284494a251fdSmrg# -Werror=unused-command-line-argument
284594a251fdSmrg#
284694a251fdSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
284794a251fdSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
284894a251fdSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
284994a251fdSmrg
285094a251fdSmrgAC_LANG_COMPILER_REQUIRE
285194a251fdSmrg
285294a251fdSmrgAC_LANG_CASE(
285394a251fdSmrg	[C], [
285494a251fdSmrg		AC_REQUIRE([AC_PROG_CC_C99])
285594a251fdSmrg		define([PREFIX], [C])
285694a251fdSmrg		define([CACHE_PREFIX], [cc])
285794a251fdSmrg		define([COMPILER], [$CC])
285894a251fdSmrg	],
285994a251fdSmrg	[C++], [
286094a251fdSmrg		define([PREFIX], [CXX])
286194a251fdSmrg		define([CACHE_PREFIX], [cxx])
286294a251fdSmrg		define([COMPILER], [$CXX])
286394a251fdSmrg	]
286494a251fdSmrg)
286594a251fdSmrg
286694a251fdSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
286794a251fdSmrg
286894a251fdSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
286994a251fdSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
287094a251fdSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
287194a251fdSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
287294a251fdSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
287394a251fdSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
287494a251fdSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
287594a251fdSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
287694a251fdSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
287794a251fdSmrgfi
287894a251fdSmrg
287994a251fdSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
288094a251fdSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
288194a251fdSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
288294a251fdSmrg	fi
288394a251fdSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
288494a251fdSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
288594a251fdSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
288694a251fdSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
288794a251fdSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
288894a251fdSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
288994a251fdSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
289094a251fdSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
289194a251fdSmrgfi
289294a251fdSmrg
289394a251fdSmrgfound="no"
289494a251fdSmrgm4_foreach([flag], m4_cdr($@), [
289594a251fdSmrg	if test $found = "no" ; then
28966a45684fSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
289794a251fdSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
289894a251fdSmrg		fi
289994a251fdSmrg
29006a45684fSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
290194a251fdSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
290294a251fdSmrg		fi
290394a251fdSmrg
290494a251fdSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
290594a251fdSmrg
290694a251fdSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
290794a251fdSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
290894a251fdSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
290994a251fdSmrg		AC_CACHE_VAL($cacheid,
291094a251fdSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
291194a251fdSmrg					     [eval $cacheid=yes],
291294a251fdSmrg					     [eval $cacheid=no])])
291394a251fdSmrg
291494a251fdSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
291594a251fdSmrg
291694a251fdSmrg		eval supported=\$$cacheid
291794a251fdSmrg		AC_MSG_RESULT([$supported])
291894a251fdSmrg		if test "$supported" = "yes" ; then
291994a251fdSmrg			$1="$$1 ]flag["
292094a251fdSmrg			found="yes"
292194a251fdSmrg		fi
292294a251fdSmrg	fi
29238fff3f40Smrg])
292494a251fdSmrg]) # XORG_TESTSET_CFLAG
29258fff3f40Smrg
292694a251fdSmrg# XORG_COMPILER_FLAGS
292794a251fdSmrg# ---------------
292894a251fdSmrg# Minimum version: 1.16.0
292994a251fdSmrg#
293094a251fdSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
293194a251fdSmrg# arguments supported by the selected compiler which do NOT alter the generated
293294a251fdSmrg# code.  These arguments will cause the compiler to print various warnings
293394a251fdSmrg# during compilation AND turn a conservative set of warnings into errors.
293494a251fdSmrg#
293594a251fdSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
293694a251fdSmrg# future versions of util-macros as options are added to new compilers.
293794a251fdSmrg#
293894a251fdSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
293994a251fdSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
294094a251fdSmrg
294194a251fdSmrgAC_ARG_ENABLE(selective-werror,
294294a251fdSmrg              AS_HELP_STRING([--disable-selective-werror],
294394a251fdSmrg                             [Turn off selective compiler errors. (default: enabled)]),
294494a251fdSmrg              [SELECTIVE_WERROR=$enableval],
294594a251fdSmrg              [SELECTIVE_WERROR=yes])
294694a251fdSmrg
294794a251fdSmrgAC_LANG_CASE(
294894a251fdSmrg        [C], [
294994a251fdSmrg                define([PREFIX], [C])
295094a251fdSmrg        ],
295194a251fdSmrg        [C++], [
295294a251fdSmrg                define([PREFIX], [CXX])
295394a251fdSmrg        ]
295494a251fdSmrg)
295594a251fdSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
295694a251fdSmrgif test "x$SUNCC" = "xyes"; then
295794a251fdSmrg    [BASE_]PREFIX[FLAGS]="-v"
295894a251fdSmrgelse
295994a251fdSmrg    [BASE_]PREFIX[FLAGS]=""
296094a251fdSmrgfi
29618fff3f40Smrg
296294a251fdSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
296394a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
296494a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
296594a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
296694a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
296794a251fdSmrg
296894a251fdSmrgAC_LANG_CASE(
296994a251fdSmrg	[C], [
297094a251fdSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
297194a251fdSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
297294a251fdSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
297394a251fdSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
29746a45684fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
297594a251fdSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
297694a251fdSmrg	]
297794a251fdSmrg)
297894a251fdSmrg
297994a251fdSmrg# This chunk adds additional warnings that could catch undesired effects.
298094a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
298194a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
298294a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
298394a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
298494a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
298594a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
29866a45684fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
298794a251fdSmrg
298894a251fdSmrg# These are currently disabled because they are noisy.  They will be enabled
298994a251fdSmrg# in the future once the codebase is sufficiently modernized to silence
299094a251fdSmrg# them.  For now, I don't want them to drown out the other warnings.
299194a251fdSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
299294a251fdSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
29936a45684fSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
299494a251fdSmrg
299594a251fdSmrg# Turn some warnings into errors, so we don't accidently get successful builds
299694a251fdSmrg# when there are problems that should be fixed.
299794a251fdSmrg
299894a251fdSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
299994a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
300094a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
300194a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
300294a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
300394a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
300494a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
300594a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
300694a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
300794a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
300894a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
300994a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
301094a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
301194a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
301294a251fdSmrgelse
301394a251fdSmrgAC_MSG_WARN([You have chosen not to turn some select compiler warnings into errors.  This should not be necessary.  Please report why you needed to do so in a bug report at $PACKAGE_BUGREPORT])
301494a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
301594a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
301694a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
301794a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
301894a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
301994a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
302094a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
302194a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
302294a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
302394a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
302494a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
302594a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
302694a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
30278fff3f40Smrgfi
30288fff3f40Smrg
302994a251fdSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
303094a251fdSmrg]) # XORG_COMPILER_FLAGS
303194a251fdSmrg
303294a251fdSmrg# XORG_CWARNFLAGS
303394a251fdSmrg# ---------------
303494a251fdSmrg# Minimum version: 1.2.0
303594a251fdSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3036e6232409Smrg#
303794a251fdSmrg# Defines CWARNFLAGS to enable C compiler warnings.
303894a251fdSmrg#
303994a251fdSmrg# This function is deprecated because it defines -fno-strict-aliasing
304094a251fdSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
304194a251fdSmrg# is needed, then it should be added explicitly in the module when
304294a251fdSmrg# it is updated to use BASE_CFLAGS.
304394a251fdSmrg#
304494a251fdSmrgAC_DEFUN([XORG_CWARNFLAGS], [
304594a251fdSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
304694a251fdSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
304794a251fdSmrgAC_LANG_CASE(
304894a251fdSmrg	[C], [
304994a251fdSmrg		CWARNFLAGS="$BASE_CFLAGS"
305094a251fdSmrg		if  test "x$GCC" = xyes ; then
305194a251fdSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
305294a251fdSmrg		fi
305394a251fdSmrg		AC_SUBST(CWARNFLAGS)
305494a251fdSmrg	]
305594a251fdSmrg)
305694a251fdSmrg]) # XORG_CWARNFLAGS
3057e6232409Smrg
305894a251fdSmrg# XORG_STRICT_OPTION
305994a251fdSmrg# -----------------------
306094a251fdSmrg# Minimum version: 1.3.0
306194a251fdSmrg#
306294a251fdSmrg# Add configure option to enable strict compilation flags, such as treating
306394a251fdSmrg# warnings as fatal errors.
306494a251fdSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
306594a251fdSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
306694a251fdSmrg#
306794a251fdSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
306894a251fdSmrg# when strict compilation is unconditionally desired.
306994a251fdSmrgAC_DEFUN([XORG_STRICT_OPTION], [
307094a251fdSmrgAC_REQUIRE([XORG_CWARNFLAGS])
307194a251fdSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3072e6232409Smrg
307394a251fdSmrgAC_ARG_ENABLE(strict-compilation,
307494a251fdSmrg			  AS_HELP_STRING([--enable-strict-compilation],
307594a251fdSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
307694a251fdSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3077e6232409Smrg
307894a251fdSmrgAC_LANG_CASE(
307994a251fdSmrg        [C], [
308094a251fdSmrg                define([PREFIX], [C])
308194a251fdSmrg        ],
308294a251fdSmrg        [C++], [
308394a251fdSmrg                define([PREFIX], [CXX])
308494a251fdSmrg        ]
308594a251fdSmrg)
3086e6232409Smrg
308794a251fdSmrg[STRICT_]PREFIX[FLAGS]=""
308894a251fdSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
308994a251fdSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3090e6232409Smrg
309194a251fdSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
309294a251fdSmrg# activate it with -Werror, so we add it here explicitly.
309394a251fdSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3094e6232409Smrg
309594a251fdSmrgif test "x$STRICT_COMPILE" = "xyes"; then
309694a251fdSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
309794a251fdSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
309894a251fdSmrgfi
309994a251fdSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
310094a251fdSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
310194a251fdSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
310294a251fdSmrg]) # XORG_STRICT_OPTION
3103e6232409Smrg
310494a251fdSmrg# XORG_DEFAULT_OPTIONS
31058fff3f40Smrg# --------------------
310694a251fdSmrg# Minimum version: 1.3.0
31078fff3f40Smrg#
310894a251fdSmrg# Defines default options for X.Org modules.
31098fff3f40Smrg#
311094a251fdSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
311194a251fdSmrgAC_REQUIRE([AC_PROG_INSTALL])
311294a251fdSmrgXORG_COMPILER_FLAGS
311394a251fdSmrgXORG_CWARNFLAGS
311494a251fdSmrgXORG_STRICT_OPTION
311594a251fdSmrgXORG_RELEASE_VERSION
311694a251fdSmrgXORG_CHANGELOG
311794a251fdSmrgXORG_INSTALL
311894a251fdSmrgXORG_MANPAGE_SECTIONS
311994a251fdSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
312094a251fdSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
312194a251fdSmrg]) # XORG_DEFAULT_OPTIONS
31228fff3f40Smrg
312394a251fdSmrg# XORG_INSTALL()
312494a251fdSmrg# ----------------
312594a251fdSmrg# Minimum version: 1.4.0
312694a251fdSmrg#
312794a251fdSmrg# Defines the variable INSTALL_CMD as the command to copy
312894a251fdSmrg# INSTALL from $prefix/share/util-macros.
312994a251fdSmrg#
313094a251fdSmrgAC_DEFUN([XORG_INSTALL], [
313194a251fdSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
313294a251fdSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
313394a251fdSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
313494a251fdSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
313594a251fdSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
313694a251fdSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
313794a251fdSmrgAC_SUBST([INSTALL_CMD])
313894a251fdSmrg]) # XORG_INSTALL
313994a251fdSmrgdnl Copyright 2005 Red Hat, Inc
314094a251fdSmrgdnl
314194a251fdSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
314294a251fdSmrgdnl documentation for any purpose is hereby granted without fee, provided that
314394a251fdSmrgdnl the above copyright notice appear in all copies and that both that
314494a251fdSmrgdnl copyright notice and this permission notice appear in supporting
314594a251fdSmrgdnl documentation.
314694a251fdSmrgdnl
314794a251fdSmrgdnl The above copyright notice and this permission notice shall be included
314894a251fdSmrgdnl in all copies or substantial portions of the Software.
314994a251fdSmrgdnl
315094a251fdSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
315194a251fdSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
315294a251fdSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
315394a251fdSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
315494a251fdSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
315594a251fdSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
315694a251fdSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
315794a251fdSmrgdnl
315894a251fdSmrgdnl Except as contained in this notice, the name of the copyright holders shall
315994a251fdSmrgdnl not be used in advertising or otherwise to promote the sale, use or
316094a251fdSmrgdnl other dealings in this Software without prior written authorization
316194a251fdSmrgdnl from the copyright holders.
316294a251fdSmrgdnl
31638fff3f40Smrg
316494a251fdSmrg# XORG_RELEASE_VERSION
316594a251fdSmrg# --------------------
316694a251fdSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
31676a45684fSmrg
316894a251fdSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
316994a251fdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
317094a251fdSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
317194a251fdSmrg		[Major version of this package])
317294a251fdSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
317394a251fdSmrg	if test "x$PVM" = "x"; then
317494a251fdSmrg		PVM="0"
317594a251fdSmrg	fi
317694a251fdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
317794a251fdSmrg		[$PVM],
317894a251fdSmrg		[Minor version of this package])
317994a251fdSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
318094a251fdSmrg	if test "x$PVP" = "x"; then
318194a251fdSmrg		PVP="0"
318294a251fdSmrg	fi
318394a251fdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
318494a251fdSmrg		[$PVP],
318594a251fdSmrg		[Patch version of this package])
318694a251fdSmrg])
31878fff3f40Smrg
318894a251fdSmrg# XORG_CHANGELOG()
318994a251fdSmrg# ----------------
319094a251fdSmrg# Minimum version: 1.2.0
319194a251fdSmrg#
319294a251fdSmrg# Defines the variable CHANGELOG_CMD as the command to generate
319394a251fdSmrg# ChangeLog from git.
319494a251fdSmrg#
319594a251fdSmrg#
319694a251fdSmrgAC_DEFUN([XORG_CHANGELOG], [
319794a251fdSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
319894a251fdSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
319994a251fdSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
320094a251fdSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
320194a251fdSmrgAC_SUBST([CHANGELOG_CMD])
320294a251fdSmrg]) # XORG_CHANGELOG
3203e6232409Smrg
3204