aclocal.m4 revision c27291eb
1c27291ebSmrg# generated automatically by aclocal 1.11.2 -*- Autoconf -*-
2d1333322Smrg
3d1333322Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4c27291ebSmrg# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
5c27291ebSmrg# Inc.
6d1333322Smrg# This file is free software; the Free Software Foundation
7d1333322Smrg# gives unlimited permission to copy and/or distribute it,
8d1333322Smrg# with or without modifications, as long as this notice is preserved.
9d1333322Smrg
10d1333322Smrg# This program is distributed in the hope that it will be useful,
11d1333322Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
12d1333322Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13d1333322Smrg# PARTICULAR PURPOSE.
14d1333322Smrg
154f9ac78aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
164f9ac78aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
174f9ac78aSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
184f9ac78aSmrg[m4_warning([this file was generated for autoconf 2.68.
194f9ac78aSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
204f9ac78aSmrgIf you have problems, you may need to regenerate the build system entirely.
214f9ac78aSmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
22d1333322Smrg
23c27291ebSmrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
24c27291ebSmrg# Foundation, Inc.
25d1333322Smrg#
26d1333322Smrg# This file is free software; the Free Software Foundation
27d1333322Smrg# gives unlimited permission to copy and/or distribute it,
28d1333322Smrg# with or without modifications, as long as this notice is preserved.
29d1333322Smrg
30c27291ebSmrg# serial 1
31c27291ebSmrg
32d1333322Smrg# AM_AUTOMAKE_VERSION(VERSION)
33d1333322Smrg# ----------------------------
34d1333322Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
35d1333322Smrg# generated from the m4 files accompanying Automake X.Y.
36d1333322Smrg# (This private macro should not be called outside this file.)
37d1333322SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
384f9ac78aSmrg[am__api_version='1.11'
39d1333322Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
40d1333322Smrgdnl require some minimum version.  Point them to the right macro.
41c27291ebSmrgm4_if([$1], [1.11.2], [],
42d1333322Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
43d1333322Smrg])
44d1333322Smrg
45d1333322Smrg# _AM_AUTOCONF_VERSION(VERSION)
46d1333322Smrg# -----------------------------
47d1333322Smrg# aclocal traces this macro to find the Autoconf version.
48d1333322Smrg# This is a private macro too.  Using m4_define simplifies
49d1333322Smrg# the logic in aclocal, which can simply ignore this definition.
50d1333322Smrgm4_define([_AM_AUTOCONF_VERSION], [])
51d1333322Smrg
52d1333322Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
53d1333322Smrg# -------------------------------
54d1333322Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
554f9ac78aSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
56d1333322SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
57c27291ebSmrg[AM_AUTOMAKE_VERSION([1.11.2])dnl
584f9ac78aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
594f9ac78aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
604f9ac78aSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
61d1333322Smrg
62d1333322Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
63d1333322Smrg
64c27291ebSmrg# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
65d1333322Smrg#
66d1333322Smrg# This file is free software; the Free Software Foundation
67d1333322Smrg# gives unlimited permission to copy and/or distribute it,
68d1333322Smrg# with or without modifications, as long as this notice is preserved.
69d1333322Smrg
70c27291ebSmrg# serial 1
71c27291ebSmrg
72d1333322Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
73d1333322Smrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
74d1333322Smrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
75d1333322Smrg#
76d1333322Smrg# Of course, Automake must honor this variable whenever it calls a
77d1333322Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
78d1333322Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
79d1333322Smrg# depending on how configure is run.  This is pretty annoying, since
80d1333322Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
81d1333322Smrg# source directory, any form will work fine, but in subdirectories a
82d1333322Smrg# relative path needs to be adjusted first.
83d1333322Smrg#
84d1333322Smrg# $ac_aux_dir/missing
85d1333322Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
86d1333322Smrg# $top_srcdir/$ac_aux_dir/missing
87d1333322Smrg#    fails if $ac_aux_dir is absolute,
88d1333322Smrg#    fails when called from a subdirectory in a VPATH build with
89d1333322Smrg#          a relative $ac_aux_dir
90d1333322Smrg#
91d1333322Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
92d1333322Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
93d1333322Smrg# harmless because $srcdir is `.', but things will broke when you
94d1333322Smrg# start a VPATH build or use an absolute $srcdir.
95d1333322Smrg#
96d1333322Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
97d1333322Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
98d1333322Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
99d1333322Smrg# and then we would define $MISSING as
100d1333322Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
101d1333322Smrg# This will work as long as MISSING is not called from configure, because
102d1333322Smrg# unfortunately $(top_srcdir) has no meaning in configure.
103d1333322Smrg# However there are other variables, like CC, which are often used in
104d1333322Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
105d1333322Smrg#
106d1333322Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
107d1333322Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
108d1333322Smrg# configured tree to be moved without reconfiguration.
109d1333322Smrg
110d1333322SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
111d1333322Smrg[dnl Rely on autoconf to set up CDPATH properly.
112d1333322SmrgAC_PREREQ([2.50])dnl
113d1333322Smrg# expand $ac_aux_dir to an absolute path
114d1333322Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
115d1333322Smrg])
116d1333322Smrg
117d1333322Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
118d1333322Smrg
1194f9ac78aSmrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
120d1333322Smrg# Free Software Foundation, Inc.
121d1333322Smrg#
122d1333322Smrg# This file is free software; the Free Software Foundation
123d1333322Smrg# gives unlimited permission to copy and/or distribute it,
124d1333322Smrg# with or without modifications, as long as this notice is preserved.
125d1333322Smrg
1264f9ac78aSmrg# serial 9
127d1333322Smrg
128d1333322Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
129d1333322Smrg# -------------------------------------
130d1333322Smrg# Define a conditional.
131d1333322SmrgAC_DEFUN([AM_CONDITIONAL],
132d1333322Smrg[AC_PREREQ(2.52)dnl
133d1333322Smrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
134d1333322Smrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
135d1333322SmrgAC_SUBST([$1_TRUE])dnl
136d1333322SmrgAC_SUBST([$1_FALSE])dnl
137d1333322Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
138d1333322Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1394f9ac78aSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
140d1333322Smrgif $2; then
141d1333322Smrg  $1_TRUE=
142d1333322Smrg  $1_FALSE='#'
143d1333322Smrgelse
144d1333322Smrg  $1_TRUE='#'
145d1333322Smrg  $1_FALSE=
146d1333322Smrgfi
147d1333322SmrgAC_CONFIG_COMMANDS_PRE(
148d1333322Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
149d1333322Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
150d1333322SmrgUsually this means the macro was only invoked conditionally.]])
151d1333322Smrgfi])])
152d1333322Smrg
153c27291ebSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
154c27291ebSmrg# 2010, 2011 Free Software Foundation, Inc.
155d1333322Smrg#
156d1333322Smrg# This file is free software; the Free Software Foundation
157d1333322Smrg# gives unlimited permission to copy and/or distribute it,
158d1333322Smrg# with or without modifications, as long as this notice is preserved.
159d1333322Smrg
160c27291ebSmrg# serial 12
161d1333322Smrg
162d1333322Smrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
163d1333322Smrg# written in clear, in which case automake, when reading aclocal.m4,
164d1333322Smrg# will think it sees a *use*, and therefore will trigger all it's
165d1333322Smrg# C support machinery.  Also note that it means that autoscan, seeing
166d1333322Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
167d1333322Smrg
168d1333322Smrg
169d1333322Smrg# _AM_DEPENDENCIES(NAME)
170d1333322Smrg# ----------------------
171d1333322Smrg# See how the compiler implements dependency checking.
172d1333322Smrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
173d1333322Smrg# We try a few techniques and use that to set a single cache variable.
174d1333322Smrg#
175d1333322Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
176d1333322Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
177d1333322Smrg# dependency, and given that the user is not expected to run this macro,
178d1333322Smrg# just rely on AC_PROG_CC.
179d1333322SmrgAC_DEFUN([_AM_DEPENDENCIES],
180d1333322Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
181d1333322SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
182d1333322SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
183d1333322SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
184d1333322Smrg
185d1333322Smrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
186d1333322Smrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
187d1333322Smrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
188d1333322Smrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
189d1333322Smrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
190d1333322Smrg                   [depcc="$$1"   am_compiler_list=])
191d1333322Smrg
192d1333322SmrgAC_CACHE_CHECK([dependency style of $depcc],
193d1333322Smrg               [am_cv_$1_dependencies_compiler_type],
194d1333322Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
195d1333322Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
196d1333322Smrg  # making bogus files that we don't know about and never remove.  For
197d1333322Smrg  # instance it was reported that on HP-UX the gcc test will end up
198d1333322Smrg  # making a dummy file named `D' -- because `-MD' means `put the output
199d1333322Smrg  # in D'.
200c27291ebSmrg  rm -rf conftest.dir
201d1333322Smrg  mkdir conftest.dir
202d1333322Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
203d1333322Smrg  # using a relative directory.
204d1333322Smrg  cp "$am_depcomp" conftest.dir
205d1333322Smrg  cd conftest.dir
206d1333322Smrg  # We will build objects and dependencies in a subdirectory because
207d1333322Smrg  # it helps to detect inapplicable dependency modes.  For instance
208d1333322Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
209d1333322Smrg  # side effect of compilation, but ICC will put the dependencies in
210d1333322Smrg  # the current directory while Tru64 will put them in the object
211d1333322Smrg  # directory.
212d1333322Smrg  mkdir sub
213d1333322Smrg
214d1333322Smrg  am_cv_$1_dependencies_compiler_type=none
215d1333322Smrg  if test "$am_compiler_list" = ""; then
216d1333322Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
217d1333322Smrg  fi
2184f9ac78aSmrg  am__universal=false
2194f9ac78aSmrg  m4_case([$1], [CC],
2204f9ac78aSmrg    [case " $depcc " in #(
2214f9ac78aSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2224f9ac78aSmrg     esac],
2234f9ac78aSmrg    [CXX],
2244f9ac78aSmrg    [case " $depcc " in #(
2254f9ac78aSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2264f9ac78aSmrg     esac])
2274f9ac78aSmrg
228d1333322Smrg  for depmode in $am_compiler_list; do
229d1333322Smrg    # Setup a source with many dependencies, because some compilers
230d1333322Smrg    # like to wrap large dependency lists on column 80 (with \), and
231d1333322Smrg    # we should not choose a depcomp mode which is confused by this.
232d1333322Smrg    #
233d1333322Smrg    # We need to recreate these files for each test, as the compiler may
234d1333322Smrg    # overwrite some of them when testing with obscure command lines.
235d1333322Smrg    # This happens at least with the AIX C compiler.
236d1333322Smrg    : > sub/conftest.c
237d1333322Smrg    for i in 1 2 3 4 5 6; do
238d1333322Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
239d1333322Smrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
240d1333322Smrg      # Solaris 8's {/usr,}/bin/sh.
241d1333322Smrg      touch sub/conftst$i.h
242d1333322Smrg    done
243d1333322Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
244d1333322Smrg
2454f9ac78aSmrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
2464f9ac78aSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2474f9ac78aSmrg    # handle `-M -o', and we need to detect this.  Also, some Intel
2484f9ac78aSmrg    # versions had trouble with output in subdirs
2494f9ac78aSmrg    am__obj=sub/conftest.${OBJEXT-o}
2504f9ac78aSmrg    am__minus_obj="-o $am__obj"
251d1333322Smrg    case $depmode in
2524f9ac78aSmrg    gcc)
2534f9ac78aSmrg      # This depmode causes a compiler race in universal mode.
2544f9ac78aSmrg      test "$am__universal" = false || continue
2554f9ac78aSmrg      ;;
256d1333322Smrg    nosideeffect)
257d1333322Smrg      # after this tag, mechanisms are not by side-effect, so they'll
258d1333322Smrg      # only be used when explicitly requested
259d1333322Smrg      if test "x$enable_dependency_tracking" = xyes; then
260d1333322Smrg	continue
261d1333322Smrg      else
262d1333322Smrg	break
263d1333322Smrg      fi
264d1333322Smrg      ;;
265c27291ebSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2664f9ac78aSmrg      # This compiler won't grok `-c -o', but also, the minuso test has
2674f9ac78aSmrg      # not run yet.  These depmodes are late enough in the game, and
2684f9ac78aSmrg      # so weak that their functioning should not be impacted.
2694f9ac78aSmrg      am__obj=conftest.${OBJEXT-o}
2704f9ac78aSmrg      am__minus_obj=
2714f9ac78aSmrg      ;;
272d1333322Smrg    none) break ;;
273d1333322Smrg    esac
274d1333322Smrg    if depmode=$depmode \
2754f9ac78aSmrg       source=sub/conftest.c object=$am__obj \
276d1333322Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2774f9ac78aSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
278d1333322Smrg         >/dev/null 2>conftest.err &&
279d1333322Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
280d1333322Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2814f9ac78aSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
282d1333322Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
283d1333322Smrg      # icc doesn't choke on unknown options, it will just issue warnings
284d1333322Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
285d1333322Smrg      # that says an option was ignored or not supported.
286d1333322Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
287d1333322Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
288d1333322Smrg      # The diagnosis changed in icc 8.0:
289d1333322Smrg      #   icc: Command line remark: option '-MP' not supported
290d1333322Smrg      if (grep 'ignoring option' conftest.err ||
291d1333322Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
292d1333322Smrg        am_cv_$1_dependencies_compiler_type=$depmode
293d1333322Smrg        break
294d1333322Smrg      fi
295d1333322Smrg    fi
296d1333322Smrg  done
297d1333322Smrg
298d1333322Smrg  cd ..
299d1333322Smrg  rm -rf conftest.dir
300d1333322Smrgelse
301d1333322Smrg  am_cv_$1_dependencies_compiler_type=none
302d1333322Smrgfi
303d1333322Smrg])
304d1333322SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
305d1333322SmrgAM_CONDITIONAL([am__fastdep$1], [
306d1333322Smrg  test "x$enable_dependency_tracking" != xno \
307d1333322Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
308d1333322Smrg])
309d1333322Smrg
310d1333322Smrg
311d1333322Smrg# AM_SET_DEPDIR
312d1333322Smrg# -------------
313d1333322Smrg# Choose a directory name for dependency files.
314d1333322Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
315d1333322SmrgAC_DEFUN([AM_SET_DEPDIR],
316d1333322Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
317d1333322SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
318d1333322Smrg])
319d1333322Smrg
320d1333322Smrg
321d1333322Smrg# AM_DEP_TRACK
322d1333322Smrg# ------------
323d1333322SmrgAC_DEFUN([AM_DEP_TRACK],
324d1333322Smrg[AC_ARG_ENABLE(dependency-tracking,
325d1333322Smrg[  --disable-dependency-tracking  speeds up one-time build
326d1333322Smrg  --enable-dependency-tracking   do not reject slow dependency extractors])
327d1333322Smrgif test "x$enable_dependency_tracking" != xno; then
328d1333322Smrg  am_depcomp="$ac_aux_dir/depcomp"
329d1333322Smrg  AMDEPBACKSLASH='\'
330c27291ebSmrg  am__nodep='_no'
331d1333322Smrgfi
332d1333322SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
333d1333322SmrgAC_SUBST([AMDEPBACKSLASH])dnl
334d1333322Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
335c27291ebSmrgAC_SUBST([am__nodep])dnl
336c27291ebSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
337d1333322Smrg])
338d1333322Smrg
339d1333322Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
340d1333322Smrg
3414f9ac78aSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
342d1333322Smrg# Free Software Foundation, Inc.
343d1333322Smrg#
344d1333322Smrg# This file is free software; the Free Software Foundation
345d1333322Smrg# gives unlimited permission to copy and/or distribute it,
346d1333322Smrg# with or without modifications, as long as this notice is preserved.
347d1333322Smrg
3484f9ac78aSmrg#serial 5
349d1333322Smrg
350d1333322Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
351d1333322Smrg# ------------------------------
352d1333322SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3534f9ac78aSmrg[{
3544f9ac78aSmrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
3554f9ac78aSmrg  # are listed without --file.  Let's play safe and only enable the eval
3564f9ac78aSmrg  # if we detect the quoting.
3574f9ac78aSmrg  case $CONFIG_FILES in
3584f9ac78aSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
3594f9ac78aSmrg  *)   set x $CONFIG_FILES ;;
3604f9ac78aSmrg  esac
3614f9ac78aSmrg  shift
3624f9ac78aSmrg  for mf
3634f9ac78aSmrg  do
3644f9ac78aSmrg    # Strip MF so we end up with the name of the file.
3654f9ac78aSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
3664f9ac78aSmrg    # Check whether this is an Automake generated Makefile or not.
3674f9ac78aSmrg    # We used to match only the files named `Makefile.in', but
3684f9ac78aSmrg    # some people rename them; so instead we look at the file content.
3694f9ac78aSmrg    # Grep'ing the first line is not enough: some people post-process
3704f9ac78aSmrg    # each Makefile.in and add a new line on top of each file to say so.
3714f9ac78aSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
3724f9ac78aSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
3734f9ac78aSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
3744f9ac78aSmrg      dirpart=`AS_DIRNAME("$mf")`
3754f9ac78aSmrg    else
3764f9ac78aSmrg      continue
3774f9ac78aSmrg    fi
3784f9ac78aSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
3794f9ac78aSmrg    # from the Makefile without running `make'.
3804f9ac78aSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
3814f9ac78aSmrg    test -z "$DEPDIR" && continue
3824f9ac78aSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
3834f9ac78aSmrg    test -z "am__include" && continue
3844f9ac78aSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
3854f9ac78aSmrg    # When using ansi2knr, U may be empty or an underscore; expand it
3864f9ac78aSmrg    U=`sed -n 's/^U = //p' < "$mf"`
3874f9ac78aSmrg    # Find all dependency output files, they are included files with
3884f9ac78aSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
3894f9ac78aSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
3904f9ac78aSmrg    # expansion.
3914f9ac78aSmrg    for file in `sed -n "
3924f9ac78aSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
3934f9ac78aSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
3944f9ac78aSmrg      # Make sure the directory exists.
3954f9ac78aSmrg      test -f "$dirpart/$file" && continue
3964f9ac78aSmrg      fdir=`AS_DIRNAME(["$file"])`
3974f9ac78aSmrg      AS_MKDIR_P([$dirpart/$fdir])
3984f9ac78aSmrg      # echo "creating $dirpart/$file"
3994f9ac78aSmrg      echo '# dummy' > "$dirpart/$file"
4004f9ac78aSmrg    done
401d1333322Smrg  done
4024f9ac78aSmrg}
403d1333322Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
404d1333322Smrg
405d1333322Smrg
406d1333322Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
407d1333322Smrg# -----------------------------
408d1333322Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
409d1333322Smrg#
410d1333322Smrg# This code is only required when automatic dependency tracking
411d1333322Smrg# is enabled.  FIXME.  This creates each `.P' file that we will
412d1333322Smrg# need in order to bootstrap the dependency handling code.
413d1333322SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
414d1333322Smrg[AC_CONFIG_COMMANDS([depfiles],
415d1333322Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
416d1333322Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
417d1333322Smrg])
418d1333322Smrg
419d1333322Smrg# Do all the work for Automake.                             -*- Autoconf -*-
420d1333322Smrg
421d1333322Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4224f9ac78aSmrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
423d1333322Smrg#
424d1333322Smrg# This file is free software; the Free Software Foundation
425d1333322Smrg# gives unlimited permission to copy and/or distribute it,
426d1333322Smrg# with or without modifications, as long as this notice is preserved.
427d1333322Smrg
4284f9ac78aSmrg# serial 16
429d1333322Smrg
430d1333322Smrg# This macro actually does too much.  Some checks are only needed if
431d1333322Smrg# your package does certain things.  But this isn't really a big deal.
432d1333322Smrg
433d1333322Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
434d1333322Smrg# AM_INIT_AUTOMAKE([OPTIONS])
435d1333322Smrg# -----------------------------------------------
436d1333322Smrg# The call with PACKAGE and VERSION arguments is the old style
437d1333322Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
438d1333322Smrg# and VERSION should now be passed to AC_INIT and removed from
439d1333322Smrg# the call to AM_INIT_AUTOMAKE.
440d1333322Smrg# We support both call styles for the transition.  After
441d1333322Smrg# the next Automake release, Autoconf can make the AC_INIT
442d1333322Smrg# arguments mandatory, and then we can depend on a new Autoconf
443d1333322Smrg# release and drop the old call support.
444d1333322SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4454f9ac78aSmrg[AC_PREREQ([2.62])dnl
446d1333322Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
447d1333322Smrgdnl the ones we care about.
448d1333322Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
449d1333322SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
450d1333322SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
451d1333322Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
452d1333322Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
453d1333322Smrg  # is not polluted with repeated "-I."
454d1333322Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
455d1333322Smrg  # test to see if srcdir already configured
456d1333322Smrg  if test -f $srcdir/config.status; then
457d1333322Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
458d1333322Smrg  fi
459d1333322Smrgfi
460d1333322Smrg
461d1333322Smrg# test whether we have cygpath
462d1333322Smrgif test -z "$CYGPATH_W"; then
463d1333322Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
464d1333322Smrg    CYGPATH_W='cygpath -w'
465d1333322Smrg  else
466d1333322Smrg    CYGPATH_W=echo
467d1333322Smrg  fi
468d1333322Smrgfi
469d1333322SmrgAC_SUBST([CYGPATH_W])
470d1333322Smrg
471d1333322Smrg# Define the identity of the package.
472d1333322Smrgdnl Distinguish between old-style and new-style calls.
473d1333322Smrgm4_ifval([$2],
474d1333322Smrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
475d1333322Smrg AC_SUBST([PACKAGE], [$1])dnl
476d1333322Smrg AC_SUBST([VERSION], [$2])],
477d1333322Smrg[_AM_SET_OPTIONS([$1])dnl
478d1333322Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
479d1333322Smrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
480d1333322Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
481d1333322Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
482d1333322Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
483d1333322Smrg
484d1333322Smrg_AM_IF_OPTION([no-define],,
485d1333322Smrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
486d1333322Smrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
487d1333322Smrg
488d1333322Smrg# Some tools Automake needs.
489d1333322SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
490d1333322SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
491d1333322SmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
492d1333322SmrgAM_MISSING_PROG(AUTOCONF, autoconf)
493d1333322SmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
494d1333322SmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
495d1333322SmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
4964f9ac78aSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4974f9ac78aSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
498d1333322SmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
499d1333322Smrg# We need awk for the "check" target.  The system "awk" is bad on
500d1333322Smrg# some platforms.
501d1333322SmrgAC_REQUIRE([AC_PROG_AWK])dnl
502d1333322SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
503d1333322SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
504d1333322Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5054f9ac78aSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5064f9ac78aSmrg			     [_AM_PROG_TAR([v7])])])
507d1333322Smrg_AM_IF_OPTION([no-dependencies],,
508d1333322Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5094f9ac78aSmrg		  [_AM_DEPENDENCIES(CC)],
5104f9ac78aSmrg		  [define([AC_PROG_CC],
5114f9ac78aSmrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
512d1333322SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5134f9ac78aSmrg		  [_AM_DEPENDENCIES(CXX)],
5144f9ac78aSmrg		  [define([AC_PROG_CXX],
5154f9ac78aSmrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
516d1333322SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5174f9ac78aSmrg		  [_AM_DEPENDENCIES(OBJC)],
5184f9ac78aSmrg		  [define([AC_PROG_OBJC],
5194f9ac78aSmrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
520d1333322Smrg])
5214f9ac78aSmrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
5224f9ac78aSmrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
5234f9ac78aSmrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
5244f9ac78aSmrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
5254f9ac78aSmrgAC_CONFIG_COMMANDS_PRE(dnl
5264f9ac78aSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5274f9ac78aSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
528d1333322Smrg])
529d1333322Smrg
5304f9ac78aSmrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5314f9ac78aSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5324f9ac78aSmrgdnl mangled by Autoconf and run in a shell conditional statement.
5334f9ac78aSmrgm4_define([_AC_COMPILER_EXEEXT],
5344f9ac78aSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5354f9ac78aSmrg
536d1333322Smrg
537d1333322Smrg# When config.status generates a header, we must update the stamp-h file.
538d1333322Smrg# This file resides in the same directory as the config header
539d1333322Smrg# that is generated.  The stamp files are numbered to have different names.
540d1333322Smrg
541d1333322Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
542d1333322Smrg# loop where config.status creates the headers, so we can generate
543d1333322Smrg# our stamp files there.
544d1333322SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
545d1333322Smrg[# Compute $1's index in $config_headers.
5464f9ac78aSmrg_am_arg=$1
547d1333322Smrg_am_stamp_count=1
548d1333322Smrgfor _am_header in $config_headers :; do
549d1333322Smrg  case $_am_header in
5504f9ac78aSmrg    $_am_arg | $_am_arg:* )
551d1333322Smrg      break ;;
552d1333322Smrg    * )
553d1333322Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
554d1333322Smrg  esac
555d1333322Smrgdone
5564f9ac78aSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
557d1333322Smrg
558c27291ebSmrg# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
559c27291ebSmrg# Inc.
560d1333322Smrg#
561d1333322Smrg# This file is free software; the Free Software Foundation
562d1333322Smrg# gives unlimited permission to copy and/or distribute it,
563d1333322Smrg# with or without modifications, as long as this notice is preserved.
564d1333322Smrg
565c27291ebSmrg# serial 1
566c27291ebSmrg
567d1333322Smrg# AM_PROG_INSTALL_SH
568d1333322Smrg# ------------------
569d1333322Smrg# Define $install_sh.
570d1333322SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
571d1333322Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
5724f9ac78aSmrgif test x"${install_sh}" != xset; then
5734f9ac78aSmrg  case $am_aux_dir in
5744f9ac78aSmrg  *\ * | *\	*)
5754f9ac78aSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
5764f9ac78aSmrg  *)
5774f9ac78aSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
5784f9ac78aSmrg  esac
5794f9ac78aSmrgfi
580d1333322SmrgAC_SUBST(install_sh)])
581d1333322Smrg
582d1333322Smrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
583d1333322Smrg#
584d1333322Smrg# This file is free software; the Free Software Foundation
585d1333322Smrg# gives unlimited permission to copy and/or distribute it,
586d1333322Smrg# with or without modifications, as long as this notice is preserved.
587d1333322Smrg
588d1333322Smrg# serial 2
589d1333322Smrg
590d1333322Smrg# Check whether the underlying file-system supports filenames
591d1333322Smrg# with a leading dot.  For instance MS-DOS doesn't.
592d1333322SmrgAC_DEFUN([AM_SET_LEADING_DOT],
593d1333322Smrg[rm -rf .tst 2>/dev/null
594d1333322Smrgmkdir .tst 2>/dev/null
595d1333322Smrgif test -d .tst; then
596d1333322Smrg  am__leading_dot=.
597d1333322Smrgelse
598d1333322Smrg  am__leading_dot=_
599d1333322Smrgfi
600d1333322Smrgrmdir .tst 2>/dev/null
601d1333322SmrgAC_SUBST([am__leading_dot])])
602d1333322Smrg
603d1333322Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
604d1333322Smrg# From Jim Meyering
605d1333322Smrg
606c27291ebSmrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
607c27291ebSmrg# 2011 Free Software Foundation, Inc.
608d1333322Smrg#
609d1333322Smrg# This file is free software; the Free Software Foundation
610d1333322Smrg# gives unlimited permission to copy and/or distribute it,
611d1333322Smrg# with or without modifications, as long as this notice is preserved.
612d1333322Smrg
6134f9ac78aSmrg# serial 5
614d1333322Smrg
6154f9ac78aSmrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
6164f9ac78aSmrg# ----------------------------------
6174f9ac78aSmrg# Control maintainer-specific portions of Makefiles.
6184f9ac78aSmrg# Default is to disable them, unless `enable' is passed literally.
6194f9ac78aSmrg# For symmetry, `disable' may be passed as well.  Anyway, the user
6204f9ac78aSmrg# can override the default with the --enable/--disable switch.
621d1333322SmrgAC_DEFUN([AM_MAINTAINER_MODE],
6224f9ac78aSmrg[m4_case(m4_default([$1], [disable]),
6234f9ac78aSmrg       [enable], [m4_define([am_maintainer_other], [disable])],
6244f9ac78aSmrg       [disable], [m4_define([am_maintainer_other], [enable])],
6254f9ac78aSmrg       [m4_define([am_maintainer_other], [enable])
6264f9ac78aSmrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
627c27291ebSmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
6284f9ac78aSmrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
6294f9ac78aSmrg  AC_ARG_ENABLE([maintainer-mode],
6304f9ac78aSmrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
631d1333322Smrg			  (and sometimes confusing) to the casual installer],
6324f9ac78aSmrg      [USE_MAINTAINER_MODE=$enableval],
6334f9ac78aSmrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
634d1333322Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
6354f9ac78aSmrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
636d1333322Smrg  MAINT=$MAINTAINER_MODE_TRUE
6374f9ac78aSmrg  AC_SUBST([MAINT])dnl
638d1333322Smrg]
639d1333322Smrg)
640d1333322Smrg
641d1333322SmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
642d1333322Smrg
643d1333322Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
644d1333322Smrg
6454f9ac78aSmrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
646d1333322Smrg#
647d1333322Smrg# This file is free software; the Free Software Foundation
648d1333322Smrg# gives unlimited permission to copy and/or distribute it,
649d1333322Smrg# with or without modifications, as long as this notice is preserved.
650d1333322Smrg
6514f9ac78aSmrg# serial 4
652d1333322Smrg
653d1333322Smrg# AM_MAKE_INCLUDE()
654d1333322Smrg# -----------------
655d1333322Smrg# Check to see how make treats includes.
656d1333322SmrgAC_DEFUN([AM_MAKE_INCLUDE],
657d1333322Smrg[am_make=${MAKE-make}
658d1333322Smrgcat > confinc << 'END'
659d1333322Smrgam__doit:
6604f9ac78aSmrg	@echo this is the am__doit target
661d1333322Smrg.PHONY: am__doit
662d1333322SmrgEND
663d1333322Smrg# If we don't find an include directive, just comment out the code.
664d1333322SmrgAC_MSG_CHECKING([for style of include used by $am_make])
665d1333322Smrgam__include="#"
666d1333322Smrgam__quote=
667d1333322Smrg_am_result=none
668d1333322Smrg# First try GNU make style include.
669d1333322Smrgecho "include confinc" > confmf
6704f9ac78aSmrg# Ignore all kinds of additional output from `make'.
6714f9ac78aSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
6724f9ac78aSmrg*the\ am__doit\ target*)
6734f9ac78aSmrg  am__include=include
6744f9ac78aSmrg  am__quote=
6754f9ac78aSmrg  _am_result=GNU
6764f9ac78aSmrg  ;;
6774f9ac78aSmrgesac
678d1333322Smrg# Now try BSD make style include.
679d1333322Smrgif test "$am__include" = "#"; then
680d1333322Smrg   echo '.include "confinc"' > confmf
6814f9ac78aSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
6824f9ac78aSmrg   *the\ am__doit\ target*)
6834f9ac78aSmrg     am__include=.include
6844f9ac78aSmrg     am__quote="\""
6854f9ac78aSmrg     _am_result=BSD
6864f9ac78aSmrg     ;;
6874f9ac78aSmrg   esac
688d1333322Smrgfi
689d1333322SmrgAC_SUBST([am__include])
690d1333322SmrgAC_SUBST([am__quote])
691d1333322SmrgAC_MSG_RESULT([$_am_result])
692d1333322Smrgrm -f confinc confmf
693d1333322Smrg])
694d1333322Smrg
695d1333322Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
696d1333322Smrg
6974f9ac78aSmrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
698d1333322Smrg# Free Software Foundation, Inc.
699d1333322Smrg#
700d1333322Smrg# This file is free software; the Free Software Foundation
701d1333322Smrg# gives unlimited permission to copy and/or distribute it,
702d1333322Smrg# with or without modifications, as long as this notice is preserved.
703d1333322Smrg
7044f9ac78aSmrg# serial 6
705d1333322Smrg
706d1333322Smrg# AM_MISSING_PROG(NAME, PROGRAM)
707d1333322Smrg# ------------------------------
708d1333322SmrgAC_DEFUN([AM_MISSING_PROG],
709d1333322Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
710d1333322Smrg$1=${$1-"${am_missing_run}$2"}
711d1333322SmrgAC_SUBST($1)])
712d1333322Smrg
713d1333322Smrg
714d1333322Smrg# AM_MISSING_HAS_RUN
715d1333322Smrg# ------------------
716d1333322Smrg# Define MISSING if not defined so far and test if it supports --run.
717d1333322Smrg# If it does, set am_missing_run to use it, otherwise, to nothing.
718d1333322SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
719d1333322Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
720d1333322SmrgAC_REQUIRE_AUX_FILE([missing])dnl
7214f9ac78aSmrgif test x"${MISSING+set}" != xset; then
7224f9ac78aSmrg  case $am_aux_dir in
7234f9ac78aSmrg  *\ * | *\	*)
7244f9ac78aSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
7254f9ac78aSmrg  *)
7264f9ac78aSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
7274f9ac78aSmrg  esac
7284f9ac78aSmrgfi
729d1333322Smrg# Use eval to expand $SHELL
730d1333322Smrgif eval "$MISSING --run true"; then
731d1333322Smrg  am_missing_run="$MISSING --run "
732d1333322Smrgelse
733d1333322Smrg  am_missing_run=
734d1333322Smrg  AC_MSG_WARN([`missing' script is too old or missing])
735d1333322Smrgfi
736d1333322Smrg])
737d1333322Smrg
738c27291ebSmrg# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
739c27291ebSmrg# Inc.
740d1333322Smrg#
741d1333322Smrg# This file is free software; the Free Software Foundation
742d1333322Smrg# gives unlimited permission to copy and/or distribute it,
743d1333322Smrg# with or without modifications, as long as this notice is preserved.
744d1333322Smrg
745c27291ebSmrg# serial 1
746c27291ebSmrg
747d1333322Smrg# AM_PROG_MKDIR_P
748d1333322Smrg# ---------------
749d1333322Smrg# Check for `mkdir -p'.
750d1333322SmrgAC_DEFUN([AM_PROG_MKDIR_P],
751d1333322Smrg[AC_PREREQ([2.60])dnl
752d1333322SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
753d1333322Smrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
754d1333322Smrgdnl while keeping a definition of mkdir_p for backward compatibility.
755d1333322Smrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
756d1333322Smrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
757d1333322Smrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
758d1333322Smrgdnl adjustment using top_builddir (which is defined more often than
759d1333322Smrgdnl MKDIR_P).
760d1333322SmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
761d1333322Smrgcase $mkdir_p in
762d1333322Smrg  [[\\/$]]* | ?:[[\\/]]*) ;;
763d1333322Smrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
764d1333322Smrgesac
765d1333322Smrg])
766d1333322Smrg
767d1333322Smrg# Helper functions for option handling.                     -*- Autoconf -*-
768d1333322Smrg
769c27291ebSmrg# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
770c27291ebSmrg# Foundation, Inc.
771d1333322Smrg#
772d1333322Smrg# This file is free software; the Free Software Foundation
773d1333322Smrg# gives unlimited permission to copy and/or distribute it,
774d1333322Smrg# with or without modifications, as long as this notice is preserved.
775d1333322Smrg
776c27291ebSmrg# serial 5
777d1333322Smrg
778d1333322Smrg# _AM_MANGLE_OPTION(NAME)
779d1333322Smrg# -----------------------
780d1333322SmrgAC_DEFUN([_AM_MANGLE_OPTION],
781d1333322Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
782d1333322Smrg
783d1333322Smrg# _AM_SET_OPTION(NAME)
784c27291ebSmrg# --------------------
785d1333322Smrg# Set option NAME.  Presently that only means defining a flag for this option.
786d1333322SmrgAC_DEFUN([_AM_SET_OPTION],
787d1333322Smrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
788d1333322Smrg
789d1333322Smrg# _AM_SET_OPTIONS(OPTIONS)
790c27291ebSmrg# ------------------------
791d1333322Smrg# OPTIONS is a space-separated list of Automake options.
792d1333322SmrgAC_DEFUN([_AM_SET_OPTIONS],
7934f9ac78aSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
794d1333322Smrg
795d1333322Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
796d1333322Smrg# -------------------------------------------
797d1333322Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
798d1333322SmrgAC_DEFUN([_AM_IF_OPTION],
799d1333322Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
800d1333322Smrg
801d1333322Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
802d1333322Smrg
8034f9ac78aSmrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
804d1333322Smrg# Free Software Foundation, Inc.
805d1333322Smrg#
806d1333322Smrg# This file is free software; the Free Software Foundation
807d1333322Smrg# gives unlimited permission to copy and/or distribute it,
808d1333322Smrg# with or without modifications, as long as this notice is preserved.
809d1333322Smrg
8104f9ac78aSmrg# serial 5
811d1333322Smrg
812d1333322Smrg# AM_SANITY_CHECK
813d1333322Smrg# ---------------
814d1333322SmrgAC_DEFUN([AM_SANITY_CHECK],
815d1333322Smrg[AC_MSG_CHECKING([whether build environment is sane])
816d1333322Smrg# Just in case
817d1333322Smrgsleep 1
818d1333322Smrgecho timestamp > conftest.file
8194f9ac78aSmrg# Reject unsafe characters in $srcdir or the absolute working directory
8204f9ac78aSmrg# name.  Accept space and tab only in the latter.
8214f9ac78aSmrgam_lf='
8224f9ac78aSmrg'
8234f9ac78aSmrgcase `pwd` in
8244f9ac78aSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8254f9ac78aSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8264f9ac78aSmrgesac
8274f9ac78aSmrgcase $srcdir in
8284f9ac78aSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8294f9ac78aSmrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
8304f9ac78aSmrgesac
8314f9ac78aSmrg
832d1333322Smrg# Do `set' in a subshell so we don't clobber the current shell's
833d1333322Smrg# arguments.  Must try -L first in case configure is actually a
834d1333322Smrg# symlink; some systems play weird games with the mod time of symlinks
835d1333322Smrg# (eg FreeBSD returns the mod time of the symlink's containing
836d1333322Smrg# directory).
837d1333322Smrgif (
8384f9ac78aSmrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
839d1333322Smrg   if test "$[*]" = "X"; then
840d1333322Smrg      # -L didn't work.
8414f9ac78aSmrg      set X `ls -t "$srcdir/configure" conftest.file`
842d1333322Smrg   fi
843d1333322Smrg   rm -f conftest.file
844d1333322Smrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
845d1333322Smrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
846d1333322Smrg
847d1333322Smrg      # If neither matched, then we have a broken ls.  This can happen
848d1333322Smrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
849d1333322Smrg      # broken ls alias from the environment.  This has actually
850d1333322Smrg      # happened.  Such a system could not be considered "sane".
851d1333322Smrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
852d1333322Smrgalias in your environment])
853d1333322Smrg   fi
854d1333322Smrg
855d1333322Smrg   test "$[2]" = conftest.file
856d1333322Smrg   )
857d1333322Smrgthen
858d1333322Smrg   # Ok.
859d1333322Smrg   :
860d1333322Smrgelse
861d1333322Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
862d1333322SmrgCheck your system clock])
863d1333322Smrgfi
864d1333322SmrgAC_MSG_RESULT(yes)])
865d1333322Smrg
8664f9ac78aSmrg# Copyright (C) 2009  Free Software Foundation, Inc.
8674f9ac78aSmrg#
8684f9ac78aSmrg# This file is free software; the Free Software Foundation
8694f9ac78aSmrg# gives unlimited permission to copy and/or distribute it,
8704f9ac78aSmrg# with or without modifications, as long as this notice is preserved.
8714f9ac78aSmrg
8724f9ac78aSmrg# serial 1
8734f9ac78aSmrg
8744f9ac78aSmrg# AM_SILENT_RULES([DEFAULT])
8754f9ac78aSmrg# --------------------------
8764f9ac78aSmrg# Enable less verbose build rules; with the default set to DEFAULT
8774f9ac78aSmrg# (`yes' being less verbose, `no' or empty being verbose).
8784f9ac78aSmrgAC_DEFUN([AM_SILENT_RULES],
8794f9ac78aSmrg[AC_ARG_ENABLE([silent-rules],
8804f9ac78aSmrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
8814f9ac78aSmrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
8824f9ac78aSmrgcase $enable_silent_rules in
8834f9ac78aSmrgyes) AM_DEFAULT_VERBOSITY=0;;
8844f9ac78aSmrgno)  AM_DEFAULT_VERBOSITY=1;;
8854f9ac78aSmrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
8864f9ac78aSmrgesac
8874f9ac78aSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
8884f9ac78aSmrgAM_BACKSLASH='\'
8894f9ac78aSmrgAC_SUBST([AM_BACKSLASH])dnl
8904f9ac78aSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
8914f9ac78aSmrg])
8924f9ac78aSmrg
893c27291ebSmrg# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
894d1333322Smrg#
895d1333322Smrg# This file is free software; the Free Software Foundation
896d1333322Smrg# gives unlimited permission to copy and/or distribute it,
897d1333322Smrg# with or without modifications, as long as this notice is preserved.
898d1333322Smrg
899c27291ebSmrg# serial 1
900c27291ebSmrg
901d1333322Smrg# AM_PROG_INSTALL_STRIP
902d1333322Smrg# ---------------------
903d1333322Smrg# One issue with vendor `install' (even GNU) is that you can't
904d1333322Smrg# specify the program used to strip binaries.  This is especially
905d1333322Smrg# annoying in cross-compiling environments, where the build's strip
906d1333322Smrg# is unlikely to handle the host's binaries.
907d1333322Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
908d1333322Smrg# always use install-sh in `make install-strip', and initialize
909d1333322Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
910d1333322SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
911d1333322Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
912d1333322Smrg# Installed binaries are usually stripped using `strip' when the user
913d1333322Smrg# run `make install-strip'.  However `strip' might not be the right
914d1333322Smrg# tool to use in cross-compilation environments, therefore Automake
915d1333322Smrg# will honor the `STRIP' environment variable to overrule this program.
916d1333322Smrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
917d1333322Smrgif test "$cross_compiling" != no; then
918d1333322Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
919d1333322Smrgfi
920d1333322SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
921d1333322SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
922d1333322Smrg
923c27291ebSmrg# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
924d1333322Smrg#
925d1333322Smrg# This file is free software; the Free Software Foundation
926d1333322Smrg# gives unlimited permission to copy and/or distribute it,
927d1333322Smrg# with or without modifications, as long as this notice is preserved.
928d1333322Smrg
929c27291ebSmrg# serial 3
9304f9ac78aSmrg
931d1333322Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
932d1333322Smrg# ---------------------------
9334f9ac78aSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
934d1333322Smrg# This macro is traced by Automake.
935d1333322SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
936d1333322Smrg
9374f9ac78aSmrg# AM_SUBST_NOTMAKE(VARIABLE)
938c27291ebSmrg# --------------------------
9394f9ac78aSmrg# Public sister of _AM_SUBST_NOTMAKE.
9404f9ac78aSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
9414f9ac78aSmrg
942d1333322Smrg# Check how to create a tarball.                            -*- Autoconf -*-
943d1333322Smrg
944d1333322Smrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
945d1333322Smrg#
946d1333322Smrg# This file is free software; the Free Software Foundation
947d1333322Smrg# gives unlimited permission to copy and/or distribute it,
948d1333322Smrg# with or without modifications, as long as this notice is preserved.
949d1333322Smrg
950d1333322Smrg# serial 2
951d1333322Smrg
952d1333322Smrg# _AM_PROG_TAR(FORMAT)
953d1333322Smrg# --------------------
954d1333322Smrg# Check how to create a tarball in format FORMAT.
955d1333322Smrg# FORMAT should be one of `v7', `ustar', or `pax'.
956d1333322Smrg#
957d1333322Smrg# Substitute a variable $(am__tar) that is a command
958d1333322Smrg# writing to stdout a FORMAT-tarball containing the directory
959d1333322Smrg# $tardir.
960d1333322Smrg#     tardir=directory && $(am__tar) > result.tar
961d1333322Smrg#
962d1333322Smrg# Substitute a variable $(am__untar) that extract such
963d1333322Smrg# a tarball read from stdin.
964d1333322Smrg#     $(am__untar) < result.tar
965d1333322SmrgAC_DEFUN([_AM_PROG_TAR],
966d1333322Smrg[# Always define AMTAR for backward compatibility.
967d1333322SmrgAM_MISSING_PROG([AMTAR], [tar])
968d1333322Smrgm4_if([$1], [v7],
969d1333322Smrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
970d1333322Smrg     [m4_case([$1], [ustar],, [pax],,
971d1333322Smrg              [m4_fatal([Unknown tar format])])
972d1333322SmrgAC_MSG_CHECKING([how to create a $1 tar archive])
973d1333322Smrg# Loop over all known methods to create a tar archive until one works.
974d1333322Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
975d1333322Smrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
976d1333322Smrg# Do not fold the above two line into one, because Tru64 sh and
977d1333322Smrg# Solaris sh will not grok spaces in the rhs of `-'.
978d1333322Smrgfor _am_tool in $_am_tools
979d1333322Smrgdo
980d1333322Smrg  case $_am_tool in
981d1333322Smrg  gnutar)
982d1333322Smrg    for _am_tar in tar gnutar gtar;
983d1333322Smrg    do
984d1333322Smrg      AM_RUN_LOG([$_am_tar --version]) && break
985d1333322Smrg    done
986d1333322Smrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
987d1333322Smrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
988d1333322Smrg    am__untar="$_am_tar -xf -"
989d1333322Smrg    ;;
990d1333322Smrg  plaintar)
991d1333322Smrg    # Must skip GNU tar: if it does not support --format= it doesn't create
992d1333322Smrg    # ustar tarball either.
993d1333322Smrg    (tar --version) >/dev/null 2>&1 && continue
994d1333322Smrg    am__tar='tar chf - "$$tardir"'
995d1333322Smrg    am__tar_='tar chf - "$tardir"'
996d1333322Smrg    am__untar='tar xf -'
997d1333322Smrg    ;;
998d1333322Smrg  pax)
999d1333322Smrg    am__tar='pax -L -x $1 -w "$$tardir"'
1000d1333322Smrg    am__tar_='pax -L -x $1 -w "$tardir"'
1001d1333322Smrg    am__untar='pax -r'
1002d1333322Smrg    ;;
1003d1333322Smrg  cpio)
1004d1333322Smrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1005d1333322Smrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1006d1333322Smrg    am__untar='cpio -i -H $1 -d'
1007d1333322Smrg    ;;
1008d1333322Smrg  none)
1009d1333322Smrg    am__tar=false
1010d1333322Smrg    am__tar_=false
1011d1333322Smrg    am__untar=false
1012d1333322Smrg    ;;
1013d1333322Smrg  esac
1014d1333322Smrg
1015d1333322Smrg  # If the value was cached, stop now.  We just wanted to have am__tar
1016d1333322Smrg  # and am__untar set.
1017d1333322Smrg  test -n "${am_cv_prog_tar_$1}" && break
1018d1333322Smrg
1019d1333322Smrg  # tar/untar a dummy directory, and stop if the command works
1020d1333322Smrg  rm -rf conftest.dir
1021d1333322Smrg  mkdir conftest.dir
1022d1333322Smrg  echo GrepMe > conftest.dir/file
1023d1333322Smrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1024d1333322Smrg  rm -rf conftest.dir
1025d1333322Smrg  if test -s conftest.tar; then
1026d1333322Smrg    AM_RUN_LOG([$am__untar <conftest.tar])
1027d1333322Smrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1028d1333322Smrg  fi
1029d1333322Smrgdone
1030d1333322Smrgrm -rf conftest.dir
1031d1333322Smrg
1032d1333322SmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1033d1333322SmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
1034d1333322SmrgAC_SUBST([am__tar])
1035d1333322SmrgAC_SUBST([am__untar])
1036d1333322Smrg]) # _AM_PROG_TAR
1037d1333322Smrg
1038c27291ebSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1039c27291ebSmrg# 
1040c27291ebSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1041c27291ebSmrg#
1042c27291ebSmrg# This program is free software; you can redistribute it and/or modify
1043c27291ebSmrg# it under the terms of the GNU General Public License as published by
1044c27291ebSmrg# the Free Software Foundation; either version 2 of the License, or
1045c27291ebSmrg# (at your option) any later version.
1046c27291ebSmrg#
1047c27291ebSmrg# This program is distributed in the hope that it will be useful, but
1048c27291ebSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1049c27291ebSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1050c27291ebSmrg# General Public License for more details.
1051c27291ebSmrg#
1052c27291ebSmrg# You should have received a copy of the GNU General Public License
1053c27291ebSmrg# along with this program; if not, write to the Free Software
1054c27291ebSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1055c27291ebSmrg#
1056c27291ebSmrg# As a special exception to the GNU General Public License, if you
1057c27291ebSmrg# distribute this file as part of a program that contains a
1058c27291ebSmrg# configuration script generated by Autoconf, you may include it under
1059c27291ebSmrg# the same distribution terms that you use for the rest of that program.
1060c27291ebSmrg
1061c27291ebSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1062c27291ebSmrg# ----------------------------------
1063c27291ebSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1064c27291ebSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1065c27291ebSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1066c27291ebSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1067c27291ebSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1068c27291ebSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1069c27291ebSmrgfi
1070c27291ebSmrgif test -n "$PKG_CONFIG"; then
1071c27291ebSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
1072c27291ebSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1073c27291ebSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1074c27291ebSmrg		AC_MSG_RESULT([yes])
1075c27291ebSmrg	else
1076c27291ebSmrg		AC_MSG_RESULT([no])
1077c27291ebSmrg		PKG_CONFIG=""
1078c27291ebSmrg	fi
1079c27291ebSmrg		
1080c27291ebSmrgfi[]dnl
1081c27291ebSmrg])# PKG_PROG_PKG_CONFIG
1082c27291ebSmrg
1083c27291ebSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1084c27291ebSmrg#
1085c27291ebSmrg# Check to see whether a particular set of modules exists.  Similar
1086c27291ebSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1087c27291ebSmrg#
1088c27291ebSmrg#
1089c27291ebSmrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1090c27291ebSmrg# this or PKG_CHECK_MODULES is called, or make sure to call
1091c27291ebSmrg# PKG_CHECK_EXISTS manually
1092c27291ebSmrg# --------------------------------------------------------------
1093c27291ebSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1094c27291ebSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1095c27291ebSmrgif test -n "$PKG_CONFIG" && \
1096c27291ebSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1097c27291ebSmrg  m4_ifval([$2], [$2], [:])
1098c27291ebSmrgm4_ifvaln([$3], [else
1099c27291ebSmrg  $3])dnl
1100c27291ebSmrgfi])
1101c27291ebSmrg
1102c27291ebSmrg
1103c27291ebSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1104c27291ebSmrg# ---------------------------------------------
1105c27291ebSmrgm4_define([_PKG_CONFIG],
1106c27291ebSmrg[if test -n "$$1"; then
1107c27291ebSmrg    pkg_cv_[]$1="$$1"
1108c27291ebSmrg elif test -n "$PKG_CONFIG"; then
1109c27291ebSmrg    PKG_CHECK_EXISTS([$3],
1110c27291ebSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1111c27291ebSmrg		     [pkg_failed=yes])
1112c27291ebSmrg else
1113c27291ebSmrg    pkg_failed=untried
1114c27291ebSmrgfi[]dnl
1115c27291ebSmrg])# _PKG_CONFIG
1116c27291ebSmrg
1117c27291ebSmrg# _PKG_SHORT_ERRORS_SUPPORTED
1118c27291ebSmrg# -----------------------------
1119c27291ebSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1120c27291ebSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1121c27291ebSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1122c27291ebSmrg        _pkg_short_errors_supported=yes
1123c27291ebSmrgelse
1124c27291ebSmrg        _pkg_short_errors_supported=no
1125c27291ebSmrgfi[]dnl
1126c27291ebSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
1127c27291ebSmrg
1128c27291ebSmrg
1129c27291ebSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1130c27291ebSmrg# [ACTION-IF-NOT-FOUND])
1131c27291ebSmrg#
1132c27291ebSmrg#
1133c27291ebSmrg# Note that if there is a possibility the first call to
1134c27291ebSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1135c27291ebSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1136c27291ebSmrg#
1137c27291ebSmrg#
1138c27291ebSmrg# --------------------------------------------------------------
1139c27291ebSmrgAC_DEFUN([PKG_CHECK_MODULES],
1140c27291ebSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1141c27291ebSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1142c27291ebSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1143c27291ebSmrg
1144c27291ebSmrgpkg_failed=no
1145c27291ebSmrgAC_MSG_CHECKING([for $1])
1146c27291ebSmrg
1147c27291ebSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1148c27291ebSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1149c27291ebSmrg
1150c27291ebSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1151c27291ebSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1152c27291ebSmrgSee the pkg-config man page for more details.])
1153c27291ebSmrg
1154c27291ebSmrgif test $pkg_failed = yes; then
1155c27291ebSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1156c27291ebSmrg        if test $_pkg_short_errors_supported = yes; then
1157c27291ebSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1158c27291ebSmrg        else 
1159c27291ebSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1160c27291ebSmrg        fi
1161c27291ebSmrg	# Put the nasty error message in config.log where it belongs
1162c27291ebSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1163c27291ebSmrg
1164c27291ebSmrg	ifelse([$4], , [AC_MSG_ERROR(dnl
1165c27291ebSmrg[Package requirements ($2) were not met:
1166c27291ebSmrg
1167c27291ebSmrg$$1_PKG_ERRORS
1168c27291ebSmrg
1169c27291ebSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1170c27291ebSmrginstalled software in a non-standard prefix.
1171c27291ebSmrg
1172c27291ebSmrg_PKG_TEXT
1173c27291ebSmrg])],
1174c27291ebSmrg		[AC_MSG_RESULT([no])
1175c27291ebSmrg                $4])
1176c27291ebSmrgelif test $pkg_failed = untried; then
1177c27291ebSmrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
1178c27291ebSmrg[The pkg-config script could not be found or is too old.  Make sure it
1179c27291ebSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
1180c27291ebSmrgpath to pkg-config.
1181c27291ebSmrg
1182c27291ebSmrg_PKG_TEXT
1183c27291ebSmrg
1184c27291ebSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1185c27291ebSmrg		[$4])
1186c27291ebSmrgelse
1187c27291ebSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1188c27291ebSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1189c27291ebSmrg        AC_MSG_RESULT([yes])
1190c27291ebSmrg	ifelse([$3], , :, [$3])
1191c27291ebSmrgfi[]dnl
1192c27291ebSmrg])# PKG_CHECK_MODULES
1193c27291ebSmrg
11944f9ac78aSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1195d1333322Smrgdnl
11964f9ac78aSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1197d1333322Smrgdnl 
1198d1333322Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
11994f9ac78aSmrgdnl copy of this software and associated documentation files (the "Software"),
12004f9ac78aSmrgdnl to deal in the Software without restriction, including without limitation
12014f9ac78aSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
12024f9ac78aSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
12034f9ac78aSmrgdnl Software is furnished to do so, subject to the following conditions:
1204d1333322Smrgdnl
12054f9ac78aSmrgdnl The above copyright notice and this permission notice (including the next
12064f9ac78aSmrgdnl paragraph) shall be included in all copies or substantial portions of the
12074f9ac78aSmrgdnl Software.
1208d1333322Smrgdnl
12094f9ac78aSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12104f9ac78aSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12114f9ac78aSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
12124f9ac78aSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12134f9ac78aSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
12144f9ac78aSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
12154f9ac78aSmrgdnl DEALINGS IN THE SOFTWARE.
1216d1333322Smrg
1217d1333322Smrg# XORG_MACROS_VERSION(required-version)
1218d1333322Smrg# -------------------------------------
1219d1333322Smrg# Minimum version: 1.1.0
1220d1333322Smrg#
1221d1333322Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1222d1333322Smrg# your configure.ac with the minimum required version, such as:
1223d1333322Smrg# XORG_MACROS_VERSION(1.1)
1224d1333322Smrg#
12254f9ac78aSmrg# To ensure that this macro is defined, also add:
12264f9ac78aSmrg# m4_ifndef([XORG_MACROS_VERSION],
12274f9ac78aSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1228d1333322Smrg#
1229d1333322Smrg#
1230d1333322Smrg# See the "minimum version" comment for each macro you use to see what 
1231d1333322Smrg# version you require.
12324f9ac78aSmrgm4_defun([XORG_MACROS_VERSION],[
1233c27291ebSmrgm4_define([vers_have], [1.17])
12344f9ac78aSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
12354f9ac78aSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
12364f9ac78aSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
12374f9ac78aSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
12384f9ac78aSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
12394f9ac78aSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
12404f9ac78aSmrgm4_undefine([vers_have])
12414f9ac78aSmrgm4_undefine([maj_have])
12424f9ac78aSmrgm4_undefine([maj_needed])
1243d1333322Smrg]) # XORG_MACROS_VERSION
1244d1333322Smrg
1245d1333322Smrg# XORG_PROG_RAWCPP()
1246d1333322Smrg# ------------------
1247d1333322Smrg# Minimum version: 1.0.0
1248d1333322Smrg#
1249d1333322Smrg# Find cpp program and necessary flags for use in pre-processing text files
1250d1333322Smrg# such as man pages and config files
1251d1333322SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1252d1333322SmrgAC_REQUIRE([AC_PROG_CPP])
1253d1333322SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
1254d1333322Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1255d1333322Smrg
1256d1333322Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1257d1333322Smrg# which is not the best choice for supporting other OS'es, but covers most
1258d1333322Smrg# of the ones we need for now.
1259d1333322SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1260c27291ebSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1261d1333322Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1262d1333322Smrg	AC_MSG_RESULT([no])
1263d1333322Smrgelse
1264d1333322Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1265d1333322Smrg		RAWCPPFLAGS=-undef
1266d1333322Smrg		AC_MSG_RESULT([yes])
12674f9ac78aSmrg	# under Cygwin unix is still defined even with -undef
12684f9ac78aSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
12694f9ac78aSmrg		RAWCPPFLAGS="-undef -ansi"
12704f9ac78aSmrg		AC_MSG_RESULT([yes, with -ansi])
1271d1333322Smrg	else
1272d1333322Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1273d1333322Smrg	fi
1274d1333322Smrgfi
1275d1333322Smrgrm -f conftest.$ac_ext
1276d1333322Smrg
1277d1333322SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1278c27291ebSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1279d1333322Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1280d1333322Smrg	AC_MSG_RESULT([no])
1281d1333322Smrgelse
1282d1333322Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1283d1333322Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1284d1333322Smrg		AC_MSG_RESULT([yes])
1285d1333322Smrg	else
1286d1333322Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1287d1333322Smrg	fi
1288d1333322Smrgfi
1289d1333322Smrgrm -f conftest.$ac_ext
1290d1333322SmrgAC_SUBST(RAWCPPFLAGS)
1291d1333322Smrg]) # XORG_PROG_RAWCPP
1292d1333322Smrg
1293d1333322Smrg# XORG_MANPAGE_SECTIONS()
1294d1333322Smrg# -----------------------
1295d1333322Smrg# Minimum version: 1.0.0
1296d1333322Smrg#
1297d1333322Smrg# Determine which sections man pages go in for the different man page types
1298d1333322Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1299d1333322Smrg# Not sure if there's any better way than just hardcoding by OS name.
1300d1333322Smrg# Override default settings by setting environment variables
13014f9ac78aSmrg# Added MAN_SUBSTS in version 1.8
13024f9ac78aSmrg# Added AC_PROG_SED in version 1.8
1303d1333322Smrg
1304d1333322SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1305d1333322SmrgAC_REQUIRE([AC_CANONICAL_HOST])
13064f9ac78aSmrgAC_REQUIRE([AC_PROG_SED])
1307d1333322Smrg
1308d1333322Smrgif test x$APP_MAN_SUFFIX = x    ; then
1309d1333322Smrg    APP_MAN_SUFFIX=1
1310d1333322Smrgfi
1311d1333322Smrgif test x$APP_MAN_DIR = x    ; then
1312d1333322Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1313d1333322Smrgfi
1314d1333322Smrg
1315d1333322Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1316d1333322Smrg    LIB_MAN_SUFFIX=3
1317d1333322Smrgfi
1318d1333322Smrgif test x$LIB_MAN_DIR = x    ; then
1319d1333322Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1320d1333322Smrgfi
1321d1333322Smrg
1322d1333322Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1323d1333322Smrg    case $host_os in
1324d1333322Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1325d1333322Smrg	*)		FILE_MAN_SUFFIX=5  ;;
1326d1333322Smrg    esac
1327d1333322Smrgfi
1328d1333322Smrgif test x$FILE_MAN_DIR = x    ; then
1329d1333322Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1330d1333322Smrgfi
1331d1333322Smrg
1332d1333322Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1333d1333322Smrg    case $host_os in
1334d1333322Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1335d1333322Smrg	*)		MISC_MAN_SUFFIX=7  ;;
1336d1333322Smrg    esac
1337d1333322Smrgfi
1338d1333322Smrgif test x$MISC_MAN_DIR = x    ; then
1339d1333322Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1340d1333322Smrgfi
1341d1333322Smrg
1342d1333322Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1343d1333322Smrg    case $host_os in
1344d1333322Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1345d1333322Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1346d1333322Smrg    esac
1347d1333322Smrgfi
1348d1333322Smrgif test x$DRIVER_MAN_DIR = x    ; then
1349d1333322Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1350d1333322Smrgfi
1351d1333322Smrg
1352d1333322Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1353d1333322Smrg    case $host_os in
1354d1333322Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1355d1333322Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1356d1333322Smrg    esac
1357d1333322Smrgfi
1358d1333322Smrgif test x$ADMIN_MAN_DIR = x    ; then
1359d1333322Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1360d1333322Smrgfi
1361d1333322Smrg
1362d1333322Smrg
1363d1333322SmrgAC_SUBST([APP_MAN_SUFFIX])
1364d1333322SmrgAC_SUBST([LIB_MAN_SUFFIX])
1365d1333322SmrgAC_SUBST([FILE_MAN_SUFFIX])
1366d1333322SmrgAC_SUBST([MISC_MAN_SUFFIX])
1367d1333322SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1368d1333322SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1369d1333322SmrgAC_SUBST([APP_MAN_DIR])
1370d1333322SmrgAC_SUBST([LIB_MAN_DIR])
1371d1333322SmrgAC_SUBST([FILE_MAN_DIR])
1372d1333322SmrgAC_SUBST([MISC_MAN_DIR])
1373d1333322SmrgAC_SUBST([DRIVER_MAN_DIR])
1374d1333322SmrgAC_SUBST([ADMIN_MAN_DIR])
13754f9ac78aSmrg
13764f9ac78aSmrgXORG_MAN_PAGE="X Version 11"
13774f9ac78aSmrgAC_SUBST([XORG_MAN_PAGE])
13784f9ac78aSmrgMAN_SUBSTS="\
13794f9ac78aSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
13804f9ac78aSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
13814f9ac78aSmrg	-e 's|__xservername__|Xorg|g' \
13824f9ac78aSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
13834f9ac78aSmrg	-e 's|__projectroot__|\$(prefix)|g' \
13844f9ac78aSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
13854f9ac78aSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
13864f9ac78aSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
13874f9ac78aSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
13884f9ac78aSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
13894f9ac78aSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
13904f9ac78aSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
13914f9ac78aSmrgAC_SUBST([MAN_SUBSTS])
13924f9ac78aSmrg
1393d1333322Smrg]) # XORG_MANPAGE_SECTIONS
1394d1333322Smrg
13954f9ac78aSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
13964f9ac78aSmrg# ------------------------
13974f9ac78aSmrg# Minimum version: 1.7.0
13984f9ac78aSmrg#
13994f9ac78aSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
14004f9ac78aSmrg# provided by xorg-sgml-doctools, if installed.
14014f9ac78aSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
14024f9ac78aSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
14034f9ac78aSmrgXORG_SGML_PATH=
14044f9ac78aSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
14054f9ac78aSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
14064f9ac78aSmrg    [m4_ifval([$1],[:],
14074f9ac78aSmrg        [if test x"$cross_compiling" != x"yes" ; then
14084f9ac78aSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
14094f9ac78aSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
14104f9ac78aSmrg         fi])
14114f9ac78aSmrg    ])
14124f9ac78aSmrg
14134f9ac78aSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
14144f9ac78aSmrg# the path and the name of the doc stylesheet
14154f9ac78aSmrgif test "x$XORG_SGML_PATH" != "x" ; then
14164f9ac78aSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
14174f9ac78aSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
14184f9ac78aSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
14194f9ac78aSmrgelse
14204f9ac78aSmrg   AC_MSG_RESULT([no])
14214f9ac78aSmrgfi
14224f9ac78aSmrg
14234f9ac78aSmrgAC_SUBST(XORG_SGML_PATH)
14244f9ac78aSmrgAC_SUBST(STYLESHEET_SRCDIR)
14254f9ac78aSmrgAC_SUBST(XSL_STYLESHEET)
14264f9ac78aSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
14274f9ac78aSmrg]) # XORG_CHECK_SGML_DOCTOOLS
14284f9ac78aSmrg
1429d1333322Smrg# XORG_CHECK_LINUXDOC
1430d1333322Smrg# -------------------
1431d1333322Smrg# Minimum version: 1.0.0
1432d1333322Smrg#
1433d1333322Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1434d1333322Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1435d1333322Smrg# Whether or not the necessary tools and files are found can be checked
1436d1333322Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1437d1333322SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
14384f9ac78aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
14394f9ac78aSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1440d1333322Smrg
1441d1333322SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1442d1333322Smrg
14434f9ac78aSmrgAC_MSG_CHECKING([whether to build documentation])
1444d1333322Smrg
14454f9ac78aSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1446d1333322Smrg   BUILDDOC=yes
1447d1333322Smrgelse
1448d1333322Smrg   BUILDDOC=no
1449d1333322Smrgfi
1450d1333322Smrg
1451d1333322SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1452d1333322Smrg
1453d1333322SmrgAC_MSG_RESULT([$BUILDDOC])
1454d1333322Smrg
14554f9ac78aSmrgAC_MSG_CHECKING([whether to build pdf documentation])
1456d1333322Smrg
14574f9ac78aSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1458d1333322Smrg   BUILDPDFDOC=yes
1459d1333322Smrgelse
1460d1333322Smrg   BUILDPDFDOC=no
1461d1333322Smrgfi
1462d1333322Smrg
1463d1333322SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1464d1333322Smrg
1465d1333322SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1466d1333322Smrg
14674f9ac78aSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1468d1333322SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1469d1333322SmrgMAKE_PDF="$PS2PDF"
1470d1333322SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1471d1333322Smrg
1472d1333322SmrgAC_SUBST(MAKE_TEXT)
1473d1333322SmrgAC_SUBST(MAKE_PS)
1474d1333322SmrgAC_SUBST(MAKE_PDF)
1475d1333322SmrgAC_SUBST(MAKE_HTML)
1476d1333322Smrg]) # XORG_CHECK_LINUXDOC
1477d1333322Smrg
1478d1333322Smrg# XORG_CHECK_DOCBOOK
1479d1333322Smrg# -------------------
1480d1333322Smrg# Minimum version: 1.0.0
1481d1333322Smrg#
1482d1333322Smrg# Checks for the ability to build output formats from SGML DocBook source.
1483d1333322Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1484d1333322Smrg# indicates whether the necessary tools and files are found and, if set,
1485d1333322Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1486d1333322SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
14874f9ac78aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
14884f9ac78aSmrg
1489d1333322SmrgBUILDTXTDOC=no
1490d1333322SmrgBUILDPDFDOC=no
1491d1333322SmrgBUILDPSDOC=no
1492d1333322SmrgBUILDHTMLDOC=no
1493d1333322Smrg
1494d1333322SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1495d1333322SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1496d1333322SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1497d1333322SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1498d1333322Smrg
14994f9ac78aSmrgAC_MSG_CHECKING([whether to build text documentation])
15004f9ac78aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1501d1333322Smrg   test x$BUILD_TXTDOC != xno; then
1502d1333322Smrg	BUILDTXTDOC=yes
1503d1333322Smrgfi
1504d1333322SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1505d1333322SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1506d1333322Smrg
15074f9ac78aSmrgAC_MSG_CHECKING([whether to build PDF documentation])
15084f9ac78aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1509d1333322Smrg   test x$BUILD_PDFDOC != xno; then
1510d1333322Smrg	BUILDPDFDOC=yes
1511d1333322Smrgfi
1512d1333322SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1513d1333322SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1514d1333322Smrg
15154f9ac78aSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
15164f9ac78aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1517d1333322Smrg   test x$BUILD_PSDOC != xno; then
1518d1333322Smrg	BUILDPSDOC=yes
1519d1333322Smrgfi
1520d1333322SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1521d1333322SmrgAC_MSG_RESULT([$BUILDPSDOC])
1522d1333322Smrg
15234f9ac78aSmrgAC_MSG_CHECKING([whether to build HTML documentation])
15244f9ac78aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1525d1333322Smrg   test x$BUILD_HTMLDOC != xno; then
1526d1333322Smrg	BUILDHTMLDOC=yes
1527d1333322Smrgfi
1528d1333322SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1529d1333322SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1530d1333322Smrg
1531d1333322SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1532d1333322SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1533d1333322SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1534d1333322SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1535d1333322Smrg
1536d1333322SmrgAC_SUBST(MAKE_TEXT)
1537d1333322SmrgAC_SUBST(MAKE_PS)
1538d1333322SmrgAC_SUBST(MAKE_PDF)
1539d1333322SmrgAC_SUBST(MAKE_HTML)
1540d1333322Smrg]) # XORG_CHECK_DOCBOOK
1541d1333322Smrg
15424f9ac78aSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
15434f9ac78aSmrg# ----------------
15444f9ac78aSmrg# Minimum version: 1.5.0
15454f9ac78aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
15464f9ac78aSmrg#
15474f9ac78aSmrg# Documentation tools are not always available on all platforms and sometimes
15484f9ac78aSmrg# not at the appropriate level. This macro enables a module to test for the
15494f9ac78aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
15504f9ac78aSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
15514f9ac78aSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
15524f9ac78aSmrg# --with-xmlto assumes 'auto'.
15534f9ac78aSmrg#
15544f9ac78aSmrg# Interface to module:
15554f9ac78aSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
15564f9ac78aSmrg# XMLTO:	returns the path of the xmlto program found
15574f9ac78aSmrg#		returns the path set by the user in the environment
15584f9ac78aSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
15594f9ac78aSmrg#		'no' user instructs the module not to use xmlto
15604f9ac78aSmrg#
15614f9ac78aSmrg# Added in version 1.10.0
15624f9ac78aSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
15634f9ac78aSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
15644f9ac78aSmrg#
15654f9ac78aSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
15664f9ac78aSmrg#
15674f9ac78aSmrgAC_DEFUN([XORG_WITH_XMLTO],[
15684f9ac78aSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
15694f9ac78aSmrgm4_define([_defopt], m4_default([$2], [auto]))
15704f9ac78aSmrgAC_ARG_WITH(xmlto,
15714f9ac78aSmrg	AS_HELP_STRING([--with-xmlto],
15724f9ac78aSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
15734f9ac78aSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
15744f9ac78aSmrgm4_undefine([_defopt])
15754f9ac78aSmrg
15764f9ac78aSmrgif test "x$use_xmlto" = x"auto"; then
15774f9ac78aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
15784f9ac78aSmrg   if test "x$XMLTO" = "x"; then
15794f9ac78aSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
15804f9ac78aSmrg	have_xmlto=no
15814f9ac78aSmrg   else
15824f9ac78aSmrg        have_xmlto=yes
15834f9ac78aSmrg   fi
15844f9ac78aSmrgelif test "x$use_xmlto" = x"yes" ; then
15854f9ac78aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
15864f9ac78aSmrg   if test "x$XMLTO" = "x"; then
15874f9ac78aSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
15884f9ac78aSmrg   fi
15894f9ac78aSmrg   have_xmlto=yes
15904f9ac78aSmrgelif test "x$use_xmlto" = x"no" ; then
15914f9ac78aSmrg   if test "x$XMLTO" != "x"; then
15924f9ac78aSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
15934f9ac78aSmrg   fi
15944f9ac78aSmrg   have_xmlto=no
15954f9ac78aSmrgelse
15964f9ac78aSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
15974f9ac78aSmrgfi
15984f9ac78aSmrg
15994f9ac78aSmrg# Test for a minimum version of xmlto, if provided.
16004f9ac78aSmrgm4_ifval([$1],
16014f9ac78aSmrg[if test "$have_xmlto" = yes; then
16024f9ac78aSmrg    # scrape the xmlto version
16034f9ac78aSmrg    AC_MSG_CHECKING([the xmlto version])
16044f9ac78aSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
16054f9ac78aSmrg    AC_MSG_RESULT([$xmlto_version])
16064f9ac78aSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
16074f9ac78aSmrg        [if test "x$use_xmlto" = xauto; then
16084f9ac78aSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
16094f9ac78aSmrg            have_xmlto=no
16104f9ac78aSmrg        else
16114f9ac78aSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
16124f9ac78aSmrg        fi])
16134f9ac78aSmrgfi])
16144f9ac78aSmrg
16154f9ac78aSmrg# Test for the ability of xmlto to generate a text target
16164f9ac78aSmrghave_xmlto_text=no
16174f9ac78aSmrgcat > conftest.xml << "EOF"
16184f9ac78aSmrgEOF
16194f9ac78aSmrgAS_IF([test "$have_xmlto" = yes],
16204f9ac78aSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
16214f9ac78aSmrg             [have_xmlto_text=yes],
16224f9ac78aSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
16234f9ac78aSmrgrm -f conftest.xml
16244f9ac78aSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
16254f9ac78aSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
16264f9ac78aSmrg]) # XORG_WITH_XMLTO
16274f9ac78aSmrg
1628c27291ebSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1629c27291ebSmrg# --------------------------------------------
1630c27291ebSmrg# Minimum version: 1.12.0
1631c27291ebSmrg# Minimum version for optional DEFAULT argument: 1.12.0
1632c27291ebSmrg#
1633c27291ebSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1634c27291ebSmrg# XML-based language used for the transformation of XML documents.
1635c27291ebSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1636c27291ebSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1637c27291ebSmrg# The XSLT processor is often used as a standalone tool for transformations.
1638c27291ebSmrg# It should not be assumed that this tool is used only to work with documnetation.
1639c27291ebSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1640c27291ebSmrg#
1641c27291ebSmrg# Interface to module:
1642c27291ebSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1643c27291ebSmrg# XSLTPROC:	 returns the path of the xsltproc program found
1644c27291ebSmrg#		 returns the path set by the user in the environment
1645c27291ebSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1646c27291ebSmrg#		  'no' user instructs the module not to use xsltproc
1647c27291ebSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1648c27291ebSmrg#
1649c27291ebSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1650c27291ebSmrg#
1651c27291ebSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1652c27291ebSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1653c27291ebSmrg# Preserves the interface, should it be implemented later
1654c27291ebSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1655c27291ebSmrgm4_define([_defopt], m4_default([$2], [auto]))
1656c27291ebSmrgAC_ARG_WITH(xsltproc,
1657c27291ebSmrg	AS_HELP_STRING([--with-xsltproc],
1658c27291ebSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1659c27291ebSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1660c27291ebSmrgm4_undefine([_defopt])
1661c27291ebSmrg
1662c27291ebSmrgif test "x$use_xsltproc" = x"auto"; then
1663c27291ebSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1664c27291ebSmrg   if test "x$XSLTPROC" = "x"; then
1665c27291ebSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1666c27291ebSmrg	have_xsltproc=no
1667c27291ebSmrg   else
1668c27291ebSmrg        have_xsltproc=yes
1669c27291ebSmrg   fi
1670c27291ebSmrgelif test "x$use_xsltproc" = x"yes" ; then
1671c27291ebSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1672c27291ebSmrg   if test "x$XSLTPROC" = "x"; then
1673c27291ebSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1674c27291ebSmrg   fi
1675c27291ebSmrg   have_xsltproc=yes
1676c27291ebSmrgelif test "x$use_xsltproc" = x"no" ; then
1677c27291ebSmrg   if test "x$XSLTPROC" != "x"; then
1678c27291ebSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1679c27291ebSmrg   fi
1680c27291ebSmrg   have_xsltproc=no
1681c27291ebSmrgelse
1682c27291ebSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1683c27291ebSmrgfi
1684c27291ebSmrg
1685c27291ebSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1686c27291ebSmrg]) # XORG_WITH_XSLTPROC
1687c27291ebSmrg
1688c27291ebSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1689c27291ebSmrg# ----------------------------------------
1690c27291ebSmrg# Minimum version: 1.15.0
1691c27291ebSmrg#
1692c27291ebSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
1693c27291ebSmrg# scanning arbitrary text files, extracting information from those text files,
1694c27291ebSmrg# and printing reports based on that information.
1695c27291ebSmrg#
1696c27291ebSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1697c27291ebSmrg#
1698c27291ebSmrg# Interface to module:
1699c27291ebSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
1700c27291ebSmrg# PERL:	     returns the path of the perl program found
1701c27291ebSmrg#	     returns the path set by the user in the environment
1702c27291ebSmrg# --with-perl: 'yes' user instructs the module to use perl
1703c27291ebSmrg#	       'no' user instructs the module not to use perl
1704c27291ebSmrg# have_perl: returns yes if perl found in PATH or no
1705c27291ebSmrg#
1706c27291ebSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1707c27291ebSmrg#
1708c27291ebSmrgAC_DEFUN([XORG_WITH_PERL],[
1709c27291ebSmrgAC_ARG_VAR([PERL], [Path to perl command])
1710c27291ebSmrg# Preserves the interface, should it be implemented later
1711c27291ebSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1712c27291ebSmrgm4_define([_defopt], m4_default([$2], [auto]))
1713c27291ebSmrgAC_ARG_WITH(perl,
1714c27291ebSmrg	AS_HELP_STRING([--with-perl],
1715c27291ebSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1716c27291ebSmrg	   [use_perl=$withval], [use_perl=]_defopt)
1717c27291ebSmrgm4_undefine([_defopt])
1718c27291ebSmrg
1719c27291ebSmrgif test "x$use_perl" = x"auto"; then
1720c27291ebSmrg   AC_PATH_PROG([PERL], [perl])
1721c27291ebSmrg   if test "x$PERL" = "x"; then
1722c27291ebSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1723c27291ebSmrg	have_perl=no
1724c27291ebSmrg   else
1725c27291ebSmrg        have_perl=yes
1726c27291ebSmrg   fi
1727c27291ebSmrgelif test "x$use_perl" = x"yes" ; then
1728c27291ebSmrg   AC_PATH_PROG([PERL], [perl])
1729c27291ebSmrg   if test "x$PERL" = "x"; then
1730c27291ebSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1731c27291ebSmrg   fi
1732c27291ebSmrg   have_perl=yes
1733c27291ebSmrgelif test "x$use_perl" = x"no" ; then
1734c27291ebSmrg   if test "x$PERL" != "x"; then
1735c27291ebSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1736c27291ebSmrg   fi
1737c27291ebSmrg   have_perl=no
1738c27291ebSmrgelse
1739c27291ebSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1740c27291ebSmrgfi
1741c27291ebSmrg
1742c27291ebSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1743c27291ebSmrg]) # XORG_WITH_PERL
1744c27291ebSmrg
17454f9ac78aSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
17464f9ac78aSmrg# ----------------
17474f9ac78aSmrg# Minimum version: 1.5.0
17484f9ac78aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
17494f9ac78aSmrg#
17504f9ac78aSmrg# Documentation tools are not always available on all platforms and sometimes
17514f9ac78aSmrg# not at the appropriate level. This macro enables a module to test for the
17524f9ac78aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
17534f9ac78aSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
17544f9ac78aSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
17554f9ac78aSmrg# --with-asciidoc assumes 'auto'.
17564f9ac78aSmrg#
17574f9ac78aSmrg# Interface to module:
17584f9ac78aSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
17594f9ac78aSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
17604f9ac78aSmrg#		 returns the path set by the user in the environment
17614f9ac78aSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
17624f9ac78aSmrg#		  'no' user instructs the module not to use asciidoc
17634f9ac78aSmrg#
17644f9ac78aSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
17654f9ac78aSmrg#
17664f9ac78aSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
17674f9ac78aSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
17684f9ac78aSmrgm4_define([_defopt], m4_default([$2], [auto]))
17694f9ac78aSmrgAC_ARG_WITH(asciidoc,
17704f9ac78aSmrg	AS_HELP_STRING([--with-asciidoc],
17714f9ac78aSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
17724f9ac78aSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
17734f9ac78aSmrgm4_undefine([_defopt])
17744f9ac78aSmrg
17754f9ac78aSmrgif test "x$use_asciidoc" = x"auto"; then
17764f9ac78aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
17774f9ac78aSmrg   if test "x$ASCIIDOC" = "x"; then
17784f9ac78aSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
17794f9ac78aSmrg	have_asciidoc=no
17804f9ac78aSmrg   else
17814f9ac78aSmrg        have_asciidoc=yes
17824f9ac78aSmrg   fi
17834f9ac78aSmrgelif test "x$use_asciidoc" = x"yes" ; then
17844f9ac78aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
17854f9ac78aSmrg   if test "x$ASCIIDOC" = "x"; then
17864f9ac78aSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
17874f9ac78aSmrg   fi
17884f9ac78aSmrg   have_asciidoc=yes
17894f9ac78aSmrgelif test "x$use_asciidoc" = x"no" ; then
17904f9ac78aSmrg   if test "x$ASCIIDOC" != "x"; then
17914f9ac78aSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
17924f9ac78aSmrg   fi
17934f9ac78aSmrg   have_asciidoc=no
17944f9ac78aSmrgelse
17954f9ac78aSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
17964f9ac78aSmrgfi
17974f9ac78aSmrgm4_ifval([$1],
17984f9ac78aSmrg[if test "$have_asciidoc" = yes; then
17994f9ac78aSmrg    # scrape the asciidoc version
18004f9ac78aSmrg    AC_MSG_CHECKING([the asciidoc version])
18014f9ac78aSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
18024f9ac78aSmrg    AC_MSG_RESULT([$asciidoc_version])
18034f9ac78aSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
18044f9ac78aSmrg        [if test "x$use_asciidoc" = xauto; then
18054f9ac78aSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
18064f9ac78aSmrg            have_asciidoc=no
18074f9ac78aSmrg        else
18084f9ac78aSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
18094f9ac78aSmrg        fi])
18104f9ac78aSmrgfi])
18114f9ac78aSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
18124f9ac78aSmrg]) # XORG_WITH_ASCIIDOC
18134f9ac78aSmrg
18144f9ac78aSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
18154f9ac78aSmrg# --------------------------------
18164f9ac78aSmrg# Minimum version: 1.5.0
18174f9ac78aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
18184f9ac78aSmrg#
18194f9ac78aSmrg# Documentation tools are not always available on all platforms and sometimes
18204f9ac78aSmrg# not at the appropriate level. This macro enables a module to test for the
18214f9ac78aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
18224f9ac78aSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
18234f9ac78aSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
18244f9ac78aSmrg# --with-doxygen assumes 'auto'.
18254f9ac78aSmrg#
18264f9ac78aSmrg# Interface to module:
18274f9ac78aSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
18284f9ac78aSmrg# DOXYGEN:	 returns the path of the doxygen program found
18294f9ac78aSmrg#		 returns the path set by the user in the environment
18304f9ac78aSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
18314f9ac78aSmrg#		  'no' user instructs the module not to use doxygen
18324f9ac78aSmrg#
18334f9ac78aSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
18344f9ac78aSmrg#
18354f9ac78aSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
18364f9ac78aSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
18374f9ac78aSmrgm4_define([_defopt], m4_default([$2], [auto]))
18384f9ac78aSmrgAC_ARG_WITH(doxygen,
18394f9ac78aSmrg	AS_HELP_STRING([--with-doxygen],
18404f9ac78aSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
18414f9ac78aSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
18424f9ac78aSmrgm4_undefine([_defopt])
18434f9ac78aSmrg
18444f9ac78aSmrgif test "x$use_doxygen" = x"auto"; then
18454f9ac78aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
18464f9ac78aSmrg   if test "x$DOXYGEN" = "x"; then
18474f9ac78aSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
18484f9ac78aSmrg	have_doxygen=no
18494f9ac78aSmrg   else
18504f9ac78aSmrg        have_doxygen=yes
18514f9ac78aSmrg   fi
18524f9ac78aSmrgelif test "x$use_doxygen" = x"yes" ; then
18534f9ac78aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
18544f9ac78aSmrg   if test "x$DOXYGEN" = "x"; then
18554f9ac78aSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
18564f9ac78aSmrg   fi
18574f9ac78aSmrg   have_doxygen=yes
18584f9ac78aSmrgelif test "x$use_doxygen" = x"no" ; then
18594f9ac78aSmrg   if test "x$DOXYGEN" != "x"; then
18604f9ac78aSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
18614f9ac78aSmrg   fi
18624f9ac78aSmrg   have_doxygen=no
18634f9ac78aSmrgelse
18644f9ac78aSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
18654f9ac78aSmrgfi
18664f9ac78aSmrgm4_ifval([$1],
18674f9ac78aSmrg[if test "$have_doxygen" = yes; then
18684f9ac78aSmrg    # scrape the doxygen version
18694f9ac78aSmrg    AC_MSG_CHECKING([the doxygen version])
18704f9ac78aSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
18714f9ac78aSmrg    AC_MSG_RESULT([$doxygen_version])
18724f9ac78aSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
18734f9ac78aSmrg        [if test "x$use_doxygen" = xauto; then
18744f9ac78aSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
18754f9ac78aSmrg            have_doxygen=no
18764f9ac78aSmrg        else
18774f9ac78aSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
18784f9ac78aSmrg        fi])
18794f9ac78aSmrgfi])
18804f9ac78aSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
18814f9ac78aSmrg]) # XORG_WITH_DOXYGEN
18824f9ac78aSmrg
18834f9ac78aSmrg# XORG_WITH_GROFF([DEFAULT])
18844f9ac78aSmrg# ----------------
18854f9ac78aSmrg# Minimum version: 1.6.0
18864f9ac78aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
18874f9ac78aSmrg#
18884f9ac78aSmrg# Documentation tools are not always available on all platforms and sometimes
18894f9ac78aSmrg# not at the appropriate level. This macro enables a module to test for the
18904f9ac78aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
18914f9ac78aSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
18924f9ac78aSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
18934f9ac78aSmrg# --with-groff assumes 'auto'.
18944f9ac78aSmrg#
18954f9ac78aSmrg# Interface to module:
18964f9ac78aSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
18974f9ac78aSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
18984f9ac78aSmrg# HAVE_GROFF_MS: the -ms macros package
18994f9ac78aSmrg# GROFF:	 returns the path of the groff program found
19004f9ac78aSmrg#		 returns the path set by the user in the environment
19014f9ac78aSmrg# --with-groff:	 'yes' user instructs the module to use groff
19024f9ac78aSmrg#		 'no' user instructs the module not to use groff
19034f9ac78aSmrg#
19044f9ac78aSmrg# Added in version 1.9.0:
19054f9ac78aSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
19064f9ac78aSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
19074f9ac78aSmrg#		   psselect from the psutils package.
19084f9ac78aSmrg#		   the ghostcript package. Refer to the grohtml man pages
19094f9ac78aSmrg#
19104f9ac78aSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
19114f9ac78aSmrg#
19124f9ac78aSmrg# OS and distros often splits groff in a basic and full package, the former
19134f9ac78aSmrg# having the groff program and the later having devices, fonts and macros
19144f9ac78aSmrg# Checking for the groff executable is not enough.
19154f9ac78aSmrg#
19164f9ac78aSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
19174f9ac78aSmrg# unset HAVE_GROFF or GROFF env variables.
19184f9ac78aSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
19194f9ac78aSmrg#
19204f9ac78aSmrgAC_DEFUN([XORG_WITH_GROFF],[
19214f9ac78aSmrgAC_ARG_VAR([GROFF], [Path to groff command])
19224f9ac78aSmrgm4_define([_defopt], m4_default([$1], [auto]))
19234f9ac78aSmrgAC_ARG_WITH(groff,
19244f9ac78aSmrg	AS_HELP_STRING([--with-groff],
19254f9ac78aSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
19264f9ac78aSmrg	   [use_groff=$withval], [use_groff=]_defopt)
19274f9ac78aSmrgm4_undefine([_defopt])
19284f9ac78aSmrg
19294f9ac78aSmrgif test "x$use_groff" = x"auto"; then
19304f9ac78aSmrg   AC_PATH_PROG([GROFF], [groff])
19314f9ac78aSmrg   if test "x$GROFF" = "x"; then
19324f9ac78aSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
19334f9ac78aSmrg	have_groff=no
19344f9ac78aSmrg   else
19354f9ac78aSmrg        have_groff=yes
19364f9ac78aSmrg   fi
19374f9ac78aSmrgelif test "x$use_groff" = x"yes" ; then
19384f9ac78aSmrg   AC_PATH_PROG([GROFF], [groff])
19394f9ac78aSmrg   if test "x$GROFF" = "x"; then
19404f9ac78aSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
19414f9ac78aSmrg   fi
19424f9ac78aSmrg   have_groff=yes
19434f9ac78aSmrgelif test "x$use_groff" = x"no" ; then
19444f9ac78aSmrg   if test "x$GROFF" != "x"; then
19454f9ac78aSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
19464f9ac78aSmrg   fi
19474f9ac78aSmrg   have_groff=no
19484f9ac78aSmrgelse
19494f9ac78aSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
19504f9ac78aSmrgfi
19514f9ac78aSmrg
19524f9ac78aSmrg# We have groff, test for the presence of the macro packages
19534f9ac78aSmrgif test "x$have_groff" = x"yes"; then
19544f9ac78aSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
19554f9ac78aSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
19564f9ac78aSmrg        groff_ms_works=yes
19574f9ac78aSmrg    else
19584f9ac78aSmrg        groff_ms_works=no
19594f9ac78aSmrg    fi
19604f9ac78aSmrg    AC_MSG_RESULT([$groff_ms_works])
19614f9ac78aSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
19624f9ac78aSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
19634f9ac78aSmrg        groff_mm_works=yes
19644f9ac78aSmrg    else
19654f9ac78aSmrg        groff_mm_works=no
19664f9ac78aSmrg    fi
19674f9ac78aSmrg    AC_MSG_RESULT([$groff_mm_works])
19684f9ac78aSmrgfi
19694f9ac78aSmrg
19704f9ac78aSmrg# We have groff, test for HTML dependencies, one command per package
19714f9ac78aSmrgif test "x$have_groff" = x"yes"; then
19724f9ac78aSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
19734f9ac78aSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
19744f9ac78aSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
19754f9ac78aSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
19764f9ac78aSmrg      have_groff_html=yes
19774f9ac78aSmrg   else
19784f9ac78aSmrg      have_groff_html=no
19794f9ac78aSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
19804f9ac78aSmrg   fi
19814f9ac78aSmrgfi
19824f9ac78aSmrg
19834f9ac78aSmrg# Set Automake conditionals for Makefiles
19844f9ac78aSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
19854f9ac78aSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
19864f9ac78aSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
19874f9ac78aSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
19884f9ac78aSmrg]) # XORG_WITH_GROFF
19894f9ac78aSmrg
1990c27291ebSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
1991c27291ebSmrg# ---------------------------------------
19924f9ac78aSmrg# Minimum version: 1.6.0
19934f9ac78aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1994c27291ebSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
19954f9ac78aSmrg#
19964f9ac78aSmrg# Documentation tools are not always available on all platforms and sometimes
19974f9ac78aSmrg# not at the appropriate level. This macro enables a module to test for the
19984f9ac78aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
19994f9ac78aSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
20004f9ac78aSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
20014f9ac78aSmrg# --with-fop assumes 'auto'.
20024f9ac78aSmrg#
20034f9ac78aSmrg# Interface to module:
20044f9ac78aSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
20054f9ac78aSmrg# FOP:	 	returns the path of the fop program found
20064f9ac78aSmrg#		returns the path set by the user in the environment
20074f9ac78aSmrg# --with-fop: 	'yes' user instructs the module to use fop
20084f9ac78aSmrg#		'no' user instructs the module not to use fop
20094f9ac78aSmrg#
20104f9ac78aSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
20114f9ac78aSmrg#
20124f9ac78aSmrgAC_DEFUN([XORG_WITH_FOP],[
20134f9ac78aSmrgAC_ARG_VAR([FOP], [Path to fop command])
2014c27291ebSmrgm4_define([_defopt], m4_default([$2], [auto]))
20154f9ac78aSmrgAC_ARG_WITH(fop,
20164f9ac78aSmrg	AS_HELP_STRING([--with-fop],
20174f9ac78aSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
20184f9ac78aSmrg	   [use_fop=$withval], [use_fop=]_defopt)
20194f9ac78aSmrgm4_undefine([_defopt])
20204f9ac78aSmrg
20214f9ac78aSmrgif test "x$use_fop" = x"auto"; then
20224f9ac78aSmrg   AC_PATH_PROG([FOP], [fop])
20234f9ac78aSmrg   if test "x$FOP" = "x"; then
20244f9ac78aSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
20254f9ac78aSmrg	have_fop=no
20264f9ac78aSmrg   else
20274f9ac78aSmrg        have_fop=yes
20284f9ac78aSmrg   fi
20294f9ac78aSmrgelif test "x$use_fop" = x"yes" ; then
20304f9ac78aSmrg   AC_PATH_PROG([FOP], [fop])
20314f9ac78aSmrg   if test "x$FOP" = "x"; then
20324f9ac78aSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
20334f9ac78aSmrg   fi
20344f9ac78aSmrg   have_fop=yes
20354f9ac78aSmrgelif test "x$use_fop" = x"no" ; then
20364f9ac78aSmrg   if test "x$FOP" != "x"; then
20374f9ac78aSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
20384f9ac78aSmrg   fi
20394f9ac78aSmrg   have_fop=no
20404f9ac78aSmrgelse
20414f9ac78aSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
20424f9ac78aSmrgfi
2043c27291ebSmrg
2044c27291ebSmrg# Test for a minimum version of fop, if provided.
2045c27291ebSmrgm4_ifval([$1],
2046c27291ebSmrg[if test "$have_fop" = yes; then
2047c27291ebSmrg    # scrape the fop version
2048c27291ebSmrg    AC_MSG_CHECKING([for fop minimum version])
2049c27291ebSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2050c27291ebSmrg    AC_MSG_RESULT([$fop_version])
2051c27291ebSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
2052c27291ebSmrg        [if test "x$use_fop" = xauto; then
2053c27291ebSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2054c27291ebSmrg            have_fop=no
2055c27291ebSmrg        else
2056c27291ebSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2057c27291ebSmrg        fi])
2058c27291ebSmrgfi])
20594f9ac78aSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
20604f9ac78aSmrg]) # XORG_WITH_FOP
20614f9ac78aSmrg
20624f9ac78aSmrg# XORG_WITH_PS2PDF([DEFAULT])
20634f9ac78aSmrg# ----------------
20644f9ac78aSmrg# Minimum version: 1.6.0
20654f9ac78aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
20664f9ac78aSmrg#
20674f9ac78aSmrg# Documentation tools are not always available on all platforms and sometimes
20684f9ac78aSmrg# not at the appropriate level. This macro enables a module to test for the
20694f9ac78aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
20704f9ac78aSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
20714f9ac78aSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
20724f9ac78aSmrg# --with-ps2pdf assumes 'auto'.
20734f9ac78aSmrg#
20744f9ac78aSmrg# Interface to module:
20754f9ac78aSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
20764f9ac78aSmrg# PS2PDF:	returns the path of the ps2pdf program found
20774f9ac78aSmrg#		returns the path set by the user in the environment
20784f9ac78aSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
20794f9ac78aSmrg#		 'no' user instructs the module not to use ps2pdf
20804f9ac78aSmrg#
20814f9ac78aSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
20824f9ac78aSmrg#
20834f9ac78aSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
20844f9ac78aSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
20854f9ac78aSmrgm4_define([_defopt], m4_default([$1], [auto]))
20864f9ac78aSmrgAC_ARG_WITH(ps2pdf,
20874f9ac78aSmrg	AS_HELP_STRING([--with-ps2pdf],
20884f9ac78aSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
20894f9ac78aSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
20904f9ac78aSmrgm4_undefine([_defopt])
20914f9ac78aSmrg
20924f9ac78aSmrgif test "x$use_ps2pdf" = x"auto"; then
20934f9ac78aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
20944f9ac78aSmrg   if test "x$PS2PDF" = "x"; then
20954f9ac78aSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
20964f9ac78aSmrg	have_ps2pdf=no
20974f9ac78aSmrg   else
20984f9ac78aSmrg        have_ps2pdf=yes
20994f9ac78aSmrg   fi
21004f9ac78aSmrgelif test "x$use_ps2pdf" = x"yes" ; then
21014f9ac78aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
21024f9ac78aSmrg   if test "x$PS2PDF" = "x"; then
21034f9ac78aSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
21044f9ac78aSmrg   fi
21054f9ac78aSmrg   have_ps2pdf=yes
21064f9ac78aSmrgelif test "x$use_ps2pdf" = x"no" ; then
21074f9ac78aSmrg   if test "x$PS2PDF" != "x"; then
21084f9ac78aSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
21094f9ac78aSmrg   fi
21104f9ac78aSmrg   have_ps2pdf=no
21114f9ac78aSmrgelse
21124f9ac78aSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
21134f9ac78aSmrgfi
21144f9ac78aSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
21154f9ac78aSmrg]) # XORG_WITH_PS2PDF
21164f9ac78aSmrg
21174f9ac78aSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
21184f9ac78aSmrg# ----------------
21194f9ac78aSmrg# Minimum version: 1.6.0
21204f9ac78aSmrg#
21214f9ac78aSmrg# Documentation tools are not always available on all platforms and sometimes
21224f9ac78aSmrg# not at the appropriate level. This macro enables a builder to skip all
21234f9ac78aSmrg# documentation targets except traditional man pages.
21244f9ac78aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
21254f9ac78aSmrg# maximum flexibilty in controlling documentation building.
21264f9ac78aSmrg# Refer to:
21274f9ac78aSmrg# XORG_WITH_XMLTO         --with-xmlto
21284f9ac78aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
21294f9ac78aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
21304f9ac78aSmrg# XORG_WITH_FOP           --with-fop
21314f9ac78aSmrg# XORG_WITH_GROFF         --with-groff
21324f9ac78aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
21334f9ac78aSmrg#
21344f9ac78aSmrg# Interface to module:
21354f9ac78aSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
21364f9ac78aSmrg# --enable-docs: 'yes' user instructs the module to generate docs
21374f9ac78aSmrg#		 'no' user instructs the module not to generate docs
21384f9ac78aSmrg# parm1:	specify the default value, yes or no.
21394f9ac78aSmrg#
21404f9ac78aSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2141c27291ebSmrgm4_define([docs_default], m4_default([$1], [yes]))
21424f9ac78aSmrgAC_ARG_ENABLE(docs,
21434f9ac78aSmrg	AS_HELP_STRING([--enable-docs],
2144c27291ebSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2145c27291ebSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2146c27291ebSmrgm4_undefine([docs_default])
21474f9ac78aSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
21484f9ac78aSmrgAC_MSG_CHECKING([whether to build documentation])
21494f9ac78aSmrgAC_MSG_RESULT([$build_docs])
21504f9ac78aSmrg]) # XORG_ENABLE_DOCS
21514f9ac78aSmrg
21524f9ac78aSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
21534f9ac78aSmrg# ----------------
21544f9ac78aSmrg# Minimum version: 1.6.0
21554f9ac78aSmrg#
21564f9ac78aSmrg# This macro enables a builder to skip all developer documentation.
21574f9ac78aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
21584f9ac78aSmrg# maximum flexibilty in controlling documentation building.
21594f9ac78aSmrg# Refer to:
21604f9ac78aSmrg# XORG_WITH_XMLTO         --with-xmlto
21614f9ac78aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
21624f9ac78aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
21634f9ac78aSmrg# XORG_WITH_FOP           --with-fop
21644f9ac78aSmrg# XORG_WITH_GROFF         --with-groff
21654f9ac78aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
21664f9ac78aSmrg#
21674f9ac78aSmrg# Interface to module:
21684f9ac78aSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
21694f9ac78aSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
21704f9ac78aSmrg#			'no' user instructs the module not to generate developer docs
21714f9ac78aSmrg# parm1:		specify the default value, yes or no.
21724f9ac78aSmrg#
21734f9ac78aSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
21744f9ac78aSmrgm4_define([devel_default], m4_default([$1], [yes]))
21754f9ac78aSmrgAC_ARG_ENABLE(devel-docs,
21764f9ac78aSmrg	AS_HELP_STRING([--enable-devel-docs],
21774f9ac78aSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
21784f9ac78aSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
21794f9ac78aSmrgm4_undefine([devel_default])
21804f9ac78aSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
21814f9ac78aSmrgAC_MSG_CHECKING([whether to build developer documentation])
21824f9ac78aSmrgAC_MSG_RESULT([$build_devel_docs])
21834f9ac78aSmrg]) # XORG_ENABLE_DEVEL_DOCS
21844f9ac78aSmrg
21854f9ac78aSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
21864f9ac78aSmrg# ----------------
21874f9ac78aSmrg# Minimum version: 1.6.0
21884f9ac78aSmrg#
21894f9ac78aSmrg# This macro enables a builder to skip all functional specification targets.
21904f9ac78aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
21914f9ac78aSmrg# maximum flexibilty in controlling documentation building.
21924f9ac78aSmrg# Refer to:
21934f9ac78aSmrg# XORG_WITH_XMLTO         --with-xmlto
21944f9ac78aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
21954f9ac78aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
21964f9ac78aSmrg# XORG_WITH_FOP           --with-fop
21974f9ac78aSmrg# XORG_WITH_GROFF         --with-groff
21984f9ac78aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
21994f9ac78aSmrg#
22004f9ac78aSmrg# Interface to module:
22014f9ac78aSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
22024f9ac78aSmrg# --enable-specs:	'yes' user instructs the module to generate specs
22034f9ac78aSmrg#			'no' user instructs the module not to generate specs
22044f9ac78aSmrg# parm1:		specify the default value, yes or no.
22054f9ac78aSmrg#
22064f9ac78aSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
22074f9ac78aSmrgm4_define([spec_default], m4_default([$1], [yes]))
22084f9ac78aSmrgAC_ARG_ENABLE(specs,
22094f9ac78aSmrg	AS_HELP_STRING([--enable-specs],
22104f9ac78aSmrg	   [Enable building the specs (default: ]spec_default[)]),
22114f9ac78aSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
22124f9ac78aSmrgm4_undefine([spec_default])
22134f9ac78aSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
22144f9ac78aSmrgAC_MSG_CHECKING([whether to build functional specifications])
22154f9ac78aSmrgAC_MSG_RESULT([$build_specs])
22164f9ac78aSmrg]) # XORG_ENABLE_SPECS
22174f9ac78aSmrg
2218c27291ebSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2219c27291ebSmrg# ----------------------------------------------
2220c27291ebSmrg# Minimum version: 1.13.0
2221c27291ebSmrg#
2222c27291ebSmrg# This macro enables a builder to enable/disable unit testing
2223c27291ebSmrg# It makes no assumption about the test cases implementation
2224c27291ebSmrg# Test cases may or may not use Automake "Support for test suites"
2225c27291ebSmrg# They may or may not use the software utility library GLib
2226c27291ebSmrg#
2227c27291ebSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2228c27291ebSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2229c27291ebSmrg# The variable enable_unit_tests is used by other macros in this file.
2230c27291ebSmrg#
2231c27291ebSmrg# Interface to module:
2232c27291ebSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2233c27291ebSmrg# enable_unit_tests:    used in configure.ac for additional configuration
2234c27291ebSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2235c27291ebSmrg#			'no' user instructs the module not to build tests
2236c27291ebSmrg# parm1:		specify the default value, yes or no.
2237c27291ebSmrg#
2238c27291ebSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2239c27291ebSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2240c27291ebSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2241c27291ebSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2242c27291ebSmrgm4_define([_defopt], m4_default([$1], [auto]))
2243c27291ebSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2244c27291ebSmrg	[Enable building unit test cases (default: ]_defopt[)]),
2245c27291ebSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2246c27291ebSmrgm4_undefine([_defopt])
2247c27291ebSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2248c27291ebSmrgAC_MSG_CHECKING([whether to build unit test cases])
2249c27291ebSmrgAC_MSG_RESULT([$enable_unit_tests])
2250c27291ebSmrg]) # XORG_ENABLE_UNIT_TESTS
2251c27291ebSmrg
2252c27291ebSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2253c27291ebSmrg# ------------------------------------------------------
2254c27291ebSmrg# Minimum version: 1.17.0
2255c27291ebSmrg#
2256c27291ebSmrg# This macro enables a builder to enable/disable integration testing
2257c27291ebSmrg# It makes no assumption about the test cases' implementation
2258c27291ebSmrg# Test cases may or may not use Automake "Support for test suites"
2259c27291ebSmrg#
2260c27291ebSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2261c27291ebSmrg# usually requires less dependencies and may be built and run under less
2262c27291ebSmrg# stringent environments than integration tests.
2263c27291ebSmrg#
2264c27291ebSmrg# Interface to module:
2265c27291ebSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2266c27291ebSmrg# enable_integration_tests:   used in configure.ac for additional configuration
2267c27291ebSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2268c27291ebSmrg#                             'no' user instructs the module not to build tests
2269c27291ebSmrg# parm1:                      specify the default value, yes or no.
2270c27291ebSmrg#
2271c27291ebSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2272c27291ebSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2273c27291ebSmrgm4_define([_defopt], m4_default([$1], [auto]))
2274c27291ebSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2275c27291ebSmrg	[Enable building integration test cases (default: ]_defopt[)]),
2276c27291ebSmrg	[enable_integration_tests=$enableval],
2277c27291ebSmrg	[enable_integration_tests=]_defopt)
2278c27291ebSmrgm4_undefine([_defopt])
2279c27291ebSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2280c27291ebSmrg	[test "x$enable_integration_tests" != xno])
2281c27291ebSmrgAC_MSG_CHECKING([whether to build unit test cases])
2282c27291ebSmrgAC_MSG_RESULT([$enable_integration_tests])
2283c27291ebSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
2284c27291ebSmrg
2285c27291ebSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2286c27291ebSmrg# ----------------------------------------
2287c27291ebSmrg# Minimum version: 1.13.0
2288c27291ebSmrg#
2289c27291ebSmrg# GLib is a library which provides advanced data structures and functions.
2290c27291ebSmrg# This macro enables a module to test for the presence of Glib.
2291c27291ebSmrg#
2292c27291ebSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2293c27291ebSmrg# Otherwise the value of $enable_unit_tests is blank.
2294c27291ebSmrg#
2295c27291ebSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2296c27291ebSmrg# test support usually requires less dependencies and may be built and run under
2297c27291ebSmrg# less stringent environments than integration tests.
2298c27291ebSmrg#
2299c27291ebSmrg# Interface to module:
2300c27291ebSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
2301c27291ebSmrg# with_glib: used in configure.ac to know if GLib has been found
2302c27291ebSmrg# --with-glib:	'yes' user instructs the module to use glib
2303c27291ebSmrg#		'no' user instructs the module not to use glib
2304c27291ebSmrg#
2305c27291ebSmrgAC_DEFUN([XORG_WITH_GLIB],[
2306c27291ebSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2307c27291ebSmrgm4_define([_defopt], m4_default([$2], [auto]))
2308c27291ebSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2309c27291ebSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2310c27291ebSmrg	[with_glib=$withval], [with_glib=]_defopt)
2311c27291ebSmrgm4_undefine([_defopt])
2312c27291ebSmrg
2313c27291ebSmrghave_glib=no
2314c27291ebSmrg# Do not probe GLib if user explicitly disabled unit testing
2315c27291ebSmrgif test "x$enable_unit_tests" != x"no"; then
2316c27291ebSmrg  # Do not probe GLib if user explicitly disabled it
2317c27291ebSmrg  if test "x$with_glib" != x"no"; then
2318c27291ebSmrg    m4_ifval(
2319c27291ebSmrg      [$1],
2320c27291ebSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2321c27291ebSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2322c27291ebSmrg    )
2323c27291ebSmrg  fi
2324c27291ebSmrgfi
2325c27291ebSmrg
2326c27291ebSmrg# Not having GLib when unit testing has been explicitly requested is an error
2327c27291ebSmrgif test "x$enable_unit_tests" = x"yes"; then
2328c27291ebSmrg  if test "x$have_glib" = x"no"; then
2329c27291ebSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2330c27291ebSmrg  fi
2331c27291ebSmrgfi
2332c27291ebSmrg
2333c27291ebSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
2334c27291ebSmrgif test "x$enable_unit_tests" = x"no"; then
2335c27291ebSmrg  if test "x$with_glib" = x"yes"; then
2336c27291ebSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2337c27291ebSmrg  fi
2338c27291ebSmrgfi
2339c27291ebSmrg
2340c27291ebSmrg# Not having GLib when it has been explicitly requested is an error
2341c27291ebSmrgif test "x$with_glib" = x"yes"; then
2342c27291ebSmrg  if test "x$have_glib" = x"no"; then
2343c27291ebSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2344c27291ebSmrg  fi
2345c27291ebSmrgfi
2346c27291ebSmrg
2347c27291ebSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2348c27291ebSmrg]) # XORG_WITH_GLIB
2349c27291ebSmrg
2350c27291ebSmrg# XORG_LD_WRAP([required|optional])
2351c27291ebSmrg# ---------------------------------
2352c27291ebSmrg# Minimum version: 1.13.0
2353c27291ebSmrg#
2354c27291ebSmrg# Check if linker supports -wrap, passed via compiler flags
2355c27291ebSmrg#
2356c27291ebSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2357c27291ebSmrg# Otherwise the value of $enable_unit_tests is blank.
2358c27291ebSmrg#
2359c27291ebSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2360c27291ebSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2361c27291ebSmrg# available, an argument of "optional" allows use when some unit tests require
2362c27291ebSmrg# ld -wrap and others do not.
2363c27291ebSmrg#
2364c27291ebSmrgAC_DEFUN([XORG_LD_WRAP],[
2365c27291ebSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2366c27291ebSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2367c27291ebSmrg                      void __wrap_exit(int status) { return; }],
2368c27291ebSmrg                     [exit(0);])])
2369c27291ebSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
2370c27291ebSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2371c27291ebSmrg  if test "x$have_ld_wrap" = x"no"; then
2372c27291ebSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2373c27291ebSmrg  fi
2374c27291ebSmrgfi
2375c27291ebSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2376c27291ebSmrg#
2377c27291ebSmrg]) # XORG_LD_WRAP
2378c27291ebSmrg
2379c27291ebSmrg# XORG_CHECK_LINKER_FLAGS
2380c27291ebSmrg# -----------------------
2381c27291ebSmrg# SYNOPSIS
2382c27291ebSmrg#
2383c27291ebSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2384c27291ebSmrg#
2385c27291ebSmrg# DESCRIPTION
2386c27291ebSmrg#
2387c27291ebSmrg#   Check whether the given linker FLAGS work with the current language's
2388c27291ebSmrg#   linker, or whether they give an error.
2389c27291ebSmrg#
2390c27291ebSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2391c27291ebSmrg#   success/failure.
2392c27291ebSmrg#
2393c27291ebSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
2394c27291ebSmrg#
2395c27291ebSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2396c27291ebSmrg#
2397c27291ebSmrg# LICENSE
2398c27291ebSmrg#
2399c27291ebSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2400c27291ebSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2401c27291ebSmrg#   Copyright (c) 2009 Matteo Frigo
2402c27291ebSmrg#
2403c27291ebSmrg#   This program is free software: you can redistribute it and/or modify it
2404c27291ebSmrg#   under the terms of the GNU General Public License as published by the
2405c27291ebSmrg#   Free Software Foundation, either version 3 of the License, or (at your
2406c27291ebSmrg#   option) any later version.
2407c27291ebSmrg#
2408c27291ebSmrg#   This program is distributed in the hope that it will be useful, but
2409c27291ebSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2410c27291ebSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2411c27291ebSmrg#   Public License for more details.
2412c27291ebSmrg#
2413c27291ebSmrg#   You should have received a copy of the GNU General Public License along
2414c27291ebSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2415c27291ebSmrg#
2416c27291ebSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
2417c27291ebSmrg#   gives unlimited permission to copy, distribute and modify the configure
2418c27291ebSmrg#   scripts that are the output of Autoconf when processing the Macro. You
2419c27291ebSmrg#   need not follow the terms of the GNU General Public License when using
2420c27291ebSmrg#   or distributing such scripts, even though portions of the text of the
2421c27291ebSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2422c27291ebSmrg#   all other use of the material that constitutes the Autoconf Macro.
2423c27291ebSmrg#
2424c27291ebSmrg#   This special exception to the GPL applies to versions of the Autoconf
2425c27291ebSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
2426c27291ebSmrg#   modified version of the Autoconf Macro, you may extend this special
2427c27291ebSmrg#   exception to the GPL to apply to your modified version as well.#
2428c27291ebSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2429c27291ebSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
2430c27291ebSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2431c27291ebSmrgAS_LITERAL_IF([$1],
2432c27291ebSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2433c27291ebSmrg      ax_save_FLAGS=$LDFLAGS
2434c27291ebSmrg      LDFLAGS="$1"
2435c27291ebSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2436c27291ebSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2437c27291ebSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2438c27291ebSmrg      LDFLAGS=$ax_save_FLAGS])],
2439c27291ebSmrg  [ax_save_FLAGS=$LDFLAGS
2440c27291ebSmrg   LDFLAGS="$1"
2441c27291ebSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2442c27291ebSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2443c27291ebSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2444c27291ebSmrg   LDFLAGS=$ax_save_FLAGS])
2445c27291ebSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2446c27291ebSmrgAC_MSG_RESULT($xorg_check_linker_flags)
2447c27291ebSmrgif test "x$xorg_check_linker_flags" = xyes; then
2448c27291ebSmrg	m4_default([$2], :)
2449c27291ebSmrgelse
2450c27291ebSmrg	m4_default([$3], :)
2451c27291ebSmrgfi
2452c27291ebSmrg]) # XORG_CHECK_LINKER_FLAGS
2453c27291ebSmrg
2454c27291ebSmrg# XORG_MEMORY_CHECK_FLAGS
2455c27291ebSmrg# -----------------------
2456c27291ebSmrg# Minimum version: 1.16.0
2457c27291ebSmrg#
2458c27291ebSmrg# This macro attempts to find appropriate memory checking functionality
2459c27291ebSmrg# for various platforms which unit testing code may use to catch various
2460c27291ebSmrg# forms of memory allocation and access errors in testing.
2461c27291ebSmrg#
2462c27291ebSmrg# Interface to module:
2463c27291ebSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2464c27291ebSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2465c27291ebSmrg#
2466c27291ebSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2467c27291ebSmrg#
2468c27291ebSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2469c27291ebSmrg
2470c27291ebSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2471c27291ebSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2472c27291ebSmrg           [Environment variables to enable memory checking in tests])
2473c27291ebSmrg
2474c27291ebSmrg# Check for different types of support on different platforms
2475c27291ebSmrgcase $host_os in
2476c27291ebSmrg    solaris*)
2477c27291ebSmrg        AC_CHECK_LIB([umem], [umem_alloc],
2478c27291ebSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2479c27291ebSmrg        ;;
2480c27291ebSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2481c27291ebSmrg        # both directly and inverted, so should not be 0 or 255.
2482c27291ebSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
2483c27291ebSmrg        ;;
2484c27291ebSmrg    darwin*)
2485c27291ebSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2486c27291ebSmrg        ;;
2487c27291ebSmrg    *bsd*)
2488c27291ebSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2489c27291ebSmrg        ;;
2490c27291ebSmrgesac
2491c27291ebSmrg
2492c27291ebSmrg# User supplied flags override default flags
2493c27291ebSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2494c27291ebSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2495c27291ebSmrgfi
2496c27291ebSmrg
2497c27291ebSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2498c27291ebSmrg]) # XORG_WITH_LINT
2499c27291ebSmrg
2500d1333322Smrg# XORG_CHECK_MALLOC_ZERO
2501d1333322Smrg# ----------------------
2502d1333322Smrg# Minimum version: 1.0.0
2503d1333322Smrg#
2504d1333322Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2505d1333322Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2506d1333322Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2507d1333322SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2508d1333322SmrgAC_ARG_ENABLE(malloc0returnsnull,
25094f9ac78aSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2510d1333322Smrg		       [malloc(0) returns NULL (default: auto)]),
2511d1333322Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2512d1333322Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2513d1333322Smrg
2514d1333322SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2515d1333322Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2516c27291ebSmrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
2517c27291ebSmrg#include <stdlib.h>
2518c27291ebSmrg],[
2519d1333322Smrg    char *m0, *r0, *c0, *p;
2520d1333322Smrg    m0 = malloc(0);
2521d1333322Smrg    p = malloc(10);
2522d1333322Smrg    r0 = realloc(p,0);
2523c27291ebSmrg    c0 = calloc(0,10);
2524c27291ebSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2525c27291ebSmrg])],
2526d1333322Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
25274f9ac78aSmrg		[MALLOC_ZERO_RETURNS_NULL=no],
25284f9ac78aSmrg		[MALLOC_ZERO_RETURNS_NULL=yes])
2529d1333322Smrgfi
2530d1333322SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2531d1333322Smrg
2532d1333322Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2533d1333322Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2534d1333322Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2535d1333322Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2536d1333322Smrgelse
2537d1333322Smrg	MALLOC_ZERO_CFLAGS=""
2538d1333322Smrg	XMALLOC_ZERO_CFLAGS=""
2539d1333322Smrg	XTMALLOC_ZERO_CFLAGS=""
2540d1333322Smrgfi
2541d1333322Smrg
2542d1333322SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2543d1333322SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2544d1333322SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2545d1333322Smrg]) # XORG_CHECK_MALLOC_ZERO
2546d1333322Smrg
2547d1333322Smrg# XORG_WITH_LINT()
2548d1333322Smrg# ----------------
2549d1333322Smrg# Minimum version: 1.1.0
2550d1333322Smrg#
25514f9ac78aSmrg# This macro enables the use of a tool that flags some suspicious and
25524f9ac78aSmrg# non-portable constructs (likely to be bugs) in C language source code.
25534f9ac78aSmrg# It will attempt to locate the tool and use appropriate options.
25544f9ac78aSmrg# There are various lint type tools on different platforms.
25554f9ac78aSmrg#
25564f9ac78aSmrg# Interface to module:
25574f9ac78aSmrg# LINT:		returns the path to the tool found on the platform
25584f9ac78aSmrg#		or the value set to LINT on the configure cmd line
25594f9ac78aSmrg#		also an Automake conditional
25604f9ac78aSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
25614f9ac78aSmrg#
25624f9ac78aSmrg# --with-lint:	'yes' user instructs the module to use lint
25634f9ac78aSmrg#		'no' user instructs the module not to use lint (default)
25644f9ac78aSmrg#
25654f9ac78aSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
25664f9ac78aSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2567d1333322Smrg#
2568d1333322SmrgAC_DEFUN([XORG_WITH_LINT],[
2569d1333322Smrg
25704f9ac78aSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
25714f9ac78aSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
25724f9ac78aSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2573d1333322Smrg		[Use a lint-style source code checker (default: disabled)])],
2574d1333322Smrg		[use_lint=$withval], [use_lint=no])
25754f9ac78aSmrg
25764f9ac78aSmrg# Obtain platform specific info like program name and options
25774f9ac78aSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
25784f9ac78aSmrgcase $host_os in
25794f9ac78aSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
25804f9ac78aSmrg	lint_name=splint
25814f9ac78aSmrg	lint_options="-badflag"
25824f9ac78aSmrg	;;
25834f9ac78aSmrg  *freebsd* | *netbsd*)
25844f9ac78aSmrg	lint_name=lint
25854f9ac78aSmrg	lint_options="-u -b"
25864f9ac78aSmrg	;;
25874f9ac78aSmrg  *solaris*)
25884f9ac78aSmrg	lint_name=lint
25894f9ac78aSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
25904f9ac78aSmrg	;;
25914f9ac78aSmrgesac
25924f9ac78aSmrg
25934f9ac78aSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
25944f9ac78aSmrgif test "x$use_lint" = x"yes" ; then
25954f9ac78aSmrg   AC_PATH_PROG([LINT], [$lint_name])
25964f9ac78aSmrg   if test "x$LINT" = "x"; then
25974f9ac78aSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
25984f9ac78aSmrg   fi
25994f9ac78aSmrgelif test "x$use_lint" = x"no" ; then
26004f9ac78aSmrg   if test "x$LINT" != "x"; then
26014f9ac78aSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
26024f9ac78aSmrg   fi
2603d1333322Smrgelse
26044f9ac78aSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2605d1333322Smrgfi
26064f9ac78aSmrg
26074f9ac78aSmrg# User supplied flags override default flags
26084f9ac78aSmrgif test "x$LINT_FLAGS" != "x"; then
26094f9ac78aSmrg   lint_options=$LINT_FLAGS
2610d1333322Smrgfi
2611d1333322Smrg
26124f9ac78aSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
26134f9ac78aSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2614d1333322Smrg
2615d1333322Smrg]) # XORG_WITH_LINT
2616d1333322Smrg
2617d1333322Smrg# XORG_LINT_LIBRARY(LIBNAME)
2618d1333322Smrg# --------------------------
2619d1333322Smrg# Minimum version: 1.1.0
2620d1333322Smrg#
2621d1333322Smrg# Sets up flags for building lint libraries for checking programs that call
2622d1333322Smrg# functions in the library.
2623d1333322Smrg#
26244f9ac78aSmrg# Interface to module:
26254f9ac78aSmrg# LINTLIB		- Automake variable with the name of lint library file to make
26264f9ac78aSmrg# MAKE_LINT_LIB		- Automake conditional
26274f9ac78aSmrg#
26284f9ac78aSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
26294f9ac78aSmrg#			  - 'no' user instructs the module not to create a lint library (default)
2630d1333322Smrg
2631d1333322SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2632d1333322SmrgAC_REQUIRE([XORG_WITH_LINT])
26334f9ac78aSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2634d1333322Smrg	[Create lint library (default: disabled)])],
2635d1333322Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
26364f9ac78aSmrg
26374f9ac78aSmrgif test "x$make_lint_lib" = x"yes" ; then
26384f9ac78aSmrg   LINTLIB=llib-l$1.ln
26394f9ac78aSmrg   if test "x$LINT" = "x"; then
26404f9ac78aSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
26414f9ac78aSmrg   fi
26424f9ac78aSmrgelif test "x$make_lint_lib" != x"no" ; then
26434f9ac78aSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2644d1333322Smrgfi
26454f9ac78aSmrg
2646d1333322SmrgAC_SUBST(LINTLIB)
2647d1333322SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2648d1333322Smrg
2649d1333322Smrg]) # XORG_LINT_LIBRARY
2650d1333322Smrg
2651c27291ebSmrg# XORG_COMPILER_BRAND
2652c27291ebSmrg# -------------------
2653c27291ebSmrg# Minimum version: 1.14.0
2654c27291ebSmrg#
2655c27291ebSmrg# Checks for various brands of compilers and sets flags as appropriate:
2656c27291ebSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2657c27291ebSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2658c27291ebSmrg#   clang compiler - sets CLANGCC to "yes"
2659c27291ebSmrg#   Intel compiler - sets INTELCC to "yes"
2660c27291ebSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2661c27291ebSmrg#
2662c27291ebSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2663c27291ebSmrgAC_LANG_CASE(
2664c27291ebSmrg	[C], [
2665c27291ebSmrg		AC_REQUIRE([AC_PROG_CC_C99])
2666c27291ebSmrg	],
2667c27291ebSmrg	[C++], [
2668c27291ebSmrg		AC_REQUIRE([AC_PROG_CXX])
2669c27291ebSmrg	]
2670c27291ebSmrg)
2671c27291ebSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2672c27291ebSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2673c27291ebSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2674c27291ebSmrg]) # XORG_COMPILER_BRAND
2675c27291ebSmrg
2676c27291ebSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2677c27291ebSmrg# ---------------
2678c27291ebSmrg# Minimum version: 1.16.0
2679c27291ebSmrg#
2680c27291ebSmrg# Test if the compiler works when passed the given flag as a command line argument.
2681c27291ebSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2682c27291ebSmrg# next flag in the list until there are no more options.
2683c27291ebSmrg#
2684c27291ebSmrg# Note that this does not guarantee that the compiler supports the flag as some
2685c27291ebSmrg# compilers will simply ignore arguments that they do not understand, but we do
2686c27291ebSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2687c27291ebSmrg# -Werror=unused-command-line-argument
2688c27291ebSmrg#
2689c27291ebSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2690c27291ebSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2691c27291ebSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2692c27291ebSmrg
2693c27291ebSmrgAC_LANG_COMPILER_REQUIRE
2694c27291ebSmrg
2695c27291ebSmrgAC_LANG_CASE(
2696c27291ebSmrg	[C], [
2697c27291ebSmrg		AC_REQUIRE([AC_PROG_CC_C99])
2698c27291ebSmrg		define([PREFIX], [C])
2699c27291ebSmrg		define([CACHE_PREFIX], [cc])
2700c27291ebSmrg		define([COMPILER], [$CC])
2701c27291ebSmrg	],
2702c27291ebSmrg	[C++], [
2703c27291ebSmrg		define([PREFIX], [CXX])
2704c27291ebSmrg		define([CACHE_PREFIX], [cxx])
2705c27291ebSmrg		define([COMPILER], [$CXX])
2706c27291ebSmrg	]
2707c27291ebSmrg)
2708c27291ebSmrg
2709c27291ebSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2710c27291ebSmrg
2711c27291ebSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
2712c27291ebSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2713c27291ebSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
2714c27291ebSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2715c27291ebSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2716c27291ebSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
2717c27291ebSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
2718c27291ebSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
2719c27291ebSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2720c27291ebSmrgfi
2721c27291ebSmrg
2722c27291ebSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
2723c27291ebSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
2724c27291ebSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2725c27291ebSmrg	fi
2726c27291ebSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2727c27291ebSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
2728c27291ebSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2729c27291ebSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2730c27291ebSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
2731c27291ebSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
2732c27291ebSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
2733c27291ebSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2734c27291ebSmrgfi
2735c27291ebSmrg
2736c27291ebSmrgfound="no"
2737c27291ebSmrgm4_foreach([flag], m4_cdr($@), [
2738c27291ebSmrg	if test $found = "no" ; then
2739c27291ebSmrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
2740c27291ebSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2741c27291ebSmrg		fi
2742c27291ebSmrg
2743c27291ebSmrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
2744c27291ebSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2745c27291ebSmrg		fi
2746c27291ebSmrg
2747c27291ebSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2748c27291ebSmrg
2749c27291ebSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2750c27291ebSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
2751c27291ebSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
2752c27291ebSmrg		AC_CACHE_VAL($cacheid,
2753c27291ebSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2754c27291ebSmrg					     [eval $cacheid=yes],
2755c27291ebSmrg					     [eval $cacheid=no])])
2756c27291ebSmrg
2757c27291ebSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2758c27291ebSmrg
2759c27291ebSmrg		eval supported=\$$cacheid
2760c27291ebSmrg		AC_MSG_RESULT([$supported])
2761c27291ebSmrg		if test "$supported" = "yes" ; then
2762c27291ebSmrg			$1="$$1 ]flag["
2763c27291ebSmrg			found="yes"
2764c27291ebSmrg		fi
2765c27291ebSmrg	fi
2766c27291ebSmrg])
2767c27291ebSmrg]) # XORG_TESTSET_CFLAG
2768c27291ebSmrg
2769c27291ebSmrg# XORG_COMPILER_FLAGS
2770c27291ebSmrg# ---------------
2771c27291ebSmrg# Minimum version: 1.16.0
2772c27291ebSmrg#
2773c27291ebSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2774c27291ebSmrg# arguments supported by the selected compiler which do NOT alter the generated
2775c27291ebSmrg# code.  These arguments will cause the compiler to print various warnings
2776c27291ebSmrg# during compilation AND turn a conservative set of warnings into errors.
2777c27291ebSmrg#
2778c27291ebSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2779c27291ebSmrg# future versions of util-macros as options are added to new compilers.
2780c27291ebSmrg#
2781c27291ebSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2782c27291ebSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2783c27291ebSmrg
2784c27291ebSmrgAC_ARG_ENABLE(selective-werror,
2785c27291ebSmrg              AS_HELP_STRING([--disable-selective-werror],
2786c27291ebSmrg                             [Turn off selective compiler errors. (default: enabled)]),
2787c27291ebSmrg              [SELECTIVE_WERROR=$enableval],
2788c27291ebSmrg              [SELECTIVE_WERROR=yes])
2789c27291ebSmrg
2790c27291ebSmrgAC_LANG_CASE(
2791c27291ebSmrg        [C], [
2792c27291ebSmrg                define([PREFIX], [C])
2793c27291ebSmrg        ],
2794c27291ebSmrg        [C++], [
2795c27291ebSmrg                define([PREFIX], [CXX])
2796c27291ebSmrg        ]
2797c27291ebSmrg)
2798c27291ebSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2799c27291ebSmrgif test "x$SUNCC" = "xyes"; then
2800c27291ebSmrg    [BASE_]PREFIX[FLAGS]="-v"
2801c27291ebSmrgelse
2802c27291ebSmrg    [BASE_]PREFIX[FLAGS]=""
2803c27291ebSmrgfi
2804c27291ebSmrg
2805c27291ebSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2806c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2807c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2808c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2809c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2810c27291ebSmrg
2811c27291ebSmrgAC_LANG_CASE(
2812c27291ebSmrg	[C], [
2813c27291ebSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2814c27291ebSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2815c27291ebSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2816c27291ebSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
2817c27291ebSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
2818c27291ebSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2819c27291ebSmrg	]
2820c27291ebSmrg)
2821c27291ebSmrg
2822c27291ebSmrg# This chunk adds additional warnings that could catch undesired effects.
2823c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2824c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2825c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2826c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2827c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2828c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2829c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
2830c27291ebSmrg
2831c27291ebSmrg# These are currently disabled because they are noisy.  They will be enabled
2832c27291ebSmrg# in the future once the codebase is sufficiently modernized to silence
2833c27291ebSmrg# them.  For now, I don't want them to drown out the other warnings.
2834c27291ebSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2835c27291ebSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
2836c27291ebSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
2837c27291ebSmrg
2838c27291ebSmrg# Turn some warnings into errors, so we don't accidently get successful builds
2839c27291ebSmrg# when there are problems that should be fixed.
2840c27291ebSmrg
2841c27291ebSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
2842c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
2843c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
2844c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
2845c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
2846c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
2847c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
2848c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
2849c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
2850c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
2851c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
2852c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
2853c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
2854c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
2855c27291ebSmrgelse
2856c27291ebSmrgAC_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])
2857c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
2858c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
2859c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
2860c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
2861c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
2862c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
2863c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
2864c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
2865c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
2866c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
2867c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
2868c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
2869c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
2870c27291ebSmrgfi
2871c27291ebSmrg
2872c27291ebSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2873c27291ebSmrg]) # XORG_COMPILER_FLAGS
2874c27291ebSmrg
28754f9ac78aSmrg# XORG_CWARNFLAGS
28764f9ac78aSmrg# ---------------
28774f9ac78aSmrg# Minimum version: 1.2.0
2878c27291ebSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
28794f9ac78aSmrg#
28804f9ac78aSmrg# Defines CWARNFLAGS to enable C compiler warnings.
28814f9ac78aSmrg#
2882c27291ebSmrg# This function is deprecated because it defines -fno-strict-aliasing
2883c27291ebSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
2884c27291ebSmrg# is needed, then it should be added explicitly in the module when
2885c27291ebSmrg# it is updated to use BASE_CFLAGS.
2886c27291ebSmrg#
28874f9ac78aSmrgAC_DEFUN([XORG_CWARNFLAGS], [
2888c27291ebSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2889c27291ebSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2890c27291ebSmrgAC_LANG_CASE(
2891c27291ebSmrg	[C], [
2892c27291ebSmrg		CWARNFLAGS="$BASE_CFLAGS"
2893c27291ebSmrg		if  test "x$GCC" = xyes ; then
2894c27291ebSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
2895c27291ebSmrg		fi
2896c27291ebSmrg		AC_SUBST(CWARNFLAGS)
2897c27291ebSmrg	]
2898c27291ebSmrg)
28994f9ac78aSmrg]) # XORG_CWARNFLAGS
29004f9ac78aSmrg
29014f9ac78aSmrg# XORG_STRICT_OPTION
29024f9ac78aSmrg# -----------------------
29034f9ac78aSmrg# Minimum version: 1.3.0
29044f9ac78aSmrg#
2905c27291ebSmrg# Add configure option to enable strict compilation flags, such as treating
2906c27291ebSmrg# warnings as fatal errors.
2907c27291ebSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
2908c27291ebSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
2909c27291ebSmrg#
2910c27291ebSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
2911c27291ebSmrg# when strict compilation is unconditionally desired.
29124f9ac78aSmrgAC_DEFUN([XORG_STRICT_OPTION], [
29134f9ac78aSmrgAC_REQUIRE([XORG_CWARNFLAGS])
2914c27291ebSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
29154f9ac78aSmrg
29164f9ac78aSmrgAC_ARG_ENABLE(strict-compilation,
29174f9ac78aSmrg			  AS_HELP_STRING([--enable-strict-compilation],
29184f9ac78aSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
29194f9ac78aSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2920c27291ebSmrg
2921c27291ebSmrgAC_LANG_CASE(
2922c27291ebSmrg        [C], [
2923c27291ebSmrg                define([PREFIX], [C])
2924c27291ebSmrg        ],
2925c27291ebSmrg        [C++], [
2926c27291ebSmrg                define([PREFIX], [CXX])
2927c27291ebSmrg        ]
2928c27291ebSmrg)
2929c27291ebSmrg
2930c27291ebSmrg[STRICT_]PREFIX[FLAGS]=""
2931c27291ebSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
2932c27291ebSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
2933c27291ebSmrg
2934c27291ebSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
2935c27291ebSmrg# activate it with -Werror, so we add it here explicitly.
2936c27291ebSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
2937c27291ebSmrg
29384f9ac78aSmrgif test "x$STRICT_COMPILE" = "xyes"; then
2939c27291ebSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
2940c27291ebSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
29414f9ac78aSmrgfi
2942c27291ebSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
2943c27291ebSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2944c27291ebSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
29454f9ac78aSmrg]) # XORG_STRICT_OPTION
29464f9ac78aSmrg
29474f9ac78aSmrg# XORG_DEFAULT_OPTIONS
29484f9ac78aSmrg# --------------------
29494f9ac78aSmrg# Minimum version: 1.3.0
29504f9ac78aSmrg#
29514f9ac78aSmrg# Defines default options for X.Org modules.
29524f9ac78aSmrg#
29534f9ac78aSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
29544f9ac78aSmrgAC_REQUIRE([AC_PROG_INSTALL])
2955c27291ebSmrgXORG_COMPILER_FLAGS
29564f9ac78aSmrgXORG_CWARNFLAGS
29574f9ac78aSmrgXORG_STRICT_OPTION
29584f9ac78aSmrgXORG_RELEASE_VERSION
29594f9ac78aSmrgXORG_CHANGELOG
29604f9ac78aSmrgXORG_INSTALL
29614f9ac78aSmrgXORG_MANPAGE_SECTIONS
29624f9ac78aSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
29634f9ac78aSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
29644f9ac78aSmrg]) # XORG_DEFAULT_OPTIONS
29654f9ac78aSmrg
29664f9ac78aSmrg# XORG_INSTALL()
29674f9ac78aSmrg# ----------------
29684f9ac78aSmrg# Minimum version: 1.4.0
29694f9ac78aSmrg#
29704f9ac78aSmrg# Defines the variable INSTALL_CMD as the command to copy
29714f9ac78aSmrg# INSTALL from $prefix/share/util-macros.
29724f9ac78aSmrg#
29734f9ac78aSmrgAC_DEFUN([XORG_INSTALL], [
29744f9ac78aSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
29754f9ac78aSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
29764f9ac78aSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
29774f9ac78aSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
29784f9ac78aSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
29794f9ac78aSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
29804f9ac78aSmrgAC_SUBST([INSTALL_CMD])
29814f9ac78aSmrg]) # XORG_INSTALL
2982d1333322Smrgdnl Copyright 2005 Red Hat, Inc
2983d1333322Smrgdnl
2984d1333322Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
2985d1333322Smrgdnl documentation for any purpose is hereby granted without fee, provided that
2986d1333322Smrgdnl the above copyright notice appear in all copies and that both that
2987d1333322Smrgdnl copyright notice and this permission notice appear in supporting
2988d1333322Smrgdnl documentation.
2989d1333322Smrgdnl
2990d1333322Smrgdnl The above copyright notice and this permission notice shall be included
2991d1333322Smrgdnl in all copies or substantial portions of the Software.
2992d1333322Smrgdnl
2993d1333322Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2994d1333322Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2995d1333322Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2996d1333322Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2997d1333322Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2998d1333322Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2999d1333322Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3000d1333322Smrgdnl
3001d1333322Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3002d1333322Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3003d1333322Smrgdnl other dealings in this Software without prior written authorization
3004d1333322Smrgdnl from the copyright holders.
3005d1333322Smrgdnl
3006d1333322Smrg
3007d1333322Smrg# XORG_RELEASE_VERSION
3008d1333322Smrg# --------------------
30094f9ac78aSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3010d1333322Smrg 
3011d1333322SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3012d1333322Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3013d1333322Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3014d1333322Smrg		[Major version of this package])
3015d1333322Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3016d1333322Smrg	if test "x$PVM" = "x"; then
3017d1333322Smrg		PVM="0"
3018d1333322Smrg	fi
3019d1333322Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3020d1333322Smrg		[$PVM],
3021d1333322Smrg		[Minor version of this package])
3022d1333322Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3023d1333322Smrg	if test "x$PVP" = "x"; then
3024d1333322Smrg		PVP="0"
3025d1333322Smrg	fi
3026d1333322Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3027d1333322Smrg		[$PVP],
3028d1333322Smrg		[Patch version of this package])
3029d1333322Smrg])
3030d1333322Smrg
30314f9ac78aSmrg# XORG_CHANGELOG()
30324f9ac78aSmrg# ----------------
30334f9ac78aSmrg# Minimum version: 1.2.0
30344f9ac78aSmrg#
30354f9ac78aSmrg# Defines the variable CHANGELOG_CMD as the command to generate
30364f9ac78aSmrg# ChangeLog from git.
30374f9ac78aSmrg#
30384f9ac78aSmrg#
30394f9ac78aSmrgAC_DEFUN([XORG_CHANGELOG], [
30404f9ac78aSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
30414f9ac78aSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
30424f9ac78aSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
30434f9ac78aSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
30444f9ac78aSmrgAC_SUBST([CHANGELOG_CMD])
30454f9ac78aSmrg]) # XORG_CHANGELOG
30464f9ac78aSmrg
3047