aclocal.m4 revision 736a7e2c
1736a7e2cSmrg# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
2264fa531Smrg
3c37a63b8Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4c37a63b8Smrg# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
5264fa531Smrg# This file is free software; the Free Software Foundation
6264fa531Smrg# gives unlimited permission to copy and/or distribute it,
7264fa531Smrg# with or without modifications, as long as this notice is preserved.
8264fa531Smrg
9264fa531Smrg# This program is distributed in the hope that it will be useful,
10264fa531Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11264fa531Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12264fa531Smrg# PARTICULAR PURPOSE.
13264fa531Smrg
14c37a63b8Smrgm4_ifndef([AC_AUTOCONF_VERSION],
15c37a63b8Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
16736a7e2cSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
17736a7e2cSmrg[m4_warning([this file was generated for autoconf 2.68.
18c37a63b8SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
19c37a63b8SmrgIf you have problems, you may need to regenerate the build system entirely.
20c37a63b8SmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
21264fa531Smrg
22c37a63b8Smrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
23c37a63b8Smrg#
24c37a63b8Smrg# This file is free software; the Free Software Foundation
25c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
26c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
27264fa531Smrg
28264fa531Smrg# AM_AUTOMAKE_VERSION(VERSION)
29264fa531Smrg# ----------------------------
30264fa531Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
31264fa531Smrg# generated from the m4 files accompanying Automake X.Y.
32c37a63b8Smrg# (This private macro should not be called outside this file.)
33c37a63b8SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
34c37a63b8Smrg[am__api_version='1.11'
35c37a63b8Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
36c37a63b8Smrgdnl require some minimum version.  Point them to the right macro.
37736a7e2cSmrgm4_if([$1], [1.11.1], [],
38c37a63b8Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
39c37a63b8Smrg])
40c37a63b8Smrg
41c37a63b8Smrg# _AM_AUTOCONF_VERSION(VERSION)
42c37a63b8Smrg# -----------------------------
43c37a63b8Smrg# aclocal traces this macro to find the Autoconf version.
44c37a63b8Smrg# This is a private macro too.  Using m4_define simplifies
45c37a63b8Smrg# the logic in aclocal, which can simply ignore this definition.
46c37a63b8Smrgm4_define([_AM_AUTOCONF_VERSION], [])
47264fa531Smrg
48264fa531Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
49264fa531Smrg# -------------------------------
50c37a63b8Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
51c37a63b8Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
52264fa531SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
53736a7e2cSmrg[AM_AUTOMAKE_VERSION([1.11.1])dnl
54c37a63b8Smrgm4_ifndef([AC_AUTOCONF_VERSION],
55c37a63b8Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
56c37a63b8Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
57264fa531Smrg
58c37a63b8Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
59264fa531Smrg
60c37a63b8Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
61264fa531Smrg#
62c37a63b8Smrg# This file is free software; the Free Software Foundation
63c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
64c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
65264fa531Smrg
66264fa531Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
67264fa531Smrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
68264fa531Smrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
69264fa531Smrg#
70264fa531Smrg# Of course, Automake must honor this variable whenever it calls a
71264fa531Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
72264fa531Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
73264fa531Smrg# depending on how configure is run.  This is pretty annoying, since
74264fa531Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
75264fa531Smrg# source directory, any form will work fine, but in subdirectories a
76264fa531Smrg# relative path needs to be adjusted first.
77264fa531Smrg#
78264fa531Smrg# $ac_aux_dir/missing
79264fa531Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
80264fa531Smrg# $top_srcdir/$ac_aux_dir/missing
81264fa531Smrg#    fails if $ac_aux_dir is absolute,
82264fa531Smrg#    fails when called from a subdirectory in a VPATH build with
83264fa531Smrg#          a relative $ac_aux_dir
84264fa531Smrg#
85264fa531Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
86264fa531Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
87264fa531Smrg# harmless because $srcdir is `.', but things will broke when you
88264fa531Smrg# start a VPATH build or use an absolute $srcdir.
89264fa531Smrg#
90264fa531Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
91264fa531Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
92264fa531Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
93264fa531Smrg# and then we would define $MISSING as
94264fa531Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
95264fa531Smrg# This will work as long as MISSING is not called from configure, because
96264fa531Smrg# unfortunately $(top_srcdir) has no meaning in configure.
97264fa531Smrg# However there are other variables, like CC, which are often used in
98264fa531Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
99264fa531Smrg#
100264fa531Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
101264fa531Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
102264fa531Smrg# configured tree to be moved without reconfiguration.
103264fa531Smrg
104c37a63b8SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
105c37a63b8Smrg[dnl Rely on autoconf to set up CDPATH properly.
106c37a63b8SmrgAC_PREREQ([2.50])dnl
107264fa531Smrg# expand $ac_aux_dir to an absolute path
108264fa531Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
109264fa531Smrg])
110264fa531Smrg
111c37a63b8Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112264fa531Smrg
113c37a63b8Smrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
114c37a63b8Smrg# Free Software Foundation, Inc.
115c37a63b8Smrg#
116c37a63b8Smrg# This file is free software; the Free Software Foundation
117c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
118c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
119264fa531Smrg
120c37a63b8Smrg# serial 9
121264fa531Smrg
122c37a63b8Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
123c37a63b8Smrg# -------------------------------------
124c37a63b8Smrg# Define a conditional.
125c37a63b8SmrgAC_DEFUN([AM_CONDITIONAL],
126c37a63b8Smrg[AC_PREREQ(2.52)dnl
127c37a63b8Smrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
128c37a63b8Smrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
129c37a63b8SmrgAC_SUBST([$1_TRUE])dnl
130c37a63b8SmrgAC_SUBST([$1_FALSE])dnl
131c37a63b8Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
132c37a63b8Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
133c37a63b8Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
134c37a63b8Smrgif $2; then
135c37a63b8Smrg  $1_TRUE=
136c37a63b8Smrg  $1_FALSE='#'
137264fa531Smrgelse
138c37a63b8Smrg  $1_TRUE='#'
139c37a63b8Smrg  $1_FALSE=
140264fa531Smrgfi
141c37a63b8SmrgAC_CONFIG_COMMANDS_PRE(
142c37a63b8Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
143c37a63b8Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
144c37a63b8SmrgUsually this means the macro was only invoked conditionally.]])
145c37a63b8Smrgfi])])
146264fa531Smrg
147c37a63b8Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
148c37a63b8Smrg# Free Software Foundation, Inc.
149c37a63b8Smrg#
150c37a63b8Smrg# This file is free software; the Free Software Foundation
151c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
152c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
153264fa531Smrg
154c37a63b8Smrg# serial 10
155264fa531Smrg
156264fa531Smrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
157264fa531Smrg# written in clear, in which case automake, when reading aclocal.m4,
158264fa531Smrg# will think it sees a *use*, and therefore will trigger all it's
159264fa531Smrg# C support machinery.  Also note that it means that autoscan, seeing
160264fa531Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
161264fa531Smrg
162264fa531Smrg
163264fa531Smrg# _AM_DEPENDENCIES(NAME)
164264fa531Smrg# ----------------------
165264fa531Smrg# See how the compiler implements dependency checking.
166264fa531Smrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
167264fa531Smrg# We try a few techniques and use that to set a single cache variable.
168264fa531Smrg#
169264fa531Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
170264fa531Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
171264fa531Smrg# dependency, and given that the user is not expected to run this macro,
172264fa531Smrg# just rely on AC_PROG_CC.
173264fa531SmrgAC_DEFUN([_AM_DEPENDENCIES],
174264fa531Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
175264fa531SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
176264fa531SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
177264fa531SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
178264fa531Smrg
179264fa531Smrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
180264fa531Smrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
181264fa531Smrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
182c37a63b8Smrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
183264fa531Smrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
184264fa531Smrg                   [depcc="$$1"   am_compiler_list=])
185264fa531Smrg
186264fa531SmrgAC_CACHE_CHECK([dependency style of $depcc],
187264fa531Smrg               [am_cv_$1_dependencies_compiler_type],
188264fa531Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
189264fa531Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
190264fa531Smrg  # making bogus files that we don't know about and never remove.  For
191264fa531Smrg  # instance it was reported that on HP-UX the gcc test will end up
192264fa531Smrg  # making a dummy file named `D' -- because `-MD' means `put the output
193264fa531Smrg  # in D'.
194264fa531Smrg  mkdir conftest.dir
195264fa531Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
196264fa531Smrg  # using a relative directory.
197264fa531Smrg  cp "$am_depcomp" conftest.dir
198264fa531Smrg  cd conftest.dir
199264fa531Smrg  # We will build objects and dependencies in a subdirectory because
200264fa531Smrg  # it helps to detect inapplicable dependency modes.  For instance
201264fa531Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
202264fa531Smrg  # side effect of compilation, but ICC will put the dependencies in
203264fa531Smrg  # the current directory while Tru64 will put them in the object
204264fa531Smrg  # directory.
205264fa531Smrg  mkdir sub
206264fa531Smrg
207264fa531Smrg  am_cv_$1_dependencies_compiler_type=none
208264fa531Smrg  if test "$am_compiler_list" = ""; then
209264fa531Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
210264fa531Smrg  fi
211c37a63b8Smrg  am__universal=false
212c37a63b8Smrg  m4_case([$1], [CC],
213c37a63b8Smrg    [case " $depcc " in #(
214c37a63b8Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
215c37a63b8Smrg     esac],
216c37a63b8Smrg    [CXX],
217c37a63b8Smrg    [case " $depcc " in #(
218c37a63b8Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
219c37a63b8Smrg     esac])
220c37a63b8Smrg
221264fa531Smrg  for depmode in $am_compiler_list; do
222264fa531Smrg    # Setup a source with many dependencies, because some compilers
223264fa531Smrg    # like to wrap large dependency lists on column 80 (with \), and
224264fa531Smrg    # we should not choose a depcomp mode which is confused by this.
225264fa531Smrg    #
226264fa531Smrg    # We need to recreate these files for each test, as the compiler may
227264fa531Smrg    # overwrite some of them when testing with obscure command lines.
228264fa531Smrg    # This happens at least with the AIX C compiler.
229264fa531Smrg    : > sub/conftest.c
230264fa531Smrg    for i in 1 2 3 4 5 6; do
231264fa531Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
232c37a63b8Smrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
233c37a63b8Smrg      # Solaris 8's {/usr,}/bin/sh.
234c37a63b8Smrg      touch sub/conftst$i.h
235264fa531Smrg    done
236264fa531Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
237264fa531Smrg
238c37a63b8Smrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
239c37a63b8Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
240c37a63b8Smrg    # handle `-M -o', and we need to detect this.  Also, some Intel
241c37a63b8Smrg    # versions had trouble with output in subdirs
242c37a63b8Smrg    am__obj=sub/conftest.${OBJEXT-o}
243c37a63b8Smrg    am__minus_obj="-o $am__obj"
244264fa531Smrg    case $depmode in
245c37a63b8Smrg    gcc)
246c37a63b8Smrg      # This depmode causes a compiler race in universal mode.
247c37a63b8Smrg      test "$am__universal" = false || continue
248c37a63b8Smrg      ;;
249264fa531Smrg    nosideeffect)
250264fa531Smrg      # after this tag, mechanisms are not by side-effect, so they'll
251264fa531Smrg      # only be used when explicitly requested
252264fa531Smrg      if test "x$enable_dependency_tracking" = xyes; then
253264fa531Smrg	continue
254264fa531Smrg      else
255264fa531Smrg	break
256264fa531Smrg      fi
257264fa531Smrg      ;;
258c37a63b8Smrg    msvisualcpp | msvcmsys)
259c37a63b8Smrg      # This compiler won't grok `-c -o', but also, the minuso test has
260c37a63b8Smrg      # not run yet.  These depmodes are late enough in the game, and
261c37a63b8Smrg      # so weak that their functioning should not be impacted.
262c37a63b8Smrg      am__obj=conftest.${OBJEXT-o}
263c37a63b8Smrg      am__minus_obj=
264c37a63b8Smrg      ;;
265264fa531Smrg    none) break ;;
266264fa531Smrg    esac
267264fa531Smrg    if depmode=$depmode \
268c37a63b8Smrg       source=sub/conftest.c object=$am__obj \
269264fa531Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
270c37a63b8Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
271264fa531Smrg         >/dev/null 2>conftest.err &&
272c37a63b8Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
273264fa531Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
274c37a63b8Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
275264fa531Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
276264fa531Smrg      # icc doesn't choke on unknown options, it will just issue warnings
277c37a63b8Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
278c37a63b8Smrg      # that says an option was ignored or not supported.
279c37a63b8Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
280c37a63b8Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
281c37a63b8Smrg      # The diagnosis changed in icc 8.0:
282c37a63b8Smrg      #   icc: Command line remark: option '-MP' not supported
283c37a63b8Smrg      if (grep 'ignoring option' conftest.err ||
284c37a63b8Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
285264fa531Smrg        am_cv_$1_dependencies_compiler_type=$depmode
286264fa531Smrg        break
287264fa531Smrg      fi
288264fa531Smrg    fi
289264fa531Smrg  done
290264fa531Smrg
291264fa531Smrg  cd ..
292264fa531Smrg  rm -rf conftest.dir
293264fa531Smrgelse
294264fa531Smrg  am_cv_$1_dependencies_compiler_type=none
295264fa531Smrgfi
296264fa531Smrg])
297264fa531SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
298264fa531SmrgAM_CONDITIONAL([am__fastdep$1], [
299264fa531Smrg  test "x$enable_dependency_tracking" != xno \
300264fa531Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
301264fa531Smrg])
302264fa531Smrg
303264fa531Smrg
304264fa531Smrg# AM_SET_DEPDIR
305264fa531Smrg# -------------
306264fa531Smrg# Choose a directory name for dependency files.
307264fa531Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
308264fa531SmrgAC_DEFUN([AM_SET_DEPDIR],
309264fa531Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
310264fa531SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
311264fa531Smrg])
312264fa531Smrg
313264fa531Smrg
314264fa531Smrg# AM_DEP_TRACK
315264fa531Smrg# ------------
316264fa531SmrgAC_DEFUN([AM_DEP_TRACK],
317264fa531Smrg[AC_ARG_ENABLE(dependency-tracking,
318c37a63b8Smrg[  --disable-dependency-tracking  speeds up one-time build
319c37a63b8Smrg  --enable-dependency-tracking   do not reject slow dependency extractors])
320264fa531Smrgif test "x$enable_dependency_tracking" != xno; then
321264fa531Smrg  am_depcomp="$ac_aux_dir/depcomp"
322264fa531Smrg  AMDEPBACKSLASH='\'
323264fa531Smrgfi
324264fa531SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
325c37a63b8SmrgAC_SUBST([AMDEPBACKSLASH])dnl
326c37a63b8Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
327264fa531Smrg])
328264fa531Smrg
329c37a63b8Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
330264fa531Smrg
331c37a63b8Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
332c37a63b8Smrg# Free Software Foundation, Inc.
333c37a63b8Smrg#
334c37a63b8Smrg# This file is free software; the Free Software Foundation
335c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
336c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
337264fa531Smrg
338c37a63b8Smrg#serial 5
339264fa531Smrg
340264fa531Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
341264fa531Smrg# ------------------------------
342264fa531SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
343c37a63b8Smrg[{
344c37a63b8Smrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
345c37a63b8Smrg  # are listed without --file.  Let's play safe and only enable the eval
346c37a63b8Smrg  # if we detect the quoting.
347c37a63b8Smrg  case $CONFIG_FILES in
348c37a63b8Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
349c37a63b8Smrg  *)   set x $CONFIG_FILES ;;
350c37a63b8Smrg  esac
351c37a63b8Smrg  shift
352c37a63b8Smrg  for mf
353c37a63b8Smrg  do
354c37a63b8Smrg    # Strip MF so we end up with the name of the file.
355c37a63b8Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
356c37a63b8Smrg    # Check whether this is an Automake generated Makefile or not.
357c37a63b8Smrg    # We used to match only the files named `Makefile.in', but
358c37a63b8Smrg    # some people rename them; so instead we look at the file content.
359c37a63b8Smrg    # Grep'ing the first line is not enough: some people post-process
360c37a63b8Smrg    # each Makefile.in and add a new line on top of each file to say so.
361c37a63b8Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
362c37a63b8Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
363c37a63b8Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
364c37a63b8Smrg      dirpart=`AS_DIRNAME("$mf")`
365c37a63b8Smrg    else
366c37a63b8Smrg      continue
367c37a63b8Smrg    fi
368c37a63b8Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
369c37a63b8Smrg    # from the Makefile without running `make'.
370c37a63b8Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
371c37a63b8Smrg    test -z "$DEPDIR" && continue
372c37a63b8Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
373c37a63b8Smrg    test -z "am__include" && continue
374c37a63b8Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
375c37a63b8Smrg    # When using ansi2knr, U may be empty or an underscore; expand it
376c37a63b8Smrg    U=`sed -n 's/^U = //p' < "$mf"`
377c37a63b8Smrg    # Find all dependency output files, they are included files with
378c37a63b8Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
379c37a63b8Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
380c37a63b8Smrg    # expansion.
381c37a63b8Smrg    for file in `sed -n "
382c37a63b8Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
383c37a63b8Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
384c37a63b8Smrg      # Make sure the directory exists.
385c37a63b8Smrg      test -f "$dirpart/$file" && continue
386c37a63b8Smrg      fdir=`AS_DIRNAME(["$file"])`
387c37a63b8Smrg      AS_MKDIR_P([$dirpart/$fdir])
388c37a63b8Smrg      # echo "creating $dirpart/$file"
389c37a63b8Smrg      echo '# dummy' > "$dirpart/$file"
390c37a63b8Smrg    done
391264fa531Smrg  done
392c37a63b8Smrg}
393264fa531Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
394264fa531Smrg
395264fa531Smrg
396264fa531Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
397264fa531Smrg# -----------------------------
398264fa531Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
399264fa531Smrg#
400264fa531Smrg# This code is only required when automatic dependency tracking
401264fa531Smrg# is enabled.  FIXME.  This creates each `.P' file that we will
402264fa531Smrg# need in order to bootstrap the dependency handling code.
403264fa531SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
404264fa531Smrg[AC_CONFIG_COMMANDS([depfiles],
405264fa531Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
406264fa531Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
407264fa531Smrg])
408264fa531Smrg
409c37a63b8Smrg# Do all the work for Automake.                             -*- Autoconf -*-
410264fa531Smrg
411c37a63b8Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
412c37a63b8Smrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
413c37a63b8Smrg#
414c37a63b8Smrg# This file is free software; the Free Software Foundation
415c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
416c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
417264fa531Smrg
418c37a63b8Smrg# serial 16
419264fa531Smrg
420c37a63b8Smrg# This macro actually does too much.  Some checks are only needed if
421c37a63b8Smrg# your package does certain things.  But this isn't really a big deal.
422c37a63b8Smrg
423c37a63b8Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
424c37a63b8Smrg# AM_INIT_AUTOMAKE([OPTIONS])
425c37a63b8Smrg# -----------------------------------------------
426c37a63b8Smrg# The call with PACKAGE and VERSION arguments is the old style
427c37a63b8Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
428c37a63b8Smrg# and VERSION should now be passed to AC_INIT and removed from
429c37a63b8Smrg# the call to AM_INIT_AUTOMAKE.
430c37a63b8Smrg# We support both call styles for the transition.  After
431c37a63b8Smrg# the next Automake release, Autoconf can make the AC_INIT
432c37a63b8Smrg# arguments mandatory, and then we can depend on a new Autoconf
433c37a63b8Smrg# release and drop the old call support.
434c37a63b8SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
435c37a63b8Smrg[AC_PREREQ([2.62])dnl
436c37a63b8Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
437c37a63b8Smrgdnl the ones we care about.
438c37a63b8Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
439c37a63b8SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
440c37a63b8SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
441c37a63b8Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
442c37a63b8Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
443c37a63b8Smrg  # is not polluted with repeated "-I."
444c37a63b8Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
445c37a63b8Smrg  # test to see if srcdir already configured
446c37a63b8Smrg  if test -f $srcdir/config.status; then
447c37a63b8Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
448c37a63b8Smrg  fi
449264fa531Smrgfi
450c37a63b8Smrg
451c37a63b8Smrg# test whether we have cygpath
452c37a63b8Smrgif test -z "$CYGPATH_W"; then
453c37a63b8Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
454c37a63b8Smrg    CYGPATH_W='cygpath -w'
455c37a63b8Smrg  else
456c37a63b8Smrg    CYGPATH_W=echo
457c37a63b8Smrg  fi
458264fa531Smrgfi
459c37a63b8SmrgAC_SUBST([CYGPATH_W])
460264fa531Smrg
461c37a63b8Smrg# Define the identity of the package.
462c37a63b8Smrgdnl Distinguish between old-style and new-style calls.
463c37a63b8Smrgm4_ifval([$2],
464c37a63b8Smrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
465c37a63b8Smrg AC_SUBST([PACKAGE], [$1])dnl
466c37a63b8Smrg AC_SUBST([VERSION], [$2])],
467c37a63b8Smrg[_AM_SET_OPTIONS([$1])dnl
468c37a63b8Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
469c37a63b8Smrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
470c37a63b8Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
471c37a63b8Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
472c37a63b8Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
473264fa531Smrg
474c37a63b8Smrg_AM_IF_OPTION([no-define],,
475c37a63b8Smrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
476c37a63b8Smrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
477264fa531Smrg
478c37a63b8Smrg# Some tools Automake needs.
479c37a63b8SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
480c37a63b8SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
481c37a63b8SmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
482c37a63b8SmrgAM_MISSING_PROG(AUTOCONF, autoconf)
483c37a63b8SmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
484c37a63b8SmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
485c37a63b8SmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
486c37a63b8SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
487c37a63b8SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
488c37a63b8SmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
489c37a63b8Smrg# We need awk for the "check" target.  The system "awk" is bad on
490c37a63b8Smrg# some platforms.
491c37a63b8SmrgAC_REQUIRE([AC_PROG_AWK])dnl
492c37a63b8SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
493c37a63b8SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
494c37a63b8Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
495c37a63b8Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
496c37a63b8Smrg			     [_AM_PROG_TAR([v7])])])
497c37a63b8Smrg_AM_IF_OPTION([no-dependencies],,
498c37a63b8Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
499c37a63b8Smrg		  [_AM_DEPENDENCIES(CC)],
500c37a63b8Smrg		  [define([AC_PROG_CC],
501c37a63b8Smrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
502c37a63b8SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
503c37a63b8Smrg		  [_AM_DEPENDENCIES(CXX)],
504c37a63b8Smrg		  [define([AC_PROG_CXX],
505c37a63b8Smrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
506c37a63b8SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
507c37a63b8Smrg		  [_AM_DEPENDENCIES(OBJC)],
508c37a63b8Smrg		  [define([AC_PROG_OBJC],
509c37a63b8Smrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
510c37a63b8Smrg])
511c37a63b8Smrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
512c37a63b8Smrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
513c37a63b8Smrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
514c37a63b8Smrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
515c37a63b8SmrgAC_CONFIG_COMMANDS_PRE(dnl
516c37a63b8Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
517c37a63b8Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
518c37a63b8Smrg])
519264fa531Smrg
520c37a63b8Smrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
521c37a63b8Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
522c37a63b8Smrgdnl mangled by Autoconf and run in a shell conditional statement.
523c37a63b8Smrgm4_define([_AC_COMPILER_EXEEXT],
524c37a63b8Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
525264fa531Smrg
526264fa531Smrg
527c37a63b8Smrg# When config.status generates a header, we must update the stamp-h file.
528c37a63b8Smrg# This file resides in the same directory as the config header
529c37a63b8Smrg# that is generated.  The stamp files are numbered to have different names.
530c37a63b8Smrg
531c37a63b8Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
532c37a63b8Smrg# loop where config.status creates the headers, so we can generate
533c37a63b8Smrg# our stamp files there.
534c37a63b8SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
535c37a63b8Smrg[# Compute $1's index in $config_headers.
536c37a63b8Smrg_am_arg=$1
537c37a63b8Smrg_am_stamp_count=1
538c37a63b8Smrgfor _am_header in $config_headers :; do
539c37a63b8Smrg  case $_am_header in
540c37a63b8Smrg    $_am_arg | $_am_arg:* )
541c37a63b8Smrg      break ;;
542c37a63b8Smrg    * )
543c37a63b8Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
544c37a63b8Smrg  esac
545c37a63b8Smrgdone
546c37a63b8Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
547264fa531Smrg
548c37a63b8Smrg# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
549c37a63b8Smrg#
550c37a63b8Smrg# This file is free software; the Free Software Foundation
551c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
552c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
553264fa531Smrg
554c37a63b8Smrg# AM_PROG_INSTALL_SH
555c37a63b8Smrg# ------------------
556c37a63b8Smrg# Define $install_sh.
557c37a63b8SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
558c37a63b8Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
559c37a63b8Smrgif test x"${install_sh}" != xset; then
560c37a63b8Smrg  case $am_aux_dir in
561c37a63b8Smrg  *\ * | *\	*)
562c37a63b8Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
563c37a63b8Smrg  *)
564c37a63b8Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
565c37a63b8Smrg  esac
566264fa531Smrgfi
567c37a63b8SmrgAC_SUBST(install_sh)])
568264fa531Smrg
569c37a63b8Smrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
570c37a63b8Smrg#
571c37a63b8Smrg# This file is free software; the Free Software Foundation
572c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
573c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
574264fa531Smrg
575c37a63b8Smrg# serial 2
576264fa531Smrg
577c37a63b8Smrg# Check whether the underlying file-system supports filenames
578c37a63b8Smrg# with a leading dot.  For instance MS-DOS doesn't.
579c37a63b8SmrgAC_DEFUN([AM_SET_LEADING_DOT],
580c37a63b8Smrg[rm -rf .tst 2>/dev/null
581c37a63b8Smrgmkdir .tst 2>/dev/null
582c37a63b8Smrgif test -d .tst; then
583c37a63b8Smrg  am__leading_dot=.
584c37a63b8Smrgelse
585c37a63b8Smrg  am__leading_dot=_
586c37a63b8Smrgfi
587c37a63b8Smrgrmdir .tst 2>/dev/null
588c37a63b8SmrgAC_SUBST([am__leading_dot])])
589264fa531Smrg
590c37a63b8Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
591c37a63b8Smrg# From Jim Meyering
592264fa531Smrg
593c37a63b8Smrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
594c37a63b8Smrg# Free Software Foundation, Inc.
595c37a63b8Smrg#
596c37a63b8Smrg# This file is free software; the Free Software Foundation
597c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
598c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
599264fa531Smrg
600c37a63b8Smrg# serial 5
601c37a63b8Smrg
602c37a63b8Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
603c37a63b8Smrg# ----------------------------------
604c37a63b8Smrg# Control maintainer-specific portions of Makefiles.
605c37a63b8Smrg# Default is to disable them, unless `enable' is passed literally.
606c37a63b8Smrg# For symmetry, `disable' may be passed as well.  Anyway, the user
607c37a63b8Smrg# can override the default with the --enable/--disable switch.
608264fa531SmrgAC_DEFUN([AM_MAINTAINER_MODE],
609c37a63b8Smrg[m4_case(m4_default([$1], [disable]),
610c37a63b8Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
611c37a63b8Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
612c37a63b8Smrg       [m4_define([am_maintainer_other], [enable])
613c37a63b8Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
614c37a63b8SmrgAC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
615c37a63b8Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
616c37a63b8Smrg  AC_ARG_ENABLE([maintainer-mode],
617c37a63b8Smrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
618c37a63b8Smrg			  (and sometimes confusing) to the casual installer],
619c37a63b8Smrg      [USE_MAINTAINER_MODE=$enableval],
620c37a63b8Smrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
621264fa531Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
622c37a63b8Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
623264fa531Smrg  MAINT=$MAINTAINER_MODE_TRUE
624c37a63b8Smrg  AC_SUBST([MAINT])dnl
625264fa531Smrg]
626264fa531Smrg)
627264fa531Smrg
628264fa531SmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
629264fa531Smrg
630c37a63b8Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
631264fa531Smrg
632c37a63b8Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
633c37a63b8Smrg#
634c37a63b8Smrg# This file is free software; the Free Software Foundation
635c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
636c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
637264fa531Smrg
638c37a63b8Smrg# serial 4
639264fa531Smrg
640c37a63b8Smrg# AM_MAKE_INCLUDE()
641c37a63b8Smrg# -----------------
642c37a63b8Smrg# Check to see how make treats includes.
643c37a63b8SmrgAC_DEFUN([AM_MAKE_INCLUDE],
644c37a63b8Smrg[am_make=${MAKE-make}
645c37a63b8Smrgcat > confinc << 'END'
646c37a63b8Smrgam__doit:
647c37a63b8Smrg	@echo this is the am__doit target
648c37a63b8Smrg.PHONY: am__doit
649c37a63b8SmrgEND
650c37a63b8Smrg# If we don't find an include directive, just comment out the code.
651c37a63b8SmrgAC_MSG_CHECKING([for style of include used by $am_make])
652c37a63b8Smrgam__include="#"
653c37a63b8Smrgam__quote=
654c37a63b8Smrg_am_result=none
655c37a63b8Smrg# First try GNU make style include.
656c37a63b8Smrgecho "include confinc" > confmf
657c37a63b8Smrg# Ignore all kinds of additional output from `make'.
658c37a63b8Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
659c37a63b8Smrg*the\ am__doit\ target*)
660c37a63b8Smrg  am__include=include
661c37a63b8Smrg  am__quote=
662c37a63b8Smrg  _am_result=GNU
663c37a63b8Smrg  ;;
664c37a63b8Smrgesac
665c37a63b8Smrg# Now try BSD make style include.
666c37a63b8Smrgif test "$am__include" = "#"; then
667c37a63b8Smrg   echo '.include "confinc"' > confmf
668c37a63b8Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
669c37a63b8Smrg   *the\ am__doit\ target*)
670c37a63b8Smrg     am__include=.include
671c37a63b8Smrg     am__quote="\""
672c37a63b8Smrg     _am_result=BSD
673c37a63b8Smrg     ;;
674c37a63b8Smrg   esac
675c37a63b8Smrgfi
676c37a63b8SmrgAC_SUBST([am__include])
677c37a63b8SmrgAC_SUBST([am__quote])
678c37a63b8SmrgAC_MSG_RESULT([$_am_result])
679c37a63b8Smrgrm -f confinc confmf
680c37a63b8Smrg])
681264fa531Smrg
682c37a63b8Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
683264fa531Smrg
684c37a63b8Smrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
685c37a63b8Smrg# Free Software Foundation, Inc.
686c37a63b8Smrg#
687c37a63b8Smrg# This file is free software; the Free Software Foundation
688c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
689c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
690264fa531Smrg
691264fa531Smrg# serial 6
692264fa531Smrg
693c37a63b8Smrg# AM_MISSING_PROG(NAME, PROGRAM)
694c37a63b8Smrg# ------------------------------
695c37a63b8SmrgAC_DEFUN([AM_MISSING_PROG],
696c37a63b8Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
697c37a63b8Smrg$1=${$1-"${am_missing_run}$2"}
698c37a63b8SmrgAC_SUBST($1)])
699264fa531Smrg
700264fa531Smrg
701c37a63b8Smrg# AM_MISSING_HAS_RUN
702c37a63b8Smrg# ------------------
703c37a63b8Smrg# Define MISSING if not defined so far and test if it supports --run.
704c37a63b8Smrg# If it does, set am_missing_run to use it, otherwise, to nothing.
705c37a63b8SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
706c37a63b8Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
707c37a63b8SmrgAC_REQUIRE_AUX_FILE([missing])dnl
708c37a63b8Smrgif test x"${MISSING+set}" != xset; then
709c37a63b8Smrg  case $am_aux_dir in
710c37a63b8Smrg  *\ * | *\	*)
711c37a63b8Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
712c37a63b8Smrg  *)
713c37a63b8Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
714c37a63b8Smrg  esac
715264fa531Smrgfi
716c37a63b8Smrg# Use eval to expand $SHELL
717c37a63b8Smrgif eval "$MISSING --run true"; then
718c37a63b8Smrg  am_missing_run="$MISSING --run "
719c37a63b8Smrgelse
720c37a63b8Smrg  am_missing_run=
721c37a63b8Smrg  AC_MSG_WARN([`missing' script is too old or missing])
722c37a63b8Smrgfi
723c37a63b8Smrg])
724264fa531Smrg
725c37a63b8Smrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
726264fa531Smrg#
727c37a63b8Smrg# This file is free software; the Free Software Foundation
728c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
729c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
730c37a63b8Smrg
731c37a63b8Smrg# AM_PROG_MKDIR_P
732c37a63b8Smrg# ---------------
733c37a63b8Smrg# Check for `mkdir -p'.
734c37a63b8SmrgAC_DEFUN([AM_PROG_MKDIR_P],
735c37a63b8Smrg[AC_PREREQ([2.60])dnl
736c37a63b8SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
737c37a63b8Smrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
738c37a63b8Smrgdnl while keeping a definition of mkdir_p for backward compatibility.
739c37a63b8Smrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
740c37a63b8Smrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
741c37a63b8Smrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
742c37a63b8Smrgdnl adjustment using top_builddir (which is defined more often than
743c37a63b8Smrgdnl MKDIR_P).
744c37a63b8SmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
745c37a63b8Smrgcase $mkdir_p in
746c37a63b8Smrg  [[\\/$]]* | ?:[[\\/]]*) ;;
747c37a63b8Smrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
748c37a63b8Smrgesac
749c37a63b8Smrg])
750c37a63b8Smrg
751c37a63b8Smrg# Helper functions for option handling.                     -*- Autoconf -*-
752c37a63b8Smrg
753c37a63b8Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
754264fa531Smrg#
755c37a63b8Smrg# This file is free software; the Free Software Foundation
756c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
757c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
758c37a63b8Smrg
759c37a63b8Smrg# serial 4
760c37a63b8Smrg
761c37a63b8Smrg# _AM_MANGLE_OPTION(NAME)
762c37a63b8Smrg# -----------------------
763c37a63b8SmrgAC_DEFUN([_AM_MANGLE_OPTION],
764c37a63b8Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
765c37a63b8Smrg
766c37a63b8Smrg# _AM_SET_OPTION(NAME)
767c37a63b8Smrg# ------------------------------
768c37a63b8Smrg# Set option NAME.  Presently that only means defining a flag for this option.
769c37a63b8SmrgAC_DEFUN([_AM_SET_OPTION],
770c37a63b8Smrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
771c37a63b8Smrg
772c37a63b8Smrg# _AM_SET_OPTIONS(OPTIONS)
773c37a63b8Smrg# ----------------------------------
774c37a63b8Smrg# OPTIONS is a space-separated list of Automake options.
775c37a63b8SmrgAC_DEFUN([_AM_SET_OPTIONS],
776c37a63b8Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
777c37a63b8Smrg
778c37a63b8Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
779c37a63b8Smrg# -------------------------------------------
780c37a63b8Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
781c37a63b8SmrgAC_DEFUN([_AM_IF_OPTION],
782c37a63b8Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
783c37a63b8Smrg
784c37a63b8Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
785c37a63b8Smrg
786c37a63b8Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
787c37a63b8Smrg# Free Software Foundation, Inc.
788264fa531Smrg#
789c37a63b8Smrg# This file is free software; the Free Software Foundation
790c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
791c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
792264fa531Smrg
793c37a63b8Smrg# serial 5
794264fa531Smrg
795c37a63b8Smrg# AM_SANITY_CHECK
796c37a63b8Smrg# ---------------
797c37a63b8SmrgAC_DEFUN([AM_SANITY_CHECK],
798c37a63b8Smrg[AC_MSG_CHECKING([whether build environment is sane])
799c37a63b8Smrg# Just in case
800c37a63b8Smrgsleep 1
801c37a63b8Smrgecho timestamp > conftest.file
802c37a63b8Smrg# Reject unsafe characters in $srcdir or the absolute working directory
803c37a63b8Smrg# name.  Accept space and tab only in the latter.
804c37a63b8Smrgam_lf='
805c37a63b8Smrg'
806c37a63b8Smrgcase `pwd` in
807c37a63b8Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
808c37a63b8Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
809c37a63b8Smrgesac
810c37a63b8Smrgcase $srcdir in
811c37a63b8Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
812c37a63b8Smrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
813c37a63b8Smrgesac
814c37a63b8Smrg
815c37a63b8Smrg# Do `set' in a subshell so we don't clobber the current shell's
816c37a63b8Smrg# arguments.  Must try -L first in case configure is actually a
817c37a63b8Smrg# symlink; some systems play weird games with the mod time of symlinks
818c37a63b8Smrg# (eg FreeBSD returns the mod time of the symlink's containing
819c37a63b8Smrg# directory).
820c37a63b8Smrgif (
821c37a63b8Smrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
822c37a63b8Smrg   if test "$[*]" = "X"; then
823c37a63b8Smrg      # -L didn't work.
824c37a63b8Smrg      set X `ls -t "$srcdir/configure" conftest.file`
825c37a63b8Smrg   fi
826c37a63b8Smrg   rm -f conftest.file
827c37a63b8Smrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
828c37a63b8Smrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
829c37a63b8Smrg
830c37a63b8Smrg      # If neither matched, then we have a broken ls.  This can happen
831c37a63b8Smrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
832c37a63b8Smrg      # broken ls alias from the environment.  This has actually
833c37a63b8Smrg      # happened.  Such a system could not be considered "sane".
834c37a63b8Smrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
835c37a63b8Smrgalias in your environment])
836c37a63b8Smrg   fi
837c37a63b8Smrg
838c37a63b8Smrg   test "$[2]" = conftest.file
839c37a63b8Smrg   )
840c37a63b8Smrgthen
841c37a63b8Smrg   # Ok.
842c37a63b8Smrg   :
843264fa531Smrgelse
844c37a63b8Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
845c37a63b8SmrgCheck your system clock])
846c37a63b8Smrgfi
847c37a63b8SmrgAC_MSG_RESULT(yes)])
848264fa531Smrg
849c37a63b8Smrg# Copyright (C) 2009  Free Software Foundation, Inc.
850264fa531Smrg#
851c37a63b8Smrg# This file is free software; the Free Software Foundation
852c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
853c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
854c37a63b8Smrg
855c37a63b8Smrg# serial 1
856c37a63b8Smrg
857c37a63b8Smrg# AM_SILENT_RULES([DEFAULT])
858c37a63b8Smrg# --------------------------
859c37a63b8Smrg# Enable less verbose build rules; with the default set to DEFAULT
860c37a63b8Smrg# (`yes' being less verbose, `no' or empty being verbose).
861c37a63b8SmrgAC_DEFUN([AM_SILENT_RULES],
862c37a63b8Smrg[AC_ARG_ENABLE([silent-rules],
863c37a63b8Smrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
864c37a63b8Smrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
865c37a63b8Smrgcase $enable_silent_rules in
866c37a63b8Smrgyes) AM_DEFAULT_VERBOSITY=0;;
867c37a63b8Smrgno)  AM_DEFAULT_VERBOSITY=1;;
868c37a63b8Smrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
869c37a63b8Smrgesac
870c37a63b8SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
871c37a63b8SmrgAM_BACKSLASH='\'
872c37a63b8SmrgAC_SUBST([AM_BACKSLASH])dnl
873c37a63b8Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
874c37a63b8Smrg])
875c37a63b8Smrg
876c37a63b8Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
877264fa531Smrg#
878c37a63b8Smrg# This file is free software; the Free Software Foundation
879c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
880c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
881c37a63b8Smrg
882c37a63b8Smrg# AM_PROG_INSTALL_STRIP
883c37a63b8Smrg# ---------------------
884c37a63b8Smrg# One issue with vendor `install' (even GNU) is that you can't
885c37a63b8Smrg# specify the program used to strip binaries.  This is especially
886c37a63b8Smrg# annoying in cross-compiling environments, where the build's strip
887c37a63b8Smrg# is unlikely to handle the host's binaries.
888c37a63b8Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
889c37a63b8Smrg# always use install-sh in `make install-strip', and initialize
890c37a63b8Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
891c37a63b8SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
892c37a63b8Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
893c37a63b8Smrg# Installed binaries are usually stripped using `strip' when the user
894c37a63b8Smrg# run `make install-strip'.  However `strip' might not be the right
895c37a63b8Smrg# tool to use in cross-compilation environments, therefore Automake
896c37a63b8Smrg# will honor the `STRIP' environment variable to overrule this program.
897c37a63b8Smrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
898c37a63b8Smrgif test "$cross_compiling" != no; then
899c37a63b8Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
900c37a63b8Smrgfi
901c37a63b8SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
902c37a63b8SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
903c37a63b8Smrg
904c37a63b8Smrg# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
905264fa531Smrg#
906c37a63b8Smrg# This file is free software; the Free Software Foundation
907c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
908c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
909264fa531Smrg
910c37a63b8Smrg# serial 2
911264fa531Smrg
912c37a63b8Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
913c37a63b8Smrg# ---------------------------
914c37a63b8Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
915c37a63b8Smrg# This macro is traced by Automake.
916c37a63b8SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
917264fa531Smrg
918c37a63b8Smrg# AM_SUBST_NOTMAKE(VARIABLE)
919c37a63b8Smrg# ---------------------------
920c37a63b8Smrg# Public sister of _AM_SUBST_NOTMAKE.
921c37a63b8SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
922264fa531Smrg
923c37a63b8Smrg# Check how to create a tarball.                            -*- Autoconf -*-
924c37a63b8Smrg
925c37a63b8Smrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
926c37a63b8Smrg#
927c37a63b8Smrg# This file is free software; the Free Software Foundation
928c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
929c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
930c37a63b8Smrg
931c37a63b8Smrg# serial 2
932c37a63b8Smrg
933c37a63b8Smrg# _AM_PROG_TAR(FORMAT)
934c37a63b8Smrg# --------------------
935c37a63b8Smrg# Check how to create a tarball in format FORMAT.
936c37a63b8Smrg# FORMAT should be one of `v7', `ustar', or `pax'.
937c37a63b8Smrg#
938c37a63b8Smrg# Substitute a variable $(am__tar) that is a command
939c37a63b8Smrg# writing to stdout a FORMAT-tarball containing the directory
940c37a63b8Smrg# $tardir.
941c37a63b8Smrg#     tardir=directory && $(am__tar) > result.tar
942c37a63b8Smrg#
943c37a63b8Smrg# Substitute a variable $(am__untar) that extract such
944c37a63b8Smrg# a tarball read from stdin.
945c37a63b8Smrg#     $(am__untar) < result.tar
946c37a63b8SmrgAC_DEFUN([_AM_PROG_TAR],
947c37a63b8Smrg[# Always define AMTAR for backward compatibility.
948c37a63b8SmrgAM_MISSING_PROG([AMTAR], [tar])
949c37a63b8Smrgm4_if([$1], [v7],
950c37a63b8Smrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
951c37a63b8Smrg     [m4_case([$1], [ustar],, [pax],,
952c37a63b8Smrg              [m4_fatal([Unknown tar format])])
953c37a63b8SmrgAC_MSG_CHECKING([how to create a $1 tar archive])
954c37a63b8Smrg# Loop over all known methods to create a tar archive until one works.
955c37a63b8Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
956c37a63b8Smrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
957c37a63b8Smrg# Do not fold the above two line into one, because Tru64 sh and
958c37a63b8Smrg# Solaris sh will not grok spaces in the rhs of `-'.
959c37a63b8Smrgfor _am_tool in $_am_tools
960c37a63b8Smrgdo
961c37a63b8Smrg  case $_am_tool in
962c37a63b8Smrg  gnutar)
963c37a63b8Smrg    for _am_tar in tar gnutar gtar;
964c37a63b8Smrg    do
965c37a63b8Smrg      AM_RUN_LOG([$_am_tar --version]) && break
966c37a63b8Smrg    done
967c37a63b8Smrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
968c37a63b8Smrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
969c37a63b8Smrg    am__untar="$_am_tar -xf -"
970c37a63b8Smrg    ;;
971c37a63b8Smrg  plaintar)
972c37a63b8Smrg    # Must skip GNU tar: if it does not support --format= it doesn't create
973c37a63b8Smrg    # ustar tarball either.
974c37a63b8Smrg    (tar --version) >/dev/null 2>&1 && continue
975c37a63b8Smrg    am__tar='tar chf - "$$tardir"'
976c37a63b8Smrg    am__tar_='tar chf - "$tardir"'
977c37a63b8Smrg    am__untar='tar xf -'
978c37a63b8Smrg    ;;
979c37a63b8Smrg  pax)
980c37a63b8Smrg    am__tar='pax -L -x $1 -w "$$tardir"'
981c37a63b8Smrg    am__tar_='pax -L -x $1 -w "$tardir"'
982c37a63b8Smrg    am__untar='pax -r'
983c37a63b8Smrg    ;;
984c37a63b8Smrg  cpio)
985c37a63b8Smrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
986c37a63b8Smrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
987c37a63b8Smrg    am__untar='cpio -i -H $1 -d'
988c37a63b8Smrg    ;;
989c37a63b8Smrg  none)
990c37a63b8Smrg    am__tar=false
991c37a63b8Smrg    am__tar_=false
992c37a63b8Smrg    am__untar=false
993c37a63b8Smrg    ;;
994c37a63b8Smrg  esac
995264fa531Smrg
996c37a63b8Smrg  # If the value was cached, stop now.  We just wanted to have am__tar
997c37a63b8Smrg  # and am__untar set.
998c37a63b8Smrg  test -n "${am_cv_prog_tar_$1}" && break
999264fa531Smrg
1000c37a63b8Smrg  # tar/untar a dummy directory, and stop if the command works
1001c37a63b8Smrg  rm -rf conftest.dir
1002c37a63b8Smrg  mkdir conftest.dir
1003c37a63b8Smrg  echo GrepMe > conftest.dir/file
1004c37a63b8Smrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1005c37a63b8Smrg  rm -rf conftest.dir
1006c37a63b8Smrg  if test -s conftest.tar; then
1007c37a63b8Smrg    AM_RUN_LOG([$am__untar <conftest.tar])
1008c37a63b8Smrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1009c37a63b8Smrg  fi
1010c37a63b8Smrgdone
1011c37a63b8Smrgrm -rf conftest.dir
1012264fa531Smrg
1013c37a63b8SmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1014c37a63b8SmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
1015c37a63b8SmrgAC_SUBST([am__tar])
1016c37a63b8SmrgAC_SUBST([am__untar])
1017c37a63b8Smrg]) # _AM_PROG_TAR
1018264fa531Smrg
1019c37a63b8Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1020264fa531Smrgdnl
1021736a7e2cSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1022264fa531Smrgdnl 
1023c37a63b8Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1024736a7e2cSmrgdnl copy of this software and associated documentation files (the "Software"),
1025736a7e2cSmrgdnl to deal in the Software without restriction, including without limitation
1026736a7e2cSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1027736a7e2cSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1028736a7e2cSmrgdnl Software is furnished to do so, subject to the following conditions:
1029c37a63b8Smrgdnl
1030736a7e2cSmrgdnl The above copyright notice and this permission notice (including the next
1031736a7e2cSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1032736a7e2cSmrgdnl Software.
1033c37a63b8Smrgdnl
1034736a7e2cSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1035736a7e2cSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1036736a7e2cSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1037736a7e2cSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1038736a7e2cSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1039736a7e2cSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1040736a7e2cSmrgdnl DEALINGS IN THE SOFTWARE.
1041c37a63b8Smrg
1042c37a63b8Smrg# XORG_MACROS_VERSION(required-version)
1043c37a63b8Smrg# -------------------------------------
1044c37a63b8Smrg# Minimum version: 1.1.0
1045c37a63b8Smrg#
1046c37a63b8Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1047c37a63b8Smrg# your configure.ac with the minimum required version, such as:
1048c37a63b8Smrg# XORG_MACROS_VERSION(1.1)
1049c37a63b8Smrg#
1050c37a63b8Smrg# To ensure that this macro is defined, also add:
1051c37a63b8Smrg# m4_ifndef([XORG_MACROS_VERSION],
1052c37a63b8Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1053c37a63b8Smrg#
1054c37a63b8Smrg#
1055c37a63b8Smrg# See the "minimum version" comment for each macro you use to see what 
1056c37a63b8Smrg# version you require.
1057c37a63b8Smrgm4_defun([XORG_MACROS_VERSION],[
1058736a7e2cSmrgm4_define([vers_have], [1.11.0])
1059c37a63b8Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1060c37a63b8Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1061c37a63b8Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1062c37a63b8Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1063c37a63b8Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1064c37a63b8Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1065c37a63b8Smrgm4_undefine([vers_have])
1066c37a63b8Smrgm4_undefine([maj_have])
1067c37a63b8Smrgm4_undefine([maj_needed])
1068c37a63b8Smrg]) # XORG_MACROS_VERSION
1069264fa531Smrg
1070264fa531Smrg# XORG_PROG_RAWCPP()
1071264fa531Smrg# ------------------
1072c37a63b8Smrg# Minimum version: 1.0.0
1073c37a63b8Smrg#
1074264fa531Smrg# Find cpp program and necessary flags for use in pre-processing text files
1075264fa531Smrg# such as man pages and config files
1076264fa531SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1077264fa531SmrgAC_REQUIRE([AC_PROG_CPP])
1078264fa531SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
1079264fa531Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1080264fa531Smrg
1081264fa531Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1082264fa531Smrg# which is not the best choice for supporting other OS'es, but covers most
1083264fa531Smrg# of the ones we need for now.
1084264fa531SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1085264fa531SmrgAC_LANG_CONFTEST([Does cpp redefine unix ?])
1086264fa531Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1087264fa531Smrg	AC_MSG_RESULT([no])
1088264fa531Smrgelse
1089264fa531Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1090264fa531Smrg		RAWCPPFLAGS=-undef
1091264fa531Smrg		AC_MSG_RESULT([yes])
1092c37a63b8Smrg	# under Cygwin unix is still defined even with -undef
1093c37a63b8Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1094c37a63b8Smrg		RAWCPPFLAGS="-undef -ansi"
1095c37a63b8Smrg		AC_MSG_RESULT([yes, with -ansi])
1096264fa531Smrg	else
1097264fa531Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1098264fa531Smrg	fi
1099264fa531Smrgfi
1100264fa531Smrgrm -f conftest.$ac_ext
1101264fa531Smrg
1102264fa531SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1103264fa531SmrgAC_LANG_CONFTEST([Does cpp preserve   "whitespace"?])
1104264fa531Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1105264fa531Smrg	AC_MSG_RESULT([no])
1106264fa531Smrgelse
1107264fa531Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1108264fa531Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1109264fa531Smrg		AC_MSG_RESULT([yes])
1110264fa531Smrg	else
1111264fa531Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1112264fa531Smrg	fi
1113264fa531Smrgfi
1114264fa531Smrgrm -f conftest.$ac_ext
1115264fa531SmrgAC_SUBST(RAWCPPFLAGS)
1116264fa531Smrg]) # XORG_PROG_RAWCPP
1117264fa531Smrg
1118264fa531Smrg# XORG_MANPAGE_SECTIONS()
1119264fa531Smrg# -----------------------
1120c37a63b8Smrg# Minimum version: 1.0.0
1121c37a63b8Smrg#
1122264fa531Smrg# Determine which sections man pages go in for the different man page types
1123264fa531Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1124264fa531Smrg# Not sure if there's any better way than just hardcoding by OS name.
1125264fa531Smrg# Override default settings by setting environment variables
1126736a7e2cSmrg# Added MAN_SUBSTS in version 1.8
1127736a7e2cSmrg# Added AC_PROG_SED in version 1.8
1128264fa531Smrg
1129264fa531SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1130264fa531SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1131736a7e2cSmrgAC_REQUIRE([AC_PROG_SED])
1132264fa531Smrg
1133264fa531Smrgif test x$APP_MAN_SUFFIX = x    ; then
1134c37a63b8Smrg    APP_MAN_SUFFIX=1
1135264fa531Smrgfi
1136264fa531Smrgif test x$APP_MAN_DIR = x    ; then
1137c37a63b8Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1138264fa531Smrgfi
1139264fa531Smrg
1140264fa531Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1141c37a63b8Smrg    LIB_MAN_SUFFIX=3
1142264fa531Smrgfi
1143264fa531Smrgif test x$LIB_MAN_DIR = x    ; then
1144c37a63b8Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1145264fa531Smrgfi
1146264fa531Smrg
1147264fa531Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1148264fa531Smrg    case $host_os in
1149264fa531Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1150264fa531Smrg	*)		FILE_MAN_SUFFIX=5  ;;
1151264fa531Smrg    esac
1152264fa531Smrgfi
1153264fa531Smrgif test x$FILE_MAN_DIR = x    ; then
1154c37a63b8Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1155264fa531Smrgfi
1156264fa531Smrg
1157264fa531Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1158264fa531Smrg    case $host_os in
1159264fa531Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1160264fa531Smrg	*)		MISC_MAN_SUFFIX=7  ;;
1161264fa531Smrg    esac
1162264fa531Smrgfi
1163264fa531Smrgif test x$MISC_MAN_DIR = x    ; then
1164c37a63b8Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1165264fa531Smrgfi
1166264fa531Smrg
1167264fa531Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1168264fa531Smrg    case $host_os in
1169264fa531Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1170264fa531Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1171264fa531Smrg    esac
1172264fa531Smrgfi
1173264fa531Smrgif test x$DRIVER_MAN_DIR = x    ; then
1174c37a63b8Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1175264fa531Smrgfi
1176264fa531Smrg
1177264fa531Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1178264fa531Smrg    case $host_os in
1179264fa531Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1180264fa531Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1181264fa531Smrg    esac
1182264fa531Smrgfi
1183264fa531Smrgif test x$ADMIN_MAN_DIR = x    ; then
1184264fa531Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1185264fa531Smrgfi
1186264fa531Smrg
1187264fa531Smrg
1188264fa531SmrgAC_SUBST([APP_MAN_SUFFIX])
1189264fa531SmrgAC_SUBST([LIB_MAN_SUFFIX])
1190264fa531SmrgAC_SUBST([FILE_MAN_SUFFIX])
1191264fa531SmrgAC_SUBST([MISC_MAN_SUFFIX])
1192264fa531SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1193264fa531SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1194264fa531SmrgAC_SUBST([APP_MAN_DIR])
1195264fa531SmrgAC_SUBST([LIB_MAN_DIR])
1196264fa531SmrgAC_SUBST([FILE_MAN_DIR])
1197264fa531SmrgAC_SUBST([MISC_MAN_DIR])
1198264fa531SmrgAC_SUBST([DRIVER_MAN_DIR])
1199264fa531SmrgAC_SUBST([ADMIN_MAN_DIR])
1200736a7e2cSmrg
1201736a7e2cSmrgXORG_MAN_PAGE="X Version 11"
1202736a7e2cSmrgAC_SUBST([XORG_MAN_PAGE])
1203736a7e2cSmrgMAN_SUBSTS="\
1204736a7e2cSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1205736a7e2cSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1206736a7e2cSmrg	-e 's|__xservername__|Xorg|g' \
1207736a7e2cSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
1208736a7e2cSmrg	-e 's|__projectroot__|\$(prefix)|g' \
1209736a7e2cSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1210736a7e2cSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1211736a7e2cSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1212736a7e2cSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1213736a7e2cSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1214736a7e2cSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1215736a7e2cSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1216736a7e2cSmrgAC_SUBST([MAN_SUBSTS])
1217736a7e2cSmrg
1218264fa531Smrg]) # XORG_MANPAGE_SECTIONS
1219264fa531Smrg
1220736a7e2cSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1221736a7e2cSmrg# ------------------------
1222736a7e2cSmrg# Minimum version: 1.7.0
1223736a7e2cSmrg#
1224736a7e2cSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1225736a7e2cSmrg# provided by xorg-sgml-doctools, if installed.
1226736a7e2cSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1227736a7e2cSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1228736a7e2cSmrgXORG_SGML_PATH=
1229736a7e2cSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1230736a7e2cSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1231736a7e2cSmrg    [m4_ifval([$1],[:],
1232736a7e2cSmrg        [if test x"$cross_compiling" != x"yes" ; then
1233736a7e2cSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1234736a7e2cSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1235736a7e2cSmrg         fi])
1236736a7e2cSmrg    ])
1237736a7e2cSmrg
1238736a7e2cSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1239736a7e2cSmrg# the path and the name of the doc stylesheet
1240736a7e2cSmrgif test "x$XORG_SGML_PATH" != "x" ; then
1241736a7e2cSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1242736a7e2cSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1243736a7e2cSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1244736a7e2cSmrgelse
1245736a7e2cSmrg   AC_MSG_RESULT([no])
1246736a7e2cSmrgfi
1247736a7e2cSmrg
1248736a7e2cSmrgAC_SUBST(XORG_SGML_PATH)
1249736a7e2cSmrgAC_SUBST(STYLESHEET_SRCDIR)
1250736a7e2cSmrgAC_SUBST(XSL_STYLESHEET)
1251736a7e2cSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1252736a7e2cSmrg]) # XORG_CHECK_SGML_DOCTOOLS
1253736a7e2cSmrg
1254264fa531Smrg# XORG_CHECK_LINUXDOC
1255264fa531Smrg# -------------------
1256c37a63b8Smrg# Minimum version: 1.0.0
1257c37a63b8Smrg#
1258264fa531Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1259264fa531Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1260264fa531Smrg# Whether or not the necessary tools and files are found can be checked
1261264fa531Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1262264fa531SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1263736a7e2cSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1264736a7e2cSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1265264fa531Smrg
1266264fa531SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1267264fa531Smrg
1268736a7e2cSmrgAC_MSG_CHECKING([whether to build documentation])
1269264fa531Smrg
1270736a7e2cSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1271264fa531Smrg   BUILDDOC=yes
1272264fa531Smrgelse
1273264fa531Smrg   BUILDDOC=no
1274264fa531Smrgfi
1275264fa531Smrg
1276264fa531SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1277264fa531Smrg
1278264fa531SmrgAC_MSG_RESULT([$BUILDDOC])
1279264fa531Smrg
1280736a7e2cSmrgAC_MSG_CHECKING([whether to build pdf documentation])
1281264fa531Smrg
1282736a7e2cSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1283264fa531Smrg   BUILDPDFDOC=yes
1284264fa531Smrgelse
1285264fa531Smrg   BUILDPDFDOC=no
1286264fa531Smrgfi
1287264fa531Smrg
1288264fa531SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1289264fa531Smrg
1290264fa531SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1291264fa531Smrg
1292736a7e2cSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1293c37a63b8SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1294264fa531SmrgMAKE_PDF="$PS2PDF"
1295c37a63b8SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1296264fa531Smrg
1297264fa531SmrgAC_SUBST(MAKE_TEXT)
1298264fa531SmrgAC_SUBST(MAKE_PS)
1299264fa531SmrgAC_SUBST(MAKE_PDF)
1300264fa531SmrgAC_SUBST(MAKE_HTML)
1301264fa531Smrg]) # XORG_CHECK_LINUXDOC
1302264fa531Smrg
1303c37a63b8Smrg# XORG_CHECK_DOCBOOK
1304c37a63b8Smrg# -------------------
1305c37a63b8Smrg# Minimum version: 1.0.0
1306c37a63b8Smrg#
1307c37a63b8Smrg# Checks for the ability to build output formats from SGML DocBook source.
1308c37a63b8Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1309c37a63b8Smrg# indicates whether the necessary tools and files are found and, if set,
1310c37a63b8Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1311c37a63b8SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1312736a7e2cSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1313736a7e2cSmrg
1314c37a63b8SmrgBUILDTXTDOC=no
1315c37a63b8SmrgBUILDPDFDOC=no
1316c37a63b8SmrgBUILDPSDOC=no
1317c37a63b8SmrgBUILDHTMLDOC=no
1318c37a63b8Smrg
1319c37a63b8SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1320c37a63b8SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1321c37a63b8SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1322c37a63b8SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1323c37a63b8Smrg
1324736a7e2cSmrgAC_MSG_CHECKING([whether to build text documentation])
1325736a7e2cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1326c37a63b8Smrg   test x$BUILD_TXTDOC != xno; then
1327c37a63b8Smrg	BUILDTXTDOC=yes
1328c37a63b8Smrgfi
1329c37a63b8SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1330c37a63b8SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1331c37a63b8Smrg
1332736a7e2cSmrgAC_MSG_CHECKING([whether to build PDF documentation])
1333736a7e2cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1334c37a63b8Smrg   test x$BUILD_PDFDOC != xno; then
1335c37a63b8Smrg	BUILDPDFDOC=yes
1336c37a63b8Smrgfi
1337c37a63b8SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1338c37a63b8SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1339c37a63b8Smrg
1340736a7e2cSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1341736a7e2cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1342c37a63b8Smrg   test x$BUILD_PSDOC != xno; then
1343c37a63b8Smrg	BUILDPSDOC=yes
1344c37a63b8Smrgfi
1345c37a63b8SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1346c37a63b8SmrgAC_MSG_RESULT([$BUILDPSDOC])
1347c37a63b8Smrg
1348736a7e2cSmrgAC_MSG_CHECKING([whether to build HTML documentation])
1349736a7e2cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1350c37a63b8Smrg   test x$BUILD_HTMLDOC != xno; then
1351c37a63b8Smrg	BUILDHTMLDOC=yes
1352c37a63b8Smrgfi
1353c37a63b8SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1354c37a63b8SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1355c37a63b8Smrg
1356c37a63b8SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1357c37a63b8SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1358c37a63b8SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1359c37a63b8SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1360c37a63b8Smrg
1361c37a63b8SmrgAC_SUBST(MAKE_TEXT)
1362c37a63b8SmrgAC_SUBST(MAKE_PS)
1363c37a63b8SmrgAC_SUBST(MAKE_PDF)
1364c37a63b8SmrgAC_SUBST(MAKE_HTML)
1365c37a63b8Smrg]) # XORG_CHECK_DOCBOOK
1366c37a63b8Smrg
1367736a7e2cSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1368736a7e2cSmrg# ----------------
1369736a7e2cSmrg# Minimum version: 1.5.0
1370736a7e2cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1371736a7e2cSmrg#
1372736a7e2cSmrg# Documentation tools are not always available on all platforms and sometimes
1373736a7e2cSmrg# not at the appropriate level. This macro enables a module to test for the
1374736a7e2cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1375736a7e2cSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1376736a7e2cSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1377736a7e2cSmrg# --with-xmlto assumes 'auto'.
1378736a7e2cSmrg#
1379736a7e2cSmrg# Interface to module:
1380736a7e2cSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1381736a7e2cSmrg# XMLTO:	returns the path of the xmlto program found
1382736a7e2cSmrg#		returns the path set by the user in the environment
1383736a7e2cSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1384736a7e2cSmrg#		'no' user instructs the module not to use xmlto
1385736a7e2cSmrg#
1386736a7e2cSmrg# Added in version 1.10.0
1387736a7e2cSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1388736a7e2cSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1389736a7e2cSmrg#
1390736a7e2cSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1391736a7e2cSmrg#
1392736a7e2cSmrgAC_DEFUN([XORG_WITH_XMLTO],[
1393736a7e2cSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1394736a7e2cSmrgm4_define([_defopt], m4_default([$2], [auto]))
1395736a7e2cSmrgAC_ARG_WITH(xmlto,
1396736a7e2cSmrg	AS_HELP_STRING([--with-xmlto],
1397736a7e2cSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1398736a7e2cSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1399736a7e2cSmrgm4_undefine([_defopt])
1400736a7e2cSmrg
1401736a7e2cSmrgif test "x$use_xmlto" = x"auto"; then
1402736a7e2cSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1403736a7e2cSmrg   if test "x$XMLTO" = "x"; then
1404736a7e2cSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1405736a7e2cSmrg	have_xmlto=no
1406736a7e2cSmrg   else
1407736a7e2cSmrg        have_xmlto=yes
1408736a7e2cSmrg   fi
1409736a7e2cSmrgelif test "x$use_xmlto" = x"yes" ; then
1410736a7e2cSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1411736a7e2cSmrg   if test "x$XMLTO" = "x"; then
1412736a7e2cSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1413736a7e2cSmrg   fi
1414736a7e2cSmrg   have_xmlto=yes
1415736a7e2cSmrgelif test "x$use_xmlto" = x"no" ; then
1416736a7e2cSmrg   if test "x$XMLTO" != "x"; then
1417736a7e2cSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1418736a7e2cSmrg   fi
1419736a7e2cSmrg   have_xmlto=no
1420736a7e2cSmrgelse
1421736a7e2cSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1422736a7e2cSmrgfi
1423736a7e2cSmrg
1424736a7e2cSmrg# Test for a minimum version of xmlto, if provided.
1425736a7e2cSmrgm4_ifval([$1],
1426736a7e2cSmrg[if test "$have_xmlto" = yes; then
1427736a7e2cSmrg    # scrape the xmlto version
1428736a7e2cSmrg    AC_MSG_CHECKING([the xmlto version])
1429736a7e2cSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1430736a7e2cSmrg    AC_MSG_RESULT([$xmlto_version])
1431736a7e2cSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1432736a7e2cSmrg        [if test "x$use_xmlto" = xauto; then
1433736a7e2cSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1434736a7e2cSmrg            have_xmlto=no
1435736a7e2cSmrg        else
1436736a7e2cSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1437736a7e2cSmrg        fi])
1438736a7e2cSmrgfi])
1439736a7e2cSmrg
1440736a7e2cSmrg# Test for the ability of xmlto to generate a text target
1441736a7e2cSmrghave_xmlto_text=no
1442736a7e2cSmrgcat > conftest.xml << "EOF"
1443736a7e2cSmrgEOF
1444736a7e2cSmrgAS_IF([test "$have_xmlto" = yes],
1445736a7e2cSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1446736a7e2cSmrg             [have_xmlto_text=yes],
1447736a7e2cSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1448736a7e2cSmrgrm -f conftest.xml
1449736a7e2cSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1450736a7e2cSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1451736a7e2cSmrg]) # XORG_WITH_XMLTO
1452736a7e2cSmrg
1453736a7e2cSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1454736a7e2cSmrg# ----------------
1455736a7e2cSmrg# Minimum version: 1.5.0
1456736a7e2cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1457736a7e2cSmrg#
1458736a7e2cSmrg# Documentation tools are not always available on all platforms and sometimes
1459736a7e2cSmrg# not at the appropriate level. This macro enables a module to test for the
1460736a7e2cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1461736a7e2cSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1462736a7e2cSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1463736a7e2cSmrg# --with-asciidoc assumes 'auto'.
1464736a7e2cSmrg#
1465736a7e2cSmrg# Interface to module:
1466736a7e2cSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1467736a7e2cSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
1468736a7e2cSmrg#		 returns the path set by the user in the environment
1469736a7e2cSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1470736a7e2cSmrg#		  'no' user instructs the module not to use asciidoc
1471736a7e2cSmrg#
1472736a7e2cSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1473736a7e2cSmrg#
1474736a7e2cSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1475736a7e2cSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1476736a7e2cSmrgm4_define([_defopt], m4_default([$2], [auto]))
1477736a7e2cSmrgAC_ARG_WITH(asciidoc,
1478736a7e2cSmrg	AS_HELP_STRING([--with-asciidoc],
1479736a7e2cSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1480736a7e2cSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1481736a7e2cSmrgm4_undefine([_defopt])
1482736a7e2cSmrg
1483736a7e2cSmrgif test "x$use_asciidoc" = x"auto"; then
1484736a7e2cSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1485736a7e2cSmrg   if test "x$ASCIIDOC" = "x"; then
1486736a7e2cSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1487736a7e2cSmrg	have_asciidoc=no
1488736a7e2cSmrg   else
1489736a7e2cSmrg        have_asciidoc=yes
1490736a7e2cSmrg   fi
1491736a7e2cSmrgelif test "x$use_asciidoc" = x"yes" ; then
1492736a7e2cSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1493736a7e2cSmrg   if test "x$ASCIIDOC" = "x"; then
1494736a7e2cSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1495736a7e2cSmrg   fi
1496736a7e2cSmrg   have_asciidoc=yes
1497736a7e2cSmrgelif test "x$use_asciidoc" = x"no" ; then
1498736a7e2cSmrg   if test "x$ASCIIDOC" != "x"; then
1499736a7e2cSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1500736a7e2cSmrg   fi
1501736a7e2cSmrg   have_asciidoc=no
1502736a7e2cSmrgelse
1503736a7e2cSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1504736a7e2cSmrgfi
1505736a7e2cSmrgm4_ifval([$1],
1506736a7e2cSmrg[if test "$have_asciidoc" = yes; then
1507736a7e2cSmrg    # scrape the asciidoc version
1508736a7e2cSmrg    AC_MSG_CHECKING([the asciidoc version])
1509736a7e2cSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1510736a7e2cSmrg    AC_MSG_RESULT([$asciidoc_version])
1511736a7e2cSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1512736a7e2cSmrg        [if test "x$use_asciidoc" = xauto; then
1513736a7e2cSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1514736a7e2cSmrg            have_asciidoc=no
1515736a7e2cSmrg        else
1516736a7e2cSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1517736a7e2cSmrg        fi])
1518736a7e2cSmrgfi])
1519736a7e2cSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1520736a7e2cSmrg]) # XORG_WITH_ASCIIDOC
1521736a7e2cSmrg
1522736a7e2cSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1523736a7e2cSmrg# --------------------------------
1524736a7e2cSmrg# Minimum version: 1.5.0
1525736a7e2cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1526736a7e2cSmrg#
1527736a7e2cSmrg# Documentation tools are not always available on all platforms and sometimes
1528736a7e2cSmrg# not at the appropriate level. This macro enables a module to test for the
1529736a7e2cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1530736a7e2cSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1531736a7e2cSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1532736a7e2cSmrg# --with-doxygen assumes 'auto'.
1533736a7e2cSmrg#
1534736a7e2cSmrg# Interface to module:
1535736a7e2cSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1536736a7e2cSmrg# DOXYGEN:	 returns the path of the doxygen program found
1537736a7e2cSmrg#		 returns the path set by the user in the environment
1538736a7e2cSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1539736a7e2cSmrg#		  'no' user instructs the module not to use doxygen
1540736a7e2cSmrg#
1541736a7e2cSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1542736a7e2cSmrg#
1543736a7e2cSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1544736a7e2cSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1545736a7e2cSmrgm4_define([_defopt], m4_default([$2], [auto]))
1546736a7e2cSmrgAC_ARG_WITH(doxygen,
1547736a7e2cSmrg	AS_HELP_STRING([--with-doxygen],
1548736a7e2cSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1549736a7e2cSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1550736a7e2cSmrgm4_undefine([_defopt])
1551736a7e2cSmrg
1552736a7e2cSmrgif test "x$use_doxygen" = x"auto"; then
1553736a7e2cSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1554736a7e2cSmrg   if test "x$DOXYGEN" = "x"; then
1555736a7e2cSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1556736a7e2cSmrg	have_doxygen=no
1557736a7e2cSmrg   else
1558736a7e2cSmrg        have_doxygen=yes
1559736a7e2cSmrg   fi
1560736a7e2cSmrgelif test "x$use_doxygen" = x"yes" ; then
1561736a7e2cSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1562736a7e2cSmrg   if test "x$DOXYGEN" = "x"; then
1563736a7e2cSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1564736a7e2cSmrg   fi
1565736a7e2cSmrg   have_doxygen=yes
1566736a7e2cSmrgelif test "x$use_doxygen" = x"no" ; then
1567736a7e2cSmrg   if test "x$DOXYGEN" != "x"; then
1568736a7e2cSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1569736a7e2cSmrg   fi
1570736a7e2cSmrg   have_doxygen=no
1571736a7e2cSmrgelse
1572736a7e2cSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1573736a7e2cSmrgfi
1574736a7e2cSmrgm4_ifval([$1],
1575736a7e2cSmrg[if test "$have_doxygen" = yes; then
1576736a7e2cSmrg    # scrape the doxygen version
1577736a7e2cSmrg    AC_MSG_CHECKING([the doxygen version])
1578736a7e2cSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1579736a7e2cSmrg    AC_MSG_RESULT([$doxygen_version])
1580736a7e2cSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1581736a7e2cSmrg        [if test "x$use_doxygen" = xauto; then
1582736a7e2cSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1583736a7e2cSmrg            have_doxygen=no
1584736a7e2cSmrg        else
1585736a7e2cSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1586736a7e2cSmrg        fi])
1587736a7e2cSmrgfi])
1588736a7e2cSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
1589736a7e2cSmrg]) # XORG_WITH_DOXYGEN
1590736a7e2cSmrg
1591736a7e2cSmrg# XORG_WITH_GROFF([DEFAULT])
1592736a7e2cSmrg# ----------------
1593736a7e2cSmrg# Minimum version: 1.6.0
1594736a7e2cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1595736a7e2cSmrg#
1596736a7e2cSmrg# Documentation tools are not always available on all platforms and sometimes
1597736a7e2cSmrg# not at the appropriate level. This macro enables a module to test for the
1598736a7e2cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1599736a7e2cSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
1600736a7e2cSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
1601736a7e2cSmrg# --with-groff assumes 'auto'.
1602736a7e2cSmrg#
1603736a7e2cSmrg# Interface to module:
1604736a7e2cSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
1605736a7e2cSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
1606736a7e2cSmrg# HAVE_GROFF_MS: the -ms macros package
1607736a7e2cSmrg# GROFF:	 returns the path of the groff program found
1608736a7e2cSmrg#		 returns the path set by the user in the environment
1609736a7e2cSmrg# --with-groff:	 'yes' user instructs the module to use groff
1610736a7e2cSmrg#		 'no' user instructs the module not to use groff
1611736a7e2cSmrg#
1612736a7e2cSmrg# Added in version 1.9.0:
1613736a7e2cSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
1614736a7e2cSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
1615736a7e2cSmrg#		   psselect from the psutils package.
1616736a7e2cSmrg#		   the ghostcript package. Refer to the grohtml man pages
1617736a7e2cSmrg#
1618736a7e2cSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
1619736a7e2cSmrg#
1620736a7e2cSmrg# OS and distros often splits groff in a basic and full package, the former
1621736a7e2cSmrg# having the groff program and the later having devices, fonts and macros
1622736a7e2cSmrg# Checking for the groff executable is not enough.
1623736a7e2cSmrg#
1624736a7e2cSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
1625736a7e2cSmrg# unset HAVE_GROFF or GROFF env variables.
1626736a7e2cSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
1627736a7e2cSmrg#
1628736a7e2cSmrgAC_DEFUN([XORG_WITH_GROFF],[
1629736a7e2cSmrgAC_ARG_VAR([GROFF], [Path to groff command])
1630736a7e2cSmrgm4_define([_defopt], m4_default([$1], [auto]))
1631736a7e2cSmrgAC_ARG_WITH(groff,
1632736a7e2cSmrg	AS_HELP_STRING([--with-groff],
1633736a7e2cSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
1634736a7e2cSmrg	   [use_groff=$withval], [use_groff=]_defopt)
1635736a7e2cSmrgm4_undefine([_defopt])
1636736a7e2cSmrg
1637736a7e2cSmrgif test "x$use_groff" = x"auto"; then
1638736a7e2cSmrg   AC_PATH_PROG([GROFF], [groff])
1639736a7e2cSmrg   if test "x$GROFF" = "x"; then
1640736a7e2cSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
1641736a7e2cSmrg	have_groff=no
1642736a7e2cSmrg   else
1643736a7e2cSmrg        have_groff=yes
1644736a7e2cSmrg   fi
1645736a7e2cSmrgelif test "x$use_groff" = x"yes" ; then
1646736a7e2cSmrg   AC_PATH_PROG([GROFF], [groff])
1647736a7e2cSmrg   if test "x$GROFF" = "x"; then
1648736a7e2cSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
1649736a7e2cSmrg   fi
1650736a7e2cSmrg   have_groff=yes
1651736a7e2cSmrgelif test "x$use_groff" = x"no" ; then
1652736a7e2cSmrg   if test "x$GROFF" != "x"; then
1653736a7e2cSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
1654736a7e2cSmrg   fi
1655736a7e2cSmrg   have_groff=no
1656736a7e2cSmrgelse
1657736a7e2cSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1658736a7e2cSmrgfi
1659736a7e2cSmrg
1660736a7e2cSmrg# We have groff, test for the presence of the macro packages
1661736a7e2cSmrgif test "x$have_groff" = x"yes"; then
1662736a7e2cSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
1663736a7e2cSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
1664736a7e2cSmrg        groff_ms_works=yes
1665736a7e2cSmrg    else
1666736a7e2cSmrg        groff_ms_works=no
1667736a7e2cSmrg    fi
1668736a7e2cSmrg    AC_MSG_RESULT([$groff_ms_works])
1669736a7e2cSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
1670736a7e2cSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
1671736a7e2cSmrg        groff_mm_works=yes
1672736a7e2cSmrg    else
1673736a7e2cSmrg        groff_mm_works=no
1674736a7e2cSmrg    fi
1675736a7e2cSmrg    AC_MSG_RESULT([$groff_mm_works])
1676736a7e2cSmrgfi
1677736a7e2cSmrg
1678736a7e2cSmrg# We have groff, test for HTML dependencies, one command per package
1679736a7e2cSmrgif test "x$have_groff" = x"yes"; then
1680736a7e2cSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
1681736a7e2cSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
1682736a7e2cSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
1683736a7e2cSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
1684736a7e2cSmrg      have_groff_html=yes
1685736a7e2cSmrg   else
1686736a7e2cSmrg      have_groff_html=no
1687736a7e2cSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
1688736a7e2cSmrg   fi
1689736a7e2cSmrgfi
1690736a7e2cSmrg
1691736a7e2cSmrg# Set Automake conditionals for Makefiles
1692736a7e2cSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
1693736a7e2cSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
1694736a7e2cSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
1695736a7e2cSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
1696736a7e2cSmrg]) # XORG_WITH_GROFF
1697736a7e2cSmrg
1698736a7e2cSmrg# XORG_WITH_FOP([DEFAULT])
1699736a7e2cSmrg# ----------------
1700736a7e2cSmrg# Minimum version: 1.6.0
1701736a7e2cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1702736a7e2cSmrg#
1703736a7e2cSmrg# Documentation tools are not always available on all platforms and sometimes
1704736a7e2cSmrg# not at the appropriate level. This macro enables a module to test for the
1705736a7e2cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1706736a7e2cSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
1707736a7e2cSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
1708736a7e2cSmrg# --with-fop assumes 'auto'.
1709736a7e2cSmrg#
1710736a7e2cSmrg# Interface to module:
1711736a7e2cSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
1712736a7e2cSmrg# FOP:	 	returns the path of the fop program found
1713736a7e2cSmrg#		returns the path set by the user in the environment
1714736a7e2cSmrg# --with-fop: 	'yes' user instructs the module to use fop
1715736a7e2cSmrg#		'no' user instructs the module not to use fop
1716736a7e2cSmrg#
1717736a7e2cSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
1718736a7e2cSmrg#
1719736a7e2cSmrgAC_DEFUN([XORG_WITH_FOP],[
1720736a7e2cSmrgAC_ARG_VAR([FOP], [Path to fop command])
1721736a7e2cSmrgm4_define([_defopt], m4_default([$1], [auto]))
1722736a7e2cSmrgAC_ARG_WITH(fop,
1723736a7e2cSmrg	AS_HELP_STRING([--with-fop],
1724736a7e2cSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
1725736a7e2cSmrg	   [use_fop=$withval], [use_fop=]_defopt)
1726736a7e2cSmrgm4_undefine([_defopt])
1727736a7e2cSmrg
1728736a7e2cSmrgif test "x$use_fop" = x"auto"; then
1729736a7e2cSmrg   AC_PATH_PROG([FOP], [fop])
1730736a7e2cSmrg   if test "x$FOP" = "x"; then
1731736a7e2cSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
1732736a7e2cSmrg	have_fop=no
1733736a7e2cSmrg   else
1734736a7e2cSmrg        have_fop=yes
1735736a7e2cSmrg   fi
1736736a7e2cSmrgelif test "x$use_fop" = x"yes" ; then
1737736a7e2cSmrg   AC_PATH_PROG([FOP], [fop])
1738736a7e2cSmrg   if test "x$FOP" = "x"; then
1739736a7e2cSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
1740736a7e2cSmrg   fi
1741736a7e2cSmrg   have_fop=yes
1742736a7e2cSmrgelif test "x$use_fop" = x"no" ; then
1743736a7e2cSmrg   if test "x$FOP" != "x"; then
1744736a7e2cSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
1745736a7e2cSmrg   fi
1746736a7e2cSmrg   have_fop=no
1747736a7e2cSmrgelse
1748736a7e2cSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
1749736a7e2cSmrgfi
1750736a7e2cSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
1751736a7e2cSmrg]) # XORG_WITH_FOP
1752736a7e2cSmrg
1753736a7e2cSmrg# XORG_WITH_PS2PDF([DEFAULT])
1754736a7e2cSmrg# ----------------
1755736a7e2cSmrg# Minimum version: 1.6.0
1756736a7e2cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1757736a7e2cSmrg#
1758736a7e2cSmrg# Documentation tools are not always available on all platforms and sometimes
1759736a7e2cSmrg# not at the appropriate level. This macro enables a module to test for the
1760736a7e2cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1761736a7e2cSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
1762736a7e2cSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
1763736a7e2cSmrg# --with-ps2pdf assumes 'auto'.
1764736a7e2cSmrg#
1765736a7e2cSmrg# Interface to module:
1766736a7e2cSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
1767736a7e2cSmrg# PS2PDF:	returns the path of the ps2pdf program found
1768736a7e2cSmrg#		returns the path set by the user in the environment
1769736a7e2cSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
1770736a7e2cSmrg#		 'no' user instructs the module not to use ps2pdf
1771736a7e2cSmrg#
1772736a7e2cSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
1773736a7e2cSmrg#
1774736a7e2cSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
1775736a7e2cSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
1776736a7e2cSmrgm4_define([_defopt], m4_default([$1], [auto]))
1777736a7e2cSmrgAC_ARG_WITH(ps2pdf,
1778736a7e2cSmrg	AS_HELP_STRING([--with-ps2pdf],
1779736a7e2cSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
1780736a7e2cSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
1781736a7e2cSmrgm4_undefine([_defopt])
1782736a7e2cSmrg
1783736a7e2cSmrgif test "x$use_ps2pdf" = x"auto"; then
1784736a7e2cSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
1785736a7e2cSmrg   if test "x$PS2PDF" = "x"; then
1786736a7e2cSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
1787736a7e2cSmrg	have_ps2pdf=no
1788736a7e2cSmrg   else
1789736a7e2cSmrg        have_ps2pdf=yes
1790736a7e2cSmrg   fi
1791736a7e2cSmrgelif test "x$use_ps2pdf" = x"yes" ; then
1792736a7e2cSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
1793736a7e2cSmrg   if test "x$PS2PDF" = "x"; then
1794736a7e2cSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
1795736a7e2cSmrg   fi
1796736a7e2cSmrg   have_ps2pdf=yes
1797736a7e2cSmrgelif test "x$use_ps2pdf" = x"no" ; then
1798736a7e2cSmrg   if test "x$PS2PDF" != "x"; then
1799736a7e2cSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
1800736a7e2cSmrg   fi
1801736a7e2cSmrg   have_ps2pdf=no
1802736a7e2cSmrgelse
1803736a7e2cSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
1804736a7e2cSmrgfi
1805736a7e2cSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
1806736a7e2cSmrg]) # XORG_WITH_PS2PDF
1807736a7e2cSmrg
1808736a7e2cSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
1809736a7e2cSmrg# ----------------
1810736a7e2cSmrg# Minimum version: 1.6.0
1811736a7e2cSmrg#
1812736a7e2cSmrg# Documentation tools are not always available on all platforms and sometimes
1813736a7e2cSmrg# not at the appropriate level. This macro enables a builder to skip all
1814736a7e2cSmrg# documentation targets except traditional man pages.
1815736a7e2cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1816736a7e2cSmrg# maximum flexibilty in controlling documentation building.
1817736a7e2cSmrg# Refer to:
1818736a7e2cSmrg# XORG_WITH_XMLTO         --with-xmlto
1819736a7e2cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1820736a7e2cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
1821736a7e2cSmrg# XORG_WITH_FOP           --with-fop
1822736a7e2cSmrg# XORG_WITH_GROFF         --with-groff
1823736a7e2cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1824736a7e2cSmrg#
1825736a7e2cSmrg# Interface to module:
1826736a7e2cSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
1827736a7e2cSmrg# --enable-docs: 'yes' user instructs the module to generate docs
1828736a7e2cSmrg#		 'no' user instructs the module not to generate docs
1829736a7e2cSmrg# parm1:	specify the default value, yes or no.
1830736a7e2cSmrg#
1831736a7e2cSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
1832736a7e2cSmrgm4_define([docs_default], m4_default([$1], [yes]))
1833736a7e2cSmrgAC_ARG_ENABLE(docs,
1834736a7e2cSmrg	AS_HELP_STRING([--enable-docs],
1835736a7e2cSmrg	   [Enable building the documentation (default: ]docs_default[)]),
1836736a7e2cSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
1837736a7e2cSmrgm4_undefine([docs_default])
1838736a7e2cSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
1839736a7e2cSmrgAC_MSG_CHECKING([whether to build documentation])
1840736a7e2cSmrgAC_MSG_RESULT([$build_docs])
1841736a7e2cSmrg]) # XORG_ENABLE_DOCS
1842736a7e2cSmrg
1843736a7e2cSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
1844736a7e2cSmrg# ----------------
1845736a7e2cSmrg# Minimum version: 1.6.0
1846736a7e2cSmrg#
1847736a7e2cSmrg# This macro enables a builder to skip all developer documentation.
1848736a7e2cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1849736a7e2cSmrg# maximum flexibilty in controlling documentation building.
1850736a7e2cSmrg# Refer to:
1851736a7e2cSmrg# XORG_WITH_XMLTO         --with-xmlto
1852736a7e2cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1853736a7e2cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
1854736a7e2cSmrg# XORG_WITH_FOP           --with-fop
1855736a7e2cSmrg# XORG_WITH_GROFF         --with-groff
1856736a7e2cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1857736a7e2cSmrg#
1858736a7e2cSmrg# Interface to module:
1859736a7e2cSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
1860736a7e2cSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
1861736a7e2cSmrg#			'no' user instructs the module not to generate developer docs
1862736a7e2cSmrg# parm1:		specify the default value, yes or no.
1863736a7e2cSmrg#
1864736a7e2cSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
1865736a7e2cSmrgm4_define([devel_default], m4_default([$1], [yes]))
1866736a7e2cSmrgAC_ARG_ENABLE(devel-docs,
1867736a7e2cSmrg	AS_HELP_STRING([--enable-devel-docs],
1868736a7e2cSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
1869736a7e2cSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
1870736a7e2cSmrgm4_undefine([devel_default])
1871736a7e2cSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
1872736a7e2cSmrgAC_MSG_CHECKING([whether to build developer documentation])
1873736a7e2cSmrgAC_MSG_RESULT([$build_devel_docs])
1874736a7e2cSmrg]) # XORG_ENABLE_DEVEL_DOCS
1875736a7e2cSmrg
1876736a7e2cSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
1877736a7e2cSmrg# ----------------
1878736a7e2cSmrg# Minimum version: 1.6.0
1879736a7e2cSmrg#
1880736a7e2cSmrg# This macro enables a builder to skip all functional specification targets.
1881736a7e2cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1882736a7e2cSmrg# maximum flexibilty in controlling documentation building.
1883736a7e2cSmrg# Refer to:
1884736a7e2cSmrg# XORG_WITH_XMLTO         --with-xmlto
1885736a7e2cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1886736a7e2cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
1887736a7e2cSmrg# XORG_WITH_FOP           --with-fop
1888736a7e2cSmrg# XORG_WITH_GROFF         --with-groff
1889736a7e2cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1890736a7e2cSmrg#
1891736a7e2cSmrg# Interface to module:
1892736a7e2cSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
1893736a7e2cSmrg# --enable-specs:	'yes' user instructs the module to generate specs
1894736a7e2cSmrg#			'no' user instructs the module not to generate specs
1895736a7e2cSmrg# parm1:		specify the default value, yes or no.
1896736a7e2cSmrg#
1897736a7e2cSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
1898736a7e2cSmrgm4_define([spec_default], m4_default([$1], [yes]))
1899736a7e2cSmrgAC_ARG_ENABLE(specs,
1900736a7e2cSmrg	AS_HELP_STRING([--enable-specs],
1901736a7e2cSmrg	   [Enable building the specs (default: ]spec_default[)]),
1902736a7e2cSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
1903736a7e2cSmrgm4_undefine([spec_default])
1904736a7e2cSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
1905736a7e2cSmrgAC_MSG_CHECKING([whether to build functional specifications])
1906736a7e2cSmrgAC_MSG_RESULT([$build_specs])
1907736a7e2cSmrg]) # XORG_ENABLE_SPECS
1908736a7e2cSmrg
1909264fa531Smrg# XORG_CHECK_MALLOC_ZERO
1910264fa531Smrg# ----------------------
1911c37a63b8Smrg# Minimum version: 1.0.0
1912c37a63b8Smrg#
1913264fa531Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
1914264fa531Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
1915264fa531Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
1916264fa531SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
1917264fa531SmrgAC_ARG_ENABLE(malloc0returnsnull,
1918c37a63b8Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
1919264fa531Smrg		       [malloc(0) returns NULL (default: auto)]),
1920264fa531Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
1921264fa531Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
1922264fa531Smrg
1923264fa531SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
1924264fa531Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
1925736a7e2cSmrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
1926736a7e2cSmrg#include <stdlib.h>
1927736a7e2cSmrg],[
1928264fa531Smrg    char *m0, *r0, *c0, *p;
1929264fa531Smrg    m0 = malloc(0);
1930264fa531Smrg    p = malloc(10);
1931264fa531Smrg    r0 = realloc(p,0);
1932736a7e2cSmrg    c0 = calloc(0,10);
1933736a7e2cSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
1934736a7e2cSmrg])],
1935264fa531Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
1936736a7e2cSmrg		[MALLOC_ZERO_RETURNS_NULL=no],
1937736a7e2cSmrg		[MALLOC_ZERO_RETURNS_NULL=yes])
1938264fa531Smrgfi
1939264fa531SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
1940264fa531Smrg
1941264fa531Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
1942264fa531Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
1943264fa531Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
1944264fa531Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
1945264fa531Smrgelse
1946264fa531Smrg	MALLOC_ZERO_CFLAGS=""
1947264fa531Smrg	XMALLOC_ZERO_CFLAGS=""
1948264fa531Smrg	XTMALLOC_ZERO_CFLAGS=""
1949264fa531Smrgfi
1950264fa531Smrg
1951264fa531SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
1952264fa531SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
1953264fa531SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
1954264fa531Smrg]) # XORG_CHECK_MALLOC_ZERO
1955264fa531Smrg
1956c37a63b8Smrg# XORG_WITH_LINT()
1957c37a63b8Smrg# ----------------
1958c37a63b8Smrg# Minimum version: 1.1.0
1959c37a63b8Smrg#
1960736a7e2cSmrg# This macro enables the use of a tool that flags some suspicious and
1961736a7e2cSmrg# non-portable constructs (likely to be bugs) in C language source code.
1962736a7e2cSmrg# It will attempt to locate the tool and use appropriate options.
1963736a7e2cSmrg# There are various lint type tools on different platforms.
1964736a7e2cSmrg#
1965736a7e2cSmrg# Interface to module:
1966736a7e2cSmrg# LINT:		returns the path to the tool found on the platform
1967736a7e2cSmrg#		or the value set to LINT on the configure cmd line
1968736a7e2cSmrg#		also an Automake conditional
1969736a7e2cSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
1970736a7e2cSmrg#
1971736a7e2cSmrg# --with-lint:	'yes' user instructs the module to use lint
1972736a7e2cSmrg#		'no' user instructs the module not to use lint (default)
1973736a7e2cSmrg#
1974736a7e2cSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
1975736a7e2cSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
1976c37a63b8Smrg#
1977c37a63b8SmrgAC_DEFUN([XORG_WITH_LINT],[
1978c37a63b8Smrg
1979736a7e2cSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
1980736a7e2cSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
1981c37a63b8SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
1982c37a63b8Smrg		[Use a lint-style source code checker (default: disabled)])],
1983c37a63b8Smrg		[use_lint=$withval], [use_lint=no])
1984736a7e2cSmrg
1985736a7e2cSmrg# Obtain platform specific info like program name and options
1986736a7e2cSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
1987736a7e2cSmrgcase $host_os in
1988736a7e2cSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
1989736a7e2cSmrg	lint_name=splint
1990736a7e2cSmrg	lint_options="-badflag"
1991736a7e2cSmrg	;;
1992736a7e2cSmrg  *freebsd* | *netbsd*)
1993736a7e2cSmrg	lint_name=lint
1994736a7e2cSmrg	lint_options="-u -b"
1995736a7e2cSmrg	;;
1996736a7e2cSmrg  *solaris*)
1997736a7e2cSmrg	lint_name=lint
1998736a7e2cSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
1999736a7e2cSmrg	;;
2000736a7e2cSmrgesac
2001736a7e2cSmrg
2002736a7e2cSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2003736a7e2cSmrgif test "x$use_lint" = x"yes" ; then
2004736a7e2cSmrg   AC_PATH_PROG([LINT], [$lint_name])
2005736a7e2cSmrg   if test "x$LINT" = "x"; then
2006736a7e2cSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2007736a7e2cSmrg   fi
2008736a7e2cSmrgelif test "x$use_lint" = x"no" ; then
2009736a7e2cSmrg   if test "x$LINT" != "x"; then
2010736a7e2cSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2011736a7e2cSmrg   fi
2012c37a63b8Smrgelse
2013736a7e2cSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2014c37a63b8Smrgfi
2015736a7e2cSmrg
2016736a7e2cSmrg# User supplied flags override default flags
2017736a7e2cSmrgif test "x$LINT_FLAGS" != "x"; then
2018736a7e2cSmrg   lint_options=$LINT_FLAGS
2019c37a63b8Smrgfi
2020c37a63b8Smrg
2021736a7e2cSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2022736a7e2cSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2023c37a63b8Smrg
2024c37a63b8Smrg]) # XORG_WITH_LINT
2025c37a63b8Smrg
2026c37a63b8Smrg# XORG_LINT_LIBRARY(LIBNAME)
2027c37a63b8Smrg# --------------------------
2028c37a63b8Smrg# Minimum version: 1.1.0
2029c37a63b8Smrg#
2030c37a63b8Smrg# Sets up flags for building lint libraries for checking programs that call
2031c37a63b8Smrg# functions in the library.
2032c37a63b8Smrg#
2033736a7e2cSmrg# Interface to module:
2034736a7e2cSmrg# LINTLIB		- Automake variable with the name of lint library file to make
2035736a7e2cSmrg# MAKE_LINT_LIB		- Automake conditional
2036736a7e2cSmrg#
2037736a7e2cSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2038736a7e2cSmrg#			  - 'no' user instructs the module not to create a lint library (default)
2039c37a63b8Smrg
2040c37a63b8SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2041c37a63b8SmrgAC_REQUIRE([XORG_WITH_LINT])
2042c37a63b8SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2043c37a63b8Smrg	[Create lint library (default: disabled)])],
2044c37a63b8Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2045736a7e2cSmrg
2046736a7e2cSmrgif test "x$make_lint_lib" = x"yes" ; then
2047736a7e2cSmrg   LINTLIB=llib-l$1.ln
2048736a7e2cSmrg   if test "x$LINT" = "x"; then
2049736a7e2cSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2050736a7e2cSmrg   fi
2051736a7e2cSmrgelif test "x$make_lint_lib" != x"no" ; then
2052736a7e2cSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2053c37a63b8Smrgfi
2054736a7e2cSmrg
2055c37a63b8SmrgAC_SUBST(LINTLIB)
2056c37a63b8SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2057c37a63b8Smrg
2058c37a63b8Smrg]) # XORG_LINT_LIBRARY
2059c37a63b8Smrg
2060c37a63b8Smrg# XORG_CWARNFLAGS
2061c37a63b8Smrg# ---------------
2062c37a63b8Smrg# Minimum version: 1.2.0
2063c37a63b8Smrg#
2064c37a63b8Smrg# Defines CWARNFLAGS to enable C compiler warnings.
2065c37a63b8Smrg#
2066c37a63b8SmrgAC_DEFUN([XORG_CWARNFLAGS], [
2067736a7e2cSmrgAC_REQUIRE([AC_PROG_CC_C99])
2068c37a63b8Smrgif  test "x$GCC" = xyes ; then
2069c37a63b8Smrg    CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
2070c37a63b8Smrg-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
2071736a7e2cSmrg-Wbad-function-cast -Wformat=2"
2072c37a63b8Smrg    case `$CC -dumpversion` in
2073c37a63b8Smrg    3.4.* | 4.*)
2074c37a63b8Smrg	CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
2075c37a63b8Smrg	;;
2076c37a63b8Smrg    esac
2077c37a63b8Smrgelse
2078c37a63b8Smrg    AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2079c37a63b8Smrg    if test "x$SUNCC" = "xyes"; then
2080c37a63b8Smrg	CWARNFLAGS="-v"
2081c37a63b8Smrg    fi
2082c37a63b8Smrgfi
2083c37a63b8SmrgAC_SUBST(CWARNFLAGS)
2084c37a63b8Smrg]) # XORG_CWARNFLAGS
2085c37a63b8Smrg
2086c37a63b8Smrg# XORG_STRICT_OPTION
2087c37a63b8Smrg# -----------------------
2088c37a63b8Smrg# Minimum version: 1.3.0
2089c37a63b8Smrg#
2090c37a63b8Smrg# Add configure option to enable strict compilation
2091c37a63b8SmrgAC_DEFUN([XORG_STRICT_OPTION], [
2092736a7e2cSmrg# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
2093c37a63b8SmrgAC_REQUIRE([AC_PROG_CC_C99])
2094c37a63b8SmrgAC_REQUIRE([XORG_CWARNFLAGS])
2095c37a63b8Smrg
2096c37a63b8SmrgAC_ARG_ENABLE(strict-compilation,
2097c37a63b8Smrg			  AS_HELP_STRING([--enable-strict-compilation],
2098c37a63b8Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2099c37a63b8Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2100c37a63b8Smrgif test "x$STRICT_COMPILE" = "xyes"; then
2101c37a63b8Smrg	AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2102c37a63b8Smrg	AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2103c37a63b8Smrg	if test "x$GCC" = xyes ; then
2104c37a63b8Smrg		STRICT_CFLAGS="-pedantic -Werror"
2105c37a63b8Smrg	elif test "x$SUNCC" = "xyes"; then
2106c37a63b8Smrg		STRICT_CFLAGS="-errwarn"
2107c37a63b8Smrg    elif test "x$INTELCC" = "xyes"; then
2108c37a63b8Smrg		STRICT_CFLAGS="-Werror"
2109c37a63b8Smrg	fi
2110c37a63b8Smrgfi
2111c37a63b8SmrgCWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
2112c37a63b8SmrgAC_SUBST([CWARNFLAGS])
2113c37a63b8Smrg]) # XORG_STRICT_OPTION
2114c37a63b8Smrg
2115c37a63b8Smrg# XORG_DEFAULT_OPTIONS
2116c37a63b8Smrg# --------------------
2117c37a63b8Smrg# Minimum version: 1.3.0
2118c37a63b8Smrg#
2119c37a63b8Smrg# Defines default options for X.Org modules.
2120c37a63b8Smrg#
2121c37a63b8SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
2122736a7e2cSmrgAC_REQUIRE([AC_PROG_INSTALL])
2123c37a63b8SmrgXORG_CWARNFLAGS
2124c37a63b8SmrgXORG_STRICT_OPTION
2125c37a63b8SmrgXORG_RELEASE_VERSION
2126c37a63b8SmrgXORG_CHANGELOG
2127736a7e2cSmrgXORG_INSTALL
2128c37a63b8SmrgXORG_MANPAGE_SECTIONS
2129736a7e2cSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
2130736a7e2cSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
2131c37a63b8Smrg]) # XORG_DEFAULT_OPTIONS
2132736a7e2cSmrg
2133736a7e2cSmrg# XORG_INSTALL()
2134736a7e2cSmrg# ----------------
2135736a7e2cSmrg# Minimum version: 1.4.0
2136736a7e2cSmrg#
2137736a7e2cSmrg# Defines the variable INSTALL_CMD as the command to copy
2138736a7e2cSmrg# INSTALL from $prefix/share/util-macros.
2139736a7e2cSmrg#
2140736a7e2cSmrgAC_DEFUN([XORG_INSTALL], [
2141736a7e2cSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2142736a7e2cSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
2143736a7e2cSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
2144736a7e2cSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
2145736a7e2cSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
2146736a7e2cSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
2147736a7e2cSmrgAC_SUBST([INSTALL_CMD])
2148736a7e2cSmrg]) # XORG_INSTALL
2149264fa531Smrgdnl Copyright 2005 Red Hat, Inc
2150264fa531Smrgdnl
2151264fa531Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
2152264fa531Smrgdnl documentation for any purpose is hereby granted without fee, provided that
2153264fa531Smrgdnl the above copyright notice appear in all copies and that both that
2154264fa531Smrgdnl copyright notice and this permission notice appear in supporting
2155264fa531Smrgdnl documentation.
2156264fa531Smrgdnl
2157264fa531Smrgdnl The above copyright notice and this permission notice shall be included
2158264fa531Smrgdnl in all copies or substantial portions of the Software.
2159264fa531Smrgdnl
2160264fa531Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2161264fa531Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2162264fa531Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2163264fa531Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2164264fa531Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2165264fa531Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2166264fa531Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
2167264fa531Smrgdnl
2168264fa531Smrgdnl Except as contained in this notice, the name of the copyright holders shall
2169264fa531Smrgdnl not be used in advertising or otherwise to promote the sale, use or
2170264fa531Smrgdnl other dealings in this Software without prior written authorization
2171264fa531Smrgdnl from the copyright holders.
2172264fa531Smrgdnl
2173264fa531Smrg
2174264fa531Smrg# XORG_RELEASE_VERSION
2175264fa531Smrg# --------------------
2176736a7e2cSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
2177264fa531Smrg 
2178264fa531SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
2179c37a63b8Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
2180c37a63b8Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
2181c37a63b8Smrg		[Major version of this package])
2182c37a63b8Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
2183c37a63b8Smrg	if test "x$PVM" = "x"; then
2184c37a63b8Smrg		PVM="0"
2185c37a63b8Smrg	fi
2186c37a63b8Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
2187c37a63b8Smrg		[$PVM],
2188c37a63b8Smrg		[Minor version of this package])
2189c37a63b8Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
2190c37a63b8Smrg	if test "x$PVP" = "x"; then
2191c37a63b8Smrg		PVP="0"
2192c37a63b8Smrg	fi
2193c37a63b8Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
2194c37a63b8Smrg		[$PVP],
2195c37a63b8Smrg		[Patch version of this package])
2196264fa531Smrg])
2197264fa531Smrg
2198c37a63b8Smrg# XORG_CHANGELOG()
2199c37a63b8Smrg# ----------------
2200c37a63b8Smrg# Minimum version: 1.2.0
2201c37a63b8Smrg#
2202c37a63b8Smrg# Defines the variable CHANGELOG_CMD as the command to generate
2203c37a63b8Smrg# ChangeLog from git.
2204c37a63b8Smrg#
2205c37a63b8Smrg#
2206c37a63b8SmrgAC_DEFUN([XORG_CHANGELOG], [
2207736a7e2cSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
2208736a7e2cSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
2209736a7e2cSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
2210c37a63b8Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
2211c37a63b8SmrgAC_SUBST([CHANGELOG_CMD])
2212c37a63b8Smrg]) # XORG_CHANGELOG
2213c37a63b8Smrg
2214c37a63b8Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
2215c37a63b8Smrg# 
2216c37a63b8Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
2217c37a63b8Smrg#
2218c37a63b8Smrg# This program is free software; you can redistribute it and/or modify
2219c37a63b8Smrg# it under the terms of the GNU General Public License as published by
2220c37a63b8Smrg# the Free Software Foundation; either version 2 of the License, or
2221c37a63b8Smrg# (at your option) any later version.
2222c37a63b8Smrg#
2223c37a63b8Smrg# This program is distributed in the hope that it will be useful, but
2224c37a63b8Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
2225c37a63b8Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2226c37a63b8Smrg# General Public License for more details.
2227c37a63b8Smrg#
2228c37a63b8Smrg# You should have received a copy of the GNU General Public License
2229c37a63b8Smrg# along with this program; if not, write to the Free Software
2230c37a63b8Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2231c37a63b8Smrg#
2232c37a63b8Smrg# As a special exception to the GNU General Public License, if you
2233c37a63b8Smrg# distribute this file as part of a program that contains a
2234c37a63b8Smrg# configuration script generated by Autoconf, you may include it under
2235c37a63b8Smrg# the same distribution terms that you use for the rest of that program.
2236c37a63b8Smrg
2237c37a63b8Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
2238c37a63b8Smrg# ----------------------------------
2239c37a63b8SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
2240c37a63b8Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
2241c37a63b8Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
2242c37a63b8SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
2243c37a63b8Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
2244c37a63b8Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
2245c37a63b8Smrgfi
2246c37a63b8Smrgif test -n "$PKG_CONFIG"; then
2247c37a63b8Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
2248c37a63b8Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
2249c37a63b8Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
2250c37a63b8Smrg		AC_MSG_RESULT([yes])
2251c37a63b8Smrg	else
2252c37a63b8Smrg		AC_MSG_RESULT([no])
2253c37a63b8Smrg		PKG_CONFIG=""
2254c37a63b8Smrg	fi
2255c37a63b8Smrg		
2256c37a63b8Smrgfi[]dnl
2257c37a63b8Smrg])# PKG_PROG_PKG_CONFIG
2258c37a63b8Smrg
2259c37a63b8Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2260c37a63b8Smrg#
2261c37a63b8Smrg# Check to see whether a particular set of modules exists.  Similar
2262c37a63b8Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
2263c37a63b8Smrg#
2264c37a63b8Smrg#
2265c37a63b8Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
2266c37a63b8Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
2267c37a63b8Smrg# PKG_CHECK_EXISTS manually
2268c37a63b8Smrg# --------------------------------------------------------------
2269c37a63b8SmrgAC_DEFUN([PKG_CHECK_EXISTS],
2270c37a63b8Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2271c37a63b8Smrgif test -n "$PKG_CONFIG" && \
2272c37a63b8Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
2273c37a63b8Smrg  m4_ifval([$2], [$2], [:])
2274c37a63b8Smrgm4_ifvaln([$3], [else
2275c37a63b8Smrg  $3])dnl
2276c37a63b8Smrgfi])
2277c37a63b8Smrg
2278c37a63b8Smrg
2279c37a63b8Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
2280c37a63b8Smrg# ---------------------------------------------
2281c37a63b8Smrgm4_define([_PKG_CONFIG],
2282c37a63b8Smrg[if test -n "$$1"; then
2283c37a63b8Smrg    pkg_cv_[]$1="$$1"
2284c37a63b8Smrg elif test -n "$PKG_CONFIG"; then
2285c37a63b8Smrg    PKG_CHECK_EXISTS([$3],
2286c37a63b8Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
2287c37a63b8Smrg		     [pkg_failed=yes])
2288c37a63b8Smrg else
2289c37a63b8Smrg    pkg_failed=untried
2290c37a63b8Smrgfi[]dnl
2291c37a63b8Smrg])# _PKG_CONFIG
2292c37a63b8Smrg
2293c37a63b8Smrg# _PKG_SHORT_ERRORS_SUPPORTED
2294c37a63b8Smrg# -----------------------------
2295c37a63b8SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
2296c37a63b8Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2297c37a63b8Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
2298c37a63b8Smrg        _pkg_short_errors_supported=yes
2299c37a63b8Smrgelse
2300c37a63b8Smrg        _pkg_short_errors_supported=no
2301c37a63b8Smrgfi[]dnl
2302c37a63b8Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
2303c37a63b8Smrg
2304c37a63b8Smrg
2305c37a63b8Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2306c37a63b8Smrg# [ACTION-IF-NOT-FOUND])
2307c37a63b8Smrg#
2308c37a63b8Smrg#
2309c37a63b8Smrg# Note that if there is a possibility the first call to
2310c37a63b8Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
2311c37a63b8Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
2312c37a63b8Smrg#
2313c37a63b8Smrg#
2314c37a63b8Smrg# --------------------------------------------------------------
2315c37a63b8SmrgAC_DEFUN([PKG_CHECK_MODULES],
2316c37a63b8Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2317c37a63b8SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
2318c37a63b8SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
2319c37a63b8Smrg
2320c37a63b8Smrgpkg_failed=no
2321c37a63b8SmrgAC_MSG_CHECKING([for $1])
2322c37a63b8Smrg
2323c37a63b8Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
2324c37a63b8Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
2325c37a63b8Smrg
2326c37a63b8Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
2327c37a63b8Smrgand $1[]_LIBS to avoid the need to call pkg-config.
2328c37a63b8SmrgSee the pkg-config man page for more details.])
2329c37a63b8Smrg
2330c37a63b8Smrgif test $pkg_failed = yes; then
2331c37a63b8Smrg        _PKG_SHORT_ERRORS_SUPPORTED
2332c37a63b8Smrg        if test $_pkg_short_errors_supported = yes; then
2333c37a63b8Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
2334c37a63b8Smrg        else 
2335c37a63b8Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
2336c37a63b8Smrg        fi
2337c37a63b8Smrg	# Put the nasty error message in config.log where it belongs
2338c37a63b8Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
2339c37a63b8Smrg
2340c37a63b8Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
2341c37a63b8Smrg[Package requirements ($2) were not met:
2342c37a63b8Smrg
2343c37a63b8Smrg$$1_PKG_ERRORS
2344c37a63b8Smrg
2345c37a63b8SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
2346c37a63b8Smrginstalled software in a non-standard prefix.
2347c37a63b8Smrg
2348c37a63b8Smrg_PKG_TEXT
2349c37a63b8Smrg])],
2350c37a63b8Smrg		[AC_MSG_RESULT([no])
2351c37a63b8Smrg                $4])
2352c37a63b8Smrgelif test $pkg_failed = untried; then
2353c37a63b8Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
2354c37a63b8Smrg[The pkg-config script could not be found or is too old.  Make sure it
2355c37a63b8Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
2356c37a63b8Smrgpath to pkg-config.
2357c37a63b8Smrg
2358c37a63b8Smrg_PKG_TEXT
2359c37a63b8Smrg
2360c37a63b8SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
2361c37a63b8Smrg		[$4])
2362c37a63b8Smrgelse
2363c37a63b8Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2364c37a63b8Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2365c37a63b8Smrg        AC_MSG_RESULT([yes])
2366c37a63b8Smrg	ifelse([$3], , :, [$3])
2367c37a63b8Smrgfi[]dnl
2368c37a63b8Smrg])# PKG_CHECK_MODULES
2369c37a63b8Smrg
2370