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