aclocal.m4 revision 533545b5
1533545b5Smrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
2533545b5Smrg
3533545b5Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
4264fa531Smrg
5264fa531Smrg# This file is free software; the Free Software Foundation
6264fa531Smrg# gives unlimited permission to copy and/or distribute it,
7264fa531Smrg# with or without modifications, as long as this notice is preserved.
8264fa531Smrg
9264fa531Smrg# This program is distributed in the hope that it will be useful,
10264fa531Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11264fa531Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12264fa531Smrg# PARTICULAR PURPOSE.
13264fa531Smrg
14533545b5Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15c37a63b8Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16c37a63b8Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17533545b5Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
18533545b5Smrg[m4_warning([this file was generated for autoconf 2.69.
19c37a63b8SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20c37a63b8SmrgIf you have problems, you may need to regenerate the build system entirely.
21533545b5SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22264fa531Smrg
23533545b5Smrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
24c37a63b8Smrg#
25c37a63b8Smrg# This file is free software; the Free Software Foundation
26c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
27c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
28264fa531Smrg
29264fa531Smrg# AM_AUTOMAKE_VERSION(VERSION)
30264fa531Smrg# ----------------------------
31264fa531Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32264fa531Smrg# generated from the m4 files accompanying Automake X.Y.
33c37a63b8Smrg# (This private macro should not be called outside this file.)
34c37a63b8SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35533545b5Smrg[am__api_version='1.15'
36c37a63b8Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37c37a63b8Smrgdnl require some minimum version.  Point them to the right macro.
38533545b5Smrgm4_if([$1], [1.15], [],
39c37a63b8Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40c37a63b8Smrg])
41c37a63b8Smrg
42c37a63b8Smrg# _AM_AUTOCONF_VERSION(VERSION)
43c37a63b8Smrg# -----------------------------
44c37a63b8Smrg# aclocal traces this macro to find the Autoconf version.
45c37a63b8Smrg# This is a private macro too.  Using m4_define simplifies
46c37a63b8Smrg# the logic in aclocal, which can simply ignore this definition.
47c37a63b8Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48264fa531Smrg
49264fa531Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50264fa531Smrg# -------------------------------
51c37a63b8Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52c37a63b8Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53264fa531SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54533545b5Smrg[AM_AUTOMAKE_VERSION([1.15])dnl
55c37a63b8Smrgm4_ifndef([AC_AUTOCONF_VERSION],
56c37a63b8Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57c37a63b8Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58264fa531Smrg
59c37a63b8Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60264fa531Smrg
61533545b5Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
62264fa531Smrg#
63c37a63b8Smrg# This file is free software; the Free Software Foundation
64c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
65c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
66264fa531Smrg
67264fa531Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68533545b5Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69533545b5Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70264fa531Smrg#
71264fa531Smrg# Of course, Automake must honor this variable whenever it calls a
72264fa531Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73264fa531Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74264fa531Smrg# depending on how configure is run.  This is pretty annoying, since
75264fa531Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76264fa531Smrg# source directory, any form will work fine, but in subdirectories a
77264fa531Smrg# relative path needs to be adjusted first.
78264fa531Smrg#
79264fa531Smrg# $ac_aux_dir/missing
80264fa531Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81264fa531Smrg# $top_srcdir/$ac_aux_dir/missing
82264fa531Smrg#    fails if $ac_aux_dir is absolute,
83264fa531Smrg#    fails when called from a subdirectory in a VPATH build with
84264fa531Smrg#          a relative $ac_aux_dir
85264fa531Smrg#
86264fa531Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87264fa531Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
88533545b5Smrg# harmless because $srcdir is '.', but things will broke when you
89264fa531Smrg# start a VPATH build or use an absolute $srcdir.
90264fa531Smrg#
91264fa531Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92264fa531Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93264fa531Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94264fa531Smrg# and then we would define $MISSING as
95264fa531Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96264fa531Smrg# This will work as long as MISSING is not called from configure, because
97264fa531Smrg# unfortunately $(top_srcdir) has no meaning in configure.
98264fa531Smrg# However there are other variables, like CC, which are often used in
99264fa531Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100264fa531Smrg#
101264fa531Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
102264fa531Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
103264fa531Smrg# configured tree to be moved without reconfiguration.
104264fa531Smrg
105c37a63b8SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106533545b5Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107533545b5Smrg# Expand $ac_aux_dir to an absolute path.
108533545b5Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109264fa531Smrg])
110264fa531Smrg
111c37a63b8Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112264fa531Smrg
113533545b5Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
114c37a63b8Smrg#
115c37a63b8Smrg# This file is free software; the Free Software Foundation
116c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
117c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
118264fa531Smrg
119c37a63b8Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120c37a63b8Smrg# -------------------------------------
121c37a63b8Smrg# Define a conditional.
122c37a63b8SmrgAC_DEFUN([AM_CONDITIONAL],
123533545b5Smrg[AC_PREREQ([2.52])dnl
124533545b5Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
125533545b5Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126c37a63b8SmrgAC_SUBST([$1_TRUE])dnl
127c37a63b8SmrgAC_SUBST([$1_FALSE])dnl
128c37a63b8Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129c37a63b8Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130c37a63b8Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131c37a63b8Smrgif $2; then
132c37a63b8Smrg  $1_TRUE=
133c37a63b8Smrg  $1_FALSE='#'
134264fa531Smrgelse
135c37a63b8Smrg  $1_TRUE='#'
136c37a63b8Smrg  $1_FALSE=
137264fa531Smrgfi
138c37a63b8SmrgAC_CONFIG_COMMANDS_PRE(
139c37a63b8Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140c37a63b8Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141c37a63b8SmrgUsually this means the macro was only invoked conditionally.]])
142c37a63b8Smrgfi])])
143264fa531Smrg
144533545b5Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
145c37a63b8Smrg#
146c37a63b8Smrg# This file is free software; the Free Software Foundation
147c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
148c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
149264fa531Smrg
150264fa531Smrg
151533545b5Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
152264fa531Smrg# written in clear, in which case automake, when reading aclocal.m4,
153264fa531Smrg# will think it sees a *use*, and therefore will trigger all it's
154264fa531Smrg# C support machinery.  Also note that it means that autoscan, seeing
155264fa531Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156264fa531Smrg
157264fa531Smrg
158264fa531Smrg# _AM_DEPENDENCIES(NAME)
159264fa531Smrg# ----------------------
160264fa531Smrg# See how the compiler implements dependency checking.
161533545b5Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
162264fa531Smrg# We try a few techniques and use that to set a single cache variable.
163264fa531Smrg#
164264fa531Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
165264fa531Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
166264fa531Smrg# dependency, and given that the user is not expected to run this macro,
167264fa531Smrg# just rely on AC_PROG_CC.
168264fa531SmrgAC_DEFUN([_AM_DEPENDENCIES],
169264fa531Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
170264fa531SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
171264fa531SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
172264fa531SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173264fa531Smrg
174533545b5Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
175533545b5Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
176533545b5Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
177533545b5Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
178533545b5Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
179533545b5Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
180533545b5Smrg                    [depcc="$$1"   am_compiler_list=])
181264fa531Smrg
182264fa531SmrgAC_CACHE_CHECK([dependency style of $depcc],
183264fa531Smrg               [am_cv_$1_dependencies_compiler_type],
184264fa531Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
185264fa531Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
186264fa531Smrg  # making bogus files that we don't know about and never remove.  For
187264fa531Smrg  # instance it was reported that on HP-UX the gcc test will end up
188533545b5Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
189533545b5Smrg  # in D".
190533545b5Smrg  rm -rf conftest.dir
191264fa531Smrg  mkdir conftest.dir
192264fa531Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
193264fa531Smrg  # using a relative directory.
194264fa531Smrg  cp "$am_depcomp" conftest.dir
195264fa531Smrg  cd conftest.dir
196264fa531Smrg  # We will build objects and dependencies in a subdirectory because
197264fa531Smrg  # it helps to detect inapplicable dependency modes.  For instance
198264fa531Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
199264fa531Smrg  # side effect of compilation, but ICC will put the dependencies in
200264fa531Smrg  # the current directory while Tru64 will put them in the object
201264fa531Smrg  # directory.
202264fa531Smrg  mkdir sub
203264fa531Smrg
204264fa531Smrg  am_cv_$1_dependencies_compiler_type=none
205264fa531Smrg  if test "$am_compiler_list" = ""; then
206264fa531Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
207264fa531Smrg  fi
208c37a63b8Smrg  am__universal=false
209c37a63b8Smrg  m4_case([$1], [CC],
210c37a63b8Smrg    [case " $depcc " in #(
211c37a63b8Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212c37a63b8Smrg     esac],
213c37a63b8Smrg    [CXX],
214c37a63b8Smrg    [case " $depcc " in #(
215c37a63b8Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216c37a63b8Smrg     esac])
217c37a63b8Smrg
218264fa531Smrg  for depmode in $am_compiler_list; do
219264fa531Smrg    # Setup a source with many dependencies, because some compilers
220264fa531Smrg    # like to wrap large dependency lists on column 80 (with \), and
221264fa531Smrg    # we should not choose a depcomp mode which is confused by this.
222264fa531Smrg    #
223264fa531Smrg    # We need to recreate these files for each test, as the compiler may
224264fa531Smrg    # overwrite some of them when testing with obscure command lines.
225264fa531Smrg    # This happens at least with the AIX C compiler.
226264fa531Smrg    : > sub/conftest.c
227264fa531Smrg    for i in 1 2 3 4 5 6; do
228264fa531Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
229533545b5Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
230533545b5Smrg      # Solaris 10 /bin/sh.
231533545b5Smrg      echo '/* dummy */' > sub/conftst$i.h
232264fa531Smrg    done
233264fa531Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234264fa531Smrg
235533545b5Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236c37a63b8Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
237533545b5Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
238533545b5Smrg    # versions had trouble with output in subdirs.
239c37a63b8Smrg    am__obj=sub/conftest.${OBJEXT-o}
240c37a63b8Smrg    am__minus_obj="-o $am__obj"
241264fa531Smrg    case $depmode in
242c37a63b8Smrg    gcc)
243c37a63b8Smrg      # This depmode causes a compiler race in universal mode.
244c37a63b8Smrg      test "$am__universal" = false || continue
245c37a63b8Smrg      ;;
246264fa531Smrg    nosideeffect)
247533545b5Smrg      # After this tag, mechanisms are not by side-effect, so they'll
248533545b5Smrg      # only be used when explicitly requested.
249264fa531Smrg      if test "x$enable_dependency_tracking" = xyes; then
250264fa531Smrg	continue
251264fa531Smrg      else
252264fa531Smrg	break
253264fa531Smrg      fi
254264fa531Smrg      ;;
255533545b5Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
256533545b5Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
257c37a63b8Smrg      # not run yet.  These depmodes are late enough in the game, and
258c37a63b8Smrg      # so weak that their functioning should not be impacted.
259c37a63b8Smrg      am__obj=conftest.${OBJEXT-o}
260c37a63b8Smrg      am__minus_obj=
261c37a63b8Smrg      ;;
262264fa531Smrg    none) break ;;
263264fa531Smrg    esac
264264fa531Smrg    if depmode=$depmode \
265c37a63b8Smrg       source=sub/conftest.c object=$am__obj \
266264fa531Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267c37a63b8Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
268264fa531Smrg         >/dev/null 2>conftest.err &&
269c37a63b8Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
270264fa531Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271c37a63b8Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
272264fa531Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
273264fa531Smrg      # icc doesn't choke on unknown options, it will just issue warnings
274c37a63b8Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
275c37a63b8Smrg      # that says an option was ignored or not supported.
276c37a63b8Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
277c37a63b8Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
278c37a63b8Smrg      # The diagnosis changed in icc 8.0:
279c37a63b8Smrg      #   icc: Command line remark: option '-MP' not supported
280c37a63b8Smrg      if (grep 'ignoring option' conftest.err ||
281c37a63b8Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
282264fa531Smrg        am_cv_$1_dependencies_compiler_type=$depmode
283264fa531Smrg        break
284264fa531Smrg      fi
285264fa531Smrg    fi
286264fa531Smrg  done
287264fa531Smrg
288264fa531Smrg  cd ..
289264fa531Smrg  rm -rf conftest.dir
290264fa531Smrgelse
291264fa531Smrg  am_cv_$1_dependencies_compiler_type=none
292264fa531Smrgfi
293264fa531Smrg])
294264fa531SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
295264fa531SmrgAM_CONDITIONAL([am__fastdep$1], [
296264fa531Smrg  test "x$enable_dependency_tracking" != xno \
297264fa531Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298264fa531Smrg])
299264fa531Smrg
300264fa531Smrg
301264fa531Smrg# AM_SET_DEPDIR
302264fa531Smrg# -------------
303264fa531Smrg# Choose a directory name for dependency files.
304533545b5Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
305264fa531SmrgAC_DEFUN([AM_SET_DEPDIR],
306264fa531Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
307264fa531SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
308264fa531Smrg])
309264fa531Smrg
310264fa531Smrg
311264fa531Smrg# AM_DEP_TRACK
312264fa531Smrg# ------------
313264fa531SmrgAC_DEFUN([AM_DEP_TRACK],
314533545b5Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
315533545b5SmrgAS_HELP_STRING(
316533545b5Smrg  [--enable-dependency-tracking],
317533545b5Smrg  [do not reject slow dependency extractors])
318533545b5SmrgAS_HELP_STRING(
319533545b5Smrg  [--disable-dependency-tracking],
320533545b5Smrg  [speeds up one-time build])])
321264fa531Smrgif test "x$enable_dependency_tracking" != xno; then
322264fa531Smrg  am_depcomp="$ac_aux_dir/depcomp"
323264fa531Smrg  AMDEPBACKSLASH='\'
324533545b5Smrg  am__nodep='_no'
325264fa531Smrgfi
326264fa531SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
327c37a63b8SmrgAC_SUBST([AMDEPBACKSLASH])dnl
328c37a63b8Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
329533545b5SmrgAC_SUBST([am__nodep])dnl
330533545b5Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
331264fa531Smrg])
332264fa531Smrg
333c37a63b8Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334264fa531Smrg
335533545b5Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
336c37a63b8Smrg#
337c37a63b8Smrg# This file is free software; the Free Software Foundation
338c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
339c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
340264fa531Smrg
341264fa531Smrg
342264fa531Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
343264fa531Smrg# ------------------------------
344264fa531SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
345c37a63b8Smrg[{
346533545b5Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
347c37a63b8Smrg  # are listed without --file.  Let's play safe and only enable the eval
348c37a63b8Smrg  # if we detect the quoting.
349c37a63b8Smrg  case $CONFIG_FILES in
350c37a63b8Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
351c37a63b8Smrg  *)   set x $CONFIG_FILES ;;
352c37a63b8Smrg  esac
353c37a63b8Smrg  shift
354c37a63b8Smrg  for mf
355c37a63b8Smrg  do
356c37a63b8Smrg    # Strip MF so we end up with the name of the file.
357c37a63b8Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
358c37a63b8Smrg    # Check whether this is an Automake generated Makefile or not.
359533545b5Smrg    # We used to match only the files named 'Makefile.in', but
360c37a63b8Smrg    # some people rename them; so instead we look at the file content.
361c37a63b8Smrg    # Grep'ing the first line is not enough: some people post-process
362c37a63b8Smrg    # each Makefile.in and add a new line on top of each file to say so.
363c37a63b8Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
364c37a63b8Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
365c37a63b8Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
366c37a63b8Smrg      dirpart=`AS_DIRNAME("$mf")`
367c37a63b8Smrg    else
368c37a63b8Smrg      continue
369c37a63b8Smrg    fi
370c37a63b8Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
371533545b5Smrg    # from the Makefile without running 'make'.
372c37a63b8Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
373c37a63b8Smrg    test -z "$DEPDIR" && continue
374c37a63b8Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
375533545b5Smrg    test -z "$am__include" && continue
376c37a63b8Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
377c37a63b8Smrg    # Find all dependency output files, they are included files with
378c37a63b8Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
379c37a63b8Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
380c37a63b8Smrg    # expansion.
381c37a63b8Smrg    for file in `sed -n "
382c37a63b8Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
383533545b5Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
384c37a63b8Smrg      # Make sure the directory exists.
385c37a63b8Smrg      test -f "$dirpart/$file" && continue
386c37a63b8Smrg      fdir=`AS_DIRNAME(["$file"])`
387c37a63b8Smrg      AS_MKDIR_P([$dirpart/$fdir])
388c37a63b8Smrg      # echo "creating $dirpart/$file"
389c37a63b8Smrg      echo '# dummy' > "$dirpart/$file"
390c37a63b8Smrg    done
391264fa531Smrg  done
392c37a63b8Smrg}
393264fa531Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
394264fa531Smrg
395264fa531Smrg
396264fa531Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
397264fa531Smrg# -----------------------------
398264fa531Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
399264fa531Smrg#
400264fa531Smrg# This code is only required when automatic dependency tracking
401533545b5Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
402264fa531Smrg# need in order to bootstrap the dependency handling code.
403264fa531SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
404264fa531Smrg[AC_CONFIG_COMMANDS([depfiles],
405264fa531Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
406264fa531Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
407264fa531Smrg])
408264fa531Smrg
409c37a63b8Smrg# Do all the work for Automake.                             -*- Autoconf -*-
410264fa531Smrg
411533545b5Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
412c37a63b8Smrg#
413c37a63b8Smrg# This file is free software; the Free Software Foundation
414c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
415c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
416264fa531Smrg
417c37a63b8Smrg# This macro actually does too much.  Some checks are only needed if
418c37a63b8Smrg# your package does certain things.  But this isn't really a big deal.
419c37a63b8Smrg
420533545b5Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
421533545b5Smrgm4_define([AC_PROG_CC],
422533545b5Smrgm4_defn([AC_PROG_CC])
423533545b5Smrg[_AM_PROG_CC_C_O
424533545b5Smrg])
425533545b5Smrg
426c37a63b8Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
427c37a63b8Smrg# AM_INIT_AUTOMAKE([OPTIONS])
428c37a63b8Smrg# -----------------------------------------------
429c37a63b8Smrg# The call with PACKAGE and VERSION arguments is the old style
430c37a63b8Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
431c37a63b8Smrg# and VERSION should now be passed to AC_INIT and removed from
432c37a63b8Smrg# the call to AM_INIT_AUTOMAKE.
433c37a63b8Smrg# We support both call styles for the transition.  After
434c37a63b8Smrg# the next Automake release, Autoconf can make the AC_INIT
435c37a63b8Smrg# arguments mandatory, and then we can depend on a new Autoconf
436c37a63b8Smrg# release and drop the old call support.
437c37a63b8SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
438533545b5Smrg[AC_PREREQ([2.65])dnl
439c37a63b8Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
440c37a63b8Smrgdnl the ones we care about.
441c37a63b8Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
442c37a63b8SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
443c37a63b8SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
444c37a63b8Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
445c37a63b8Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
446c37a63b8Smrg  # is not polluted with repeated "-I."
447c37a63b8Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
448c37a63b8Smrg  # test to see if srcdir already configured
449c37a63b8Smrg  if test -f $srcdir/config.status; then
450c37a63b8Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
451c37a63b8Smrg  fi
452264fa531Smrgfi
453c37a63b8Smrg
454c37a63b8Smrg# test whether we have cygpath
455c37a63b8Smrgif test -z "$CYGPATH_W"; then
456c37a63b8Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
457c37a63b8Smrg    CYGPATH_W='cygpath -w'
458c37a63b8Smrg  else
459c37a63b8Smrg    CYGPATH_W=echo
460c37a63b8Smrg  fi
461264fa531Smrgfi
462c37a63b8SmrgAC_SUBST([CYGPATH_W])
463264fa531Smrg
464c37a63b8Smrg# Define the identity of the package.
465c37a63b8Smrgdnl Distinguish between old-style and new-style calls.
466c37a63b8Smrgm4_ifval([$2],
467533545b5Smrg[AC_DIAGNOSE([obsolete],
468533545b5Smrg             [$0: two- and three-arguments forms are deprecated.])
469533545b5Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
470c37a63b8Smrg AC_SUBST([PACKAGE], [$1])dnl
471c37a63b8Smrg AC_SUBST([VERSION], [$2])],
472c37a63b8Smrg[_AM_SET_OPTIONS([$1])dnl
473c37a63b8Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
474533545b5Smrgm4_if(
475533545b5Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
476533545b5Smrg  [ok:ok],,
477c37a63b8Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
478c37a63b8Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
479c37a63b8Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
480264fa531Smrg
481c37a63b8Smrg_AM_IF_OPTION([no-define],,
482533545b5Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
483533545b5Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
484264fa531Smrg
485c37a63b8Smrg# Some tools Automake needs.
486c37a63b8SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
487c37a63b8SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
488533545b5SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
489533545b5SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
490533545b5SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
491533545b5SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
492533545b5SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
493c37a63b8SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
494c37a63b8SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
495533545b5SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
496533545b5Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
497533545b5Smrg# dies out for good.  For more background, see:
498533545b5Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
499533545b5Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
500533545b5SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
501533545b5Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
502533545b5Smrg# system "awk" is bad on some platforms.
503c37a63b8SmrgAC_REQUIRE([AC_PROG_AWK])dnl
504c37a63b8SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
505c37a63b8SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
506c37a63b8Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
507c37a63b8Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
508c37a63b8Smrg			     [_AM_PROG_TAR([v7])])])
509c37a63b8Smrg_AM_IF_OPTION([no-dependencies],,
510c37a63b8Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
511533545b5Smrg		  [_AM_DEPENDENCIES([CC])],
512533545b5Smrg		  [m4_define([AC_PROG_CC],
513533545b5Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
514c37a63b8SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
515533545b5Smrg		  [_AM_DEPENDENCIES([CXX])],
516533545b5Smrg		  [m4_define([AC_PROG_CXX],
517533545b5Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
518c37a63b8SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
519533545b5Smrg		  [_AM_DEPENDENCIES([OBJC])],
520533545b5Smrg		  [m4_define([AC_PROG_OBJC],
521533545b5Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
522533545b5SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
523533545b5Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
524533545b5Smrg		  [m4_define([AC_PROG_OBJCXX],
525533545b5Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
526c37a63b8Smrg])
527533545b5SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
528533545b5Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
529533545b5Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
530533545b5Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
531c37a63b8SmrgAC_CONFIG_COMMANDS_PRE(dnl
532c37a63b8Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
533c37a63b8Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
534533545b5Smrg
535533545b5Smrg# POSIX will say in a future version that running "rm -f" with no argument
536533545b5Smrg# is OK; and we want to be able to make that assumption in our Makefile
537533545b5Smrg# recipes.  So use an aggressive probe to check that the usage we want is
538533545b5Smrg# actually supported "in the wild" to an acceptable degree.
539533545b5Smrg# See automake bug#10828.
540533545b5Smrg# To make any issue more visible, cause the running configure to be aborted
541533545b5Smrg# by default if the 'rm' program in use doesn't match our expectations; the
542533545b5Smrg# user can still override this though.
543533545b5Smrgif rm -f && rm -fr && rm -rf; then : OK; else
544533545b5Smrg  cat >&2 <<'END'
545533545b5SmrgOops!
546533545b5Smrg
547533545b5SmrgYour 'rm' program seems unable to run without file operands specified
548533545b5Smrgon the command line, even when the '-f' option is present.  This is contrary
549533545b5Smrgto the behaviour of most rm programs out there, and not conforming with
550533545b5Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
551533545b5Smrg
552533545b5SmrgPlease tell bug-automake@gnu.org about your system, including the value
553533545b5Smrgof your $PATH and any error possibly output before this message.  This
554533545b5Smrgcan help us improve future automake versions.
555533545b5Smrg
556533545b5SmrgEND
557533545b5Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
558533545b5Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
559533545b5Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
560533545b5Smrg    echo >&2
561533545b5Smrg  else
562533545b5Smrg    cat >&2 <<'END'
563533545b5SmrgAborting the configuration process, to ensure you take notice of the issue.
564533545b5Smrg
565533545b5SmrgYou can download and install GNU coreutils to get an 'rm' implementation
566533545b5Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
567533545b5Smrg
568533545b5SmrgIf you want to complete the configuration process using your problematic
569533545b5Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
570533545b5Smrgto "yes", and re-run configure.
571533545b5Smrg
572533545b5SmrgEND
573533545b5Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
574533545b5Smrg  fi
575533545b5Smrgfi
576533545b5Smrgdnl The trailing newline in this macro's definition is deliberate, for
577533545b5Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
578533545b5Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
579c37a63b8Smrg])
580264fa531Smrg
581533545b5Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
582c37a63b8Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
583c37a63b8Smrgdnl mangled by Autoconf and run in a shell conditional statement.
584c37a63b8Smrgm4_define([_AC_COMPILER_EXEEXT],
585c37a63b8Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
586264fa531Smrg
587c37a63b8Smrg# When config.status generates a header, we must update the stamp-h file.
588c37a63b8Smrg# This file resides in the same directory as the config header
589c37a63b8Smrg# that is generated.  The stamp files are numbered to have different names.
590c37a63b8Smrg
591c37a63b8Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
592c37a63b8Smrg# loop where config.status creates the headers, so we can generate
593c37a63b8Smrg# our stamp files there.
594c37a63b8SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
595c37a63b8Smrg[# Compute $1's index in $config_headers.
596c37a63b8Smrg_am_arg=$1
597c37a63b8Smrg_am_stamp_count=1
598c37a63b8Smrgfor _am_header in $config_headers :; do
599c37a63b8Smrg  case $_am_header in
600c37a63b8Smrg    $_am_arg | $_am_arg:* )
601c37a63b8Smrg      break ;;
602c37a63b8Smrg    * )
603c37a63b8Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
604c37a63b8Smrg  esac
605c37a63b8Smrgdone
606c37a63b8Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
607264fa531Smrg
608533545b5Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
609c37a63b8Smrg#
610c37a63b8Smrg# This file is free software; the Free Software Foundation
611c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
612c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
613264fa531Smrg
614c37a63b8Smrg# AM_PROG_INSTALL_SH
615c37a63b8Smrg# ------------------
616c37a63b8Smrg# Define $install_sh.
617c37a63b8SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
618c37a63b8Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
619533545b5Smrgif test x"${install_sh+set}" != xset; then
620c37a63b8Smrg  case $am_aux_dir in
621c37a63b8Smrg  *\ * | *\	*)
622c37a63b8Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
623c37a63b8Smrg  *)
624c37a63b8Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
625c37a63b8Smrg  esac
626264fa531Smrgfi
627533545b5SmrgAC_SUBST([install_sh])])
628264fa531Smrg
629533545b5Smrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
630c37a63b8Smrg#
631c37a63b8Smrg# This file is free software; the Free Software Foundation
632c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
633c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
634264fa531Smrg
635c37a63b8Smrg# Check whether the underlying file-system supports filenames
636c37a63b8Smrg# with a leading dot.  For instance MS-DOS doesn't.
637c37a63b8SmrgAC_DEFUN([AM_SET_LEADING_DOT],
638c37a63b8Smrg[rm -rf .tst 2>/dev/null
639c37a63b8Smrgmkdir .tst 2>/dev/null
640c37a63b8Smrgif test -d .tst; then
641c37a63b8Smrg  am__leading_dot=.
642c37a63b8Smrgelse
643c37a63b8Smrg  am__leading_dot=_
644c37a63b8Smrgfi
645c37a63b8Smrgrmdir .tst 2>/dev/null
646c37a63b8SmrgAC_SUBST([am__leading_dot])])
647264fa531Smrg
648c37a63b8Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
649264fa531Smrg
650533545b5Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
651c37a63b8Smrg#
652c37a63b8Smrg# This file is free software; the Free Software Foundation
653c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
654c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
655264fa531Smrg
656c37a63b8Smrg# AM_MAKE_INCLUDE()
657c37a63b8Smrg# -----------------
658c37a63b8Smrg# Check to see how make treats includes.
659c37a63b8SmrgAC_DEFUN([AM_MAKE_INCLUDE],
660c37a63b8Smrg[am_make=${MAKE-make}
661c37a63b8Smrgcat > confinc << 'END'
662c37a63b8Smrgam__doit:
663c37a63b8Smrg	@echo this is the am__doit target
664c37a63b8Smrg.PHONY: am__doit
665c37a63b8SmrgEND
666c37a63b8Smrg# If we don't find an include directive, just comment out the code.
667c37a63b8SmrgAC_MSG_CHECKING([for style of include used by $am_make])
668c37a63b8Smrgam__include="#"
669c37a63b8Smrgam__quote=
670c37a63b8Smrg_am_result=none
671c37a63b8Smrg# First try GNU make style include.
672c37a63b8Smrgecho "include confinc" > confmf
673533545b5Smrg# Ignore all kinds of additional output from 'make'.
674c37a63b8Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
675c37a63b8Smrg*the\ am__doit\ target*)
676c37a63b8Smrg  am__include=include
677c37a63b8Smrg  am__quote=
678c37a63b8Smrg  _am_result=GNU
679c37a63b8Smrg  ;;
680c37a63b8Smrgesac
681c37a63b8Smrg# Now try BSD make style include.
682c37a63b8Smrgif test "$am__include" = "#"; then
683c37a63b8Smrg   echo '.include "confinc"' > confmf
684c37a63b8Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
685c37a63b8Smrg   *the\ am__doit\ target*)
686c37a63b8Smrg     am__include=.include
687c37a63b8Smrg     am__quote="\""
688c37a63b8Smrg     _am_result=BSD
689c37a63b8Smrg     ;;
690c37a63b8Smrg   esac
691c37a63b8Smrgfi
692c37a63b8SmrgAC_SUBST([am__include])
693c37a63b8SmrgAC_SUBST([am__quote])
694c37a63b8SmrgAC_MSG_RESULT([$_am_result])
695c37a63b8Smrgrm -f confinc confmf
696c37a63b8Smrg])
697264fa531Smrg
698c37a63b8Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
699264fa531Smrg
700533545b5Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
701c37a63b8Smrg#
702c37a63b8Smrg# This file is free software; the Free Software Foundation
703c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
704c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
705264fa531Smrg
706c37a63b8Smrg# AM_MISSING_PROG(NAME, PROGRAM)
707c37a63b8Smrg# ------------------------------
708c37a63b8SmrgAC_DEFUN([AM_MISSING_PROG],
709c37a63b8Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
710c37a63b8Smrg$1=${$1-"${am_missing_run}$2"}
711c37a63b8SmrgAC_SUBST($1)])
712264fa531Smrg
713c37a63b8Smrg# AM_MISSING_HAS_RUN
714c37a63b8Smrg# ------------------
715533545b5Smrg# Define MISSING if not defined so far and test if it is modern enough.
716533545b5Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
717c37a63b8SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
718c37a63b8Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
719c37a63b8SmrgAC_REQUIRE_AUX_FILE([missing])dnl
720c37a63b8Smrgif test x"${MISSING+set}" != xset; then
721c37a63b8Smrg  case $am_aux_dir in
722c37a63b8Smrg  *\ * | *\	*)
723c37a63b8Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
724c37a63b8Smrg  *)
725c37a63b8Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
726c37a63b8Smrg  esac
727264fa531Smrgfi
728c37a63b8Smrg# Use eval to expand $SHELL
729533545b5Smrgif eval "$MISSING --is-lightweight"; then
730533545b5Smrg  am_missing_run="$MISSING "
731c37a63b8Smrgelse
732c37a63b8Smrg  am_missing_run=
733533545b5Smrg  AC_MSG_WARN(['missing' script is too old or missing])
734c37a63b8Smrgfi
735c37a63b8Smrg])
736264fa531Smrg
737c37a63b8Smrg# Helper functions for option handling.                     -*- Autoconf -*-
738c37a63b8Smrg
739533545b5Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
740264fa531Smrg#
741c37a63b8Smrg# This file is free software; the Free Software Foundation
742c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
743c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
744c37a63b8Smrg
745c37a63b8Smrg# _AM_MANGLE_OPTION(NAME)
746c37a63b8Smrg# -----------------------
747c37a63b8SmrgAC_DEFUN([_AM_MANGLE_OPTION],
748c37a63b8Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
749c37a63b8Smrg
750c37a63b8Smrg# _AM_SET_OPTION(NAME)
751533545b5Smrg# --------------------
752c37a63b8Smrg# Set option NAME.  Presently that only means defining a flag for this option.
753c37a63b8SmrgAC_DEFUN([_AM_SET_OPTION],
754533545b5Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
755c37a63b8Smrg
756c37a63b8Smrg# _AM_SET_OPTIONS(OPTIONS)
757533545b5Smrg# ------------------------
758c37a63b8Smrg# OPTIONS is a space-separated list of Automake options.
759c37a63b8SmrgAC_DEFUN([_AM_SET_OPTIONS],
760c37a63b8Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
761c37a63b8Smrg
762c37a63b8Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
763c37a63b8Smrg# -------------------------------------------
764c37a63b8Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
765c37a63b8SmrgAC_DEFUN([_AM_IF_OPTION],
766c37a63b8Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
767c37a63b8Smrg
768533545b5Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
769533545b5Smrg#
770533545b5Smrg# This file is free software; the Free Software Foundation
771533545b5Smrg# gives unlimited permission to copy and/or distribute it,
772533545b5Smrg# with or without modifications, as long as this notice is preserved.
773533545b5Smrg
774533545b5Smrg# _AM_PROG_CC_C_O
775533545b5Smrg# ---------------
776533545b5Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
777533545b5Smrg# to automatically call this.
778533545b5SmrgAC_DEFUN([_AM_PROG_CC_C_O],
779533545b5Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
780533545b5SmrgAC_REQUIRE_AUX_FILE([compile])dnl
781533545b5SmrgAC_LANG_PUSH([C])dnl
782533545b5SmrgAC_CACHE_CHECK(
783533545b5Smrg  [whether $CC understands -c and -o together],
784533545b5Smrg  [am_cv_prog_cc_c_o],
785533545b5Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
786533545b5Smrg  # Make sure it works both with $CC and with simple cc.
787533545b5Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
788533545b5Smrg  # compilers refuse to overwrite an existing .o file with -o,
789533545b5Smrg  # though they will create one.
790533545b5Smrg  am_cv_prog_cc_c_o=yes
791533545b5Smrg  for am_i in 1 2; do
792533545b5Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
793533545b5Smrg         && test -f conftest2.$ac_objext; then
794533545b5Smrg      : OK
795533545b5Smrg    else
796533545b5Smrg      am_cv_prog_cc_c_o=no
797533545b5Smrg      break
798533545b5Smrg    fi
799533545b5Smrg  done
800533545b5Smrg  rm -f core conftest*
801533545b5Smrg  unset am_i])
802533545b5Smrgif test "$am_cv_prog_cc_c_o" != yes; then
803533545b5Smrg   # Losing compiler, so override with the script.
804533545b5Smrg   # FIXME: It is wrong to rewrite CC.
805533545b5Smrg   # But if we don't then we get into trouble of one sort or another.
806533545b5Smrg   # A longer-term fix would be to have automake use am__CC in this case,
807533545b5Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
808533545b5Smrg   CC="$am_aux_dir/compile $CC"
809533545b5Smrgfi
810533545b5SmrgAC_LANG_POP([C])])
811c37a63b8Smrg
812533545b5Smrg# For backward compatibility.
813533545b5SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
814533545b5Smrg
815533545b5Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
816264fa531Smrg#
817c37a63b8Smrg# This file is free software; the Free Software Foundation
818c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
819c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
820264fa531Smrg
821533545b5Smrg# AM_RUN_LOG(COMMAND)
822533545b5Smrg# -------------------
823533545b5Smrg# Run COMMAND, save the exit status in ac_status, and log it.
824533545b5Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
825533545b5SmrgAC_DEFUN([AM_RUN_LOG],
826533545b5Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
827533545b5Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
828533545b5Smrg   ac_status=$?
829533545b5Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
830533545b5Smrg   (exit $ac_status); }])
831533545b5Smrg
832533545b5Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
833533545b5Smrg
834533545b5Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
835533545b5Smrg#
836533545b5Smrg# This file is free software; the Free Software Foundation
837533545b5Smrg# gives unlimited permission to copy and/or distribute it,
838533545b5Smrg# with or without modifications, as long as this notice is preserved.
839264fa531Smrg
840c37a63b8Smrg# AM_SANITY_CHECK
841c37a63b8Smrg# ---------------
842c37a63b8SmrgAC_DEFUN([AM_SANITY_CHECK],
843c37a63b8Smrg[AC_MSG_CHECKING([whether build environment is sane])
844c37a63b8Smrg# Reject unsafe characters in $srcdir or the absolute working directory
845c37a63b8Smrg# name.  Accept space and tab only in the latter.
846c37a63b8Smrgam_lf='
847c37a63b8Smrg'
848c37a63b8Smrgcase `pwd` in
849c37a63b8Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
850c37a63b8Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
851c37a63b8Smrgesac
852c37a63b8Smrgcase $srcdir in
853c37a63b8Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
854533545b5Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
855c37a63b8Smrgesac
856c37a63b8Smrg
857533545b5Smrg# Do 'set' in a subshell so we don't clobber the current shell's
858c37a63b8Smrg# arguments.  Must try -L first in case configure is actually a
859c37a63b8Smrg# symlink; some systems play weird games with the mod time of symlinks
860c37a63b8Smrg# (eg FreeBSD returns the mod time of the symlink's containing
861c37a63b8Smrg# directory).
862c37a63b8Smrgif (
863533545b5Smrg   am_has_slept=no
864533545b5Smrg   for am_try in 1 2; do
865533545b5Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
866533545b5Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
867533545b5Smrg     if test "$[*]" = "X"; then
868533545b5Smrg	# -L didn't work.
869533545b5Smrg	set X `ls -t "$srcdir/configure" conftest.file`
870533545b5Smrg     fi
871533545b5Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
872533545b5Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
873533545b5Smrg
874533545b5Smrg	# If neither matched, then we have a broken ls.  This can happen
875533545b5Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
876533545b5Smrg	# broken ls alias from the environment.  This has actually
877533545b5Smrg	# happened.  Such a system could not be considered "sane".
878533545b5Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
879533545b5Smrg  alias in your environment])
880533545b5Smrg     fi
881533545b5Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
882533545b5Smrg       break
883533545b5Smrg     fi
884533545b5Smrg     # Just in case.
885533545b5Smrg     sleep 1
886533545b5Smrg     am_has_slept=yes
887533545b5Smrg   done
888c37a63b8Smrg   test "$[2]" = conftest.file
889c37a63b8Smrg   )
890c37a63b8Smrgthen
891c37a63b8Smrg   # Ok.
892c37a63b8Smrg   :
893264fa531Smrgelse
894c37a63b8Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
895c37a63b8SmrgCheck your system clock])
896c37a63b8Smrgfi
897533545b5SmrgAC_MSG_RESULT([yes])
898533545b5Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
899533545b5Smrg# generated files are strictly newer.
900533545b5Smrgam_sleep_pid=
901533545b5Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
902533545b5Smrg  ( sleep 1 ) &
903533545b5Smrg  am_sleep_pid=$!
904533545b5Smrgfi
905533545b5SmrgAC_CONFIG_COMMANDS_PRE(
906533545b5Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
907533545b5Smrg   if test -n "$am_sleep_pid"; then
908533545b5Smrg     # Hide warnings about reused PIDs.
909533545b5Smrg     wait $am_sleep_pid 2>/dev/null
910533545b5Smrg   fi
911533545b5Smrg   AC_MSG_RESULT([done])])
912533545b5Smrgrm -f conftest.file
913533545b5Smrg])
914264fa531Smrg
915533545b5Smrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
916264fa531Smrg#
917c37a63b8Smrg# This file is free software; the Free Software Foundation
918c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
919c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
920c37a63b8Smrg
921c37a63b8Smrg# AM_SILENT_RULES([DEFAULT])
922c37a63b8Smrg# --------------------------
923c37a63b8Smrg# Enable less verbose build rules; with the default set to DEFAULT
924533545b5Smrg# ("yes" being less verbose, "no" or empty being verbose).
925c37a63b8SmrgAC_DEFUN([AM_SILENT_RULES],
926533545b5Smrg[AC_ARG_ENABLE([silent-rules], [dnl
927533545b5SmrgAS_HELP_STRING(
928533545b5Smrg  [--enable-silent-rules],
929533545b5Smrg  [less verbose build output (undo: "make V=1")])
930533545b5SmrgAS_HELP_STRING(
931533545b5Smrg  [--disable-silent-rules],
932533545b5Smrg  [verbose build output (undo: "make V=0")])dnl
933533545b5Smrg])
934533545b5Smrgcase $enable_silent_rules in @%:@ (((
935533545b5Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
936533545b5Smrg   no) AM_DEFAULT_VERBOSITY=1;;
937533545b5Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
938c37a63b8Smrgesac
939533545b5Smrgdnl
940533545b5Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
941533545b5Smrgdnl do not support nested variable expansions.
942533545b5Smrgdnl See automake bug#9928 and bug#10237.
943533545b5Smrgam_make=${MAKE-make}
944533545b5SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
945533545b5Smrg   [am_cv_make_support_nested_variables],
946533545b5Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
947533545b5SmrgBAR0=false
948533545b5SmrgBAR1=true
949533545b5SmrgV=1
950533545b5Smrgam__doit:
951533545b5Smrg	@$(TRUE)
952533545b5Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
953533545b5Smrg  am_cv_make_support_nested_variables=yes
954533545b5Smrgelse
955533545b5Smrg  am_cv_make_support_nested_variables=no
956533545b5Smrgfi])
957533545b5Smrgif test $am_cv_make_support_nested_variables = yes; then
958533545b5Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
959533545b5Smrg  AM_V='$(V)'
960533545b5Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
961533545b5Smrgelse
962533545b5Smrg  AM_V=$AM_DEFAULT_VERBOSITY
963533545b5Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
964533545b5Smrgfi
965533545b5SmrgAC_SUBST([AM_V])dnl
966533545b5SmrgAM_SUBST_NOTMAKE([AM_V])dnl
967533545b5SmrgAC_SUBST([AM_DEFAULT_V])dnl
968533545b5SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
969c37a63b8SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
970c37a63b8SmrgAM_BACKSLASH='\'
971c37a63b8SmrgAC_SUBST([AM_BACKSLASH])dnl
972c37a63b8Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
973c37a63b8Smrg])
974c37a63b8Smrg
975533545b5Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
976264fa531Smrg#
977c37a63b8Smrg# This file is free software; the Free Software Foundation
978c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
979c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
980c37a63b8Smrg
981c37a63b8Smrg# AM_PROG_INSTALL_STRIP
982c37a63b8Smrg# ---------------------
983533545b5Smrg# One issue with vendor 'install' (even GNU) is that you can't
984c37a63b8Smrg# specify the program used to strip binaries.  This is especially
985c37a63b8Smrg# annoying in cross-compiling environments, where the build's strip
986c37a63b8Smrg# is unlikely to handle the host's binaries.
987c37a63b8Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
988533545b5Smrg# always use install-sh in "make install-strip", and initialize
989c37a63b8Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
990c37a63b8SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
991c37a63b8Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
992533545b5Smrg# Installed binaries are usually stripped using 'strip' when the user
993533545b5Smrg# run "make install-strip".  However 'strip' might not be the right
994c37a63b8Smrg# tool to use in cross-compilation environments, therefore Automake
995533545b5Smrg# will honor the 'STRIP' environment variable to overrule this program.
996533545b5Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
997c37a63b8Smrgif test "$cross_compiling" != no; then
998c37a63b8Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
999c37a63b8Smrgfi
1000c37a63b8SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
1001c37a63b8SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1002c37a63b8Smrg
1003533545b5Smrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
1004264fa531Smrg#
1005c37a63b8Smrg# This file is free software; the Free Software Foundation
1006c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
1007c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
1008264fa531Smrg
1009c37a63b8Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
1010c37a63b8Smrg# ---------------------------
1011c37a63b8Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1012c37a63b8Smrg# This macro is traced by Automake.
1013c37a63b8SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1014264fa531Smrg
1015c37a63b8Smrg# AM_SUBST_NOTMAKE(VARIABLE)
1016533545b5Smrg# --------------------------
1017c37a63b8Smrg# Public sister of _AM_SUBST_NOTMAKE.
1018c37a63b8SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1019264fa531Smrg
1020c37a63b8Smrg# Check how to create a tarball.                            -*- Autoconf -*-
1021c37a63b8Smrg
1022533545b5Smrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
1023c37a63b8Smrg#
1024c37a63b8Smrg# This file is free software; the Free Software Foundation
1025c37a63b8Smrg# gives unlimited permission to copy and/or distribute it,
1026c37a63b8Smrg# with or without modifications, as long as this notice is preserved.
1027c37a63b8Smrg
1028c37a63b8Smrg# _AM_PROG_TAR(FORMAT)
1029c37a63b8Smrg# --------------------
1030c37a63b8Smrg# Check how to create a tarball in format FORMAT.
1031533545b5Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1032c37a63b8Smrg#
1033c37a63b8Smrg# Substitute a variable $(am__tar) that is a command
1034c37a63b8Smrg# writing to stdout a FORMAT-tarball containing the directory
1035c37a63b8Smrg# $tardir.
1036c37a63b8Smrg#     tardir=directory && $(am__tar) > result.tar
1037c37a63b8Smrg#
1038c37a63b8Smrg# Substitute a variable $(am__untar) that extract such
1039c37a63b8Smrg# a tarball read from stdin.
1040c37a63b8Smrg#     $(am__untar) < result.tar
1041533545b5Smrg#
1042c37a63b8SmrgAC_DEFUN([_AM_PROG_TAR],
1043533545b5Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1044533545b5Smrg# in the wild :-(  We should find a proper way to deprecate it ...
1045533545b5SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1046533545b5Smrg
1047533545b5Smrg# We'll loop over all known methods to create a tar archive until one works.
1048c37a63b8Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1049264fa531Smrg
1050533545b5Smrgm4_if([$1], [v7],
1051533545b5Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1052533545b5Smrg
1053533545b5Smrg  [m4_case([$1],
1054533545b5Smrg    [ustar],
1055533545b5Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1056533545b5Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1057533545b5Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1058533545b5Smrg      # and bug#13588).
1059533545b5Smrg      am_max_uid=2097151 # 2^21 - 1
1060533545b5Smrg      am_max_gid=$am_max_uid
1061533545b5Smrg      # The $UID and $GID variables are not portable, so we need to resort
1062533545b5Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1063533545b5Smrg      # below are definitely unexpected, so allow the users to see them
1064533545b5Smrg      # (that is, avoid stderr redirection).
1065533545b5Smrg      am_uid=`id -u || echo unknown`
1066533545b5Smrg      am_gid=`id -g || echo unknown`
1067533545b5Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1068533545b5Smrg      if test $am_uid -le $am_max_uid; then
1069533545b5Smrg         AC_MSG_RESULT([yes])
1070533545b5Smrg      else
1071533545b5Smrg         AC_MSG_RESULT([no])
1072533545b5Smrg         _am_tools=none
1073533545b5Smrg      fi
1074533545b5Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1075533545b5Smrg      if test $am_gid -le $am_max_gid; then
1076533545b5Smrg         AC_MSG_RESULT([yes])
1077533545b5Smrg      else
1078533545b5Smrg        AC_MSG_RESULT([no])
1079533545b5Smrg        _am_tools=none
1080533545b5Smrg      fi],
1081533545b5Smrg
1082533545b5Smrg  [pax],
1083533545b5Smrg    [],
1084533545b5Smrg
1085533545b5Smrg  [m4_fatal([Unknown tar format])])
1086533545b5Smrg
1087533545b5Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1088533545b5Smrg
1089533545b5Smrg  # Go ahead even if we have the value already cached.  We do so because we
1090533545b5Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1091533545b5Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1092533545b5Smrg
1093533545b5Smrg  for _am_tool in $_am_tools; do
1094533545b5Smrg    case $_am_tool in
1095533545b5Smrg    gnutar)
1096533545b5Smrg      for _am_tar in tar gnutar gtar; do
1097533545b5Smrg        AM_RUN_LOG([$_am_tar --version]) && break
1098533545b5Smrg      done
1099533545b5Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1100533545b5Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1101533545b5Smrg      am__untar="$_am_tar -xf -"
1102533545b5Smrg      ;;
1103533545b5Smrg    plaintar)
1104533545b5Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1105533545b5Smrg      # ustar tarball either.
1106533545b5Smrg      (tar --version) >/dev/null 2>&1 && continue
1107533545b5Smrg      am__tar='tar chf - "$$tardir"'
1108533545b5Smrg      am__tar_='tar chf - "$tardir"'
1109533545b5Smrg      am__untar='tar xf -'
1110533545b5Smrg      ;;
1111533545b5Smrg    pax)
1112533545b5Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
1113533545b5Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
1114533545b5Smrg      am__untar='pax -r'
1115533545b5Smrg      ;;
1116533545b5Smrg    cpio)
1117533545b5Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1118533545b5Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1119533545b5Smrg      am__untar='cpio -i -H $1 -d'
1120533545b5Smrg      ;;
1121533545b5Smrg    none)
1122533545b5Smrg      am__tar=false
1123533545b5Smrg      am__tar_=false
1124533545b5Smrg      am__untar=false
1125533545b5Smrg      ;;
1126533545b5Smrg    esac
1127264fa531Smrg
1128533545b5Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
1129533545b5Smrg    # and am__untar set.
1130533545b5Smrg    test -n "${am_cv_prog_tar_$1}" && break
1131533545b5Smrg
1132533545b5Smrg    # tar/untar a dummy directory, and stop if the command works.
1133533545b5Smrg    rm -rf conftest.dir
1134533545b5Smrg    mkdir conftest.dir
1135533545b5Smrg    echo GrepMe > conftest.dir/file
1136533545b5Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1137533545b5Smrg    rm -rf conftest.dir
1138533545b5Smrg    if test -s conftest.tar; then
1139533545b5Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
1140533545b5Smrg      AM_RUN_LOG([cat conftest.dir/file])
1141533545b5Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1142533545b5Smrg    fi
1143533545b5Smrg  done
1144c37a63b8Smrg  rm -rf conftest.dir
1145264fa531Smrg
1146533545b5Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1147533545b5Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1148533545b5Smrg
1149c37a63b8SmrgAC_SUBST([am__tar])
1150c37a63b8SmrgAC_SUBST([am__untar])
1151c37a63b8Smrg]) # _AM_PROG_TAR
1152264fa531Smrg
1153533545b5Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1154533545b5Smrg# 
1155533545b5Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1156533545b5Smrg#
1157533545b5Smrg# This program is free software; you can redistribute it and/or modify
1158533545b5Smrg# it under the terms of the GNU General Public License as published by
1159533545b5Smrg# the Free Software Foundation; either version 2 of the License, or
1160533545b5Smrg# (at your option) any later version.
1161533545b5Smrg#
1162533545b5Smrg# This program is distributed in the hope that it will be useful, but
1163533545b5Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1164533545b5Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1165533545b5Smrg# General Public License for more details.
1166533545b5Smrg#
1167533545b5Smrg# You should have received a copy of the GNU General Public License
1168533545b5Smrg# along with this program; if not, write to the Free Software
1169533545b5Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1170533545b5Smrg#
1171533545b5Smrg# As a special exception to the GNU General Public License, if you
1172533545b5Smrg# distribute this file as part of a program that contains a
1173533545b5Smrg# configuration script generated by Autoconf, you may include it under
1174533545b5Smrg# the same distribution terms that you use for the rest of that program.
1175533545b5Smrg
1176533545b5Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1177533545b5Smrg# ----------------------------------
1178533545b5SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1179533545b5Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1180533545b5Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1181533545b5SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1182533545b5Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1183533545b5Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1184533545b5Smrgfi
1185533545b5Smrgif test -n "$PKG_CONFIG"; then
1186533545b5Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
1187533545b5Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1188533545b5Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1189533545b5Smrg		AC_MSG_RESULT([yes])
1190533545b5Smrg	else
1191533545b5Smrg		AC_MSG_RESULT([no])
1192533545b5Smrg		PKG_CONFIG=""
1193533545b5Smrg	fi
1194533545b5Smrg		
1195533545b5Smrgfi[]dnl
1196533545b5Smrg])# PKG_PROG_PKG_CONFIG
1197533545b5Smrg
1198533545b5Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1199533545b5Smrg#
1200533545b5Smrg# Check to see whether a particular set of modules exists.  Similar
1201533545b5Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1202533545b5Smrg#
1203533545b5Smrg#
1204533545b5Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1205533545b5Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
1206533545b5Smrg# PKG_CHECK_EXISTS manually
1207533545b5Smrg# --------------------------------------------------------------
1208533545b5SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1209533545b5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1210533545b5Smrgif test -n "$PKG_CONFIG" && \
1211533545b5Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1212533545b5Smrg  m4_ifval([$2], [$2], [:])
1213533545b5Smrgm4_ifvaln([$3], [else
1214533545b5Smrg  $3])dnl
1215533545b5Smrgfi])
1216533545b5Smrg
1217533545b5Smrg
1218533545b5Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1219533545b5Smrg# ---------------------------------------------
1220533545b5Smrgm4_define([_PKG_CONFIG],
1221533545b5Smrg[if test -n "$$1"; then
1222533545b5Smrg    pkg_cv_[]$1="$$1"
1223533545b5Smrg elif test -n "$PKG_CONFIG"; then
1224533545b5Smrg    PKG_CHECK_EXISTS([$3],
1225533545b5Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1226533545b5Smrg		     [pkg_failed=yes])
1227533545b5Smrg else
1228533545b5Smrg    pkg_failed=untried
1229533545b5Smrgfi[]dnl
1230533545b5Smrg])# _PKG_CONFIG
1231533545b5Smrg
1232533545b5Smrg# _PKG_SHORT_ERRORS_SUPPORTED
1233533545b5Smrg# -----------------------------
1234533545b5SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1235533545b5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1236533545b5Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1237533545b5Smrg        _pkg_short_errors_supported=yes
1238533545b5Smrgelse
1239533545b5Smrg        _pkg_short_errors_supported=no
1240533545b5Smrgfi[]dnl
1241533545b5Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
1242533545b5Smrg
1243533545b5Smrg
1244533545b5Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1245533545b5Smrg# [ACTION-IF-NOT-FOUND])
1246533545b5Smrg#
1247533545b5Smrg#
1248533545b5Smrg# Note that if there is a possibility the first call to
1249533545b5Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1250533545b5Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1251533545b5Smrg#
1252533545b5Smrg#
1253533545b5Smrg# --------------------------------------------------------------
1254533545b5SmrgAC_DEFUN([PKG_CHECK_MODULES],
1255533545b5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1256533545b5SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1257533545b5SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1258533545b5Smrg
1259533545b5Smrgpkg_failed=no
1260533545b5SmrgAC_MSG_CHECKING([for $1])
1261533545b5Smrg
1262533545b5Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1263533545b5Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1264533545b5Smrg
1265533545b5Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1266533545b5Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1267533545b5SmrgSee the pkg-config man page for more details.])
1268533545b5Smrg
1269533545b5Smrgif test $pkg_failed = yes; then
1270533545b5Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1271533545b5Smrg        if test $_pkg_short_errors_supported = yes; then
1272533545b5Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1273533545b5Smrg        else 
1274533545b5Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1275533545b5Smrg        fi
1276533545b5Smrg	# Put the nasty error message in config.log where it belongs
1277533545b5Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1278533545b5Smrg
1279533545b5Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
1280533545b5Smrg[Package requirements ($2) were not met:
1281533545b5Smrg
1282533545b5Smrg$$1_PKG_ERRORS
1283533545b5Smrg
1284533545b5SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1285533545b5Smrginstalled software in a non-standard prefix.
1286533545b5Smrg
1287533545b5Smrg_PKG_TEXT
1288533545b5Smrg])],
1289533545b5Smrg		[AC_MSG_RESULT([no])
1290533545b5Smrg                $4])
1291533545b5Smrgelif test $pkg_failed = untried; then
1292533545b5Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
1293533545b5Smrg[The pkg-config script could not be found or is too old.  Make sure it
1294533545b5Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1295533545b5Smrgpath to pkg-config.
1296533545b5Smrg
1297533545b5Smrg_PKG_TEXT
1298533545b5Smrg
1299533545b5SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1300533545b5Smrg		[$4])
1301533545b5Smrgelse
1302533545b5Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1303533545b5Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1304533545b5Smrg        AC_MSG_RESULT([yes])
1305533545b5Smrg	ifelse([$3], , :, [$3])
1306533545b5Smrgfi[]dnl
1307533545b5Smrg])# PKG_CHECK_MODULES
1308533545b5Smrg
1309c37a63b8Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1310264fa531Smrgdnl
1311736a7e2cSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1312533545b5Smrgdnl
1313c37a63b8Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1314736a7e2cSmrgdnl copy of this software and associated documentation files (the "Software"),
1315736a7e2cSmrgdnl to deal in the Software without restriction, including without limitation
1316736a7e2cSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1317736a7e2cSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1318736a7e2cSmrgdnl Software is furnished to do so, subject to the following conditions:
1319c37a63b8Smrgdnl
1320736a7e2cSmrgdnl The above copyright notice and this permission notice (including the next
1321736a7e2cSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1322736a7e2cSmrgdnl Software.
1323c37a63b8Smrgdnl
1324736a7e2cSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1325736a7e2cSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1326736a7e2cSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1327736a7e2cSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1328736a7e2cSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1329736a7e2cSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1330736a7e2cSmrgdnl DEALINGS IN THE SOFTWARE.
1331c37a63b8Smrg
1332c37a63b8Smrg# XORG_MACROS_VERSION(required-version)
1333c37a63b8Smrg# -------------------------------------
1334c37a63b8Smrg# Minimum version: 1.1.0
1335c37a63b8Smrg#
1336c37a63b8Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1337c37a63b8Smrg# your configure.ac with the minimum required version, such as:
1338c37a63b8Smrg# XORG_MACROS_VERSION(1.1)
1339c37a63b8Smrg#
1340c37a63b8Smrg# To ensure that this macro is defined, also add:
1341c37a63b8Smrg# m4_ifndef([XORG_MACROS_VERSION],
1342c37a63b8Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1343c37a63b8Smrg#
1344c37a63b8Smrg#
1345533545b5Smrg# See the "minimum version" comment for each macro you use to see what
1346c37a63b8Smrg# version you require.
1347c37a63b8Smrgm4_defun([XORG_MACROS_VERSION],[
1348533545b5Smrgm4_define([vers_have], [1.19.0])
1349c37a63b8Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1350c37a63b8Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1351c37a63b8Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1352c37a63b8Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1353c37a63b8Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1354c37a63b8Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1355c37a63b8Smrgm4_undefine([vers_have])
1356c37a63b8Smrgm4_undefine([maj_have])
1357c37a63b8Smrgm4_undefine([maj_needed])
1358c37a63b8Smrg]) # XORG_MACROS_VERSION
1359264fa531Smrg
1360264fa531Smrg# XORG_PROG_RAWCPP()
1361264fa531Smrg# ------------------
1362c37a63b8Smrg# Minimum version: 1.0.0
1363c37a63b8Smrg#
1364264fa531Smrg# Find cpp program and necessary flags for use in pre-processing text files
1365264fa531Smrg# such as man pages and config files
1366264fa531SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1367264fa531SmrgAC_REQUIRE([AC_PROG_CPP])
1368533545b5SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
1369264fa531Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1370264fa531Smrg
1371264fa531Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1372264fa531Smrg# which is not the best choice for supporting other OS'es, but covers most
1373264fa531Smrg# of the ones we need for now.
1374264fa531SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1375e4ee1255SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1376264fa531Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1377264fa531Smrg	AC_MSG_RESULT([no])
1378264fa531Smrgelse
1379264fa531Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1380264fa531Smrg		RAWCPPFLAGS=-undef
1381264fa531Smrg		AC_MSG_RESULT([yes])
1382c37a63b8Smrg	# under Cygwin unix is still defined even with -undef
1383c37a63b8Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1384c37a63b8Smrg		RAWCPPFLAGS="-undef -ansi"
1385c37a63b8Smrg		AC_MSG_RESULT([yes, with -ansi])
1386264fa531Smrg	else
1387264fa531Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1388264fa531Smrg	fi
1389264fa531Smrgfi
1390264fa531Smrgrm -f conftest.$ac_ext
1391264fa531Smrg
1392264fa531SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1393e4ee1255SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1394264fa531Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1395264fa531Smrg	AC_MSG_RESULT([no])
1396264fa531Smrgelse
1397264fa531Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1398533545b5Smrg		TRADITIONALCPPFLAGS="-traditional"
1399264fa531Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1400264fa531Smrg		AC_MSG_RESULT([yes])
1401264fa531Smrg	else
1402264fa531Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1403264fa531Smrg	fi
1404264fa531Smrgfi
1405264fa531Smrgrm -f conftest.$ac_ext
1406264fa531SmrgAC_SUBST(RAWCPPFLAGS)
1407533545b5SmrgAC_SUBST(TRADITIONALCPPFLAGS)
1408264fa531Smrg]) # XORG_PROG_RAWCPP
1409264fa531Smrg
1410264fa531Smrg# XORG_MANPAGE_SECTIONS()
1411264fa531Smrg# -----------------------
1412c37a63b8Smrg# Minimum version: 1.0.0
1413c37a63b8Smrg#
1414264fa531Smrg# Determine which sections man pages go in for the different man page types
1415264fa531Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1416264fa531Smrg# Not sure if there's any better way than just hardcoding by OS name.
1417264fa531Smrg# Override default settings by setting environment variables
1418736a7e2cSmrg# Added MAN_SUBSTS in version 1.8
1419736a7e2cSmrg# Added AC_PROG_SED in version 1.8
1420264fa531Smrg
1421264fa531SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1422264fa531SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1423736a7e2cSmrgAC_REQUIRE([AC_PROG_SED])
1424264fa531Smrg
1425264fa531Smrgif test x$APP_MAN_SUFFIX = x    ; then
1426c37a63b8Smrg    APP_MAN_SUFFIX=1
1427264fa531Smrgfi
1428264fa531Smrgif test x$APP_MAN_DIR = x    ; then
1429c37a63b8Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1430264fa531Smrgfi
1431264fa531Smrg
1432264fa531Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1433c37a63b8Smrg    LIB_MAN_SUFFIX=3
1434264fa531Smrgfi
1435264fa531Smrgif test x$LIB_MAN_DIR = x    ; then
1436c37a63b8Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1437264fa531Smrgfi
1438264fa531Smrg
1439264fa531Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1440264fa531Smrg    case $host_os in
1441264fa531Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1442264fa531Smrg	*)		FILE_MAN_SUFFIX=5  ;;
1443264fa531Smrg    esac
1444264fa531Smrgfi
1445264fa531Smrgif test x$FILE_MAN_DIR = x    ; then
1446c37a63b8Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1447264fa531Smrgfi
1448264fa531Smrg
1449264fa531Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1450264fa531Smrg    case $host_os in
1451264fa531Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1452264fa531Smrg	*)		MISC_MAN_SUFFIX=7  ;;
1453264fa531Smrg    esac
1454264fa531Smrgfi
1455264fa531Smrgif test x$MISC_MAN_DIR = x    ; then
1456c37a63b8Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1457264fa531Smrgfi
1458264fa531Smrg
1459264fa531Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1460264fa531Smrg    case $host_os in
1461264fa531Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1462264fa531Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1463264fa531Smrg    esac
1464264fa531Smrgfi
1465264fa531Smrgif test x$DRIVER_MAN_DIR = x    ; then
1466c37a63b8Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1467264fa531Smrgfi
1468264fa531Smrg
1469264fa531Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1470264fa531Smrg    case $host_os in
1471264fa531Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1472264fa531Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1473264fa531Smrg    esac
1474264fa531Smrgfi
1475264fa531Smrgif test x$ADMIN_MAN_DIR = x    ; then
1476264fa531Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1477264fa531Smrgfi
1478264fa531Smrg
1479264fa531Smrg
1480264fa531SmrgAC_SUBST([APP_MAN_SUFFIX])
1481264fa531SmrgAC_SUBST([LIB_MAN_SUFFIX])
1482264fa531SmrgAC_SUBST([FILE_MAN_SUFFIX])
1483264fa531SmrgAC_SUBST([MISC_MAN_SUFFIX])
1484264fa531SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1485264fa531SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1486264fa531SmrgAC_SUBST([APP_MAN_DIR])
1487264fa531SmrgAC_SUBST([LIB_MAN_DIR])
1488264fa531SmrgAC_SUBST([FILE_MAN_DIR])
1489264fa531SmrgAC_SUBST([MISC_MAN_DIR])
1490264fa531SmrgAC_SUBST([DRIVER_MAN_DIR])
1491264fa531SmrgAC_SUBST([ADMIN_MAN_DIR])
1492736a7e2cSmrg
1493736a7e2cSmrgXORG_MAN_PAGE="X Version 11"
1494736a7e2cSmrgAC_SUBST([XORG_MAN_PAGE])
1495736a7e2cSmrgMAN_SUBSTS="\
1496736a7e2cSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1497736a7e2cSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1498736a7e2cSmrg	-e 's|__xservername__|Xorg|g' \
1499736a7e2cSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
1500736a7e2cSmrg	-e 's|__projectroot__|\$(prefix)|g' \
1501736a7e2cSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1502736a7e2cSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1503736a7e2cSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1504736a7e2cSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1505736a7e2cSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1506736a7e2cSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1507736a7e2cSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1508736a7e2cSmrgAC_SUBST([MAN_SUBSTS])
1509736a7e2cSmrg
1510264fa531Smrg]) # XORG_MANPAGE_SECTIONS
1511264fa531Smrg
1512736a7e2cSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1513736a7e2cSmrg# ------------------------
1514736a7e2cSmrg# Minimum version: 1.7.0
1515736a7e2cSmrg#
1516736a7e2cSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1517736a7e2cSmrg# provided by xorg-sgml-doctools, if installed.
1518736a7e2cSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1519736a7e2cSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1520736a7e2cSmrgXORG_SGML_PATH=
1521736a7e2cSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1522736a7e2cSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1523736a7e2cSmrg    [m4_ifval([$1],[:],
1524736a7e2cSmrg        [if test x"$cross_compiling" != x"yes" ; then
1525736a7e2cSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1526736a7e2cSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1527736a7e2cSmrg         fi])
1528736a7e2cSmrg    ])
1529736a7e2cSmrg
1530736a7e2cSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1531736a7e2cSmrg# the path and the name of the doc stylesheet
1532736a7e2cSmrgif test "x$XORG_SGML_PATH" != "x" ; then
1533736a7e2cSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1534736a7e2cSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1535736a7e2cSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1536736a7e2cSmrgelse
1537736a7e2cSmrg   AC_MSG_RESULT([no])
1538736a7e2cSmrgfi
1539736a7e2cSmrg
1540736a7e2cSmrgAC_SUBST(XORG_SGML_PATH)
1541736a7e2cSmrgAC_SUBST(STYLESHEET_SRCDIR)
1542736a7e2cSmrgAC_SUBST(XSL_STYLESHEET)
1543736a7e2cSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1544736a7e2cSmrg]) # XORG_CHECK_SGML_DOCTOOLS
1545736a7e2cSmrg
1546264fa531Smrg# XORG_CHECK_LINUXDOC
1547264fa531Smrg# -------------------
1548c37a63b8Smrg# Minimum version: 1.0.0
1549c37a63b8Smrg#
1550264fa531Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1551264fa531Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1552264fa531Smrg# Whether or not the necessary tools and files are found can be checked
1553264fa531Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1554264fa531SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1555736a7e2cSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1556736a7e2cSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1557264fa531Smrg
1558264fa531SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1559264fa531Smrg
1560736a7e2cSmrgAC_MSG_CHECKING([whether to build documentation])
1561264fa531Smrg
1562736a7e2cSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1563264fa531Smrg   BUILDDOC=yes
1564264fa531Smrgelse
1565264fa531Smrg   BUILDDOC=no
1566264fa531Smrgfi
1567264fa531Smrg
1568264fa531SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1569264fa531Smrg
1570264fa531SmrgAC_MSG_RESULT([$BUILDDOC])
1571264fa531Smrg
1572736a7e2cSmrgAC_MSG_CHECKING([whether to build pdf documentation])
1573264fa531Smrg
1574736a7e2cSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1575264fa531Smrg   BUILDPDFDOC=yes
1576264fa531Smrgelse
1577264fa531Smrg   BUILDPDFDOC=no
1578264fa531Smrgfi
1579264fa531Smrg
1580264fa531SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1581264fa531Smrg
1582264fa531SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1583264fa531Smrg
1584736a7e2cSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1585c37a63b8SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1586264fa531SmrgMAKE_PDF="$PS2PDF"
1587c37a63b8SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1588264fa531Smrg
1589264fa531SmrgAC_SUBST(MAKE_TEXT)
1590264fa531SmrgAC_SUBST(MAKE_PS)
1591264fa531SmrgAC_SUBST(MAKE_PDF)
1592264fa531SmrgAC_SUBST(MAKE_HTML)
1593264fa531Smrg]) # XORG_CHECK_LINUXDOC
1594264fa531Smrg
1595c37a63b8Smrg# XORG_CHECK_DOCBOOK
1596c37a63b8Smrg# -------------------
1597c37a63b8Smrg# Minimum version: 1.0.0
1598c37a63b8Smrg#
1599c37a63b8Smrg# Checks for the ability to build output formats from SGML DocBook source.
1600c37a63b8Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1601c37a63b8Smrg# indicates whether the necessary tools and files are found and, if set,
1602c37a63b8Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1603c37a63b8SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1604736a7e2cSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1605736a7e2cSmrg
1606c37a63b8SmrgBUILDTXTDOC=no
1607c37a63b8SmrgBUILDPDFDOC=no
1608c37a63b8SmrgBUILDPSDOC=no
1609c37a63b8SmrgBUILDHTMLDOC=no
1610c37a63b8Smrg
1611c37a63b8SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1612c37a63b8SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1613c37a63b8SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1614c37a63b8SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1615c37a63b8Smrg
1616736a7e2cSmrgAC_MSG_CHECKING([whether to build text documentation])
1617736a7e2cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1618c37a63b8Smrg   test x$BUILD_TXTDOC != xno; then
1619c37a63b8Smrg	BUILDTXTDOC=yes
1620c37a63b8Smrgfi
1621c37a63b8SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1622c37a63b8SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1623c37a63b8Smrg
1624736a7e2cSmrgAC_MSG_CHECKING([whether to build PDF documentation])
1625736a7e2cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1626c37a63b8Smrg   test x$BUILD_PDFDOC != xno; then
1627c37a63b8Smrg	BUILDPDFDOC=yes
1628c37a63b8Smrgfi
1629c37a63b8SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1630c37a63b8SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1631c37a63b8Smrg
1632736a7e2cSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1633736a7e2cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1634c37a63b8Smrg   test x$BUILD_PSDOC != xno; then
1635c37a63b8Smrg	BUILDPSDOC=yes
1636c37a63b8Smrgfi
1637c37a63b8SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1638c37a63b8SmrgAC_MSG_RESULT([$BUILDPSDOC])
1639c37a63b8Smrg
1640736a7e2cSmrgAC_MSG_CHECKING([whether to build HTML documentation])
1641736a7e2cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1642c37a63b8Smrg   test x$BUILD_HTMLDOC != xno; then
1643c37a63b8Smrg	BUILDHTMLDOC=yes
1644c37a63b8Smrgfi
1645c37a63b8SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1646c37a63b8SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1647c37a63b8Smrg
1648c37a63b8SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1649c37a63b8SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1650c37a63b8SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1651c37a63b8SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1652c37a63b8Smrg
1653c37a63b8SmrgAC_SUBST(MAKE_TEXT)
1654c37a63b8SmrgAC_SUBST(MAKE_PS)
1655c37a63b8SmrgAC_SUBST(MAKE_PDF)
1656c37a63b8SmrgAC_SUBST(MAKE_HTML)
1657c37a63b8Smrg]) # XORG_CHECK_DOCBOOK
1658c37a63b8Smrg
1659736a7e2cSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1660736a7e2cSmrg# ----------------
1661736a7e2cSmrg# Minimum version: 1.5.0
1662736a7e2cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1663736a7e2cSmrg#
1664736a7e2cSmrg# Documentation tools are not always available on all platforms and sometimes
1665736a7e2cSmrg# not at the appropriate level. This macro enables a module to test for the
1666736a7e2cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1667736a7e2cSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1668736a7e2cSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1669736a7e2cSmrg# --with-xmlto assumes 'auto'.
1670736a7e2cSmrg#
1671736a7e2cSmrg# Interface to module:
1672736a7e2cSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1673736a7e2cSmrg# XMLTO:	returns the path of the xmlto program found
1674736a7e2cSmrg#		returns the path set by the user in the environment
1675736a7e2cSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1676736a7e2cSmrg#		'no' user instructs the module not to use xmlto
1677736a7e2cSmrg#
1678736a7e2cSmrg# Added in version 1.10.0
1679736a7e2cSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1680736a7e2cSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1681736a7e2cSmrg#
1682736a7e2cSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1683736a7e2cSmrg#
1684736a7e2cSmrgAC_DEFUN([XORG_WITH_XMLTO],[
1685736a7e2cSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1686736a7e2cSmrgm4_define([_defopt], m4_default([$2], [auto]))
1687736a7e2cSmrgAC_ARG_WITH(xmlto,
1688736a7e2cSmrg	AS_HELP_STRING([--with-xmlto],
1689736a7e2cSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1690736a7e2cSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1691736a7e2cSmrgm4_undefine([_defopt])
1692736a7e2cSmrg
1693736a7e2cSmrgif test "x$use_xmlto" = x"auto"; then
1694736a7e2cSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1695736a7e2cSmrg   if test "x$XMLTO" = "x"; then
1696736a7e2cSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1697736a7e2cSmrg	have_xmlto=no
1698736a7e2cSmrg   else
1699736a7e2cSmrg        have_xmlto=yes
1700736a7e2cSmrg   fi
1701736a7e2cSmrgelif test "x$use_xmlto" = x"yes" ; then
1702736a7e2cSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1703736a7e2cSmrg   if test "x$XMLTO" = "x"; then
1704736a7e2cSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1705736a7e2cSmrg   fi
1706736a7e2cSmrg   have_xmlto=yes
1707736a7e2cSmrgelif test "x$use_xmlto" = x"no" ; then
1708736a7e2cSmrg   if test "x$XMLTO" != "x"; then
1709736a7e2cSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1710736a7e2cSmrg   fi
1711736a7e2cSmrg   have_xmlto=no
1712736a7e2cSmrgelse
1713736a7e2cSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1714736a7e2cSmrgfi
1715736a7e2cSmrg
1716736a7e2cSmrg# Test for a minimum version of xmlto, if provided.
1717736a7e2cSmrgm4_ifval([$1],
1718736a7e2cSmrg[if test "$have_xmlto" = yes; then
1719736a7e2cSmrg    # scrape the xmlto version
1720736a7e2cSmrg    AC_MSG_CHECKING([the xmlto version])
1721736a7e2cSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1722736a7e2cSmrg    AC_MSG_RESULT([$xmlto_version])
1723736a7e2cSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1724736a7e2cSmrg        [if test "x$use_xmlto" = xauto; then
1725736a7e2cSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1726736a7e2cSmrg            have_xmlto=no
1727736a7e2cSmrg        else
1728736a7e2cSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1729736a7e2cSmrg        fi])
1730736a7e2cSmrgfi])
1731736a7e2cSmrg
1732736a7e2cSmrg# Test for the ability of xmlto to generate a text target
1733736a7e2cSmrghave_xmlto_text=no
1734736a7e2cSmrgcat > conftest.xml << "EOF"
1735736a7e2cSmrgEOF
1736736a7e2cSmrgAS_IF([test "$have_xmlto" = yes],
1737736a7e2cSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1738736a7e2cSmrg             [have_xmlto_text=yes],
1739736a7e2cSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1740736a7e2cSmrgrm -f conftest.xml
1741736a7e2cSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1742736a7e2cSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1743736a7e2cSmrg]) # XORG_WITH_XMLTO
1744736a7e2cSmrg
1745e4ee1255Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1746e4ee1255Smrg# --------------------------------------------
1747e4ee1255Smrg# Minimum version: 1.12.0
1748e4ee1255Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1749e4ee1255Smrg#
1750e4ee1255Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1751e4ee1255Smrg# XML-based language used for the transformation of XML documents.
1752e4ee1255Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1753e4ee1255Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1754e4ee1255Smrg# The XSLT processor is often used as a standalone tool for transformations.
1755e4ee1255Smrg# It should not be assumed that this tool is used only to work with documnetation.
1756e4ee1255Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1757e4ee1255Smrg#
1758e4ee1255Smrg# Interface to module:
1759e4ee1255Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1760e4ee1255Smrg# XSLTPROC:	 returns the path of the xsltproc program found
1761e4ee1255Smrg#		 returns the path set by the user in the environment
1762e4ee1255Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1763e4ee1255Smrg#		  'no' user instructs the module not to use xsltproc
1764e4ee1255Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1765e4ee1255Smrg#
1766e4ee1255Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1767e4ee1255Smrg#
1768e4ee1255SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1769e4ee1255SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1770e4ee1255Smrg# Preserves the interface, should it be implemented later
1771e4ee1255Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1772e4ee1255Smrgm4_define([_defopt], m4_default([$2], [auto]))
1773e4ee1255SmrgAC_ARG_WITH(xsltproc,
1774e4ee1255Smrg	AS_HELP_STRING([--with-xsltproc],
1775e4ee1255Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1776e4ee1255Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1777e4ee1255Smrgm4_undefine([_defopt])
1778e4ee1255Smrg
1779e4ee1255Smrgif test "x$use_xsltproc" = x"auto"; then
1780e4ee1255Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1781e4ee1255Smrg   if test "x$XSLTPROC" = "x"; then
1782e4ee1255Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1783e4ee1255Smrg	have_xsltproc=no
1784e4ee1255Smrg   else
1785e4ee1255Smrg        have_xsltproc=yes
1786e4ee1255Smrg   fi
1787e4ee1255Smrgelif test "x$use_xsltproc" = x"yes" ; then
1788e4ee1255Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1789e4ee1255Smrg   if test "x$XSLTPROC" = "x"; then
1790e4ee1255Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1791e4ee1255Smrg   fi
1792e4ee1255Smrg   have_xsltproc=yes
1793e4ee1255Smrgelif test "x$use_xsltproc" = x"no" ; then
1794e4ee1255Smrg   if test "x$XSLTPROC" != "x"; then
1795e4ee1255Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1796e4ee1255Smrg   fi
1797e4ee1255Smrg   have_xsltproc=no
1798e4ee1255Smrgelse
1799e4ee1255Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1800e4ee1255Smrgfi
1801e4ee1255Smrg
1802e4ee1255SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1803e4ee1255Smrg]) # XORG_WITH_XSLTPROC
1804e4ee1255Smrg
1805e4ee1255Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1806e4ee1255Smrg# ----------------------------------------
1807e4ee1255Smrg# Minimum version: 1.15.0
1808e4ee1255Smrg#
1809e4ee1255Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
1810e4ee1255Smrg# scanning arbitrary text files, extracting information from those text files,
1811e4ee1255Smrg# and printing reports based on that information.
1812e4ee1255Smrg#
1813e4ee1255Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1814e4ee1255Smrg#
1815e4ee1255Smrg# Interface to module:
1816e4ee1255Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
1817e4ee1255Smrg# PERL:	     returns the path of the perl program found
1818e4ee1255Smrg#	     returns the path set by the user in the environment
1819e4ee1255Smrg# --with-perl: 'yes' user instructs the module to use perl
1820e4ee1255Smrg#	       'no' user instructs the module not to use perl
1821e4ee1255Smrg# have_perl: returns yes if perl found in PATH or no
1822e4ee1255Smrg#
1823e4ee1255Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1824e4ee1255Smrg#
1825e4ee1255SmrgAC_DEFUN([XORG_WITH_PERL],[
1826e4ee1255SmrgAC_ARG_VAR([PERL], [Path to perl command])
1827e4ee1255Smrg# Preserves the interface, should it be implemented later
1828e4ee1255Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1829e4ee1255Smrgm4_define([_defopt], m4_default([$2], [auto]))
1830e4ee1255SmrgAC_ARG_WITH(perl,
1831e4ee1255Smrg	AS_HELP_STRING([--with-perl],
1832e4ee1255Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1833e4ee1255Smrg	   [use_perl=$withval], [use_perl=]_defopt)
1834e4ee1255Smrgm4_undefine([_defopt])
1835e4ee1255Smrg
1836e4ee1255Smrgif test "x$use_perl" = x"auto"; then
1837e4ee1255Smrg   AC_PATH_PROG([PERL], [perl])
1838e4ee1255Smrg   if test "x$PERL" = "x"; then
1839e4ee1255Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1840e4ee1255Smrg	have_perl=no
1841e4ee1255Smrg   else
1842e4ee1255Smrg        have_perl=yes
1843e4ee1255Smrg   fi
1844e4ee1255Smrgelif test "x$use_perl" = x"yes" ; then
1845e4ee1255Smrg   AC_PATH_PROG([PERL], [perl])
1846e4ee1255Smrg   if test "x$PERL" = "x"; then
1847e4ee1255Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1848e4ee1255Smrg   fi
1849e4ee1255Smrg   have_perl=yes
1850e4ee1255Smrgelif test "x$use_perl" = x"no" ; then
1851e4ee1255Smrg   if test "x$PERL" != "x"; then
1852e4ee1255Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1853e4ee1255Smrg   fi
1854e4ee1255Smrg   have_perl=no
1855e4ee1255Smrgelse
1856e4ee1255Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1857e4ee1255Smrgfi
1858e4ee1255Smrg
1859e4ee1255SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1860e4ee1255Smrg]) # XORG_WITH_PERL
1861e4ee1255Smrg
1862736a7e2cSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1863736a7e2cSmrg# ----------------
1864736a7e2cSmrg# Minimum version: 1.5.0
1865736a7e2cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1866736a7e2cSmrg#
1867736a7e2cSmrg# Documentation tools are not always available on all platforms and sometimes
1868736a7e2cSmrg# not at the appropriate level. This macro enables a module to test for the
1869736a7e2cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1870736a7e2cSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1871736a7e2cSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1872736a7e2cSmrg# --with-asciidoc assumes 'auto'.
1873736a7e2cSmrg#
1874736a7e2cSmrg# Interface to module:
1875736a7e2cSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1876736a7e2cSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
1877736a7e2cSmrg#		 returns the path set by the user in the environment
1878736a7e2cSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1879736a7e2cSmrg#		  'no' user instructs the module not to use asciidoc
1880736a7e2cSmrg#
1881736a7e2cSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1882736a7e2cSmrg#
1883736a7e2cSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1884736a7e2cSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1885736a7e2cSmrgm4_define([_defopt], m4_default([$2], [auto]))
1886736a7e2cSmrgAC_ARG_WITH(asciidoc,
1887736a7e2cSmrg	AS_HELP_STRING([--with-asciidoc],
1888736a7e2cSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1889736a7e2cSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1890736a7e2cSmrgm4_undefine([_defopt])
1891736a7e2cSmrg
1892736a7e2cSmrgif test "x$use_asciidoc" = x"auto"; then
1893736a7e2cSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1894736a7e2cSmrg   if test "x$ASCIIDOC" = "x"; then
1895736a7e2cSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1896736a7e2cSmrg	have_asciidoc=no
1897736a7e2cSmrg   else
1898736a7e2cSmrg        have_asciidoc=yes
1899736a7e2cSmrg   fi
1900736a7e2cSmrgelif test "x$use_asciidoc" = x"yes" ; then
1901736a7e2cSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1902736a7e2cSmrg   if test "x$ASCIIDOC" = "x"; then
1903736a7e2cSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1904736a7e2cSmrg   fi
1905736a7e2cSmrg   have_asciidoc=yes
1906736a7e2cSmrgelif test "x$use_asciidoc" = x"no" ; then
1907736a7e2cSmrg   if test "x$ASCIIDOC" != "x"; then
1908736a7e2cSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1909736a7e2cSmrg   fi
1910736a7e2cSmrg   have_asciidoc=no
1911736a7e2cSmrgelse
1912736a7e2cSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1913736a7e2cSmrgfi
1914736a7e2cSmrgm4_ifval([$1],
1915736a7e2cSmrg[if test "$have_asciidoc" = yes; then
1916736a7e2cSmrg    # scrape the asciidoc version
1917736a7e2cSmrg    AC_MSG_CHECKING([the asciidoc version])
1918736a7e2cSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1919736a7e2cSmrg    AC_MSG_RESULT([$asciidoc_version])
1920736a7e2cSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1921736a7e2cSmrg        [if test "x$use_asciidoc" = xauto; then
1922736a7e2cSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1923736a7e2cSmrg            have_asciidoc=no
1924736a7e2cSmrg        else
1925736a7e2cSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1926736a7e2cSmrg        fi])
1927736a7e2cSmrgfi])
1928736a7e2cSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1929736a7e2cSmrg]) # XORG_WITH_ASCIIDOC
1930736a7e2cSmrg
1931736a7e2cSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1932533545b5Smrg# -------------------------------------------
1933736a7e2cSmrg# Minimum version: 1.5.0
1934736a7e2cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1935533545b5Smrg# Minimum version for optional DOT checking: 1.18.0
1936736a7e2cSmrg#
1937736a7e2cSmrg# Documentation tools are not always available on all platforms and sometimes
1938736a7e2cSmrg# not at the appropriate level. This macro enables a module to test for the
1939736a7e2cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1940736a7e2cSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1941736a7e2cSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1942736a7e2cSmrg# --with-doxygen assumes 'auto'.
1943736a7e2cSmrg#
1944736a7e2cSmrg# Interface to module:
1945736a7e2cSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1946736a7e2cSmrg# DOXYGEN:	 returns the path of the doxygen program found
1947736a7e2cSmrg#		 returns the path set by the user in the environment
1948736a7e2cSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1949736a7e2cSmrg#		  'no' user instructs the module not to use doxygen
1950736a7e2cSmrg#
1951736a7e2cSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1952736a7e2cSmrg#
1953736a7e2cSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1954736a7e2cSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1955533545b5SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
1956736a7e2cSmrgm4_define([_defopt], m4_default([$2], [auto]))
1957736a7e2cSmrgAC_ARG_WITH(doxygen,
1958736a7e2cSmrg	AS_HELP_STRING([--with-doxygen],
1959736a7e2cSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1960736a7e2cSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1961736a7e2cSmrgm4_undefine([_defopt])
1962736a7e2cSmrg
1963736a7e2cSmrgif test "x$use_doxygen" = x"auto"; then
1964736a7e2cSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1965736a7e2cSmrg   if test "x$DOXYGEN" = "x"; then
1966736a7e2cSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1967736a7e2cSmrg	have_doxygen=no
1968736a7e2cSmrg   else
1969736a7e2cSmrg        have_doxygen=yes
1970736a7e2cSmrg   fi
1971736a7e2cSmrgelif test "x$use_doxygen" = x"yes" ; then
1972736a7e2cSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1973736a7e2cSmrg   if test "x$DOXYGEN" = "x"; then
1974736a7e2cSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1975736a7e2cSmrg   fi
1976736a7e2cSmrg   have_doxygen=yes
1977736a7e2cSmrgelif test "x$use_doxygen" = x"no" ; then
1978736a7e2cSmrg   if test "x$DOXYGEN" != "x"; then
1979736a7e2cSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1980736a7e2cSmrg   fi
1981736a7e2cSmrg   have_doxygen=no
1982736a7e2cSmrgelse
1983736a7e2cSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1984736a7e2cSmrgfi
1985736a7e2cSmrgm4_ifval([$1],
1986736a7e2cSmrg[if test "$have_doxygen" = yes; then
1987736a7e2cSmrg    # scrape the doxygen version
1988736a7e2cSmrg    AC_MSG_CHECKING([the doxygen version])
1989736a7e2cSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1990736a7e2cSmrg    AC_MSG_RESULT([$doxygen_version])
1991736a7e2cSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1992736a7e2cSmrg        [if test "x$use_doxygen" = xauto; then
1993736a7e2cSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1994736a7e2cSmrg            have_doxygen=no
1995736a7e2cSmrg        else
1996736a7e2cSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1997736a7e2cSmrg        fi])
1998736a7e2cSmrgfi])
1999533545b5Smrg
2000533545b5Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2001533545b5Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2002533545b5Smrgdnl 	HAVE_DOT = @HAVE_DOT@
2003533545b5SmrgHAVE_DOT=no
2004533545b5Smrgif test "x$have_doxygen" = "xyes"; then
2005533545b5Smrg  AC_PATH_PROG([DOT], [dot])
2006533545b5Smrg    if test "x$DOT" != "x"; then
2007533545b5Smrg      HAVE_DOT=yes
2008533545b5Smrg    fi
2009533545b5Smrgfi
2010533545b5Smrg
2011533545b5SmrgAC_SUBST([HAVE_DOT])
2012533545b5SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2013736a7e2cSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2014736a7e2cSmrg]) # XORG_WITH_DOXYGEN
2015736a7e2cSmrg
2016736a7e2cSmrg# XORG_WITH_GROFF([DEFAULT])
2017736a7e2cSmrg# ----------------
2018736a7e2cSmrg# Minimum version: 1.6.0
2019736a7e2cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2020736a7e2cSmrg#
2021736a7e2cSmrg# Documentation tools are not always available on all platforms and sometimes
2022736a7e2cSmrg# not at the appropriate level. This macro enables a module to test for the
2023736a7e2cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2024736a7e2cSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
2025736a7e2cSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
2026736a7e2cSmrg# --with-groff assumes 'auto'.
2027736a7e2cSmrg#
2028736a7e2cSmrg# Interface to module:
2029736a7e2cSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2030736a7e2cSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2031736a7e2cSmrg# HAVE_GROFF_MS: the -ms macros package
2032736a7e2cSmrg# GROFF:	 returns the path of the groff program found
2033736a7e2cSmrg#		 returns the path set by the user in the environment
2034736a7e2cSmrg# --with-groff:	 'yes' user instructs the module to use groff
2035736a7e2cSmrg#		 'no' user instructs the module not to use groff
2036736a7e2cSmrg#
2037736a7e2cSmrg# Added in version 1.9.0:
2038736a7e2cSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2039736a7e2cSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2040736a7e2cSmrg#		   psselect from the psutils package.
2041736a7e2cSmrg#		   the ghostcript package. Refer to the grohtml man pages
2042736a7e2cSmrg#
2043736a7e2cSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2044736a7e2cSmrg#
2045736a7e2cSmrg# OS and distros often splits groff in a basic and full package, the former
2046736a7e2cSmrg# having the groff program and the later having devices, fonts and macros
2047736a7e2cSmrg# Checking for the groff executable is not enough.
2048736a7e2cSmrg#
2049736a7e2cSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
2050736a7e2cSmrg# unset HAVE_GROFF or GROFF env variables.
2051736a7e2cSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2052736a7e2cSmrg#
2053736a7e2cSmrgAC_DEFUN([XORG_WITH_GROFF],[
2054736a7e2cSmrgAC_ARG_VAR([GROFF], [Path to groff command])
2055736a7e2cSmrgm4_define([_defopt], m4_default([$1], [auto]))
2056736a7e2cSmrgAC_ARG_WITH(groff,
2057736a7e2cSmrg	AS_HELP_STRING([--with-groff],
2058736a7e2cSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2059736a7e2cSmrg	   [use_groff=$withval], [use_groff=]_defopt)
2060736a7e2cSmrgm4_undefine([_defopt])
2061736a7e2cSmrg
2062736a7e2cSmrgif test "x$use_groff" = x"auto"; then
2063736a7e2cSmrg   AC_PATH_PROG([GROFF], [groff])
2064736a7e2cSmrg   if test "x$GROFF" = "x"; then
2065736a7e2cSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2066736a7e2cSmrg	have_groff=no
2067736a7e2cSmrg   else
2068736a7e2cSmrg        have_groff=yes
2069736a7e2cSmrg   fi
2070736a7e2cSmrgelif test "x$use_groff" = x"yes" ; then
2071736a7e2cSmrg   AC_PATH_PROG([GROFF], [groff])
2072736a7e2cSmrg   if test "x$GROFF" = "x"; then
2073736a7e2cSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2074736a7e2cSmrg   fi
2075736a7e2cSmrg   have_groff=yes
2076736a7e2cSmrgelif test "x$use_groff" = x"no" ; then
2077736a7e2cSmrg   if test "x$GROFF" != "x"; then
2078736a7e2cSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2079736a7e2cSmrg   fi
2080736a7e2cSmrg   have_groff=no
2081736a7e2cSmrgelse
2082736a7e2cSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2083736a7e2cSmrgfi
2084736a7e2cSmrg
2085736a7e2cSmrg# We have groff, test for the presence of the macro packages
2086736a7e2cSmrgif test "x$have_groff" = x"yes"; then
2087736a7e2cSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2088736a7e2cSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2089736a7e2cSmrg        groff_ms_works=yes
2090736a7e2cSmrg    else
2091736a7e2cSmrg        groff_ms_works=no
2092736a7e2cSmrg    fi
2093736a7e2cSmrg    AC_MSG_RESULT([$groff_ms_works])
2094736a7e2cSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2095736a7e2cSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2096736a7e2cSmrg        groff_mm_works=yes
2097736a7e2cSmrg    else
2098736a7e2cSmrg        groff_mm_works=no
2099736a7e2cSmrg    fi
2100736a7e2cSmrg    AC_MSG_RESULT([$groff_mm_works])
2101736a7e2cSmrgfi
2102736a7e2cSmrg
2103736a7e2cSmrg# We have groff, test for HTML dependencies, one command per package
2104736a7e2cSmrgif test "x$have_groff" = x"yes"; then
2105736a7e2cSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2106736a7e2cSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2107736a7e2cSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2108736a7e2cSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2109736a7e2cSmrg      have_groff_html=yes
2110736a7e2cSmrg   else
2111736a7e2cSmrg      have_groff_html=no
2112736a7e2cSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2113736a7e2cSmrg   fi
2114736a7e2cSmrgfi
2115736a7e2cSmrg
2116736a7e2cSmrg# Set Automake conditionals for Makefiles
2117736a7e2cSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2118736a7e2cSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2119736a7e2cSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2120736a7e2cSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2121736a7e2cSmrg]) # XORG_WITH_GROFF
2122736a7e2cSmrg
2123e4ee1255Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2124e4ee1255Smrg# ---------------------------------------
2125736a7e2cSmrg# Minimum version: 1.6.0
2126736a7e2cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2127e4ee1255Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2128736a7e2cSmrg#
2129736a7e2cSmrg# Documentation tools are not always available on all platforms and sometimes
2130736a7e2cSmrg# not at the appropriate level. This macro enables a module to test for the
2131736a7e2cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2132736a7e2cSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
2133736a7e2cSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
2134736a7e2cSmrg# --with-fop assumes 'auto'.
2135736a7e2cSmrg#
2136736a7e2cSmrg# Interface to module:
2137736a7e2cSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2138736a7e2cSmrg# FOP:	 	returns the path of the fop program found
2139736a7e2cSmrg#		returns the path set by the user in the environment
2140736a7e2cSmrg# --with-fop: 	'yes' user instructs the module to use fop
2141736a7e2cSmrg#		'no' user instructs the module not to use fop
2142736a7e2cSmrg#
2143736a7e2cSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2144736a7e2cSmrg#
2145736a7e2cSmrgAC_DEFUN([XORG_WITH_FOP],[
2146736a7e2cSmrgAC_ARG_VAR([FOP], [Path to fop command])
2147e4ee1255Smrgm4_define([_defopt], m4_default([$2], [auto]))
2148736a7e2cSmrgAC_ARG_WITH(fop,
2149736a7e2cSmrg	AS_HELP_STRING([--with-fop],
2150736a7e2cSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2151736a7e2cSmrg	   [use_fop=$withval], [use_fop=]_defopt)
2152736a7e2cSmrgm4_undefine([_defopt])
2153736a7e2cSmrg
2154736a7e2cSmrgif test "x$use_fop" = x"auto"; then
2155736a7e2cSmrg   AC_PATH_PROG([FOP], [fop])
2156736a7e2cSmrg   if test "x$FOP" = "x"; then
2157736a7e2cSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2158736a7e2cSmrg	have_fop=no
2159736a7e2cSmrg   else
2160736a7e2cSmrg        have_fop=yes
2161736a7e2cSmrg   fi
2162736a7e2cSmrgelif test "x$use_fop" = x"yes" ; then
2163736a7e2cSmrg   AC_PATH_PROG([FOP], [fop])
2164736a7e2cSmrg   if test "x$FOP" = "x"; then
2165736a7e2cSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2166736a7e2cSmrg   fi
2167736a7e2cSmrg   have_fop=yes
2168736a7e2cSmrgelif test "x$use_fop" = x"no" ; then
2169736a7e2cSmrg   if test "x$FOP" != "x"; then
2170736a7e2cSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2171736a7e2cSmrg   fi
2172736a7e2cSmrg   have_fop=no
2173736a7e2cSmrgelse
2174736a7e2cSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2175736a7e2cSmrgfi
2176e4ee1255Smrg
2177e4ee1255Smrg# Test for a minimum version of fop, if provided.
2178e4ee1255Smrgm4_ifval([$1],
2179e4ee1255Smrg[if test "$have_fop" = yes; then
2180e4ee1255Smrg    # scrape the fop version
2181e4ee1255Smrg    AC_MSG_CHECKING([for fop minimum version])
2182e4ee1255Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2183e4ee1255Smrg    AC_MSG_RESULT([$fop_version])
2184e4ee1255Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2185e4ee1255Smrg        [if test "x$use_fop" = xauto; then
2186e4ee1255Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2187e4ee1255Smrg            have_fop=no
2188e4ee1255Smrg        else
2189e4ee1255Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2190e4ee1255Smrg        fi])
2191e4ee1255Smrgfi])
2192736a7e2cSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2193736a7e2cSmrg]) # XORG_WITH_FOP
2194736a7e2cSmrg
2195533545b5Smrg# XORG_WITH_M4([MIN-VERSION])
2196533545b5Smrg# ---------------------------
2197533545b5Smrg# Minimum version: 1.19.0
2198533545b5Smrg#
2199533545b5Smrg# This macro attempts to locate an m4 macro processor which supports
2200533545b5Smrg# -I option and is only useful for modules relying on M4 in order to
2201533545b5Smrg# expand macros in source code files.
2202533545b5Smrg#
2203533545b5Smrg# Interface to module:
2204533545b5Smrg# M4:	 	returns the path of the m4 program found
2205533545b5Smrg#		returns the path set by the user in the environment
2206533545b5Smrg#
2207533545b5SmrgAC_DEFUN([XORG_WITH_M4], [
2208533545b5SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2209533545b5Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2210533545b5Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2211533545b5Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2212533545b5Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2213533545b5Smrg   [$PATH:/usr/gnu/bin])])
2214533545b5Smrg
2215533545b5SmrgAC_SUBST([M4], [$ac_cv_path_M4])
2216533545b5Smrg]) # XORG_WITH_M4
2217533545b5Smrg
2218736a7e2cSmrg# XORG_WITH_PS2PDF([DEFAULT])
2219736a7e2cSmrg# ----------------
2220736a7e2cSmrg# Minimum version: 1.6.0
2221736a7e2cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2222736a7e2cSmrg#
2223736a7e2cSmrg# Documentation tools are not always available on all platforms and sometimes
2224736a7e2cSmrg# not at the appropriate level. This macro enables a module to test for the
2225736a7e2cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2226736a7e2cSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2227736a7e2cSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2228736a7e2cSmrg# --with-ps2pdf assumes 'auto'.
2229736a7e2cSmrg#
2230736a7e2cSmrg# Interface to module:
2231736a7e2cSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2232736a7e2cSmrg# PS2PDF:	returns the path of the ps2pdf program found
2233736a7e2cSmrg#		returns the path set by the user in the environment
2234736a7e2cSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2235736a7e2cSmrg#		 'no' user instructs the module not to use ps2pdf
2236736a7e2cSmrg#
2237736a7e2cSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2238736a7e2cSmrg#
2239736a7e2cSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2240736a7e2cSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2241736a7e2cSmrgm4_define([_defopt], m4_default([$1], [auto]))
2242736a7e2cSmrgAC_ARG_WITH(ps2pdf,
2243736a7e2cSmrg	AS_HELP_STRING([--with-ps2pdf],
2244736a7e2cSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2245736a7e2cSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2246736a7e2cSmrgm4_undefine([_defopt])
2247736a7e2cSmrg
2248736a7e2cSmrgif test "x$use_ps2pdf" = x"auto"; then
2249736a7e2cSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2250736a7e2cSmrg   if test "x$PS2PDF" = "x"; then
2251736a7e2cSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2252736a7e2cSmrg	have_ps2pdf=no
2253736a7e2cSmrg   else
2254736a7e2cSmrg        have_ps2pdf=yes
2255736a7e2cSmrg   fi
2256736a7e2cSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2257736a7e2cSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2258736a7e2cSmrg   if test "x$PS2PDF" = "x"; then
2259736a7e2cSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2260736a7e2cSmrg   fi
2261736a7e2cSmrg   have_ps2pdf=yes
2262736a7e2cSmrgelif test "x$use_ps2pdf" = x"no" ; then
2263736a7e2cSmrg   if test "x$PS2PDF" != "x"; then
2264736a7e2cSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2265736a7e2cSmrg   fi
2266736a7e2cSmrg   have_ps2pdf=no
2267736a7e2cSmrgelse
2268736a7e2cSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2269736a7e2cSmrgfi
2270736a7e2cSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2271736a7e2cSmrg]) # XORG_WITH_PS2PDF
2272736a7e2cSmrg
2273736a7e2cSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2274736a7e2cSmrg# ----------------
2275736a7e2cSmrg# Minimum version: 1.6.0
2276736a7e2cSmrg#
2277736a7e2cSmrg# Documentation tools are not always available on all platforms and sometimes
2278736a7e2cSmrg# not at the appropriate level. This macro enables a builder to skip all
2279736a7e2cSmrg# documentation targets except traditional man pages.
2280736a7e2cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2281736a7e2cSmrg# maximum flexibilty in controlling documentation building.
2282736a7e2cSmrg# Refer to:
2283736a7e2cSmrg# XORG_WITH_XMLTO         --with-xmlto
2284736a7e2cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2285736a7e2cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2286736a7e2cSmrg# XORG_WITH_FOP           --with-fop
2287736a7e2cSmrg# XORG_WITH_GROFF         --with-groff
2288736a7e2cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2289736a7e2cSmrg#
2290736a7e2cSmrg# Interface to module:
2291736a7e2cSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2292736a7e2cSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2293736a7e2cSmrg#		 'no' user instructs the module not to generate docs
2294736a7e2cSmrg# parm1:	specify the default value, yes or no.
2295736a7e2cSmrg#
2296736a7e2cSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2297736a7e2cSmrgm4_define([docs_default], m4_default([$1], [yes]))
2298736a7e2cSmrgAC_ARG_ENABLE(docs,
2299736a7e2cSmrg	AS_HELP_STRING([--enable-docs],
2300736a7e2cSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2301736a7e2cSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2302736a7e2cSmrgm4_undefine([docs_default])
2303736a7e2cSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2304736a7e2cSmrgAC_MSG_CHECKING([whether to build documentation])
2305736a7e2cSmrgAC_MSG_RESULT([$build_docs])
2306736a7e2cSmrg]) # XORG_ENABLE_DOCS
2307736a7e2cSmrg
2308736a7e2cSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2309736a7e2cSmrg# ----------------
2310736a7e2cSmrg# Minimum version: 1.6.0
2311736a7e2cSmrg#
2312736a7e2cSmrg# This macro enables a builder to skip all developer documentation.
2313736a7e2cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2314736a7e2cSmrg# maximum flexibilty in controlling documentation building.
2315736a7e2cSmrg# Refer to:
2316736a7e2cSmrg# XORG_WITH_XMLTO         --with-xmlto
2317736a7e2cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2318736a7e2cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2319736a7e2cSmrg# XORG_WITH_FOP           --with-fop
2320736a7e2cSmrg# XORG_WITH_GROFF         --with-groff
2321736a7e2cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2322736a7e2cSmrg#
2323736a7e2cSmrg# Interface to module:
2324736a7e2cSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2325736a7e2cSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2326736a7e2cSmrg#			'no' user instructs the module not to generate developer docs
2327736a7e2cSmrg# parm1:		specify the default value, yes or no.
2328736a7e2cSmrg#
2329736a7e2cSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2330736a7e2cSmrgm4_define([devel_default], m4_default([$1], [yes]))
2331736a7e2cSmrgAC_ARG_ENABLE(devel-docs,
2332736a7e2cSmrg	AS_HELP_STRING([--enable-devel-docs],
2333736a7e2cSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2334736a7e2cSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2335736a7e2cSmrgm4_undefine([devel_default])
2336736a7e2cSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2337736a7e2cSmrgAC_MSG_CHECKING([whether to build developer documentation])
2338736a7e2cSmrgAC_MSG_RESULT([$build_devel_docs])
2339736a7e2cSmrg]) # XORG_ENABLE_DEVEL_DOCS
2340736a7e2cSmrg
2341736a7e2cSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
2342736a7e2cSmrg# ----------------
2343736a7e2cSmrg# Minimum version: 1.6.0
2344736a7e2cSmrg#
2345736a7e2cSmrg# This macro enables a builder to skip all functional specification targets.
2346736a7e2cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2347736a7e2cSmrg# maximum flexibilty in controlling documentation building.
2348736a7e2cSmrg# Refer to:
2349736a7e2cSmrg# XORG_WITH_XMLTO         --with-xmlto
2350736a7e2cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2351736a7e2cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2352736a7e2cSmrg# XORG_WITH_FOP           --with-fop
2353736a7e2cSmrg# XORG_WITH_GROFF         --with-groff
2354736a7e2cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2355736a7e2cSmrg#
2356736a7e2cSmrg# Interface to module:
2357736a7e2cSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2358736a7e2cSmrg# --enable-specs:	'yes' user instructs the module to generate specs
2359736a7e2cSmrg#			'no' user instructs the module not to generate specs
2360736a7e2cSmrg# parm1:		specify the default value, yes or no.
2361736a7e2cSmrg#
2362736a7e2cSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2363736a7e2cSmrgm4_define([spec_default], m4_default([$1], [yes]))
2364736a7e2cSmrgAC_ARG_ENABLE(specs,
2365736a7e2cSmrg	AS_HELP_STRING([--enable-specs],
2366736a7e2cSmrg	   [Enable building the specs (default: ]spec_default[)]),
2367736a7e2cSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
2368736a7e2cSmrgm4_undefine([spec_default])
2369736a7e2cSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2370736a7e2cSmrgAC_MSG_CHECKING([whether to build functional specifications])
2371736a7e2cSmrgAC_MSG_RESULT([$build_specs])
2372736a7e2cSmrg]) # XORG_ENABLE_SPECS
2373736a7e2cSmrg
2374e4ee1255Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2375e4ee1255Smrg# ----------------------------------------------
2376e4ee1255Smrg# Minimum version: 1.13.0
2377e4ee1255Smrg#
2378e4ee1255Smrg# This macro enables a builder to enable/disable unit testing
2379e4ee1255Smrg# It makes no assumption about the test cases implementation
2380e4ee1255Smrg# Test cases may or may not use Automake "Support for test suites"
2381e4ee1255Smrg# They may or may not use the software utility library GLib
2382e4ee1255Smrg#
2383e4ee1255Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2384e4ee1255Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2385e4ee1255Smrg# The variable enable_unit_tests is used by other macros in this file.
2386e4ee1255Smrg#
2387e4ee1255Smrg# Interface to module:
2388e4ee1255Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2389e4ee1255Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2390e4ee1255Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2391e4ee1255Smrg#			'no' user instructs the module not to build tests
2392e4ee1255Smrg# parm1:		specify the default value, yes or no.
2393e4ee1255Smrg#
2394e4ee1255SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2395e4ee1255SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2396e4ee1255SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2397533545b5SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2398e4ee1255Smrgm4_define([_defopt], m4_default([$1], [auto]))
2399e4ee1255SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2400e4ee1255Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2401e4ee1255Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2402e4ee1255Smrgm4_undefine([_defopt])
2403e4ee1255SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2404e4ee1255SmrgAC_MSG_CHECKING([whether to build unit test cases])
2405e4ee1255SmrgAC_MSG_RESULT([$enable_unit_tests])
2406e4ee1255Smrg]) # XORG_ENABLE_UNIT_TESTS
2407e4ee1255Smrg
2408533545b5Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2409533545b5Smrg# ------------------------------------------------------
2410533545b5Smrg# Minimum version: 1.17.0
2411533545b5Smrg#
2412533545b5Smrg# This macro enables a builder to enable/disable integration testing
2413533545b5Smrg# It makes no assumption about the test cases' implementation
2414533545b5Smrg# Test cases may or may not use Automake "Support for test suites"
2415533545b5Smrg#
2416533545b5Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2417533545b5Smrg# usually requires less dependencies and may be built and run under less
2418533545b5Smrg# stringent environments than integration tests.
2419533545b5Smrg#
2420533545b5Smrg# Interface to module:
2421533545b5Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2422533545b5Smrg# enable_integration_tests:   used in configure.ac for additional configuration
2423533545b5Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2424533545b5Smrg#                             'no' user instructs the module not to build tests
2425533545b5Smrg# parm1:                      specify the default value, yes or no.
2426533545b5Smrg#
2427533545b5SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2428533545b5SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2429533545b5Smrgm4_define([_defopt], m4_default([$1], [auto]))
2430533545b5SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2431533545b5Smrg	[Enable building integration test cases (default: ]_defopt[)]),
2432533545b5Smrg	[enable_integration_tests=$enableval],
2433533545b5Smrg	[enable_integration_tests=]_defopt)
2434533545b5Smrgm4_undefine([_defopt])
2435533545b5SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2436533545b5Smrg	[test "x$enable_integration_tests" != xno])
2437533545b5SmrgAC_MSG_CHECKING([whether to build unit test cases])
2438533545b5SmrgAC_MSG_RESULT([$enable_integration_tests])
2439533545b5Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2440533545b5Smrg
2441e4ee1255Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2442e4ee1255Smrg# ----------------------------------------
2443e4ee1255Smrg# Minimum version: 1.13.0
2444e4ee1255Smrg#
2445e4ee1255Smrg# GLib is a library which provides advanced data structures and functions.
2446e4ee1255Smrg# This macro enables a module to test for the presence of Glib.
2447e4ee1255Smrg#
2448e4ee1255Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2449e4ee1255Smrg# Otherwise the value of $enable_unit_tests is blank.
2450e4ee1255Smrg#
2451533545b5Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2452533545b5Smrg# test support usually requires less dependencies and may be built and run under
2453533545b5Smrg# less stringent environments than integration tests.
2454533545b5Smrg#
2455e4ee1255Smrg# Interface to module:
2456e4ee1255Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2457e4ee1255Smrg# with_glib: used in configure.ac to know if GLib has been found
2458e4ee1255Smrg# --with-glib:	'yes' user instructs the module to use glib
2459e4ee1255Smrg#		'no' user instructs the module not to use glib
2460e4ee1255Smrg#
2461e4ee1255SmrgAC_DEFUN([XORG_WITH_GLIB],[
2462e4ee1255SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2463e4ee1255Smrgm4_define([_defopt], m4_default([$2], [auto]))
2464e4ee1255SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2465e4ee1255Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2466e4ee1255Smrg	[with_glib=$withval], [with_glib=]_defopt)
2467e4ee1255Smrgm4_undefine([_defopt])
2468e4ee1255Smrg
2469e4ee1255Smrghave_glib=no
2470e4ee1255Smrg# Do not probe GLib if user explicitly disabled unit testing
2471e4ee1255Smrgif test "x$enable_unit_tests" != x"no"; then
2472e4ee1255Smrg  # Do not probe GLib if user explicitly disabled it
2473e4ee1255Smrg  if test "x$with_glib" != x"no"; then
2474e4ee1255Smrg    m4_ifval(
2475e4ee1255Smrg      [$1],
2476e4ee1255Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2477e4ee1255Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2478e4ee1255Smrg    )
2479e4ee1255Smrg  fi
2480e4ee1255Smrgfi
2481e4ee1255Smrg
2482e4ee1255Smrg# Not having GLib when unit testing has been explicitly requested is an error
2483e4ee1255Smrgif test "x$enable_unit_tests" = x"yes"; then
2484e4ee1255Smrg  if test "x$have_glib" = x"no"; then
2485e4ee1255Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2486e4ee1255Smrg  fi
2487e4ee1255Smrgfi
2488e4ee1255Smrg
2489e4ee1255Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2490e4ee1255Smrgif test "x$enable_unit_tests" = x"no"; then
2491e4ee1255Smrg  if test "x$with_glib" = x"yes"; then
2492e4ee1255Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2493e4ee1255Smrg  fi
2494e4ee1255Smrgfi
2495e4ee1255Smrg
2496e4ee1255Smrg# Not having GLib when it has been explicitly requested is an error
2497e4ee1255Smrgif test "x$with_glib" = x"yes"; then
2498e4ee1255Smrg  if test "x$have_glib" = x"no"; then
2499e4ee1255Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2500e4ee1255Smrg  fi
2501e4ee1255Smrgfi
2502e4ee1255Smrg
2503e4ee1255SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2504e4ee1255Smrg]) # XORG_WITH_GLIB
2505e4ee1255Smrg
2506533545b5Smrg# XORG_LD_WRAP([required|optional])
2507533545b5Smrg# ---------------------------------
2508e4ee1255Smrg# Minimum version: 1.13.0
2509e4ee1255Smrg#
2510e4ee1255Smrg# Check if linker supports -wrap, passed via compiler flags
2511e4ee1255Smrg#
2512e4ee1255Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2513e4ee1255Smrg# Otherwise the value of $enable_unit_tests is blank.
2514e4ee1255Smrg#
2515533545b5Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2516533545b5Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2517533545b5Smrg# available, an argument of "optional" allows use when some unit tests require
2518533545b5Smrg# ld -wrap and others do not.
2519533545b5Smrg#
2520e4ee1255SmrgAC_DEFUN([XORG_LD_WRAP],[
2521533545b5SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2522533545b5Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2523533545b5Smrg                      void __wrap_exit(int status) { return; }],
2524533545b5Smrg                     [exit(0);])])
2525e4ee1255Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2526533545b5Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2527e4ee1255Smrg  if test "x$have_ld_wrap" = x"no"; then
2528e4ee1255Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2529e4ee1255Smrg  fi
2530e4ee1255Smrgfi
2531e4ee1255SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2532e4ee1255Smrg#
2533e4ee1255Smrg]) # XORG_LD_WRAP
2534e4ee1255Smrg
2535e4ee1255Smrg# XORG_CHECK_LINKER_FLAGS
2536e4ee1255Smrg# -----------------------
2537e4ee1255Smrg# SYNOPSIS
2538e4ee1255Smrg#
2539533545b5Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2540e4ee1255Smrg#
2541e4ee1255Smrg# DESCRIPTION
2542e4ee1255Smrg#
2543e4ee1255Smrg#   Check whether the given linker FLAGS work with the current language's
2544e4ee1255Smrg#   linker, or whether they give an error.
2545e4ee1255Smrg#
2546e4ee1255Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2547e4ee1255Smrg#   success/failure.
2548e4ee1255Smrg#
2549533545b5Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2550533545b5Smrg#
2551e4ee1255Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2552e4ee1255Smrg#
2553e4ee1255Smrg# LICENSE
2554e4ee1255Smrg#
2555e4ee1255Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2556e4ee1255Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2557e4ee1255Smrg#   Copyright (c) 2009 Matteo Frigo
2558e4ee1255Smrg#
2559e4ee1255Smrg#   This program is free software: you can redistribute it and/or modify it
2560e4ee1255Smrg#   under the terms of the GNU General Public License as published by the
2561e4ee1255Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2562e4ee1255Smrg#   option) any later version.
2563e4ee1255Smrg#
2564e4ee1255Smrg#   This program is distributed in the hope that it will be useful, but
2565e4ee1255Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2566e4ee1255Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2567e4ee1255Smrg#   Public License for more details.
2568e4ee1255Smrg#
2569e4ee1255Smrg#   You should have received a copy of the GNU General Public License along
2570e4ee1255Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2571e4ee1255Smrg#
2572e4ee1255Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2573e4ee1255Smrg#   gives unlimited permission to copy, distribute and modify the configure
2574e4ee1255Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2575e4ee1255Smrg#   need not follow the terms of the GNU General Public License when using
2576e4ee1255Smrg#   or distributing such scripts, even though portions of the text of the
2577e4ee1255Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2578e4ee1255Smrg#   all other use of the material that constitutes the Autoconf Macro.
2579e4ee1255Smrg#
2580e4ee1255Smrg#   This special exception to the GPL applies to versions of the Autoconf
2581e4ee1255Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2582e4ee1255Smrg#   modified version of the Autoconf Macro, you may extend this special
2583e4ee1255Smrg#   exception to the GPL to apply to your modified version as well.#
2584e4ee1255SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2585e4ee1255Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2586e4ee1255Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2587e4ee1255SmrgAS_LITERAL_IF([$1],
2588e4ee1255Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2589e4ee1255Smrg      ax_save_FLAGS=$LDFLAGS
2590e4ee1255Smrg      LDFLAGS="$1"
2591533545b5Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2592e4ee1255Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2593e4ee1255Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2594e4ee1255Smrg      LDFLAGS=$ax_save_FLAGS])],
2595e4ee1255Smrg  [ax_save_FLAGS=$LDFLAGS
2596e4ee1255Smrg   LDFLAGS="$1"
2597e4ee1255Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2598e4ee1255Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2599e4ee1255Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2600e4ee1255Smrg   LDFLAGS=$ax_save_FLAGS])
2601e4ee1255Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2602e4ee1255SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2603e4ee1255Smrgif test "x$xorg_check_linker_flags" = xyes; then
2604e4ee1255Smrg	m4_default([$2], :)
2605e4ee1255Smrgelse
2606e4ee1255Smrg	m4_default([$3], :)
2607e4ee1255Smrgfi
2608e4ee1255Smrg]) # XORG_CHECK_LINKER_FLAGS
2609e4ee1255Smrg
2610533545b5Smrg# XORG_MEMORY_CHECK_FLAGS
2611533545b5Smrg# -----------------------
2612533545b5Smrg# Minimum version: 1.16.0
2613533545b5Smrg#
2614533545b5Smrg# This macro attempts to find appropriate memory checking functionality
2615533545b5Smrg# for various platforms which unit testing code may use to catch various
2616533545b5Smrg# forms of memory allocation and access errors in testing.
2617533545b5Smrg#
2618533545b5Smrg# Interface to module:
2619533545b5Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2620533545b5Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2621533545b5Smrg#
2622533545b5Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2623533545b5Smrg#
2624533545b5SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2625533545b5Smrg
2626533545b5SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2627533545b5SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2628533545b5Smrg           [Environment variables to enable memory checking in tests])
2629533545b5Smrg
2630533545b5Smrg# Check for different types of support on different platforms
2631533545b5Smrgcase $host_os in
2632533545b5Smrg    solaris*)
2633533545b5Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2634533545b5Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2635533545b5Smrg        ;;
2636533545b5Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2637533545b5Smrg        # both directly and inverted, so should not be 0 or 255.
2638533545b5Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2639533545b5Smrg        ;;
2640533545b5Smrg    darwin*)
2641533545b5Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2642533545b5Smrg        ;;
2643533545b5Smrg    *bsd*)
2644533545b5Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2645533545b5Smrg        ;;
2646533545b5Smrgesac
2647533545b5Smrg
2648533545b5Smrg# User supplied flags override default flags
2649533545b5Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2650533545b5Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2651533545b5Smrgfi
2652533545b5Smrg
2653533545b5SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2654533545b5Smrg]) # XORG_WITH_LINT
2655533545b5Smrg
2656264fa531Smrg# XORG_CHECK_MALLOC_ZERO
2657264fa531Smrg# ----------------------
2658c37a63b8Smrg# Minimum version: 1.0.0
2659c37a63b8Smrg#
2660264fa531Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2661264fa531Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2662264fa531Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2663264fa531SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2664264fa531SmrgAC_ARG_ENABLE(malloc0returnsnull,
2665c37a63b8Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2666264fa531Smrg		       [malloc(0) returns NULL (default: auto)]),
2667264fa531Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2668264fa531Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2669264fa531Smrg
2670264fa531SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2671264fa531Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2672533545b5SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
2673533545b5Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2674736a7e2cSmrg#include <stdlib.h>
2675736a7e2cSmrg],[
2676264fa531Smrg    char *m0, *r0, *c0, *p;
2677264fa531Smrg    m0 = malloc(0);
2678264fa531Smrg    p = malloc(10);
2679264fa531Smrg    r0 = realloc(p,0);
2680736a7e2cSmrg    c0 = calloc(0,10);
2681736a7e2cSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2682736a7e2cSmrg])],
2683533545b5Smrg		[xorg_cv_malloc0_returns_null=yes],
2684533545b5Smrg		[xorg_cv_malloc0_returns_null=no])])
2685533545b5SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2686264fa531Smrgfi
2687264fa531SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2688264fa531Smrg
2689264fa531Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2690264fa531Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2691264fa531Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2692264fa531Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2693264fa531Smrgelse
2694264fa531Smrg	MALLOC_ZERO_CFLAGS=""
2695264fa531Smrg	XMALLOC_ZERO_CFLAGS=""
2696264fa531Smrg	XTMALLOC_ZERO_CFLAGS=""
2697264fa531Smrgfi
2698264fa531Smrg
2699264fa531SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2700264fa531SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2701264fa531SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2702264fa531Smrg]) # XORG_CHECK_MALLOC_ZERO
2703264fa531Smrg
2704c37a63b8Smrg# XORG_WITH_LINT()
2705c37a63b8Smrg# ----------------
2706c37a63b8Smrg# Minimum version: 1.1.0
2707c37a63b8Smrg#
2708736a7e2cSmrg# This macro enables the use of a tool that flags some suspicious and
2709736a7e2cSmrg# non-portable constructs (likely to be bugs) in C language source code.
2710736a7e2cSmrg# It will attempt to locate the tool and use appropriate options.
2711736a7e2cSmrg# There are various lint type tools on different platforms.
2712736a7e2cSmrg#
2713736a7e2cSmrg# Interface to module:
2714736a7e2cSmrg# LINT:		returns the path to the tool found on the platform
2715736a7e2cSmrg#		or the value set to LINT on the configure cmd line
2716736a7e2cSmrg#		also an Automake conditional
2717736a7e2cSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
2718736a7e2cSmrg#
2719736a7e2cSmrg# --with-lint:	'yes' user instructs the module to use lint
2720736a7e2cSmrg#		'no' user instructs the module not to use lint (default)
2721736a7e2cSmrg#
2722736a7e2cSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2723736a7e2cSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2724c37a63b8Smrg#
2725c37a63b8SmrgAC_DEFUN([XORG_WITH_LINT],[
2726c37a63b8Smrg
2727736a7e2cSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2728736a7e2cSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2729c37a63b8SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2730c37a63b8Smrg		[Use a lint-style source code checker (default: disabled)])],
2731c37a63b8Smrg		[use_lint=$withval], [use_lint=no])
2732736a7e2cSmrg
2733736a7e2cSmrg# Obtain platform specific info like program name and options
2734736a7e2cSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2735736a7e2cSmrgcase $host_os in
2736736a7e2cSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2737736a7e2cSmrg	lint_name=splint
2738736a7e2cSmrg	lint_options="-badflag"
2739736a7e2cSmrg	;;
2740736a7e2cSmrg  *freebsd* | *netbsd*)
2741736a7e2cSmrg	lint_name=lint
2742736a7e2cSmrg	lint_options="-u -b"
2743736a7e2cSmrg	;;
2744736a7e2cSmrg  *solaris*)
2745736a7e2cSmrg	lint_name=lint
2746736a7e2cSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2747736a7e2cSmrg	;;
2748736a7e2cSmrgesac
2749736a7e2cSmrg
2750736a7e2cSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2751736a7e2cSmrgif test "x$use_lint" = x"yes" ; then
2752736a7e2cSmrg   AC_PATH_PROG([LINT], [$lint_name])
2753736a7e2cSmrg   if test "x$LINT" = "x"; then
2754736a7e2cSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2755736a7e2cSmrg   fi
2756736a7e2cSmrgelif test "x$use_lint" = x"no" ; then
2757736a7e2cSmrg   if test "x$LINT" != "x"; then
2758736a7e2cSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2759736a7e2cSmrg   fi
2760c37a63b8Smrgelse
2761736a7e2cSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2762c37a63b8Smrgfi
2763736a7e2cSmrg
2764736a7e2cSmrg# User supplied flags override default flags
2765736a7e2cSmrgif test "x$LINT_FLAGS" != "x"; then
2766736a7e2cSmrg   lint_options=$LINT_FLAGS
2767c37a63b8Smrgfi
2768c37a63b8Smrg
2769736a7e2cSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2770736a7e2cSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2771c37a63b8Smrg
2772c37a63b8Smrg]) # XORG_WITH_LINT
2773c37a63b8Smrg
2774c37a63b8Smrg# XORG_LINT_LIBRARY(LIBNAME)
2775c37a63b8Smrg# --------------------------
2776c37a63b8Smrg# Minimum version: 1.1.0
2777c37a63b8Smrg#
2778c37a63b8Smrg# Sets up flags for building lint libraries for checking programs that call
2779c37a63b8Smrg# functions in the library.
2780c37a63b8Smrg#
2781736a7e2cSmrg# Interface to module:
2782736a7e2cSmrg# LINTLIB		- Automake variable with the name of lint library file to make
2783736a7e2cSmrg# MAKE_LINT_LIB		- Automake conditional
2784736a7e2cSmrg#
2785736a7e2cSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2786736a7e2cSmrg#			  - 'no' user instructs the module not to create a lint library (default)
2787c37a63b8Smrg
2788c37a63b8SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2789c37a63b8SmrgAC_REQUIRE([XORG_WITH_LINT])
2790c37a63b8SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2791c37a63b8Smrg	[Create lint library (default: disabled)])],
2792c37a63b8Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2793736a7e2cSmrg
2794736a7e2cSmrgif test "x$make_lint_lib" = x"yes" ; then
2795736a7e2cSmrg   LINTLIB=llib-l$1.ln
2796736a7e2cSmrg   if test "x$LINT" = "x"; then
2797736a7e2cSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2798736a7e2cSmrg   fi
2799736a7e2cSmrgelif test "x$make_lint_lib" != x"no" ; then
2800736a7e2cSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2801c37a63b8Smrgfi
2802736a7e2cSmrg
2803c37a63b8SmrgAC_SUBST(LINTLIB)
2804c37a63b8SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2805c37a63b8Smrg
2806c37a63b8Smrg]) # XORG_LINT_LIBRARY
2807c37a63b8Smrg
2808e4ee1255Smrg# XORG_COMPILER_BRAND
2809e4ee1255Smrg# -------------------
2810e4ee1255Smrg# Minimum version: 1.14.0
2811e4ee1255Smrg#
2812e4ee1255Smrg# Checks for various brands of compilers and sets flags as appropriate:
2813e4ee1255Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2814533545b5Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2815e4ee1255Smrg#   clang compiler - sets CLANGCC to "yes"
2816e4ee1255Smrg#   Intel compiler - sets INTELCC to "yes"
2817e4ee1255Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2818e4ee1255Smrg#
2819e4ee1255SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2820533545b5SmrgAC_LANG_CASE(
2821533545b5Smrg	[C], [
2822533545b5Smrg		AC_REQUIRE([AC_PROG_CC_C99])
2823533545b5Smrg	],
2824533545b5Smrg	[C++], [
2825533545b5Smrg		AC_REQUIRE([AC_PROG_CXX])
2826533545b5Smrg	]
2827533545b5Smrg)
2828e4ee1255SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2829e4ee1255SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2830e4ee1255SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2831e4ee1255Smrg]) # XORG_COMPILER_BRAND
2832e4ee1255Smrg
2833533545b5Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2834533545b5Smrg# ---------------
2835533545b5Smrg# Minimum version: 1.16.0
2836533545b5Smrg#
2837533545b5Smrg# Test if the compiler works when passed the given flag as a command line argument.
2838533545b5Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2839533545b5Smrg# next flag in the list until there are no more options.
2840533545b5Smrg#
2841533545b5Smrg# Note that this does not guarantee that the compiler supports the flag as some
2842533545b5Smrg# compilers will simply ignore arguments that they do not understand, but we do
2843533545b5Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2844533545b5Smrg# -Werror=unused-command-line-argument
2845533545b5Smrg#
2846533545b5SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2847533545b5Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2848533545b5Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2849533545b5Smrg
2850533545b5SmrgAC_LANG_COMPILER_REQUIRE
2851533545b5Smrg
2852533545b5SmrgAC_LANG_CASE(
2853533545b5Smrg	[C], [
2854533545b5Smrg		AC_REQUIRE([AC_PROG_CC_C99])
2855533545b5Smrg		define([PREFIX], [C])
2856533545b5Smrg		define([CACHE_PREFIX], [cc])
2857533545b5Smrg		define([COMPILER], [$CC])
2858533545b5Smrg	],
2859533545b5Smrg	[C++], [
2860533545b5Smrg		define([PREFIX], [CXX])
2861533545b5Smrg		define([CACHE_PREFIX], [cxx])
2862533545b5Smrg		define([COMPILER], [$CXX])
2863533545b5Smrg	]
2864533545b5Smrg)
2865533545b5Smrg
2866533545b5Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2867533545b5Smrg
2868533545b5Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
2869533545b5Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2870533545b5Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
2871533545b5Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2872533545b5Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2873533545b5Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
2874533545b5Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
2875533545b5Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
2876533545b5Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2877533545b5Smrgfi
2878533545b5Smrg
2879533545b5Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
2880533545b5Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
2881533545b5Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2882533545b5Smrg	fi
2883533545b5Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2884533545b5Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
2885533545b5Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2886533545b5Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2887533545b5Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
2888533545b5Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
2889533545b5Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
2890533545b5Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2891533545b5Smrgfi
2892533545b5Smrg
2893533545b5Smrgfound="no"
2894533545b5Smrgm4_foreach([flag], m4_cdr($@), [
2895533545b5Smrg	if test $found = "no" ; then
2896533545b5Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
2897533545b5Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2898533545b5Smrg		fi
2899533545b5Smrg
2900533545b5Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
2901533545b5Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2902533545b5Smrg		fi
2903533545b5Smrg
2904533545b5Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2905533545b5Smrg
2906533545b5Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2907533545b5Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
2908533545b5Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
2909533545b5Smrg		AC_CACHE_VAL($cacheid,
2910533545b5Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2911533545b5Smrg					     [eval $cacheid=yes],
2912533545b5Smrg					     [eval $cacheid=no])])
2913533545b5Smrg
2914533545b5Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2915533545b5Smrg
2916533545b5Smrg		eval supported=\$$cacheid
2917533545b5Smrg		AC_MSG_RESULT([$supported])
2918533545b5Smrg		if test "$supported" = "yes" ; then
2919533545b5Smrg			$1="$$1 ]flag["
2920533545b5Smrg			found="yes"
2921533545b5Smrg		fi
2922533545b5Smrg	fi
2923533545b5Smrg])
2924533545b5Smrg]) # XORG_TESTSET_CFLAG
2925533545b5Smrg
2926533545b5Smrg# XORG_COMPILER_FLAGS
2927533545b5Smrg# ---------------
2928533545b5Smrg# Minimum version: 1.16.0
2929533545b5Smrg#
2930533545b5Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2931533545b5Smrg# arguments supported by the selected compiler which do NOT alter the generated
2932533545b5Smrg# code.  These arguments will cause the compiler to print various warnings
2933533545b5Smrg# during compilation AND turn a conservative set of warnings into errors.
2934533545b5Smrg#
2935533545b5Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2936533545b5Smrg# future versions of util-macros as options are added to new compilers.
2937533545b5Smrg#
2938533545b5SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2939533545b5SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2940533545b5Smrg
2941533545b5SmrgAC_ARG_ENABLE(selective-werror,
2942533545b5Smrg              AS_HELP_STRING([--disable-selective-werror],
2943533545b5Smrg                             [Turn off selective compiler errors. (default: enabled)]),
2944533545b5Smrg              [SELECTIVE_WERROR=$enableval],
2945533545b5Smrg              [SELECTIVE_WERROR=yes])
2946533545b5Smrg
2947533545b5SmrgAC_LANG_CASE(
2948533545b5Smrg        [C], [
2949533545b5Smrg                define([PREFIX], [C])
2950533545b5Smrg        ],
2951533545b5Smrg        [C++], [
2952533545b5Smrg                define([PREFIX], [CXX])
2953533545b5Smrg        ]
2954533545b5Smrg)
2955533545b5Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2956533545b5Smrgif test "x$SUNCC" = "xyes"; then
2957533545b5Smrg    [BASE_]PREFIX[FLAGS]="-v"
2958533545b5Smrgelse
2959533545b5Smrg    [BASE_]PREFIX[FLAGS]=""
2960533545b5Smrgfi
2961533545b5Smrg
2962533545b5Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2963533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2964533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2965533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2966533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2967533545b5Smrg
2968533545b5SmrgAC_LANG_CASE(
2969533545b5Smrg	[C], [
2970533545b5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2971533545b5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2972533545b5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2973533545b5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
2974533545b5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
2975533545b5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2976533545b5Smrg	]
2977533545b5Smrg)
2978533545b5Smrg
2979533545b5Smrg# This chunk adds additional warnings that could catch undesired effects.
2980533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2981533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2982533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2983533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2984533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2985533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
2986533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2987533545b5Smrg
2988533545b5Smrg# These are currently disabled because they are noisy.  They will be enabled
2989533545b5Smrg# in the future once the codebase is sufficiently modernized to silence
2990533545b5Smrg# them.  For now, I don't want them to drown out the other warnings.
2991533545b5Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
2992533545b5Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
2993533545b5Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2994533545b5Smrg
2995533545b5Smrg# Turn some warnings into errors, so we don't accidently get successful builds
2996533545b5Smrg# when there are problems that should be fixed.
2997533545b5Smrg
2998533545b5Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
2999533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3000533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3001533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3002533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3003533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3004533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3005533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3006533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3007533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3008533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3009533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3010533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3011533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3012533545b5Smrgelse
3013533545b5SmrgAC_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])
3014533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3015533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3016533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3017533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3018533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3019533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3020533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3021533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3022533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3023533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3024533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3025533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3026533545b5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3027533545b5Smrgfi
3028533545b5Smrg
3029533545b5SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3030533545b5Smrg]) # XORG_COMPILER_FLAGS
3031533545b5Smrg
3032c37a63b8Smrg# XORG_CWARNFLAGS
3033c37a63b8Smrg# ---------------
3034c37a63b8Smrg# Minimum version: 1.2.0
3035533545b5Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3036c37a63b8Smrg#
3037c37a63b8Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3038c37a63b8Smrg#
3039533545b5Smrg# This function is deprecated because it defines -fno-strict-aliasing
3040533545b5Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3041533545b5Smrg# is needed, then it should be added explicitly in the module when
3042533545b5Smrg# it is updated to use BASE_CFLAGS.
3043533545b5Smrg#
3044c37a63b8SmrgAC_DEFUN([XORG_CWARNFLAGS], [
3045533545b5SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3046e4ee1255SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3047533545b5SmrgAC_LANG_CASE(
3048533545b5Smrg	[C], [
3049533545b5Smrg		CWARNFLAGS="$BASE_CFLAGS"
3050533545b5Smrg		if  test "x$GCC" = xyes ; then
3051533545b5Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3052533545b5Smrg		fi
3053533545b5Smrg		AC_SUBST(CWARNFLAGS)
3054533545b5Smrg	]
3055533545b5Smrg)
3056c37a63b8Smrg]) # XORG_CWARNFLAGS
3057c37a63b8Smrg
3058c37a63b8Smrg# XORG_STRICT_OPTION
3059c37a63b8Smrg# -----------------------
3060c37a63b8Smrg# Minimum version: 1.3.0
3061c37a63b8Smrg#
3062e4ee1255Smrg# Add configure option to enable strict compilation flags, such as treating
3063e4ee1255Smrg# warnings as fatal errors.
3064e4ee1255Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3065533545b5Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3066e4ee1255Smrg#
3067e4ee1255Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3068e4ee1255Smrg# when strict compilation is unconditionally desired.
3069c37a63b8SmrgAC_DEFUN([XORG_STRICT_OPTION], [
3070c37a63b8SmrgAC_REQUIRE([XORG_CWARNFLAGS])
3071533545b5SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3072c37a63b8Smrg
3073c37a63b8SmrgAC_ARG_ENABLE(strict-compilation,
3074c37a63b8Smrg			  AS_HELP_STRING([--enable-strict-compilation],
3075c37a63b8Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3076c37a63b8Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3077533545b5Smrg
3078533545b5SmrgAC_LANG_CASE(
3079533545b5Smrg        [C], [
3080533545b5Smrg                define([PREFIX], [C])
3081533545b5Smrg        ],
3082533545b5Smrg        [C++], [
3083533545b5Smrg                define([PREFIX], [CXX])
3084533545b5Smrg        ]
3085533545b5Smrg)
3086533545b5Smrg
3087533545b5Smrg[STRICT_]PREFIX[FLAGS]=""
3088533545b5SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3089533545b5SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3090533545b5Smrg
3091533545b5Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3092533545b5Smrg# activate it with -Werror, so we add it here explicitly.
3093533545b5SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3094533545b5Smrg
3095c37a63b8Smrgif test "x$STRICT_COMPILE" = "xyes"; then
3096533545b5Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3097533545b5Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3098c37a63b8Smrgfi
3099533545b5SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3100533545b5SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3101533545b5SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3102c37a63b8Smrg]) # XORG_STRICT_OPTION
3103c37a63b8Smrg
3104c37a63b8Smrg# XORG_DEFAULT_OPTIONS
3105c37a63b8Smrg# --------------------
3106c37a63b8Smrg# Minimum version: 1.3.0
3107c37a63b8Smrg#
3108c37a63b8Smrg# Defines default options for X.Org modules.
3109c37a63b8Smrg#
3110c37a63b8SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3111736a7e2cSmrgAC_REQUIRE([AC_PROG_INSTALL])
3112533545b5SmrgXORG_COMPILER_FLAGS
3113c37a63b8SmrgXORG_CWARNFLAGS
3114c37a63b8SmrgXORG_STRICT_OPTION
3115c37a63b8SmrgXORG_RELEASE_VERSION
3116c37a63b8SmrgXORG_CHANGELOG
3117736a7e2cSmrgXORG_INSTALL
3118c37a63b8SmrgXORG_MANPAGE_SECTIONS
3119736a7e2cSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3120736a7e2cSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3121c37a63b8Smrg]) # XORG_DEFAULT_OPTIONS
3122736a7e2cSmrg
3123736a7e2cSmrg# XORG_INSTALL()
3124736a7e2cSmrg# ----------------
3125736a7e2cSmrg# Minimum version: 1.4.0
3126736a7e2cSmrg#
3127736a7e2cSmrg# Defines the variable INSTALL_CMD as the command to copy
3128736a7e2cSmrg# INSTALL from $prefix/share/util-macros.
3129736a7e2cSmrg#
3130736a7e2cSmrgAC_DEFUN([XORG_INSTALL], [
3131736a7e2cSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3132736a7e2cSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3133736a7e2cSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3134736a7e2cSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3135736a7e2cSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
3136736a7e2cSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
3137736a7e2cSmrgAC_SUBST([INSTALL_CMD])
3138736a7e2cSmrg]) # XORG_INSTALL
3139264fa531Smrgdnl Copyright 2005 Red Hat, Inc
3140264fa531Smrgdnl
3141264fa531Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3142264fa531Smrgdnl documentation for any purpose is hereby granted without fee, provided that
3143264fa531Smrgdnl the above copyright notice appear in all copies and that both that
3144264fa531Smrgdnl copyright notice and this permission notice appear in supporting
3145264fa531Smrgdnl documentation.
3146264fa531Smrgdnl
3147264fa531Smrgdnl The above copyright notice and this permission notice shall be included
3148264fa531Smrgdnl in all copies or substantial portions of the Software.
3149264fa531Smrgdnl
3150264fa531Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3151264fa531Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3152264fa531Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3153264fa531Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3154264fa531Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3155264fa531Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3156264fa531Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3157264fa531Smrgdnl
3158264fa531Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3159264fa531Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3160264fa531Smrgdnl other dealings in this Software without prior written authorization
3161264fa531Smrgdnl from the copyright holders.
3162264fa531Smrgdnl
3163264fa531Smrg
3164264fa531Smrg# XORG_RELEASE_VERSION
3165264fa531Smrg# --------------------
3166736a7e2cSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3167533545b5Smrg
3168264fa531SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3169c37a63b8Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3170c37a63b8Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3171c37a63b8Smrg		[Major version of this package])
3172c37a63b8Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3173c37a63b8Smrg	if test "x$PVM" = "x"; then
3174c37a63b8Smrg		PVM="0"
3175c37a63b8Smrg	fi
3176c37a63b8Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3177c37a63b8Smrg		[$PVM],
3178c37a63b8Smrg		[Minor version of this package])
3179c37a63b8Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3180c37a63b8Smrg	if test "x$PVP" = "x"; then
3181c37a63b8Smrg		PVP="0"
3182c37a63b8Smrg	fi
3183c37a63b8Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3184c37a63b8Smrg		[$PVP],
3185c37a63b8Smrg		[Patch version of this package])
3186264fa531Smrg])
3187264fa531Smrg
3188c37a63b8Smrg# XORG_CHANGELOG()
3189c37a63b8Smrg# ----------------
3190c37a63b8Smrg# Minimum version: 1.2.0
3191c37a63b8Smrg#
3192c37a63b8Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3193c37a63b8Smrg# ChangeLog from git.
3194c37a63b8Smrg#
3195c37a63b8Smrg#
3196c37a63b8SmrgAC_DEFUN([XORG_CHANGELOG], [
3197736a7e2cSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3198736a7e2cSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3199736a7e2cSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3200c37a63b8Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
3201c37a63b8SmrgAC_SUBST([CHANGELOG_CMD])
3202c37a63b8Smrg]) # XORG_CHANGELOG
3203c37a63b8Smrg
3204