aclocal.m4 revision f931275d
148af84faSmrg# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
266fe65f6Smrg
366fe65f6Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4a9274bcdSmrg# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
566fe65f6Smrg# This file is free software; the Free Software Foundation
666fe65f6Smrg# gives unlimited permission to copy and/or distribute it,
766fe65f6Smrg# with or without modifications, as long as this notice is preserved.
866fe65f6Smrg
966fe65f6Smrg# This program is distributed in the hope that it will be useful,
1066fe65f6Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1166fe65f6Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1266fe65f6Smrg# PARTICULAR PURPOSE.
1366fe65f6Smrg
1489d09728Smrgm4_ifndef([AC_AUTOCONF_VERSION],
1589d09728Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1648af84faSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
1748af84faSmrg[m4_warning([this file was generated for autoconf 2.68.
1889d09728SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
1989d09728SmrgIf you have problems, you may need to regenerate the build system entirely.
2089d09728SmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
2189d09728Smrg
22a9274bcdSmrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
23a9274bcdSmrg#
24a9274bcdSmrg# This file is free software; the Free Software Foundation
25a9274bcdSmrg# gives unlimited permission to copy and/or distribute it,
26a9274bcdSmrg# with or without modifications, as long as this notice is preserved.
2789d09728Smrg
28a9274bcdSmrg# AM_AUTOMAKE_VERSION(VERSION)
29a9274bcdSmrg# ----------------------------
30a9274bcdSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
31a9274bcdSmrg# generated from the m4 files accompanying Automake X.Y.
32a9274bcdSmrg# (This private macro should not be called outside this file.)
33a9274bcdSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
34a9274bcdSmrg[am__api_version='1.11'
35a9274bcdSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
36a9274bcdSmrgdnl require some minimum version.  Point them to the right macro.
3748af84faSmrgm4_if([$1], [1.11.1], [],
38a9274bcdSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
39a9274bcdSmrg])
40a9274bcdSmrg
41a9274bcdSmrg# _AM_AUTOCONF_VERSION(VERSION)
42a9274bcdSmrg# -----------------------------
43a9274bcdSmrg# aclocal traces this macro to find the Autoconf version.
44a9274bcdSmrg# This is a private macro too.  Using m4_define simplifies
45a9274bcdSmrg# the logic in aclocal, which can simply ignore this definition.
46a9274bcdSmrgm4_define([_AM_AUTOCONF_VERSION], [])
47a9274bcdSmrg
48a9274bcdSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
49a9274bcdSmrg# -------------------------------
50a9274bcdSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
51a9274bcdSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
52a9274bcdSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5348af84faSmrg[AM_AUTOMAKE_VERSION([1.11.1])dnl
54a9274bcdSmrgm4_ifndef([AC_AUTOCONF_VERSION],
55a9274bcdSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
56a9274bcdSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
57a9274bcdSmrg
58a9274bcdSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
59a9274bcdSmrg
60a9274bcdSmrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
6189d09728Smrg#
62a9274bcdSmrg# This file is free software; the Free Software Foundation
63a9274bcdSmrg# gives unlimited permission to copy and/or distribute it,
64a9274bcdSmrg# with or without modifications, as long as this notice is preserved.
65a9274bcdSmrg
66a9274bcdSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
67a9274bcdSmrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
68a9274bcdSmrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
6989d09728Smrg#
70a9274bcdSmrg# Of course, Automake must honor this variable whenever it calls a
71a9274bcdSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
72a9274bcdSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
73a9274bcdSmrg# depending on how configure is run.  This is pretty annoying, since
74a9274bcdSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
75a9274bcdSmrg# source directory, any form will work fine, but in subdirectories a
76a9274bcdSmrg# relative path needs to be adjusted first.
7789d09728Smrg#
78a9274bcdSmrg# $ac_aux_dir/missing
79a9274bcdSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
80a9274bcdSmrg# $top_srcdir/$ac_aux_dir/missing
81a9274bcdSmrg#    fails if $ac_aux_dir is absolute,
82a9274bcdSmrg#    fails when called from a subdirectory in a VPATH build with
83a9274bcdSmrg#          a relative $ac_aux_dir
8489d09728Smrg#
85a9274bcdSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
86a9274bcdSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
87a9274bcdSmrg# harmless because $srcdir is `.', but things will broke when you
88a9274bcdSmrg# start a VPATH build or use an absolute $srcdir.
8989d09728Smrg#
90a9274bcdSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
91a9274bcdSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
92a9274bcdSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
93a9274bcdSmrg# and then we would define $MISSING as
94a9274bcdSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
95a9274bcdSmrg# This will work as long as MISSING is not called from configure, because
96a9274bcdSmrg# unfortunately $(top_srcdir) has no meaning in configure.
97a9274bcdSmrg# However there are other variables, like CC, which are often used in
98a9274bcdSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
99a9274bcdSmrg#
100a9274bcdSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
101a9274bcdSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
102a9274bcdSmrg# configured tree to be moved without reconfiguration.
10366fe65f6Smrg
104a9274bcdSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
105a9274bcdSmrg[dnl Rely on autoconf to set up CDPATH properly.
106a9274bcdSmrgAC_PREREQ([2.50])dnl
107a9274bcdSmrg# expand $ac_aux_dir to an absolute path
108a9274bcdSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
109a9274bcdSmrg])
11066fe65f6Smrg
111a9274bcdSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11266fe65f6Smrg
113a9274bcdSmrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
114a9274bcdSmrg# Free Software Foundation, Inc.
11589d09728Smrg#
116a9274bcdSmrg# This file is free software; the Free Software Foundation
117a9274bcdSmrg# gives unlimited permission to copy and/or distribute it,
118a9274bcdSmrg# with or without modifications, as long as this notice is preserved.
11966fe65f6Smrg
120a9274bcdSmrg# serial 9
12166fe65f6Smrg
122a9274bcdSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
123a9274bcdSmrg# -------------------------------------
124a9274bcdSmrg# Define a conditional.
125a9274bcdSmrgAC_DEFUN([AM_CONDITIONAL],
126a9274bcdSmrg[AC_PREREQ(2.52)dnl
127a9274bcdSmrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
128a9274bcdSmrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
129a9274bcdSmrgAC_SUBST([$1_TRUE])dnl
130a9274bcdSmrgAC_SUBST([$1_FALSE])dnl
131a9274bcdSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
132a9274bcdSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
133a9274bcdSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
134a9274bcdSmrgif $2; then
135a9274bcdSmrg  $1_TRUE=
136a9274bcdSmrg  $1_FALSE='#'
137a9274bcdSmrgelse
138a9274bcdSmrg  $1_TRUE='#'
139a9274bcdSmrg  $1_FALSE=
14066fe65f6Smrgfi
141a9274bcdSmrgAC_CONFIG_COMMANDS_PRE(
142a9274bcdSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
143a9274bcdSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
144a9274bcdSmrgUsually this means the macro was only invoked conditionally.]])
145a9274bcdSmrgfi])])
14666fe65f6Smrg
147a9274bcdSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
148a9274bcdSmrg# Free Software Foundation, Inc.
149a9274bcdSmrg#
150a9274bcdSmrg# This file is free software; the Free Software Foundation
151a9274bcdSmrg# gives unlimited permission to copy and/or distribute it,
152a9274bcdSmrg# with or without modifications, as long as this notice is preserved.
15366fe65f6Smrg
154a9274bcdSmrg# serial 10
15566fe65f6Smrg
156a9274bcdSmrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
157a9274bcdSmrg# written in clear, in which case automake, when reading aclocal.m4,
158a9274bcdSmrg# will think it sees a *use*, and therefore will trigger all it's
159a9274bcdSmrg# C support machinery.  Also note that it means that autoscan, seeing
160a9274bcdSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
16166fe65f6Smrg
16266fe65f6Smrg
163a9274bcdSmrg# _AM_DEPENDENCIES(NAME)
164a9274bcdSmrg# ----------------------
165a9274bcdSmrg# See how the compiler implements dependency checking.
166a9274bcdSmrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
167a9274bcdSmrg# We try a few techniques and use that to set a single cache variable.
168a9274bcdSmrg#
169a9274bcdSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
170a9274bcdSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
171a9274bcdSmrg# dependency, and given that the user is not expected to run this macro,
172a9274bcdSmrg# just rely on AC_PROG_CC.
173a9274bcdSmrgAC_DEFUN([_AM_DEPENDENCIES],
174a9274bcdSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
175a9274bcdSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
176a9274bcdSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
177a9274bcdSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
17866fe65f6Smrg
179a9274bcdSmrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
180a9274bcdSmrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
181a9274bcdSmrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
182a9274bcdSmrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
183a9274bcdSmrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
184a9274bcdSmrg                   [depcc="$$1"   am_compiler_list=])
18566fe65f6Smrg
186a9274bcdSmrgAC_CACHE_CHECK([dependency style of $depcc],
187a9274bcdSmrg               [am_cv_$1_dependencies_compiler_type],
188a9274bcdSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
189a9274bcdSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
190a9274bcdSmrg  # making bogus files that we don't know about and never remove.  For
191a9274bcdSmrg  # instance it was reported that on HP-UX the gcc test will end up
192a9274bcdSmrg  # making a dummy file named `D' -- because `-MD' means `put the output
193a9274bcdSmrg  # in D'.
194a9274bcdSmrg  mkdir conftest.dir
195a9274bcdSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
196a9274bcdSmrg  # using a relative directory.
197a9274bcdSmrg  cp "$am_depcomp" conftest.dir
198a9274bcdSmrg  cd conftest.dir
199a9274bcdSmrg  # We will build objects and dependencies in a subdirectory because
200a9274bcdSmrg  # it helps to detect inapplicable dependency modes.  For instance
201a9274bcdSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
202a9274bcdSmrg  # side effect of compilation, but ICC will put the dependencies in
203a9274bcdSmrg  # the current directory while Tru64 will put them in the object
204a9274bcdSmrg  # directory.
205a9274bcdSmrg  mkdir sub
20689d09728Smrg
207a9274bcdSmrg  am_cv_$1_dependencies_compiler_type=none
208a9274bcdSmrg  if test "$am_compiler_list" = ""; then
209a9274bcdSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
210a9274bcdSmrg  fi
211a9274bcdSmrg  am__universal=false
212a9274bcdSmrg  m4_case([$1], [CC],
213a9274bcdSmrg    [case " $depcc " in #(
214a9274bcdSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
215a9274bcdSmrg     esac],
216a9274bcdSmrg    [CXX],
217a9274bcdSmrg    [case " $depcc " in #(
218a9274bcdSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
219a9274bcdSmrg     esac])
22066fe65f6Smrg
221a9274bcdSmrg  for depmode in $am_compiler_list; do
222a9274bcdSmrg    # Setup a source with many dependencies, because some compilers
223a9274bcdSmrg    # like to wrap large dependency lists on column 80 (with \), and
224a9274bcdSmrg    # we should not choose a depcomp mode which is confused by this.
225a9274bcdSmrg    #
226a9274bcdSmrg    # We need to recreate these files for each test, as the compiler may
227a9274bcdSmrg    # overwrite some of them when testing with obscure command lines.
228a9274bcdSmrg    # This happens at least with the AIX C compiler.
229a9274bcdSmrg    : > sub/conftest.c
230a9274bcdSmrg    for i in 1 2 3 4 5 6; do
231a9274bcdSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
232a9274bcdSmrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
233a9274bcdSmrg      # Solaris 8's {/usr,}/bin/sh.
234a9274bcdSmrg      touch sub/conftst$i.h
235a9274bcdSmrg    done
236a9274bcdSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
23766fe65f6Smrg
238a9274bcdSmrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
239a9274bcdSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
240a9274bcdSmrg    # handle `-M -o', and we need to detect this.  Also, some Intel
241a9274bcdSmrg    # versions had trouble with output in subdirs
242a9274bcdSmrg    am__obj=sub/conftest.${OBJEXT-o}
243a9274bcdSmrg    am__minus_obj="-o $am__obj"
244a9274bcdSmrg    case $depmode in
245a9274bcdSmrg    gcc)
246a9274bcdSmrg      # This depmode causes a compiler race in universal mode.
247a9274bcdSmrg      test "$am__universal" = false || continue
248a9274bcdSmrg      ;;
249a9274bcdSmrg    nosideeffect)
250a9274bcdSmrg      # after this tag, mechanisms are not by side-effect, so they'll
251a9274bcdSmrg      # only be used when explicitly requested
252a9274bcdSmrg      if test "x$enable_dependency_tracking" = xyes; then
253a9274bcdSmrg	continue
254a9274bcdSmrg      else
255a9274bcdSmrg	break
256a9274bcdSmrg      fi
257a9274bcdSmrg      ;;
258a9274bcdSmrg    msvisualcpp | msvcmsys)
259a9274bcdSmrg      # This compiler won't grok `-c -o', but also, the minuso test has
260a9274bcdSmrg      # not run yet.  These depmodes are late enough in the game, and
261a9274bcdSmrg      # so weak that their functioning should not be impacted.
262a9274bcdSmrg      am__obj=conftest.${OBJEXT-o}
263a9274bcdSmrg      am__minus_obj=
264a9274bcdSmrg      ;;
265a9274bcdSmrg    none) break ;;
266a9274bcdSmrg    esac
267a9274bcdSmrg    if depmode=$depmode \
268a9274bcdSmrg       source=sub/conftest.c object=$am__obj \
269a9274bcdSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
270a9274bcdSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
271a9274bcdSmrg         >/dev/null 2>conftest.err &&
272a9274bcdSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
273a9274bcdSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
274a9274bcdSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
275a9274bcdSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
276a9274bcdSmrg      # icc doesn't choke on unknown options, it will just issue warnings
277a9274bcdSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
278a9274bcdSmrg      # that says an option was ignored or not supported.
279a9274bcdSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
280a9274bcdSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
281a9274bcdSmrg      # The diagnosis changed in icc 8.0:
282a9274bcdSmrg      #   icc: Command line remark: option '-MP' not supported
283a9274bcdSmrg      if (grep 'ignoring option' conftest.err ||
284a9274bcdSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
285a9274bcdSmrg        am_cv_$1_dependencies_compiler_type=$depmode
286a9274bcdSmrg        break
287a9274bcdSmrg      fi
288a9274bcdSmrg    fi
289a9274bcdSmrg  done
29066fe65f6Smrg
291a9274bcdSmrg  cd ..
292a9274bcdSmrg  rm -rf conftest.dir
29366fe65f6Smrgelse
294a9274bcdSmrg  am_cv_$1_dependencies_compiler_type=none
29566fe65f6Smrgfi
296a9274bcdSmrg])
297a9274bcdSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
298a9274bcdSmrgAM_CONDITIONAL([am__fastdep$1], [
299a9274bcdSmrg  test "x$enable_dependency_tracking" != xno \
300a9274bcdSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
301a9274bcdSmrg])
30266fe65f6Smrg
30366fe65f6Smrg
304a9274bcdSmrg# AM_SET_DEPDIR
305a9274bcdSmrg# -------------
306a9274bcdSmrg# Choose a directory name for dependency files.
307a9274bcdSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
308a9274bcdSmrgAC_DEFUN([AM_SET_DEPDIR],
309a9274bcdSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
310a9274bcdSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
311a9274bcdSmrg])
31266fe65f6Smrg
31366fe65f6Smrg
314a9274bcdSmrg# AM_DEP_TRACK
315a9274bcdSmrg# ------------
316a9274bcdSmrgAC_DEFUN([AM_DEP_TRACK],
317a9274bcdSmrg[AC_ARG_ENABLE(dependency-tracking,
318a9274bcdSmrg[  --disable-dependency-tracking  speeds up one-time build
319a9274bcdSmrg  --enable-dependency-tracking   do not reject slow dependency extractors])
320a9274bcdSmrgif test "x$enable_dependency_tracking" != xno; then
321a9274bcdSmrg  am_depcomp="$ac_aux_dir/depcomp"
322a9274bcdSmrg  AMDEPBACKSLASH='\'
32366fe65f6Smrgfi
324a9274bcdSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
325a9274bcdSmrgAC_SUBST([AMDEPBACKSLASH])dnl
326a9274bcdSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
327a9274bcdSmrg])
32866fe65f6Smrg
329a9274bcdSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
33066fe65f6Smrg
331a9274bcdSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
332a9274bcdSmrg# Free Software Foundation, Inc.
333a9274bcdSmrg#
334a9274bcdSmrg# This file is free software; the Free Software Foundation
335a9274bcdSmrg# gives unlimited permission to copy and/or distribute it,
336a9274bcdSmrg# with or without modifications, as long as this notice is preserved.
33766fe65f6Smrg
338a9274bcdSmrg#serial 5
33966fe65f6Smrg
340a9274bcdSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
341a9274bcdSmrg# ------------------------------
342a9274bcdSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
343a9274bcdSmrg[{
344a9274bcdSmrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
345a9274bcdSmrg  # are listed without --file.  Let's play safe and only enable the eval
346a9274bcdSmrg  # if we detect the quoting.
347a9274bcdSmrg  case $CONFIG_FILES in
348a9274bcdSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
349a9274bcdSmrg  *)   set x $CONFIG_FILES ;;
350a9274bcdSmrg  esac
351a9274bcdSmrg  shift
352a9274bcdSmrg  for mf
353a9274bcdSmrg  do
354a9274bcdSmrg    # Strip MF so we end up with the name of the file.
355a9274bcdSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
356a9274bcdSmrg    # Check whether this is an Automake generated Makefile or not.
357a9274bcdSmrg    # We used to match only the files named `Makefile.in', but
358a9274bcdSmrg    # some people rename them; so instead we look at the file content.
359a9274bcdSmrg    # Grep'ing the first line is not enough: some people post-process
360a9274bcdSmrg    # each Makefile.in and add a new line on top of each file to say so.
361a9274bcdSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
362a9274bcdSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
363a9274bcdSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
364a9274bcdSmrg      dirpart=`AS_DIRNAME("$mf")`
365a9274bcdSmrg    else
366a9274bcdSmrg      continue
367a9274bcdSmrg    fi
368a9274bcdSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
369a9274bcdSmrg    # from the Makefile without running `make'.
370a9274bcdSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
371a9274bcdSmrg    test -z "$DEPDIR" && continue
372a9274bcdSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
373a9274bcdSmrg    test -z "am__include" && continue
374a9274bcdSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
375a9274bcdSmrg    # When using ansi2knr, U may be empty or an underscore; expand it
376a9274bcdSmrg    U=`sed -n 's/^U = //p' < "$mf"`
377a9274bcdSmrg    # Find all dependency output files, they are included files with
378a9274bcdSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
379a9274bcdSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
380a9274bcdSmrg    # expansion.
381a9274bcdSmrg    for file in `sed -n "
382a9274bcdSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
383a9274bcdSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
384a9274bcdSmrg      # Make sure the directory exists.
385a9274bcdSmrg      test -f "$dirpart/$file" && continue
386a9274bcdSmrg      fdir=`AS_DIRNAME(["$file"])`
387a9274bcdSmrg      AS_MKDIR_P([$dirpart/$fdir])
388a9274bcdSmrg      # echo "creating $dirpart/$file"
389a9274bcdSmrg      echo '# dummy' > "$dirpart/$file"
390a9274bcdSmrg    done
391a9274bcdSmrg  done
392a9274bcdSmrg}
393a9274bcdSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
39466fe65f6Smrg
395a9274bcdSmrg
396a9274bcdSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
397a9274bcdSmrg# -----------------------------
398a9274bcdSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
39989d09728Smrg#
400a9274bcdSmrg# This code is only required when automatic dependency tracking
401a9274bcdSmrg# is enabled.  FIXME.  This creates each `.P' file that we will
402a9274bcdSmrg# need in order to bootstrap the dependency handling code.
403a9274bcdSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
404a9274bcdSmrg[AC_CONFIG_COMMANDS([depfiles],
405a9274bcdSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
406a9274bcdSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
407a9274bcdSmrg])
40889d09728Smrg
409a9274bcdSmrg# Do all the work for Automake.                             -*- Autoconf -*-
41089d09728Smrg
411a9274bcdSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
412a9274bcdSmrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
413a9274bcdSmrg#
414a9274bcdSmrg# This file is free software; the Free Software Foundation
415a9274bcdSmrg# gives unlimited permission to copy and/or distribute it,
416a9274bcdSmrg# with or without modifications, as long as this notice is preserved.
417a9274bcdSmrg
418a9274bcdSmrg# serial 16
419a9274bcdSmrg
420a9274bcdSmrg# This macro actually does too much.  Some checks are only needed if
421a9274bcdSmrg# your package does certain things.  But this isn't really a big deal.
422a9274bcdSmrg
423a9274bcdSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
424a9274bcdSmrg# AM_INIT_AUTOMAKE([OPTIONS])
425a9274bcdSmrg# -----------------------------------------------
426a9274bcdSmrg# The call with PACKAGE and VERSION arguments is the old style
427a9274bcdSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
428a9274bcdSmrg# and VERSION should now be passed to AC_INIT and removed from
429a9274bcdSmrg# the call to AM_INIT_AUTOMAKE.
430a9274bcdSmrg# We support both call styles for the transition.  After
431a9274bcdSmrg# the next Automake release, Autoconf can make the AC_INIT
432a9274bcdSmrg# arguments mandatory, and then we can depend on a new Autoconf
433a9274bcdSmrg# release and drop the old call support.
434a9274bcdSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
435a9274bcdSmrg[AC_PREREQ([2.62])dnl
436a9274bcdSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
437a9274bcdSmrgdnl the ones we care about.
438a9274bcdSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
439a9274bcdSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
440a9274bcdSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
441a9274bcdSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
442a9274bcdSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
443a9274bcdSmrg  # is not polluted with repeated "-I."
444a9274bcdSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
445a9274bcdSmrg  # test to see if srcdir already configured
446a9274bcdSmrg  if test -f $srcdir/config.status; then
447a9274bcdSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
448a9274bcdSmrg  fi
44989d09728Smrgfi
45089d09728Smrg
451a9274bcdSmrg# test whether we have cygpath
452a9274bcdSmrgif test -z "$CYGPATH_W"; then
453a9274bcdSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
454a9274bcdSmrg    CYGPATH_W='cygpath -w'
455a9274bcdSmrg  else
456a9274bcdSmrg    CYGPATH_W=echo
457a9274bcdSmrg  fi
45889d09728Smrgfi
459a9274bcdSmrgAC_SUBST([CYGPATH_W])
46089d09728Smrg
461a9274bcdSmrg# Define the identity of the package.
462a9274bcdSmrgdnl Distinguish between old-style and new-style calls.
463a9274bcdSmrgm4_ifval([$2],
464a9274bcdSmrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
465a9274bcdSmrg AC_SUBST([PACKAGE], [$1])dnl
466a9274bcdSmrg AC_SUBST([VERSION], [$2])],
467a9274bcdSmrg[_AM_SET_OPTIONS([$1])dnl
468a9274bcdSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
469a9274bcdSmrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
470a9274bcdSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
471a9274bcdSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
472a9274bcdSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
47389d09728Smrg
474a9274bcdSmrg_AM_IF_OPTION([no-define],,
475a9274bcdSmrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
476a9274bcdSmrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
47789d09728Smrg
478a9274bcdSmrg# Some tools Automake needs.
479a9274bcdSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
480a9274bcdSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
481a9274bcdSmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
482a9274bcdSmrgAM_MISSING_PROG(AUTOCONF, autoconf)
483a9274bcdSmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
484a9274bcdSmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
485a9274bcdSmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
486a9274bcdSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
487a9274bcdSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
488a9274bcdSmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
489a9274bcdSmrg# We need awk for the "check" target.  The system "awk" is bad on
490a9274bcdSmrg# some platforms.
491a9274bcdSmrgAC_REQUIRE([AC_PROG_AWK])dnl
492a9274bcdSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
493a9274bcdSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
494a9274bcdSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
495a9274bcdSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
496a9274bcdSmrg			     [_AM_PROG_TAR([v7])])])
497a9274bcdSmrg_AM_IF_OPTION([no-dependencies],,
498a9274bcdSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
499a9274bcdSmrg		  [_AM_DEPENDENCIES(CC)],
500a9274bcdSmrg		  [define([AC_PROG_CC],
501a9274bcdSmrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
502a9274bcdSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
503a9274bcdSmrg		  [_AM_DEPENDENCIES(CXX)],
504a9274bcdSmrg		  [define([AC_PROG_CXX],
505a9274bcdSmrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
506a9274bcdSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
507a9274bcdSmrg		  [_AM_DEPENDENCIES(OBJC)],
508a9274bcdSmrg		  [define([AC_PROG_OBJC],
509a9274bcdSmrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
510a9274bcdSmrg])
511a9274bcdSmrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
512a9274bcdSmrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
513a9274bcdSmrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
514a9274bcdSmrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
515a9274bcdSmrgAC_CONFIG_COMMANDS_PRE(dnl
516a9274bcdSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
517a9274bcdSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
518a9274bcdSmrg])
519a9274bcdSmrg
520a9274bcdSmrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
521a9274bcdSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
522a9274bcdSmrgdnl mangled by Autoconf and run in a shell conditional statement.
523a9274bcdSmrgm4_define([_AC_COMPILER_EXEEXT],
524a9274bcdSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
525a9274bcdSmrg
526a9274bcdSmrg
527a9274bcdSmrg# When config.status generates a header, we must update the stamp-h file.
528a9274bcdSmrg# This file resides in the same directory as the config header
529a9274bcdSmrg# that is generated.  The stamp files are numbered to have different names.
530a9274bcdSmrg
531a9274bcdSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
532a9274bcdSmrg# loop where config.status creates the headers, so we can generate
533a9274bcdSmrg# our stamp files there.
534a9274bcdSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
535a9274bcdSmrg[# Compute $1's index in $config_headers.
536a9274bcdSmrg_am_arg=$1
537a9274bcdSmrg_am_stamp_count=1
538a9274bcdSmrgfor _am_header in $config_headers :; do
539a9274bcdSmrg  case $_am_header in
540a9274bcdSmrg    $_am_arg | $_am_arg:* )
541a9274bcdSmrg      break ;;
542a9274bcdSmrg    * )
543a9274bcdSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
544a9274bcdSmrg  esac
545a9274bcdSmrgdone
546a9274bcdSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
547a9274bcdSmrg
548a9274bcdSmrg# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
54989d09728Smrg#
550a9274bcdSmrg# This file is free software; the Free Software Foundation
551a9274bcdSmrg# gives unlimited permission to copy and/or distribute it,
552a9274bcdSmrg# with or without modifications, as long as this notice is preserved.
55366fe65f6Smrg
554a9274bcdSmrg# AM_PROG_INSTALL_SH
555a9274bcdSmrg# ------------------
556a9274bcdSmrg# Define $install_sh.
557a9274bcdSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
558a9274bcdSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
559a9274bcdSmrgif test x"${install_sh}" != xset; then
560a9274bcdSmrg  case $am_aux_dir in
561a9274bcdSmrg  *\ * | *\	*)
562a9274bcdSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
563a9274bcdSmrg  *)
564a9274bcdSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
565a9274bcdSmrg  esac
56666fe65f6Smrgfi
567a9274bcdSmrgAC_SUBST(install_sh)])
56866fe65f6Smrg
569a9274bcdSmrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
570a9274bcdSmrg#
571a9274bcdSmrg# This file is free software; the Free Software Foundation
572a9274bcdSmrg# gives unlimited permission to copy and/or distribute it,
573a9274bcdSmrg# with or without modifications, as long as this notice is preserved.
574a9274bcdSmrg
575a9274bcdSmrg# serial 2
576a9274bcdSmrg
577a9274bcdSmrg# Check whether the underlying file-system supports filenames
578a9274bcdSmrg# with a leading dot.  For instance MS-DOS doesn't.
579a9274bcdSmrgAC_DEFUN([AM_SET_LEADING_DOT],
580a9274bcdSmrg[rm -rf .tst 2>/dev/null
581a9274bcdSmrgmkdir .tst 2>/dev/null
582a9274bcdSmrgif test -d .tst; then
583a9274bcdSmrg  am__leading_dot=.
58466fe65f6Smrgelse
585a9274bcdSmrg  am__leading_dot=_
58666fe65f6Smrgfi
587a9274bcdSmrgrmdir .tst 2>/dev/null
588a9274bcdSmrgAC_SUBST([am__leading_dot])])
58966fe65f6Smrg
590a9274bcdSmrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
591a9274bcdSmrg# From Jim Meyering
59266fe65f6Smrg
593a9274bcdSmrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
594a9274bcdSmrg# Free Software Foundation, Inc.
59589d09728Smrg#
596a9274bcdSmrg# This file is free software; the Free Software Foundation
597a9274bcdSmrg# gives unlimited permission to copy and/or distribute it,
598a9274bcdSmrg# with or without modifications, as long as this notice is preserved.
59989d09728Smrg
600a9274bcdSmrg# serial 5
60189d09728Smrg
602a9274bcdSmrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
603a9274bcdSmrg# ----------------------------------
604a9274bcdSmrg# Control maintainer-specific portions of Makefiles.
605a9274bcdSmrg# Default is to disable them, unless `enable' is passed literally.
606a9274bcdSmrg# For symmetry, `disable' may be passed as well.  Anyway, the user
607a9274bcdSmrg# can override the default with the --enable/--disable switch.
608a9274bcdSmrgAC_DEFUN([AM_MAINTAINER_MODE],
609a9274bcdSmrg[m4_case(m4_default([$1], [disable]),
610a9274bcdSmrg       [enable], [m4_define([am_maintainer_other], [disable])],
611a9274bcdSmrg       [disable], [m4_define([am_maintainer_other], [enable])],
612a9274bcdSmrg       [m4_define([am_maintainer_other], [enable])
613a9274bcdSmrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
614a9274bcdSmrgAC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
615a9274bcdSmrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
616a9274bcdSmrg  AC_ARG_ENABLE([maintainer-mode],
617a9274bcdSmrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
618a9274bcdSmrg			  (and sometimes confusing) to the casual installer],
619a9274bcdSmrg      [USE_MAINTAINER_MODE=$enableval],
620a9274bcdSmrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
621a9274bcdSmrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
622a9274bcdSmrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
623a9274bcdSmrg  MAINT=$MAINTAINER_MODE_TRUE
624a9274bcdSmrg  AC_SUBST([MAINT])dnl
625a9274bcdSmrg]
626a9274bcdSmrg)
62789d09728Smrg
628a9274bcdSmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
62989d09728Smrg
630a9274bcdSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
631a9274bcdSmrg
632a9274bcdSmrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
63389d09728Smrg#
634a9274bcdSmrg# This file is free software; the Free Software Foundation
635a9274bcdSmrg# gives unlimited permission to copy and/or distribute it,
636a9274bcdSmrg# with or without modifications, as long as this notice is preserved.
63789d09728Smrg
638a9274bcdSmrg# serial 4
63989d09728Smrg
640a9274bcdSmrg# AM_MAKE_INCLUDE()
641a9274bcdSmrg# -----------------
642a9274bcdSmrg# Check to see how make treats includes.
643a9274bcdSmrgAC_DEFUN([AM_MAKE_INCLUDE],
644a9274bcdSmrg[am_make=${MAKE-make}
645a9274bcdSmrgcat > confinc << 'END'
646a9274bcdSmrgam__doit:
647a9274bcdSmrg	@echo this is the am__doit target
648a9274bcdSmrg.PHONY: am__doit
649a9274bcdSmrgEND
650a9274bcdSmrg# If we don't find an include directive, just comment out the code.
651a9274bcdSmrgAC_MSG_CHECKING([for style of include used by $am_make])
652a9274bcdSmrgam__include="#"
653a9274bcdSmrgam__quote=
654a9274bcdSmrg_am_result=none
655a9274bcdSmrg# First try GNU make style include.
656a9274bcdSmrgecho "include confinc" > confmf
657a9274bcdSmrg# Ignore all kinds of additional output from `make'.
658a9274bcdSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
659a9274bcdSmrg*the\ am__doit\ target*)
660a9274bcdSmrg  am__include=include
661a9274bcdSmrg  am__quote=
662a9274bcdSmrg  _am_result=GNU
663a9274bcdSmrg  ;;
664a9274bcdSmrgesac
665a9274bcdSmrg# Now try BSD make style include.
666a9274bcdSmrgif test "$am__include" = "#"; then
667a9274bcdSmrg   echo '.include "confinc"' > confmf
668a9274bcdSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
669a9274bcdSmrg   *the\ am__doit\ target*)
670a9274bcdSmrg     am__include=.include
671a9274bcdSmrg     am__quote="\""
672a9274bcdSmrg     _am_result=BSD
673a9274bcdSmrg     ;;
674a9274bcdSmrg   esac
67589d09728Smrgfi
676a9274bcdSmrgAC_SUBST([am__include])
677a9274bcdSmrgAC_SUBST([am__quote])
678a9274bcdSmrgAC_MSG_RESULT([$_am_result])
679a9274bcdSmrgrm -f confinc confmf
68066fe65f6Smrg])
68166fe65f6Smrg
682a9274bcdSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
68389d09728Smrg
684a9274bcdSmrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
685a9274bcdSmrg# Free Software Foundation, Inc.
68666fe65f6Smrg#
68766fe65f6Smrg# This file is free software; the Free Software Foundation
68866fe65f6Smrg# gives unlimited permission to copy and/or distribute it,
68966fe65f6Smrg# with or without modifications, as long as this notice is preserved.
69066fe65f6Smrg
691a9274bcdSmrg# serial 6
69289d09728Smrg
693a9274bcdSmrg# AM_MISSING_PROG(NAME, PROGRAM)
694a9274bcdSmrg# ------------------------------
695a9274bcdSmrgAC_DEFUN([AM_MISSING_PROG],
696a9274bcdSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
697a9274bcdSmrg$1=${$1-"${am_missing_run}$2"}
698a9274bcdSmrgAC_SUBST($1)])
69966fe65f6Smrg
70066fe65f6Smrg
701a9274bcdSmrg# AM_MISSING_HAS_RUN
702a9274bcdSmrg# ------------------
703a9274bcdSmrg# Define MISSING if not defined so far and test if it supports --run.
704a9274bcdSmrg# If it does, set am_missing_run to use it, otherwise, to nothing.
705a9274bcdSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
706a9274bcdSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
707a9274bcdSmrgAC_REQUIRE_AUX_FILE([missing])dnl
708a9274bcdSmrgif test x"${MISSING+set}" != xset; then
709a9274bcdSmrg  case $am_aux_dir in
710a9274bcdSmrg  *\ * | *\	*)
711a9274bcdSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
712a9274bcdSmrg  *)
713a9274bcdSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
714a9274bcdSmrg  esac
715a9274bcdSmrgfi
716a9274bcdSmrg# Use eval to expand $SHELL
717a9274bcdSmrgif eval "$MISSING --run true"; then
718a9274bcdSmrg  am_missing_run="$MISSING --run "
719a9274bcdSmrgelse
720a9274bcdSmrg  am_missing_run=
721a9274bcdSmrg  AC_MSG_WARN([`missing' script is too old or missing])
722a9274bcdSmrgfi
723a9274bcdSmrg])
72466fe65f6Smrg
725a9274bcdSmrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
72666fe65f6Smrg#
72766fe65f6Smrg# This file is free software; the Free Software Foundation
72866fe65f6Smrg# gives unlimited permission to copy and/or distribute it,
72966fe65f6Smrg# with or without modifications, as long as this notice is preserved.
73066fe65f6Smrg
731a9274bcdSmrg# AM_PROG_MKDIR_P
732a9274bcdSmrg# ---------------
733a9274bcdSmrg# Check for `mkdir -p'.
734a9274bcdSmrgAC_DEFUN([AM_PROG_MKDIR_P],
735a9274bcdSmrg[AC_PREREQ([2.60])dnl
736a9274bcdSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
737a9274bcdSmrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
738a9274bcdSmrgdnl while keeping a definition of mkdir_p for backward compatibility.
739a9274bcdSmrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
740a9274bcdSmrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
741a9274bcdSmrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
742a9274bcdSmrgdnl adjustment using top_builddir (which is defined more often than
743a9274bcdSmrgdnl MKDIR_P).
744a9274bcdSmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
745a9274bcdSmrgcase $mkdir_p in
746a9274bcdSmrg  [[\\/$]]* | ?:[[\\/]]*) ;;
747a9274bcdSmrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
748a9274bcdSmrgesac
74966fe65f6Smrg])
75066fe65f6Smrg
751a9274bcdSmrg# Helper functions for option handling.                     -*- Autoconf -*-
75266fe65f6Smrg
753a9274bcdSmrg# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
75466fe65f6Smrg#
75566fe65f6Smrg# This file is free software; the Free Software Foundation
75666fe65f6Smrg# gives unlimited permission to copy and/or distribute it,
75766fe65f6Smrg# with or without modifications, as long as this notice is preserved.
75866fe65f6Smrg
759a9274bcdSmrg# serial 4
76066fe65f6Smrg
761a9274bcdSmrg# _AM_MANGLE_OPTION(NAME)
762a9274bcdSmrg# -----------------------
763a9274bcdSmrgAC_DEFUN([_AM_MANGLE_OPTION],
764a9274bcdSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
76566fe65f6Smrg
766a9274bcdSmrg# _AM_SET_OPTION(NAME)
767a9274bcdSmrg# ------------------------------
768a9274bcdSmrg# Set option NAME.  Presently that only means defining a flag for this option.
769a9274bcdSmrgAC_DEFUN([_AM_SET_OPTION],
770a9274bcdSmrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
77166fe65f6Smrg
772a9274bcdSmrg# _AM_SET_OPTIONS(OPTIONS)
773a9274bcdSmrg# ----------------------------------
774a9274bcdSmrg# OPTIONS is a space-separated list of Automake options.
775a9274bcdSmrgAC_DEFUN([_AM_SET_OPTIONS],
776a9274bcdSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
77766fe65f6Smrg
778a9274bcdSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
779a9274bcdSmrg# -------------------------------------------
780a9274bcdSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
781a9274bcdSmrgAC_DEFUN([_AM_IF_OPTION],
782a9274bcdSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
78366fe65f6Smrg
784a9274bcdSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
78566fe65f6Smrg
786a9274bcdSmrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
787a9274bcdSmrg# Free Software Foundation, Inc.
78866fe65f6Smrg#
789a9274bcdSmrg# This file is free software; the Free Software Foundation
790a9274bcdSmrg# gives unlimited permission to copy and/or distribute it,
791a9274bcdSmrg# with or without modifications, as long as this notice is preserved.
79266fe65f6Smrg
793a9274bcdSmrg# serial 5
79466fe65f6Smrg
795a9274bcdSmrg# AM_SANITY_CHECK
796a9274bcdSmrg# ---------------
797a9274bcdSmrgAC_DEFUN([AM_SANITY_CHECK],
798a9274bcdSmrg[AC_MSG_CHECKING([whether build environment is sane])
799a9274bcdSmrg# Just in case
800a9274bcdSmrgsleep 1
801a9274bcdSmrgecho timestamp > conftest.file
802a9274bcdSmrg# Reject unsafe characters in $srcdir or the absolute working directory
803a9274bcdSmrg# name.  Accept space and tab only in the latter.
804a9274bcdSmrgam_lf='
805a9274bcdSmrg'
806a9274bcdSmrgcase `pwd` in
807a9274bcdSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
808a9274bcdSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
809a9274bcdSmrgesac
810a9274bcdSmrgcase $srcdir in
811a9274bcdSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
812a9274bcdSmrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
813a9274bcdSmrgesac
81466fe65f6Smrg
815a9274bcdSmrg# Do `set' in a subshell so we don't clobber the current shell's
816a9274bcdSmrg# arguments.  Must try -L first in case configure is actually a
817a9274bcdSmrg# symlink; some systems play weird games with the mod time of symlinks
818a9274bcdSmrg# (eg FreeBSD returns the mod time of the symlink's containing
819a9274bcdSmrg# directory).
820a9274bcdSmrgif (
821a9274bcdSmrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
822a9274bcdSmrg   if test "$[*]" = "X"; then
823a9274bcdSmrg      # -L didn't work.
824a9274bcdSmrg      set X `ls -t "$srcdir/configure" conftest.file`
825a9274bcdSmrg   fi
826a9274bcdSmrg   rm -f conftest.file
827a9274bcdSmrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
828a9274bcdSmrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
82966fe65f6Smrg
830a9274bcdSmrg      # If neither matched, then we have a broken ls.  This can happen
831a9274bcdSmrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
832a9274bcdSmrg      # broken ls alias from the environment.  This has actually
833a9274bcdSmrg      # happened.  Such a system could not be considered "sane".
834a9274bcdSmrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
835a9274bcdSmrgalias in your environment])
836a9274bcdSmrg   fi
83766fe65f6Smrg
838a9274bcdSmrg   test "$[2]" = conftest.file
839a9274bcdSmrg   )
840a9274bcdSmrgthen
841a9274bcdSmrg   # Ok.
842a9274bcdSmrg   :
84366fe65f6Smrgelse
844a9274bcdSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
845a9274bcdSmrgCheck your system clock])
84666fe65f6Smrgfi
847a9274bcdSmrgAC_MSG_RESULT(yes)])
84866fe65f6Smrg
849a9274bcdSmrg# Copyright (C) 2009  Free Software Foundation, Inc.
85066fe65f6Smrg#
85166fe65f6Smrg# This file is free software; the Free Software Foundation
85266fe65f6Smrg# gives unlimited permission to copy and/or distribute it,
85366fe65f6Smrg# with or without modifications, as long as this notice is preserved.
85466fe65f6Smrg
855a9274bcdSmrg# serial 1
85666fe65f6Smrg
857a9274bcdSmrg# AM_SILENT_RULES([DEFAULT])
858a9274bcdSmrg# --------------------------
859a9274bcdSmrg# Enable less verbose build rules; with the default set to DEFAULT
860a9274bcdSmrg# (`yes' being less verbose, `no' or empty being verbose).
861a9274bcdSmrgAC_DEFUN([AM_SILENT_RULES],
862a9274bcdSmrg[AC_ARG_ENABLE([silent-rules],
863a9274bcdSmrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
864a9274bcdSmrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
865a9274bcdSmrgcase $enable_silent_rules in
866a9274bcdSmrgyes) AM_DEFAULT_VERBOSITY=0;;
867a9274bcdSmrgno)  AM_DEFAULT_VERBOSITY=1;;
868a9274bcdSmrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
86989d09728Smrgesac
870a9274bcdSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
871a9274bcdSmrgAM_BACKSLASH='\'
872a9274bcdSmrgAC_SUBST([AM_BACKSLASH])dnl
873a9274bcdSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
87466fe65f6Smrg])
87566fe65f6Smrg
876a9274bcdSmrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
87766fe65f6Smrg#
87866fe65f6Smrg# This file is free software; the Free Software Foundation
87966fe65f6Smrg# gives unlimited permission to copy and/or distribute it,
88066fe65f6Smrg# with or without modifications, as long as this notice is preserved.
88166fe65f6Smrg
882a9274bcdSmrg# AM_PROG_INSTALL_STRIP
883a9274bcdSmrg# ---------------------
884a9274bcdSmrg# One issue with vendor `install' (even GNU) is that you can't
885a9274bcdSmrg# specify the program used to strip binaries.  This is especially
886a9274bcdSmrg# annoying in cross-compiling environments, where the build's strip
887a9274bcdSmrg# is unlikely to handle the host's binaries.
888a9274bcdSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
889a9274bcdSmrg# always use install-sh in `make install-strip', and initialize
890a9274bcdSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
891a9274bcdSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
892a9274bcdSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
893a9274bcdSmrg# Installed binaries are usually stripped using `strip' when the user
894a9274bcdSmrg# run `make install-strip'.  However `strip' might not be the right
895a9274bcdSmrg# tool to use in cross-compilation environments, therefore Automake
896a9274bcdSmrg# will honor the `STRIP' environment variable to overrule this program.
897a9274bcdSmrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
898a9274bcdSmrgif test "$cross_compiling" != no; then
899a9274bcdSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
900a9274bcdSmrgfi
901a9274bcdSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
902a9274bcdSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
90366fe65f6Smrg
904a9274bcdSmrg# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
90566fe65f6Smrg#
90666fe65f6Smrg# This file is free software; the Free Software Foundation
90766fe65f6Smrg# gives unlimited permission to copy and/or distribute it,
90866fe65f6Smrg# with or without modifications, as long as this notice is preserved.
90966fe65f6Smrg
910a9274bcdSmrg# serial 2
91166fe65f6Smrg
912a9274bcdSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
913a9274bcdSmrg# ---------------------------
914a9274bcdSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
915a9274bcdSmrg# This macro is traced by Automake.
916a9274bcdSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
91766fe65f6Smrg
918a9274bcdSmrg# AM_SUBST_NOTMAKE(VARIABLE)
919a9274bcdSmrg# ---------------------------
920a9274bcdSmrg# Public sister of _AM_SUBST_NOTMAKE.
921a9274bcdSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
92266fe65f6Smrg
923a9274bcdSmrg# Check how to create a tarball.                            -*- Autoconf -*-
92466fe65f6Smrg
925a9274bcdSmrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
92666fe65f6Smrg#
92766fe65f6Smrg# This file is free software; the Free Software Foundation
92866fe65f6Smrg# gives unlimited permission to copy and/or distribute it,
92966fe65f6Smrg# with or without modifications, as long as this notice is preserved.
93066fe65f6Smrg
93166fe65f6Smrg# serial 2
93266fe65f6Smrg
933a9274bcdSmrg# _AM_PROG_TAR(FORMAT)
934a9274bcdSmrg# --------------------
935a9274bcdSmrg# Check how to create a tarball in format FORMAT.
936a9274bcdSmrg# FORMAT should be one of `v7', `ustar', or `pax'.
93766fe65f6Smrg#
938a9274bcdSmrg# Substitute a variable $(am__tar) that is a command
939a9274bcdSmrg# writing to stdout a FORMAT-tarball containing the directory
940a9274bcdSmrg# $tardir.
941a9274bcdSmrg#     tardir=directory && $(am__tar) > result.tar
94266fe65f6Smrg#
943a9274bcdSmrg# Substitute a variable $(am__untar) that extract such
944a9274bcdSmrg# a tarball read from stdin.
945a9274bcdSmrg#     $(am__untar) < result.tar
946a9274bcdSmrgAC_DEFUN([_AM_PROG_TAR],
947a9274bcdSmrg[# Always define AMTAR for backward compatibility.
948a9274bcdSmrgAM_MISSING_PROG([AMTAR], [tar])
949a9274bcdSmrgm4_if([$1], [v7],
950a9274bcdSmrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
951a9274bcdSmrg     [m4_case([$1], [ustar],, [pax],,
952a9274bcdSmrg              [m4_fatal([Unknown tar format])])
953a9274bcdSmrgAC_MSG_CHECKING([how to create a $1 tar archive])
954a9274bcdSmrg# Loop over all known methods to create a tar archive until one works.
955a9274bcdSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
956a9274bcdSmrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
957a9274bcdSmrg# Do not fold the above two line into one, because Tru64 sh and
958a9274bcdSmrg# Solaris sh will not grok spaces in the rhs of `-'.
959a9274bcdSmrgfor _am_tool in $_am_tools
960a9274bcdSmrgdo
961a9274bcdSmrg  case $_am_tool in
962a9274bcdSmrg  gnutar)
963a9274bcdSmrg    for _am_tar in tar gnutar gtar;
964a9274bcdSmrg    do
965a9274bcdSmrg      AM_RUN_LOG([$_am_tar --version]) && break
966a9274bcdSmrg    done
967a9274bcdSmrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
968a9274bcdSmrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
969a9274bcdSmrg    am__untar="$_am_tar -xf -"
970a9274bcdSmrg    ;;
971a9274bcdSmrg  plaintar)
972a9274bcdSmrg    # Must skip GNU tar: if it does not support --format= it doesn't create
973a9274bcdSmrg    # ustar tarball either.
974a9274bcdSmrg    (tar --version) >/dev/null 2>&1 && continue
975a9274bcdSmrg    am__tar='tar chf - "$$tardir"'
976a9274bcdSmrg    am__tar_='tar chf - "$tardir"'
977a9274bcdSmrg    am__untar='tar xf -'
978a9274bcdSmrg    ;;
979a9274bcdSmrg  pax)
980a9274bcdSmrg    am__tar='pax -L -x $1 -w "$$tardir"'
981a9274bcdSmrg    am__tar_='pax -L -x $1 -w "$tardir"'
982a9274bcdSmrg    am__untar='pax -r'
983a9274bcdSmrg    ;;
984a9274bcdSmrg  cpio)
985a9274bcdSmrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
986a9274bcdSmrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
987a9274bcdSmrg    am__untar='cpio -i -H $1 -d'
988a9274bcdSmrg    ;;
989a9274bcdSmrg  none)
990a9274bcdSmrg    am__tar=false
991a9274bcdSmrg    am__tar_=false
992a9274bcdSmrg    am__untar=false
993a9274bcdSmrg    ;;
994a9274bcdSmrg  esac
99566fe65f6Smrg
996a9274bcdSmrg  # If the value was cached, stop now.  We just wanted to have am__tar
997a9274bcdSmrg  # and am__untar set.
998a9274bcdSmrg  test -n "${am_cv_prog_tar_$1}" && break
99966fe65f6Smrg
1000a9274bcdSmrg  # tar/untar a dummy directory, and stop if the command works
1001a9274bcdSmrg  rm -rf conftest.dir
1002a9274bcdSmrg  mkdir conftest.dir
1003a9274bcdSmrg  echo GrepMe > conftest.dir/file
1004a9274bcdSmrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1005a9274bcdSmrg  rm -rf conftest.dir
1006a9274bcdSmrg  if test -s conftest.tar; then
1007a9274bcdSmrg    AM_RUN_LOG([$am__untar <conftest.tar])
1008a9274bcdSmrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1009a9274bcdSmrg  fi
1010a9274bcdSmrgdone
1011a9274bcdSmrgrm -rf conftest.dir
101266fe65f6Smrg
1013a9274bcdSmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1014a9274bcdSmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
1015a9274bcdSmrgAC_SUBST([am__tar])
1016a9274bcdSmrgAC_SUBST([am__untar])
1017a9274bcdSmrg]) # _AM_PROG_TAR
101866fe65f6Smrg
1019f931275dSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1020f931275dSmrg# 
1021f931275dSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1022f931275dSmrg#
1023f931275dSmrg# This program is free software; you can redistribute it and/or modify
1024f931275dSmrg# it under the terms of the GNU General Public License as published by
1025f931275dSmrg# the Free Software Foundation; either version 2 of the License, or
1026f931275dSmrg# (at your option) any later version.
1027f931275dSmrg#
1028f931275dSmrg# This program is distributed in the hope that it will be useful, but
1029f931275dSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1030f931275dSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1031f931275dSmrg# General Public License for more details.
1032f931275dSmrg#
1033f931275dSmrg# You should have received a copy of the GNU General Public License
1034f931275dSmrg# along with this program; if not, write to the Free Software
1035f931275dSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1036f931275dSmrg#
1037f931275dSmrg# As a special exception to the GNU General Public License, if you
1038f931275dSmrg# distribute this file as part of a program that contains a
1039f931275dSmrg# configuration script generated by Autoconf, you may include it under
1040f931275dSmrg# the same distribution terms that you use for the rest of that program.
1041f931275dSmrg
1042f931275dSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1043f931275dSmrg# ----------------------------------
1044f931275dSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1045f931275dSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1046f931275dSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1047f931275dSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1048f931275dSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1049f931275dSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1050f931275dSmrgfi
1051f931275dSmrgif test -n "$PKG_CONFIG"; then
1052f931275dSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
1053f931275dSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1054f931275dSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1055f931275dSmrg		AC_MSG_RESULT([yes])
1056f931275dSmrg	else
1057f931275dSmrg		AC_MSG_RESULT([no])
1058f931275dSmrg		PKG_CONFIG=""
1059f931275dSmrg	fi
1060f931275dSmrg		
1061f931275dSmrgfi[]dnl
1062f931275dSmrg])# PKG_PROG_PKG_CONFIG
1063f931275dSmrg
1064f931275dSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1065f931275dSmrg#
1066f931275dSmrg# Check to see whether a particular set of modules exists.  Similar
1067f931275dSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1068f931275dSmrg#
1069f931275dSmrg#
1070f931275dSmrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1071f931275dSmrg# this or PKG_CHECK_MODULES is called, or make sure to call
1072f931275dSmrg# PKG_CHECK_EXISTS manually
1073f931275dSmrg# --------------------------------------------------------------
1074f931275dSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1075f931275dSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1076f931275dSmrgif test -n "$PKG_CONFIG" && \
1077f931275dSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1078f931275dSmrg  m4_ifval([$2], [$2], [:])
1079f931275dSmrgm4_ifvaln([$3], [else
1080f931275dSmrg  $3])dnl
1081f931275dSmrgfi])
1082f931275dSmrg
1083f931275dSmrg
1084f931275dSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1085f931275dSmrg# ---------------------------------------------
1086f931275dSmrgm4_define([_PKG_CONFIG],
1087f931275dSmrg[if test -n "$$1"; then
1088f931275dSmrg    pkg_cv_[]$1="$$1"
1089f931275dSmrg elif test -n "$PKG_CONFIG"; then
1090f931275dSmrg    PKG_CHECK_EXISTS([$3],
1091f931275dSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1092f931275dSmrg		     [pkg_failed=yes])
1093f931275dSmrg else
1094f931275dSmrg    pkg_failed=untried
1095f931275dSmrgfi[]dnl
1096f931275dSmrg])# _PKG_CONFIG
1097f931275dSmrg
1098f931275dSmrg# _PKG_SHORT_ERRORS_SUPPORTED
1099f931275dSmrg# -----------------------------
1100f931275dSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1101f931275dSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1102f931275dSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1103f931275dSmrg        _pkg_short_errors_supported=yes
1104f931275dSmrgelse
1105f931275dSmrg        _pkg_short_errors_supported=no
1106f931275dSmrgfi[]dnl
1107f931275dSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
1108f931275dSmrg
1109f931275dSmrg
1110f931275dSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1111f931275dSmrg# [ACTION-IF-NOT-FOUND])
1112f931275dSmrg#
1113f931275dSmrg#
1114f931275dSmrg# Note that if there is a possibility the first call to
1115f931275dSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1116f931275dSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1117f931275dSmrg#
1118f931275dSmrg#
1119f931275dSmrg# --------------------------------------------------------------
1120f931275dSmrgAC_DEFUN([PKG_CHECK_MODULES],
1121f931275dSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1122f931275dSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1123f931275dSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1124f931275dSmrg
1125f931275dSmrgpkg_failed=no
1126f931275dSmrgAC_MSG_CHECKING([for $1])
1127f931275dSmrg
1128f931275dSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1129f931275dSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1130f931275dSmrg
1131f931275dSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1132f931275dSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1133f931275dSmrgSee the pkg-config man page for more details.])
1134f931275dSmrg
1135f931275dSmrgif test $pkg_failed = yes; then
1136f931275dSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1137f931275dSmrg        if test $_pkg_short_errors_supported = yes; then
1138f931275dSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1139f931275dSmrg        else 
1140f931275dSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1141f931275dSmrg        fi
1142f931275dSmrg	# Put the nasty error message in config.log where it belongs
1143f931275dSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1144f931275dSmrg
1145f931275dSmrg	ifelse([$4], , [AC_MSG_ERROR(dnl
1146f931275dSmrg[Package requirements ($2) were not met:
1147f931275dSmrg
1148f931275dSmrg$$1_PKG_ERRORS
1149f931275dSmrg
1150f931275dSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1151f931275dSmrginstalled software in a non-standard prefix.
1152f931275dSmrg
1153f931275dSmrg_PKG_TEXT
1154f931275dSmrg])],
1155f931275dSmrg		[AC_MSG_RESULT([no])
1156f931275dSmrg                $4])
1157f931275dSmrgelif test $pkg_failed = untried; then
1158f931275dSmrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
1159f931275dSmrg[The pkg-config script could not be found or is too old.  Make sure it
1160f931275dSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
1161f931275dSmrgpath to pkg-config.
1162f931275dSmrg
1163f931275dSmrg_PKG_TEXT
1164f931275dSmrg
1165f931275dSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1166f931275dSmrg		[$4])
1167f931275dSmrgelse
1168f931275dSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1169f931275dSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1170f931275dSmrg        AC_MSG_RESULT([yes])
1171f931275dSmrg	ifelse([$3], , :, [$3])
1172f931275dSmrgfi[]dnl
1173f931275dSmrg])# PKG_CHECK_MODULES
1174f931275dSmrg
1175a9274bcdSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1176a9274bcdSmrgdnl
117748af84faSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1178a9274bcdSmrgdnl 
1179a9274bcdSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
118048af84faSmrgdnl copy of this software and associated documentation files (the "Software"),
118148af84faSmrgdnl to deal in the Software without restriction, including without limitation
118248af84faSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
118348af84faSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
118448af84faSmrgdnl Software is furnished to do so, subject to the following conditions:
1185a9274bcdSmrgdnl
118648af84faSmrgdnl The above copyright notice and this permission notice (including the next
118748af84faSmrgdnl paragraph) shall be included in all copies or substantial portions of the
118848af84faSmrgdnl Software.
1189a9274bcdSmrgdnl
119048af84faSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
119148af84faSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
119248af84faSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
119348af84faSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
119448af84faSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
119548af84faSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
119648af84faSmrgdnl DEALINGS IN THE SOFTWARE.
119766fe65f6Smrg
1198a9274bcdSmrg# XORG_MACROS_VERSION(required-version)
1199a9274bcdSmrg# -------------------------------------
1200a9274bcdSmrg# Minimum version: 1.1.0
1201a9274bcdSmrg#
1202a9274bcdSmrg# If you're using a macro added in Version 1.1 or newer, include this in
1203a9274bcdSmrg# your configure.ac with the minimum required version, such as:
1204a9274bcdSmrg# XORG_MACROS_VERSION(1.1)
1205a9274bcdSmrg#
1206a9274bcdSmrg# To ensure that this macro is defined, also add:
1207a9274bcdSmrg# m4_ifndef([XORG_MACROS_VERSION],
1208a9274bcdSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1209a9274bcdSmrg#
1210a9274bcdSmrg#
1211a9274bcdSmrg# See the "minimum version" comment for each macro you use to see what 
1212a9274bcdSmrg# version you require.
1213a9274bcdSmrgm4_defun([XORG_MACROS_VERSION],[
1214f931275dSmrgm4_define([vers_have], [1.16.1])
1215a9274bcdSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1216a9274bcdSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1217a9274bcdSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1218a9274bcdSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1219a9274bcdSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1220a9274bcdSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1221a9274bcdSmrgm4_undefine([vers_have])
1222a9274bcdSmrgm4_undefine([maj_have])
1223a9274bcdSmrgm4_undefine([maj_needed])
1224a9274bcdSmrg]) # XORG_MACROS_VERSION
122566fe65f6Smrg
1226a9274bcdSmrg# XORG_PROG_RAWCPP()
1227a9274bcdSmrg# ------------------
1228a9274bcdSmrg# Minimum version: 1.0.0
1229a9274bcdSmrg#
1230a9274bcdSmrg# Find cpp program and necessary flags for use in pre-processing text files
1231a9274bcdSmrg# such as man pages and config files
1232a9274bcdSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1233a9274bcdSmrgAC_REQUIRE([AC_PROG_CPP])
1234a9274bcdSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
1235a9274bcdSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
123666fe65f6Smrg
1237a9274bcdSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1238a9274bcdSmrg# which is not the best choice for supporting other OS'es, but covers most
1239a9274bcdSmrg# of the ones we need for now.
1240a9274bcdSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1241f931275dSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1242a9274bcdSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1243a9274bcdSmrg	AC_MSG_RESULT([no])
1244a9274bcdSmrgelse
1245a9274bcdSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1246a9274bcdSmrg		RAWCPPFLAGS=-undef
1247a9274bcdSmrg		AC_MSG_RESULT([yes])
1248a9274bcdSmrg	# under Cygwin unix is still defined even with -undef
1249a9274bcdSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1250a9274bcdSmrg		RAWCPPFLAGS="-undef -ansi"
1251a9274bcdSmrg		AC_MSG_RESULT([yes, with -ansi])
1252a9274bcdSmrg	else
1253a9274bcdSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1254a9274bcdSmrg	fi
1255a9274bcdSmrgfi
1256a9274bcdSmrgrm -f conftest.$ac_ext
125766fe65f6Smrg
1258a9274bcdSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1259f931275dSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1260a9274bcdSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1261a9274bcdSmrg	AC_MSG_RESULT([no])
126266fe65f6Smrgelse
1263a9274bcdSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1264a9274bcdSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1265a9274bcdSmrg		AC_MSG_RESULT([yes])
1266a9274bcdSmrg	else
1267a9274bcdSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1268a9274bcdSmrg	fi
126966fe65f6Smrgfi
1270a9274bcdSmrgrm -f conftest.$ac_ext
1271a9274bcdSmrgAC_SUBST(RAWCPPFLAGS)
1272a9274bcdSmrg]) # XORG_PROG_RAWCPP
127366fe65f6Smrg
1274a9274bcdSmrg# XORG_MANPAGE_SECTIONS()
1275a9274bcdSmrg# -----------------------
1276a9274bcdSmrg# Minimum version: 1.0.0
127766fe65f6Smrg#
1278a9274bcdSmrg# Determine which sections man pages go in for the different man page types
1279a9274bcdSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1280a9274bcdSmrg# Not sure if there's any better way than just hardcoding by OS name.
1281a9274bcdSmrg# Override default settings by setting environment variables
128248af84faSmrg# Added MAN_SUBSTS in version 1.8
128348af84faSmrg# Added AC_PROG_SED in version 1.8
128466fe65f6Smrg
1285a9274bcdSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1286a9274bcdSmrgAC_REQUIRE([AC_CANONICAL_HOST])
128748af84faSmrgAC_REQUIRE([AC_PROG_SED])
128866fe65f6Smrg
1289a9274bcdSmrgif test x$APP_MAN_SUFFIX = x    ; then
1290a9274bcdSmrg    APP_MAN_SUFFIX=1
1291a9274bcdSmrgfi
1292a9274bcdSmrgif test x$APP_MAN_DIR = x    ; then
1293a9274bcdSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1294a9274bcdSmrgfi
129566fe65f6Smrg
1296a9274bcdSmrgif test x$LIB_MAN_SUFFIX = x    ; then
1297a9274bcdSmrg    LIB_MAN_SUFFIX=3
1298a9274bcdSmrgfi
1299a9274bcdSmrgif test x$LIB_MAN_DIR = x    ; then
1300a9274bcdSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1301a9274bcdSmrgfi
130266fe65f6Smrg
1303a9274bcdSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1304a9274bcdSmrg    case $host_os in
1305a9274bcdSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1306a9274bcdSmrg	*)		FILE_MAN_SUFFIX=5  ;;
1307a9274bcdSmrg    esac
1308a9274bcdSmrgfi
1309a9274bcdSmrgif test x$FILE_MAN_DIR = x    ; then
1310a9274bcdSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1311a9274bcdSmrgfi
131266fe65f6Smrg
1313a9274bcdSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1314a9274bcdSmrg    case $host_os in
1315a9274bcdSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1316a9274bcdSmrg	*)		MISC_MAN_SUFFIX=7  ;;
1317a9274bcdSmrg    esac
1318a9274bcdSmrgfi
1319a9274bcdSmrgif test x$MISC_MAN_DIR = x    ; then
1320a9274bcdSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1321a9274bcdSmrgfi
132266fe65f6Smrg
1323a9274bcdSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1324a9274bcdSmrg    case $host_os in
1325a9274bcdSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1326a9274bcdSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1327a9274bcdSmrg    esac
1328a9274bcdSmrgfi
1329a9274bcdSmrgif test x$DRIVER_MAN_DIR = x    ; then
1330a9274bcdSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1331a9274bcdSmrgfi
133266fe65f6Smrg
1333a9274bcdSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1334a9274bcdSmrg    case $host_os in
1335a9274bcdSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1336a9274bcdSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1337a9274bcdSmrg    esac
1338a9274bcdSmrgfi
1339a9274bcdSmrgif test x$ADMIN_MAN_DIR = x    ; then
1340a9274bcdSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1341a9274bcdSmrgfi
134266fe65f6Smrg
134366fe65f6Smrg
1344a9274bcdSmrgAC_SUBST([APP_MAN_SUFFIX])
1345a9274bcdSmrgAC_SUBST([LIB_MAN_SUFFIX])
1346a9274bcdSmrgAC_SUBST([FILE_MAN_SUFFIX])
1347a9274bcdSmrgAC_SUBST([MISC_MAN_SUFFIX])
1348a9274bcdSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1349a9274bcdSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1350a9274bcdSmrgAC_SUBST([APP_MAN_DIR])
1351a9274bcdSmrgAC_SUBST([LIB_MAN_DIR])
1352a9274bcdSmrgAC_SUBST([FILE_MAN_DIR])
1353a9274bcdSmrgAC_SUBST([MISC_MAN_DIR])
1354a9274bcdSmrgAC_SUBST([DRIVER_MAN_DIR])
1355a9274bcdSmrgAC_SUBST([ADMIN_MAN_DIR])
135648af84faSmrg
135748af84faSmrgXORG_MAN_PAGE="X Version 11"
135848af84faSmrgAC_SUBST([XORG_MAN_PAGE])
135948af84faSmrgMAN_SUBSTS="\
136048af84faSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
136148af84faSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
136248af84faSmrg	-e 's|__xservername__|Xorg|g' \
136348af84faSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
136448af84faSmrg	-e 's|__projectroot__|\$(prefix)|g' \
136548af84faSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
136648af84faSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
136748af84faSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
136848af84faSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
136948af84faSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
137048af84faSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
137148af84faSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
137248af84faSmrgAC_SUBST([MAN_SUBSTS])
137348af84faSmrg
1374a9274bcdSmrg]) # XORG_MANPAGE_SECTIONS
1375a9274bcdSmrg
137648af84faSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
137748af84faSmrg# ------------------------
137848af84faSmrg# Minimum version: 1.7.0
137948af84faSmrg#
138048af84faSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
138148af84faSmrg# provided by xorg-sgml-doctools, if installed.
138248af84faSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
138348af84faSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
138448af84faSmrgXORG_SGML_PATH=
138548af84faSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
138648af84faSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
138748af84faSmrg    [m4_ifval([$1],[:],
138848af84faSmrg        [if test x"$cross_compiling" != x"yes" ; then
138948af84faSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
139048af84faSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
139148af84faSmrg         fi])
139248af84faSmrg    ])
139348af84faSmrg
139448af84faSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
139548af84faSmrg# the path and the name of the doc stylesheet
139648af84faSmrgif test "x$XORG_SGML_PATH" != "x" ; then
139748af84faSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
139848af84faSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
139948af84faSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
140048af84faSmrgelse
140148af84faSmrg   AC_MSG_RESULT([no])
140248af84faSmrgfi
140348af84faSmrg
140448af84faSmrgAC_SUBST(XORG_SGML_PATH)
140548af84faSmrgAC_SUBST(STYLESHEET_SRCDIR)
140648af84faSmrgAC_SUBST(XSL_STYLESHEET)
140748af84faSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
140848af84faSmrg]) # XORG_CHECK_SGML_DOCTOOLS
140948af84faSmrg
1410a9274bcdSmrg# XORG_CHECK_LINUXDOC
1411a9274bcdSmrg# -------------------
1412a9274bcdSmrg# Minimum version: 1.0.0
141366fe65f6Smrg#
1414a9274bcdSmrg# Defines the variable MAKE_TEXT if the necessary tools and
1415a9274bcdSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1416a9274bcdSmrg# Whether or not the necessary tools and files are found can be checked
1417a9274bcdSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1418a9274bcdSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
141948af84faSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
142048af84faSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
142166fe65f6Smrg
1422a9274bcdSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
142366fe65f6Smrg
142448af84faSmrgAC_MSG_CHECKING([whether to build documentation])
142566fe65f6Smrg
142648af84faSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1427a9274bcdSmrg   BUILDDOC=yes
142866fe65f6Smrgelse
1429a9274bcdSmrg   BUILDDOC=no
143066fe65f6Smrgfi
143166fe65f6Smrg
1432a9274bcdSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1433a9274bcdSmrg
1434a9274bcdSmrgAC_MSG_RESULT([$BUILDDOC])
1435a9274bcdSmrg
143648af84faSmrgAC_MSG_CHECKING([whether to build pdf documentation])
1437a9274bcdSmrg
143848af84faSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1439a9274bcdSmrg   BUILDPDFDOC=yes
1440a9274bcdSmrgelse
1441a9274bcdSmrg   BUILDPDFDOC=no
1442a9274bcdSmrgfi
1443a9274bcdSmrg
1444a9274bcdSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1445a9274bcdSmrg
1446a9274bcdSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1447a9274bcdSmrg
144848af84faSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1449a9274bcdSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1450a9274bcdSmrgMAKE_PDF="$PS2PDF"
1451a9274bcdSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1452a9274bcdSmrg
1453a9274bcdSmrgAC_SUBST(MAKE_TEXT)
1454a9274bcdSmrgAC_SUBST(MAKE_PS)
1455a9274bcdSmrgAC_SUBST(MAKE_PDF)
1456a9274bcdSmrgAC_SUBST(MAKE_HTML)
1457a9274bcdSmrg]) # XORG_CHECK_LINUXDOC
1458a9274bcdSmrg
1459a9274bcdSmrg# XORG_CHECK_DOCBOOK
1460a9274bcdSmrg# -------------------
1461a9274bcdSmrg# Minimum version: 1.0.0
146266fe65f6Smrg#
1463a9274bcdSmrg# Checks for the ability to build output formats from SGML DocBook source.
1464a9274bcdSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1465a9274bcdSmrg# indicates whether the necessary tools and files are found and, if set,
1466a9274bcdSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1467a9274bcdSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
146848af84faSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
146948af84faSmrg
1470a9274bcdSmrgBUILDTXTDOC=no
1471a9274bcdSmrgBUILDPDFDOC=no
1472a9274bcdSmrgBUILDPSDOC=no
1473a9274bcdSmrgBUILDHTMLDOC=no
147466fe65f6Smrg
1475a9274bcdSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1476a9274bcdSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1477a9274bcdSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1478a9274bcdSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1479a9274bcdSmrg
148048af84faSmrgAC_MSG_CHECKING([whether to build text documentation])
148148af84faSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1482a9274bcdSmrg   test x$BUILD_TXTDOC != xno; then
1483a9274bcdSmrg	BUILDTXTDOC=yes
148466fe65f6Smrgfi
1485a9274bcdSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1486a9274bcdSmrgAC_MSG_RESULT([$BUILDTXTDOC])
148766fe65f6Smrg
148848af84faSmrgAC_MSG_CHECKING([whether to build PDF documentation])
148948af84faSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1490a9274bcdSmrg   test x$BUILD_PDFDOC != xno; then
1491a9274bcdSmrg	BUILDPDFDOC=yes
1492a9274bcdSmrgfi
1493a9274bcdSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1494a9274bcdSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1495a9274bcdSmrg
149648af84faSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
149748af84faSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1498a9274bcdSmrg   test x$BUILD_PSDOC != xno; then
1499a9274bcdSmrg	BUILDPSDOC=yes
1500a9274bcdSmrgfi
1501a9274bcdSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1502a9274bcdSmrgAC_MSG_RESULT([$BUILDPSDOC])
1503a9274bcdSmrg
150448af84faSmrgAC_MSG_CHECKING([whether to build HTML documentation])
150548af84faSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1506a9274bcdSmrg   test x$BUILD_HTMLDOC != xno; then
1507a9274bcdSmrg	BUILDHTMLDOC=yes
1508a9274bcdSmrgfi
1509a9274bcdSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1510a9274bcdSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1511a9274bcdSmrg
1512a9274bcdSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1513a9274bcdSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1514a9274bcdSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1515a9274bcdSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1516a9274bcdSmrg
1517a9274bcdSmrgAC_SUBST(MAKE_TEXT)
1518a9274bcdSmrgAC_SUBST(MAKE_PS)
1519a9274bcdSmrgAC_SUBST(MAKE_PDF)
1520a9274bcdSmrgAC_SUBST(MAKE_HTML)
1521a9274bcdSmrg]) # XORG_CHECK_DOCBOOK
1522a9274bcdSmrg
1523f931275dSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
152448af84faSmrg# ----------------
152548af84faSmrg# Minimum version: 1.5.0
1526f931275dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
152748af84faSmrg#
152848af84faSmrg# Documentation tools are not always available on all platforms and sometimes
152948af84faSmrg# not at the appropriate level. This macro enables a module to test for the
153048af84faSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
153148af84faSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1532f931275dSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1533f931275dSmrg# --with-xmlto assumes 'auto'.
153448af84faSmrg#
153548af84faSmrg# Interface to module:
153648af84faSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
153748af84faSmrg# XMLTO:	returns the path of the xmlto program found
153848af84faSmrg#		returns the path set by the user in the environment
153948af84faSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
154048af84faSmrg#		'no' user instructs the module not to use xmlto
154148af84faSmrg#
154248af84faSmrg# Added in version 1.10.0
154348af84faSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
154448af84faSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
154548af84faSmrg#
154648af84faSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
154748af84faSmrg#
154848af84faSmrgAC_DEFUN([XORG_WITH_XMLTO],[
154948af84faSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1550f931275dSmrgm4_define([_defopt], m4_default([$2], [auto]))
155148af84faSmrgAC_ARG_WITH(xmlto,
155248af84faSmrg	AS_HELP_STRING([--with-xmlto],
1553f931275dSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1554f931275dSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1555f931275dSmrgm4_undefine([_defopt])
155648af84faSmrg
155748af84faSmrgif test "x$use_xmlto" = x"auto"; then
155848af84faSmrg   AC_PATH_PROG([XMLTO], [xmlto])
155948af84faSmrg   if test "x$XMLTO" = "x"; then
156048af84faSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
156148af84faSmrg	have_xmlto=no
156248af84faSmrg   else
156348af84faSmrg        have_xmlto=yes
156448af84faSmrg   fi
156548af84faSmrgelif test "x$use_xmlto" = x"yes" ; then
156648af84faSmrg   AC_PATH_PROG([XMLTO], [xmlto])
156748af84faSmrg   if test "x$XMLTO" = "x"; then
156848af84faSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
156948af84faSmrg   fi
157048af84faSmrg   have_xmlto=yes
157148af84faSmrgelif test "x$use_xmlto" = x"no" ; then
157248af84faSmrg   if test "x$XMLTO" != "x"; then
157348af84faSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
157448af84faSmrg   fi
157548af84faSmrg   have_xmlto=no
157648af84faSmrgelse
157748af84faSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
157848af84faSmrgfi
157948af84faSmrg
158048af84faSmrg# Test for a minimum version of xmlto, if provided.
158148af84faSmrgm4_ifval([$1],
158248af84faSmrg[if test "$have_xmlto" = yes; then
158348af84faSmrg    # scrape the xmlto version
158448af84faSmrg    AC_MSG_CHECKING([the xmlto version])
158548af84faSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
158648af84faSmrg    AC_MSG_RESULT([$xmlto_version])
158748af84faSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
158848af84faSmrg        [if test "x$use_xmlto" = xauto; then
158948af84faSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
159048af84faSmrg            have_xmlto=no
159148af84faSmrg        else
159248af84faSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
159348af84faSmrg        fi])
159448af84faSmrgfi])
159548af84faSmrg
159648af84faSmrg# Test for the ability of xmlto to generate a text target
159748af84faSmrghave_xmlto_text=no
159848af84faSmrgcat > conftest.xml << "EOF"
159948af84faSmrgEOF
160048af84faSmrgAS_IF([test "$have_xmlto" = yes],
160148af84faSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
160248af84faSmrg             [have_xmlto_text=yes],
160348af84faSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
160448af84faSmrgrm -f conftest.xml
160548af84faSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
160648af84faSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
160748af84faSmrg]) # XORG_WITH_XMLTO
160848af84faSmrg
1609f931275dSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1610f931275dSmrg# --------------------------------------------
1611f931275dSmrg# Minimum version: 1.12.0
1612f931275dSmrg# Minimum version for optional DEFAULT argument: 1.12.0
1613f931275dSmrg#
1614f931275dSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1615f931275dSmrg# XML-based language used for the transformation of XML documents.
1616f931275dSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1617f931275dSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1618f931275dSmrg# The XSLT processor is often used as a standalone tool for transformations.
1619f931275dSmrg# It should not be assumed that this tool is used only to work with documnetation.
1620f931275dSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1621f931275dSmrg#
1622f931275dSmrg# Interface to module:
1623f931275dSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1624f931275dSmrg# XSLTPROC:	 returns the path of the xsltproc program found
1625f931275dSmrg#		 returns the path set by the user in the environment
1626f931275dSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1627f931275dSmrg#		  'no' user instructs the module not to use xsltproc
1628f931275dSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1629f931275dSmrg#
1630f931275dSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1631f931275dSmrg#
1632f931275dSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1633f931275dSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1634f931275dSmrg# Preserves the interface, should it be implemented later
1635f931275dSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1636f931275dSmrgm4_define([_defopt], m4_default([$2], [auto]))
1637f931275dSmrgAC_ARG_WITH(xsltproc,
1638f931275dSmrg	AS_HELP_STRING([--with-xsltproc],
1639f931275dSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1640f931275dSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1641f931275dSmrgm4_undefine([_defopt])
1642f931275dSmrg
1643f931275dSmrgif test "x$use_xsltproc" = x"auto"; then
1644f931275dSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1645f931275dSmrg   if test "x$XSLTPROC" = "x"; then
1646f931275dSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1647f931275dSmrg	have_xsltproc=no
1648f931275dSmrg   else
1649f931275dSmrg        have_xsltproc=yes
1650f931275dSmrg   fi
1651f931275dSmrgelif test "x$use_xsltproc" = x"yes" ; then
1652f931275dSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1653f931275dSmrg   if test "x$XSLTPROC" = "x"; then
1654f931275dSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1655f931275dSmrg   fi
1656f931275dSmrg   have_xsltproc=yes
1657f931275dSmrgelif test "x$use_xsltproc" = x"no" ; then
1658f931275dSmrg   if test "x$XSLTPROC" != "x"; then
1659f931275dSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1660f931275dSmrg   fi
1661f931275dSmrg   have_xsltproc=no
1662f931275dSmrgelse
1663f931275dSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1664f931275dSmrgfi
1665f931275dSmrg
1666f931275dSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1667f931275dSmrg]) # XORG_WITH_XSLTPROC
1668f931275dSmrg
1669f931275dSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1670f931275dSmrg# ----------------------------------------
1671f931275dSmrg# Minimum version: 1.15.0
1672f931275dSmrg#
1673f931275dSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
1674f931275dSmrg# scanning arbitrary text files, extracting information from those text files,
1675f931275dSmrg# and printing reports based on that information.
1676f931275dSmrg#
1677f931275dSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1678f931275dSmrg#
1679f931275dSmrg# Interface to module:
1680f931275dSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
1681f931275dSmrg# PERL:	     returns the path of the perl program found
1682f931275dSmrg#	     returns the path set by the user in the environment
1683f931275dSmrg# --with-perl: 'yes' user instructs the module to use perl
1684f931275dSmrg#	       'no' user instructs the module not to use perl
1685f931275dSmrg# have_perl: returns yes if perl found in PATH or no
1686f931275dSmrg#
1687f931275dSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1688f931275dSmrg#
1689f931275dSmrgAC_DEFUN([XORG_WITH_PERL],[
1690f931275dSmrgAC_ARG_VAR([PERL], [Path to perl command])
1691f931275dSmrg# Preserves the interface, should it be implemented later
1692f931275dSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1693f931275dSmrgm4_define([_defopt], m4_default([$2], [auto]))
1694f931275dSmrgAC_ARG_WITH(perl,
1695f931275dSmrg	AS_HELP_STRING([--with-perl],
1696f931275dSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1697f931275dSmrg	   [use_perl=$withval], [use_perl=]_defopt)
1698f931275dSmrgm4_undefine([_defopt])
1699f931275dSmrg
1700f931275dSmrgif test "x$use_perl" = x"auto"; then
1701f931275dSmrg   AC_PATH_PROG([PERL], [perl])
1702f931275dSmrg   if test "x$PERL" = "x"; then
1703f931275dSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1704f931275dSmrg	have_perl=no
1705f931275dSmrg   else
1706f931275dSmrg        have_perl=yes
1707f931275dSmrg   fi
1708f931275dSmrgelif test "x$use_perl" = x"yes" ; then
1709f931275dSmrg   AC_PATH_PROG([PERL], [perl])
1710f931275dSmrg   if test "x$PERL" = "x"; then
1711f931275dSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1712f931275dSmrg   fi
1713f931275dSmrg   have_perl=yes
1714f931275dSmrgelif test "x$use_perl" = x"no" ; then
1715f931275dSmrg   if test "x$PERL" != "x"; then
1716f931275dSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1717f931275dSmrg   fi
1718f931275dSmrg   have_perl=no
1719f931275dSmrgelse
1720f931275dSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1721f931275dSmrgfi
1722f931275dSmrg
1723f931275dSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1724f931275dSmrg]) # XORG_WITH_PERL
1725f931275dSmrg
1726f931275dSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
172748af84faSmrg# ----------------
172848af84faSmrg# Minimum version: 1.5.0
1729f931275dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
173048af84faSmrg#
173148af84faSmrg# Documentation tools are not always available on all platforms and sometimes
173248af84faSmrg# not at the appropriate level. This macro enables a module to test for the
173348af84faSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
173448af84faSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1735f931275dSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1736f931275dSmrg# --with-asciidoc assumes 'auto'.
173748af84faSmrg#
173848af84faSmrg# Interface to module:
173948af84faSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
174048af84faSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
174148af84faSmrg#		 returns the path set by the user in the environment
174248af84faSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
174348af84faSmrg#		  'no' user instructs the module not to use asciidoc
174448af84faSmrg#
174548af84faSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
174648af84faSmrg#
174748af84faSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
174848af84faSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1749f931275dSmrgm4_define([_defopt], m4_default([$2], [auto]))
175048af84faSmrgAC_ARG_WITH(asciidoc,
175148af84faSmrg	AS_HELP_STRING([--with-asciidoc],
1752f931275dSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1753f931275dSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1754f931275dSmrgm4_undefine([_defopt])
175548af84faSmrg
175648af84faSmrgif test "x$use_asciidoc" = x"auto"; then
175748af84faSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
175848af84faSmrg   if test "x$ASCIIDOC" = "x"; then
175948af84faSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
176048af84faSmrg	have_asciidoc=no
176148af84faSmrg   else
176248af84faSmrg        have_asciidoc=yes
176348af84faSmrg   fi
176448af84faSmrgelif test "x$use_asciidoc" = x"yes" ; then
176548af84faSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
176648af84faSmrg   if test "x$ASCIIDOC" = "x"; then
176748af84faSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
176848af84faSmrg   fi
176948af84faSmrg   have_asciidoc=yes
177048af84faSmrgelif test "x$use_asciidoc" = x"no" ; then
177148af84faSmrg   if test "x$ASCIIDOC" != "x"; then
177248af84faSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
177348af84faSmrg   fi
177448af84faSmrg   have_asciidoc=no
177548af84faSmrgelse
177648af84faSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
177748af84faSmrgfi
177848af84faSmrgm4_ifval([$1],
177948af84faSmrg[if test "$have_asciidoc" = yes; then
178048af84faSmrg    # scrape the asciidoc version
178148af84faSmrg    AC_MSG_CHECKING([the asciidoc version])
178248af84faSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
178348af84faSmrg    AC_MSG_RESULT([$asciidoc_version])
178448af84faSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
178548af84faSmrg        [if test "x$use_asciidoc" = xauto; then
178648af84faSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
178748af84faSmrg            have_asciidoc=no
178848af84faSmrg        else
178948af84faSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
179048af84faSmrg        fi])
179148af84faSmrgfi])
179248af84faSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
179348af84faSmrg]) # XORG_WITH_ASCIIDOC
179448af84faSmrg
1795f931275dSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
179648af84faSmrg# --------------------------------
179748af84faSmrg# Minimum version: 1.5.0
1798f931275dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
179948af84faSmrg#
180048af84faSmrg# Documentation tools are not always available on all platforms and sometimes
180148af84faSmrg# not at the appropriate level. This macro enables a module to test for the
180248af84faSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
180348af84faSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1804f931275dSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1805f931275dSmrg# --with-doxygen assumes 'auto'.
180648af84faSmrg#
180748af84faSmrg# Interface to module:
180848af84faSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
180948af84faSmrg# DOXYGEN:	 returns the path of the doxygen program found
181048af84faSmrg#		 returns the path set by the user in the environment
181148af84faSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
181248af84faSmrg#		  'no' user instructs the module not to use doxygen
181348af84faSmrg#
181448af84faSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
181548af84faSmrg#
181648af84faSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
181748af84faSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1818f931275dSmrgm4_define([_defopt], m4_default([$2], [auto]))
181948af84faSmrgAC_ARG_WITH(doxygen,
182048af84faSmrg	AS_HELP_STRING([--with-doxygen],
1821f931275dSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1822f931275dSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1823f931275dSmrgm4_undefine([_defopt])
182448af84faSmrg
182548af84faSmrgif test "x$use_doxygen" = x"auto"; then
182648af84faSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
182748af84faSmrg   if test "x$DOXYGEN" = "x"; then
182848af84faSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
182948af84faSmrg	have_doxygen=no
183048af84faSmrg   else
183148af84faSmrg        have_doxygen=yes
183248af84faSmrg   fi
183348af84faSmrgelif test "x$use_doxygen" = x"yes" ; then
183448af84faSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
183548af84faSmrg   if test "x$DOXYGEN" = "x"; then
183648af84faSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
183748af84faSmrg   fi
183848af84faSmrg   have_doxygen=yes
183948af84faSmrgelif test "x$use_doxygen" = x"no" ; then
184048af84faSmrg   if test "x$DOXYGEN" != "x"; then
184148af84faSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
184248af84faSmrg   fi
184348af84faSmrg   have_doxygen=no
184448af84faSmrgelse
184548af84faSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
184648af84faSmrgfi
184748af84faSmrgm4_ifval([$1],
184848af84faSmrg[if test "$have_doxygen" = yes; then
184948af84faSmrg    # scrape the doxygen version
185048af84faSmrg    AC_MSG_CHECKING([the doxygen version])
185148af84faSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
185248af84faSmrg    AC_MSG_RESULT([$doxygen_version])
185348af84faSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
185448af84faSmrg        [if test "x$use_doxygen" = xauto; then
185548af84faSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
185648af84faSmrg            have_doxygen=no
185748af84faSmrg        else
185848af84faSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
185948af84faSmrg        fi])
186048af84faSmrgfi])
186148af84faSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
186248af84faSmrg]) # XORG_WITH_DOXYGEN
186348af84faSmrg
1864f931275dSmrg# XORG_WITH_GROFF([DEFAULT])
186548af84faSmrg# ----------------
186648af84faSmrg# Minimum version: 1.6.0
1867f931275dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
186848af84faSmrg#
186948af84faSmrg# Documentation tools are not always available on all platforms and sometimes
187048af84faSmrg# not at the appropriate level. This macro enables a module to test for the
187148af84faSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
187248af84faSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
1873f931275dSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
1874f931275dSmrg# --with-groff assumes 'auto'.
187548af84faSmrg#
187648af84faSmrg# Interface to module:
187748af84faSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
187848af84faSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
187948af84faSmrg# HAVE_GROFF_MS: the -ms macros package
188048af84faSmrg# GROFF:	 returns the path of the groff program found
188148af84faSmrg#		 returns the path set by the user in the environment
188248af84faSmrg# --with-groff:	 'yes' user instructs the module to use groff
188348af84faSmrg#		 'no' user instructs the module not to use groff
188448af84faSmrg#
188548af84faSmrg# Added in version 1.9.0:
188648af84faSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
188748af84faSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
188848af84faSmrg#		   psselect from the psutils package.
188948af84faSmrg#		   the ghostcript package. Refer to the grohtml man pages
189048af84faSmrg#
189148af84faSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
189248af84faSmrg#
189348af84faSmrg# OS and distros often splits groff in a basic and full package, the former
189448af84faSmrg# having the groff program and the later having devices, fonts and macros
189548af84faSmrg# Checking for the groff executable is not enough.
189648af84faSmrg#
189748af84faSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
189848af84faSmrg# unset HAVE_GROFF or GROFF env variables.
189948af84faSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
190048af84faSmrg#
190148af84faSmrgAC_DEFUN([XORG_WITH_GROFF],[
190248af84faSmrgAC_ARG_VAR([GROFF], [Path to groff command])
1903f931275dSmrgm4_define([_defopt], m4_default([$1], [auto]))
190448af84faSmrgAC_ARG_WITH(groff,
190548af84faSmrg	AS_HELP_STRING([--with-groff],
1906f931275dSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
1907f931275dSmrg	   [use_groff=$withval], [use_groff=]_defopt)
1908f931275dSmrgm4_undefine([_defopt])
190948af84faSmrg
191048af84faSmrgif test "x$use_groff" = x"auto"; then
191148af84faSmrg   AC_PATH_PROG([GROFF], [groff])
191248af84faSmrg   if test "x$GROFF" = "x"; then
191348af84faSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
191448af84faSmrg	have_groff=no
191548af84faSmrg   else
191648af84faSmrg        have_groff=yes
191748af84faSmrg   fi
191848af84faSmrgelif test "x$use_groff" = x"yes" ; then
191948af84faSmrg   AC_PATH_PROG([GROFF], [groff])
192048af84faSmrg   if test "x$GROFF" = "x"; then
192148af84faSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
192248af84faSmrg   fi
192348af84faSmrg   have_groff=yes
192448af84faSmrgelif test "x$use_groff" = x"no" ; then
192548af84faSmrg   if test "x$GROFF" != "x"; then
192648af84faSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
192748af84faSmrg   fi
192848af84faSmrg   have_groff=no
192948af84faSmrgelse
193048af84faSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
193148af84faSmrgfi
193248af84faSmrg
193348af84faSmrg# We have groff, test for the presence of the macro packages
193448af84faSmrgif test "x$have_groff" = x"yes"; then
193548af84faSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
193648af84faSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
193748af84faSmrg        groff_ms_works=yes
193848af84faSmrg    else
193948af84faSmrg        groff_ms_works=no
194048af84faSmrg    fi
194148af84faSmrg    AC_MSG_RESULT([$groff_ms_works])
194248af84faSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
194348af84faSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
194448af84faSmrg        groff_mm_works=yes
194548af84faSmrg    else
194648af84faSmrg        groff_mm_works=no
194748af84faSmrg    fi
194848af84faSmrg    AC_MSG_RESULT([$groff_mm_works])
194948af84faSmrgfi
195048af84faSmrg
195148af84faSmrg# We have groff, test for HTML dependencies, one command per package
195248af84faSmrgif test "x$have_groff" = x"yes"; then
195348af84faSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
195448af84faSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
195548af84faSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
195648af84faSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
195748af84faSmrg      have_groff_html=yes
195848af84faSmrg   else
195948af84faSmrg      have_groff_html=no
196048af84faSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
196148af84faSmrg   fi
196248af84faSmrgfi
196348af84faSmrg
196448af84faSmrg# Set Automake conditionals for Makefiles
196548af84faSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
196648af84faSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
196748af84faSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
196848af84faSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
196948af84faSmrg]) # XORG_WITH_GROFF
197048af84faSmrg
1971f931275dSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
1972f931275dSmrg# ---------------------------------------
197348af84faSmrg# Minimum version: 1.6.0
1974f931275dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1975f931275dSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
197648af84faSmrg#
197748af84faSmrg# Documentation tools are not always available on all platforms and sometimes
197848af84faSmrg# not at the appropriate level. This macro enables a module to test for the
197948af84faSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
198048af84faSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
1981f931275dSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
1982f931275dSmrg# --with-fop assumes 'auto'.
198348af84faSmrg#
198448af84faSmrg# Interface to module:
198548af84faSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
198648af84faSmrg# FOP:	 	returns the path of the fop program found
198748af84faSmrg#		returns the path set by the user in the environment
198848af84faSmrg# --with-fop: 	'yes' user instructs the module to use fop
198948af84faSmrg#		'no' user instructs the module not to use fop
199048af84faSmrg#
199148af84faSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
199248af84faSmrg#
199348af84faSmrgAC_DEFUN([XORG_WITH_FOP],[
199448af84faSmrgAC_ARG_VAR([FOP], [Path to fop command])
1995f931275dSmrgm4_define([_defopt], m4_default([$2], [auto]))
199648af84faSmrgAC_ARG_WITH(fop,
199748af84faSmrg	AS_HELP_STRING([--with-fop],
1998f931275dSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
1999f931275dSmrg	   [use_fop=$withval], [use_fop=]_defopt)
2000f931275dSmrgm4_undefine([_defopt])
200148af84faSmrg
200248af84faSmrgif test "x$use_fop" = x"auto"; then
200348af84faSmrg   AC_PATH_PROG([FOP], [fop])
200448af84faSmrg   if test "x$FOP" = "x"; then
200548af84faSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
200648af84faSmrg	have_fop=no
200748af84faSmrg   else
200848af84faSmrg        have_fop=yes
200948af84faSmrg   fi
201048af84faSmrgelif test "x$use_fop" = x"yes" ; then
201148af84faSmrg   AC_PATH_PROG([FOP], [fop])
201248af84faSmrg   if test "x$FOP" = "x"; then
201348af84faSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
201448af84faSmrg   fi
201548af84faSmrg   have_fop=yes
201648af84faSmrgelif test "x$use_fop" = x"no" ; then
201748af84faSmrg   if test "x$FOP" != "x"; then
201848af84faSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
201948af84faSmrg   fi
202048af84faSmrg   have_fop=no
202148af84faSmrgelse
202248af84faSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
202348af84faSmrgfi
2024f931275dSmrg
2025f931275dSmrg# Test for a minimum version of fop, if provided.
2026f931275dSmrgm4_ifval([$1],
2027f931275dSmrg[if test "$have_fop" = yes; then
2028f931275dSmrg    # scrape the fop version
2029f931275dSmrg    AC_MSG_CHECKING([for fop minimum version])
2030f931275dSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2031f931275dSmrg    AC_MSG_RESULT([$fop_version])
2032f931275dSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
2033f931275dSmrg        [if test "x$use_fop" = xauto; then
2034f931275dSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2035f931275dSmrg            have_fop=no
2036f931275dSmrg        else
2037f931275dSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2038f931275dSmrg        fi])
2039f931275dSmrgfi])
204048af84faSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
204148af84faSmrg]) # XORG_WITH_FOP
204248af84faSmrg
2043f931275dSmrg# XORG_WITH_PS2PDF([DEFAULT])
204448af84faSmrg# ----------------
204548af84faSmrg# Minimum version: 1.6.0
2046f931275dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
204748af84faSmrg#
204848af84faSmrg# Documentation tools are not always available on all platforms and sometimes
204948af84faSmrg# not at the appropriate level. This macro enables a module to test for the
205048af84faSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
205148af84faSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2052f931275dSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2053f931275dSmrg# --with-ps2pdf assumes 'auto'.
205448af84faSmrg#
205548af84faSmrg# Interface to module:
205648af84faSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
205748af84faSmrg# PS2PDF:	returns the path of the ps2pdf program found
205848af84faSmrg#		returns the path set by the user in the environment
205948af84faSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
206048af84faSmrg#		 'no' user instructs the module not to use ps2pdf
206148af84faSmrg#
206248af84faSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
206348af84faSmrg#
206448af84faSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
206548af84faSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2066f931275dSmrgm4_define([_defopt], m4_default([$1], [auto]))
206748af84faSmrgAC_ARG_WITH(ps2pdf,
206848af84faSmrg	AS_HELP_STRING([--with-ps2pdf],
2069f931275dSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2070f931275dSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2071f931275dSmrgm4_undefine([_defopt])
207248af84faSmrg
207348af84faSmrgif test "x$use_ps2pdf" = x"auto"; then
207448af84faSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
207548af84faSmrg   if test "x$PS2PDF" = "x"; then
207648af84faSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
207748af84faSmrg	have_ps2pdf=no
207848af84faSmrg   else
207948af84faSmrg        have_ps2pdf=yes
208048af84faSmrg   fi
208148af84faSmrgelif test "x$use_ps2pdf" = x"yes" ; then
208248af84faSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
208348af84faSmrg   if test "x$PS2PDF" = "x"; then
208448af84faSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
208548af84faSmrg   fi
208648af84faSmrg   have_ps2pdf=yes
208748af84faSmrgelif test "x$use_ps2pdf" = x"no" ; then
208848af84faSmrg   if test "x$PS2PDF" != "x"; then
208948af84faSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
209048af84faSmrg   fi
209148af84faSmrg   have_ps2pdf=no
209248af84faSmrgelse
209348af84faSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
209448af84faSmrgfi
209548af84faSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
209648af84faSmrg]) # XORG_WITH_PS2PDF
209748af84faSmrg
209848af84faSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
209948af84faSmrg# ----------------
210048af84faSmrg# Minimum version: 1.6.0
210148af84faSmrg#
210248af84faSmrg# Documentation tools are not always available on all platforms and sometimes
210348af84faSmrg# not at the appropriate level. This macro enables a builder to skip all
210448af84faSmrg# documentation targets except traditional man pages.
210548af84faSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
210648af84faSmrg# maximum flexibilty in controlling documentation building.
210748af84faSmrg# Refer to:
210848af84faSmrg# XORG_WITH_XMLTO         --with-xmlto
210948af84faSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
211048af84faSmrg# XORG_WITH_DOXYGEN       --with-doxygen
211148af84faSmrg# XORG_WITH_FOP           --with-fop
211248af84faSmrg# XORG_WITH_GROFF         --with-groff
211348af84faSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
211448af84faSmrg#
211548af84faSmrg# Interface to module:
211648af84faSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
211748af84faSmrg# --enable-docs: 'yes' user instructs the module to generate docs
211848af84faSmrg#		 'no' user instructs the module not to generate docs
211948af84faSmrg# parm1:	specify the default value, yes or no.
212048af84faSmrg#
212148af84faSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2122f931275dSmrgm4_define([docs_default], m4_default([$1], [yes]))
212348af84faSmrgAC_ARG_ENABLE(docs,
212448af84faSmrg	AS_HELP_STRING([--enable-docs],
2125f931275dSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2126f931275dSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2127f931275dSmrgm4_undefine([docs_default])
212848af84faSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
212948af84faSmrgAC_MSG_CHECKING([whether to build documentation])
213048af84faSmrgAC_MSG_RESULT([$build_docs])
213148af84faSmrg]) # XORG_ENABLE_DOCS
213248af84faSmrg
213348af84faSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
213448af84faSmrg# ----------------
213548af84faSmrg# Minimum version: 1.6.0
213648af84faSmrg#
213748af84faSmrg# This macro enables a builder to skip all developer documentation.
213848af84faSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
213948af84faSmrg# maximum flexibilty in controlling documentation building.
214048af84faSmrg# Refer to:
214148af84faSmrg# XORG_WITH_XMLTO         --with-xmlto
214248af84faSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
214348af84faSmrg# XORG_WITH_DOXYGEN       --with-doxygen
214448af84faSmrg# XORG_WITH_FOP           --with-fop
214548af84faSmrg# XORG_WITH_GROFF         --with-groff
214648af84faSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
214748af84faSmrg#
214848af84faSmrg# Interface to module:
214948af84faSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
215048af84faSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
215148af84faSmrg#			'no' user instructs the module not to generate developer docs
215248af84faSmrg# parm1:		specify the default value, yes or no.
215348af84faSmrg#
215448af84faSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2155f931275dSmrgm4_define([devel_default], m4_default([$1], [yes]))
215648af84faSmrgAC_ARG_ENABLE(devel-docs,
215748af84faSmrg	AS_HELP_STRING([--enable-devel-docs],
2158f931275dSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2159f931275dSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2160f931275dSmrgm4_undefine([devel_default])
216148af84faSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
216248af84faSmrgAC_MSG_CHECKING([whether to build developer documentation])
216348af84faSmrgAC_MSG_RESULT([$build_devel_docs])
216448af84faSmrg]) # XORG_ENABLE_DEVEL_DOCS
216548af84faSmrg
216648af84faSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
216748af84faSmrg# ----------------
216848af84faSmrg# Minimum version: 1.6.0
216948af84faSmrg#
217048af84faSmrg# This macro enables a builder to skip all functional specification targets.
217148af84faSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
217248af84faSmrg# maximum flexibilty in controlling documentation building.
217348af84faSmrg# Refer to:
217448af84faSmrg# XORG_WITH_XMLTO         --with-xmlto
217548af84faSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
217648af84faSmrg# XORG_WITH_DOXYGEN       --with-doxygen
217748af84faSmrg# XORG_WITH_FOP           --with-fop
217848af84faSmrg# XORG_WITH_GROFF         --with-groff
217948af84faSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
218048af84faSmrg#
218148af84faSmrg# Interface to module:
218248af84faSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
218348af84faSmrg# --enable-specs:	'yes' user instructs the module to generate specs
218448af84faSmrg#			'no' user instructs the module not to generate specs
218548af84faSmrg# parm1:		specify the default value, yes or no.
218648af84faSmrg#
218748af84faSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2188f931275dSmrgm4_define([spec_default], m4_default([$1], [yes]))
218948af84faSmrgAC_ARG_ENABLE(specs,
219048af84faSmrg	AS_HELP_STRING([--enable-specs],
2191f931275dSmrg	   [Enable building the specs (default: ]spec_default[)]),
2192f931275dSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
2193f931275dSmrgm4_undefine([spec_default])
219448af84faSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
219548af84faSmrgAC_MSG_CHECKING([whether to build functional specifications])
219648af84faSmrgAC_MSG_RESULT([$build_specs])
219748af84faSmrg]) # XORG_ENABLE_SPECS
219848af84faSmrg
2199f931275dSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2200f931275dSmrg# ----------------------------------------------
2201f931275dSmrg# Minimum version: 1.13.0
2202f931275dSmrg#
2203f931275dSmrg# This macro enables a builder to enable/disable unit testing
2204f931275dSmrg# It makes no assumption about the test cases implementation
2205f931275dSmrg# Test cases may or may not use Automake "Support for test suites"
2206f931275dSmrg# They may or may not use the software utility library GLib
2207f931275dSmrg#
2208f931275dSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2209f931275dSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2210f931275dSmrg# The variable enable_unit_tests is used by other macros in this file.
2211f931275dSmrg#
2212f931275dSmrg# Interface to module:
2213f931275dSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2214f931275dSmrg# enable_unit_tests:    used in configure.ac for additional configuration
2215f931275dSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2216f931275dSmrg#			'no' user instructs the module not to build tests
2217f931275dSmrg# parm1:		specify the default value, yes or no.
2218f931275dSmrg#
2219f931275dSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2220f931275dSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2221f931275dSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2222f931275dSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2223f931275dSmrgm4_define([_defopt], m4_default([$1], [auto]))
2224f931275dSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2225f931275dSmrg	[Enable building unit test cases (default: ]_defopt[)]),
2226f931275dSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2227f931275dSmrgm4_undefine([_defopt])
2228f931275dSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2229f931275dSmrgAC_MSG_CHECKING([whether to build unit test cases])
2230f931275dSmrgAC_MSG_RESULT([$enable_unit_tests])
2231f931275dSmrg]) # XORG_ENABLE_UNIT_TESTS
2232f931275dSmrg
2233f931275dSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2234f931275dSmrg# ----------------------------------------
2235f931275dSmrg# Minimum version: 1.13.0
2236f931275dSmrg#
2237f931275dSmrg# GLib is a library which provides advanced data structures and functions.
2238f931275dSmrg# This macro enables a module to test for the presence of Glib.
2239f931275dSmrg#
2240f931275dSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2241f931275dSmrg# Otherwise the value of $enable_unit_tests is blank.
2242f931275dSmrg#
2243f931275dSmrg# Interface to module:
2244f931275dSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
2245f931275dSmrg# with_glib: used in configure.ac to know if GLib has been found
2246f931275dSmrg# --with-glib:	'yes' user instructs the module to use glib
2247f931275dSmrg#		'no' user instructs the module not to use glib
2248f931275dSmrg#
2249f931275dSmrgAC_DEFUN([XORG_WITH_GLIB],[
2250f931275dSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2251f931275dSmrgm4_define([_defopt], m4_default([$2], [auto]))
2252f931275dSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2253f931275dSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2254f931275dSmrg	[with_glib=$withval], [with_glib=]_defopt)
2255f931275dSmrgm4_undefine([_defopt])
2256f931275dSmrg
2257f931275dSmrghave_glib=no
2258f931275dSmrg# Do not probe GLib if user explicitly disabled unit testing
2259f931275dSmrgif test "x$enable_unit_tests" != x"no"; then
2260f931275dSmrg  # Do not probe GLib if user explicitly disabled it
2261f931275dSmrg  if test "x$with_glib" != x"no"; then
2262f931275dSmrg    m4_ifval(
2263f931275dSmrg      [$1],
2264f931275dSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2265f931275dSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2266f931275dSmrg    )
2267f931275dSmrg  fi
2268f931275dSmrgfi
2269f931275dSmrg
2270f931275dSmrg# Not having GLib when unit testing has been explicitly requested is an error
2271f931275dSmrgif test "x$enable_unit_tests" = x"yes"; then
2272f931275dSmrg  if test "x$have_glib" = x"no"; then
2273f931275dSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2274f931275dSmrg  fi
2275f931275dSmrgfi
2276f931275dSmrg
2277f931275dSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
2278f931275dSmrgif test "x$enable_unit_tests" = x"no"; then
2279f931275dSmrg  if test "x$with_glib" = x"yes"; then
2280f931275dSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2281f931275dSmrg  fi
2282f931275dSmrgfi
2283f931275dSmrg
2284f931275dSmrg# Not having GLib when it has been explicitly requested is an error
2285f931275dSmrgif test "x$with_glib" = x"yes"; then
2286f931275dSmrg  if test "x$have_glib" = x"no"; then
2287f931275dSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2288f931275dSmrg  fi
2289f931275dSmrgfi
2290f931275dSmrg
2291f931275dSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2292f931275dSmrg]) # XORG_WITH_GLIB
2293f931275dSmrg
2294f931275dSmrg# XORG_LD_WRAP([required|optional])
2295f931275dSmrg# ---------------------------------
2296f931275dSmrg# Minimum version: 1.13.0
2297f931275dSmrg#
2298f931275dSmrg# Check if linker supports -wrap, passed via compiler flags
2299f931275dSmrg#
2300f931275dSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2301f931275dSmrg# Otherwise the value of $enable_unit_tests is blank.
2302f931275dSmrg#
2303f931275dSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2304f931275dSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2305f931275dSmrg# available, an argument of "optional" allows use when some unit tests require
2306f931275dSmrg# ld -wrap and others do not.
2307f931275dSmrg#
2308f931275dSmrgAC_DEFUN([XORG_LD_WRAP],[
2309f931275dSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2310f931275dSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2311f931275dSmrg                      void __wrap_exit(int status) { return; }],
2312f931275dSmrg                     [exit(0);])])
2313f931275dSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
2314f931275dSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2315f931275dSmrg  if test "x$have_ld_wrap" = x"no"; then
2316f931275dSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2317f931275dSmrg  fi
2318f931275dSmrgfi
2319f931275dSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2320f931275dSmrg#
2321f931275dSmrg]) # XORG_LD_WRAP
2322f931275dSmrg
2323f931275dSmrg# XORG_CHECK_LINKER_FLAGS
2324f931275dSmrg# -----------------------
2325f931275dSmrg# SYNOPSIS
2326f931275dSmrg#
2327f931275dSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2328f931275dSmrg#
2329f931275dSmrg# DESCRIPTION
2330f931275dSmrg#
2331f931275dSmrg#   Check whether the given linker FLAGS work with the current language's
2332f931275dSmrg#   linker, or whether they give an error.
2333f931275dSmrg#
2334f931275dSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2335f931275dSmrg#   success/failure.
2336f931275dSmrg#
2337f931275dSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
2338f931275dSmrg#
2339f931275dSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2340f931275dSmrg#
2341f931275dSmrg# LICENSE
2342f931275dSmrg#
2343f931275dSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2344f931275dSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2345f931275dSmrg#   Copyright (c) 2009 Matteo Frigo
2346f931275dSmrg#
2347f931275dSmrg#   This program is free software: you can redistribute it and/or modify it
2348f931275dSmrg#   under the terms of the GNU General Public License as published by the
2349f931275dSmrg#   Free Software Foundation, either version 3 of the License, or (at your
2350f931275dSmrg#   option) any later version.
2351f931275dSmrg#
2352f931275dSmrg#   This program is distributed in the hope that it will be useful, but
2353f931275dSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2354f931275dSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2355f931275dSmrg#   Public License for more details.
2356f931275dSmrg#
2357f931275dSmrg#   You should have received a copy of the GNU General Public License along
2358f931275dSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2359f931275dSmrg#
2360f931275dSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
2361f931275dSmrg#   gives unlimited permission to copy, distribute and modify the configure
2362f931275dSmrg#   scripts that are the output of Autoconf when processing the Macro. You
2363f931275dSmrg#   need not follow the terms of the GNU General Public License when using
2364f931275dSmrg#   or distributing such scripts, even though portions of the text of the
2365f931275dSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2366f931275dSmrg#   all other use of the material that constitutes the Autoconf Macro.
2367f931275dSmrg#
2368f931275dSmrg#   This special exception to the GPL applies to versions of the Autoconf
2369f931275dSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
2370f931275dSmrg#   modified version of the Autoconf Macro, you may extend this special
2371f931275dSmrg#   exception to the GPL to apply to your modified version as well.#
2372f931275dSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2373f931275dSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
2374f931275dSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2375f931275dSmrgAS_LITERAL_IF([$1],
2376f931275dSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2377f931275dSmrg      ax_save_FLAGS=$LDFLAGS
2378f931275dSmrg      LDFLAGS="$1"
2379f931275dSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2380f931275dSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2381f931275dSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2382f931275dSmrg      LDFLAGS=$ax_save_FLAGS])],
2383f931275dSmrg  [ax_save_FLAGS=$LDFLAGS
2384f931275dSmrg   LDFLAGS="$1"
2385f931275dSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2386f931275dSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2387f931275dSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2388f931275dSmrg   LDFLAGS=$ax_save_FLAGS])
2389f931275dSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2390f931275dSmrgAC_MSG_RESULT($xorg_check_linker_flags)
2391f931275dSmrgif test "x$xorg_check_linker_flags" = xyes; then
2392f931275dSmrg	m4_default([$2], :)
2393f931275dSmrgelse
2394f931275dSmrg	m4_default([$3], :)
2395f931275dSmrgfi
2396f931275dSmrg]) # XORG_CHECK_LINKER_FLAGS
2397f931275dSmrg
2398f931275dSmrg# XORG_MEMORY_CHECK_FLAGS
2399f931275dSmrg# -----------------------
2400f931275dSmrg# Minimum version: 1.16.0
2401f931275dSmrg#
2402f931275dSmrg# This macro attempts to find appropriate memory checking functionality
2403f931275dSmrg# for various platforms which unit testing code may use to catch various
2404f931275dSmrg# forms of memory allocation and access errors in testing.
2405f931275dSmrg#
2406f931275dSmrg# Interface to module:
2407f931275dSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2408f931275dSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2409f931275dSmrg#
2410f931275dSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2411f931275dSmrg#
2412f931275dSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2413f931275dSmrg
2414f931275dSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2415f931275dSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2416f931275dSmrg           [Environment variables to enable memory checking in tests])
2417f931275dSmrg
2418f931275dSmrg# Check for different types of support on different platforms
2419f931275dSmrgcase $host_os in
2420f931275dSmrg    solaris*)
2421f931275dSmrg        AC_CHECK_LIB([umem], [umem_alloc],
2422f931275dSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2423f931275dSmrg        ;;
2424f931275dSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2425f931275dSmrg        # both directly and inverted, so should not be 0 or 255.
2426f931275dSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
2427f931275dSmrg        ;;
2428f931275dSmrg    darwin*)
2429f931275dSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2430f931275dSmrg        ;;
2431f931275dSmrg    *bsd*)
2432f931275dSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2433f931275dSmrg        ;;
2434f931275dSmrgesac
2435f931275dSmrg
2436f931275dSmrg# User supplied flags override default flags
2437f931275dSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2438f931275dSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2439f931275dSmrgfi
2440f931275dSmrg
2441f931275dSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2442f931275dSmrg]) # XORG_WITH_LINT
2443f931275dSmrg
2444a9274bcdSmrg# XORG_CHECK_MALLOC_ZERO
2445a9274bcdSmrg# ----------------------
2446a9274bcdSmrg# Minimum version: 1.0.0
244789d09728Smrg#
2448a9274bcdSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2449a9274bcdSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2450a9274bcdSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2451a9274bcdSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2452a9274bcdSmrgAC_ARG_ENABLE(malloc0returnsnull,
2453a9274bcdSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2454a9274bcdSmrg		       [malloc(0) returns NULL (default: auto)]),
2455a9274bcdSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2456a9274bcdSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
245789d09728Smrg
2458a9274bcdSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2459a9274bcdSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2460f931275dSmrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
2461f931275dSmrg#include <stdlib.h>
2462f931275dSmrg],[
2463a9274bcdSmrg    char *m0, *r0, *c0, *p;
2464a9274bcdSmrg    m0 = malloc(0);
2465a9274bcdSmrg    p = malloc(10);
2466a9274bcdSmrg    r0 = realloc(p,0);
2467f931275dSmrg    c0 = calloc(0,10);
2468f931275dSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2469f931275dSmrg])],
2470a9274bcdSmrg		[MALLOC_ZERO_RETURNS_NULL=yes],
247148af84faSmrg		[MALLOC_ZERO_RETURNS_NULL=no],
247248af84faSmrg		[MALLOC_ZERO_RETURNS_NULL=yes])
2473a9274bcdSmrgfi
2474a9274bcdSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
247589d09728Smrg
2476a9274bcdSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2477a9274bcdSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2478a9274bcdSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2479a9274bcdSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2480a9274bcdSmrgelse
2481a9274bcdSmrg	MALLOC_ZERO_CFLAGS=""
2482a9274bcdSmrg	XMALLOC_ZERO_CFLAGS=""
2483a9274bcdSmrg	XTMALLOC_ZERO_CFLAGS=""
2484a9274bcdSmrgfi
248566fe65f6Smrg
2486a9274bcdSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2487a9274bcdSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2488a9274bcdSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2489a9274bcdSmrg]) # XORG_CHECK_MALLOC_ZERO
2490a9274bcdSmrg
2491a9274bcdSmrg# XORG_WITH_LINT()
2492a9274bcdSmrg# ----------------
2493a9274bcdSmrg# Minimum version: 1.1.0
249466fe65f6Smrg#
249548af84faSmrg# This macro enables the use of a tool that flags some suspicious and
249648af84faSmrg# non-portable constructs (likely to be bugs) in C language source code.
249748af84faSmrg# It will attempt to locate the tool and use appropriate options.
249848af84faSmrg# There are various lint type tools on different platforms.
249948af84faSmrg#
250048af84faSmrg# Interface to module:
250148af84faSmrg# LINT:		returns the path to the tool found on the platform
250248af84faSmrg#		or the value set to LINT on the configure cmd line
250348af84faSmrg#		also an Automake conditional
250448af84faSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
250548af84faSmrg#
250648af84faSmrg# --with-lint:	'yes' user instructs the module to use lint
250748af84faSmrg#		'no' user instructs the module not to use lint (default)
250848af84faSmrg#
250948af84faSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
251048af84faSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2511a9274bcdSmrg#
2512a9274bcdSmrgAC_DEFUN([XORG_WITH_LINT],[
251366fe65f6Smrg
251448af84faSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
251548af84faSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2516a9274bcdSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2517a9274bcdSmrg		[Use a lint-style source code checker (default: disabled)])],
2518a9274bcdSmrg		[use_lint=$withval], [use_lint=no])
251948af84faSmrg
252048af84faSmrg# Obtain platform specific info like program name and options
252148af84faSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
252248af84faSmrgcase $host_os in
252348af84faSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
252448af84faSmrg	lint_name=splint
252548af84faSmrg	lint_options="-badflag"
252648af84faSmrg	;;
252748af84faSmrg  *freebsd* | *netbsd*)
252848af84faSmrg	lint_name=lint
252948af84faSmrg	lint_options="-u -b"
253048af84faSmrg	;;
253148af84faSmrg  *solaris*)
253248af84faSmrg	lint_name=lint
253348af84faSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
253448af84faSmrg	;;
253548af84faSmrgesac
253648af84faSmrg
253748af84faSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
253848af84faSmrgif test "x$use_lint" = x"yes" ; then
253948af84faSmrg   AC_PATH_PROG([LINT], [$lint_name])
254048af84faSmrg   if test "x$LINT" = "x"; then
254148af84faSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
254248af84faSmrg   fi
254348af84faSmrgelif test "x$use_lint" = x"no" ; then
254448af84faSmrg   if test "x$LINT" != "x"; then
254548af84faSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
254648af84faSmrg   fi
2547a9274bcdSmrgelse
254848af84faSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2549a9274bcdSmrgfi
255048af84faSmrg
255148af84faSmrg# User supplied flags override default flags
255248af84faSmrgif test "x$LINT_FLAGS" != "x"; then
255348af84faSmrg   lint_options=$LINT_FLAGS
2554a9274bcdSmrgfi
255566fe65f6Smrg
255648af84faSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
255748af84faSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2558a9274bcdSmrg
2559a9274bcdSmrg]) # XORG_WITH_LINT
2560a9274bcdSmrg
2561a9274bcdSmrg# XORG_LINT_LIBRARY(LIBNAME)
2562a9274bcdSmrg# --------------------------
2563a9274bcdSmrg# Minimum version: 1.1.0
256466fe65f6Smrg#
2565a9274bcdSmrg# Sets up flags for building lint libraries for checking programs that call
2566a9274bcdSmrg# functions in the library.
256766fe65f6Smrg#
256848af84faSmrg# Interface to module:
256948af84faSmrg# LINTLIB		- Automake variable with the name of lint library file to make
257048af84faSmrg# MAKE_LINT_LIB		- Automake conditional
257148af84faSmrg#
257248af84faSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
257348af84faSmrg#			  - 'no' user instructs the module not to create a lint library (default)
257466fe65f6Smrg
2575a9274bcdSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2576a9274bcdSmrgAC_REQUIRE([XORG_WITH_LINT])
2577a9274bcdSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2578a9274bcdSmrg	[Create lint library (default: disabled)])],
2579a9274bcdSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
258048af84faSmrg
258148af84faSmrgif test "x$make_lint_lib" = x"yes" ; then
258248af84faSmrg   LINTLIB=llib-l$1.ln
258348af84faSmrg   if test "x$LINT" = "x"; then
258448af84faSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
258548af84faSmrg   fi
258648af84faSmrgelif test "x$make_lint_lib" != x"no" ; then
258748af84faSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2588a9274bcdSmrgfi
258948af84faSmrg
2590a9274bcdSmrgAC_SUBST(LINTLIB)
2591a9274bcdSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
259266fe65f6Smrg
2593a9274bcdSmrg]) # XORG_LINT_LIBRARY
259466fe65f6Smrg
2595f931275dSmrg# XORG_COMPILER_BRAND
2596f931275dSmrg# -------------------
2597f931275dSmrg# Minimum version: 1.14.0
2598f931275dSmrg#
2599f931275dSmrg# Checks for various brands of compilers and sets flags as appropriate:
2600f931275dSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2601f931275dSmrg#   clang compiler - sets CLANGCC to "yes"
2602f931275dSmrg#   Intel compiler - sets INTELCC to "yes"
2603f931275dSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2604f931275dSmrg#
2605f931275dSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2606f931275dSmrgAC_REQUIRE([AC_PROG_CC_C99])
2607f931275dSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2608f931275dSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2609f931275dSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2610f931275dSmrg]) # XORG_COMPILER_BRAND
2611f931275dSmrg
2612f931275dSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2613f931275dSmrg# ---------------
2614f931275dSmrg# Minimum version: 1.16.0
2615f931275dSmrg#
2616f931275dSmrg# Test if the compiler works when passed the given flag as a command line argument.
2617f931275dSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2618f931275dSmrg# next flag in the list until there are no more options.
2619f931275dSmrg#
2620f931275dSmrg# Note that this does not guarantee that the compiler supports the flag as some
2621f931275dSmrg# compilers will simply ignore arguments that they do not understand, but we do
2622f931275dSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2623f931275dSmrg# -Werror=unused-command-line-argument
2624f931275dSmrg#
2625f931275dSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2626f931275dSmrgAC_REQUIRE([AC_PROG_CC_C99])
2627f931275dSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2628f931275dSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2629f931275dSmrg
2630f931275dSmrgxorg_testset_save_CFLAGS="$CFLAGS"
2631f931275dSmrg
2632f931275dSmrgif test "x$xorg_testset_unknown_warning_option" = "x" ; then
2633f931275dSmrg	CFLAGS="$CFLAGS -Werror=unknown-warning-option"
2634f931275dSmrg	AC_CACHE_CHECK([if $CC supports -Werror=unknown-warning-option],
2635f931275dSmrg			xorg_cv_cc_flag_unknown_warning_option,
2636f931275dSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2637f931275dSmrg					  [xorg_cv_cc_flag_unknown_warning_option=yes],
2638f931275dSmrg					  [xorg_cv_cc_flag_unknown_warning_option=no]))
2639f931275dSmrg	xorg_testset_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option
2640f931275dSmrg	CFLAGS="$xorg_testset_save_CFLAGS"
2641f931275dSmrgfi
2642f931275dSmrg
2643f931275dSmrgif test "x$xorg_testset_unused_command_line_argument" = "x" ; then
2644f931275dSmrg	if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
2645f931275dSmrg		CFLAGS="$CFLAGS -Werror=unknown-warning-option"
2646f931275dSmrg	fi
2647f931275dSmrg	CFLAGS="$CFLAGS -Werror=unused-command-line-argument"
2648f931275dSmrg	AC_CACHE_CHECK([if $CC supports -Werror=unused-command-line-argument],
2649f931275dSmrg			xorg_cv_cc_flag_unused_command_line_argument,
2650f931275dSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2651f931275dSmrg					  [xorg_cv_cc_flag_unused_command_line_argument=yes],
2652f931275dSmrg					  [xorg_cv_cc_flag_unused_command_line_argument=no]))
2653f931275dSmrg	xorg_testset_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument
2654f931275dSmrg	CFLAGS="$xorg_testset_save_CFLAGS"
2655f931275dSmrgfi
2656f931275dSmrg
2657f931275dSmrgfound="no"
2658f931275dSmrgm4_foreach([flag], m4_cdr($@), [
2659f931275dSmrg	if test $found = "no" ; then
2660f931275dSmrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
2661f931275dSmrg			CFLAGS="$CFLAGS -Werror=unknown-warning-option"
2662f931275dSmrg		fi
2663f931275dSmrg
2664f931275dSmrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
2665f931275dSmrg			CFLAGS="$CFLAGS -Werror=unused-command-line-argument"
2666f931275dSmrg		fi
2667f931275dSmrg
2668f931275dSmrg		CFLAGS="$CFLAGS ]flag["
2669f931275dSmrg
2670f931275dSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2671f931275dSmrg		AC_MSG_CHECKING([if $CC supports ]flag[])
2672f931275dSmrg		cacheid=`AS_ECHO([xorg_cv_cc_flag_]flag[])`
2673f931275dSmrg		AC_CACHE_VAL(AS_TR_SH($cacheid),
2674f931275dSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2675f931275dSmrg					     [eval AS_TR_SH($cacheid)=yes],
2676f931275dSmrg					     [eval AS_TR_SH($cacheid)=no])])
2677f931275dSmrg
2678f931275dSmrg		CFLAGS="$xorg_testset_save_CFLAGS"
2679f931275dSmrg
2680f931275dSmrg		eval supported=$AS_TR_SH($cacheid)
2681f931275dSmrg		AC_MSG_RESULT([$supported])
2682f931275dSmrg		if test "$supported" = "yes" ; then
2683f931275dSmrg			$1="$$1 ]flag["
2684f931275dSmrg			found="yes"
2685f931275dSmrg		fi
2686f931275dSmrg	fi
2687f931275dSmrg])
2688f931275dSmrg]) # XORG_TESTSET_CFLAG
2689f931275dSmrg
2690f931275dSmrg# XORG_COMPILER_FLAGS
2691f931275dSmrg# ---------------
2692f931275dSmrg# Minimum version: 1.16.0
2693f931275dSmrg#
2694f931275dSmrg# Defines BASE_CFLAGS to contain a set of command line arguments supported
2695f931275dSmrg# by the selected compiler which do NOT alter the generated code.  These
2696f931275dSmrg# arguments will cause the compiler to print various warnings during
2697f931275dSmrg# compilation AND turn a conservative set of warnings into errors.
2698f931275dSmrg#
2699f931275dSmrg# The set of flags supported by BASE_CFLAGS will grow in future
2700f931275dSmrg# versions of util-macros as options are added to new compilers.
2701f931275dSmrg#
2702f931275dSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2703f931275dSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2704f931275dSmrg
2705f931275dSmrgAC_ARG_ENABLE(selective-werror,
2706f931275dSmrg              AS_HELP_STRING([--disable-selective-werror],
2707f931275dSmrg                             [Turn off selective compiler errors. (default: enabled)]),
2708f931275dSmrg              [SELECTIVE_WERROR=$enableval],
2709f931275dSmrg              [SELECTIVE_WERROR=yes])
2710f931275dSmrg
2711f931275dSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2712f931275dSmrgif test "x$SUNCC" = "xyes"; then
2713f931275dSmrg    BASE_CFLAGS="-v"
2714f931275dSmrgelse
2715f931275dSmrg    BASE_CFLAGS=""
2716f931275dSmrgfi
2717f931275dSmrg
2718f931275dSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2719f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wall])
2720f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wpointer-arith])
2721f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wstrict-prototypes])
2722f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-prototypes])
2723f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-declarations])
2724f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wnested-externs])
2725f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wbad-function-cast])
2726f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wformat=2], [-Wformat])
2727f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wold-style-definition])
2728f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wdeclaration-after-statement])
2729f931275dSmrg
2730f931275dSmrg# This chunk adds additional warnings that could catch undesired effects.
2731f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wunused])
2732f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wuninitialized])
2733f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wshadow])
2734f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wcast-qual])
2735f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-noreturn])
2736f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-format-attribute])
2737f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wredundant-decls])
2738f931275dSmrg
2739f931275dSmrg# These are currently disabled because they are noisy.  They will be enabled
2740f931275dSmrg# in the future once the codebase is sufficiently modernized to silence
2741f931275dSmrg# them.  For now, I don't want them to drown out the other warnings.
2742f931275dSmrg# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wlogical-op])
2743f931275dSmrg# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wparentheses])
2744f931275dSmrg# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wcast-align])
2745f931275dSmrg
2746f931275dSmrg# Turn some warnings into errors, so we don't accidently get successful builds
2747f931275dSmrg# when there are problems that should be fixed.
2748f931275dSmrg
2749f931275dSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
2750f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
2751f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=nonnull])
2752f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=init-self])
2753f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=main])
2754f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=missing-braces])
2755f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=sequence-point])
2756f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
2757f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=trigraphs])
2758f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=array-bounds])
2759f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=write-strings])
2760f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=address])
2761f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
2762f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
2763f931275dSmrgelse
2764f931275dSmrgAC_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])
2765f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wimplicit])
2766f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wnonnull])
2767f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Winit-self])
2768f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmain])
2769f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-braces])
2770f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wsequence-point])
2771f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wreturn-type])
2772f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wtrigraphs])
2773f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Warray-bounds])
2774f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wwrite-strings])
2775f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Waddress])
2776f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wint-to-pointer-cast])
2777f931275dSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wpointer-to-int-cast])
2778f931275dSmrgfi
2779f931275dSmrg
2780f931275dSmrgAC_SUBST([BASE_CFLAGS])
2781f931275dSmrg]) # XORG_COMPILER_FLAGS
2782f931275dSmrg
2783a9274bcdSmrg# XORG_CWARNFLAGS
2784a9274bcdSmrg# ---------------
2785a9274bcdSmrg# Minimum version: 1.2.0
2786f931275dSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2787a9274bcdSmrg#
2788a9274bcdSmrg# Defines CWARNFLAGS to enable C compiler warnings.
2789a9274bcdSmrg#
2790f931275dSmrg# This function is deprecated because it defines -fno-strict-aliasing
2791f931275dSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
2792f931275dSmrg# is needed, then it should be added explicitly in the module when
2793f931275dSmrg# it is updated to use BASE_CFLAGS.
2794f931275dSmrg#
2795a9274bcdSmrgAC_DEFUN([XORG_CWARNFLAGS], [
2796f931275dSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2797f931275dSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2798f931275dSmrgCWARNFLAGS="$BASE_CFLAGS"
2799a9274bcdSmrgif  test "x$GCC" = xyes ; then
2800f931275dSmrg    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
2801a9274bcdSmrgfi
2802a9274bcdSmrgAC_SUBST(CWARNFLAGS)
2803a9274bcdSmrg]) # XORG_CWARNFLAGS
2804a9274bcdSmrg
2805a9274bcdSmrg# XORG_STRICT_OPTION
2806a9274bcdSmrg# -----------------------
2807a9274bcdSmrg# Minimum version: 1.3.0
2808a9274bcdSmrg#
2809f931275dSmrg# Add configure option to enable strict compilation flags, such as treating
2810f931275dSmrg# warnings as fatal errors.
2811f931275dSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
2812f931275dSmrg# $BASE_CFLAGS and the deprecated $CWARNFLAGS.
2813f931275dSmrg#
2814f931275dSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
2815f931275dSmrg# when strict compilation is unconditionally desired.
2816a9274bcdSmrgAC_DEFUN([XORG_STRICT_OPTION], [
2817a9274bcdSmrgAC_REQUIRE([XORG_CWARNFLAGS])
2818f931275dSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2819a9274bcdSmrg
2820a9274bcdSmrgAC_ARG_ENABLE(strict-compilation,
2821a9274bcdSmrg			  AS_HELP_STRING([--enable-strict-compilation],
2822a9274bcdSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2823a9274bcdSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2824f931275dSmrg
2825f931275dSmrgSTRICT_CFLAGS=""
2826f931275dSmrgXORG_TESTSET_CFLAG([STRICT_CFLAGS], [-pedantic])
2827f931275dSmrgXORG_TESTSET_CFLAG([STRICT_CFLAGS], [-Werror], [-errwarn])
2828f931275dSmrg
2829f931275dSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
2830f931275dSmrg# activate it with -Werror, so we add it here explicitly.
2831f931275dSmrgXORG_TESTSET_CFLAG([STRICT_CFLAGS], [-Werror=attributes])
2832f931275dSmrg
2833a9274bcdSmrgif test "x$STRICT_COMPILE" = "xyes"; then
2834f931275dSmrg    BASE_CFLAGS="$BASE_CFLAGS $STRICT_CFLAGS"
2835f931275dSmrg    CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
2836a9274bcdSmrgfi
2837f931275dSmrgAC_SUBST([STRICT_CFLAGS])
2838f931275dSmrgAC_SUBST([BASE_CFLAGS])
2839a9274bcdSmrgAC_SUBST([CWARNFLAGS])
2840a9274bcdSmrg]) # XORG_STRICT_OPTION
2841a9274bcdSmrg
2842a9274bcdSmrg# XORG_DEFAULT_OPTIONS
2843a9274bcdSmrg# --------------------
2844a9274bcdSmrg# Minimum version: 1.3.0
2845a9274bcdSmrg#
2846a9274bcdSmrg# Defines default options for X.Org modules.
2847a9274bcdSmrg#
2848a9274bcdSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
284948af84faSmrgAC_REQUIRE([AC_PROG_INSTALL])
2850f931275dSmrgXORG_COMPILER_FLAGS
2851a9274bcdSmrgXORG_CWARNFLAGS
2852a9274bcdSmrgXORG_STRICT_OPTION
2853a9274bcdSmrgXORG_RELEASE_VERSION
2854a9274bcdSmrgXORG_CHANGELOG
285548af84faSmrgXORG_INSTALL
2856a9274bcdSmrgXORG_MANPAGE_SECTIONS
285748af84faSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
285848af84faSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
2859a9274bcdSmrg]) # XORG_DEFAULT_OPTIONS
286048af84faSmrg
286148af84faSmrg# XORG_INSTALL()
286248af84faSmrg# ----------------
286348af84faSmrg# Minimum version: 1.4.0
286448af84faSmrg#
286548af84faSmrg# Defines the variable INSTALL_CMD as the command to copy
286648af84faSmrg# INSTALL from $prefix/share/util-macros.
286748af84faSmrg#
286848af84faSmrgAC_DEFUN([XORG_INSTALL], [
286948af84faSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
287048af84faSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
287148af84faSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
287248af84faSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
287348af84faSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
287448af84faSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
287548af84faSmrgAC_SUBST([INSTALL_CMD])
287648af84faSmrg]) # XORG_INSTALL
2877a9274bcdSmrgdnl Copyright 2005 Red Hat, Inc
2878a9274bcdSmrgdnl
2879a9274bcdSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
2880a9274bcdSmrgdnl documentation for any purpose is hereby granted without fee, provided that
2881a9274bcdSmrgdnl the above copyright notice appear in all copies and that both that
2882a9274bcdSmrgdnl copyright notice and this permission notice appear in supporting
2883a9274bcdSmrgdnl documentation.
2884a9274bcdSmrgdnl
2885a9274bcdSmrgdnl The above copyright notice and this permission notice shall be included
2886a9274bcdSmrgdnl in all copies or substantial portions of the Software.
2887a9274bcdSmrgdnl
2888a9274bcdSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2889a9274bcdSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2890a9274bcdSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2891a9274bcdSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2892a9274bcdSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2893a9274bcdSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2894a9274bcdSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
2895a9274bcdSmrgdnl
2896a9274bcdSmrgdnl Except as contained in this notice, the name of the copyright holders shall
2897a9274bcdSmrgdnl not be used in advertising or otherwise to promote the sale, use or
2898a9274bcdSmrgdnl other dealings in this Software without prior written authorization
2899a9274bcdSmrgdnl from the copyright holders.
2900a9274bcdSmrgdnl
2901a9274bcdSmrg
2902a9274bcdSmrg# XORG_RELEASE_VERSION
2903a9274bcdSmrg# --------------------
290448af84faSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
2905a9274bcdSmrg 
2906a9274bcdSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
2907a9274bcdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
2908a9274bcdSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
2909a9274bcdSmrg		[Major version of this package])
2910a9274bcdSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
2911a9274bcdSmrg	if test "x$PVM" = "x"; then
2912a9274bcdSmrg		PVM="0"
2913a9274bcdSmrg	fi
2914a9274bcdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
2915a9274bcdSmrg		[$PVM],
2916a9274bcdSmrg		[Minor version of this package])
2917a9274bcdSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
2918a9274bcdSmrg	if test "x$PVP" = "x"; then
2919a9274bcdSmrg		PVP="0"
2920a9274bcdSmrg	fi
2921a9274bcdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
2922a9274bcdSmrg		[$PVP],
2923a9274bcdSmrg		[Patch version of this package])
2924a9274bcdSmrg])
2925a9274bcdSmrg
2926a9274bcdSmrg# XORG_CHANGELOG()
2927a9274bcdSmrg# ----------------
2928a9274bcdSmrg# Minimum version: 1.2.0
2929a9274bcdSmrg#
2930a9274bcdSmrg# Defines the variable CHANGELOG_CMD as the command to generate
2931a9274bcdSmrg# ChangeLog from git.
2932a9274bcdSmrg#
2933a9274bcdSmrg#
2934a9274bcdSmrgAC_DEFUN([XORG_CHANGELOG], [
293548af84faSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
293648af84faSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
293748af84faSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
2938a9274bcdSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
2939a9274bcdSmrgAC_SUBST([CHANGELOG_CMD])
2940a9274bcdSmrg]) # XORG_CHANGELOG
294166fe65f6Smrg
2942