aclocal.m4 revision af23b0a6
1af23b0a6Smrg# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
2010cdda0Smrg
3b3eb03f3Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4b3eb03f3Smrg# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
5010cdda0Smrg# This file is free software; the Free Software Foundation
6010cdda0Smrg# gives unlimited permission to copy and/or distribute it,
7010cdda0Smrg# with or without modifications, as long as this notice is preserved.
8010cdda0Smrg
9010cdda0Smrg# This program is distributed in the hope that it will be useful,
10010cdda0Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11010cdda0Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12010cdda0Smrg# PARTICULAR PURPOSE.
13010cdda0Smrg
14b3eb03f3Smrgm4_ifndef([AC_AUTOCONF_VERSION],
15b3eb03f3Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
16af23b0a6Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
17af23b0a6Smrg[m4_warning([this file was generated for autoconf 2.68.
18b3eb03f3SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
19b3eb03f3SmrgIf you have problems, you may need to regenerate the build system entirely.
20b3eb03f3SmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
21010cdda0Smrg
22b3eb03f3Smrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
23b3eb03f3Smrg#
24b3eb03f3Smrg# This file is free software; the Free Software Foundation
25b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
26b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
27010cdda0Smrg
28010cdda0Smrg# AM_AUTOMAKE_VERSION(VERSION)
29010cdda0Smrg# ----------------------------
30010cdda0Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
31010cdda0Smrg# generated from the m4 files accompanying Automake X.Y.
32b3eb03f3Smrg# (This private macro should not be called outside this file.)
33b3eb03f3SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
34b3eb03f3Smrg[am__api_version='1.11'
35b3eb03f3Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
36b3eb03f3Smrgdnl require some minimum version.  Point them to the right macro.
37af23b0a6Smrgm4_if([$1], [1.11.1], [],
38b3eb03f3Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
39b3eb03f3Smrg])
40b3eb03f3Smrg
41b3eb03f3Smrg# _AM_AUTOCONF_VERSION(VERSION)
42b3eb03f3Smrg# -----------------------------
43b3eb03f3Smrg# aclocal traces this macro to find the Autoconf version.
44b3eb03f3Smrg# This is a private macro too.  Using m4_define simplifies
45b3eb03f3Smrg# the logic in aclocal, which can simply ignore this definition.
46b3eb03f3Smrgm4_define([_AM_AUTOCONF_VERSION], [])
47010cdda0Smrg
48010cdda0Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
49010cdda0Smrg# -------------------------------
50b3eb03f3Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
51b3eb03f3Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
52010cdda0SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
53af23b0a6Smrg[AM_AUTOMAKE_VERSION([1.11.1])dnl
54b3eb03f3Smrgm4_ifndef([AC_AUTOCONF_VERSION],
55b3eb03f3Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
56b3eb03f3Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
57010cdda0Smrg
58b3eb03f3Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
59010cdda0Smrg
60b3eb03f3Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
61010cdda0Smrg#
62b3eb03f3Smrg# This file is free software; the Free Software Foundation
63b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
64b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
65010cdda0Smrg
66010cdda0Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
67010cdda0Smrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
68010cdda0Smrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
69010cdda0Smrg#
70010cdda0Smrg# Of course, Automake must honor this variable whenever it calls a
71010cdda0Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
72010cdda0Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
73010cdda0Smrg# depending on how configure is run.  This is pretty annoying, since
74010cdda0Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
75010cdda0Smrg# source directory, any form will work fine, but in subdirectories a
76010cdda0Smrg# relative path needs to be adjusted first.
77010cdda0Smrg#
78010cdda0Smrg# $ac_aux_dir/missing
79010cdda0Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
80010cdda0Smrg# $top_srcdir/$ac_aux_dir/missing
81010cdda0Smrg#    fails if $ac_aux_dir is absolute,
82010cdda0Smrg#    fails when called from a subdirectory in a VPATH build with
83010cdda0Smrg#          a relative $ac_aux_dir
84010cdda0Smrg#
85010cdda0Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
86010cdda0Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
87010cdda0Smrg# harmless because $srcdir is `.', but things will broke when you
88010cdda0Smrg# start a VPATH build or use an absolute $srcdir.
89010cdda0Smrg#
90010cdda0Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
91010cdda0Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
92010cdda0Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
93010cdda0Smrg# and then we would define $MISSING as
94010cdda0Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
95010cdda0Smrg# This will work as long as MISSING is not called from configure, because
96010cdda0Smrg# unfortunately $(top_srcdir) has no meaning in configure.
97010cdda0Smrg# However there are other variables, like CC, which are often used in
98010cdda0Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
99010cdda0Smrg#
100010cdda0Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
101010cdda0Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
102010cdda0Smrg# configured tree to be moved without reconfiguration.
103010cdda0Smrg
104b3eb03f3SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
105b3eb03f3Smrg[dnl Rely on autoconf to set up CDPATH properly.
106b3eb03f3SmrgAC_PREREQ([2.50])dnl
107010cdda0Smrg# expand $ac_aux_dir to an absolute path
108010cdda0Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
109010cdda0Smrg])
110010cdda0Smrg
111b3eb03f3Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112010cdda0Smrg
113b3eb03f3Smrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
114b3eb03f3Smrg# Free Software Foundation, Inc.
115b3eb03f3Smrg#
116b3eb03f3Smrg# This file is free software; the Free Software Foundation
117b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
118b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
119010cdda0Smrg
120b3eb03f3Smrg# serial 9
121010cdda0Smrg
122b3eb03f3Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
123b3eb03f3Smrg# -------------------------------------
124b3eb03f3Smrg# Define a conditional.
125b3eb03f3SmrgAC_DEFUN([AM_CONDITIONAL],
126b3eb03f3Smrg[AC_PREREQ(2.52)dnl
127b3eb03f3Smrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
128b3eb03f3Smrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
129b3eb03f3SmrgAC_SUBST([$1_TRUE])dnl
130b3eb03f3SmrgAC_SUBST([$1_FALSE])dnl
131b3eb03f3Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
132b3eb03f3Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
133b3eb03f3Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
134b3eb03f3Smrgif $2; then
135b3eb03f3Smrg  $1_TRUE=
136b3eb03f3Smrg  $1_FALSE='#'
137010cdda0Smrgelse
138b3eb03f3Smrg  $1_TRUE='#'
139b3eb03f3Smrg  $1_FALSE=
140010cdda0Smrgfi
141b3eb03f3SmrgAC_CONFIG_COMMANDS_PRE(
142b3eb03f3Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
143b3eb03f3Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
144b3eb03f3SmrgUsually this means the macro was only invoked conditionally.]])
145b3eb03f3Smrgfi])])
146010cdda0Smrg
147b3eb03f3Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
148b3eb03f3Smrg# Free Software Foundation, Inc.
149b3eb03f3Smrg#
150b3eb03f3Smrg# This file is free software; the Free Software Foundation
151b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
152b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
153010cdda0Smrg
154b3eb03f3Smrg# serial 10
155010cdda0Smrg
156010cdda0Smrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
157010cdda0Smrg# written in clear, in which case automake, when reading aclocal.m4,
158010cdda0Smrg# will think it sees a *use*, and therefore will trigger all it's
159010cdda0Smrg# C support machinery.  Also note that it means that autoscan, seeing
160010cdda0Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
161010cdda0Smrg
162010cdda0Smrg
163010cdda0Smrg# _AM_DEPENDENCIES(NAME)
164010cdda0Smrg# ----------------------
165010cdda0Smrg# See how the compiler implements dependency checking.
166010cdda0Smrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
167010cdda0Smrg# We try a few techniques and use that to set a single cache variable.
168010cdda0Smrg#
169010cdda0Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
170010cdda0Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
171010cdda0Smrg# dependency, and given that the user is not expected to run this macro,
172010cdda0Smrg# just rely on AC_PROG_CC.
173010cdda0SmrgAC_DEFUN([_AM_DEPENDENCIES],
174010cdda0Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
175010cdda0SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
176010cdda0SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
177010cdda0SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
178010cdda0Smrg
179010cdda0Smrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
180010cdda0Smrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
181010cdda0Smrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
182b3eb03f3Smrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
183010cdda0Smrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
184010cdda0Smrg                   [depcc="$$1"   am_compiler_list=])
185010cdda0Smrg
186010cdda0SmrgAC_CACHE_CHECK([dependency style of $depcc],
187010cdda0Smrg               [am_cv_$1_dependencies_compiler_type],
188010cdda0Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
189010cdda0Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
190010cdda0Smrg  # making bogus files that we don't know about and never remove.  For
191010cdda0Smrg  # instance it was reported that on HP-UX the gcc test will end up
192010cdda0Smrg  # making a dummy file named `D' -- because `-MD' means `put the output
193010cdda0Smrg  # in D'.
194010cdda0Smrg  mkdir conftest.dir
195010cdda0Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
196010cdda0Smrg  # using a relative directory.
197010cdda0Smrg  cp "$am_depcomp" conftest.dir
198010cdda0Smrg  cd conftest.dir
199010cdda0Smrg  # We will build objects and dependencies in a subdirectory because
200010cdda0Smrg  # it helps to detect inapplicable dependency modes.  For instance
201010cdda0Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
202010cdda0Smrg  # side effect of compilation, but ICC will put the dependencies in
203010cdda0Smrg  # the current directory while Tru64 will put them in the object
204010cdda0Smrg  # directory.
205010cdda0Smrg  mkdir sub
206010cdda0Smrg
207010cdda0Smrg  am_cv_$1_dependencies_compiler_type=none
208010cdda0Smrg  if test "$am_compiler_list" = ""; then
209010cdda0Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
210010cdda0Smrg  fi
211b3eb03f3Smrg  am__universal=false
212b3eb03f3Smrg  m4_case([$1], [CC],
213b3eb03f3Smrg    [case " $depcc " in #(
214b3eb03f3Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
215b3eb03f3Smrg     esac],
216b3eb03f3Smrg    [CXX],
217b3eb03f3Smrg    [case " $depcc " in #(
218b3eb03f3Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
219b3eb03f3Smrg     esac])
220b3eb03f3Smrg
221010cdda0Smrg  for depmode in $am_compiler_list; do
222010cdda0Smrg    # Setup a source with many dependencies, because some compilers
223010cdda0Smrg    # like to wrap large dependency lists on column 80 (with \), and
224010cdda0Smrg    # we should not choose a depcomp mode which is confused by this.
225010cdda0Smrg    #
226010cdda0Smrg    # We need to recreate these files for each test, as the compiler may
227010cdda0Smrg    # overwrite some of them when testing with obscure command lines.
228010cdda0Smrg    # This happens at least with the AIX C compiler.
229010cdda0Smrg    : > sub/conftest.c
230010cdda0Smrg    for i in 1 2 3 4 5 6; do
231010cdda0Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
232b3eb03f3Smrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
233b3eb03f3Smrg      # Solaris 8's {/usr,}/bin/sh.
234b3eb03f3Smrg      touch sub/conftst$i.h
235010cdda0Smrg    done
236010cdda0Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
237010cdda0Smrg
238b3eb03f3Smrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
239b3eb03f3Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
240b3eb03f3Smrg    # handle `-M -o', and we need to detect this.  Also, some Intel
241b3eb03f3Smrg    # versions had trouble with output in subdirs
242b3eb03f3Smrg    am__obj=sub/conftest.${OBJEXT-o}
243b3eb03f3Smrg    am__minus_obj="-o $am__obj"
244010cdda0Smrg    case $depmode in
245b3eb03f3Smrg    gcc)
246b3eb03f3Smrg      # This depmode causes a compiler race in universal mode.
247b3eb03f3Smrg      test "$am__universal" = false || continue
248b3eb03f3Smrg      ;;
249010cdda0Smrg    nosideeffect)
250010cdda0Smrg      # after this tag, mechanisms are not by side-effect, so they'll
251010cdda0Smrg      # only be used when explicitly requested
252010cdda0Smrg      if test "x$enable_dependency_tracking" = xyes; then
253010cdda0Smrg	continue
254010cdda0Smrg      else
255010cdda0Smrg	break
256010cdda0Smrg      fi
257010cdda0Smrg      ;;
258b3eb03f3Smrg    msvisualcpp | msvcmsys)
259b3eb03f3Smrg      # This compiler won't grok `-c -o', but also, the minuso test has
260b3eb03f3Smrg      # not run yet.  These depmodes are late enough in the game, and
261b3eb03f3Smrg      # so weak that their functioning should not be impacted.
262b3eb03f3Smrg      am__obj=conftest.${OBJEXT-o}
263b3eb03f3Smrg      am__minus_obj=
264b3eb03f3Smrg      ;;
265010cdda0Smrg    none) break ;;
266010cdda0Smrg    esac
267010cdda0Smrg    if depmode=$depmode \
268b3eb03f3Smrg       source=sub/conftest.c object=$am__obj \
269010cdda0Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
270b3eb03f3Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
271010cdda0Smrg         >/dev/null 2>conftest.err &&
272b3eb03f3Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
273010cdda0Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
274b3eb03f3Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
275010cdda0Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
276010cdda0Smrg      # icc doesn't choke on unknown options, it will just issue warnings
277b3eb03f3Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
278b3eb03f3Smrg      # that says an option was ignored or not supported.
279b3eb03f3Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
280b3eb03f3Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
281b3eb03f3Smrg      # The diagnosis changed in icc 8.0:
282b3eb03f3Smrg      #   icc: Command line remark: option '-MP' not supported
283b3eb03f3Smrg      if (grep 'ignoring option' conftest.err ||
284b3eb03f3Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
285010cdda0Smrg        am_cv_$1_dependencies_compiler_type=$depmode
286010cdda0Smrg        break
287010cdda0Smrg      fi
288010cdda0Smrg    fi
289010cdda0Smrg  done
290010cdda0Smrg
291010cdda0Smrg  cd ..
292010cdda0Smrg  rm -rf conftest.dir
293010cdda0Smrgelse
294010cdda0Smrg  am_cv_$1_dependencies_compiler_type=none
295010cdda0Smrgfi
296010cdda0Smrg])
297010cdda0SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
298010cdda0SmrgAM_CONDITIONAL([am__fastdep$1], [
299010cdda0Smrg  test "x$enable_dependency_tracking" != xno \
300010cdda0Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
301010cdda0Smrg])
302010cdda0Smrg
303010cdda0Smrg
304010cdda0Smrg# AM_SET_DEPDIR
305010cdda0Smrg# -------------
306010cdda0Smrg# Choose a directory name for dependency files.
307010cdda0Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
308010cdda0SmrgAC_DEFUN([AM_SET_DEPDIR],
309010cdda0Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
310010cdda0SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
311010cdda0Smrg])
312010cdda0Smrg
313010cdda0Smrg
314010cdda0Smrg# AM_DEP_TRACK
315010cdda0Smrg# ------------
316010cdda0SmrgAC_DEFUN([AM_DEP_TRACK],
317010cdda0Smrg[AC_ARG_ENABLE(dependency-tracking,
318b3eb03f3Smrg[  --disable-dependency-tracking  speeds up one-time build
319b3eb03f3Smrg  --enable-dependency-tracking   do not reject slow dependency extractors])
320010cdda0Smrgif test "x$enable_dependency_tracking" != xno; then
321010cdda0Smrg  am_depcomp="$ac_aux_dir/depcomp"
322010cdda0Smrg  AMDEPBACKSLASH='\'
323010cdda0Smrgfi
324b3eb03f3SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
325b3eb03f3SmrgAC_SUBST([AMDEPBACKSLASH])dnl
326b3eb03f3Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
327b3eb03f3Smrg])
328b3eb03f3Smrg
329b3eb03f3Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
330b3eb03f3Smrg
331b3eb03f3Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
332b3eb03f3Smrg# Free Software Foundation, Inc.
333b3eb03f3Smrg#
334b3eb03f3Smrg# This file is free software; the Free Software Foundation
335b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
336b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
337b3eb03f3Smrg
338b3eb03f3Smrg#serial 5
339b3eb03f3Smrg
340b3eb03f3Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
341b3eb03f3Smrg# ------------------------------
342b3eb03f3SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
343b3eb03f3Smrg[{
344b3eb03f3Smrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
345b3eb03f3Smrg  # are listed without --file.  Let's play safe and only enable the eval
346b3eb03f3Smrg  # if we detect the quoting.
347b3eb03f3Smrg  case $CONFIG_FILES in
348b3eb03f3Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
349b3eb03f3Smrg  *)   set x $CONFIG_FILES ;;
350b3eb03f3Smrg  esac
351b3eb03f3Smrg  shift
352b3eb03f3Smrg  for mf
353b3eb03f3Smrg  do
354b3eb03f3Smrg    # Strip MF so we end up with the name of the file.
355b3eb03f3Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
356b3eb03f3Smrg    # Check whether this is an Automake generated Makefile or not.
357b3eb03f3Smrg    # We used to match only the files named `Makefile.in', but
358b3eb03f3Smrg    # some people rename them; so instead we look at the file content.
359b3eb03f3Smrg    # Grep'ing the first line is not enough: some people post-process
360b3eb03f3Smrg    # each Makefile.in and add a new line on top of each file to say so.
361b3eb03f3Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
362b3eb03f3Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
363b3eb03f3Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
364b3eb03f3Smrg      dirpart=`AS_DIRNAME("$mf")`
365b3eb03f3Smrg    else
366b3eb03f3Smrg      continue
367b3eb03f3Smrg    fi
368b3eb03f3Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
369b3eb03f3Smrg    # from the Makefile without running `make'.
370b3eb03f3Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
371b3eb03f3Smrg    test -z "$DEPDIR" && continue
372b3eb03f3Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
373b3eb03f3Smrg    test -z "am__include" && continue
374b3eb03f3Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
375b3eb03f3Smrg    # When using ansi2knr, U may be empty or an underscore; expand it
376b3eb03f3Smrg    U=`sed -n 's/^U = //p' < "$mf"`
377b3eb03f3Smrg    # Find all dependency output files, they are included files with
378b3eb03f3Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
379b3eb03f3Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
380b3eb03f3Smrg    # expansion.
381b3eb03f3Smrg    for file in `sed -n "
382b3eb03f3Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
383b3eb03f3Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
384b3eb03f3Smrg      # Make sure the directory exists.
385b3eb03f3Smrg      test -f "$dirpart/$file" && continue
386b3eb03f3Smrg      fdir=`AS_DIRNAME(["$file"])`
387b3eb03f3Smrg      AS_MKDIR_P([$dirpart/$fdir])
388b3eb03f3Smrg      # echo "creating $dirpart/$file"
389b3eb03f3Smrg      echo '# dummy' > "$dirpart/$file"
390b3eb03f3Smrg    done
391b3eb03f3Smrg  done
392b3eb03f3Smrg}
393b3eb03f3Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
394b3eb03f3Smrg
395b3eb03f3Smrg
396b3eb03f3Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
397b3eb03f3Smrg# -----------------------------
398b3eb03f3Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
399b3eb03f3Smrg#
400b3eb03f3Smrg# This code is only required when automatic dependency tracking
401b3eb03f3Smrg# is enabled.  FIXME.  This creates each `.P' file that we will
402b3eb03f3Smrg# need in order to bootstrap the dependency handling code.
403b3eb03f3SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
404b3eb03f3Smrg[AC_CONFIG_COMMANDS([depfiles],
405b3eb03f3Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
406b3eb03f3Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
407b3eb03f3Smrg])
408b3eb03f3Smrg
409b3eb03f3Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
410b3eb03f3Smrg# Free Software Foundation, Inc.
411b3eb03f3Smrg#
412b3eb03f3Smrg# This file is free software; the Free Software Foundation
413b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
414b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
415b3eb03f3Smrg
416b3eb03f3Smrg# serial 8
417b3eb03f3Smrg
418b3eb03f3Smrg# AM_CONFIG_HEADER is obsolete.  It has been replaced by AC_CONFIG_HEADERS.
419b3eb03f3SmrgAU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
420b3eb03f3Smrg
421b3eb03f3Smrg# Do all the work for Automake.                             -*- Autoconf -*-
422b3eb03f3Smrg
423b3eb03f3Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
424b3eb03f3Smrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
425b3eb03f3Smrg#
426b3eb03f3Smrg# This file is free software; the Free Software Foundation
427b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
428b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
429b3eb03f3Smrg
430b3eb03f3Smrg# serial 16
431b3eb03f3Smrg
432b3eb03f3Smrg# This macro actually does too much.  Some checks are only needed if
433b3eb03f3Smrg# your package does certain things.  But this isn't really a big deal.
434b3eb03f3Smrg
435b3eb03f3Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
436b3eb03f3Smrg# AM_INIT_AUTOMAKE([OPTIONS])
437b3eb03f3Smrg# -----------------------------------------------
438b3eb03f3Smrg# The call with PACKAGE and VERSION arguments is the old style
439b3eb03f3Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
440b3eb03f3Smrg# and VERSION should now be passed to AC_INIT and removed from
441b3eb03f3Smrg# the call to AM_INIT_AUTOMAKE.
442b3eb03f3Smrg# We support both call styles for the transition.  After
443b3eb03f3Smrg# the next Automake release, Autoconf can make the AC_INIT
444b3eb03f3Smrg# arguments mandatory, and then we can depend on a new Autoconf
445b3eb03f3Smrg# release and drop the old call support.
446b3eb03f3SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
447b3eb03f3Smrg[AC_PREREQ([2.62])dnl
448b3eb03f3Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
449b3eb03f3Smrgdnl the ones we care about.
450b3eb03f3Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
451b3eb03f3SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
452b3eb03f3SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
453b3eb03f3Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
454b3eb03f3Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
455b3eb03f3Smrg  # is not polluted with repeated "-I."
456b3eb03f3Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
457b3eb03f3Smrg  # test to see if srcdir already configured
458b3eb03f3Smrg  if test -f $srcdir/config.status; then
459b3eb03f3Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
460b3eb03f3Smrg  fi
461b3eb03f3Smrgfi
462b3eb03f3Smrg
463b3eb03f3Smrg# test whether we have cygpath
464b3eb03f3Smrgif test -z "$CYGPATH_W"; then
465b3eb03f3Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
466b3eb03f3Smrg    CYGPATH_W='cygpath -w'
467b3eb03f3Smrg  else
468b3eb03f3Smrg    CYGPATH_W=echo
469b3eb03f3Smrg  fi
470b3eb03f3Smrgfi
471b3eb03f3SmrgAC_SUBST([CYGPATH_W])
472b3eb03f3Smrg
473b3eb03f3Smrg# Define the identity of the package.
474b3eb03f3Smrgdnl Distinguish between old-style and new-style calls.
475b3eb03f3Smrgm4_ifval([$2],
476b3eb03f3Smrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
477b3eb03f3Smrg AC_SUBST([PACKAGE], [$1])dnl
478b3eb03f3Smrg AC_SUBST([VERSION], [$2])],
479b3eb03f3Smrg[_AM_SET_OPTIONS([$1])dnl
480b3eb03f3Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
481b3eb03f3Smrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
482b3eb03f3Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
483b3eb03f3Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
484b3eb03f3Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
485b3eb03f3Smrg
486b3eb03f3Smrg_AM_IF_OPTION([no-define],,
487b3eb03f3Smrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
488b3eb03f3Smrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
489b3eb03f3Smrg
490b3eb03f3Smrg# Some tools Automake needs.
491b3eb03f3SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
492b3eb03f3SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
493b3eb03f3SmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
494b3eb03f3SmrgAM_MISSING_PROG(AUTOCONF, autoconf)
495b3eb03f3SmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
496b3eb03f3SmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
497b3eb03f3SmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
498b3eb03f3SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
499b3eb03f3SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
500b3eb03f3SmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
501b3eb03f3Smrg# We need awk for the "check" target.  The system "awk" is bad on
502b3eb03f3Smrg# some platforms.
503b3eb03f3SmrgAC_REQUIRE([AC_PROG_AWK])dnl
504b3eb03f3SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
505b3eb03f3SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
506b3eb03f3Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
507b3eb03f3Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
508b3eb03f3Smrg			     [_AM_PROG_TAR([v7])])])
509b3eb03f3Smrg_AM_IF_OPTION([no-dependencies],,
510b3eb03f3Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
511b3eb03f3Smrg		  [_AM_DEPENDENCIES(CC)],
512b3eb03f3Smrg		  [define([AC_PROG_CC],
513b3eb03f3Smrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
514b3eb03f3SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
515b3eb03f3Smrg		  [_AM_DEPENDENCIES(CXX)],
516b3eb03f3Smrg		  [define([AC_PROG_CXX],
517b3eb03f3Smrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
518b3eb03f3SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
519b3eb03f3Smrg		  [_AM_DEPENDENCIES(OBJC)],
520b3eb03f3Smrg		  [define([AC_PROG_OBJC],
521b3eb03f3Smrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
522b3eb03f3Smrg])
523b3eb03f3Smrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
524b3eb03f3Smrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
525b3eb03f3Smrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
526b3eb03f3Smrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
527b3eb03f3SmrgAC_CONFIG_COMMANDS_PRE(dnl
528b3eb03f3Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
529b3eb03f3Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
530b3eb03f3Smrg])
531b3eb03f3Smrg
532b3eb03f3Smrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
533b3eb03f3Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
534b3eb03f3Smrgdnl mangled by Autoconf and run in a shell conditional statement.
535b3eb03f3Smrgm4_define([_AC_COMPILER_EXEEXT],
536b3eb03f3Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
537b3eb03f3Smrg
538b3eb03f3Smrg
539b3eb03f3Smrg# When config.status generates a header, we must update the stamp-h file.
540b3eb03f3Smrg# This file resides in the same directory as the config header
541b3eb03f3Smrg# that is generated.  The stamp files are numbered to have different names.
542b3eb03f3Smrg
543b3eb03f3Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
544b3eb03f3Smrg# loop where config.status creates the headers, so we can generate
545b3eb03f3Smrg# our stamp files there.
546b3eb03f3SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
547b3eb03f3Smrg[# Compute $1's index in $config_headers.
548b3eb03f3Smrg_am_arg=$1
549b3eb03f3Smrg_am_stamp_count=1
550b3eb03f3Smrgfor _am_header in $config_headers :; do
551b3eb03f3Smrg  case $_am_header in
552b3eb03f3Smrg    $_am_arg | $_am_arg:* )
553b3eb03f3Smrg      break ;;
554b3eb03f3Smrg    * )
555b3eb03f3Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
556b3eb03f3Smrg  esac
557b3eb03f3Smrgdone
558b3eb03f3Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
559b3eb03f3Smrg
560b3eb03f3Smrg# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
561b3eb03f3Smrg#
562b3eb03f3Smrg# This file is free software; the Free Software Foundation
563b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
564b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
565b3eb03f3Smrg
566b3eb03f3Smrg# AM_PROG_INSTALL_SH
567b3eb03f3Smrg# ------------------
568b3eb03f3Smrg# Define $install_sh.
569b3eb03f3SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
570b3eb03f3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
571b3eb03f3Smrgif test x"${install_sh}" != xset; then
572b3eb03f3Smrg  case $am_aux_dir in
573b3eb03f3Smrg  *\ * | *\	*)
574b3eb03f3Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
575b3eb03f3Smrg  *)
576b3eb03f3Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
577b3eb03f3Smrg  esac
578b3eb03f3Smrgfi
579b3eb03f3SmrgAC_SUBST(install_sh)])
580b3eb03f3Smrg
581b3eb03f3Smrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
582b3eb03f3Smrg#
583b3eb03f3Smrg# This file is free software; the Free Software Foundation
584b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
585b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
586b3eb03f3Smrg
587b3eb03f3Smrg# serial 2
588b3eb03f3Smrg
589b3eb03f3Smrg# Check whether the underlying file-system supports filenames
590b3eb03f3Smrg# with a leading dot.  For instance MS-DOS doesn't.
591b3eb03f3SmrgAC_DEFUN([AM_SET_LEADING_DOT],
592b3eb03f3Smrg[rm -rf .tst 2>/dev/null
593b3eb03f3Smrgmkdir .tst 2>/dev/null
594b3eb03f3Smrgif test -d .tst; then
595b3eb03f3Smrg  am__leading_dot=.
596b3eb03f3Smrgelse
597b3eb03f3Smrg  am__leading_dot=_
598b3eb03f3Smrgfi
599b3eb03f3Smrgrmdir .tst 2>/dev/null
600b3eb03f3SmrgAC_SUBST([am__leading_dot])])
601b3eb03f3Smrg
602b3eb03f3Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
603b3eb03f3Smrg# From Jim Meyering
604b3eb03f3Smrg
605b3eb03f3Smrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
606b3eb03f3Smrg# Free Software Foundation, Inc.
607b3eb03f3Smrg#
608b3eb03f3Smrg# This file is free software; the Free Software Foundation
609b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
610b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
611b3eb03f3Smrg
612b3eb03f3Smrg# serial 5
613b3eb03f3Smrg
614b3eb03f3Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
615b3eb03f3Smrg# ----------------------------------
616b3eb03f3Smrg# Control maintainer-specific portions of Makefiles.
617b3eb03f3Smrg# Default is to disable them, unless `enable' is passed literally.
618b3eb03f3Smrg# For symmetry, `disable' may be passed as well.  Anyway, the user
619b3eb03f3Smrg# can override the default with the --enable/--disable switch.
620b3eb03f3SmrgAC_DEFUN([AM_MAINTAINER_MODE],
621b3eb03f3Smrg[m4_case(m4_default([$1], [disable]),
622b3eb03f3Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
623b3eb03f3Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
624b3eb03f3Smrg       [m4_define([am_maintainer_other], [enable])
625b3eb03f3Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
626b3eb03f3SmrgAC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
627b3eb03f3Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
628b3eb03f3Smrg  AC_ARG_ENABLE([maintainer-mode],
629b3eb03f3Smrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
630b3eb03f3Smrg			  (and sometimes confusing) to the casual installer],
631b3eb03f3Smrg      [USE_MAINTAINER_MODE=$enableval],
632b3eb03f3Smrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
633b3eb03f3Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
634b3eb03f3Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
635b3eb03f3Smrg  MAINT=$MAINTAINER_MODE_TRUE
636b3eb03f3Smrg  AC_SUBST([MAINT])dnl
637b3eb03f3Smrg]
638b3eb03f3Smrg)
639b3eb03f3Smrg
640b3eb03f3SmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
641b3eb03f3Smrg
642b3eb03f3Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
643b3eb03f3Smrg
644b3eb03f3Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
645b3eb03f3Smrg#
646b3eb03f3Smrg# This file is free software; the Free Software Foundation
647b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
648b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
649b3eb03f3Smrg
650b3eb03f3Smrg# serial 4
651b3eb03f3Smrg
652b3eb03f3Smrg# AM_MAKE_INCLUDE()
653b3eb03f3Smrg# -----------------
654b3eb03f3Smrg# Check to see how make treats includes.
655b3eb03f3SmrgAC_DEFUN([AM_MAKE_INCLUDE],
656b3eb03f3Smrg[am_make=${MAKE-make}
657b3eb03f3Smrgcat > confinc << 'END'
658b3eb03f3Smrgam__doit:
659b3eb03f3Smrg	@echo this is the am__doit target
660b3eb03f3Smrg.PHONY: am__doit
661b3eb03f3SmrgEND
662b3eb03f3Smrg# If we don't find an include directive, just comment out the code.
663b3eb03f3SmrgAC_MSG_CHECKING([for style of include used by $am_make])
664b3eb03f3Smrgam__include="#"
665b3eb03f3Smrgam__quote=
666b3eb03f3Smrg_am_result=none
667b3eb03f3Smrg# First try GNU make style include.
668b3eb03f3Smrgecho "include confinc" > confmf
669b3eb03f3Smrg# Ignore all kinds of additional output from `make'.
670b3eb03f3Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
671b3eb03f3Smrg*the\ am__doit\ target*)
672b3eb03f3Smrg  am__include=include
673b3eb03f3Smrg  am__quote=
674b3eb03f3Smrg  _am_result=GNU
675b3eb03f3Smrg  ;;
676b3eb03f3Smrgesac
677b3eb03f3Smrg# Now try BSD make style include.
678b3eb03f3Smrgif test "$am__include" = "#"; then
679b3eb03f3Smrg   echo '.include "confinc"' > confmf
680b3eb03f3Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
681b3eb03f3Smrg   *the\ am__doit\ target*)
682b3eb03f3Smrg     am__include=.include
683b3eb03f3Smrg     am__quote="\""
684b3eb03f3Smrg     _am_result=BSD
685b3eb03f3Smrg     ;;
686b3eb03f3Smrg   esac
687b3eb03f3Smrgfi
688b3eb03f3SmrgAC_SUBST([am__include])
689b3eb03f3SmrgAC_SUBST([am__quote])
690b3eb03f3SmrgAC_MSG_RESULT([$_am_result])
691b3eb03f3Smrgrm -f confinc confmf
692b3eb03f3Smrg])
693b3eb03f3Smrg
694b3eb03f3Smrg# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008
695b3eb03f3Smrg# Free Software Foundation, Inc.
696b3eb03f3Smrg#
697b3eb03f3Smrg# This file is free software; the Free Software Foundation
698b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
699b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
700b3eb03f3Smrg
701b3eb03f3Smrg# serial 6
702b3eb03f3Smrg
703b3eb03f3Smrg# AM_PROG_CC_C_O
704b3eb03f3Smrg# --------------
705b3eb03f3Smrg# Like AC_PROG_CC_C_O, but changed for automake.
706b3eb03f3SmrgAC_DEFUN([AM_PROG_CC_C_O],
707b3eb03f3Smrg[AC_REQUIRE([AC_PROG_CC_C_O])dnl
708b3eb03f3SmrgAC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
709b3eb03f3SmrgAC_REQUIRE_AUX_FILE([compile])dnl
710b3eb03f3Smrg# FIXME: we rely on the cache variable name because
711b3eb03f3Smrg# there is no other way.
712b3eb03f3Smrgset dummy $CC
713b3eb03f3Smrgam_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
714b3eb03f3Smrgeval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
715b3eb03f3Smrgif test "$am_t" != yes; then
716b3eb03f3Smrg   # Losing compiler, so override with the script.
717b3eb03f3Smrg   # FIXME: It is wrong to rewrite CC.
718b3eb03f3Smrg   # But if we don't then we get into trouble of one sort or another.
719b3eb03f3Smrg   # A longer-term fix would be to have automake use am__CC in this case,
720b3eb03f3Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
721b3eb03f3Smrg   CC="$am_aux_dir/compile $CC"
722b3eb03f3Smrgfi
723b3eb03f3Smrgdnl Make sure AC_PROG_CC is never called again, or it will override our
724b3eb03f3Smrgdnl setting of CC.
725b3eb03f3Smrgm4_define([AC_PROG_CC],
726b3eb03f3Smrg          [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
727b3eb03f3Smrg])
728b3eb03f3Smrg
729b3eb03f3Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
730b3eb03f3Smrg
731b3eb03f3Smrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
732b3eb03f3Smrg# Free Software Foundation, Inc.
733b3eb03f3Smrg#
734b3eb03f3Smrg# This file is free software; the Free Software Foundation
735b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
736b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
737b3eb03f3Smrg
738b3eb03f3Smrg# serial 6
739b3eb03f3Smrg
740b3eb03f3Smrg# AM_MISSING_PROG(NAME, PROGRAM)
741b3eb03f3Smrg# ------------------------------
742b3eb03f3SmrgAC_DEFUN([AM_MISSING_PROG],
743b3eb03f3Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
744b3eb03f3Smrg$1=${$1-"${am_missing_run}$2"}
745b3eb03f3SmrgAC_SUBST($1)])
746b3eb03f3Smrg
747b3eb03f3Smrg
748b3eb03f3Smrg# AM_MISSING_HAS_RUN
749b3eb03f3Smrg# ------------------
750b3eb03f3Smrg# Define MISSING if not defined so far and test if it supports --run.
751b3eb03f3Smrg# If it does, set am_missing_run to use it, otherwise, to nothing.
752b3eb03f3SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
753b3eb03f3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
754b3eb03f3SmrgAC_REQUIRE_AUX_FILE([missing])dnl
755b3eb03f3Smrgif test x"${MISSING+set}" != xset; then
756b3eb03f3Smrg  case $am_aux_dir in
757b3eb03f3Smrg  *\ * | *\	*)
758b3eb03f3Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
759b3eb03f3Smrg  *)
760b3eb03f3Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
761b3eb03f3Smrg  esac
762b3eb03f3Smrgfi
763b3eb03f3Smrg# Use eval to expand $SHELL
764b3eb03f3Smrgif eval "$MISSING --run true"; then
765b3eb03f3Smrg  am_missing_run="$MISSING --run "
766b3eb03f3Smrgelse
767b3eb03f3Smrg  am_missing_run=
768b3eb03f3Smrg  AC_MSG_WARN([`missing' script is too old or missing])
769b3eb03f3Smrgfi
770b3eb03f3Smrg])
771b3eb03f3Smrg
772b3eb03f3Smrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
773b3eb03f3Smrg#
774b3eb03f3Smrg# This file is free software; the Free Software Foundation
775b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
776b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
777b3eb03f3Smrg
778b3eb03f3Smrg# AM_PROG_MKDIR_P
779b3eb03f3Smrg# ---------------
780b3eb03f3Smrg# Check for `mkdir -p'.
781b3eb03f3SmrgAC_DEFUN([AM_PROG_MKDIR_P],
782b3eb03f3Smrg[AC_PREREQ([2.60])dnl
783b3eb03f3SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
784b3eb03f3Smrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
785b3eb03f3Smrgdnl while keeping a definition of mkdir_p for backward compatibility.
786b3eb03f3Smrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
787b3eb03f3Smrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
788b3eb03f3Smrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
789b3eb03f3Smrgdnl adjustment using top_builddir (which is defined more often than
790b3eb03f3Smrgdnl MKDIR_P).
791b3eb03f3SmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
792b3eb03f3Smrgcase $mkdir_p in
793b3eb03f3Smrg  [[\\/$]]* | ?:[[\\/]]*) ;;
794b3eb03f3Smrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
795b3eb03f3Smrgesac
796b3eb03f3Smrg])
797b3eb03f3Smrg
798b3eb03f3Smrg# Helper functions for option handling.                     -*- Autoconf -*-
799b3eb03f3Smrg
800b3eb03f3Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
801b3eb03f3Smrg#
802b3eb03f3Smrg# This file is free software; the Free Software Foundation
803b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
804b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
805b3eb03f3Smrg
806b3eb03f3Smrg# serial 4
807b3eb03f3Smrg
808b3eb03f3Smrg# _AM_MANGLE_OPTION(NAME)
809b3eb03f3Smrg# -----------------------
810b3eb03f3SmrgAC_DEFUN([_AM_MANGLE_OPTION],
811b3eb03f3Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
812b3eb03f3Smrg
813b3eb03f3Smrg# _AM_SET_OPTION(NAME)
814b3eb03f3Smrg# ------------------------------
815b3eb03f3Smrg# Set option NAME.  Presently that only means defining a flag for this option.
816b3eb03f3SmrgAC_DEFUN([_AM_SET_OPTION],
817b3eb03f3Smrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
818b3eb03f3Smrg
819b3eb03f3Smrg# _AM_SET_OPTIONS(OPTIONS)
820b3eb03f3Smrg# ----------------------------------
821b3eb03f3Smrg# OPTIONS is a space-separated list of Automake options.
822b3eb03f3SmrgAC_DEFUN([_AM_SET_OPTIONS],
823b3eb03f3Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
824b3eb03f3Smrg
825b3eb03f3Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
826b3eb03f3Smrg# -------------------------------------------
827b3eb03f3Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
828b3eb03f3SmrgAC_DEFUN([_AM_IF_OPTION],
829b3eb03f3Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
830b3eb03f3Smrg
831b3eb03f3Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
832b3eb03f3Smrg
833b3eb03f3Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
834b3eb03f3Smrg# Free Software Foundation, Inc.
835b3eb03f3Smrg#
836b3eb03f3Smrg# This file is free software; the Free Software Foundation
837b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
838b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
839b3eb03f3Smrg
840b3eb03f3Smrg# serial 5
841b3eb03f3Smrg
842b3eb03f3Smrg# AM_SANITY_CHECK
843b3eb03f3Smrg# ---------------
844b3eb03f3SmrgAC_DEFUN([AM_SANITY_CHECK],
845b3eb03f3Smrg[AC_MSG_CHECKING([whether build environment is sane])
846b3eb03f3Smrg# Just in case
847b3eb03f3Smrgsleep 1
848b3eb03f3Smrgecho timestamp > conftest.file
849b3eb03f3Smrg# Reject unsafe characters in $srcdir or the absolute working directory
850b3eb03f3Smrg# name.  Accept space and tab only in the latter.
851b3eb03f3Smrgam_lf='
852b3eb03f3Smrg'
853b3eb03f3Smrgcase `pwd` in
854b3eb03f3Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
855b3eb03f3Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
856b3eb03f3Smrgesac
857b3eb03f3Smrgcase $srcdir in
858b3eb03f3Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
859b3eb03f3Smrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
860b3eb03f3Smrgesac
861b3eb03f3Smrg
862b3eb03f3Smrg# Do `set' in a subshell so we don't clobber the current shell's
863b3eb03f3Smrg# arguments.  Must try -L first in case configure is actually a
864b3eb03f3Smrg# symlink; some systems play weird games with the mod time of symlinks
865b3eb03f3Smrg# (eg FreeBSD returns the mod time of the symlink's containing
866b3eb03f3Smrg# directory).
867b3eb03f3Smrgif (
868b3eb03f3Smrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
869b3eb03f3Smrg   if test "$[*]" = "X"; then
870b3eb03f3Smrg      # -L didn't work.
871b3eb03f3Smrg      set X `ls -t "$srcdir/configure" conftest.file`
872b3eb03f3Smrg   fi
873b3eb03f3Smrg   rm -f conftest.file
874b3eb03f3Smrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
875b3eb03f3Smrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
876b3eb03f3Smrg
877b3eb03f3Smrg      # If neither matched, then we have a broken ls.  This can happen
878b3eb03f3Smrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
879b3eb03f3Smrg      # broken ls alias from the environment.  This has actually
880b3eb03f3Smrg      # happened.  Such a system could not be considered "sane".
881b3eb03f3Smrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
882b3eb03f3Smrgalias in your environment])
883b3eb03f3Smrg   fi
884b3eb03f3Smrg
885b3eb03f3Smrg   test "$[2]" = conftest.file
886b3eb03f3Smrg   )
887b3eb03f3Smrgthen
888b3eb03f3Smrg   # Ok.
889b3eb03f3Smrg   :
890b3eb03f3Smrgelse
891b3eb03f3Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
892b3eb03f3SmrgCheck your system clock])
893b3eb03f3Smrgfi
894b3eb03f3SmrgAC_MSG_RESULT(yes)])
895b3eb03f3Smrg
896b3eb03f3Smrg# Copyright (C) 2009  Free Software Foundation, Inc.
897b3eb03f3Smrg#
898b3eb03f3Smrg# This file is free software; the Free Software Foundation
899b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
900b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
901b3eb03f3Smrg
902b3eb03f3Smrg# serial 1
903b3eb03f3Smrg
904b3eb03f3Smrg# AM_SILENT_RULES([DEFAULT])
905b3eb03f3Smrg# --------------------------
906b3eb03f3Smrg# Enable less verbose build rules; with the default set to DEFAULT
907b3eb03f3Smrg# (`yes' being less verbose, `no' or empty being verbose).
908b3eb03f3SmrgAC_DEFUN([AM_SILENT_RULES],
909b3eb03f3Smrg[AC_ARG_ENABLE([silent-rules],
910b3eb03f3Smrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
911b3eb03f3Smrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
912b3eb03f3Smrgcase $enable_silent_rules in
913b3eb03f3Smrgyes) AM_DEFAULT_VERBOSITY=0;;
914b3eb03f3Smrgno)  AM_DEFAULT_VERBOSITY=1;;
915b3eb03f3Smrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
916b3eb03f3Smrgesac
917b3eb03f3SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
918b3eb03f3SmrgAM_BACKSLASH='\'
919b3eb03f3SmrgAC_SUBST([AM_BACKSLASH])dnl
920b3eb03f3Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
921b3eb03f3Smrg])
922b3eb03f3Smrg
923b3eb03f3Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
924b3eb03f3Smrg#
925b3eb03f3Smrg# This file is free software; the Free Software Foundation
926b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
927b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
928b3eb03f3Smrg
929b3eb03f3Smrg# AM_PROG_INSTALL_STRIP
930b3eb03f3Smrg# ---------------------
931b3eb03f3Smrg# One issue with vendor `install' (even GNU) is that you can't
932b3eb03f3Smrg# specify the program used to strip binaries.  This is especially
933b3eb03f3Smrg# annoying in cross-compiling environments, where the build's strip
934b3eb03f3Smrg# is unlikely to handle the host's binaries.
935b3eb03f3Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
936b3eb03f3Smrg# always use install-sh in `make install-strip', and initialize
937b3eb03f3Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
938b3eb03f3SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
939b3eb03f3Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
940b3eb03f3Smrg# Installed binaries are usually stripped using `strip' when the user
941b3eb03f3Smrg# run `make install-strip'.  However `strip' might not be the right
942b3eb03f3Smrg# tool to use in cross-compilation environments, therefore Automake
943b3eb03f3Smrg# will honor the `STRIP' environment variable to overrule this program.
944b3eb03f3Smrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
945b3eb03f3Smrgif test "$cross_compiling" != no; then
946b3eb03f3Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
947b3eb03f3Smrgfi
948b3eb03f3SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
949b3eb03f3SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
950b3eb03f3Smrg
951b3eb03f3Smrg# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
952b3eb03f3Smrg#
953b3eb03f3Smrg# This file is free software; the Free Software Foundation
954b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
955b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
956b3eb03f3Smrg
957b3eb03f3Smrg# serial 2
958b3eb03f3Smrg
959b3eb03f3Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
960b3eb03f3Smrg# ---------------------------
961b3eb03f3Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
962b3eb03f3Smrg# This macro is traced by Automake.
963b3eb03f3SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
964b3eb03f3Smrg
965b3eb03f3Smrg# AM_SUBST_NOTMAKE(VARIABLE)
966b3eb03f3Smrg# ---------------------------
967b3eb03f3Smrg# Public sister of _AM_SUBST_NOTMAKE.
968b3eb03f3SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
969b3eb03f3Smrg
970b3eb03f3Smrg# Check how to create a tarball.                            -*- Autoconf -*-
971b3eb03f3Smrg
972b3eb03f3Smrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
973b3eb03f3Smrg#
974b3eb03f3Smrg# This file is free software; the Free Software Foundation
975b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
976b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
977b3eb03f3Smrg
978b3eb03f3Smrg# serial 2
979b3eb03f3Smrg
980b3eb03f3Smrg# _AM_PROG_TAR(FORMAT)
981b3eb03f3Smrg# --------------------
982b3eb03f3Smrg# Check how to create a tarball in format FORMAT.
983b3eb03f3Smrg# FORMAT should be one of `v7', `ustar', or `pax'.
984b3eb03f3Smrg#
985b3eb03f3Smrg# Substitute a variable $(am__tar) that is a command
986b3eb03f3Smrg# writing to stdout a FORMAT-tarball containing the directory
987b3eb03f3Smrg# $tardir.
988b3eb03f3Smrg#     tardir=directory && $(am__tar) > result.tar
989b3eb03f3Smrg#
990b3eb03f3Smrg# Substitute a variable $(am__untar) that extract such
991b3eb03f3Smrg# a tarball read from stdin.
992b3eb03f3Smrg#     $(am__untar) < result.tar
993b3eb03f3SmrgAC_DEFUN([_AM_PROG_TAR],
994b3eb03f3Smrg[# Always define AMTAR for backward compatibility.
995b3eb03f3SmrgAM_MISSING_PROG([AMTAR], [tar])
996b3eb03f3Smrgm4_if([$1], [v7],
997b3eb03f3Smrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
998b3eb03f3Smrg     [m4_case([$1], [ustar],, [pax],,
999b3eb03f3Smrg              [m4_fatal([Unknown tar format])])
1000b3eb03f3SmrgAC_MSG_CHECKING([how to create a $1 tar archive])
1001b3eb03f3Smrg# Loop over all known methods to create a tar archive until one works.
1002b3eb03f3Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1003b3eb03f3Smrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
1004b3eb03f3Smrg# Do not fold the above two line into one, because Tru64 sh and
1005b3eb03f3Smrg# Solaris sh will not grok spaces in the rhs of `-'.
1006b3eb03f3Smrgfor _am_tool in $_am_tools
1007b3eb03f3Smrgdo
1008b3eb03f3Smrg  case $_am_tool in
1009b3eb03f3Smrg  gnutar)
1010b3eb03f3Smrg    for _am_tar in tar gnutar gtar;
1011b3eb03f3Smrg    do
1012b3eb03f3Smrg      AM_RUN_LOG([$_am_tar --version]) && break
1013b3eb03f3Smrg    done
1014b3eb03f3Smrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1015b3eb03f3Smrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1016b3eb03f3Smrg    am__untar="$_am_tar -xf -"
1017b3eb03f3Smrg    ;;
1018b3eb03f3Smrg  plaintar)
1019b3eb03f3Smrg    # Must skip GNU tar: if it does not support --format= it doesn't create
1020b3eb03f3Smrg    # ustar tarball either.
1021b3eb03f3Smrg    (tar --version) >/dev/null 2>&1 && continue
1022b3eb03f3Smrg    am__tar='tar chf - "$$tardir"'
1023b3eb03f3Smrg    am__tar_='tar chf - "$tardir"'
1024b3eb03f3Smrg    am__untar='tar xf -'
1025b3eb03f3Smrg    ;;
1026b3eb03f3Smrg  pax)
1027b3eb03f3Smrg    am__tar='pax -L -x $1 -w "$$tardir"'
1028b3eb03f3Smrg    am__tar_='pax -L -x $1 -w "$tardir"'
1029b3eb03f3Smrg    am__untar='pax -r'
1030b3eb03f3Smrg    ;;
1031b3eb03f3Smrg  cpio)
1032b3eb03f3Smrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1033b3eb03f3Smrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1034b3eb03f3Smrg    am__untar='cpio -i -H $1 -d'
1035b3eb03f3Smrg    ;;
1036b3eb03f3Smrg  none)
1037b3eb03f3Smrg    am__tar=false
1038b3eb03f3Smrg    am__tar_=false
1039b3eb03f3Smrg    am__untar=false
1040b3eb03f3Smrg    ;;
1041b3eb03f3Smrg  esac
1042b3eb03f3Smrg
1043b3eb03f3Smrg  # If the value was cached, stop now.  We just wanted to have am__tar
1044b3eb03f3Smrg  # and am__untar set.
1045b3eb03f3Smrg  test -n "${am_cv_prog_tar_$1}" && break
1046b3eb03f3Smrg
1047b3eb03f3Smrg  # tar/untar a dummy directory, and stop if the command works
1048b3eb03f3Smrg  rm -rf conftest.dir
1049b3eb03f3Smrg  mkdir conftest.dir
1050b3eb03f3Smrg  echo GrepMe > conftest.dir/file
1051b3eb03f3Smrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1052b3eb03f3Smrg  rm -rf conftest.dir
1053b3eb03f3Smrg  if test -s conftest.tar; then
1054b3eb03f3Smrg    AM_RUN_LOG([$am__untar <conftest.tar])
1055b3eb03f3Smrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1056b3eb03f3Smrg  fi
1057b3eb03f3Smrgdone
1058b3eb03f3Smrgrm -rf conftest.dir
1059b3eb03f3Smrg
1060b3eb03f3SmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1061b3eb03f3SmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
1062b3eb03f3SmrgAC_SUBST([am__tar])
1063b3eb03f3SmrgAC_SUBST([am__untar])
1064b3eb03f3Smrg]) # _AM_PROG_TAR
1065b3eb03f3Smrg
1066b3eb03f3Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1067b3eb03f3Smrgdnl
1068af23b0a6Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1069b3eb03f3Smrgdnl 
1070b3eb03f3Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1071af23b0a6Smrgdnl copy of this software and associated documentation files (the "Software"),
1072af23b0a6Smrgdnl to deal in the Software without restriction, including without limitation
1073af23b0a6Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1074af23b0a6Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1075af23b0a6Smrgdnl Software is furnished to do so, subject to the following conditions:
1076b3eb03f3Smrgdnl
1077af23b0a6Smrgdnl The above copyright notice and this permission notice (including the next
1078af23b0a6Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1079af23b0a6Smrgdnl Software.
1080b3eb03f3Smrgdnl
1081af23b0a6Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1082af23b0a6Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1083af23b0a6Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1084af23b0a6Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1085af23b0a6Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1086af23b0a6Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1087af23b0a6Smrgdnl DEALINGS IN THE SOFTWARE.
1088b3eb03f3Smrg
1089b3eb03f3Smrg# XORG_MACROS_VERSION(required-version)
1090b3eb03f3Smrg# -------------------------------------
1091b3eb03f3Smrg# Minimum version: 1.1.0
1092b3eb03f3Smrg#
1093b3eb03f3Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1094b3eb03f3Smrg# your configure.ac with the minimum required version, such as:
1095b3eb03f3Smrg# XORG_MACROS_VERSION(1.1)
1096b3eb03f3Smrg#
1097b3eb03f3Smrg# To ensure that this macro is defined, also add:
1098b3eb03f3Smrg# m4_ifndef([XORG_MACROS_VERSION],
1099b3eb03f3Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1100b3eb03f3Smrg#
1101b3eb03f3Smrg#
1102b3eb03f3Smrg# See the "minimum version" comment for each macro you use to see what 
1103b3eb03f3Smrg# version you require.
1104b3eb03f3Smrgm4_defun([XORG_MACROS_VERSION],[
1105af23b0a6Smrgm4_define([vers_have], [1.11.0])
1106b3eb03f3Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1107b3eb03f3Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1108b3eb03f3Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1109b3eb03f3Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1110b3eb03f3Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1111b3eb03f3Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1112b3eb03f3Smrgm4_undefine([vers_have])
1113b3eb03f3Smrgm4_undefine([maj_have])
1114b3eb03f3Smrgm4_undefine([maj_needed])
1115b3eb03f3Smrg]) # XORG_MACROS_VERSION
1116b3eb03f3Smrg
1117b3eb03f3Smrg# XORG_PROG_RAWCPP()
1118b3eb03f3Smrg# ------------------
1119b3eb03f3Smrg# Minimum version: 1.0.0
1120b3eb03f3Smrg#
1121b3eb03f3Smrg# Find cpp program and necessary flags for use in pre-processing text files
1122b3eb03f3Smrg# such as man pages and config files
1123b3eb03f3SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1124b3eb03f3SmrgAC_REQUIRE([AC_PROG_CPP])
1125b3eb03f3SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
1126b3eb03f3Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1127b3eb03f3Smrg
1128b3eb03f3Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1129b3eb03f3Smrg# which is not the best choice for supporting other OS'es, but covers most
1130b3eb03f3Smrg# of the ones we need for now.
1131b3eb03f3SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1132b3eb03f3SmrgAC_LANG_CONFTEST([Does cpp redefine unix ?])
1133b3eb03f3Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1134b3eb03f3Smrg	AC_MSG_RESULT([no])
1135b3eb03f3Smrgelse
1136b3eb03f3Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1137b3eb03f3Smrg		RAWCPPFLAGS=-undef
1138b3eb03f3Smrg		AC_MSG_RESULT([yes])
1139b3eb03f3Smrg	# under Cygwin unix is still defined even with -undef
1140b3eb03f3Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1141b3eb03f3Smrg		RAWCPPFLAGS="-undef -ansi"
1142b3eb03f3Smrg		AC_MSG_RESULT([yes, with -ansi])
1143b3eb03f3Smrg	else
1144b3eb03f3Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1145b3eb03f3Smrg	fi
1146b3eb03f3Smrgfi
1147b3eb03f3Smrgrm -f conftest.$ac_ext
1148010cdda0Smrg
1149b3eb03f3SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1150b3eb03f3SmrgAC_LANG_CONFTEST([Does cpp preserve   "whitespace"?])
1151b3eb03f3Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1152b3eb03f3Smrg	AC_MSG_RESULT([no])
1153b3eb03f3Smrgelse
1154b3eb03f3Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1155b3eb03f3Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1156b3eb03f3Smrg		AC_MSG_RESULT([yes])
1157b3eb03f3Smrg	else
1158b3eb03f3Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1159b3eb03f3Smrg	fi
1160b3eb03f3Smrgfi
1161b3eb03f3Smrgrm -f conftest.$ac_ext
1162b3eb03f3SmrgAC_SUBST(RAWCPPFLAGS)
1163b3eb03f3Smrg]) # XORG_PROG_RAWCPP
1164010cdda0Smrg
1165b3eb03f3Smrg# XORG_MANPAGE_SECTIONS()
1166b3eb03f3Smrg# -----------------------
1167b3eb03f3Smrg# Minimum version: 1.0.0
1168b3eb03f3Smrg#
1169b3eb03f3Smrg# Determine which sections man pages go in for the different man page types
1170b3eb03f3Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1171b3eb03f3Smrg# Not sure if there's any better way than just hardcoding by OS name.
1172b3eb03f3Smrg# Override default settings by setting environment variables
1173af23b0a6Smrg# Added MAN_SUBSTS in version 1.8
1174af23b0a6Smrg# Added AC_PROG_SED in version 1.8
1175010cdda0Smrg
1176b3eb03f3SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1177b3eb03f3SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1178af23b0a6SmrgAC_REQUIRE([AC_PROG_SED])
1179010cdda0Smrg
1180b3eb03f3Smrgif test x$APP_MAN_SUFFIX = x    ; then
1181b3eb03f3Smrg    APP_MAN_SUFFIX=1
1182b3eb03f3Smrgfi
1183b3eb03f3Smrgif test x$APP_MAN_DIR = x    ; then
1184b3eb03f3Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1185b3eb03f3Smrgfi
1186010cdda0Smrg
1187b3eb03f3Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1188b3eb03f3Smrg    LIB_MAN_SUFFIX=3
1189b3eb03f3Smrgfi
1190b3eb03f3Smrgif test x$LIB_MAN_DIR = x    ; then
1191b3eb03f3Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1192b3eb03f3Smrgfi
1193010cdda0Smrg
1194b3eb03f3Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1195b3eb03f3Smrg    case $host_os in
1196b3eb03f3Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1197b3eb03f3Smrg	*)		FILE_MAN_SUFFIX=5  ;;
1198b3eb03f3Smrg    esac
1199b3eb03f3Smrgfi
1200b3eb03f3Smrgif test x$FILE_MAN_DIR = x    ; then
1201b3eb03f3Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1202b3eb03f3Smrgfi
1203010cdda0Smrg
1204b3eb03f3Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1205b3eb03f3Smrg    case $host_os in
1206b3eb03f3Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1207b3eb03f3Smrg	*)		MISC_MAN_SUFFIX=7  ;;
1208b3eb03f3Smrg    esac
1209b3eb03f3Smrgfi
1210b3eb03f3Smrgif test x$MISC_MAN_DIR = x    ; then
1211b3eb03f3Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1212b3eb03f3Smrgfi
1213010cdda0Smrg
1214b3eb03f3Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1215b3eb03f3Smrg    case $host_os in
1216b3eb03f3Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1217b3eb03f3Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1218b3eb03f3Smrg    esac
1219b3eb03f3Smrgfi
1220b3eb03f3Smrgif test x$DRIVER_MAN_DIR = x    ; then
1221b3eb03f3Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1222b3eb03f3Smrgfi
1223010cdda0Smrg
1224b3eb03f3Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1225b3eb03f3Smrg    case $host_os in
1226b3eb03f3Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1227b3eb03f3Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1228b3eb03f3Smrg    esac
1229b3eb03f3Smrgfi
1230b3eb03f3Smrgif test x$ADMIN_MAN_DIR = x    ; then
1231b3eb03f3Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1232b3eb03f3Smrgfi
1233010cdda0Smrg
1234010cdda0Smrg
1235b3eb03f3SmrgAC_SUBST([APP_MAN_SUFFIX])
1236b3eb03f3SmrgAC_SUBST([LIB_MAN_SUFFIX])
1237b3eb03f3SmrgAC_SUBST([FILE_MAN_SUFFIX])
1238b3eb03f3SmrgAC_SUBST([MISC_MAN_SUFFIX])
1239b3eb03f3SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1240b3eb03f3SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1241b3eb03f3SmrgAC_SUBST([APP_MAN_DIR])
1242b3eb03f3SmrgAC_SUBST([LIB_MAN_DIR])
1243b3eb03f3SmrgAC_SUBST([FILE_MAN_DIR])
1244b3eb03f3SmrgAC_SUBST([MISC_MAN_DIR])
1245b3eb03f3SmrgAC_SUBST([DRIVER_MAN_DIR])
1246b3eb03f3SmrgAC_SUBST([ADMIN_MAN_DIR])
1247af23b0a6Smrg
1248af23b0a6SmrgXORG_MAN_PAGE="X Version 11"
1249af23b0a6SmrgAC_SUBST([XORG_MAN_PAGE])
1250af23b0a6SmrgMAN_SUBSTS="\
1251af23b0a6Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1252af23b0a6Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1253af23b0a6Smrg	-e 's|__xservername__|Xorg|g' \
1254af23b0a6Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1255af23b0a6Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1256af23b0a6Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1257af23b0a6Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1258af23b0a6Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1259af23b0a6Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1260af23b0a6Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1261af23b0a6Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1262af23b0a6Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1263af23b0a6SmrgAC_SUBST([MAN_SUBSTS])
1264af23b0a6Smrg
1265b3eb03f3Smrg]) # XORG_MANPAGE_SECTIONS
1266b3eb03f3Smrg
1267af23b0a6Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1268af23b0a6Smrg# ------------------------
1269af23b0a6Smrg# Minimum version: 1.7.0
1270af23b0a6Smrg#
1271af23b0a6Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1272af23b0a6Smrg# provided by xorg-sgml-doctools, if installed.
1273af23b0a6SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1274af23b0a6SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1275af23b0a6SmrgXORG_SGML_PATH=
1276af23b0a6SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1277af23b0a6Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1278af23b0a6Smrg    [m4_ifval([$1],[:],
1279af23b0a6Smrg        [if test x"$cross_compiling" != x"yes" ; then
1280af23b0a6Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1281af23b0a6Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1282af23b0a6Smrg         fi])
1283af23b0a6Smrg    ])
1284af23b0a6Smrg
1285af23b0a6Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1286af23b0a6Smrg# the path and the name of the doc stylesheet
1287af23b0a6Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1288af23b0a6Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1289af23b0a6Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1290af23b0a6Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1291af23b0a6Smrgelse
1292af23b0a6Smrg   AC_MSG_RESULT([no])
1293af23b0a6Smrgfi
1294af23b0a6Smrg
1295af23b0a6SmrgAC_SUBST(XORG_SGML_PATH)
1296af23b0a6SmrgAC_SUBST(STYLESHEET_SRCDIR)
1297af23b0a6SmrgAC_SUBST(XSL_STYLESHEET)
1298af23b0a6SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1299af23b0a6Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1300af23b0a6Smrg
1301b3eb03f3Smrg# XORG_CHECK_LINUXDOC
1302b3eb03f3Smrg# -------------------
1303b3eb03f3Smrg# Minimum version: 1.0.0
1304b3eb03f3Smrg#
1305b3eb03f3Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1306b3eb03f3Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1307b3eb03f3Smrg# Whether or not the necessary tools and files are found can be checked
1308b3eb03f3Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1309b3eb03f3SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1310af23b0a6SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1311af23b0a6SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1312010cdda0Smrg
1313b3eb03f3SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1314010cdda0Smrg
1315af23b0a6SmrgAC_MSG_CHECKING([whether to build documentation])
1316010cdda0Smrg
1317af23b0a6Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1318b3eb03f3Smrg   BUILDDOC=yes
1319b3eb03f3Smrgelse
1320b3eb03f3Smrg   BUILDDOC=no
1321010cdda0Smrgfi
1322010cdda0Smrg
1323b3eb03f3SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1324010cdda0Smrg
1325b3eb03f3SmrgAC_MSG_RESULT([$BUILDDOC])
1326010cdda0Smrg
1327af23b0a6SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1328010cdda0Smrg
1329af23b0a6Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1330b3eb03f3Smrg   BUILDPDFDOC=yes
1331b3eb03f3Smrgelse
1332b3eb03f3Smrg   BUILDPDFDOC=no
1333b3eb03f3Smrgfi
1334010cdda0Smrg
1335b3eb03f3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1336010cdda0Smrg
1337b3eb03f3SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1338010cdda0Smrg
1339af23b0a6SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1340b3eb03f3SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1341b3eb03f3SmrgMAKE_PDF="$PS2PDF"
1342b3eb03f3SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1343010cdda0Smrg
1344b3eb03f3SmrgAC_SUBST(MAKE_TEXT)
1345b3eb03f3SmrgAC_SUBST(MAKE_PS)
1346b3eb03f3SmrgAC_SUBST(MAKE_PDF)
1347b3eb03f3SmrgAC_SUBST(MAKE_HTML)
1348b3eb03f3Smrg]) # XORG_CHECK_LINUXDOC
1349b3eb03f3Smrg
1350b3eb03f3Smrg# XORG_CHECK_DOCBOOK
1351b3eb03f3Smrg# -------------------
1352b3eb03f3Smrg# Minimum version: 1.0.0
1353b3eb03f3Smrg#
1354b3eb03f3Smrg# Checks for the ability to build output formats from SGML DocBook source.
1355b3eb03f3Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1356b3eb03f3Smrg# indicates whether the necessary tools and files are found and, if set,
1357b3eb03f3Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1358b3eb03f3SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1359af23b0a6SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1360af23b0a6Smrg
1361b3eb03f3SmrgBUILDTXTDOC=no
1362b3eb03f3SmrgBUILDPDFDOC=no
1363b3eb03f3SmrgBUILDPSDOC=no
1364b3eb03f3SmrgBUILDHTMLDOC=no
1365b3eb03f3Smrg
1366b3eb03f3SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1367b3eb03f3SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1368b3eb03f3SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1369b3eb03f3SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1370b3eb03f3Smrg
1371af23b0a6SmrgAC_MSG_CHECKING([whether to build text documentation])
1372af23b0a6Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1373b3eb03f3Smrg   test x$BUILD_TXTDOC != xno; then
1374b3eb03f3Smrg	BUILDTXTDOC=yes
1375b3eb03f3Smrgfi
1376b3eb03f3SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1377b3eb03f3SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1378010cdda0Smrg
1379af23b0a6SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1380af23b0a6Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1381b3eb03f3Smrg   test x$BUILD_PDFDOC != xno; then
1382b3eb03f3Smrg	BUILDPDFDOC=yes
1383b3eb03f3Smrgfi
1384b3eb03f3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1385b3eb03f3SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1386010cdda0Smrg
1387af23b0a6SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1388af23b0a6Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1389b3eb03f3Smrg   test x$BUILD_PSDOC != xno; then
1390b3eb03f3Smrg	BUILDPSDOC=yes
1391b3eb03f3Smrgfi
1392b3eb03f3SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1393b3eb03f3SmrgAC_MSG_RESULT([$BUILDPSDOC])
1394010cdda0Smrg
1395af23b0a6SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1396af23b0a6Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1397b3eb03f3Smrg   test x$BUILD_HTMLDOC != xno; then
1398b3eb03f3Smrg	BUILDHTMLDOC=yes
1399b3eb03f3Smrgfi
1400b3eb03f3SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1401b3eb03f3SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1402010cdda0Smrg
1403b3eb03f3SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1404b3eb03f3SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1405b3eb03f3SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1406b3eb03f3SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1407010cdda0Smrg
1408b3eb03f3SmrgAC_SUBST(MAKE_TEXT)
1409b3eb03f3SmrgAC_SUBST(MAKE_PS)
1410b3eb03f3SmrgAC_SUBST(MAKE_PDF)
1411b3eb03f3SmrgAC_SUBST(MAKE_HTML)
1412b3eb03f3Smrg]) # XORG_CHECK_DOCBOOK
1413010cdda0Smrg
1414af23b0a6Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1415af23b0a6Smrg# ----------------
1416af23b0a6Smrg# Minimum version: 1.5.0
1417af23b0a6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1418af23b0a6Smrg#
1419af23b0a6Smrg# Documentation tools are not always available on all platforms and sometimes
1420af23b0a6Smrg# not at the appropriate level. This macro enables a module to test for the
1421af23b0a6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1422af23b0a6Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1423af23b0a6Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1424af23b0a6Smrg# --with-xmlto assumes 'auto'.
1425af23b0a6Smrg#
1426af23b0a6Smrg# Interface to module:
1427af23b0a6Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1428af23b0a6Smrg# XMLTO:	returns the path of the xmlto program found
1429af23b0a6Smrg#		returns the path set by the user in the environment
1430af23b0a6Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1431af23b0a6Smrg#		'no' user instructs the module not to use xmlto
1432af23b0a6Smrg#
1433af23b0a6Smrg# Added in version 1.10.0
1434af23b0a6Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1435af23b0a6Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1436af23b0a6Smrg#
1437af23b0a6Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1438af23b0a6Smrg#
1439af23b0a6SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1440af23b0a6SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1441af23b0a6Smrgm4_define([_defopt], m4_default([$2], [auto]))
1442af23b0a6SmrgAC_ARG_WITH(xmlto,
1443af23b0a6Smrg	AS_HELP_STRING([--with-xmlto],
1444af23b0a6Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1445af23b0a6Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1446af23b0a6Smrgm4_undefine([_defopt])
1447af23b0a6Smrg
1448af23b0a6Smrgif test "x$use_xmlto" = x"auto"; then
1449af23b0a6Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1450af23b0a6Smrg   if test "x$XMLTO" = "x"; then
1451af23b0a6Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1452af23b0a6Smrg	have_xmlto=no
1453af23b0a6Smrg   else
1454af23b0a6Smrg        have_xmlto=yes
1455af23b0a6Smrg   fi
1456af23b0a6Smrgelif test "x$use_xmlto" = x"yes" ; then
1457af23b0a6Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1458af23b0a6Smrg   if test "x$XMLTO" = "x"; then
1459af23b0a6Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1460af23b0a6Smrg   fi
1461af23b0a6Smrg   have_xmlto=yes
1462af23b0a6Smrgelif test "x$use_xmlto" = x"no" ; then
1463af23b0a6Smrg   if test "x$XMLTO" != "x"; then
1464af23b0a6Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1465af23b0a6Smrg   fi
1466af23b0a6Smrg   have_xmlto=no
1467af23b0a6Smrgelse
1468af23b0a6Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1469af23b0a6Smrgfi
1470af23b0a6Smrg
1471af23b0a6Smrg# Test for a minimum version of xmlto, if provided.
1472af23b0a6Smrgm4_ifval([$1],
1473af23b0a6Smrg[if test "$have_xmlto" = yes; then
1474af23b0a6Smrg    # scrape the xmlto version
1475af23b0a6Smrg    AC_MSG_CHECKING([the xmlto version])
1476af23b0a6Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1477af23b0a6Smrg    AC_MSG_RESULT([$xmlto_version])
1478af23b0a6Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1479af23b0a6Smrg        [if test "x$use_xmlto" = xauto; then
1480af23b0a6Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1481af23b0a6Smrg            have_xmlto=no
1482af23b0a6Smrg        else
1483af23b0a6Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1484af23b0a6Smrg        fi])
1485af23b0a6Smrgfi])
1486af23b0a6Smrg
1487af23b0a6Smrg# Test for the ability of xmlto to generate a text target
1488af23b0a6Smrghave_xmlto_text=no
1489af23b0a6Smrgcat > conftest.xml << "EOF"
1490af23b0a6SmrgEOF
1491af23b0a6SmrgAS_IF([test "$have_xmlto" = yes],
1492af23b0a6Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1493af23b0a6Smrg             [have_xmlto_text=yes],
1494af23b0a6Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1495af23b0a6Smrgrm -f conftest.xml
1496af23b0a6SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1497af23b0a6SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1498af23b0a6Smrg]) # XORG_WITH_XMLTO
1499af23b0a6Smrg
1500af23b0a6Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1501af23b0a6Smrg# ----------------
1502af23b0a6Smrg# Minimum version: 1.5.0
1503af23b0a6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1504af23b0a6Smrg#
1505af23b0a6Smrg# Documentation tools are not always available on all platforms and sometimes
1506af23b0a6Smrg# not at the appropriate level. This macro enables a module to test for the
1507af23b0a6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1508af23b0a6Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1509af23b0a6Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1510af23b0a6Smrg# --with-asciidoc assumes 'auto'.
1511af23b0a6Smrg#
1512af23b0a6Smrg# Interface to module:
1513af23b0a6Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1514af23b0a6Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
1515af23b0a6Smrg#		 returns the path set by the user in the environment
1516af23b0a6Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1517af23b0a6Smrg#		  'no' user instructs the module not to use asciidoc
1518af23b0a6Smrg#
1519af23b0a6Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1520af23b0a6Smrg#
1521af23b0a6SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1522af23b0a6SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1523af23b0a6Smrgm4_define([_defopt], m4_default([$2], [auto]))
1524af23b0a6SmrgAC_ARG_WITH(asciidoc,
1525af23b0a6Smrg	AS_HELP_STRING([--with-asciidoc],
1526af23b0a6Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1527af23b0a6Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1528af23b0a6Smrgm4_undefine([_defopt])
1529af23b0a6Smrg
1530af23b0a6Smrgif test "x$use_asciidoc" = x"auto"; then
1531af23b0a6Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1532af23b0a6Smrg   if test "x$ASCIIDOC" = "x"; then
1533af23b0a6Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1534af23b0a6Smrg	have_asciidoc=no
1535af23b0a6Smrg   else
1536af23b0a6Smrg        have_asciidoc=yes
1537af23b0a6Smrg   fi
1538af23b0a6Smrgelif test "x$use_asciidoc" = x"yes" ; then
1539af23b0a6Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1540af23b0a6Smrg   if test "x$ASCIIDOC" = "x"; then
1541af23b0a6Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1542af23b0a6Smrg   fi
1543af23b0a6Smrg   have_asciidoc=yes
1544af23b0a6Smrgelif test "x$use_asciidoc" = x"no" ; then
1545af23b0a6Smrg   if test "x$ASCIIDOC" != "x"; then
1546af23b0a6Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1547af23b0a6Smrg   fi
1548af23b0a6Smrg   have_asciidoc=no
1549af23b0a6Smrgelse
1550af23b0a6Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1551af23b0a6Smrgfi
1552af23b0a6Smrgm4_ifval([$1],
1553af23b0a6Smrg[if test "$have_asciidoc" = yes; then
1554af23b0a6Smrg    # scrape the asciidoc version
1555af23b0a6Smrg    AC_MSG_CHECKING([the asciidoc version])
1556af23b0a6Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1557af23b0a6Smrg    AC_MSG_RESULT([$asciidoc_version])
1558af23b0a6Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1559af23b0a6Smrg        [if test "x$use_asciidoc" = xauto; then
1560af23b0a6Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1561af23b0a6Smrg            have_asciidoc=no
1562af23b0a6Smrg        else
1563af23b0a6Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1564af23b0a6Smrg        fi])
1565af23b0a6Smrgfi])
1566af23b0a6SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1567af23b0a6Smrg]) # XORG_WITH_ASCIIDOC
1568af23b0a6Smrg
1569af23b0a6Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1570af23b0a6Smrg# --------------------------------
1571af23b0a6Smrg# Minimum version: 1.5.0
1572af23b0a6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1573af23b0a6Smrg#
1574af23b0a6Smrg# Documentation tools are not always available on all platforms and sometimes
1575af23b0a6Smrg# not at the appropriate level. This macro enables a module to test for the
1576af23b0a6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1577af23b0a6Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1578af23b0a6Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1579af23b0a6Smrg# --with-doxygen assumes 'auto'.
1580af23b0a6Smrg#
1581af23b0a6Smrg# Interface to module:
1582af23b0a6Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1583af23b0a6Smrg# DOXYGEN:	 returns the path of the doxygen program found
1584af23b0a6Smrg#		 returns the path set by the user in the environment
1585af23b0a6Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1586af23b0a6Smrg#		  'no' user instructs the module not to use doxygen
1587af23b0a6Smrg#
1588af23b0a6Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1589af23b0a6Smrg#
1590af23b0a6SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1591af23b0a6SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1592af23b0a6Smrgm4_define([_defopt], m4_default([$2], [auto]))
1593af23b0a6SmrgAC_ARG_WITH(doxygen,
1594af23b0a6Smrg	AS_HELP_STRING([--with-doxygen],
1595af23b0a6Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1596af23b0a6Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1597af23b0a6Smrgm4_undefine([_defopt])
1598af23b0a6Smrg
1599af23b0a6Smrgif test "x$use_doxygen" = x"auto"; then
1600af23b0a6Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1601af23b0a6Smrg   if test "x$DOXYGEN" = "x"; then
1602af23b0a6Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1603af23b0a6Smrg	have_doxygen=no
1604af23b0a6Smrg   else
1605af23b0a6Smrg        have_doxygen=yes
1606af23b0a6Smrg   fi
1607af23b0a6Smrgelif test "x$use_doxygen" = x"yes" ; then
1608af23b0a6Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1609af23b0a6Smrg   if test "x$DOXYGEN" = "x"; then
1610af23b0a6Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1611af23b0a6Smrg   fi
1612af23b0a6Smrg   have_doxygen=yes
1613af23b0a6Smrgelif test "x$use_doxygen" = x"no" ; then
1614af23b0a6Smrg   if test "x$DOXYGEN" != "x"; then
1615af23b0a6Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1616af23b0a6Smrg   fi
1617af23b0a6Smrg   have_doxygen=no
1618af23b0a6Smrgelse
1619af23b0a6Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1620af23b0a6Smrgfi
1621af23b0a6Smrgm4_ifval([$1],
1622af23b0a6Smrg[if test "$have_doxygen" = yes; then
1623af23b0a6Smrg    # scrape the doxygen version
1624af23b0a6Smrg    AC_MSG_CHECKING([the doxygen version])
1625af23b0a6Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1626af23b0a6Smrg    AC_MSG_RESULT([$doxygen_version])
1627af23b0a6Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1628af23b0a6Smrg        [if test "x$use_doxygen" = xauto; then
1629af23b0a6Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1630af23b0a6Smrg            have_doxygen=no
1631af23b0a6Smrg        else
1632af23b0a6Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1633af23b0a6Smrg        fi])
1634af23b0a6Smrgfi])
1635af23b0a6SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
1636af23b0a6Smrg]) # XORG_WITH_DOXYGEN
1637af23b0a6Smrg
1638af23b0a6Smrg# XORG_WITH_GROFF([DEFAULT])
1639af23b0a6Smrg# ----------------
1640af23b0a6Smrg# Minimum version: 1.6.0
1641af23b0a6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1642af23b0a6Smrg#
1643af23b0a6Smrg# Documentation tools are not always available on all platforms and sometimes
1644af23b0a6Smrg# not at the appropriate level. This macro enables a module to test for the
1645af23b0a6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1646af23b0a6Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
1647af23b0a6Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
1648af23b0a6Smrg# --with-groff assumes 'auto'.
1649af23b0a6Smrg#
1650af23b0a6Smrg# Interface to module:
1651af23b0a6Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
1652af23b0a6Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
1653af23b0a6Smrg# HAVE_GROFF_MS: the -ms macros package
1654af23b0a6Smrg# GROFF:	 returns the path of the groff program found
1655af23b0a6Smrg#		 returns the path set by the user in the environment
1656af23b0a6Smrg# --with-groff:	 'yes' user instructs the module to use groff
1657af23b0a6Smrg#		 'no' user instructs the module not to use groff
1658af23b0a6Smrg#
1659af23b0a6Smrg# Added in version 1.9.0:
1660af23b0a6Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
1661af23b0a6Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
1662af23b0a6Smrg#		   psselect from the psutils package.
1663af23b0a6Smrg#		   the ghostcript package. Refer to the grohtml man pages
1664af23b0a6Smrg#
1665af23b0a6Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
1666af23b0a6Smrg#
1667af23b0a6Smrg# OS and distros often splits groff in a basic and full package, the former
1668af23b0a6Smrg# having the groff program and the later having devices, fonts and macros
1669af23b0a6Smrg# Checking for the groff executable is not enough.
1670af23b0a6Smrg#
1671af23b0a6Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
1672af23b0a6Smrg# unset HAVE_GROFF or GROFF env variables.
1673af23b0a6Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
1674af23b0a6Smrg#
1675af23b0a6SmrgAC_DEFUN([XORG_WITH_GROFF],[
1676af23b0a6SmrgAC_ARG_VAR([GROFF], [Path to groff command])
1677af23b0a6Smrgm4_define([_defopt], m4_default([$1], [auto]))
1678af23b0a6SmrgAC_ARG_WITH(groff,
1679af23b0a6Smrg	AS_HELP_STRING([--with-groff],
1680af23b0a6Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
1681af23b0a6Smrg	   [use_groff=$withval], [use_groff=]_defopt)
1682af23b0a6Smrgm4_undefine([_defopt])
1683af23b0a6Smrg
1684af23b0a6Smrgif test "x$use_groff" = x"auto"; then
1685af23b0a6Smrg   AC_PATH_PROG([GROFF], [groff])
1686af23b0a6Smrg   if test "x$GROFF" = "x"; then
1687af23b0a6Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
1688af23b0a6Smrg	have_groff=no
1689af23b0a6Smrg   else
1690af23b0a6Smrg        have_groff=yes
1691af23b0a6Smrg   fi
1692af23b0a6Smrgelif test "x$use_groff" = x"yes" ; then
1693af23b0a6Smrg   AC_PATH_PROG([GROFF], [groff])
1694af23b0a6Smrg   if test "x$GROFF" = "x"; then
1695af23b0a6Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
1696af23b0a6Smrg   fi
1697af23b0a6Smrg   have_groff=yes
1698af23b0a6Smrgelif test "x$use_groff" = x"no" ; then
1699af23b0a6Smrg   if test "x$GROFF" != "x"; then
1700af23b0a6Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
1701af23b0a6Smrg   fi
1702af23b0a6Smrg   have_groff=no
1703af23b0a6Smrgelse
1704af23b0a6Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1705af23b0a6Smrgfi
1706af23b0a6Smrg
1707af23b0a6Smrg# We have groff, test for the presence of the macro packages
1708af23b0a6Smrgif test "x$have_groff" = x"yes"; then
1709af23b0a6Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
1710af23b0a6Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
1711af23b0a6Smrg        groff_ms_works=yes
1712af23b0a6Smrg    else
1713af23b0a6Smrg        groff_ms_works=no
1714af23b0a6Smrg    fi
1715af23b0a6Smrg    AC_MSG_RESULT([$groff_ms_works])
1716af23b0a6Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
1717af23b0a6Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
1718af23b0a6Smrg        groff_mm_works=yes
1719af23b0a6Smrg    else
1720af23b0a6Smrg        groff_mm_works=no
1721af23b0a6Smrg    fi
1722af23b0a6Smrg    AC_MSG_RESULT([$groff_mm_works])
1723af23b0a6Smrgfi
1724af23b0a6Smrg
1725af23b0a6Smrg# We have groff, test for HTML dependencies, one command per package
1726af23b0a6Smrgif test "x$have_groff" = x"yes"; then
1727af23b0a6Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
1728af23b0a6Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
1729af23b0a6Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
1730af23b0a6Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
1731af23b0a6Smrg      have_groff_html=yes
1732af23b0a6Smrg   else
1733af23b0a6Smrg      have_groff_html=no
1734af23b0a6Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
1735af23b0a6Smrg   fi
1736af23b0a6Smrgfi
1737af23b0a6Smrg
1738af23b0a6Smrg# Set Automake conditionals for Makefiles
1739af23b0a6SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
1740af23b0a6SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
1741af23b0a6SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
1742af23b0a6SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
1743af23b0a6Smrg]) # XORG_WITH_GROFF
1744af23b0a6Smrg
1745af23b0a6Smrg# XORG_WITH_FOP([DEFAULT])
1746af23b0a6Smrg# ----------------
1747af23b0a6Smrg# Minimum version: 1.6.0
1748af23b0a6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1749af23b0a6Smrg#
1750af23b0a6Smrg# Documentation tools are not always available on all platforms and sometimes
1751af23b0a6Smrg# not at the appropriate level. This macro enables a module to test for the
1752af23b0a6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1753af23b0a6Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
1754af23b0a6Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
1755af23b0a6Smrg# --with-fop assumes 'auto'.
1756af23b0a6Smrg#
1757af23b0a6Smrg# Interface to module:
1758af23b0a6Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
1759af23b0a6Smrg# FOP:	 	returns the path of the fop program found
1760af23b0a6Smrg#		returns the path set by the user in the environment
1761af23b0a6Smrg# --with-fop: 	'yes' user instructs the module to use fop
1762af23b0a6Smrg#		'no' user instructs the module not to use fop
1763af23b0a6Smrg#
1764af23b0a6Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
1765af23b0a6Smrg#
1766af23b0a6SmrgAC_DEFUN([XORG_WITH_FOP],[
1767af23b0a6SmrgAC_ARG_VAR([FOP], [Path to fop command])
1768af23b0a6Smrgm4_define([_defopt], m4_default([$1], [auto]))
1769af23b0a6SmrgAC_ARG_WITH(fop,
1770af23b0a6Smrg	AS_HELP_STRING([--with-fop],
1771af23b0a6Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
1772af23b0a6Smrg	   [use_fop=$withval], [use_fop=]_defopt)
1773af23b0a6Smrgm4_undefine([_defopt])
1774af23b0a6Smrg
1775af23b0a6Smrgif test "x$use_fop" = x"auto"; then
1776af23b0a6Smrg   AC_PATH_PROG([FOP], [fop])
1777af23b0a6Smrg   if test "x$FOP" = "x"; then
1778af23b0a6Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
1779af23b0a6Smrg	have_fop=no
1780af23b0a6Smrg   else
1781af23b0a6Smrg        have_fop=yes
1782af23b0a6Smrg   fi
1783af23b0a6Smrgelif test "x$use_fop" = x"yes" ; then
1784af23b0a6Smrg   AC_PATH_PROG([FOP], [fop])
1785af23b0a6Smrg   if test "x$FOP" = "x"; then
1786af23b0a6Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
1787af23b0a6Smrg   fi
1788af23b0a6Smrg   have_fop=yes
1789af23b0a6Smrgelif test "x$use_fop" = x"no" ; then
1790af23b0a6Smrg   if test "x$FOP" != "x"; then
1791af23b0a6Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
1792af23b0a6Smrg   fi
1793af23b0a6Smrg   have_fop=no
1794af23b0a6Smrgelse
1795af23b0a6Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
1796af23b0a6Smrgfi
1797af23b0a6SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
1798af23b0a6Smrg]) # XORG_WITH_FOP
1799af23b0a6Smrg
1800af23b0a6Smrg# XORG_WITH_PS2PDF([DEFAULT])
1801af23b0a6Smrg# ----------------
1802af23b0a6Smrg# Minimum version: 1.6.0
1803af23b0a6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1804af23b0a6Smrg#
1805af23b0a6Smrg# Documentation tools are not always available on all platforms and sometimes
1806af23b0a6Smrg# not at the appropriate level. This macro enables a module to test for the
1807af23b0a6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1808af23b0a6Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
1809af23b0a6Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
1810af23b0a6Smrg# --with-ps2pdf assumes 'auto'.
1811af23b0a6Smrg#
1812af23b0a6Smrg# Interface to module:
1813af23b0a6Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
1814af23b0a6Smrg# PS2PDF:	returns the path of the ps2pdf program found
1815af23b0a6Smrg#		returns the path set by the user in the environment
1816af23b0a6Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
1817af23b0a6Smrg#		 'no' user instructs the module not to use ps2pdf
1818af23b0a6Smrg#
1819af23b0a6Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
1820af23b0a6Smrg#
1821af23b0a6SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
1822af23b0a6SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
1823af23b0a6Smrgm4_define([_defopt], m4_default([$1], [auto]))
1824af23b0a6SmrgAC_ARG_WITH(ps2pdf,
1825af23b0a6Smrg	AS_HELP_STRING([--with-ps2pdf],
1826af23b0a6Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
1827af23b0a6Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
1828af23b0a6Smrgm4_undefine([_defopt])
1829af23b0a6Smrg
1830af23b0a6Smrgif test "x$use_ps2pdf" = x"auto"; then
1831af23b0a6Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
1832af23b0a6Smrg   if test "x$PS2PDF" = "x"; then
1833af23b0a6Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
1834af23b0a6Smrg	have_ps2pdf=no
1835af23b0a6Smrg   else
1836af23b0a6Smrg        have_ps2pdf=yes
1837af23b0a6Smrg   fi
1838af23b0a6Smrgelif test "x$use_ps2pdf" = x"yes" ; then
1839af23b0a6Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
1840af23b0a6Smrg   if test "x$PS2PDF" = "x"; then
1841af23b0a6Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
1842af23b0a6Smrg   fi
1843af23b0a6Smrg   have_ps2pdf=yes
1844af23b0a6Smrgelif test "x$use_ps2pdf" = x"no" ; then
1845af23b0a6Smrg   if test "x$PS2PDF" != "x"; then
1846af23b0a6Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
1847af23b0a6Smrg   fi
1848af23b0a6Smrg   have_ps2pdf=no
1849af23b0a6Smrgelse
1850af23b0a6Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
1851af23b0a6Smrgfi
1852af23b0a6SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
1853af23b0a6Smrg]) # XORG_WITH_PS2PDF
1854af23b0a6Smrg
1855af23b0a6Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
1856af23b0a6Smrg# ----------------
1857af23b0a6Smrg# Minimum version: 1.6.0
1858af23b0a6Smrg#
1859af23b0a6Smrg# Documentation tools are not always available on all platforms and sometimes
1860af23b0a6Smrg# not at the appropriate level. This macro enables a builder to skip all
1861af23b0a6Smrg# documentation targets except traditional man pages.
1862af23b0a6Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1863af23b0a6Smrg# maximum flexibilty in controlling documentation building.
1864af23b0a6Smrg# Refer to:
1865af23b0a6Smrg# XORG_WITH_XMLTO         --with-xmlto
1866af23b0a6Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1867af23b0a6Smrg# XORG_WITH_DOXYGEN       --with-doxygen
1868af23b0a6Smrg# XORG_WITH_FOP           --with-fop
1869af23b0a6Smrg# XORG_WITH_GROFF         --with-groff
1870af23b0a6Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
1871af23b0a6Smrg#
1872af23b0a6Smrg# Interface to module:
1873af23b0a6Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
1874af23b0a6Smrg# --enable-docs: 'yes' user instructs the module to generate docs
1875af23b0a6Smrg#		 'no' user instructs the module not to generate docs
1876af23b0a6Smrg# parm1:	specify the default value, yes or no.
1877af23b0a6Smrg#
1878af23b0a6SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
1879af23b0a6Smrgm4_define([default], m4_default([$1], [yes]))
1880af23b0a6SmrgAC_ARG_ENABLE(docs,
1881af23b0a6Smrg	AS_HELP_STRING([--enable-docs],
1882af23b0a6Smrg	   [Enable building the documentation (default: ]default[)]),
1883af23b0a6Smrg	   [build_docs=$enableval], [build_docs=]default)
1884af23b0a6Smrgm4_undefine([default])
1885af23b0a6SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
1886af23b0a6SmrgAC_MSG_CHECKING([whether to build documentation])
1887af23b0a6SmrgAC_MSG_RESULT([$build_docs])
1888af23b0a6Smrg]) # XORG_ENABLE_DOCS
1889af23b0a6Smrg
1890af23b0a6Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
1891af23b0a6Smrg# ----------------
1892af23b0a6Smrg# Minimum version: 1.6.0
1893af23b0a6Smrg#
1894af23b0a6Smrg# This macro enables a builder to skip all developer documentation.
1895af23b0a6Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1896af23b0a6Smrg# maximum flexibilty in controlling documentation building.
1897af23b0a6Smrg# Refer to:
1898af23b0a6Smrg# XORG_WITH_XMLTO         --with-xmlto
1899af23b0a6Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1900af23b0a6Smrg# XORG_WITH_DOXYGEN       --with-doxygen
1901af23b0a6Smrg# XORG_WITH_FOP           --with-fop
1902af23b0a6Smrg# XORG_WITH_GROFF         --with-groff
1903af23b0a6Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
1904af23b0a6Smrg#
1905af23b0a6Smrg# Interface to module:
1906af23b0a6Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
1907af23b0a6Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
1908af23b0a6Smrg#			'no' user instructs the module not to generate developer docs
1909af23b0a6Smrg# parm1:		specify the default value, yes or no.
1910af23b0a6Smrg#
1911af23b0a6SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
1912af23b0a6Smrgm4_define([devel_default], m4_default([$1], [yes]))
1913af23b0a6SmrgAC_ARG_ENABLE(devel-docs,
1914af23b0a6Smrg	AS_HELP_STRING([--enable-devel-docs],
1915af23b0a6Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
1916af23b0a6Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
1917af23b0a6Smrgm4_undefine([devel_default])
1918af23b0a6SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
1919af23b0a6SmrgAC_MSG_CHECKING([whether to build developer documentation])
1920af23b0a6SmrgAC_MSG_RESULT([$build_devel_docs])
1921af23b0a6Smrg]) # XORG_ENABLE_DEVEL_DOCS
1922af23b0a6Smrg
1923af23b0a6Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
1924af23b0a6Smrg# ----------------
1925af23b0a6Smrg# Minimum version: 1.6.0
1926af23b0a6Smrg#
1927af23b0a6Smrg# This macro enables a builder to skip all functional specification targets.
1928af23b0a6Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1929af23b0a6Smrg# maximum flexibilty in controlling documentation building.
1930af23b0a6Smrg# Refer to:
1931af23b0a6Smrg# XORG_WITH_XMLTO         --with-xmlto
1932af23b0a6Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1933af23b0a6Smrg# XORG_WITH_DOXYGEN       --with-doxygen
1934af23b0a6Smrg# XORG_WITH_FOP           --with-fop
1935af23b0a6Smrg# XORG_WITH_GROFF         --with-groff
1936af23b0a6Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
1937af23b0a6Smrg#
1938af23b0a6Smrg# Interface to module:
1939af23b0a6Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
1940af23b0a6Smrg# --enable-specs:	'yes' user instructs the module to generate specs
1941af23b0a6Smrg#			'no' user instructs the module not to generate specs
1942af23b0a6Smrg# parm1:		specify the default value, yes or no.
1943af23b0a6Smrg#
1944af23b0a6SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
1945af23b0a6Smrgm4_define([spec_default], m4_default([$1], [yes]))
1946af23b0a6SmrgAC_ARG_ENABLE(specs,
1947af23b0a6Smrg	AS_HELP_STRING([--enable-specs],
1948af23b0a6Smrg	   [Enable building the specs (default: ]spec_default[)]),
1949af23b0a6Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
1950af23b0a6Smrgm4_undefine([spec_default])
1951af23b0a6SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
1952af23b0a6SmrgAC_MSG_CHECKING([whether to build functional specifications])
1953af23b0a6SmrgAC_MSG_RESULT([$build_specs])
1954af23b0a6Smrg]) # XORG_ENABLE_SPECS
1955af23b0a6Smrg
1956b3eb03f3Smrg# XORG_CHECK_MALLOC_ZERO
1957b3eb03f3Smrg# ----------------------
1958b3eb03f3Smrg# Minimum version: 1.0.0
1959b3eb03f3Smrg#
1960b3eb03f3Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
1961b3eb03f3Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
1962b3eb03f3Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
1963b3eb03f3SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
1964b3eb03f3SmrgAC_ARG_ENABLE(malloc0returnsnull,
1965b3eb03f3Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
1966b3eb03f3Smrg		       [malloc(0) returns NULL (default: auto)]),
1967b3eb03f3Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
1968b3eb03f3Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
1969b3eb03f3Smrg
1970b3eb03f3SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
1971b3eb03f3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
1972b3eb03f3Smrg	AC_RUN_IFELSE([
1973b3eb03f3Smrgchar *malloc();
1974b3eb03f3Smrgchar *realloc();
1975b3eb03f3Smrgchar *calloc();
1976b3eb03f3Smrgmain() {
1977b3eb03f3Smrg    char *m0, *r0, *c0, *p;
1978b3eb03f3Smrg    m0 = malloc(0);
1979b3eb03f3Smrg    p = malloc(10);
1980b3eb03f3Smrg    r0 = realloc(p,0);
1981b3eb03f3Smrg    c0 = calloc(0);
1982b3eb03f3Smrg    exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1);
1983b3eb03f3Smrg}],
1984b3eb03f3Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
1985af23b0a6Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
1986af23b0a6Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
1987b3eb03f3Smrgfi
1988b3eb03f3SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
1989010cdda0Smrg
1990b3eb03f3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
1991b3eb03f3Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
1992b3eb03f3Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
1993b3eb03f3Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
1994b3eb03f3Smrgelse
1995b3eb03f3Smrg	MALLOC_ZERO_CFLAGS=""
1996b3eb03f3Smrg	XMALLOC_ZERO_CFLAGS=""
1997b3eb03f3Smrg	XTMALLOC_ZERO_CFLAGS=""
1998b3eb03f3Smrgfi
1999010cdda0Smrg
2000b3eb03f3SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2001b3eb03f3SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2002b3eb03f3SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2003b3eb03f3Smrg]) # XORG_CHECK_MALLOC_ZERO
2004010cdda0Smrg
2005b3eb03f3Smrg# XORG_WITH_LINT()
2006b3eb03f3Smrg# ----------------
2007b3eb03f3Smrg# Minimum version: 1.1.0
2008b3eb03f3Smrg#
2009af23b0a6Smrg# This macro enables the use of a tool that flags some suspicious and
2010af23b0a6Smrg# non-portable constructs (likely to be bugs) in C language source code.
2011af23b0a6Smrg# It will attempt to locate the tool and use appropriate options.
2012af23b0a6Smrg# There are various lint type tools on different platforms.
2013af23b0a6Smrg#
2014af23b0a6Smrg# Interface to module:
2015af23b0a6Smrg# LINT:		returns the path to the tool found on the platform
2016af23b0a6Smrg#		or the value set to LINT on the configure cmd line
2017af23b0a6Smrg#		also an Automake conditional
2018af23b0a6Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
2019af23b0a6Smrg#
2020af23b0a6Smrg# --with-lint:	'yes' user instructs the module to use lint
2021af23b0a6Smrg#		'no' user instructs the module not to use lint (default)
2022af23b0a6Smrg#
2023af23b0a6Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2024af23b0a6Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2025b3eb03f3Smrg#
2026b3eb03f3SmrgAC_DEFUN([XORG_WITH_LINT],[
2027b3eb03f3Smrg
2028af23b0a6SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2029af23b0a6SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2030b3eb03f3SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2031b3eb03f3Smrg		[Use a lint-style source code checker (default: disabled)])],
2032b3eb03f3Smrg		[use_lint=$withval], [use_lint=no])
2033af23b0a6Smrg
2034af23b0a6Smrg# Obtain platform specific info like program name and options
2035af23b0a6Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2036af23b0a6Smrgcase $host_os in
2037af23b0a6Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2038af23b0a6Smrg	lint_name=splint
2039af23b0a6Smrg	lint_options="-badflag"
2040af23b0a6Smrg	;;
2041af23b0a6Smrg  *freebsd* | *netbsd*)
2042af23b0a6Smrg	lint_name=lint
2043af23b0a6Smrg	lint_options="-u -b"
2044af23b0a6Smrg	;;
2045af23b0a6Smrg  *solaris*)
2046af23b0a6Smrg	lint_name=lint
2047af23b0a6Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2048af23b0a6Smrg	;;
2049af23b0a6Smrgesac
2050af23b0a6Smrg
2051af23b0a6Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2052af23b0a6Smrgif test "x$use_lint" = x"yes" ; then
2053af23b0a6Smrg   AC_PATH_PROG([LINT], [$lint_name])
2054af23b0a6Smrg   if test "x$LINT" = "x"; then
2055af23b0a6Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2056af23b0a6Smrg   fi
2057af23b0a6Smrgelif test "x$use_lint" = x"no" ; then
2058af23b0a6Smrg   if test "x$LINT" != "x"; then
2059af23b0a6Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2060af23b0a6Smrg   fi
2061b3eb03f3Smrgelse
2062af23b0a6Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2063b3eb03f3Smrgfi
2064af23b0a6Smrg
2065af23b0a6Smrg# User supplied flags override default flags
2066af23b0a6Smrgif test "x$LINT_FLAGS" != "x"; then
2067af23b0a6Smrg   lint_options=$LINT_FLAGS
2068b3eb03f3Smrgfi
2069010cdda0Smrg
2070af23b0a6SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2071af23b0a6SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2072010cdda0Smrg
2073b3eb03f3Smrg]) # XORG_WITH_LINT
2074010cdda0Smrg
2075b3eb03f3Smrg# XORG_LINT_LIBRARY(LIBNAME)
2076b3eb03f3Smrg# --------------------------
2077b3eb03f3Smrg# Minimum version: 1.1.0
2078b3eb03f3Smrg#
2079b3eb03f3Smrg# Sets up flags for building lint libraries for checking programs that call
2080b3eb03f3Smrg# functions in the library.
2081b3eb03f3Smrg#
2082af23b0a6Smrg# Interface to module:
2083af23b0a6Smrg# LINTLIB		- Automake variable with the name of lint library file to make
2084af23b0a6Smrg# MAKE_LINT_LIB		- Automake conditional
2085af23b0a6Smrg#
2086af23b0a6Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2087af23b0a6Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2088010cdda0Smrg
2089b3eb03f3SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2090b3eb03f3SmrgAC_REQUIRE([XORG_WITH_LINT])
2091b3eb03f3SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2092b3eb03f3Smrg	[Create lint library (default: disabled)])],
2093b3eb03f3Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2094af23b0a6Smrg
2095af23b0a6Smrgif test "x$make_lint_lib" = x"yes" ; then
2096af23b0a6Smrg   LINTLIB=llib-l$1.ln
2097af23b0a6Smrg   if test "x$LINT" = "x"; then
2098af23b0a6Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2099af23b0a6Smrg   fi
2100af23b0a6Smrgelif test "x$make_lint_lib" != x"no" ; then
2101af23b0a6Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2102b3eb03f3Smrgfi
2103af23b0a6Smrg
2104b3eb03f3SmrgAC_SUBST(LINTLIB)
2105b3eb03f3SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2106010cdda0Smrg
2107b3eb03f3Smrg]) # XORG_LINT_LIBRARY
2108010cdda0Smrg
2109b3eb03f3Smrg# XORG_CWARNFLAGS
2110b3eb03f3Smrg# ---------------
2111b3eb03f3Smrg# Minimum version: 1.2.0
2112b3eb03f3Smrg#
2113b3eb03f3Smrg# Defines CWARNFLAGS to enable C compiler warnings.
2114b3eb03f3Smrg#
2115b3eb03f3SmrgAC_DEFUN([XORG_CWARNFLAGS], [
2116af23b0a6SmrgAC_REQUIRE([AC_PROG_CC_C99])
2117b3eb03f3Smrgif  test "x$GCC" = xyes ; then
2118b3eb03f3Smrg    CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
2119b3eb03f3Smrg-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
2120af23b0a6Smrg-Wbad-function-cast -Wformat=2"
2121b3eb03f3Smrg    case `$CC -dumpversion` in
2122b3eb03f3Smrg    3.4.* | 4.*)
2123b3eb03f3Smrg	CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
2124b3eb03f3Smrg	;;
2125b3eb03f3Smrg    esac
2126b3eb03f3Smrgelse
2127b3eb03f3Smrg    AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2128b3eb03f3Smrg    if test "x$SUNCC" = "xyes"; then
2129b3eb03f3Smrg	CWARNFLAGS="-v"
2130b3eb03f3Smrg    fi
2131b3eb03f3Smrgfi
2132b3eb03f3SmrgAC_SUBST(CWARNFLAGS)
2133b3eb03f3Smrg]) # XORG_CWARNFLAGS
2134010cdda0Smrg
2135b3eb03f3Smrg# XORG_STRICT_OPTION
2136b3eb03f3Smrg# -----------------------
2137b3eb03f3Smrg# Minimum version: 1.3.0
2138b3eb03f3Smrg#
2139b3eb03f3Smrg# Add configure option to enable strict compilation
2140b3eb03f3SmrgAC_DEFUN([XORG_STRICT_OPTION], [
2141af23b0a6Smrg# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
2142b3eb03f3SmrgAC_REQUIRE([AC_PROG_CC_C99])
2143b3eb03f3SmrgAC_REQUIRE([XORG_CWARNFLAGS])
2144b3eb03f3Smrg
2145b3eb03f3SmrgAC_ARG_ENABLE(strict-compilation,
2146b3eb03f3Smrg			  AS_HELP_STRING([--enable-strict-compilation],
2147b3eb03f3Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2148b3eb03f3Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2149b3eb03f3Smrgif test "x$STRICT_COMPILE" = "xyes"; then
2150b3eb03f3Smrg	AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2151b3eb03f3Smrg	AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2152b3eb03f3Smrg	if test "x$GCC" = xyes ; then
2153b3eb03f3Smrg		STRICT_CFLAGS="-pedantic -Werror"
2154b3eb03f3Smrg	elif test "x$SUNCC" = "xyes"; then
2155b3eb03f3Smrg		STRICT_CFLAGS="-errwarn"
2156b3eb03f3Smrg    elif test "x$INTELCC" = "xyes"; then
2157b3eb03f3Smrg		STRICT_CFLAGS="-Werror"
2158b3eb03f3Smrg	fi
2159b3eb03f3Smrgfi
2160b3eb03f3SmrgCWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
2161b3eb03f3SmrgAC_SUBST([CWARNFLAGS])
2162b3eb03f3Smrg]) # XORG_STRICT_OPTION
2163010cdda0Smrg
2164b3eb03f3Smrg# XORG_DEFAULT_OPTIONS
2165b3eb03f3Smrg# --------------------
2166b3eb03f3Smrg# Minimum version: 1.3.0
2167b3eb03f3Smrg#
2168b3eb03f3Smrg# Defines default options for X.Org modules.
2169b3eb03f3Smrg#
2170b3eb03f3SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
2171af23b0a6SmrgAC_REQUIRE([AC_PROG_INSTALL])
2172b3eb03f3SmrgXORG_CWARNFLAGS
2173b3eb03f3SmrgXORG_STRICT_OPTION
2174b3eb03f3SmrgXORG_RELEASE_VERSION
2175b3eb03f3SmrgXORG_CHANGELOG
2176af23b0a6SmrgXORG_INSTALL
2177b3eb03f3SmrgXORG_MANPAGE_SECTIONS
2178af23b0a6Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
2179af23b0a6Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
2180b3eb03f3Smrg]) # XORG_DEFAULT_OPTIONS
2181af23b0a6Smrg
2182af23b0a6Smrg# XORG_INSTALL()
2183af23b0a6Smrg# ----------------
2184af23b0a6Smrg# Minimum version: 1.4.0
2185af23b0a6Smrg#
2186af23b0a6Smrg# Defines the variable INSTALL_CMD as the command to copy
2187af23b0a6Smrg# INSTALL from $prefix/share/util-macros.
2188af23b0a6Smrg#
2189af23b0a6SmrgAC_DEFUN([XORG_INSTALL], [
2190af23b0a6SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2191af23b0a6Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
2192af23b0a6SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
2193af23b0a6Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
2194af23b0a6Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
2195af23b0a6Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
2196af23b0a6SmrgAC_SUBST([INSTALL_CMD])
2197af23b0a6Smrg]) # XORG_INSTALL
2198010cdda0Smrgdnl Copyright 2005 Red Hat, Inc
2199b3eb03f3Smrgdnl
2200010cdda0Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
2201010cdda0Smrgdnl documentation for any purpose is hereby granted without fee, provided that
2202010cdda0Smrgdnl the above copyright notice appear in all copies and that both that
2203010cdda0Smrgdnl copyright notice and this permission notice appear in supporting
2204010cdda0Smrgdnl documentation.
2205b3eb03f3Smrgdnl
2206010cdda0Smrgdnl The above copyright notice and this permission notice shall be included
2207010cdda0Smrgdnl in all copies or substantial portions of the Software.
2208b3eb03f3Smrgdnl
2209010cdda0Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2210010cdda0Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2211010cdda0Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2212010cdda0Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2213010cdda0Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2214010cdda0Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2215010cdda0Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
2216b3eb03f3Smrgdnl
2217010cdda0Smrgdnl Except as contained in this notice, the name of the copyright holders shall
2218010cdda0Smrgdnl not be used in advertising or otherwise to promote the sale, use or
2219010cdda0Smrgdnl other dealings in this Software without prior written authorization
2220010cdda0Smrgdnl from the copyright holders.
2221b3eb03f3Smrgdnl
2222010cdda0Smrg
2223b3eb03f3Smrg# XORG_RELEASE_VERSION
2224b3eb03f3Smrg# --------------------
2225af23b0a6Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
2226b3eb03f3Smrg 
2227b3eb03f3SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
2228b3eb03f3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
2229b3eb03f3Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
2230b3eb03f3Smrg		[Major version of this package])
2231b3eb03f3Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
2232b3eb03f3Smrg	if test "x$PVM" = "x"; then
2233b3eb03f3Smrg		PVM="0"
2234010cdda0Smrg	fi
2235b3eb03f3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
2236b3eb03f3Smrg		[$PVM],
2237b3eb03f3Smrg		[Minor version of this package])
2238b3eb03f3Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
2239b3eb03f3Smrg	if test "x$PVP" = "x"; then
2240b3eb03f3Smrg		PVP="0"
2241010cdda0Smrg	fi
2242b3eb03f3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
2243b3eb03f3Smrg		[$PVP],
2244b3eb03f3Smrg		[Patch version of this package])
2245010cdda0Smrg])
2246010cdda0Smrg
2247b3eb03f3Smrg# XORG_CHANGELOG()
2248b3eb03f3Smrg# ----------------
2249b3eb03f3Smrg# Minimum version: 1.2.0
2250b3eb03f3Smrg#
2251b3eb03f3Smrg# Defines the variable CHANGELOG_CMD as the command to generate
2252b3eb03f3Smrg# ChangeLog from git.
2253b3eb03f3Smrg#
2254b3eb03f3Smrg#
2255b3eb03f3SmrgAC_DEFUN([XORG_CHANGELOG], [
2256af23b0a6SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
2257af23b0a6Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
2258af23b0a6Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
2259b3eb03f3Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
2260b3eb03f3SmrgAC_SUBST([CHANGELOG_CMD])
2261b3eb03f3Smrg]) # XORG_CHANGELOG
2262b3eb03f3Smrg
2263010cdda0Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
2264010cdda0Smrg# 
2265010cdda0Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
2266010cdda0Smrg#
2267010cdda0Smrg# This program is free software; you can redistribute it and/or modify
2268010cdda0Smrg# it under the terms of the GNU General Public License as published by
2269010cdda0Smrg# the Free Software Foundation; either version 2 of the License, or
2270010cdda0Smrg# (at your option) any later version.
2271010cdda0Smrg#
2272010cdda0Smrg# This program is distributed in the hope that it will be useful, but
2273010cdda0Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
2274010cdda0Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2275010cdda0Smrg# General Public License for more details.
2276010cdda0Smrg#
2277010cdda0Smrg# You should have received a copy of the GNU General Public License
2278010cdda0Smrg# along with this program; if not, write to the Free Software
2279010cdda0Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2280010cdda0Smrg#
2281010cdda0Smrg# As a special exception to the GNU General Public License, if you
2282010cdda0Smrg# distribute this file as part of a program that contains a
2283010cdda0Smrg# configuration script generated by Autoconf, you may include it under
2284010cdda0Smrg# the same distribution terms that you use for the rest of that program.
2285010cdda0Smrg
2286010cdda0Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
2287010cdda0Smrg# ----------------------------------
2288010cdda0SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
2289010cdda0Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
2290010cdda0Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
2291010cdda0SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
2292010cdda0Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
2293010cdda0Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
2294010cdda0Smrgfi
2295010cdda0Smrgif test -n "$PKG_CONFIG"; then
2296010cdda0Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
2297010cdda0Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
2298010cdda0Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
2299010cdda0Smrg		AC_MSG_RESULT([yes])
2300010cdda0Smrg	else
2301010cdda0Smrg		AC_MSG_RESULT([no])
2302010cdda0Smrg		PKG_CONFIG=""
2303010cdda0Smrg	fi
2304010cdda0Smrg		
2305010cdda0Smrgfi[]dnl
2306010cdda0Smrg])# PKG_PROG_PKG_CONFIG
2307010cdda0Smrg
2308010cdda0Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2309010cdda0Smrg#
2310010cdda0Smrg# Check to see whether a particular set of modules exists.  Similar
2311010cdda0Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
2312010cdda0Smrg#
2313010cdda0Smrg#
2314010cdda0Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
2315010cdda0Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
2316010cdda0Smrg# PKG_CHECK_EXISTS manually
2317010cdda0Smrg# --------------------------------------------------------------
2318010cdda0SmrgAC_DEFUN([PKG_CHECK_EXISTS],
2319010cdda0Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2320010cdda0Smrgif test -n "$PKG_CONFIG" && \
2321010cdda0Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
2322010cdda0Smrg  m4_ifval([$2], [$2], [:])
2323010cdda0Smrgm4_ifvaln([$3], [else
2324010cdda0Smrg  $3])dnl
2325010cdda0Smrgfi])
2326010cdda0Smrg
2327010cdda0Smrg
2328010cdda0Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
2329010cdda0Smrg# ---------------------------------------------
2330010cdda0Smrgm4_define([_PKG_CONFIG],
2331b3eb03f3Smrg[if test -n "$$1"; then
2332b3eb03f3Smrg    pkg_cv_[]$1="$$1"
2333b3eb03f3Smrg elif test -n "$PKG_CONFIG"; then
2334b3eb03f3Smrg    PKG_CHECK_EXISTS([$3],
2335b3eb03f3Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
2336b3eb03f3Smrg		     [pkg_failed=yes])
2337b3eb03f3Smrg else
2338b3eb03f3Smrg    pkg_failed=untried
2339010cdda0Smrgfi[]dnl
2340010cdda0Smrg])# _PKG_CONFIG
2341010cdda0Smrg
2342010cdda0Smrg# _PKG_SHORT_ERRORS_SUPPORTED
2343010cdda0Smrg# -----------------------------
2344010cdda0SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
2345010cdda0Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2346010cdda0Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
2347010cdda0Smrg        _pkg_short_errors_supported=yes
2348010cdda0Smrgelse
2349010cdda0Smrg        _pkg_short_errors_supported=no
2350010cdda0Smrgfi[]dnl
2351010cdda0Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
2352010cdda0Smrg
2353010cdda0Smrg
2354010cdda0Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2355010cdda0Smrg# [ACTION-IF-NOT-FOUND])
2356010cdda0Smrg#
2357010cdda0Smrg#
2358010cdda0Smrg# Note that if there is a possibility the first call to
2359010cdda0Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
2360010cdda0Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
2361010cdda0Smrg#
2362010cdda0Smrg#
2363010cdda0Smrg# --------------------------------------------------------------
2364010cdda0SmrgAC_DEFUN([PKG_CHECK_MODULES],
2365010cdda0Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2366010cdda0SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
2367010cdda0SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
2368010cdda0Smrg
2369010cdda0Smrgpkg_failed=no
2370010cdda0SmrgAC_MSG_CHECKING([for $1])
2371010cdda0Smrg
2372010cdda0Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
2373010cdda0Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
2374010cdda0Smrg
2375010cdda0Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
2376010cdda0Smrgand $1[]_LIBS to avoid the need to call pkg-config.
2377010cdda0SmrgSee the pkg-config man page for more details.])
2378010cdda0Smrg
2379010cdda0Smrgif test $pkg_failed = yes; then
2380010cdda0Smrg        _PKG_SHORT_ERRORS_SUPPORTED
2381010cdda0Smrg        if test $_pkg_short_errors_supported = yes; then
2382b3eb03f3Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
2383010cdda0Smrg        else 
2384b3eb03f3Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
2385010cdda0Smrg        fi
2386010cdda0Smrg	# Put the nasty error message in config.log where it belongs
2387010cdda0Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
2388010cdda0Smrg
2389010cdda0Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
2390010cdda0Smrg[Package requirements ($2) were not met:
2391010cdda0Smrg
2392010cdda0Smrg$$1_PKG_ERRORS
2393010cdda0Smrg
2394010cdda0SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
2395010cdda0Smrginstalled software in a non-standard prefix.
2396010cdda0Smrg
2397010cdda0Smrg_PKG_TEXT
2398010cdda0Smrg])],
2399b3eb03f3Smrg		[AC_MSG_RESULT([no])
2400b3eb03f3Smrg                $4])
2401010cdda0Smrgelif test $pkg_failed = untried; then
2402010cdda0Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
2403010cdda0Smrg[The pkg-config script could not be found or is too old.  Make sure it
2404010cdda0Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
2405010cdda0Smrgpath to pkg-config.
2406010cdda0Smrg
2407010cdda0Smrg_PKG_TEXT
2408010cdda0Smrg
2409b3eb03f3SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
2410010cdda0Smrg		[$4])
2411010cdda0Smrgelse
2412010cdda0Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2413010cdda0Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2414010cdda0Smrg        AC_MSG_RESULT([yes])
2415010cdda0Smrg	ifelse([$3], , :, [$3])
2416010cdda0Smrgfi[]dnl
2417010cdda0Smrg])# PKG_CHECK_MODULES
2418010cdda0Smrg
2419