aclocal.m4 revision b4485a66
1b4485a66Smrg# generated automatically by aclocal 1.11.2 -*- Autoconf -*-
2010cdda0Smrg
3b3eb03f3Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4b4485a66Smrg# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
5b4485a66Smrg# Inc.
6010cdda0Smrg# This file is free software; the Free Software Foundation
7010cdda0Smrg# gives unlimited permission to copy and/or distribute it,
8010cdda0Smrg# with or without modifications, as long as this notice is preserved.
9010cdda0Smrg
10010cdda0Smrg# This program is distributed in the hope that it will be useful,
11010cdda0Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
12010cdda0Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13010cdda0Smrg# PARTICULAR PURPOSE.
14010cdda0Smrg
15b3eb03f3Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16b3eb03f3Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17af23b0a6Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
18af23b0a6Smrg[m4_warning([this file was generated for autoconf 2.68.
19b3eb03f3SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20b3eb03f3SmrgIf you have problems, you may need to regenerate the build system entirely.
21b3eb03f3SmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
22010cdda0Smrg
23b4485a66Smrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
24b4485a66Smrg# Foundation, Inc.
25b3eb03f3Smrg#
26b3eb03f3Smrg# This file is free software; the Free Software Foundation
27b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
28b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
29010cdda0Smrg
30b4485a66Smrg# serial 1
31b4485a66Smrg
32010cdda0Smrg# AM_AUTOMAKE_VERSION(VERSION)
33010cdda0Smrg# ----------------------------
34010cdda0Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
35010cdda0Smrg# generated from the m4 files accompanying Automake X.Y.
36b3eb03f3Smrg# (This private macro should not be called outside this file.)
37b3eb03f3SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
38b3eb03f3Smrg[am__api_version='1.11'
39b3eb03f3Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
40b3eb03f3Smrgdnl require some minimum version.  Point them to the right macro.
41b4485a66Smrgm4_if([$1], [1.11.2], [],
42b3eb03f3Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
43b3eb03f3Smrg])
44b3eb03f3Smrg
45b3eb03f3Smrg# _AM_AUTOCONF_VERSION(VERSION)
46b3eb03f3Smrg# -----------------------------
47b3eb03f3Smrg# aclocal traces this macro to find the Autoconf version.
48b3eb03f3Smrg# This is a private macro too.  Using m4_define simplifies
49b3eb03f3Smrg# the logic in aclocal, which can simply ignore this definition.
50b3eb03f3Smrgm4_define([_AM_AUTOCONF_VERSION], [])
51010cdda0Smrg
52010cdda0Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
53010cdda0Smrg# -------------------------------
54b3eb03f3Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
55b3eb03f3Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
56010cdda0SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
57b4485a66Smrg[AM_AUTOMAKE_VERSION([1.11.2])dnl
58b3eb03f3Smrgm4_ifndef([AC_AUTOCONF_VERSION],
59b3eb03f3Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
60b3eb03f3Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
61010cdda0Smrg
62b3eb03f3Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
63010cdda0Smrg
64b4485a66Smrg# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
65010cdda0Smrg#
66b3eb03f3Smrg# This file is free software; the Free Software Foundation
67b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
68b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
69010cdda0Smrg
70b4485a66Smrg# serial 1
71b4485a66Smrg
72010cdda0Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
73010cdda0Smrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
74010cdda0Smrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
75010cdda0Smrg#
76010cdda0Smrg# Of course, Automake must honor this variable whenever it calls a
77010cdda0Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
78010cdda0Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
79010cdda0Smrg# depending on how configure is run.  This is pretty annoying, since
80010cdda0Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
81010cdda0Smrg# source directory, any form will work fine, but in subdirectories a
82010cdda0Smrg# relative path needs to be adjusted first.
83010cdda0Smrg#
84010cdda0Smrg# $ac_aux_dir/missing
85010cdda0Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
86010cdda0Smrg# $top_srcdir/$ac_aux_dir/missing
87010cdda0Smrg#    fails if $ac_aux_dir is absolute,
88010cdda0Smrg#    fails when called from a subdirectory in a VPATH build with
89010cdda0Smrg#          a relative $ac_aux_dir
90010cdda0Smrg#
91010cdda0Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
92010cdda0Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
93010cdda0Smrg# harmless because $srcdir is `.', but things will broke when you
94010cdda0Smrg# start a VPATH build or use an absolute $srcdir.
95010cdda0Smrg#
96010cdda0Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
97010cdda0Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
98010cdda0Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
99010cdda0Smrg# and then we would define $MISSING as
100010cdda0Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
101010cdda0Smrg# This will work as long as MISSING is not called from configure, because
102010cdda0Smrg# unfortunately $(top_srcdir) has no meaning in configure.
103010cdda0Smrg# However there are other variables, like CC, which are often used in
104010cdda0Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
105010cdda0Smrg#
106010cdda0Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
107010cdda0Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
108010cdda0Smrg# configured tree to be moved without reconfiguration.
109010cdda0Smrg
110b3eb03f3SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
111b3eb03f3Smrg[dnl Rely on autoconf to set up CDPATH properly.
112b3eb03f3SmrgAC_PREREQ([2.50])dnl
113010cdda0Smrg# expand $ac_aux_dir to an absolute path
114010cdda0Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
115010cdda0Smrg])
116010cdda0Smrg
117b3eb03f3Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
118010cdda0Smrg
119b3eb03f3Smrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
120b3eb03f3Smrg# Free Software Foundation, Inc.
121b3eb03f3Smrg#
122b3eb03f3Smrg# This file is free software; the Free Software Foundation
123b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
124b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
125010cdda0Smrg
126b3eb03f3Smrg# serial 9
127010cdda0Smrg
128b3eb03f3Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
129b3eb03f3Smrg# -------------------------------------
130b3eb03f3Smrg# Define a conditional.
131b3eb03f3SmrgAC_DEFUN([AM_CONDITIONAL],
132b3eb03f3Smrg[AC_PREREQ(2.52)dnl
133b3eb03f3Smrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
134b3eb03f3Smrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
135b3eb03f3SmrgAC_SUBST([$1_TRUE])dnl
136b3eb03f3SmrgAC_SUBST([$1_FALSE])dnl
137b3eb03f3Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
138b3eb03f3Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
139b3eb03f3Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
140b3eb03f3Smrgif $2; then
141b3eb03f3Smrg  $1_TRUE=
142b3eb03f3Smrg  $1_FALSE='#'
143010cdda0Smrgelse
144b3eb03f3Smrg  $1_TRUE='#'
145b3eb03f3Smrg  $1_FALSE=
146010cdda0Smrgfi
147b3eb03f3SmrgAC_CONFIG_COMMANDS_PRE(
148b3eb03f3Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
149b3eb03f3Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
150b3eb03f3SmrgUsually this means the macro was only invoked conditionally.]])
151b3eb03f3Smrgfi])])
152010cdda0Smrg
153b4485a66Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
154b4485a66Smrg# 2010, 2011 Free Software Foundation, Inc.
155b3eb03f3Smrg#
156b3eb03f3Smrg# This file is free software; the Free Software Foundation
157b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
158b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
159010cdda0Smrg
160b4485a66Smrg# serial 12
161010cdda0Smrg
162010cdda0Smrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
163010cdda0Smrg# written in clear, in which case automake, when reading aclocal.m4,
164010cdda0Smrg# will think it sees a *use*, and therefore will trigger all it's
165010cdda0Smrg# C support machinery.  Also note that it means that autoscan, seeing
166010cdda0Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
167010cdda0Smrg
168010cdda0Smrg
169010cdda0Smrg# _AM_DEPENDENCIES(NAME)
170010cdda0Smrg# ----------------------
171010cdda0Smrg# See how the compiler implements dependency checking.
172010cdda0Smrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
173010cdda0Smrg# We try a few techniques and use that to set a single cache variable.
174010cdda0Smrg#
175010cdda0Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
176010cdda0Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
177010cdda0Smrg# dependency, and given that the user is not expected to run this macro,
178010cdda0Smrg# just rely on AC_PROG_CC.
179010cdda0SmrgAC_DEFUN([_AM_DEPENDENCIES],
180010cdda0Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
181010cdda0SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
182010cdda0SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
183010cdda0SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
184010cdda0Smrg
185010cdda0Smrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
186010cdda0Smrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
187010cdda0Smrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
188b3eb03f3Smrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
189010cdda0Smrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
190010cdda0Smrg                   [depcc="$$1"   am_compiler_list=])
191010cdda0Smrg
192010cdda0SmrgAC_CACHE_CHECK([dependency style of $depcc],
193010cdda0Smrg               [am_cv_$1_dependencies_compiler_type],
194010cdda0Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
195010cdda0Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
196010cdda0Smrg  # making bogus files that we don't know about and never remove.  For
197010cdda0Smrg  # instance it was reported that on HP-UX the gcc test will end up
198010cdda0Smrg  # making a dummy file named `D' -- because `-MD' means `put the output
199010cdda0Smrg  # in D'.
200b4485a66Smrg  rm -rf conftest.dir
201010cdda0Smrg  mkdir conftest.dir
202010cdda0Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
203010cdda0Smrg  # using a relative directory.
204010cdda0Smrg  cp "$am_depcomp" conftest.dir
205010cdda0Smrg  cd conftest.dir
206010cdda0Smrg  # We will build objects and dependencies in a subdirectory because
207010cdda0Smrg  # it helps to detect inapplicable dependency modes.  For instance
208010cdda0Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
209010cdda0Smrg  # side effect of compilation, but ICC will put the dependencies in
210010cdda0Smrg  # the current directory while Tru64 will put them in the object
211010cdda0Smrg  # directory.
212010cdda0Smrg  mkdir sub
213010cdda0Smrg
214010cdda0Smrg  am_cv_$1_dependencies_compiler_type=none
215010cdda0Smrg  if test "$am_compiler_list" = ""; then
216010cdda0Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
217010cdda0Smrg  fi
218b3eb03f3Smrg  am__universal=false
219b3eb03f3Smrg  m4_case([$1], [CC],
220b3eb03f3Smrg    [case " $depcc " in #(
221b3eb03f3Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
222b3eb03f3Smrg     esac],
223b3eb03f3Smrg    [CXX],
224b3eb03f3Smrg    [case " $depcc " in #(
225b3eb03f3Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
226b3eb03f3Smrg     esac])
227b3eb03f3Smrg
228010cdda0Smrg  for depmode in $am_compiler_list; do
229010cdda0Smrg    # Setup a source with many dependencies, because some compilers
230010cdda0Smrg    # like to wrap large dependency lists on column 80 (with \), and
231010cdda0Smrg    # we should not choose a depcomp mode which is confused by this.
232010cdda0Smrg    #
233010cdda0Smrg    # We need to recreate these files for each test, as the compiler may
234010cdda0Smrg    # overwrite some of them when testing with obscure command lines.
235010cdda0Smrg    # This happens at least with the AIX C compiler.
236010cdda0Smrg    : > sub/conftest.c
237010cdda0Smrg    for i in 1 2 3 4 5 6; do
238010cdda0Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
239b3eb03f3Smrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
240b3eb03f3Smrg      # Solaris 8's {/usr,}/bin/sh.
241b3eb03f3Smrg      touch sub/conftst$i.h
242010cdda0Smrg    done
243010cdda0Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
244010cdda0Smrg
245b3eb03f3Smrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
246b3eb03f3Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
247b3eb03f3Smrg    # handle `-M -o', and we need to detect this.  Also, some Intel
248b3eb03f3Smrg    # versions had trouble with output in subdirs
249b3eb03f3Smrg    am__obj=sub/conftest.${OBJEXT-o}
250b3eb03f3Smrg    am__minus_obj="-o $am__obj"
251010cdda0Smrg    case $depmode in
252b3eb03f3Smrg    gcc)
253b3eb03f3Smrg      # This depmode causes a compiler race in universal mode.
254b3eb03f3Smrg      test "$am__universal" = false || continue
255b3eb03f3Smrg      ;;
256010cdda0Smrg    nosideeffect)
257010cdda0Smrg      # after this tag, mechanisms are not by side-effect, so they'll
258010cdda0Smrg      # only be used when explicitly requested
259010cdda0Smrg      if test "x$enable_dependency_tracking" = xyes; then
260010cdda0Smrg	continue
261010cdda0Smrg      else
262010cdda0Smrg	break
263010cdda0Smrg      fi
264010cdda0Smrg      ;;
265b4485a66Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
266b3eb03f3Smrg      # This compiler won't grok `-c -o', but also, the minuso test has
267b3eb03f3Smrg      # not run yet.  These depmodes are late enough in the game, and
268b3eb03f3Smrg      # so weak that their functioning should not be impacted.
269b3eb03f3Smrg      am__obj=conftest.${OBJEXT-o}
270b3eb03f3Smrg      am__minus_obj=
271b3eb03f3Smrg      ;;
272010cdda0Smrg    none) break ;;
273010cdda0Smrg    esac
274010cdda0Smrg    if depmode=$depmode \
275b3eb03f3Smrg       source=sub/conftest.c object=$am__obj \
276010cdda0Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
277b3eb03f3Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
278010cdda0Smrg         >/dev/null 2>conftest.err &&
279b3eb03f3Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
280010cdda0Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
281b3eb03f3Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
282010cdda0Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
283010cdda0Smrg      # icc doesn't choke on unknown options, it will just issue warnings
284b3eb03f3Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
285b3eb03f3Smrg      # that says an option was ignored or not supported.
286b3eb03f3Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
287b3eb03f3Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
288b3eb03f3Smrg      # The diagnosis changed in icc 8.0:
289b3eb03f3Smrg      #   icc: Command line remark: option '-MP' not supported
290b3eb03f3Smrg      if (grep 'ignoring option' conftest.err ||
291b3eb03f3Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
292010cdda0Smrg        am_cv_$1_dependencies_compiler_type=$depmode
293010cdda0Smrg        break
294010cdda0Smrg      fi
295010cdda0Smrg    fi
296010cdda0Smrg  done
297010cdda0Smrg
298010cdda0Smrg  cd ..
299010cdda0Smrg  rm -rf conftest.dir
300010cdda0Smrgelse
301010cdda0Smrg  am_cv_$1_dependencies_compiler_type=none
302010cdda0Smrgfi
303010cdda0Smrg])
304010cdda0SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
305010cdda0SmrgAM_CONDITIONAL([am__fastdep$1], [
306010cdda0Smrg  test "x$enable_dependency_tracking" != xno \
307010cdda0Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
308010cdda0Smrg])
309010cdda0Smrg
310010cdda0Smrg
311010cdda0Smrg# AM_SET_DEPDIR
312010cdda0Smrg# -------------
313010cdda0Smrg# Choose a directory name for dependency files.
314010cdda0Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
315010cdda0SmrgAC_DEFUN([AM_SET_DEPDIR],
316010cdda0Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
317010cdda0SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
318010cdda0Smrg])
319010cdda0Smrg
320010cdda0Smrg
321010cdda0Smrg# AM_DEP_TRACK
322010cdda0Smrg# ------------
323010cdda0SmrgAC_DEFUN([AM_DEP_TRACK],
324010cdda0Smrg[AC_ARG_ENABLE(dependency-tracking,
325b3eb03f3Smrg[  --disable-dependency-tracking  speeds up one-time build
326b3eb03f3Smrg  --enable-dependency-tracking   do not reject slow dependency extractors])
327010cdda0Smrgif test "x$enable_dependency_tracking" != xno; then
328010cdda0Smrg  am_depcomp="$ac_aux_dir/depcomp"
329010cdda0Smrg  AMDEPBACKSLASH='\'
330b4485a66Smrg  am__nodep='_no'
331010cdda0Smrgfi
332b3eb03f3SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
333b3eb03f3SmrgAC_SUBST([AMDEPBACKSLASH])dnl
334b3eb03f3Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
335b4485a66SmrgAC_SUBST([am__nodep])dnl
336b4485a66Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
337b3eb03f3Smrg])
338b3eb03f3Smrg
339b3eb03f3Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
340b3eb03f3Smrg
341b3eb03f3Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
342b3eb03f3Smrg# Free Software Foundation, Inc.
343b3eb03f3Smrg#
344b3eb03f3Smrg# This file is free software; the Free Software Foundation
345b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
346b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
347b3eb03f3Smrg
348b3eb03f3Smrg#serial 5
349b3eb03f3Smrg
350b3eb03f3Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
351b3eb03f3Smrg# ------------------------------
352b3eb03f3SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
353b3eb03f3Smrg[{
354b3eb03f3Smrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
355b3eb03f3Smrg  # are listed without --file.  Let's play safe and only enable the eval
356b3eb03f3Smrg  # if we detect the quoting.
357b3eb03f3Smrg  case $CONFIG_FILES in
358b3eb03f3Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
359b3eb03f3Smrg  *)   set x $CONFIG_FILES ;;
360b3eb03f3Smrg  esac
361b3eb03f3Smrg  shift
362b3eb03f3Smrg  for mf
363b3eb03f3Smrg  do
364b3eb03f3Smrg    # Strip MF so we end up with the name of the file.
365b3eb03f3Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
366b3eb03f3Smrg    # Check whether this is an Automake generated Makefile or not.
367b3eb03f3Smrg    # We used to match only the files named `Makefile.in', but
368b3eb03f3Smrg    # some people rename them; so instead we look at the file content.
369b3eb03f3Smrg    # Grep'ing the first line is not enough: some people post-process
370b3eb03f3Smrg    # each Makefile.in and add a new line on top of each file to say so.
371b3eb03f3Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
372b3eb03f3Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
373b3eb03f3Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
374b3eb03f3Smrg      dirpart=`AS_DIRNAME("$mf")`
375b3eb03f3Smrg    else
376b3eb03f3Smrg      continue
377b3eb03f3Smrg    fi
378b3eb03f3Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
379b3eb03f3Smrg    # from the Makefile without running `make'.
380b3eb03f3Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
381b3eb03f3Smrg    test -z "$DEPDIR" && continue
382b3eb03f3Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
383b3eb03f3Smrg    test -z "am__include" && continue
384b3eb03f3Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
385b3eb03f3Smrg    # When using ansi2knr, U may be empty or an underscore; expand it
386b3eb03f3Smrg    U=`sed -n 's/^U = //p' < "$mf"`
387b3eb03f3Smrg    # Find all dependency output files, they are included files with
388b3eb03f3Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
389b3eb03f3Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
390b3eb03f3Smrg    # expansion.
391b3eb03f3Smrg    for file in `sed -n "
392b3eb03f3Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
393b3eb03f3Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
394b3eb03f3Smrg      # Make sure the directory exists.
395b3eb03f3Smrg      test -f "$dirpart/$file" && continue
396b3eb03f3Smrg      fdir=`AS_DIRNAME(["$file"])`
397b3eb03f3Smrg      AS_MKDIR_P([$dirpart/$fdir])
398b3eb03f3Smrg      # echo "creating $dirpart/$file"
399b3eb03f3Smrg      echo '# dummy' > "$dirpart/$file"
400b3eb03f3Smrg    done
401b3eb03f3Smrg  done
402b3eb03f3Smrg}
403b3eb03f3Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
404b3eb03f3Smrg
405b3eb03f3Smrg
406b3eb03f3Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
407b3eb03f3Smrg# -----------------------------
408b3eb03f3Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
409b3eb03f3Smrg#
410b3eb03f3Smrg# This code is only required when automatic dependency tracking
411b3eb03f3Smrg# is enabled.  FIXME.  This creates each `.P' file that we will
412b3eb03f3Smrg# need in order to bootstrap the dependency handling code.
413b3eb03f3SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
414b3eb03f3Smrg[AC_CONFIG_COMMANDS([depfiles],
415b3eb03f3Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
416b3eb03f3Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
417b3eb03f3Smrg])
418b3eb03f3Smrg
419b3eb03f3Smrg# Do all the work for Automake.                             -*- Autoconf -*-
420b3eb03f3Smrg
421b3eb03f3Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
422b3eb03f3Smrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
423b3eb03f3Smrg#
424b3eb03f3Smrg# This file is free software; the Free Software Foundation
425b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
426b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
427b3eb03f3Smrg
428b3eb03f3Smrg# serial 16
429b3eb03f3Smrg
430b3eb03f3Smrg# This macro actually does too much.  Some checks are only needed if
431b3eb03f3Smrg# your package does certain things.  But this isn't really a big deal.
432b3eb03f3Smrg
433b3eb03f3Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
434b3eb03f3Smrg# AM_INIT_AUTOMAKE([OPTIONS])
435b3eb03f3Smrg# -----------------------------------------------
436b3eb03f3Smrg# The call with PACKAGE and VERSION arguments is the old style
437b3eb03f3Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
438b3eb03f3Smrg# and VERSION should now be passed to AC_INIT and removed from
439b3eb03f3Smrg# the call to AM_INIT_AUTOMAKE.
440b3eb03f3Smrg# We support both call styles for the transition.  After
441b3eb03f3Smrg# the next Automake release, Autoconf can make the AC_INIT
442b3eb03f3Smrg# arguments mandatory, and then we can depend on a new Autoconf
443b3eb03f3Smrg# release and drop the old call support.
444b3eb03f3SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
445b3eb03f3Smrg[AC_PREREQ([2.62])dnl
446b3eb03f3Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
447b3eb03f3Smrgdnl the ones we care about.
448b3eb03f3Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
449b3eb03f3SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
450b3eb03f3SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
451b3eb03f3Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
452b3eb03f3Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
453b3eb03f3Smrg  # is not polluted with repeated "-I."
454b3eb03f3Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
455b3eb03f3Smrg  # test to see if srcdir already configured
456b3eb03f3Smrg  if test -f $srcdir/config.status; then
457b3eb03f3Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
458b3eb03f3Smrg  fi
459b3eb03f3Smrgfi
460b3eb03f3Smrg
461b3eb03f3Smrg# test whether we have cygpath
462b3eb03f3Smrgif test -z "$CYGPATH_W"; then
463b3eb03f3Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
464b3eb03f3Smrg    CYGPATH_W='cygpath -w'
465b3eb03f3Smrg  else
466b3eb03f3Smrg    CYGPATH_W=echo
467b3eb03f3Smrg  fi
468b3eb03f3Smrgfi
469b3eb03f3SmrgAC_SUBST([CYGPATH_W])
470b3eb03f3Smrg
471b3eb03f3Smrg# Define the identity of the package.
472b3eb03f3Smrgdnl Distinguish between old-style and new-style calls.
473b3eb03f3Smrgm4_ifval([$2],
474b3eb03f3Smrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
475b3eb03f3Smrg AC_SUBST([PACKAGE], [$1])dnl
476b3eb03f3Smrg AC_SUBST([VERSION], [$2])],
477b3eb03f3Smrg[_AM_SET_OPTIONS([$1])dnl
478b3eb03f3Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
479b3eb03f3Smrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
480b3eb03f3Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
481b3eb03f3Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
482b3eb03f3Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
483b3eb03f3Smrg
484b3eb03f3Smrg_AM_IF_OPTION([no-define],,
485b3eb03f3Smrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
486b3eb03f3Smrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
487b3eb03f3Smrg
488b3eb03f3Smrg# Some tools Automake needs.
489b3eb03f3SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
490b3eb03f3SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
491b3eb03f3SmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
492b3eb03f3SmrgAM_MISSING_PROG(AUTOCONF, autoconf)
493b3eb03f3SmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
494b3eb03f3SmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
495b3eb03f3SmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
496b3eb03f3SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
497b3eb03f3SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
498b3eb03f3SmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
499b3eb03f3Smrg# We need awk for the "check" target.  The system "awk" is bad on
500b3eb03f3Smrg# some platforms.
501b3eb03f3SmrgAC_REQUIRE([AC_PROG_AWK])dnl
502b3eb03f3SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
503b3eb03f3SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
504b3eb03f3Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
505b3eb03f3Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
506b3eb03f3Smrg			     [_AM_PROG_TAR([v7])])])
507b3eb03f3Smrg_AM_IF_OPTION([no-dependencies],,
508b3eb03f3Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
509b3eb03f3Smrg		  [_AM_DEPENDENCIES(CC)],
510b3eb03f3Smrg		  [define([AC_PROG_CC],
511b3eb03f3Smrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
512b3eb03f3SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
513b3eb03f3Smrg		  [_AM_DEPENDENCIES(CXX)],
514b3eb03f3Smrg		  [define([AC_PROG_CXX],
515b3eb03f3Smrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
516b3eb03f3SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
517b3eb03f3Smrg		  [_AM_DEPENDENCIES(OBJC)],
518b3eb03f3Smrg		  [define([AC_PROG_OBJC],
519b3eb03f3Smrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
520b3eb03f3Smrg])
521b3eb03f3Smrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
522b3eb03f3Smrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
523b3eb03f3Smrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
524b3eb03f3Smrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
525b3eb03f3SmrgAC_CONFIG_COMMANDS_PRE(dnl
526b3eb03f3Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
527b3eb03f3Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
528b3eb03f3Smrg])
529b3eb03f3Smrg
530b3eb03f3Smrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
531b3eb03f3Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
532b3eb03f3Smrgdnl mangled by Autoconf and run in a shell conditional statement.
533b3eb03f3Smrgm4_define([_AC_COMPILER_EXEEXT],
534b3eb03f3Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
535b3eb03f3Smrg
536b3eb03f3Smrg
537b3eb03f3Smrg# When config.status generates a header, we must update the stamp-h file.
538b3eb03f3Smrg# This file resides in the same directory as the config header
539b3eb03f3Smrg# that is generated.  The stamp files are numbered to have different names.
540b3eb03f3Smrg
541b3eb03f3Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
542b3eb03f3Smrg# loop where config.status creates the headers, so we can generate
543b3eb03f3Smrg# our stamp files there.
544b3eb03f3SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
545b3eb03f3Smrg[# Compute $1's index in $config_headers.
546b3eb03f3Smrg_am_arg=$1
547b3eb03f3Smrg_am_stamp_count=1
548b3eb03f3Smrgfor _am_header in $config_headers :; do
549b3eb03f3Smrg  case $_am_header in
550b3eb03f3Smrg    $_am_arg | $_am_arg:* )
551b3eb03f3Smrg      break ;;
552b3eb03f3Smrg    * )
553b3eb03f3Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
554b3eb03f3Smrg  esac
555b3eb03f3Smrgdone
556b3eb03f3Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
557b3eb03f3Smrg
558b4485a66Smrg# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
559b4485a66Smrg# Inc.
560b3eb03f3Smrg#
561b3eb03f3Smrg# This file is free software; the Free Software Foundation
562b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
563b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
564b3eb03f3Smrg
565b4485a66Smrg# serial 1
566b4485a66Smrg
567b3eb03f3Smrg# AM_PROG_INSTALL_SH
568b3eb03f3Smrg# ------------------
569b3eb03f3Smrg# Define $install_sh.
570b3eb03f3SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
571b3eb03f3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
572b3eb03f3Smrgif test x"${install_sh}" != xset; then
573b3eb03f3Smrg  case $am_aux_dir in
574b3eb03f3Smrg  *\ * | *\	*)
575b3eb03f3Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
576b3eb03f3Smrg  *)
577b3eb03f3Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
578b3eb03f3Smrg  esac
579b3eb03f3Smrgfi
580b3eb03f3SmrgAC_SUBST(install_sh)])
581b3eb03f3Smrg
582b3eb03f3Smrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
583b3eb03f3Smrg#
584b3eb03f3Smrg# This file is free software; the Free Software Foundation
585b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
586b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
587b3eb03f3Smrg
588b3eb03f3Smrg# serial 2
589b3eb03f3Smrg
590b3eb03f3Smrg# Check whether the underlying file-system supports filenames
591b3eb03f3Smrg# with a leading dot.  For instance MS-DOS doesn't.
592b3eb03f3SmrgAC_DEFUN([AM_SET_LEADING_DOT],
593b3eb03f3Smrg[rm -rf .tst 2>/dev/null
594b3eb03f3Smrgmkdir .tst 2>/dev/null
595b3eb03f3Smrgif test -d .tst; then
596b3eb03f3Smrg  am__leading_dot=.
597b3eb03f3Smrgelse
598b3eb03f3Smrg  am__leading_dot=_
599b3eb03f3Smrgfi
600b3eb03f3Smrgrmdir .tst 2>/dev/null
601b3eb03f3SmrgAC_SUBST([am__leading_dot])])
602b3eb03f3Smrg
603b3eb03f3Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
604b3eb03f3Smrg# From Jim Meyering
605b3eb03f3Smrg
606b4485a66Smrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
607b4485a66Smrg# 2011 Free Software Foundation, Inc.
608b3eb03f3Smrg#
609b3eb03f3Smrg# This file is free software; the Free Software Foundation
610b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
611b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
612b3eb03f3Smrg
613b3eb03f3Smrg# serial 5
614b3eb03f3Smrg
615b3eb03f3Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
616b3eb03f3Smrg# ----------------------------------
617b3eb03f3Smrg# Control maintainer-specific portions of Makefiles.
618b3eb03f3Smrg# Default is to disable them, unless `enable' is passed literally.
619b3eb03f3Smrg# For symmetry, `disable' may be passed as well.  Anyway, the user
620b3eb03f3Smrg# can override the default with the --enable/--disable switch.
621b3eb03f3SmrgAC_DEFUN([AM_MAINTAINER_MODE],
622b3eb03f3Smrg[m4_case(m4_default([$1], [disable]),
623b3eb03f3Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
624b3eb03f3Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
625b3eb03f3Smrg       [m4_define([am_maintainer_other], [enable])
626b3eb03f3Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
627b4485a66SmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
628b3eb03f3Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
629b3eb03f3Smrg  AC_ARG_ENABLE([maintainer-mode],
630b3eb03f3Smrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
631b3eb03f3Smrg			  (and sometimes confusing) to the casual installer],
632b3eb03f3Smrg      [USE_MAINTAINER_MODE=$enableval],
633b3eb03f3Smrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
634b3eb03f3Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
635b3eb03f3Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
636b3eb03f3Smrg  MAINT=$MAINTAINER_MODE_TRUE
637b3eb03f3Smrg  AC_SUBST([MAINT])dnl
638b3eb03f3Smrg]
639b3eb03f3Smrg)
640b3eb03f3Smrg
641b3eb03f3SmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
642b3eb03f3Smrg
643b3eb03f3Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
644b3eb03f3Smrg
645b3eb03f3Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
646b3eb03f3Smrg#
647b3eb03f3Smrg# This file is free software; the Free Software Foundation
648b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
649b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
650b3eb03f3Smrg
651b3eb03f3Smrg# serial 4
652b3eb03f3Smrg
653b3eb03f3Smrg# AM_MAKE_INCLUDE()
654b3eb03f3Smrg# -----------------
655b3eb03f3Smrg# Check to see how make treats includes.
656b3eb03f3SmrgAC_DEFUN([AM_MAKE_INCLUDE],
657b3eb03f3Smrg[am_make=${MAKE-make}
658b3eb03f3Smrgcat > confinc << 'END'
659b3eb03f3Smrgam__doit:
660b3eb03f3Smrg	@echo this is the am__doit target
661b3eb03f3Smrg.PHONY: am__doit
662b3eb03f3SmrgEND
663b3eb03f3Smrg# If we don't find an include directive, just comment out the code.
664b3eb03f3SmrgAC_MSG_CHECKING([for style of include used by $am_make])
665b3eb03f3Smrgam__include="#"
666b3eb03f3Smrgam__quote=
667b3eb03f3Smrg_am_result=none
668b3eb03f3Smrg# First try GNU make style include.
669b3eb03f3Smrgecho "include confinc" > confmf
670b3eb03f3Smrg# Ignore all kinds of additional output from `make'.
671b3eb03f3Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
672b3eb03f3Smrg*the\ am__doit\ target*)
673b3eb03f3Smrg  am__include=include
674b3eb03f3Smrg  am__quote=
675b3eb03f3Smrg  _am_result=GNU
676b3eb03f3Smrg  ;;
677b3eb03f3Smrgesac
678b3eb03f3Smrg# Now try BSD make style include.
679b3eb03f3Smrgif test "$am__include" = "#"; then
680b3eb03f3Smrg   echo '.include "confinc"' > confmf
681b3eb03f3Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
682b3eb03f3Smrg   *the\ am__doit\ target*)
683b3eb03f3Smrg     am__include=.include
684b3eb03f3Smrg     am__quote="\""
685b3eb03f3Smrg     _am_result=BSD
686b3eb03f3Smrg     ;;
687b3eb03f3Smrg   esac
688b3eb03f3Smrgfi
689b3eb03f3SmrgAC_SUBST([am__include])
690b3eb03f3SmrgAC_SUBST([am__quote])
691b3eb03f3SmrgAC_MSG_RESULT([$_am_result])
692b3eb03f3Smrgrm -f confinc confmf
693b3eb03f3Smrg])
694b3eb03f3Smrg
695b3eb03f3Smrg# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008
696b3eb03f3Smrg# Free Software Foundation, Inc.
697b3eb03f3Smrg#
698b3eb03f3Smrg# This file is free software; the Free Software Foundation
699b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
700b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
701b3eb03f3Smrg
702b3eb03f3Smrg# serial 6
703b3eb03f3Smrg
704b3eb03f3Smrg# AM_PROG_CC_C_O
705b3eb03f3Smrg# --------------
706b3eb03f3Smrg# Like AC_PROG_CC_C_O, but changed for automake.
707b3eb03f3SmrgAC_DEFUN([AM_PROG_CC_C_O],
708b3eb03f3Smrg[AC_REQUIRE([AC_PROG_CC_C_O])dnl
709b3eb03f3SmrgAC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
710b3eb03f3SmrgAC_REQUIRE_AUX_FILE([compile])dnl
711b3eb03f3Smrg# FIXME: we rely on the cache variable name because
712b3eb03f3Smrg# there is no other way.
713b3eb03f3Smrgset dummy $CC
714b3eb03f3Smrgam_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
715b3eb03f3Smrgeval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
716b3eb03f3Smrgif test "$am_t" != yes; then
717b3eb03f3Smrg   # Losing compiler, so override with the script.
718b3eb03f3Smrg   # FIXME: It is wrong to rewrite CC.
719b3eb03f3Smrg   # But if we don't then we get into trouble of one sort or another.
720b3eb03f3Smrg   # A longer-term fix would be to have automake use am__CC in this case,
721b3eb03f3Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
722b3eb03f3Smrg   CC="$am_aux_dir/compile $CC"
723b3eb03f3Smrgfi
724b3eb03f3Smrgdnl Make sure AC_PROG_CC is never called again, or it will override our
725b3eb03f3Smrgdnl setting of CC.
726b3eb03f3Smrgm4_define([AC_PROG_CC],
727b3eb03f3Smrg          [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
728b3eb03f3Smrg])
729b3eb03f3Smrg
730b3eb03f3Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
731b3eb03f3Smrg
732b3eb03f3Smrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
733b3eb03f3Smrg# Free Software Foundation, Inc.
734b3eb03f3Smrg#
735b3eb03f3Smrg# This file is free software; the Free Software Foundation
736b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
737b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
738b3eb03f3Smrg
739b3eb03f3Smrg# serial 6
740b3eb03f3Smrg
741b3eb03f3Smrg# AM_MISSING_PROG(NAME, PROGRAM)
742b3eb03f3Smrg# ------------------------------
743b3eb03f3SmrgAC_DEFUN([AM_MISSING_PROG],
744b3eb03f3Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
745b3eb03f3Smrg$1=${$1-"${am_missing_run}$2"}
746b3eb03f3SmrgAC_SUBST($1)])
747b3eb03f3Smrg
748b3eb03f3Smrg
749b3eb03f3Smrg# AM_MISSING_HAS_RUN
750b3eb03f3Smrg# ------------------
751b3eb03f3Smrg# Define MISSING if not defined so far and test if it supports --run.
752b3eb03f3Smrg# If it does, set am_missing_run to use it, otherwise, to nothing.
753b3eb03f3SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
754b3eb03f3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
755b3eb03f3SmrgAC_REQUIRE_AUX_FILE([missing])dnl
756b3eb03f3Smrgif test x"${MISSING+set}" != xset; then
757b3eb03f3Smrg  case $am_aux_dir in
758b3eb03f3Smrg  *\ * | *\	*)
759b3eb03f3Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
760b3eb03f3Smrg  *)
761b3eb03f3Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
762b3eb03f3Smrg  esac
763b3eb03f3Smrgfi
764b3eb03f3Smrg# Use eval to expand $SHELL
765b3eb03f3Smrgif eval "$MISSING --run true"; then
766b3eb03f3Smrg  am_missing_run="$MISSING --run "
767b3eb03f3Smrgelse
768b3eb03f3Smrg  am_missing_run=
769b3eb03f3Smrg  AC_MSG_WARN([`missing' script is too old or missing])
770b3eb03f3Smrgfi
771b3eb03f3Smrg])
772b3eb03f3Smrg
773b4485a66Smrg# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
774b4485a66Smrg# Inc.
775b3eb03f3Smrg#
776b3eb03f3Smrg# This file is free software; the Free Software Foundation
777b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
778b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
779b3eb03f3Smrg
780b4485a66Smrg# serial 1
781b4485a66Smrg
782b3eb03f3Smrg# AM_PROG_MKDIR_P
783b3eb03f3Smrg# ---------------
784b3eb03f3Smrg# Check for `mkdir -p'.
785b3eb03f3SmrgAC_DEFUN([AM_PROG_MKDIR_P],
786b3eb03f3Smrg[AC_PREREQ([2.60])dnl
787b3eb03f3SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
788b3eb03f3Smrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
789b3eb03f3Smrgdnl while keeping a definition of mkdir_p for backward compatibility.
790b3eb03f3Smrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
791b3eb03f3Smrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
792b3eb03f3Smrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
793b3eb03f3Smrgdnl adjustment using top_builddir (which is defined more often than
794b3eb03f3Smrgdnl MKDIR_P).
795b3eb03f3SmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
796b3eb03f3Smrgcase $mkdir_p in
797b3eb03f3Smrg  [[\\/$]]* | ?:[[\\/]]*) ;;
798b3eb03f3Smrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
799b3eb03f3Smrgesac
800b3eb03f3Smrg])
801b3eb03f3Smrg
802b3eb03f3Smrg# Helper functions for option handling.                     -*- Autoconf -*-
803b3eb03f3Smrg
804b4485a66Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
805b4485a66Smrg# Foundation, Inc.
806b3eb03f3Smrg#
807b3eb03f3Smrg# This file is free software; the Free Software Foundation
808b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
809b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
810b3eb03f3Smrg
811b4485a66Smrg# serial 5
812b3eb03f3Smrg
813b3eb03f3Smrg# _AM_MANGLE_OPTION(NAME)
814b3eb03f3Smrg# -----------------------
815b3eb03f3SmrgAC_DEFUN([_AM_MANGLE_OPTION],
816b3eb03f3Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
817b3eb03f3Smrg
818b3eb03f3Smrg# _AM_SET_OPTION(NAME)
819b4485a66Smrg# --------------------
820b3eb03f3Smrg# Set option NAME.  Presently that only means defining a flag for this option.
821b3eb03f3SmrgAC_DEFUN([_AM_SET_OPTION],
822b3eb03f3Smrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
823b3eb03f3Smrg
824b3eb03f3Smrg# _AM_SET_OPTIONS(OPTIONS)
825b4485a66Smrg# ------------------------
826b3eb03f3Smrg# OPTIONS is a space-separated list of Automake options.
827b3eb03f3SmrgAC_DEFUN([_AM_SET_OPTIONS],
828b3eb03f3Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
829b3eb03f3Smrg
830b3eb03f3Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
831b3eb03f3Smrg# -------------------------------------------
832b3eb03f3Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
833b3eb03f3SmrgAC_DEFUN([_AM_IF_OPTION],
834b3eb03f3Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
835b3eb03f3Smrg
836b3eb03f3Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
837b3eb03f3Smrg
838b3eb03f3Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
839b3eb03f3Smrg# Free Software Foundation, Inc.
840b3eb03f3Smrg#
841b3eb03f3Smrg# This file is free software; the Free Software Foundation
842b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
843b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
844b3eb03f3Smrg
845b3eb03f3Smrg# serial 5
846b3eb03f3Smrg
847b3eb03f3Smrg# AM_SANITY_CHECK
848b3eb03f3Smrg# ---------------
849b3eb03f3SmrgAC_DEFUN([AM_SANITY_CHECK],
850b3eb03f3Smrg[AC_MSG_CHECKING([whether build environment is sane])
851b3eb03f3Smrg# Just in case
852b3eb03f3Smrgsleep 1
853b3eb03f3Smrgecho timestamp > conftest.file
854b3eb03f3Smrg# Reject unsafe characters in $srcdir or the absolute working directory
855b3eb03f3Smrg# name.  Accept space and tab only in the latter.
856b3eb03f3Smrgam_lf='
857b3eb03f3Smrg'
858b3eb03f3Smrgcase `pwd` in
859b3eb03f3Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
860b3eb03f3Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
861b3eb03f3Smrgesac
862b3eb03f3Smrgcase $srcdir in
863b3eb03f3Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
864b3eb03f3Smrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
865b3eb03f3Smrgesac
866b3eb03f3Smrg
867b3eb03f3Smrg# Do `set' in a subshell so we don't clobber the current shell's
868b3eb03f3Smrg# arguments.  Must try -L first in case configure is actually a
869b3eb03f3Smrg# symlink; some systems play weird games with the mod time of symlinks
870b3eb03f3Smrg# (eg FreeBSD returns the mod time of the symlink's containing
871b3eb03f3Smrg# directory).
872b3eb03f3Smrgif (
873b3eb03f3Smrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
874b3eb03f3Smrg   if test "$[*]" = "X"; then
875b3eb03f3Smrg      # -L didn't work.
876b3eb03f3Smrg      set X `ls -t "$srcdir/configure" conftest.file`
877b3eb03f3Smrg   fi
878b3eb03f3Smrg   rm -f conftest.file
879b3eb03f3Smrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
880b3eb03f3Smrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
881b3eb03f3Smrg
882b3eb03f3Smrg      # If neither matched, then we have a broken ls.  This can happen
883b3eb03f3Smrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
884b3eb03f3Smrg      # broken ls alias from the environment.  This has actually
885b3eb03f3Smrg      # happened.  Such a system could not be considered "sane".
886b3eb03f3Smrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
887b3eb03f3Smrgalias in your environment])
888b3eb03f3Smrg   fi
889b3eb03f3Smrg
890b3eb03f3Smrg   test "$[2]" = conftest.file
891b3eb03f3Smrg   )
892b3eb03f3Smrgthen
893b3eb03f3Smrg   # Ok.
894b3eb03f3Smrg   :
895b3eb03f3Smrgelse
896b3eb03f3Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
897b3eb03f3SmrgCheck your system clock])
898b3eb03f3Smrgfi
899b3eb03f3SmrgAC_MSG_RESULT(yes)])
900b3eb03f3Smrg
901b3eb03f3Smrg# Copyright (C) 2009  Free Software Foundation, Inc.
902b3eb03f3Smrg#
903b3eb03f3Smrg# This file is free software; the Free Software Foundation
904b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
905b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
906b3eb03f3Smrg
907b3eb03f3Smrg# serial 1
908b3eb03f3Smrg
909b3eb03f3Smrg# AM_SILENT_RULES([DEFAULT])
910b3eb03f3Smrg# --------------------------
911b3eb03f3Smrg# Enable less verbose build rules; with the default set to DEFAULT
912b3eb03f3Smrg# (`yes' being less verbose, `no' or empty being verbose).
913b3eb03f3SmrgAC_DEFUN([AM_SILENT_RULES],
914b3eb03f3Smrg[AC_ARG_ENABLE([silent-rules],
915b3eb03f3Smrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
916b3eb03f3Smrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
917b3eb03f3Smrgcase $enable_silent_rules in
918b3eb03f3Smrgyes) AM_DEFAULT_VERBOSITY=0;;
919b3eb03f3Smrgno)  AM_DEFAULT_VERBOSITY=1;;
920b3eb03f3Smrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
921b3eb03f3Smrgesac
922b3eb03f3SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
923b3eb03f3SmrgAM_BACKSLASH='\'
924b3eb03f3SmrgAC_SUBST([AM_BACKSLASH])dnl
925b3eb03f3Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
926b3eb03f3Smrg])
927b3eb03f3Smrg
928b4485a66Smrg# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
929b3eb03f3Smrg#
930b3eb03f3Smrg# This file is free software; the Free Software Foundation
931b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
932b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
933b3eb03f3Smrg
934b4485a66Smrg# serial 1
935b4485a66Smrg
936b3eb03f3Smrg# AM_PROG_INSTALL_STRIP
937b3eb03f3Smrg# ---------------------
938b3eb03f3Smrg# One issue with vendor `install' (even GNU) is that you can't
939b3eb03f3Smrg# specify the program used to strip binaries.  This is especially
940b3eb03f3Smrg# annoying in cross-compiling environments, where the build's strip
941b3eb03f3Smrg# is unlikely to handle the host's binaries.
942b3eb03f3Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
943b3eb03f3Smrg# always use install-sh in `make install-strip', and initialize
944b3eb03f3Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
945b3eb03f3SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
946b3eb03f3Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
947b3eb03f3Smrg# Installed binaries are usually stripped using `strip' when the user
948b3eb03f3Smrg# run `make install-strip'.  However `strip' might not be the right
949b3eb03f3Smrg# tool to use in cross-compilation environments, therefore Automake
950b3eb03f3Smrg# will honor the `STRIP' environment variable to overrule this program.
951b3eb03f3Smrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
952b3eb03f3Smrgif test "$cross_compiling" != no; then
953b3eb03f3Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
954b3eb03f3Smrgfi
955b3eb03f3SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
956b3eb03f3SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
957b3eb03f3Smrg
958b4485a66Smrg# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
959b3eb03f3Smrg#
960b3eb03f3Smrg# This file is free software; the Free Software Foundation
961b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
962b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
963b3eb03f3Smrg
964b4485a66Smrg# serial 3
965b3eb03f3Smrg
966b3eb03f3Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
967b3eb03f3Smrg# ---------------------------
968b3eb03f3Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
969b3eb03f3Smrg# This macro is traced by Automake.
970b3eb03f3SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
971b3eb03f3Smrg
972b3eb03f3Smrg# AM_SUBST_NOTMAKE(VARIABLE)
973b4485a66Smrg# --------------------------
974b3eb03f3Smrg# Public sister of _AM_SUBST_NOTMAKE.
975b3eb03f3SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
976b3eb03f3Smrg
977b3eb03f3Smrg# Check how to create a tarball.                            -*- Autoconf -*-
978b3eb03f3Smrg
979b3eb03f3Smrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
980b3eb03f3Smrg#
981b3eb03f3Smrg# This file is free software; the Free Software Foundation
982b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
983b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
984b3eb03f3Smrg
985b3eb03f3Smrg# serial 2
986b3eb03f3Smrg
987b3eb03f3Smrg# _AM_PROG_TAR(FORMAT)
988b3eb03f3Smrg# --------------------
989b3eb03f3Smrg# Check how to create a tarball in format FORMAT.
990b3eb03f3Smrg# FORMAT should be one of `v7', `ustar', or `pax'.
991b3eb03f3Smrg#
992b3eb03f3Smrg# Substitute a variable $(am__tar) that is a command
993b3eb03f3Smrg# writing to stdout a FORMAT-tarball containing the directory
994b3eb03f3Smrg# $tardir.
995b3eb03f3Smrg#     tardir=directory && $(am__tar) > result.tar
996b3eb03f3Smrg#
997b3eb03f3Smrg# Substitute a variable $(am__untar) that extract such
998b3eb03f3Smrg# a tarball read from stdin.
999b3eb03f3Smrg#     $(am__untar) < result.tar
1000b3eb03f3SmrgAC_DEFUN([_AM_PROG_TAR],
1001b3eb03f3Smrg[# Always define AMTAR for backward compatibility.
1002b3eb03f3SmrgAM_MISSING_PROG([AMTAR], [tar])
1003b3eb03f3Smrgm4_if([$1], [v7],
1004b3eb03f3Smrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
1005b3eb03f3Smrg     [m4_case([$1], [ustar],, [pax],,
1006b3eb03f3Smrg              [m4_fatal([Unknown tar format])])
1007b3eb03f3SmrgAC_MSG_CHECKING([how to create a $1 tar archive])
1008b3eb03f3Smrg# Loop over all known methods to create a tar archive until one works.
1009b3eb03f3Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1010b3eb03f3Smrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
1011b3eb03f3Smrg# Do not fold the above two line into one, because Tru64 sh and
1012b3eb03f3Smrg# Solaris sh will not grok spaces in the rhs of `-'.
1013b3eb03f3Smrgfor _am_tool in $_am_tools
1014b3eb03f3Smrgdo
1015b3eb03f3Smrg  case $_am_tool in
1016b3eb03f3Smrg  gnutar)
1017b3eb03f3Smrg    for _am_tar in tar gnutar gtar;
1018b3eb03f3Smrg    do
1019b3eb03f3Smrg      AM_RUN_LOG([$_am_tar --version]) && break
1020b3eb03f3Smrg    done
1021b3eb03f3Smrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1022b3eb03f3Smrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1023b3eb03f3Smrg    am__untar="$_am_tar -xf -"
1024b3eb03f3Smrg    ;;
1025b3eb03f3Smrg  plaintar)
1026b3eb03f3Smrg    # Must skip GNU tar: if it does not support --format= it doesn't create
1027b3eb03f3Smrg    # ustar tarball either.
1028b3eb03f3Smrg    (tar --version) >/dev/null 2>&1 && continue
1029b3eb03f3Smrg    am__tar='tar chf - "$$tardir"'
1030b3eb03f3Smrg    am__tar_='tar chf - "$tardir"'
1031b3eb03f3Smrg    am__untar='tar xf -'
1032b3eb03f3Smrg    ;;
1033b3eb03f3Smrg  pax)
1034b3eb03f3Smrg    am__tar='pax -L -x $1 -w "$$tardir"'
1035b3eb03f3Smrg    am__tar_='pax -L -x $1 -w "$tardir"'
1036b3eb03f3Smrg    am__untar='pax -r'
1037b3eb03f3Smrg    ;;
1038b3eb03f3Smrg  cpio)
1039b3eb03f3Smrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1040b3eb03f3Smrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1041b3eb03f3Smrg    am__untar='cpio -i -H $1 -d'
1042b3eb03f3Smrg    ;;
1043b3eb03f3Smrg  none)
1044b3eb03f3Smrg    am__tar=false
1045b3eb03f3Smrg    am__tar_=false
1046b3eb03f3Smrg    am__untar=false
1047b3eb03f3Smrg    ;;
1048b3eb03f3Smrg  esac
1049b3eb03f3Smrg
1050b3eb03f3Smrg  # If the value was cached, stop now.  We just wanted to have am__tar
1051b3eb03f3Smrg  # and am__untar set.
1052b3eb03f3Smrg  test -n "${am_cv_prog_tar_$1}" && break
1053b3eb03f3Smrg
1054b3eb03f3Smrg  # tar/untar a dummy directory, and stop if the command works
1055b3eb03f3Smrg  rm -rf conftest.dir
1056b3eb03f3Smrg  mkdir conftest.dir
1057b3eb03f3Smrg  echo GrepMe > conftest.dir/file
1058b3eb03f3Smrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1059b3eb03f3Smrg  rm -rf conftest.dir
1060b3eb03f3Smrg  if test -s conftest.tar; then
1061b3eb03f3Smrg    AM_RUN_LOG([$am__untar <conftest.tar])
1062b3eb03f3Smrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1063b3eb03f3Smrg  fi
1064b3eb03f3Smrgdone
1065b3eb03f3Smrgrm -rf conftest.dir
1066b3eb03f3Smrg
1067b3eb03f3SmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1068b3eb03f3SmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
1069b3eb03f3SmrgAC_SUBST([am__tar])
1070b3eb03f3SmrgAC_SUBST([am__untar])
1071b3eb03f3Smrg]) # _AM_PROG_TAR
1072b3eb03f3Smrg
1073b4485a66Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1074b4485a66Smrg# 
1075b4485a66Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1076b4485a66Smrg#
1077b4485a66Smrg# This program is free software; you can redistribute it and/or modify
1078b4485a66Smrg# it under the terms of the GNU General Public License as published by
1079b4485a66Smrg# the Free Software Foundation; either version 2 of the License, or
1080b4485a66Smrg# (at your option) any later version.
1081b4485a66Smrg#
1082b4485a66Smrg# This program is distributed in the hope that it will be useful, but
1083b4485a66Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1084b4485a66Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1085b4485a66Smrg# General Public License for more details.
1086b4485a66Smrg#
1087b4485a66Smrg# You should have received a copy of the GNU General Public License
1088b4485a66Smrg# along with this program; if not, write to the Free Software
1089b4485a66Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1090b4485a66Smrg#
1091b4485a66Smrg# As a special exception to the GNU General Public License, if you
1092b4485a66Smrg# distribute this file as part of a program that contains a
1093b4485a66Smrg# configuration script generated by Autoconf, you may include it under
1094b4485a66Smrg# the same distribution terms that you use for the rest of that program.
1095b4485a66Smrg
1096b4485a66Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1097b4485a66Smrg# ----------------------------------
1098b4485a66SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1099b4485a66Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1100b4485a66Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1101b4485a66SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1102b4485a66Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1103b4485a66Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1104b4485a66Smrgfi
1105b4485a66Smrgif test -n "$PKG_CONFIG"; then
1106b4485a66Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
1107b4485a66Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1108b4485a66Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1109b4485a66Smrg		AC_MSG_RESULT([yes])
1110b4485a66Smrg	else
1111b4485a66Smrg		AC_MSG_RESULT([no])
1112b4485a66Smrg		PKG_CONFIG=""
1113b4485a66Smrg	fi
1114b4485a66Smrg		
1115b4485a66Smrgfi[]dnl
1116b4485a66Smrg])# PKG_PROG_PKG_CONFIG
1117b4485a66Smrg
1118b4485a66Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1119b4485a66Smrg#
1120b4485a66Smrg# Check to see whether a particular set of modules exists.  Similar
1121b4485a66Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1122b4485a66Smrg#
1123b4485a66Smrg#
1124b4485a66Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1125b4485a66Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
1126b4485a66Smrg# PKG_CHECK_EXISTS manually
1127b4485a66Smrg# --------------------------------------------------------------
1128b4485a66SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1129b4485a66Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1130b4485a66Smrgif test -n "$PKG_CONFIG" && \
1131b4485a66Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1132b4485a66Smrg  m4_ifval([$2], [$2], [:])
1133b4485a66Smrgm4_ifvaln([$3], [else
1134b4485a66Smrg  $3])dnl
1135b4485a66Smrgfi])
1136b4485a66Smrg
1137b4485a66Smrg
1138b4485a66Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1139b4485a66Smrg# ---------------------------------------------
1140b4485a66Smrgm4_define([_PKG_CONFIG],
1141b4485a66Smrg[if test -n "$$1"; then
1142b4485a66Smrg    pkg_cv_[]$1="$$1"
1143b4485a66Smrg elif test -n "$PKG_CONFIG"; then
1144b4485a66Smrg    PKG_CHECK_EXISTS([$3],
1145b4485a66Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1146b4485a66Smrg		     [pkg_failed=yes])
1147b4485a66Smrg else
1148b4485a66Smrg    pkg_failed=untried
1149b4485a66Smrgfi[]dnl
1150b4485a66Smrg])# _PKG_CONFIG
1151b4485a66Smrg
1152b4485a66Smrg# _PKG_SHORT_ERRORS_SUPPORTED
1153b4485a66Smrg# -----------------------------
1154b4485a66SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1155b4485a66Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1156b4485a66Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1157b4485a66Smrg        _pkg_short_errors_supported=yes
1158b4485a66Smrgelse
1159b4485a66Smrg        _pkg_short_errors_supported=no
1160b4485a66Smrgfi[]dnl
1161b4485a66Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
1162b4485a66Smrg
1163b4485a66Smrg
1164b4485a66Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1165b4485a66Smrg# [ACTION-IF-NOT-FOUND])
1166b4485a66Smrg#
1167b4485a66Smrg#
1168b4485a66Smrg# Note that if there is a possibility the first call to
1169b4485a66Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1170b4485a66Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1171b4485a66Smrg#
1172b4485a66Smrg#
1173b4485a66Smrg# --------------------------------------------------------------
1174b4485a66SmrgAC_DEFUN([PKG_CHECK_MODULES],
1175b4485a66Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1176b4485a66SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1177b4485a66SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1178b4485a66Smrg
1179b4485a66Smrgpkg_failed=no
1180b4485a66SmrgAC_MSG_CHECKING([for $1])
1181b4485a66Smrg
1182b4485a66Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1183b4485a66Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1184b4485a66Smrg
1185b4485a66Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1186b4485a66Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1187b4485a66SmrgSee the pkg-config man page for more details.])
1188b4485a66Smrg
1189b4485a66Smrgif test $pkg_failed = yes; then
1190b4485a66Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1191b4485a66Smrg        if test $_pkg_short_errors_supported = yes; then
1192b4485a66Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1193b4485a66Smrg        else 
1194b4485a66Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1195b4485a66Smrg        fi
1196b4485a66Smrg	# Put the nasty error message in config.log where it belongs
1197b4485a66Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1198b4485a66Smrg
1199b4485a66Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
1200b4485a66Smrg[Package requirements ($2) were not met:
1201b4485a66Smrg
1202b4485a66Smrg$$1_PKG_ERRORS
1203b4485a66Smrg
1204b4485a66SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1205b4485a66Smrginstalled software in a non-standard prefix.
1206b4485a66Smrg
1207b4485a66Smrg_PKG_TEXT
1208b4485a66Smrg])],
1209b4485a66Smrg		[AC_MSG_RESULT([no])
1210b4485a66Smrg                $4])
1211b4485a66Smrgelif test $pkg_failed = untried; then
1212b4485a66Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
1213b4485a66Smrg[The pkg-config script could not be found or is too old.  Make sure it
1214b4485a66Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1215b4485a66Smrgpath to pkg-config.
1216b4485a66Smrg
1217b4485a66Smrg_PKG_TEXT
1218b4485a66Smrg
1219b4485a66SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1220b4485a66Smrg		[$4])
1221b4485a66Smrgelse
1222b4485a66Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1223b4485a66Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1224b4485a66Smrg        AC_MSG_RESULT([yes])
1225b4485a66Smrg	ifelse([$3], , :, [$3])
1226b4485a66Smrgfi[]dnl
1227b4485a66Smrg])# PKG_CHECK_MODULES
1228b4485a66Smrg
1229b3eb03f3Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1230b3eb03f3Smrgdnl
1231af23b0a6Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1232b3eb03f3Smrgdnl 
1233b3eb03f3Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1234af23b0a6Smrgdnl copy of this software and associated documentation files (the "Software"),
1235af23b0a6Smrgdnl to deal in the Software without restriction, including without limitation
1236af23b0a6Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1237af23b0a6Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1238af23b0a6Smrgdnl Software is furnished to do so, subject to the following conditions:
1239b3eb03f3Smrgdnl
1240af23b0a6Smrgdnl The above copyright notice and this permission notice (including the next
1241af23b0a6Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1242af23b0a6Smrgdnl Software.
1243b3eb03f3Smrgdnl
1244af23b0a6Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1245af23b0a6Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1246af23b0a6Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1247af23b0a6Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1248af23b0a6Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1249af23b0a6Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1250af23b0a6Smrgdnl DEALINGS IN THE SOFTWARE.
1251b3eb03f3Smrg
1252b3eb03f3Smrg# XORG_MACROS_VERSION(required-version)
1253b3eb03f3Smrg# -------------------------------------
1254b3eb03f3Smrg# Minimum version: 1.1.0
1255b3eb03f3Smrg#
1256b3eb03f3Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1257b3eb03f3Smrg# your configure.ac with the minimum required version, such as:
1258b3eb03f3Smrg# XORG_MACROS_VERSION(1.1)
1259b3eb03f3Smrg#
1260b3eb03f3Smrg# To ensure that this macro is defined, also add:
1261b3eb03f3Smrg# m4_ifndef([XORG_MACROS_VERSION],
1262b3eb03f3Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1263b3eb03f3Smrg#
1264b3eb03f3Smrg#
1265b3eb03f3Smrg# See the "minimum version" comment for each macro you use to see what 
1266b3eb03f3Smrg# version you require.
1267b3eb03f3Smrgm4_defun([XORG_MACROS_VERSION],[
1268b4485a66Smrgm4_define([vers_have], [1.17])
1269b3eb03f3Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1270b3eb03f3Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1271b3eb03f3Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1272b3eb03f3Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1273b3eb03f3Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1274b3eb03f3Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1275b3eb03f3Smrgm4_undefine([vers_have])
1276b3eb03f3Smrgm4_undefine([maj_have])
1277b3eb03f3Smrgm4_undefine([maj_needed])
1278b3eb03f3Smrg]) # XORG_MACROS_VERSION
1279b3eb03f3Smrg
1280b3eb03f3Smrg# XORG_PROG_RAWCPP()
1281b3eb03f3Smrg# ------------------
1282b3eb03f3Smrg# Minimum version: 1.0.0
1283b3eb03f3Smrg#
1284b3eb03f3Smrg# Find cpp program and necessary flags for use in pre-processing text files
1285b3eb03f3Smrg# such as man pages and config files
1286b3eb03f3SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1287b3eb03f3SmrgAC_REQUIRE([AC_PROG_CPP])
1288b3eb03f3SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
1289b3eb03f3Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1290b3eb03f3Smrg
1291b3eb03f3Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1292b3eb03f3Smrg# which is not the best choice for supporting other OS'es, but covers most
1293b3eb03f3Smrg# of the ones we need for now.
1294b3eb03f3SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1295b4485a66SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1296b3eb03f3Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1297b3eb03f3Smrg	AC_MSG_RESULT([no])
1298b3eb03f3Smrgelse
1299b3eb03f3Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1300b3eb03f3Smrg		RAWCPPFLAGS=-undef
1301b3eb03f3Smrg		AC_MSG_RESULT([yes])
1302b3eb03f3Smrg	# under Cygwin unix is still defined even with -undef
1303b3eb03f3Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1304b3eb03f3Smrg		RAWCPPFLAGS="-undef -ansi"
1305b3eb03f3Smrg		AC_MSG_RESULT([yes, with -ansi])
1306b3eb03f3Smrg	else
1307b3eb03f3Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1308b3eb03f3Smrg	fi
1309b3eb03f3Smrgfi
1310b3eb03f3Smrgrm -f conftest.$ac_ext
1311010cdda0Smrg
1312b3eb03f3SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1313b4485a66SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1314b3eb03f3Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1315b3eb03f3Smrg	AC_MSG_RESULT([no])
1316b3eb03f3Smrgelse
1317b3eb03f3Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1318b3eb03f3Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1319b3eb03f3Smrg		AC_MSG_RESULT([yes])
1320b3eb03f3Smrg	else
1321b3eb03f3Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1322b3eb03f3Smrg	fi
1323b3eb03f3Smrgfi
1324b3eb03f3Smrgrm -f conftest.$ac_ext
1325b3eb03f3SmrgAC_SUBST(RAWCPPFLAGS)
1326b3eb03f3Smrg]) # XORG_PROG_RAWCPP
1327010cdda0Smrg
1328b3eb03f3Smrg# XORG_MANPAGE_SECTIONS()
1329b3eb03f3Smrg# -----------------------
1330b3eb03f3Smrg# Minimum version: 1.0.0
1331b3eb03f3Smrg#
1332b3eb03f3Smrg# Determine which sections man pages go in for the different man page types
1333b3eb03f3Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1334b3eb03f3Smrg# Not sure if there's any better way than just hardcoding by OS name.
1335b3eb03f3Smrg# Override default settings by setting environment variables
1336af23b0a6Smrg# Added MAN_SUBSTS in version 1.8
1337af23b0a6Smrg# Added AC_PROG_SED in version 1.8
1338010cdda0Smrg
1339b3eb03f3SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1340b3eb03f3SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1341af23b0a6SmrgAC_REQUIRE([AC_PROG_SED])
1342010cdda0Smrg
1343b3eb03f3Smrgif test x$APP_MAN_SUFFIX = x    ; then
1344b3eb03f3Smrg    APP_MAN_SUFFIX=1
1345b3eb03f3Smrgfi
1346b3eb03f3Smrgif test x$APP_MAN_DIR = x    ; then
1347b3eb03f3Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1348b3eb03f3Smrgfi
1349010cdda0Smrg
1350b3eb03f3Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1351b3eb03f3Smrg    LIB_MAN_SUFFIX=3
1352b3eb03f3Smrgfi
1353b3eb03f3Smrgif test x$LIB_MAN_DIR = x    ; then
1354b3eb03f3Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1355b3eb03f3Smrgfi
1356010cdda0Smrg
1357b3eb03f3Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1358b3eb03f3Smrg    case $host_os in
1359b3eb03f3Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1360b3eb03f3Smrg	*)		FILE_MAN_SUFFIX=5  ;;
1361b3eb03f3Smrg    esac
1362b3eb03f3Smrgfi
1363b3eb03f3Smrgif test x$FILE_MAN_DIR = x    ; then
1364b3eb03f3Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1365b3eb03f3Smrgfi
1366010cdda0Smrg
1367b3eb03f3Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1368b3eb03f3Smrg    case $host_os in
1369b3eb03f3Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1370b3eb03f3Smrg	*)		MISC_MAN_SUFFIX=7  ;;
1371b3eb03f3Smrg    esac
1372b3eb03f3Smrgfi
1373b3eb03f3Smrgif test x$MISC_MAN_DIR = x    ; then
1374b3eb03f3Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1375b3eb03f3Smrgfi
1376010cdda0Smrg
1377b3eb03f3Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1378b3eb03f3Smrg    case $host_os in
1379b3eb03f3Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1380b3eb03f3Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1381b3eb03f3Smrg    esac
1382b3eb03f3Smrgfi
1383b3eb03f3Smrgif test x$DRIVER_MAN_DIR = x    ; then
1384b3eb03f3Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1385b3eb03f3Smrgfi
1386010cdda0Smrg
1387b3eb03f3Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1388b3eb03f3Smrg    case $host_os in
1389b3eb03f3Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1390b3eb03f3Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1391b3eb03f3Smrg    esac
1392b3eb03f3Smrgfi
1393b3eb03f3Smrgif test x$ADMIN_MAN_DIR = x    ; then
1394b3eb03f3Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1395b3eb03f3Smrgfi
1396010cdda0Smrg
1397010cdda0Smrg
1398b3eb03f3SmrgAC_SUBST([APP_MAN_SUFFIX])
1399b3eb03f3SmrgAC_SUBST([LIB_MAN_SUFFIX])
1400b3eb03f3SmrgAC_SUBST([FILE_MAN_SUFFIX])
1401b3eb03f3SmrgAC_SUBST([MISC_MAN_SUFFIX])
1402b3eb03f3SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1403b3eb03f3SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1404b3eb03f3SmrgAC_SUBST([APP_MAN_DIR])
1405b3eb03f3SmrgAC_SUBST([LIB_MAN_DIR])
1406b3eb03f3SmrgAC_SUBST([FILE_MAN_DIR])
1407b3eb03f3SmrgAC_SUBST([MISC_MAN_DIR])
1408b3eb03f3SmrgAC_SUBST([DRIVER_MAN_DIR])
1409b3eb03f3SmrgAC_SUBST([ADMIN_MAN_DIR])
1410af23b0a6Smrg
1411af23b0a6SmrgXORG_MAN_PAGE="X Version 11"
1412af23b0a6SmrgAC_SUBST([XORG_MAN_PAGE])
1413af23b0a6SmrgMAN_SUBSTS="\
1414af23b0a6Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1415af23b0a6Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1416af23b0a6Smrg	-e 's|__xservername__|Xorg|g' \
1417af23b0a6Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1418af23b0a6Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1419af23b0a6Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1420af23b0a6Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1421af23b0a6Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1422af23b0a6Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1423af23b0a6Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1424af23b0a6Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1425af23b0a6Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1426af23b0a6SmrgAC_SUBST([MAN_SUBSTS])
1427af23b0a6Smrg
1428b3eb03f3Smrg]) # XORG_MANPAGE_SECTIONS
1429b3eb03f3Smrg
1430af23b0a6Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1431af23b0a6Smrg# ------------------------
1432af23b0a6Smrg# Minimum version: 1.7.0
1433af23b0a6Smrg#
1434af23b0a6Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1435af23b0a6Smrg# provided by xorg-sgml-doctools, if installed.
1436af23b0a6SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1437af23b0a6SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1438af23b0a6SmrgXORG_SGML_PATH=
1439af23b0a6SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1440af23b0a6Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1441af23b0a6Smrg    [m4_ifval([$1],[:],
1442af23b0a6Smrg        [if test x"$cross_compiling" != x"yes" ; then
1443af23b0a6Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1444af23b0a6Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1445af23b0a6Smrg         fi])
1446af23b0a6Smrg    ])
1447af23b0a6Smrg
1448af23b0a6Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1449af23b0a6Smrg# the path and the name of the doc stylesheet
1450af23b0a6Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1451af23b0a6Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1452af23b0a6Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1453af23b0a6Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1454af23b0a6Smrgelse
1455af23b0a6Smrg   AC_MSG_RESULT([no])
1456af23b0a6Smrgfi
1457af23b0a6Smrg
1458af23b0a6SmrgAC_SUBST(XORG_SGML_PATH)
1459af23b0a6SmrgAC_SUBST(STYLESHEET_SRCDIR)
1460af23b0a6SmrgAC_SUBST(XSL_STYLESHEET)
1461af23b0a6SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1462af23b0a6Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1463af23b0a6Smrg
1464b3eb03f3Smrg# XORG_CHECK_LINUXDOC
1465b3eb03f3Smrg# -------------------
1466b3eb03f3Smrg# Minimum version: 1.0.0
1467b3eb03f3Smrg#
1468b3eb03f3Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1469b3eb03f3Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1470b3eb03f3Smrg# Whether or not the necessary tools and files are found can be checked
1471b3eb03f3Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1472b3eb03f3SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1473af23b0a6SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1474af23b0a6SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1475010cdda0Smrg
1476b3eb03f3SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1477010cdda0Smrg
1478af23b0a6SmrgAC_MSG_CHECKING([whether to build documentation])
1479010cdda0Smrg
1480af23b0a6Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1481b3eb03f3Smrg   BUILDDOC=yes
1482b3eb03f3Smrgelse
1483b3eb03f3Smrg   BUILDDOC=no
1484010cdda0Smrgfi
1485010cdda0Smrg
1486b3eb03f3SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1487010cdda0Smrg
1488b3eb03f3SmrgAC_MSG_RESULT([$BUILDDOC])
1489010cdda0Smrg
1490af23b0a6SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1491010cdda0Smrg
1492af23b0a6Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1493b3eb03f3Smrg   BUILDPDFDOC=yes
1494b3eb03f3Smrgelse
1495b3eb03f3Smrg   BUILDPDFDOC=no
1496b3eb03f3Smrgfi
1497010cdda0Smrg
1498b3eb03f3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1499010cdda0Smrg
1500b3eb03f3SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1501010cdda0Smrg
1502af23b0a6SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1503b3eb03f3SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1504b3eb03f3SmrgMAKE_PDF="$PS2PDF"
1505b3eb03f3SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1506010cdda0Smrg
1507b3eb03f3SmrgAC_SUBST(MAKE_TEXT)
1508b3eb03f3SmrgAC_SUBST(MAKE_PS)
1509b3eb03f3SmrgAC_SUBST(MAKE_PDF)
1510b3eb03f3SmrgAC_SUBST(MAKE_HTML)
1511b3eb03f3Smrg]) # XORG_CHECK_LINUXDOC
1512b3eb03f3Smrg
1513b3eb03f3Smrg# XORG_CHECK_DOCBOOK
1514b3eb03f3Smrg# -------------------
1515b3eb03f3Smrg# Minimum version: 1.0.0
1516b3eb03f3Smrg#
1517b3eb03f3Smrg# Checks for the ability to build output formats from SGML DocBook source.
1518b3eb03f3Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1519b3eb03f3Smrg# indicates whether the necessary tools and files are found and, if set,
1520b3eb03f3Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1521b3eb03f3SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1522af23b0a6SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1523af23b0a6Smrg
1524b3eb03f3SmrgBUILDTXTDOC=no
1525b3eb03f3SmrgBUILDPDFDOC=no
1526b3eb03f3SmrgBUILDPSDOC=no
1527b3eb03f3SmrgBUILDHTMLDOC=no
1528b3eb03f3Smrg
1529b3eb03f3SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1530b3eb03f3SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1531b3eb03f3SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1532b3eb03f3SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1533b3eb03f3Smrg
1534af23b0a6SmrgAC_MSG_CHECKING([whether to build text documentation])
1535af23b0a6Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1536b3eb03f3Smrg   test x$BUILD_TXTDOC != xno; then
1537b3eb03f3Smrg	BUILDTXTDOC=yes
1538b3eb03f3Smrgfi
1539b3eb03f3SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1540b3eb03f3SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1541010cdda0Smrg
1542af23b0a6SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1543af23b0a6Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1544b3eb03f3Smrg   test x$BUILD_PDFDOC != xno; then
1545b3eb03f3Smrg	BUILDPDFDOC=yes
1546b3eb03f3Smrgfi
1547b3eb03f3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1548b3eb03f3SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1549010cdda0Smrg
1550af23b0a6SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1551af23b0a6Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1552b3eb03f3Smrg   test x$BUILD_PSDOC != xno; then
1553b3eb03f3Smrg	BUILDPSDOC=yes
1554b3eb03f3Smrgfi
1555b3eb03f3SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1556b3eb03f3SmrgAC_MSG_RESULT([$BUILDPSDOC])
1557010cdda0Smrg
1558af23b0a6SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1559af23b0a6Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1560b3eb03f3Smrg   test x$BUILD_HTMLDOC != xno; then
1561b3eb03f3Smrg	BUILDHTMLDOC=yes
1562b3eb03f3Smrgfi
1563b3eb03f3SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1564b3eb03f3SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1565010cdda0Smrg
1566b3eb03f3SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1567b3eb03f3SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1568b3eb03f3SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1569b3eb03f3SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1570010cdda0Smrg
1571b3eb03f3SmrgAC_SUBST(MAKE_TEXT)
1572b3eb03f3SmrgAC_SUBST(MAKE_PS)
1573b3eb03f3SmrgAC_SUBST(MAKE_PDF)
1574b3eb03f3SmrgAC_SUBST(MAKE_HTML)
1575b3eb03f3Smrg]) # XORG_CHECK_DOCBOOK
1576010cdda0Smrg
1577af23b0a6Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1578af23b0a6Smrg# ----------------
1579af23b0a6Smrg# Minimum version: 1.5.0
1580af23b0a6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1581af23b0a6Smrg#
1582af23b0a6Smrg# Documentation tools are not always available on all platforms and sometimes
1583af23b0a6Smrg# not at the appropriate level. This macro enables a module to test for the
1584af23b0a6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1585af23b0a6Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1586af23b0a6Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1587af23b0a6Smrg# --with-xmlto assumes 'auto'.
1588af23b0a6Smrg#
1589af23b0a6Smrg# Interface to module:
1590af23b0a6Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1591af23b0a6Smrg# XMLTO:	returns the path of the xmlto program found
1592af23b0a6Smrg#		returns the path set by the user in the environment
1593af23b0a6Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1594af23b0a6Smrg#		'no' user instructs the module not to use xmlto
1595af23b0a6Smrg#
1596af23b0a6Smrg# Added in version 1.10.0
1597af23b0a6Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1598af23b0a6Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1599af23b0a6Smrg#
1600af23b0a6Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1601af23b0a6Smrg#
1602af23b0a6SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1603af23b0a6SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1604af23b0a6Smrgm4_define([_defopt], m4_default([$2], [auto]))
1605af23b0a6SmrgAC_ARG_WITH(xmlto,
1606af23b0a6Smrg	AS_HELP_STRING([--with-xmlto],
1607af23b0a6Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1608af23b0a6Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1609af23b0a6Smrgm4_undefine([_defopt])
1610af23b0a6Smrg
1611af23b0a6Smrgif test "x$use_xmlto" = x"auto"; then
1612af23b0a6Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1613af23b0a6Smrg   if test "x$XMLTO" = "x"; then
1614af23b0a6Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1615af23b0a6Smrg	have_xmlto=no
1616af23b0a6Smrg   else
1617af23b0a6Smrg        have_xmlto=yes
1618af23b0a6Smrg   fi
1619af23b0a6Smrgelif test "x$use_xmlto" = x"yes" ; then
1620af23b0a6Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1621af23b0a6Smrg   if test "x$XMLTO" = "x"; then
1622af23b0a6Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1623af23b0a6Smrg   fi
1624af23b0a6Smrg   have_xmlto=yes
1625af23b0a6Smrgelif test "x$use_xmlto" = x"no" ; then
1626af23b0a6Smrg   if test "x$XMLTO" != "x"; then
1627af23b0a6Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1628af23b0a6Smrg   fi
1629af23b0a6Smrg   have_xmlto=no
1630af23b0a6Smrgelse
1631af23b0a6Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1632af23b0a6Smrgfi
1633af23b0a6Smrg
1634af23b0a6Smrg# Test for a minimum version of xmlto, if provided.
1635af23b0a6Smrgm4_ifval([$1],
1636af23b0a6Smrg[if test "$have_xmlto" = yes; then
1637af23b0a6Smrg    # scrape the xmlto version
1638af23b0a6Smrg    AC_MSG_CHECKING([the xmlto version])
1639af23b0a6Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1640af23b0a6Smrg    AC_MSG_RESULT([$xmlto_version])
1641af23b0a6Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1642af23b0a6Smrg        [if test "x$use_xmlto" = xauto; then
1643af23b0a6Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1644af23b0a6Smrg            have_xmlto=no
1645af23b0a6Smrg        else
1646af23b0a6Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1647af23b0a6Smrg        fi])
1648af23b0a6Smrgfi])
1649af23b0a6Smrg
1650af23b0a6Smrg# Test for the ability of xmlto to generate a text target
1651af23b0a6Smrghave_xmlto_text=no
1652af23b0a6Smrgcat > conftest.xml << "EOF"
1653af23b0a6SmrgEOF
1654af23b0a6SmrgAS_IF([test "$have_xmlto" = yes],
1655af23b0a6Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1656af23b0a6Smrg             [have_xmlto_text=yes],
1657af23b0a6Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1658af23b0a6Smrgrm -f conftest.xml
1659af23b0a6SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1660af23b0a6SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1661af23b0a6Smrg]) # XORG_WITH_XMLTO
1662af23b0a6Smrg
1663b4485a66Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1664b4485a66Smrg# --------------------------------------------
1665b4485a66Smrg# Minimum version: 1.12.0
1666b4485a66Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1667b4485a66Smrg#
1668b4485a66Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1669b4485a66Smrg# XML-based language used for the transformation of XML documents.
1670b4485a66Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1671b4485a66Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1672b4485a66Smrg# The XSLT processor is often used as a standalone tool for transformations.
1673b4485a66Smrg# It should not be assumed that this tool is used only to work with documnetation.
1674b4485a66Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1675b4485a66Smrg#
1676b4485a66Smrg# Interface to module:
1677b4485a66Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1678b4485a66Smrg# XSLTPROC:	 returns the path of the xsltproc program found
1679b4485a66Smrg#		 returns the path set by the user in the environment
1680b4485a66Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1681b4485a66Smrg#		  'no' user instructs the module not to use xsltproc
1682b4485a66Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1683b4485a66Smrg#
1684b4485a66Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1685b4485a66Smrg#
1686b4485a66SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1687b4485a66SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1688b4485a66Smrg# Preserves the interface, should it be implemented later
1689b4485a66Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1690b4485a66Smrgm4_define([_defopt], m4_default([$2], [auto]))
1691b4485a66SmrgAC_ARG_WITH(xsltproc,
1692b4485a66Smrg	AS_HELP_STRING([--with-xsltproc],
1693b4485a66Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1694b4485a66Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1695b4485a66Smrgm4_undefine([_defopt])
1696b4485a66Smrg
1697b4485a66Smrgif test "x$use_xsltproc" = x"auto"; then
1698b4485a66Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1699b4485a66Smrg   if test "x$XSLTPROC" = "x"; then
1700b4485a66Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1701b4485a66Smrg	have_xsltproc=no
1702b4485a66Smrg   else
1703b4485a66Smrg        have_xsltproc=yes
1704b4485a66Smrg   fi
1705b4485a66Smrgelif test "x$use_xsltproc" = x"yes" ; then
1706b4485a66Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1707b4485a66Smrg   if test "x$XSLTPROC" = "x"; then
1708b4485a66Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1709b4485a66Smrg   fi
1710b4485a66Smrg   have_xsltproc=yes
1711b4485a66Smrgelif test "x$use_xsltproc" = x"no" ; then
1712b4485a66Smrg   if test "x$XSLTPROC" != "x"; then
1713b4485a66Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1714b4485a66Smrg   fi
1715b4485a66Smrg   have_xsltproc=no
1716b4485a66Smrgelse
1717b4485a66Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1718b4485a66Smrgfi
1719b4485a66Smrg
1720b4485a66SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1721b4485a66Smrg]) # XORG_WITH_XSLTPROC
1722b4485a66Smrg
1723b4485a66Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1724b4485a66Smrg# ----------------------------------------
1725b4485a66Smrg# Minimum version: 1.15.0
1726b4485a66Smrg#
1727b4485a66Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
1728b4485a66Smrg# scanning arbitrary text files, extracting information from those text files,
1729b4485a66Smrg# and printing reports based on that information.
1730b4485a66Smrg#
1731b4485a66Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1732b4485a66Smrg#
1733b4485a66Smrg# Interface to module:
1734b4485a66Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
1735b4485a66Smrg# PERL:	     returns the path of the perl program found
1736b4485a66Smrg#	     returns the path set by the user in the environment
1737b4485a66Smrg# --with-perl: 'yes' user instructs the module to use perl
1738b4485a66Smrg#	       'no' user instructs the module not to use perl
1739b4485a66Smrg# have_perl: returns yes if perl found in PATH or no
1740b4485a66Smrg#
1741b4485a66Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1742b4485a66Smrg#
1743b4485a66SmrgAC_DEFUN([XORG_WITH_PERL],[
1744b4485a66SmrgAC_ARG_VAR([PERL], [Path to perl command])
1745b4485a66Smrg# Preserves the interface, should it be implemented later
1746b4485a66Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1747b4485a66Smrgm4_define([_defopt], m4_default([$2], [auto]))
1748b4485a66SmrgAC_ARG_WITH(perl,
1749b4485a66Smrg	AS_HELP_STRING([--with-perl],
1750b4485a66Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1751b4485a66Smrg	   [use_perl=$withval], [use_perl=]_defopt)
1752b4485a66Smrgm4_undefine([_defopt])
1753b4485a66Smrg
1754b4485a66Smrgif test "x$use_perl" = x"auto"; then
1755b4485a66Smrg   AC_PATH_PROG([PERL], [perl])
1756b4485a66Smrg   if test "x$PERL" = "x"; then
1757b4485a66Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1758b4485a66Smrg	have_perl=no
1759b4485a66Smrg   else
1760b4485a66Smrg        have_perl=yes
1761b4485a66Smrg   fi
1762b4485a66Smrgelif test "x$use_perl" = x"yes" ; then
1763b4485a66Smrg   AC_PATH_PROG([PERL], [perl])
1764b4485a66Smrg   if test "x$PERL" = "x"; then
1765b4485a66Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1766b4485a66Smrg   fi
1767b4485a66Smrg   have_perl=yes
1768b4485a66Smrgelif test "x$use_perl" = x"no" ; then
1769b4485a66Smrg   if test "x$PERL" != "x"; then
1770b4485a66Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1771b4485a66Smrg   fi
1772b4485a66Smrg   have_perl=no
1773b4485a66Smrgelse
1774b4485a66Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1775b4485a66Smrgfi
1776b4485a66Smrg
1777b4485a66SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1778b4485a66Smrg]) # XORG_WITH_PERL
1779b4485a66Smrg
1780af23b0a6Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1781af23b0a6Smrg# ----------------
1782af23b0a6Smrg# Minimum version: 1.5.0
1783af23b0a6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1784af23b0a6Smrg#
1785af23b0a6Smrg# Documentation tools are not always available on all platforms and sometimes
1786af23b0a6Smrg# not at the appropriate level. This macro enables a module to test for the
1787af23b0a6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1788af23b0a6Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1789af23b0a6Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1790af23b0a6Smrg# --with-asciidoc assumes 'auto'.
1791af23b0a6Smrg#
1792af23b0a6Smrg# Interface to module:
1793af23b0a6Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1794af23b0a6Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
1795af23b0a6Smrg#		 returns the path set by the user in the environment
1796af23b0a6Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1797af23b0a6Smrg#		  'no' user instructs the module not to use asciidoc
1798af23b0a6Smrg#
1799af23b0a6Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1800af23b0a6Smrg#
1801af23b0a6SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1802af23b0a6SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1803af23b0a6Smrgm4_define([_defopt], m4_default([$2], [auto]))
1804af23b0a6SmrgAC_ARG_WITH(asciidoc,
1805af23b0a6Smrg	AS_HELP_STRING([--with-asciidoc],
1806af23b0a6Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1807af23b0a6Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1808af23b0a6Smrgm4_undefine([_defopt])
1809af23b0a6Smrg
1810af23b0a6Smrgif test "x$use_asciidoc" = x"auto"; then
1811af23b0a6Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1812af23b0a6Smrg   if test "x$ASCIIDOC" = "x"; then
1813af23b0a6Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1814af23b0a6Smrg	have_asciidoc=no
1815af23b0a6Smrg   else
1816af23b0a6Smrg        have_asciidoc=yes
1817af23b0a6Smrg   fi
1818af23b0a6Smrgelif test "x$use_asciidoc" = x"yes" ; then
1819af23b0a6Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1820af23b0a6Smrg   if test "x$ASCIIDOC" = "x"; then
1821af23b0a6Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1822af23b0a6Smrg   fi
1823af23b0a6Smrg   have_asciidoc=yes
1824af23b0a6Smrgelif test "x$use_asciidoc" = x"no" ; then
1825af23b0a6Smrg   if test "x$ASCIIDOC" != "x"; then
1826af23b0a6Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1827af23b0a6Smrg   fi
1828af23b0a6Smrg   have_asciidoc=no
1829af23b0a6Smrgelse
1830af23b0a6Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1831af23b0a6Smrgfi
1832af23b0a6Smrgm4_ifval([$1],
1833af23b0a6Smrg[if test "$have_asciidoc" = yes; then
1834af23b0a6Smrg    # scrape the asciidoc version
1835af23b0a6Smrg    AC_MSG_CHECKING([the asciidoc version])
1836af23b0a6Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1837af23b0a6Smrg    AC_MSG_RESULT([$asciidoc_version])
1838af23b0a6Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1839af23b0a6Smrg        [if test "x$use_asciidoc" = xauto; then
1840af23b0a6Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1841af23b0a6Smrg            have_asciidoc=no
1842af23b0a6Smrg        else
1843af23b0a6Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1844af23b0a6Smrg        fi])
1845af23b0a6Smrgfi])
1846af23b0a6SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1847af23b0a6Smrg]) # XORG_WITH_ASCIIDOC
1848af23b0a6Smrg
1849af23b0a6Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1850af23b0a6Smrg# --------------------------------
1851af23b0a6Smrg# Minimum version: 1.5.0
1852af23b0a6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1853af23b0a6Smrg#
1854af23b0a6Smrg# Documentation tools are not always available on all platforms and sometimes
1855af23b0a6Smrg# not at the appropriate level. This macro enables a module to test for the
1856af23b0a6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1857af23b0a6Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1858af23b0a6Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1859af23b0a6Smrg# --with-doxygen assumes 'auto'.
1860af23b0a6Smrg#
1861af23b0a6Smrg# Interface to module:
1862af23b0a6Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1863af23b0a6Smrg# DOXYGEN:	 returns the path of the doxygen program found
1864af23b0a6Smrg#		 returns the path set by the user in the environment
1865af23b0a6Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1866af23b0a6Smrg#		  'no' user instructs the module not to use doxygen
1867af23b0a6Smrg#
1868af23b0a6Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1869af23b0a6Smrg#
1870af23b0a6SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1871af23b0a6SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1872af23b0a6Smrgm4_define([_defopt], m4_default([$2], [auto]))
1873af23b0a6SmrgAC_ARG_WITH(doxygen,
1874af23b0a6Smrg	AS_HELP_STRING([--with-doxygen],
1875af23b0a6Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1876af23b0a6Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1877af23b0a6Smrgm4_undefine([_defopt])
1878af23b0a6Smrg
1879af23b0a6Smrgif test "x$use_doxygen" = x"auto"; then
1880af23b0a6Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1881af23b0a6Smrg   if test "x$DOXYGEN" = "x"; then
1882af23b0a6Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1883af23b0a6Smrg	have_doxygen=no
1884af23b0a6Smrg   else
1885af23b0a6Smrg        have_doxygen=yes
1886af23b0a6Smrg   fi
1887af23b0a6Smrgelif test "x$use_doxygen" = x"yes" ; then
1888af23b0a6Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1889af23b0a6Smrg   if test "x$DOXYGEN" = "x"; then
1890af23b0a6Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1891af23b0a6Smrg   fi
1892af23b0a6Smrg   have_doxygen=yes
1893af23b0a6Smrgelif test "x$use_doxygen" = x"no" ; then
1894af23b0a6Smrg   if test "x$DOXYGEN" != "x"; then
1895af23b0a6Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1896af23b0a6Smrg   fi
1897af23b0a6Smrg   have_doxygen=no
1898af23b0a6Smrgelse
1899af23b0a6Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1900af23b0a6Smrgfi
1901af23b0a6Smrgm4_ifval([$1],
1902af23b0a6Smrg[if test "$have_doxygen" = yes; then
1903af23b0a6Smrg    # scrape the doxygen version
1904af23b0a6Smrg    AC_MSG_CHECKING([the doxygen version])
1905af23b0a6Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1906af23b0a6Smrg    AC_MSG_RESULT([$doxygen_version])
1907af23b0a6Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1908af23b0a6Smrg        [if test "x$use_doxygen" = xauto; then
1909af23b0a6Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1910af23b0a6Smrg            have_doxygen=no
1911af23b0a6Smrg        else
1912af23b0a6Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1913af23b0a6Smrg        fi])
1914af23b0a6Smrgfi])
1915af23b0a6SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
1916af23b0a6Smrg]) # XORG_WITH_DOXYGEN
1917af23b0a6Smrg
1918af23b0a6Smrg# XORG_WITH_GROFF([DEFAULT])
1919af23b0a6Smrg# ----------------
1920af23b0a6Smrg# Minimum version: 1.6.0
1921af23b0a6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1922af23b0a6Smrg#
1923af23b0a6Smrg# Documentation tools are not always available on all platforms and sometimes
1924af23b0a6Smrg# not at the appropriate level. This macro enables a module to test for the
1925af23b0a6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1926af23b0a6Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
1927af23b0a6Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
1928af23b0a6Smrg# --with-groff assumes 'auto'.
1929af23b0a6Smrg#
1930af23b0a6Smrg# Interface to module:
1931af23b0a6Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
1932af23b0a6Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
1933af23b0a6Smrg# HAVE_GROFF_MS: the -ms macros package
1934af23b0a6Smrg# GROFF:	 returns the path of the groff program found
1935af23b0a6Smrg#		 returns the path set by the user in the environment
1936af23b0a6Smrg# --with-groff:	 'yes' user instructs the module to use groff
1937af23b0a6Smrg#		 'no' user instructs the module not to use groff
1938af23b0a6Smrg#
1939af23b0a6Smrg# Added in version 1.9.0:
1940af23b0a6Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
1941af23b0a6Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
1942af23b0a6Smrg#		   psselect from the psutils package.
1943af23b0a6Smrg#		   the ghostcript package. Refer to the grohtml man pages
1944af23b0a6Smrg#
1945af23b0a6Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
1946af23b0a6Smrg#
1947af23b0a6Smrg# OS and distros often splits groff in a basic and full package, the former
1948af23b0a6Smrg# having the groff program and the later having devices, fonts and macros
1949af23b0a6Smrg# Checking for the groff executable is not enough.
1950af23b0a6Smrg#
1951af23b0a6Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
1952af23b0a6Smrg# unset HAVE_GROFF or GROFF env variables.
1953af23b0a6Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
1954af23b0a6Smrg#
1955af23b0a6SmrgAC_DEFUN([XORG_WITH_GROFF],[
1956af23b0a6SmrgAC_ARG_VAR([GROFF], [Path to groff command])
1957af23b0a6Smrgm4_define([_defopt], m4_default([$1], [auto]))
1958af23b0a6SmrgAC_ARG_WITH(groff,
1959af23b0a6Smrg	AS_HELP_STRING([--with-groff],
1960af23b0a6Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
1961af23b0a6Smrg	   [use_groff=$withval], [use_groff=]_defopt)
1962af23b0a6Smrgm4_undefine([_defopt])
1963af23b0a6Smrg
1964af23b0a6Smrgif test "x$use_groff" = x"auto"; then
1965af23b0a6Smrg   AC_PATH_PROG([GROFF], [groff])
1966af23b0a6Smrg   if test "x$GROFF" = "x"; then
1967af23b0a6Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
1968af23b0a6Smrg	have_groff=no
1969af23b0a6Smrg   else
1970af23b0a6Smrg        have_groff=yes
1971af23b0a6Smrg   fi
1972af23b0a6Smrgelif test "x$use_groff" = x"yes" ; then
1973af23b0a6Smrg   AC_PATH_PROG([GROFF], [groff])
1974af23b0a6Smrg   if test "x$GROFF" = "x"; then
1975af23b0a6Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
1976af23b0a6Smrg   fi
1977af23b0a6Smrg   have_groff=yes
1978af23b0a6Smrgelif test "x$use_groff" = x"no" ; then
1979af23b0a6Smrg   if test "x$GROFF" != "x"; then
1980af23b0a6Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
1981af23b0a6Smrg   fi
1982af23b0a6Smrg   have_groff=no
1983af23b0a6Smrgelse
1984af23b0a6Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1985af23b0a6Smrgfi
1986af23b0a6Smrg
1987af23b0a6Smrg# We have groff, test for the presence of the macro packages
1988af23b0a6Smrgif test "x$have_groff" = x"yes"; then
1989af23b0a6Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
1990af23b0a6Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
1991af23b0a6Smrg        groff_ms_works=yes
1992af23b0a6Smrg    else
1993af23b0a6Smrg        groff_ms_works=no
1994af23b0a6Smrg    fi
1995af23b0a6Smrg    AC_MSG_RESULT([$groff_ms_works])
1996af23b0a6Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
1997af23b0a6Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
1998af23b0a6Smrg        groff_mm_works=yes
1999af23b0a6Smrg    else
2000af23b0a6Smrg        groff_mm_works=no
2001af23b0a6Smrg    fi
2002af23b0a6Smrg    AC_MSG_RESULT([$groff_mm_works])
2003af23b0a6Smrgfi
2004af23b0a6Smrg
2005af23b0a6Smrg# We have groff, test for HTML dependencies, one command per package
2006af23b0a6Smrgif test "x$have_groff" = x"yes"; then
2007af23b0a6Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2008af23b0a6Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2009af23b0a6Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2010af23b0a6Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2011af23b0a6Smrg      have_groff_html=yes
2012af23b0a6Smrg   else
2013af23b0a6Smrg      have_groff_html=no
2014af23b0a6Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2015af23b0a6Smrg   fi
2016af23b0a6Smrgfi
2017af23b0a6Smrg
2018af23b0a6Smrg# Set Automake conditionals for Makefiles
2019af23b0a6SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2020af23b0a6SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2021af23b0a6SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2022af23b0a6SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2023af23b0a6Smrg]) # XORG_WITH_GROFF
2024af23b0a6Smrg
2025b4485a66Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2026b4485a66Smrg# ---------------------------------------
2027af23b0a6Smrg# Minimum version: 1.6.0
2028af23b0a6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2029b4485a66Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2030af23b0a6Smrg#
2031af23b0a6Smrg# Documentation tools are not always available on all platforms and sometimes
2032af23b0a6Smrg# not at the appropriate level. This macro enables a module to test for the
2033af23b0a6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2034af23b0a6Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
2035af23b0a6Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
2036af23b0a6Smrg# --with-fop assumes 'auto'.
2037af23b0a6Smrg#
2038af23b0a6Smrg# Interface to module:
2039af23b0a6Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2040af23b0a6Smrg# FOP:	 	returns the path of the fop program found
2041af23b0a6Smrg#		returns the path set by the user in the environment
2042af23b0a6Smrg# --with-fop: 	'yes' user instructs the module to use fop
2043af23b0a6Smrg#		'no' user instructs the module not to use fop
2044af23b0a6Smrg#
2045af23b0a6Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2046af23b0a6Smrg#
2047af23b0a6SmrgAC_DEFUN([XORG_WITH_FOP],[
2048af23b0a6SmrgAC_ARG_VAR([FOP], [Path to fop command])
2049b4485a66Smrgm4_define([_defopt], m4_default([$2], [auto]))
2050af23b0a6SmrgAC_ARG_WITH(fop,
2051af23b0a6Smrg	AS_HELP_STRING([--with-fop],
2052af23b0a6Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2053af23b0a6Smrg	   [use_fop=$withval], [use_fop=]_defopt)
2054af23b0a6Smrgm4_undefine([_defopt])
2055af23b0a6Smrg
2056af23b0a6Smrgif test "x$use_fop" = x"auto"; then
2057af23b0a6Smrg   AC_PATH_PROG([FOP], [fop])
2058af23b0a6Smrg   if test "x$FOP" = "x"; then
2059af23b0a6Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2060af23b0a6Smrg	have_fop=no
2061af23b0a6Smrg   else
2062af23b0a6Smrg        have_fop=yes
2063af23b0a6Smrg   fi
2064af23b0a6Smrgelif test "x$use_fop" = x"yes" ; then
2065af23b0a6Smrg   AC_PATH_PROG([FOP], [fop])
2066af23b0a6Smrg   if test "x$FOP" = "x"; then
2067af23b0a6Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2068af23b0a6Smrg   fi
2069af23b0a6Smrg   have_fop=yes
2070af23b0a6Smrgelif test "x$use_fop" = x"no" ; then
2071af23b0a6Smrg   if test "x$FOP" != "x"; then
2072af23b0a6Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2073af23b0a6Smrg   fi
2074af23b0a6Smrg   have_fop=no
2075af23b0a6Smrgelse
2076af23b0a6Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2077af23b0a6Smrgfi
2078b4485a66Smrg
2079b4485a66Smrg# Test for a minimum version of fop, if provided.
2080b4485a66Smrgm4_ifval([$1],
2081b4485a66Smrg[if test "$have_fop" = yes; then
2082b4485a66Smrg    # scrape the fop version
2083b4485a66Smrg    AC_MSG_CHECKING([for fop minimum version])
2084b4485a66Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2085b4485a66Smrg    AC_MSG_RESULT([$fop_version])
2086b4485a66Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2087b4485a66Smrg        [if test "x$use_fop" = xauto; then
2088b4485a66Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2089b4485a66Smrg            have_fop=no
2090b4485a66Smrg        else
2091b4485a66Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2092b4485a66Smrg        fi])
2093b4485a66Smrgfi])
2094af23b0a6SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2095af23b0a6Smrg]) # XORG_WITH_FOP
2096af23b0a6Smrg
2097af23b0a6Smrg# XORG_WITH_PS2PDF([DEFAULT])
2098af23b0a6Smrg# ----------------
2099af23b0a6Smrg# Minimum version: 1.6.0
2100af23b0a6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2101af23b0a6Smrg#
2102af23b0a6Smrg# Documentation tools are not always available on all platforms and sometimes
2103af23b0a6Smrg# not at the appropriate level. This macro enables a module to test for the
2104af23b0a6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2105af23b0a6Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2106af23b0a6Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2107af23b0a6Smrg# --with-ps2pdf assumes 'auto'.
2108af23b0a6Smrg#
2109af23b0a6Smrg# Interface to module:
2110af23b0a6Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2111af23b0a6Smrg# PS2PDF:	returns the path of the ps2pdf program found
2112af23b0a6Smrg#		returns the path set by the user in the environment
2113af23b0a6Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2114af23b0a6Smrg#		 'no' user instructs the module not to use ps2pdf
2115af23b0a6Smrg#
2116af23b0a6Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2117af23b0a6Smrg#
2118af23b0a6SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2119af23b0a6SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2120af23b0a6Smrgm4_define([_defopt], m4_default([$1], [auto]))
2121af23b0a6SmrgAC_ARG_WITH(ps2pdf,
2122af23b0a6Smrg	AS_HELP_STRING([--with-ps2pdf],
2123af23b0a6Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2124af23b0a6Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2125af23b0a6Smrgm4_undefine([_defopt])
2126af23b0a6Smrg
2127af23b0a6Smrgif test "x$use_ps2pdf" = x"auto"; then
2128af23b0a6Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2129af23b0a6Smrg   if test "x$PS2PDF" = "x"; then
2130af23b0a6Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2131af23b0a6Smrg	have_ps2pdf=no
2132af23b0a6Smrg   else
2133af23b0a6Smrg        have_ps2pdf=yes
2134af23b0a6Smrg   fi
2135af23b0a6Smrgelif test "x$use_ps2pdf" = x"yes" ; then
2136af23b0a6Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2137af23b0a6Smrg   if test "x$PS2PDF" = "x"; then
2138af23b0a6Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2139af23b0a6Smrg   fi
2140af23b0a6Smrg   have_ps2pdf=yes
2141af23b0a6Smrgelif test "x$use_ps2pdf" = x"no" ; then
2142af23b0a6Smrg   if test "x$PS2PDF" != "x"; then
2143af23b0a6Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2144af23b0a6Smrg   fi
2145af23b0a6Smrg   have_ps2pdf=no
2146af23b0a6Smrgelse
2147af23b0a6Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2148af23b0a6Smrgfi
2149af23b0a6SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2150af23b0a6Smrg]) # XORG_WITH_PS2PDF
2151af23b0a6Smrg
2152af23b0a6Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
2153af23b0a6Smrg# ----------------
2154af23b0a6Smrg# Minimum version: 1.6.0
2155af23b0a6Smrg#
2156af23b0a6Smrg# Documentation tools are not always available on all platforms and sometimes
2157af23b0a6Smrg# not at the appropriate level. This macro enables a builder to skip all
2158af23b0a6Smrg# documentation targets except traditional man pages.
2159af23b0a6Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2160af23b0a6Smrg# maximum flexibilty in controlling documentation building.
2161af23b0a6Smrg# Refer to:
2162af23b0a6Smrg# XORG_WITH_XMLTO         --with-xmlto
2163af23b0a6Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2164af23b0a6Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2165af23b0a6Smrg# XORG_WITH_FOP           --with-fop
2166af23b0a6Smrg# XORG_WITH_GROFF         --with-groff
2167af23b0a6Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2168af23b0a6Smrg#
2169af23b0a6Smrg# Interface to module:
2170af23b0a6Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2171af23b0a6Smrg# --enable-docs: 'yes' user instructs the module to generate docs
2172af23b0a6Smrg#		 'no' user instructs the module not to generate docs
2173af23b0a6Smrg# parm1:	specify the default value, yes or no.
2174af23b0a6Smrg#
2175af23b0a6SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2176b4485a66Smrgm4_define([docs_default], m4_default([$1], [yes]))
2177af23b0a6SmrgAC_ARG_ENABLE(docs,
2178af23b0a6Smrg	AS_HELP_STRING([--enable-docs],
2179b4485a66Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2180b4485a66Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2181b4485a66Smrgm4_undefine([docs_default])
2182af23b0a6SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2183af23b0a6SmrgAC_MSG_CHECKING([whether to build documentation])
2184af23b0a6SmrgAC_MSG_RESULT([$build_docs])
2185af23b0a6Smrg]) # XORG_ENABLE_DOCS
2186af23b0a6Smrg
2187af23b0a6Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2188af23b0a6Smrg# ----------------
2189af23b0a6Smrg# Minimum version: 1.6.0
2190af23b0a6Smrg#
2191af23b0a6Smrg# This macro enables a builder to skip all developer documentation.
2192af23b0a6Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2193af23b0a6Smrg# maximum flexibilty in controlling documentation building.
2194af23b0a6Smrg# Refer to:
2195af23b0a6Smrg# XORG_WITH_XMLTO         --with-xmlto
2196af23b0a6Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2197af23b0a6Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2198af23b0a6Smrg# XORG_WITH_FOP           --with-fop
2199af23b0a6Smrg# XORG_WITH_GROFF         --with-groff
2200af23b0a6Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2201af23b0a6Smrg#
2202af23b0a6Smrg# Interface to module:
2203af23b0a6Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2204af23b0a6Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2205af23b0a6Smrg#			'no' user instructs the module not to generate developer docs
2206af23b0a6Smrg# parm1:		specify the default value, yes or no.
2207af23b0a6Smrg#
2208af23b0a6SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2209af23b0a6Smrgm4_define([devel_default], m4_default([$1], [yes]))
2210af23b0a6SmrgAC_ARG_ENABLE(devel-docs,
2211af23b0a6Smrg	AS_HELP_STRING([--enable-devel-docs],
2212af23b0a6Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2213af23b0a6Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2214af23b0a6Smrgm4_undefine([devel_default])
2215af23b0a6SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2216af23b0a6SmrgAC_MSG_CHECKING([whether to build developer documentation])
2217af23b0a6SmrgAC_MSG_RESULT([$build_devel_docs])
2218af23b0a6Smrg]) # XORG_ENABLE_DEVEL_DOCS
2219af23b0a6Smrg
2220af23b0a6Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2221af23b0a6Smrg# ----------------
2222af23b0a6Smrg# Minimum version: 1.6.0
2223af23b0a6Smrg#
2224af23b0a6Smrg# This macro enables a builder to skip all functional specification targets.
2225af23b0a6Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2226af23b0a6Smrg# maximum flexibilty in controlling documentation building.
2227af23b0a6Smrg# Refer to:
2228af23b0a6Smrg# XORG_WITH_XMLTO         --with-xmlto
2229af23b0a6Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2230af23b0a6Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2231af23b0a6Smrg# XORG_WITH_FOP           --with-fop
2232af23b0a6Smrg# XORG_WITH_GROFF         --with-groff
2233af23b0a6Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2234af23b0a6Smrg#
2235af23b0a6Smrg# Interface to module:
2236af23b0a6Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2237af23b0a6Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2238af23b0a6Smrg#			'no' user instructs the module not to generate specs
2239af23b0a6Smrg# parm1:		specify the default value, yes or no.
2240af23b0a6Smrg#
2241af23b0a6SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2242af23b0a6Smrgm4_define([spec_default], m4_default([$1], [yes]))
2243af23b0a6SmrgAC_ARG_ENABLE(specs,
2244af23b0a6Smrg	AS_HELP_STRING([--enable-specs],
2245af23b0a6Smrg	   [Enable building the specs (default: ]spec_default[)]),
2246af23b0a6Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2247af23b0a6Smrgm4_undefine([spec_default])
2248af23b0a6SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2249af23b0a6SmrgAC_MSG_CHECKING([whether to build functional specifications])
2250af23b0a6SmrgAC_MSG_RESULT([$build_specs])
2251af23b0a6Smrg]) # XORG_ENABLE_SPECS
2252af23b0a6Smrg
2253b4485a66Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2254b4485a66Smrg# ----------------------------------------------
2255b4485a66Smrg# Minimum version: 1.13.0
2256b4485a66Smrg#
2257b4485a66Smrg# This macro enables a builder to enable/disable unit testing
2258b4485a66Smrg# It makes no assumption about the test cases implementation
2259b4485a66Smrg# Test cases may or may not use Automake "Support for test suites"
2260b4485a66Smrg# They may or may not use the software utility library GLib
2261b4485a66Smrg#
2262b4485a66Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2263b4485a66Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2264b4485a66Smrg# The variable enable_unit_tests is used by other macros in this file.
2265b4485a66Smrg#
2266b4485a66Smrg# Interface to module:
2267b4485a66Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2268b4485a66Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2269b4485a66Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2270b4485a66Smrg#			'no' user instructs the module not to build tests
2271b4485a66Smrg# parm1:		specify the default value, yes or no.
2272b4485a66Smrg#
2273b4485a66SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2274b4485a66SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2275b4485a66SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2276b4485a66SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2277b4485a66Smrgm4_define([_defopt], m4_default([$1], [auto]))
2278b4485a66SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2279b4485a66Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2280b4485a66Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2281b4485a66Smrgm4_undefine([_defopt])
2282b4485a66SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2283b4485a66SmrgAC_MSG_CHECKING([whether to build unit test cases])
2284b4485a66SmrgAC_MSG_RESULT([$enable_unit_tests])
2285b4485a66Smrg]) # XORG_ENABLE_UNIT_TESTS
2286b4485a66Smrg
2287b4485a66Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2288b4485a66Smrg# ------------------------------------------------------
2289b4485a66Smrg# Minimum version: 1.17.0
2290b4485a66Smrg#
2291b4485a66Smrg# This macro enables a builder to enable/disable integration testing
2292b4485a66Smrg# It makes no assumption about the test cases' implementation
2293b4485a66Smrg# Test cases may or may not use Automake "Support for test suites"
2294b4485a66Smrg#
2295b4485a66Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2296b4485a66Smrg# usually requires less dependencies and may be built and run under less
2297b4485a66Smrg# stringent environments than integration tests.
2298b4485a66Smrg#
2299b4485a66Smrg# Interface to module:
2300b4485a66Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2301b4485a66Smrg# enable_integration_tests:   used in configure.ac for additional configuration
2302b4485a66Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2303b4485a66Smrg#                             'no' user instructs the module not to build tests
2304b4485a66Smrg# parm1:                      specify the default value, yes or no.
2305b4485a66Smrg#
2306b4485a66SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2307b4485a66SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2308b4485a66Smrgm4_define([_defopt], m4_default([$1], [auto]))
2309b4485a66SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2310b4485a66Smrg	[Enable building integration test cases (default: ]_defopt[)]),
2311b4485a66Smrg	[enable_integration_tests=$enableval],
2312b4485a66Smrg	[enable_integration_tests=]_defopt)
2313b4485a66Smrgm4_undefine([_defopt])
2314b4485a66SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2315b4485a66Smrg	[test "x$enable_integration_tests" != xno])
2316b4485a66SmrgAC_MSG_CHECKING([whether to build unit test cases])
2317b4485a66SmrgAC_MSG_RESULT([$enable_integration_tests])
2318b4485a66Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2319b4485a66Smrg
2320b4485a66Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2321b4485a66Smrg# ----------------------------------------
2322b4485a66Smrg# Minimum version: 1.13.0
2323b4485a66Smrg#
2324b4485a66Smrg# GLib is a library which provides advanced data structures and functions.
2325b4485a66Smrg# This macro enables a module to test for the presence of Glib.
2326b4485a66Smrg#
2327b4485a66Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2328b4485a66Smrg# Otherwise the value of $enable_unit_tests is blank.
2329b4485a66Smrg#
2330b4485a66Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2331b4485a66Smrg# test support usually requires less dependencies and may be built and run under
2332b4485a66Smrg# less stringent environments than integration tests.
2333b4485a66Smrg#
2334b4485a66Smrg# Interface to module:
2335b4485a66Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2336b4485a66Smrg# with_glib: used in configure.ac to know if GLib has been found
2337b4485a66Smrg# --with-glib:	'yes' user instructs the module to use glib
2338b4485a66Smrg#		'no' user instructs the module not to use glib
2339b4485a66Smrg#
2340b4485a66SmrgAC_DEFUN([XORG_WITH_GLIB],[
2341b4485a66SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2342b4485a66Smrgm4_define([_defopt], m4_default([$2], [auto]))
2343b4485a66SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2344b4485a66Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2345b4485a66Smrg	[with_glib=$withval], [with_glib=]_defopt)
2346b4485a66Smrgm4_undefine([_defopt])
2347b4485a66Smrg
2348b4485a66Smrghave_glib=no
2349b4485a66Smrg# Do not probe GLib if user explicitly disabled unit testing
2350b4485a66Smrgif test "x$enable_unit_tests" != x"no"; then
2351b4485a66Smrg  # Do not probe GLib if user explicitly disabled it
2352b4485a66Smrg  if test "x$with_glib" != x"no"; then
2353b4485a66Smrg    m4_ifval(
2354b4485a66Smrg      [$1],
2355b4485a66Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2356b4485a66Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2357b4485a66Smrg    )
2358b4485a66Smrg  fi
2359b4485a66Smrgfi
2360b4485a66Smrg
2361b4485a66Smrg# Not having GLib when unit testing has been explicitly requested is an error
2362b4485a66Smrgif test "x$enable_unit_tests" = x"yes"; then
2363b4485a66Smrg  if test "x$have_glib" = x"no"; then
2364b4485a66Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2365b4485a66Smrg  fi
2366b4485a66Smrgfi
2367b4485a66Smrg
2368b4485a66Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2369b4485a66Smrgif test "x$enable_unit_tests" = x"no"; then
2370b4485a66Smrg  if test "x$with_glib" = x"yes"; then
2371b4485a66Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2372b4485a66Smrg  fi
2373b4485a66Smrgfi
2374b4485a66Smrg
2375b4485a66Smrg# Not having GLib when it has been explicitly requested is an error
2376b4485a66Smrgif test "x$with_glib" = x"yes"; then
2377b4485a66Smrg  if test "x$have_glib" = x"no"; then
2378b4485a66Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2379b4485a66Smrg  fi
2380b4485a66Smrgfi
2381b4485a66Smrg
2382b4485a66SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2383b4485a66Smrg]) # XORG_WITH_GLIB
2384b4485a66Smrg
2385b4485a66Smrg# XORG_LD_WRAP([required|optional])
2386b4485a66Smrg# ---------------------------------
2387b4485a66Smrg# Minimum version: 1.13.0
2388b4485a66Smrg#
2389b4485a66Smrg# Check if linker supports -wrap, passed via compiler flags
2390b4485a66Smrg#
2391b4485a66Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2392b4485a66Smrg# Otherwise the value of $enable_unit_tests is blank.
2393b4485a66Smrg#
2394b4485a66Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2395b4485a66Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2396b4485a66Smrg# available, an argument of "optional" allows use when some unit tests require
2397b4485a66Smrg# ld -wrap and others do not.
2398b4485a66Smrg#
2399b4485a66SmrgAC_DEFUN([XORG_LD_WRAP],[
2400b4485a66SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2401b4485a66Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2402b4485a66Smrg                      void __wrap_exit(int status) { return; }],
2403b4485a66Smrg                     [exit(0);])])
2404b4485a66Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2405b4485a66Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2406b4485a66Smrg  if test "x$have_ld_wrap" = x"no"; then
2407b4485a66Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2408b4485a66Smrg  fi
2409b4485a66Smrgfi
2410b4485a66SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2411b4485a66Smrg#
2412b4485a66Smrg]) # XORG_LD_WRAP
2413b4485a66Smrg
2414b4485a66Smrg# XORG_CHECK_LINKER_FLAGS
2415b4485a66Smrg# -----------------------
2416b4485a66Smrg# SYNOPSIS
2417b4485a66Smrg#
2418b4485a66Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2419b4485a66Smrg#
2420b4485a66Smrg# DESCRIPTION
2421b4485a66Smrg#
2422b4485a66Smrg#   Check whether the given linker FLAGS work with the current language's
2423b4485a66Smrg#   linker, or whether they give an error.
2424b4485a66Smrg#
2425b4485a66Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2426b4485a66Smrg#   success/failure.
2427b4485a66Smrg#
2428b4485a66Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2429b4485a66Smrg#
2430b4485a66Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2431b4485a66Smrg#
2432b4485a66Smrg# LICENSE
2433b4485a66Smrg#
2434b4485a66Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2435b4485a66Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2436b4485a66Smrg#   Copyright (c) 2009 Matteo Frigo
2437b4485a66Smrg#
2438b4485a66Smrg#   This program is free software: you can redistribute it and/or modify it
2439b4485a66Smrg#   under the terms of the GNU General Public License as published by the
2440b4485a66Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2441b4485a66Smrg#   option) any later version.
2442b4485a66Smrg#
2443b4485a66Smrg#   This program is distributed in the hope that it will be useful, but
2444b4485a66Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2445b4485a66Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2446b4485a66Smrg#   Public License for more details.
2447b4485a66Smrg#
2448b4485a66Smrg#   You should have received a copy of the GNU General Public License along
2449b4485a66Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2450b4485a66Smrg#
2451b4485a66Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2452b4485a66Smrg#   gives unlimited permission to copy, distribute and modify the configure
2453b4485a66Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2454b4485a66Smrg#   need not follow the terms of the GNU General Public License when using
2455b4485a66Smrg#   or distributing such scripts, even though portions of the text of the
2456b4485a66Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2457b4485a66Smrg#   all other use of the material that constitutes the Autoconf Macro.
2458b4485a66Smrg#
2459b4485a66Smrg#   This special exception to the GPL applies to versions of the Autoconf
2460b4485a66Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2461b4485a66Smrg#   modified version of the Autoconf Macro, you may extend this special
2462b4485a66Smrg#   exception to the GPL to apply to your modified version as well.#
2463b4485a66SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2464b4485a66Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2465b4485a66Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2466b4485a66SmrgAS_LITERAL_IF([$1],
2467b4485a66Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2468b4485a66Smrg      ax_save_FLAGS=$LDFLAGS
2469b4485a66Smrg      LDFLAGS="$1"
2470b4485a66Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2471b4485a66Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2472b4485a66Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2473b4485a66Smrg      LDFLAGS=$ax_save_FLAGS])],
2474b4485a66Smrg  [ax_save_FLAGS=$LDFLAGS
2475b4485a66Smrg   LDFLAGS="$1"
2476b4485a66Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2477b4485a66Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2478b4485a66Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2479b4485a66Smrg   LDFLAGS=$ax_save_FLAGS])
2480b4485a66Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2481b4485a66SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2482b4485a66Smrgif test "x$xorg_check_linker_flags" = xyes; then
2483b4485a66Smrg	m4_default([$2], :)
2484b4485a66Smrgelse
2485b4485a66Smrg	m4_default([$3], :)
2486b4485a66Smrgfi
2487b4485a66Smrg]) # XORG_CHECK_LINKER_FLAGS
2488b4485a66Smrg
2489b4485a66Smrg# XORG_MEMORY_CHECK_FLAGS
2490b4485a66Smrg# -----------------------
2491b4485a66Smrg# Minimum version: 1.16.0
2492b4485a66Smrg#
2493b4485a66Smrg# This macro attempts to find appropriate memory checking functionality
2494b4485a66Smrg# for various platforms which unit testing code may use to catch various
2495b4485a66Smrg# forms of memory allocation and access errors in testing.
2496b4485a66Smrg#
2497b4485a66Smrg# Interface to module:
2498b4485a66Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2499b4485a66Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2500b4485a66Smrg#
2501b4485a66Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2502b4485a66Smrg#
2503b4485a66SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2504b4485a66Smrg
2505b4485a66SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2506b4485a66SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2507b4485a66Smrg           [Environment variables to enable memory checking in tests])
2508b4485a66Smrg
2509b4485a66Smrg# Check for different types of support on different platforms
2510b4485a66Smrgcase $host_os in
2511b4485a66Smrg    solaris*)
2512b4485a66Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2513b4485a66Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2514b4485a66Smrg        ;;
2515b4485a66Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2516b4485a66Smrg        # both directly and inverted, so should not be 0 or 255.
2517b4485a66Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2518b4485a66Smrg        ;;
2519b4485a66Smrg    darwin*)
2520b4485a66Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2521b4485a66Smrg        ;;
2522b4485a66Smrg    *bsd*)
2523b4485a66Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2524b4485a66Smrg        ;;
2525b4485a66Smrgesac
2526b4485a66Smrg
2527b4485a66Smrg# User supplied flags override default flags
2528b4485a66Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2529b4485a66Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2530b4485a66Smrgfi
2531b4485a66Smrg
2532b4485a66SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2533b4485a66Smrg]) # XORG_WITH_LINT
2534b4485a66Smrg
2535b3eb03f3Smrg# XORG_CHECK_MALLOC_ZERO
2536b3eb03f3Smrg# ----------------------
2537b3eb03f3Smrg# Minimum version: 1.0.0
2538b3eb03f3Smrg#
2539b3eb03f3Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2540b3eb03f3Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2541b3eb03f3Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2542b3eb03f3SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2543b3eb03f3SmrgAC_ARG_ENABLE(malloc0returnsnull,
2544b3eb03f3Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2545b3eb03f3Smrg		       [malloc(0) returns NULL (default: auto)]),
2546b3eb03f3Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2547b3eb03f3Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2548b3eb03f3Smrg
2549b3eb03f3SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2550b3eb03f3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2551b4485a66Smrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
2552b4485a66Smrg#include <stdlib.h>
2553b4485a66Smrg],[
2554b3eb03f3Smrg    char *m0, *r0, *c0, *p;
2555b3eb03f3Smrg    m0 = malloc(0);
2556b3eb03f3Smrg    p = malloc(10);
2557b3eb03f3Smrg    r0 = realloc(p,0);
2558b4485a66Smrg    c0 = calloc(0,10);
2559b4485a66Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2560b4485a66Smrg])],
2561b3eb03f3Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
2562af23b0a6Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
2563af23b0a6Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
2564b3eb03f3Smrgfi
2565b3eb03f3SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2566010cdda0Smrg
2567b3eb03f3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2568b3eb03f3Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2569b3eb03f3Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2570b3eb03f3Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2571b3eb03f3Smrgelse
2572b3eb03f3Smrg	MALLOC_ZERO_CFLAGS=""
2573b3eb03f3Smrg	XMALLOC_ZERO_CFLAGS=""
2574b3eb03f3Smrg	XTMALLOC_ZERO_CFLAGS=""
2575b3eb03f3Smrgfi
2576010cdda0Smrg
2577b3eb03f3SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2578b3eb03f3SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2579b3eb03f3SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2580b3eb03f3Smrg]) # XORG_CHECK_MALLOC_ZERO
2581010cdda0Smrg
2582b3eb03f3Smrg# XORG_WITH_LINT()
2583b3eb03f3Smrg# ----------------
2584b3eb03f3Smrg# Minimum version: 1.1.0
2585b3eb03f3Smrg#
2586af23b0a6Smrg# This macro enables the use of a tool that flags some suspicious and
2587af23b0a6Smrg# non-portable constructs (likely to be bugs) in C language source code.
2588af23b0a6Smrg# It will attempt to locate the tool and use appropriate options.
2589af23b0a6Smrg# There are various lint type tools on different platforms.
2590af23b0a6Smrg#
2591af23b0a6Smrg# Interface to module:
2592af23b0a6Smrg# LINT:		returns the path to the tool found on the platform
2593af23b0a6Smrg#		or the value set to LINT on the configure cmd line
2594af23b0a6Smrg#		also an Automake conditional
2595af23b0a6Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
2596af23b0a6Smrg#
2597af23b0a6Smrg# --with-lint:	'yes' user instructs the module to use lint
2598af23b0a6Smrg#		'no' user instructs the module not to use lint (default)
2599af23b0a6Smrg#
2600af23b0a6Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2601af23b0a6Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2602b3eb03f3Smrg#
2603b3eb03f3SmrgAC_DEFUN([XORG_WITH_LINT],[
2604b3eb03f3Smrg
2605af23b0a6SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2606af23b0a6SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2607b3eb03f3SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2608b3eb03f3Smrg		[Use a lint-style source code checker (default: disabled)])],
2609b3eb03f3Smrg		[use_lint=$withval], [use_lint=no])
2610af23b0a6Smrg
2611af23b0a6Smrg# Obtain platform specific info like program name and options
2612af23b0a6Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2613af23b0a6Smrgcase $host_os in
2614af23b0a6Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2615af23b0a6Smrg	lint_name=splint
2616af23b0a6Smrg	lint_options="-badflag"
2617af23b0a6Smrg	;;
2618af23b0a6Smrg  *freebsd* | *netbsd*)
2619af23b0a6Smrg	lint_name=lint
2620af23b0a6Smrg	lint_options="-u -b"
2621af23b0a6Smrg	;;
2622af23b0a6Smrg  *solaris*)
2623af23b0a6Smrg	lint_name=lint
2624af23b0a6Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2625af23b0a6Smrg	;;
2626af23b0a6Smrgesac
2627af23b0a6Smrg
2628af23b0a6Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2629af23b0a6Smrgif test "x$use_lint" = x"yes" ; then
2630af23b0a6Smrg   AC_PATH_PROG([LINT], [$lint_name])
2631af23b0a6Smrg   if test "x$LINT" = "x"; then
2632af23b0a6Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2633af23b0a6Smrg   fi
2634af23b0a6Smrgelif test "x$use_lint" = x"no" ; then
2635af23b0a6Smrg   if test "x$LINT" != "x"; then
2636af23b0a6Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2637af23b0a6Smrg   fi
2638b3eb03f3Smrgelse
2639af23b0a6Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2640b3eb03f3Smrgfi
2641af23b0a6Smrg
2642af23b0a6Smrg# User supplied flags override default flags
2643af23b0a6Smrgif test "x$LINT_FLAGS" != "x"; then
2644af23b0a6Smrg   lint_options=$LINT_FLAGS
2645b3eb03f3Smrgfi
2646010cdda0Smrg
2647af23b0a6SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2648af23b0a6SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2649010cdda0Smrg
2650b3eb03f3Smrg]) # XORG_WITH_LINT
2651010cdda0Smrg
2652b3eb03f3Smrg# XORG_LINT_LIBRARY(LIBNAME)
2653b3eb03f3Smrg# --------------------------
2654b3eb03f3Smrg# Minimum version: 1.1.0
2655b3eb03f3Smrg#
2656b3eb03f3Smrg# Sets up flags for building lint libraries for checking programs that call
2657b3eb03f3Smrg# functions in the library.
2658b3eb03f3Smrg#
2659af23b0a6Smrg# Interface to module:
2660af23b0a6Smrg# LINTLIB		- Automake variable with the name of lint library file to make
2661af23b0a6Smrg# MAKE_LINT_LIB		- Automake conditional
2662af23b0a6Smrg#
2663af23b0a6Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2664af23b0a6Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2665010cdda0Smrg
2666b3eb03f3SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2667b3eb03f3SmrgAC_REQUIRE([XORG_WITH_LINT])
2668b3eb03f3SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2669b3eb03f3Smrg	[Create lint library (default: disabled)])],
2670b3eb03f3Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2671af23b0a6Smrg
2672af23b0a6Smrgif test "x$make_lint_lib" = x"yes" ; then
2673af23b0a6Smrg   LINTLIB=llib-l$1.ln
2674af23b0a6Smrg   if test "x$LINT" = "x"; then
2675af23b0a6Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2676af23b0a6Smrg   fi
2677af23b0a6Smrgelif test "x$make_lint_lib" != x"no" ; then
2678af23b0a6Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2679b3eb03f3Smrgfi
2680af23b0a6Smrg
2681b3eb03f3SmrgAC_SUBST(LINTLIB)
2682b3eb03f3SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2683010cdda0Smrg
2684b3eb03f3Smrg]) # XORG_LINT_LIBRARY
2685010cdda0Smrg
2686b4485a66Smrg# XORG_COMPILER_BRAND
2687b4485a66Smrg# -------------------
2688b4485a66Smrg# Minimum version: 1.14.0
2689b4485a66Smrg#
2690b4485a66Smrg# Checks for various brands of compilers and sets flags as appropriate:
2691b4485a66Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2692b4485a66Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2693b4485a66Smrg#   clang compiler - sets CLANGCC to "yes"
2694b4485a66Smrg#   Intel compiler - sets INTELCC to "yes"
2695b4485a66Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2696b4485a66Smrg#
2697b4485a66SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2698b4485a66SmrgAC_LANG_CASE(
2699b4485a66Smrg	[C], [
2700b4485a66Smrg		AC_REQUIRE([AC_PROG_CC_C99])
2701b4485a66Smrg	],
2702b4485a66Smrg	[C++], [
2703b4485a66Smrg		AC_REQUIRE([AC_PROG_CXX])
2704b4485a66Smrg	]
2705b4485a66Smrg)
2706b4485a66SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2707b4485a66SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2708b4485a66SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2709b4485a66Smrg]) # XORG_COMPILER_BRAND
2710b4485a66Smrg
2711b4485a66Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2712b4485a66Smrg# ---------------
2713b4485a66Smrg# Minimum version: 1.16.0
2714b4485a66Smrg#
2715b4485a66Smrg# Test if the compiler works when passed the given flag as a command line argument.
2716b4485a66Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2717b4485a66Smrg# next flag in the list until there are no more options.
2718b4485a66Smrg#
2719b4485a66Smrg# Note that this does not guarantee that the compiler supports the flag as some
2720b4485a66Smrg# compilers will simply ignore arguments that they do not understand, but we do
2721b4485a66Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2722b4485a66Smrg# -Werror=unused-command-line-argument
2723b4485a66Smrg#
2724b4485a66SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2725b4485a66Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2726b4485a66Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2727b4485a66Smrg
2728b4485a66SmrgAC_LANG_COMPILER_REQUIRE
2729b4485a66Smrg
2730b4485a66SmrgAC_LANG_CASE(
2731b4485a66Smrg	[C], [
2732b4485a66Smrg		AC_REQUIRE([AC_PROG_CC_C99])
2733b4485a66Smrg		define([PREFIX], [C])
2734b4485a66Smrg		define([CACHE_PREFIX], [cc])
2735b4485a66Smrg		define([COMPILER], [$CC])
2736b4485a66Smrg	],
2737b4485a66Smrg	[C++], [
2738b4485a66Smrg		define([PREFIX], [CXX])
2739b4485a66Smrg		define([CACHE_PREFIX], [cxx])
2740b4485a66Smrg		define([COMPILER], [$CXX])
2741b4485a66Smrg	]
2742b4485a66Smrg)
2743b4485a66Smrg
2744b4485a66Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2745b4485a66Smrg
2746b4485a66Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
2747b4485a66Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2748b4485a66Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
2749b4485a66Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2750b4485a66Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2751b4485a66Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
2752b4485a66Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
2753b4485a66Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
2754b4485a66Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2755b4485a66Smrgfi
2756b4485a66Smrg
2757b4485a66Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
2758b4485a66Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
2759b4485a66Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2760b4485a66Smrg	fi
2761b4485a66Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2762b4485a66Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
2763b4485a66Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2764b4485a66Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2765b4485a66Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
2766b4485a66Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
2767b4485a66Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
2768b4485a66Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2769b4485a66Smrgfi
2770b4485a66Smrg
2771b4485a66Smrgfound="no"
2772b4485a66Smrgm4_foreach([flag], m4_cdr($@), [
2773b4485a66Smrg	if test $found = "no" ; then
2774b4485a66Smrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
2775b4485a66Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2776b4485a66Smrg		fi
2777b4485a66Smrg
2778b4485a66Smrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
2779b4485a66Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2780b4485a66Smrg		fi
2781b4485a66Smrg
2782b4485a66Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2783b4485a66Smrg
2784b4485a66Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2785b4485a66Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
2786b4485a66Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
2787b4485a66Smrg		AC_CACHE_VAL($cacheid,
2788b4485a66Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2789b4485a66Smrg					     [eval $cacheid=yes],
2790b4485a66Smrg					     [eval $cacheid=no])])
2791b4485a66Smrg
2792b4485a66Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2793b4485a66Smrg
2794b4485a66Smrg		eval supported=\$$cacheid
2795b4485a66Smrg		AC_MSG_RESULT([$supported])
2796b4485a66Smrg		if test "$supported" = "yes" ; then
2797b4485a66Smrg			$1="$$1 ]flag["
2798b4485a66Smrg			found="yes"
2799b4485a66Smrg		fi
2800b4485a66Smrg	fi
2801b4485a66Smrg])
2802b4485a66Smrg]) # XORG_TESTSET_CFLAG
2803b4485a66Smrg
2804b4485a66Smrg# XORG_COMPILER_FLAGS
2805b4485a66Smrg# ---------------
2806b4485a66Smrg# Minimum version: 1.16.0
2807b4485a66Smrg#
2808b4485a66Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2809b4485a66Smrg# arguments supported by the selected compiler which do NOT alter the generated
2810b4485a66Smrg# code.  These arguments will cause the compiler to print various warnings
2811b4485a66Smrg# during compilation AND turn a conservative set of warnings into errors.
2812b4485a66Smrg#
2813b4485a66Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2814b4485a66Smrg# future versions of util-macros as options are added to new compilers.
2815b4485a66Smrg#
2816b4485a66SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2817b4485a66SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2818b4485a66Smrg
2819b4485a66SmrgAC_ARG_ENABLE(selective-werror,
2820b4485a66Smrg              AS_HELP_STRING([--disable-selective-werror],
2821b4485a66Smrg                             [Turn off selective compiler errors. (default: enabled)]),
2822b4485a66Smrg              [SELECTIVE_WERROR=$enableval],
2823b4485a66Smrg              [SELECTIVE_WERROR=yes])
2824b4485a66Smrg
2825b4485a66SmrgAC_LANG_CASE(
2826b4485a66Smrg        [C], [
2827b4485a66Smrg                define([PREFIX], [C])
2828b4485a66Smrg        ],
2829b4485a66Smrg        [C++], [
2830b4485a66Smrg                define([PREFIX], [CXX])
2831b4485a66Smrg        ]
2832b4485a66Smrg)
2833b4485a66Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2834b4485a66Smrgif test "x$SUNCC" = "xyes"; then
2835b4485a66Smrg    [BASE_]PREFIX[FLAGS]="-v"
2836b4485a66Smrgelse
2837b4485a66Smrg    [BASE_]PREFIX[FLAGS]=""
2838b4485a66Smrgfi
2839b4485a66Smrg
2840b4485a66Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2841b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2842b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2843b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2844b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2845b4485a66Smrg
2846b4485a66SmrgAC_LANG_CASE(
2847b4485a66Smrg	[C], [
2848b4485a66Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2849b4485a66Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2850b4485a66Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2851b4485a66Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
2852b4485a66Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
2853b4485a66Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2854b4485a66Smrg	]
2855b4485a66Smrg)
2856b4485a66Smrg
2857b4485a66Smrg# This chunk adds additional warnings that could catch undesired effects.
2858b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2859b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2860b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2861b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2862b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2863b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2864b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
2865b4485a66Smrg
2866b4485a66Smrg# These are currently disabled because they are noisy.  They will be enabled
2867b4485a66Smrg# in the future once the codebase is sufficiently modernized to silence
2868b4485a66Smrg# them.  For now, I don't want them to drown out the other warnings.
2869b4485a66Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2870b4485a66Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
2871b4485a66Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
2872b4485a66Smrg
2873b4485a66Smrg# Turn some warnings into errors, so we don't accidently get successful builds
2874b4485a66Smrg# when there are problems that should be fixed.
2875b4485a66Smrg
2876b4485a66Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
2877b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
2878b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
2879b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
2880b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
2881b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
2882b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
2883b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
2884b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
2885b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
2886b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
2887b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
2888b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
2889b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
2890b4485a66Smrgelse
2891b4485a66SmrgAC_MSG_WARN([You have chosen not to turn some select compiler warnings into errors.  This should not be necessary.  Please report why you needed to do so in a bug report at $PACKAGE_BUGREPORT])
2892b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
2893b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
2894b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
2895b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
2896b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
2897b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
2898b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
2899b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
2900b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
2901b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
2902b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
2903b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
2904b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
2905b4485a66Smrgfi
2906b4485a66Smrg
2907b4485a66SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2908b4485a66Smrg]) # XORG_COMPILER_FLAGS
2909b4485a66Smrg
2910b3eb03f3Smrg# XORG_CWARNFLAGS
2911b3eb03f3Smrg# ---------------
2912b3eb03f3Smrg# Minimum version: 1.2.0
2913b4485a66Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2914b3eb03f3Smrg#
2915b3eb03f3Smrg# Defines CWARNFLAGS to enable C compiler warnings.
2916b3eb03f3Smrg#
2917b4485a66Smrg# This function is deprecated because it defines -fno-strict-aliasing
2918b4485a66Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
2919b4485a66Smrg# is needed, then it should be added explicitly in the module when
2920b4485a66Smrg# it is updated to use BASE_CFLAGS.
2921b4485a66Smrg#
2922b3eb03f3SmrgAC_DEFUN([XORG_CWARNFLAGS], [
2923b4485a66SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2924b4485a66SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2925b4485a66SmrgAC_LANG_CASE(
2926b4485a66Smrg	[C], [
2927b4485a66Smrg		CWARNFLAGS="$BASE_CFLAGS"
2928b4485a66Smrg		if  test "x$GCC" = xyes ; then
2929b4485a66Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
2930b4485a66Smrg		fi
2931b4485a66Smrg		AC_SUBST(CWARNFLAGS)
2932b4485a66Smrg	]
2933b4485a66Smrg)
2934b3eb03f3Smrg]) # XORG_CWARNFLAGS
2935010cdda0Smrg
2936b3eb03f3Smrg# XORG_STRICT_OPTION
2937b3eb03f3Smrg# -----------------------
2938b3eb03f3Smrg# Minimum version: 1.3.0
2939b3eb03f3Smrg#
2940b4485a66Smrg# Add configure option to enable strict compilation flags, such as treating
2941b4485a66Smrg# warnings as fatal errors.
2942b4485a66Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
2943b4485a66Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
2944b4485a66Smrg#
2945b4485a66Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
2946b4485a66Smrg# when strict compilation is unconditionally desired.
2947b3eb03f3SmrgAC_DEFUN([XORG_STRICT_OPTION], [
2948b3eb03f3SmrgAC_REQUIRE([XORG_CWARNFLAGS])
2949b4485a66SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2950b3eb03f3Smrg
2951b3eb03f3SmrgAC_ARG_ENABLE(strict-compilation,
2952b3eb03f3Smrg			  AS_HELP_STRING([--enable-strict-compilation],
2953b3eb03f3Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2954b3eb03f3Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2955b4485a66Smrg
2956b4485a66SmrgAC_LANG_CASE(
2957b4485a66Smrg        [C], [
2958b4485a66Smrg                define([PREFIX], [C])
2959b4485a66Smrg        ],
2960b4485a66Smrg        [C++], [
2961b4485a66Smrg                define([PREFIX], [CXX])
2962b4485a66Smrg        ]
2963b4485a66Smrg)
2964b4485a66Smrg
2965b4485a66Smrg[STRICT_]PREFIX[FLAGS]=""
2966b4485a66SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
2967b4485a66SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
2968b4485a66Smrg
2969b4485a66Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
2970b4485a66Smrg# activate it with -Werror, so we add it here explicitly.
2971b4485a66SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
2972b4485a66Smrg
2973b3eb03f3Smrgif test "x$STRICT_COMPILE" = "xyes"; then
2974b4485a66Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
2975b4485a66Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
2976b3eb03f3Smrgfi
2977b4485a66SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
2978b4485a66SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2979b4485a66SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
2980b3eb03f3Smrg]) # XORG_STRICT_OPTION
2981010cdda0Smrg
2982b3eb03f3Smrg# XORG_DEFAULT_OPTIONS
2983b3eb03f3Smrg# --------------------
2984b3eb03f3Smrg# Minimum version: 1.3.0
2985b3eb03f3Smrg#
2986b3eb03f3Smrg# Defines default options for X.Org modules.
2987b3eb03f3Smrg#
2988b3eb03f3SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
2989af23b0a6SmrgAC_REQUIRE([AC_PROG_INSTALL])
2990b4485a66SmrgXORG_COMPILER_FLAGS
2991b3eb03f3SmrgXORG_CWARNFLAGS
2992b3eb03f3SmrgXORG_STRICT_OPTION
2993b3eb03f3SmrgXORG_RELEASE_VERSION
2994b3eb03f3SmrgXORG_CHANGELOG
2995af23b0a6SmrgXORG_INSTALL
2996b3eb03f3SmrgXORG_MANPAGE_SECTIONS
2997af23b0a6Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
2998af23b0a6Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
2999b3eb03f3Smrg]) # XORG_DEFAULT_OPTIONS
3000af23b0a6Smrg
3001af23b0a6Smrg# XORG_INSTALL()
3002af23b0a6Smrg# ----------------
3003af23b0a6Smrg# Minimum version: 1.4.0
3004af23b0a6Smrg#
3005af23b0a6Smrg# Defines the variable INSTALL_CMD as the command to copy
3006af23b0a6Smrg# INSTALL from $prefix/share/util-macros.
3007af23b0a6Smrg#
3008af23b0a6SmrgAC_DEFUN([XORG_INSTALL], [
3009af23b0a6SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3010af23b0a6Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3011af23b0a6SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3012af23b0a6Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3013af23b0a6Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
3014af23b0a6Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
3015af23b0a6SmrgAC_SUBST([INSTALL_CMD])
3016af23b0a6Smrg]) # XORG_INSTALL
3017010cdda0Smrgdnl Copyright 2005 Red Hat, Inc
3018b3eb03f3Smrgdnl
3019010cdda0Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3020010cdda0Smrgdnl documentation for any purpose is hereby granted without fee, provided that
3021010cdda0Smrgdnl the above copyright notice appear in all copies and that both that
3022010cdda0Smrgdnl copyright notice and this permission notice appear in supporting
3023010cdda0Smrgdnl documentation.
3024b3eb03f3Smrgdnl
3025010cdda0Smrgdnl The above copyright notice and this permission notice shall be included
3026010cdda0Smrgdnl in all copies or substantial portions of the Software.
3027b3eb03f3Smrgdnl
3028010cdda0Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3029010cdda0Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3030010cdda0Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3031010cdda0Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3032010cdda0Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3033010cdda0Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3034010cdda0Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3035b3eb03f3Smrgdnl
3036010cdda0Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3037010cdda0Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3038010cdda0Smrgdnl other dealings in this Software without prior written authorization
3039010cdda0Smrgdnl from the copyright holders.
3040b3eb03f3Smrgdnl
3041010cdda0Smrg
3042b3eb03f3Smrg# XORG_RELEASE_VERSION
3043b3eb03f3Smrg# --------------------
3044af23b0a6Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3045b3eb03f3Smrg 
3046b3eb03f3SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3047b3eb03f3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3048b3eb03f3Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3049b3eb03f3Smrg		[Major version of this package])
3050b3eb03f3Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3051b3eb03f3Smrg	if test "x$PVM" = "x"; then
3052b3eb03f3Smrg		PVM="0"
3053010cdda0Smrg	fi
3054b3eb03f3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3055b3eb03f3Smrg		[$PVM],
3056b3eb03f3Smrg		[Minor version of this package])
3057b3eb03f3Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3058b3eb03f3Smrg	if test "x$PVP" = "x"; then
3059b3eb03f3Smrg		PVP="0"
3060010cdda0Smrg	fi
3061b3eb03f3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3062b3eb03f3Smrg		[$PVP],
3063b3eb03f3Smrg		[Patch version of this package])
3064010cdda0Smrg])
3065010cdda0Smrg
3066b3eb03f3Smrg# XORG_CHANGELOG()
3067b3eb03f3Smrg# ----------------
3068b3eb03f3Smrg# Minimum version: 1.2.0
3069b3eb03f3Smrg#
3070b3eb03f3Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3071b3eb03f3Smrg# ChangeLog from git.
3072b3eb03f3Smrg#
3073b3eb03f3Smrg#
3074b3eb03f3SmrgAC_DEFUN([XORG_CHANGELOG], [
3075af23b0a6SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3076af23b0a6Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3077af23b0a6Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3078b3eb03f3Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
3079b3eb03f3SmrgAC_SUBST([CHANGELOG_CMD])
3080b3eb03f3Smrg]) # XORG_CHANGELOG
3081b3eb03f3Smrg
3082