1945aa7e3Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2945aa7e3Smrg
3945aa7e3Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4010cdda0Smrg
5010cdda0Smrg# This file is free software; the Free Software Foundation
6010cdda0Smrg# gives unlimited permission to copy and/or distribute it,
7010cdda0Smrg# with or without modifications, as long as this notice is preserved.
8010cdda0Smrg
9010cdda0Smrg# This program is distributed in the hope that it will be useful,
10010cdda0Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11010cdda0Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12010cdda0Smrg# PARTICULAR PURPOSE.
13010cdda0Smrg
14945aa7e3Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15b3eb03f3Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16b3eb03f3Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17affd2f3fSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
18affd2f3fSmrg[m4_warning([this file was generated for autoconf 2.72.
19b3eb03f3SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20b3eb03f3SmrgIf you have problems, you may need to regenerate the build system entirely.
21945aa7e3SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22010cdda0Smrg
23945aa7e3Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
24b3eb03f3Smrg#
25b3eb03f3Smrg# This file is free software; the Free Software Foundation
26b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
27b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
28010cdda0Smrg
29010cdda0Smrg# AM_AUTOMAKE_VERSION(VERSION)
30010cdda0Smrg# ----------------------------
31010cdda0Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32010cdda0Smrg# generated from the m4 files accompanying Automake X.Y.
33b3eb03f3Smrg# (This private macro should not be called outside this file.)
34b3eb03f3SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35945aa7e3Smrg[am__api_version='1.16'
36b3eb03f3Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37b3eb03f3Smrgdnl require some minimum version.  Point them to the right macro.
38945aa7e3Smrgm4_if([$1], [1.16.5], [],
39b3eb03f3Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40b3eb03f3Smrg])
41b3eb03f3Smrg
42b3eb03f3Smrg# _AM_AUTOCONF_VERSION(VERSION)
43b3eb03f3Smrg# -----------------------------
44b3eb03f3Smrg# aclocal traces this macro to find the Autoconf version.
45b3eb03f3Smrg# This is a private macro too.  Using m4_define simplifies
46b3eb03f3Smrg# the logic in aclocal, which can simply ignore this definition.
47b3eb03f3Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48010cdda0Smrg
49010cdda0Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50010cdda0Smrg# -------------------------------
51b3eb03f3Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52b3eb03f3Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53010cdda0SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54945aa7e3Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
55b3eb03f3Smrgm4_ifndef([AC_AUTOCONF_VERSION],
56b3eb03f3Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57b3eb03f3Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58010cdda0Smrg
59b3eb03f3Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60010cdda0Smrg
61945aa7e3Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
62010cdda0Smrg#
63b3eb03f3Smrg# This file is free software; the Free Software Foundation
64b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
65b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
66010cdda0Smrg
67010cdda0Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68945aa7e3Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69945aa7e3Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70010cdda0Smrg#
71010cdda0Smrg# Of course, Automake must honor this variable whenever it calls a
72010cdda0Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73010cdda0Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74010cdda0Smrg# depending on how configure is run.  This is pretty annoying, since
75010cdda0Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76010cdda0Smrg# source directory, any form will work fine, but in subdirectories a
77010cdda0Smrg# relative path needs to be adjusted first.
78010cdda0Smrg#
79010cdda0Smrg# $ac_aux_dir/missing
80010cdda0Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81010cdda0Smrg# $top_srcdir/$ac_aux_dir/missing
82010cdda0Smrg#    fails if $ac_aux_dir is absolute,
83010cdda0Smrg#    fails when called from a subdirectory in a VPATH build with
84010cdda0Smrg#          a relative $ac_aux_dir
85010cdda0Smrg#
86010cdda0Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87010cdda0Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
88945aa7e3Smrg# harmless because $srcdir is '.', but things will broke when you
89010cdda0Smrg# start a VPATH build or use an absolute $srcdir.
90010cdda0Smrg#
91010cdda0Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92010cdda0Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93010cdda0Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94010cdda0Smrg# and then we would define $MISSING as
95010cdda0Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96010cdda0Smrg# This will work as long as MISSING is not called from configure, because
97010cdda0Smrg# unfortunately $(top_srcdir) has no meaning in configure.
98010cdda0Smrg# However there are other variables, like CC, which are often used in
99010cdda0Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100010cdda0Smrg#
101010cdda0Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
102010cdda0Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
103010cdda0Smrg# configured tree to be moved without reconfiguration.
104010cdda0Smrg
105b3eb03f3SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106945aa7e3Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107945aa7e3Smrg# Expand $ac_aux_dir to an absolute path.
108945aa7e3Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109010cdda0Smrg])
110010cdda0Smrg
111b3eb03f3Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112010cdda0Smrg
113945aa7e3Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
114b3eb03f3Smrg#
115b3eb03f3Smrg# This file is free software; the Free Software Foundation
116b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
117b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
118010cdda0Smrg
119b3eb03f3Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120b3eb03f3Smrg# -------------------------------------
121b3eb03f3Smrg# Define a conditional.
122b3eb03f3SmrgAC_DEFUN([AM_CONDITIONAL],
123945aa7e3Smrg[AC_PREREQ([2.52])dnl
124945aa7e3Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
125945aa7e3Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126b3eb03f3SmrgAC_SUBST([$1_TRUE])dnl
127b3eb03f3SmrgAC_SUBST([$1_FALSE])dnl
128b3eb03f3Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129b3eb03f3Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130b3eb03f3Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131b3eb03f3Smrgif $2; then
132b3eb03f3Smrg  $1_TRUE=
133b3eb03f3Smrg  $1_FALSE='#'
134010cdda0Smrgelse
135b3eb03f3Smrg  $1_TRUE='#'
136b3eb03f3Smrg  $1_FALSE=
137010cdda0Smrgfi
138b3eb03f3SmrgAC_CONFIG_COMMANDS_PRE(
139b3eb03f3Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140b3eb03f3Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141b3eb03f3SmrgUsually this means the macro was only invoked conditionally.]])
142b3eb03f3Smrgfi])])
143010cdda0Smrg
144945aa7e3Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
145b3eb03f3Smrg#
146b3eb03f3Smrg# This file is free software; the Free Software Foundation
147b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
148b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
149010cdda0Smrg
150010cdda0Smrg
151945aa7e3Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
152010cdda0Smrg# written in clear, in which case automake, when reading aclocal.m4,
153010cdda0Smrg# will think it sees a *use*, and therefore will trigger all it's
154010cdda0Smrg# C support machinery.  Also note that it means that autoscan, seeing
155010cdda0Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156010cdda0Smrg
157010cdda0Smrg
158010cdda0Smrg# _AM_DEPENDENCIES(NAME)
159010cdda0Smrg# ----------------------
160010cdda0Smrg# See how the compiler implements dependency checking.
161945aa7e3Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
162010cdda0Smrg# We try a few techniques and use that to set a single cache variable.
163010cdda0Smrg#
164010cdda0Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
165010cdda0Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
166010cdda0Smrg# dependency, and given that the user is not expected to run this macro,
167010cdda0Smrg# just rely on AC_PROG_CC.
168010cdda0SmrgAC_DEFUN([_AM_DEPENDENCIES],
169010cdda0Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
170010cdda0SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
171010cdda0SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
172010cdda0SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173010cdda0Smrg
174945aa7e3Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
175945aa7e3Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
176945aa7e3Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
177945aa7e3Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
178945aa7e3Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
179945aa7e3Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
180945aa7e3Smrg                    [depcc="$$1"   am_compiler_list=])
181010cdda0Smrg
182010cdda0SmrgAC_CACHE_CHECK([dependency style of $depcc],
183010cdda0Smrg               [am_cv_$1_dependencies_compiler_type],
184010cdda0Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
185010cdda0Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
186010cdda0Smrg  # making bogus files that we don't know about and never remove.  For
187010cdda0Smrg  # instance it was reported that on HP-UX the gcc test will end up
188945aa7e3Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
189945aa7e3Smrg  # in D".
190b4485a66Smrg  rm -rf conftest.dir
191010cdda0Smrg  mkdir conftest.dir
192010cdda0Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
193010cdda0Smrg  # using a relative directory.
194010cdda0Smrg  cp "$am_depcomp" conftest.dir
195010cdda0Smrg  cd conftest.dir
196010cdda0Smrg  # We will build objects and dependencies in a subdirectory because
197010cdda0Smrg  # it helps to detect inapplicable dependency modes.  For instance
198010cdda0Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
199010cdda0Smrg  # side effect of compilation, but ICC will put the dependencies in
200010cdda0Smrg  # the current directory while Tru64 will put them in the object
201010cdda0Smrg  # directory.
202010cdda0Smrg  mkdir sub
203010cdda0Smrg
204010cdda0Smrg  am_cv_$1_dependencies_compiler_type=none
205010cdda0Smrg  if test "$am_compiler_list" = ""; then
206010cdda0Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
207010cdda0Smrg  fi
208b3eb03f3Smrg  am__universal=false
209b3eb03f3Smrg  m4_case([$1], [CC],
210b3eb03f3Smrg    [case " $depcc " in #(
211b3eb03f3Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212b3eb03f3Smrg     esac],
213b3eb03f3Smrg    [CXX],
214b3eb03f3Smrg    [case " $depcc " in #(
215b3eb03f3Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216b3eb03f3Smrg     esac])
217b3eb03f3Smrg
218010cdda0Smrg  for depmode in $am_compiler_list; do
219010cdda0Smrg    # Setup a source with many dependencies, because some compilers
220010cdda0Smrg    # like to wrap large dependency lists on column 80 (with \), and
221010cdda0Smrg    # we should not choose a depcomp mode which is confused by this.
222010cdda0Smrg    #
223010cdda0Smrg    # We need to recreate these files for each test, as the compiler may
224010cdda0Smrg    # overwrite some of them when testing with obscure command lines.
225010cdda0Smrg    # This happens at least with the AIX C compiler.
226010cdda0Smrg    : > sub/conftest.c
227010cdda0Smrg    for i in 1 2 3 4 5 6; do
228010cdda0Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
229945aa7e3Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
230945aa7e3Smrg      # Solaris 10 /bin/sh.
231945aa7e3Smrg      echo '/* dummy */' > sub/conftst$i.h
232010cdda0Smrg    done
233010cdda0Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234010cdda0Smrg
235945aa7e3Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236b3eb03f3Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
237945aa7e3Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
238945aa7e3Smrg    # versions had trouble with output in subdirs.
239b3eb03f3Smrg    am__obj=sub/conftest.${OBJEXT-o}
240b3eb03f3Smrg    am__minus_obj="-o $am__obj"
241010cdda0Smrg    case $depmode in
242b3eb03f3Smrg    gcc)
243b3eb03f3Smrg      # This depmode causes a compiler race in universal mode.
244b3eb03f3Smrg      test "$am__universal" = false || continue
245b3eb03f3Smrg      ;;
246010cdda0Smrg    nosideeffect)
247945aa7e3Smrg      # After this tag, mechanisms are not by side-effect, so they'll
248945aa7e3Smrg      # only be used when explicitly requested.
249010cdda0Smrg      if test "x$enable_dependency_tracking" = xyes; then
250010cdda0Smrg	continue
251010cdda0Smrg      else
252010cdda0Smrg	break
253010cdda0Smrg      fi
254010cdda0Smrg      ;;
255b4485a66Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
256945aa7e3Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
257b3eb03f3Smrg      # not run yet.  These depmodes are late enough in the game, and
258b3eb03f3Smrg      # so weak that their functioning should not be impacted.
259b3eb03f3Smrg      am__obj=conftest.${OBJEXT-o}
260b3eb03f3Smrg      am__minus_obj=
261b3eb03f3Smrg      ;;
262010cdda0Smrg    none) break ;;
263010cdda0Smrg    esac
264010cdda0Smrg    if depmode=$depmode \
265b3eb03f3Smrg       source=sub/conftest.c object=$am__obj \
266010cdda0Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267b3eb03f3Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
268010cdda0Smrg         >/dev/null 2>conftest.err &&
269b3eb03f3Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
270010cdda0Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271b3eb03f3Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
272010cdda0Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
273010cdda0Smrg      # icc doesn't choke on unknown options, it will just issue warnings
274b3eb03f3Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
275b3eb03f3Smrg      # that says an option was ignored or not supported.
276b3eb03f3Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
277b3eb03f3Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
278b3eb03f3Smrg      # The diagnosis changed in icc 8.0:
279b3eb03f3Smrg      #   icc: Command line remark: option '-MP' not supported
280b3eb03f3Smrg      if (grep 'ignoring option' conftest.err ||
281b3eb03f3Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
282010cdda0Smrg        am_cv_$1_dependencies_compiler_type=$depmode
283010cdda0Smrg        break
284010cdda0Smrg      fi
285010cdda0Smrg    fi
286010cdda0Smrg  done
287010cdda0Smrg
288010cdda0Smrg  cd ..
289010cdda0Smrg  rm -rf conftest.dir
290010cdda0Smrgelse
291010cdda0Smrg  am_cv_$1_dependencies_compiler_type=none
292010cdda0Smrgfi
293010cdda0Smrg])
294010cdda0SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
295010cdda0SmrgAM_CONDITIONAL([am__fastdep$1], [
296010cdda0Smrg  test "x$enable_dependency_tracking" != xno \
297010cdda0Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298010cdda0Smrg])
299010cdda0Smrg
300010cdda0Smrg
301010cdda0Smrg# AM_SET_DEPDIR
302010cdda0Smrg# -------------
303010cdda0Smrg# Choose a directory name for dependency files.
304945aa7e3Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
305010cdda0SmrgAC_DEFUN([AM_SET_DEPDIR],
306010cdda0Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
307010cdda0SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
308010cdda0Smrg])
309010cdda0Smrg
310010cdda0Smrg
311010cdda0Smrg# AM_DEP_TRACK
312010cdda0Smrg# ------------
313010cdda0SmrgAC_DEFUN([AM_DEP_TRACK],
314945aa7e3Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
315945aa7e3SmrgAS_HELP_STRING(
316945aa7e3Smrg  [--enable-dependency-tracking],
317945aa7e3Smrg  [do not reject slow dependency extractors])
318945aa7e3SmrgAS_HELP_STRING(
319945aa7e3Smrg  [--disable-dependency-tracking],
320945aa7e3Smrg  [speeds up one-time build])])
321010cdda0Smrgif test "x$enable_dependency_tracking" != xno; then
322010cdda0Smrg  am_depcomp="$ac_aux_dir/depcomp"
323010cdda0Smrg  AMDEPBACKSLASH='\'
324b4485a66Smrg  am__nodep='_no'
325010cdda0Smrgfi
326b3eb03f3SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
327b3eb03f3SmrgAC_SUBST([AMDEPBACKSLASH])dnl
328b3eb03f3Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
329b4485a66SmrgAC_SUBST([am__nodep])dnl
330b4485a66Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
331b3eb03f3Smrg])
332b3eb03f3Smrg
333b3eb03f3Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334b3eb03f3Smrg
335945aa7e3Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
336b3eb03f3Smrg#
337b3eb03f3Smrg# This file is free software; the Free Software Foundation
338b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
339b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
340b3eb03f3Smrg
341b3eb03f3Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
342b3eb03f3Smrg# ------------------------------
343b3eb03f3SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
344b3eb03f3Smrg[{
345945aa7e3Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
346b3eb03f3Smrg  # are listed without --file.  Let's play safe and only enable the eval
347b3eb03f3Smrg  # if we detect the quoting.
348945aa7e3Smrg  # TODO: see whether this extra hack can be removed once we start
349945aa7e3Smrg  # requiring Autoconf 2.70 or later.
350945aa7e3Smrg  AS_CASE([$CONFIG_FILES],
351945aa7e3Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
352945aa7e3Smrg          [*], [set x $CONFIG_FILES])
353b3eb03f3Smrg  shift
354945aa7e3Smrg  # Used to flag and report bootstrapping failures.
355945aa7e3Smrg  am_rc=0
356945aa7e3Smrg  for am_mf
357b3eb03f3Smrg  do
358b3eb03f3Smrg    # Strip MF so we end up with the name of the file.
359945aa7e3Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
360945aa7e3Smrg    # Check whether this is an Automake generated Makefile which includes
361945aa7e3Smrg    # dependency-tracking related rules and includes.
362945aa7e3Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
363b3eb03f3Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
364945aa7e3Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
365945aa7e3Smrg      || continue
366945aa7e3Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
367945aa7e3Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
368945aa7e3Smrg    AM_RUN_LOG([cd "$am_dirpart" \
369945aa7e3Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
370945aa7e3Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
371b3eb03f3Smrg  done
372945aa7e3Smrg  if test $am_rc -ne 0; then
373945aa7e3Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
374945aa7e3Smrg    for automatic dependency tracking.  If GNU make was not used, consider
375945aa7e3Smrg    re-running the configure script with MAKE="gmake" (or whatever is
376945aa7e3Smrg    necessary).  You can also try re-running configure with the
377945aa7e3Smrg    '--disable-dependency-tracking' option to at least be able to build
378945aa7e3Smrg    the package (albeit without support for automatic dependency tracking).])
379945aa7e3Smrg  fi
380945aa7e3Smrg  AS_UNSET([am_dirpart])
381945aa7e3Smrg  AS_UNSET([am_filepart])
382945aa7e3Smrg  AS_UNSET([am_mf])
383945aa7e3Smrg  AS_UNSET([am_rc])
384945aa7e3Smrg  rm -f conftest-deps.mk
385b3eb03f3Smrg}
386b3eb03f3Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387b3eb03f3Smrg
388b3eb03f3Smrg
389b3eb03f3Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
390b3eb03f3Smrg# -----------------------------
391b3eb03f3Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
392b3eb03f3Smrg#
393945aa7e3Smrg# This code is only required when automatic dependency tracking is enabled.
394945aa7e3Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
395945aa7e3Smrg# order to bootstrap the dependency handling code.
396b3eb03f3SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
397b3eb03f3Smrg[AC_CONFIG_COMMANDS([depfiles],
398b3eb03f3Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
399945aa7e3Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400b3eb03f3Smrg
401b3eb03f3Smrg# Do all the work for Automake.                             -*- Autoconf -*-
402b3eb03f3Smrg
403945aa7e3Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
404b3eb03f3Smrg#
405b3eb03f3Smrg# This file is free software; the Free Software Foundation
406b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
407b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
408b3eb03f3Smrg
409b3eb03f3Smrg# This macro actually does too much.  Some checks are only needed if
410b3eb03f3Smrg# your package does certain things.  But this isn't really a big deal.
411b3eb03f3Smrg
412945aa7e3Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
413945aa7e3Smrgm4_define([AC_PROG_CC],
414945aa7e3Smrgm4_defn([AC_PROG_CC])
415945aa7e3Smrg[_AM_PROG_CC_C_O
416945aa7e3Smrg])
417945aa7e3Smrg
418b3eb03f3Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
419b3eb03f3Smrg# AM_INIT_AUTOMAKE([OPTIONS])
420b3eb03f3Smrg# -----------------------------------------------
421b3eb03f3Smrg# The call with PACKAGE and VERSION arguments is the old style
422b3eb03f3Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
423b3eb03f3Smrg# and VERSION should now be passed to AC_INIT and removed from
424b3eb03f3Smrg# the call to AM_INIT_AUTOMAKE.
425b3eb03f3Smrg# We support both call styles for the transition.  After
426b3eb03f3Smrg# the next Automake release, Autoconf can make the AC_INIT
427b3eb03f3Smrg# arguments mandatory, and then we can depend on a new Autoconf
428b3eb03f3Smrg# release and drop the old call support.
429b3eb03f3SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
430945aa7e3Smrg[AC_PREREQ([2.65])dnl
431945aa7e3Smrgm4_ifdef([_$0_ALREADY_INIT],
432945aa7e3Smrg  [m4_fatal([$0 expanded multiple times
433945aa7e3Smrg]m4_defn([_$0_ALREADY_INIT]))],
434945aa7e3Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
435b3eb03f3Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
436b3eb03f3Smrgdnl the ones we care about.
437b3eb03f3Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
438b3eb03f3SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
439b3eb03f3SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
440b3eb03f3Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
441b3eb03f3Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
442b3eb03f3Smrg  # is not polluted with repeated "-I."
443b3eb03f3Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
444b3eb03f3Smrg  # test to see if srcdir already configured
445b3eb03f3Smrg  if test -f $srcdir/config.status; then
446b3eb03f3Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
447b3eb03f3Smrg  fi
448b3eb03f3Smrgfi
449b3eb03f3Smrg
450b3eb03f3Smrg# test whether we have cygpath
451b3eb03f3Smrgif test -z "$CYGPATH_W"; then
452b3eb03f3Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
453b3eb03f3Smrg    CYGPATH_W='cygpath -w'
454b3eb03f3Smrg  else
455b3eb03f3Smrg    CYGPATH_W=echo
456b3eb03f3Smrg  fi
457b3eb03f3Smrgfi
458b3eb03f3SmrgAC_SUBST([CYGPATH_W])
459b3eb03f3Smrg
460b3eb03f3Smrg# Define the identity of the package.
461b3eb03f3Smrgdnl Distinguish between old-style and new-style calls.
462b3eb03f3Smrgm4_ifval([$2],
463945aa7e3Smrg[AC_DIAGNOSE([obsolete],
464945aa7e3Smrg             [$0: two- and three-arguments forms are deprecated.])
465945aa7e3Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
466b3eb03f3Smrg AC_SUBST([PACKAGE], [$1])dnl
467b3eb03f3Smrg AC_SUBST([VERSION], [$2])],
468b3eb03f3Smrg[_AM_SET_OPTIONS([$1])dnl
469b3eb03f3Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
470945aa7e3Smrgm4_if(
471945aa7e3Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
472945aa7e3Smrg  [ok:ok],,
473b3eb03f3Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
474b3eb03f3Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
475b3eb03f3Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476b3eb03f3Smrg
477b3eb03f3Smrg_AM_IF_OPTION([no-define],,
478945aa7e3Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
479945aa7e3Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480b3eb03f3Smrg
481b3eb03f3Smrg# Some tools Automake needs.
482b3eb03f3SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
483b3eb03f3SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
484945aa7e3SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
485945aa7e3SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
486945aa7e3SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
487945aa7e3SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
488945aa7e3SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
489b3eb03f3SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
490b3eb03f3SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
491945aa7e3SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
492945aa7e3Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
493945aa7e3Smrg# dies out for good.  For more background, see:
494945aa7e3Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
495945aa7e3Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
496945aa7e3SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
497945aa7e3Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
498945aa7e3Smrg# system "awk" is bad on some platforms.
499b3eb03f3SmrgAC_REQUIRE([AC_PROG_AWK])dnl
500b3eb03f3SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
501b3eb03f3SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
502b3eb03f3Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
503b3eb03f3Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
504b3eb03f3Smrg			     [_AM_PROG_TAR([v7])])])
505b3eb03f3Smrg_AM_IF_OPTION([no-dependencies],,
506b3eb03f3Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
507945aa7e3Smrg		  [_AM_DEPENDENCIES([CC])],
508945aa7e3Smrg		  [m4_define([AC_PROG_CC],
509945aa7e3Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
510b3eb03f3SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
511945aa7e3Smrg		  [_AM_DEPENDENCIES([CXX])],
512945aa7e3Smrg		  [m4_define([AC_PROG_CXX],
513945aa7e3Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
514b3eb03f3SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
515945aa7e3Smrg		  [_AM_DEPENDENCIES([OBJC])],
516945aa7e3Smrg		  [m4_define([AC_PROG_OBJC],
517945aa7e3Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
518945aa7e3SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
519945aa7e3Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
520945aa7e3Smrg		  [m4_define([AC_PROG_OBJCXX],
521945aa7e3Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
522b3eb03f3Smrg])
523945aa7e3Smrg# Variables for tags utilities; see am/tags.am
524945aa7e3Smrgif test -z "$CTAGS"; then
525945aa7e3Smrg  CTAGS=ctags
526945aa7e3Smrgfi
527945aa7e3SmrgAC_SUBST([CTAGS])
528945aa7e3Smrgif test -z "$ETAGS"; then
529945aa7e3Smrg  ETAGS=etags
530945aa7e3Smrgfi
531945aa7e3SmrgAC_SUBST([ETAGS])
532945aa7e3Smrgif test -z "$CSCOPE"; then
533945aa7e3Smrg  CSCOPE=cscope
534945aa7e3Smrgfi
535945aa7e3SmrgAC_SUBST([CSCOPE])
536945aa7e3Smrg
537945aa7e3SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
538945aa7e3Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
539945aa7e3Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
540945aa7e3Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
541b3eb03f3SmrgAC_CONFIG_COMMANDS_PRE(dnl
542b3eb03f3Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
543b3eb03f3Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
544945aa7e3Smrg
545945aa7e3Smrg# POSIX will say in a future version that running "rm -f" with no argument
546945aa7e3Smrg# is OK; and we want to be able to make that assumption in our Makefile
547945aa7e3Smrg# recipes.  So use an aggressive probe to check that the usage we want is
548945aa7e3Smrg# actually supported "in the wild" to an acceptable degree.
549945aa7e3Smrg# See automake bug#10828.
550945aa7e3Smrg# To make any issue more visible, cause the running configure to be aborted
551945aa7e3Smrg# by default if the 'rm' program in use doesn't match our expectations; the
552945aa7e3Smrg# user can still override this though.
553945aa7e3Smrgif rm -f && rm -fr && rm -rf; then : OK; else
554945aa7e3Smrg  cat >&2 <<'END'
555945aa7e3SmrgOops!
556945aa7e3Smrg
557945aa7e3SmrgYour 'rm' program seems unable to run without file operands specified
558945aa7e3Smrgon the command line, even when the '-f' option is present.  This is contrary
559945aa7e3Smrgto the behaviour of most rm programs out there, and not conforming with
560945aa7e3Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
561945aa7e3Smrg
562945aa7e3SmrgPlease tell bug-automake@gnu.org about your system, including the value
563945aa7e3Smrgof your $PATH and any error possibly output before this message.  This
564945aa7e3Smrgcan help us improve future automake versions.
565945aa7e3Smrg
566945aa7e3SmrgEND
567945aa7e3Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
568945aa7e3Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
569945aa7e3Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
570945aa7e3Smrg    echo >&2
571945aa7e3Smrg  else
572945aa7e3Smrg    cat >&2 <<'END'
573945aa7e3SmrgAborting the configuration process, to ensure you take notice of the issue.
574945aa7e3Smrg
575945aa7e3SmrgYou can download and install GNU coreutils to get an 'rm' implementation
576945aa7e3Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
577945aa7e3Smrg
578945aa7e3SmrgIf you want to complete the configuration process using your problematic
579945aa7e3Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
580945aa7e3Smrgto "yes", and re-run configure.
581945aa7e3Smrg
582945aa7e3SmrgEND
583945aa7e3Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
584945aa7e3Smrg  fi
585945aa7e3Smrgfi
586945aa7e3Smrgdnl The trailing newline in this macro's definition is deliberate, for
587945aa7e3Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
588945aa7e3Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
589b3eb03f3Smrg])
590b3eb03f3Smrg
591945aa7e3Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
592b3eb03f3Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
593b3eb03f3Smrgdnl mangled by Autoconf and run in a shell conditional statement.
594b3eb03f3Smrgm4_define([_AC_COMPILER_EXEEXT],
595b3eb03f3Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
596b3eb03f3Smrg
597b3eb03f3Smrg# When config.status generates a header, we must update the stamp-h file.
598b3eb03f3Smrg# This file resides in the same directory as the config header
599b3eb03f3Smrg# that is generated.  The stamp files are numbered to have different names.
600b3eb03f3Smrg
601b3eb03f3Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
602b3eb03f3Smrg# loop where config.status creates the headers, so we can generate
603b3eb03f3Smrg# our stamp files there.
604b3eb03f3SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
605b3eb03f3Smrg[# Compute $1's index in $config_headers.
606b3eb03f3Smrg_am_arg=$1
607b3eb03f3Smrg_am_stamp_count=1
608b3eb03f3Smrgfor _am_header in $config_headers :; do
609b3eb03f3Smrg  case $_am_header in
610b3eb03f3Smrg    $_am_arg | $_am_arg:* )
611b3eb03f3Smrg      break ;;
612b3eb03f3Smrg    * )
613b3eb03f3Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
614b3eb03f3Smrg  esac
615b3eb03f3Smrgdone
616b3eb03f3Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
617b3eb03f3Smrg
618945aa7e3Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
619b3eb03f3Smrg#
620b3eb03f3Smrg# This file is free software; the Free Software Foundation
621b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
622b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
623b3eb03f3Smrg
624b3eb03f3Smrg# AM_PROG_INSTALL_SH
625b3eb03f3Smrg# ------------------
626b3eb03f3Smrg# Define $install_sh.
627b3eb03f3SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
628b3eb03f3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
629945aa7e3Smrgif test x"${install_sh+set}" != xset; then
630b3eb03f3Smrg  case $am_aux_dir in
631b3eb03f3Smrg  *\ * | *\	*)
632b3eb03f3Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
633b3eb03f3Smrg  *)
634b3eb03f3Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
635b3eb03f3Smrg  esac
636b3eb03f3Smrgfi
637945aa7e3SmrgAC_SUBST([install_sh])])
638b3eb03f3Smrg
639945aa7e3Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
640b3eb03f3Smrg#
641b3eb03f3Smrg# This file is free software; the Free Software Foundation
642b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
643b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
644b3eb03f3Smrg
645b3eb03f3Smrg# Check whether the underlying file-system supports filenames
646b3eb03f3Smrg# with a leading dot.  For instance MS-DOS doesn't.
647b3eb03f3SmrgAC_DEFUN([AM_SET_LEADING_DOT],
648b3eb03f3Smrg[rm -rf .tst 2>/dev/null
649b3eb03f3Smrgmkdir .tst 2>/dev/null
650b3eb03f3Smrgif test -d .tst; then
651b3eb03f3Smrg  am__leading_dot=.
652b3eb03f3Smrgelse
653b3eb03f3Smrg  am__leading_dot=_
654b3eb03f3Smrgfi
655b3eb03f3Smrgrmdir .tst 2>/dev/null
656b3eb03f3SmrgAC_SUBST([am__leading_dot])])
657b3eb03f3Smrg
658b3eb03f3Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
659b3eb03f3Smrg
660945aa7e3Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
661b3eb03f3Smrg#
662b3eb03f3Smrg# This file is free software; the Free Software Foundation
663b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
664b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
665b3eb03f3Smrg
666b3eb03f3Smrg# AM_MAKE_INCLUDE()
667b3eb03f3Smrg# -----------------
668945aa7e3Smrg# Check whether make has an 'include' directive that can support all
669945aa7e3Smrg# the idioms we need for our automatic dependency tracking code.
670b3eb03f3SmrgAC_DEFUN([AM_MAKE_INCLUDE],
671945aa7e3Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
672945aa7e3Smrgcat > confinc.mk << 'END'
673b3eb03f3Smrgam__doit:
674945aa7e3Smrg	@echo this is the am__doit target >confinc.out
675b3eb03f3Smrg.PHONY: am__doit
676b3eb03f3SmrgEND
677b3eb03f3Smrgam__include="#"
678b3eb03f3Smrgam__quote=
679945aa7e3Smrg# BSD make does it like this.
680945aa7e3Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
681945aa7e3Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
682945aa7e3Smrgecho 'include confinc.mk # ignored' > confmf.GNU
683945aa7e3Smrg_am_result=no
684945aa7e3Smrgfor s in GNU BSD; do
685945aa7e3Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
686945aa7e3Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
687945aa7e3Smrg      ['0:this is the am__doit target'],
688945aa7e3Smrg      [AS_CASE([$s],
689945aa7e3Smrg          [BSD], [am__include='.include' am__quote='"'],
690945aa7e3Smrg          [am__include='include' am__quote=''])])
691945aa7e3Smrg  if test "$am__include" != "#"; then
692945aa7e3Smrg    _am_result="yes ($s style)"
693945aa7e3Smrg    break
694945aa7e3Smrg  fi
695945aa7e3Smrgdone
696945aa7e3Smrgrm -f confinc.* confmf.*
697945aa7e3SmrgAC_MSG_RESULT([${_am_result}])
698945aa7e3SmrgAC_SUBST([am__include])])
699945aa7e3SmrgAC_SUBST([am__quote])])
700b3eb03f3Smrg
701b3eb03f3Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
702b3eb03f3Smrg
703945aa7e3Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
704b3eb03f3Smrg#
705b3eb03f3Smrg# This file is free software; the Free Software Foundation
706b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
707b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
708b3eb03f3Smrg
709b3eb03f3Smrg# AM_MISSING_PROG(NAME, PROGRAM)
710b3eb03f3Smrg# ------------------------------
711b3eb03f3SmrgAC_DEFUN([AM_MISSING_PROG],
712b3eb03f3Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
713b3eb03f3Smrg$1=${$1-"${am_missing_run}$2"}
714b3eb03f3SmrgAC_SUBST($1)])
715b3eb03f3Smrg
716b3eb03f3Smrg# AM_MISSING_HAS_RUN
717b3eb03f3Smrg# ------------------
718945aa7e3Smrg# Define MISSING if not defined so far and test if it is modern enough.
719945aa7e3Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
720b3eb03f3SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
721b3eb03f3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
722b3eb03f3SmrgAC_REQUIRE_AUX_FILE([missing])dnl
723b3eb03f3Smrgif test x"${MISSING+set}" != xset; then
724945aa7e3Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
725b3eb03f3Smrgfi
726b3eb03f3Smrg# Use eval to expand $SHELL
727945aa7e3Smrgif eval "$MISSING --is-lightweight"; then
728945aa7e3Smrg  am_missing_run="$MISSING "
729b3eb03f3Smrgelse
730b3eb03f3Smrg  am_missing_run=
731945aa7e3Smrg  AC_MSG_WARN(['missing' script is too old or missing])
732b3eb03f3Smrgfi
733b3eb03f3Smrg])
734b3eb03f3Smrg
735b3eb03f3Smrg# Helper functions for option handling.                     -*- Autoconf -*-
736b3eb03f3Smrg
737945aa7e3Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
738b3eb03f3Smrg#
739b3eb03f3Smrg# This file is free software; the Free Software Foundation
740b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
741b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
742b3eb03f3Smrg
743b3eb03f3Smrg# _AM_MANGLE_OPTION(NAME)
744b3eb03f3Smrg# -----------------------
745b3eb03f3SmrgAC_DEFUN([_AM_MANGLE_OPTION],
746b3eb03f3Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
747b3eb03f3Smrg
748b3eb03f3Smrg# _AM_SET_OPTION(NAME)
749b4485a66Smrg# --------------------
750b3eb03f3Smrg# Set option NAME.  Presently that only means defining a flag for this option.
751b3eb03f3SmrgAC_DEFUN([_AM_SET_OPTION],
752945aa7e3Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
753b3eb03f3Smrg
754b3eb03f3Smrg# _AM_SET_OPTIONS(OPTIONS)
755b4485a66Smrg# ------------------------
756b3eb03f3Smrg# OPTIONS is a space-separated list of Automake options.
757b3eb03f3SmrgAC_DEFUN([_AM_SET_OPTIONS],
758b3eb03f3Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
759b3eb03f3Smrg
760b3eb03f3Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
761b3eb03f3Smrg# -------------------------------------------
762b3eb03f3Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
763b3eb03f3SmrgAC_DEFUN([_AM_IF_OPTION],
764b3eb03f3Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
765b3eb03f3Smrg
766945aa7e3Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
767945aa7e3Smrg#
768945aa7e3Smrg# This file is free software; the Free Software Foundation
769945aa7e3Smrg# gives unlimited permission to copy and/or distribute it,
770945aa7e3Smrg# with or without modifications, as long as this notice is preserved.
771945aa7e3Smrg
772945aa7e3Smrg# _AM_PROG_CC_C_O
773945aa7e3Smrg# ---------------
774945aa7e3Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
775945aa7e3Smrg# to automatically call this.
776945aa7e3SmrgAC_DEFUN([_AM_PROG_CC_C_O],
777945aa7e3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
778945aa7e3SmrgAC_REQUIRE_AUX_FILE([compile])dnl
779945aa7e3SmrgAC_LANG_PUSH([C])dnl
780945aa7e3SmrgAC_CACHE_CHECK(
781945aa7e3Smrg  [whether $CC understands -c and -o together],
782945aa7e3Smrg  [am_cv_prog_cc_c_o],
783945aa7e3Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
784945aa7e3Smrg  # Make sure it works both with $CC and with simple cc.
785945aa7e3Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
786945aa7e3Smrg  # compilers refuse to overwrite an existing .o file with -o,
787945aa7e3Smrg  # though they will create one.
788945aa7e3Smrg  am_cv_prog_cc_c_o=yes
789945aa7e3Smrg  for am_i in 1 2; do
790945aa7e3Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
791945aa7e3Smrg         && test -f conftest2.$ac_objext; then
792945aa7e3Smrg      : OK
793945aa7e3Smrg    else
794945aa7e3Smrg      am_cv_prog_cc_c_o=no
795945aa7e3Smrg      break
796945aa7e3Smrg    fi
797945aa7e3Smrg  done
798945aa7e3Smrg  rm -f core conftest*
799945aa7e3Smrg  unset am_i])
800945aa7e3Smrgif test "$am_cv_prog_cc_c_o" != yes; then
801945aa7e3Smrg   # Losing compiler, so override with the script.
802945aa7e3Smrg   # FIXME: It is wrong to rewrite CC.
803945aa7e3Smrg   # But if we don't then we get into trouble of one sort or another.
804945aa7e3Smrg   # A longer-term fix would be to have automake use am__CC in this case,
805945aa7e3Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
806945aa7e3Smrg   CC="$am_aux_dir/compile $CC"
807945aa7e3Smrgfi
808945aa7e3SmrgAC_LANG_POP([C])])
809b3eb03f3Smrg
810945aa7e3Smrg# For backward compatibility.
811945aa7e3SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
812945aa7e3Smrg
813945aa7e3Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
814b3eb03f3Smrg#
815b3eb03f3Smrg# This file is free software; the Free Software Foundation
816b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
817b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
818b3eb03f3Smrg
819945aa7e3Smrg# AM_RUN_LOG(COMMAND)
820945aa7e3Smrg# -------------------
821945aa7e3Smrg# Run COMMAND, save the exit status in ac_status, and log it.
822945aa7e3Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
823945aa7e3SmrgAC_DEFUN([AM_RUN_LOG],
824945aa7e3Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
825945aa7e3Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
826945aa7e3Smrg   ac_status=$?
827945aa7e3Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
828945aa7e3Smrg   (exit $ac_status); }])
829945aa7e3Smrg
830945aa7e3Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
831945aa7e3Smrg
832945aa7e3Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
833945aa7e3Smrg#
834945aa7e3Smrg# This file is free software; the Free Software Foundation
835945aa7e3Smrg# gives unlimited permission to copy and/or distribute it,
836945aa7e3Smrg# with or without modifications, as long as this notice is preserved.
837b3eb03f3Smrg
838b3eb03f3Smrg# AM_SANITY_CHECK
839b3eb03f3Smrg# ---------------
840b3eb03f3SmrgAC_DEFUN([AM_SANITY_CHECK],
841b3eb03f3Smrg[AC_MSG_CHECKING([whether build environment is sane])
842b3eb03f3Smrg# Reject unsafe characters in $srcdir or the absolute working directory
843b3eb03f3Smrg# name.  Accept space and tab only in the latter.
844b3eb03f3Smrgam_lf='
845b3eb03f3Smrg'
846b3eb03f3Smrgcase `pwd` in
847b3eb03f3Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
848b3eb03f3Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
849b3eb03f3Smrgesac
850b3eb03f3Smrgcase $srcdir in
851b3eb03f3Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
852945aa7e3Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
853b3eb03f3Smrgesac
854b3eb03f3Smrg
855945aa7e3Smrg# Do 'set' in a subshell so we don't clobber the current shell's
856b3eb03f3Smrg# arguments.  Must try -L first in case configure is actually a
857b3eb03f3Smrg# symlink; some systems play weird games with the mod time of symlinks
858b3eb03f3Smrg# (eg FreeBSD returns the mod time of the symlink's containing
859b3eb03f3Smrg# directory).
860b3eb03f3Smrgif (
861945aa7e3Smrg   am_has_slept=no
862945aa7e3Smrg   for am_try in 1 2; do
863945aa7e3Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
864945aa7e3Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
865945aa7e3Smrg     if test "$[*]" = "X"; then
866945aa7e3Smrg	# -L didn't work.
867945aa7e3Smrg	set X `ls -t "$srcdir/configure" conftest.file`
868945aa7e3Smrg     fi
869945aa7e3Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
870945aa7e3Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
871945aa7e3Smrg
872945aa7e3Smrg	# If neither matched, then we have a broken ls.  This can happen
873945aa7e3Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
874945aa7e3Smrg	# broken ls alias from the environment.  This has actually
875945aa7e3Smrg	# happened.  Such a system could not be considered "sane".
876945aa7e3Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
877945aa7e3Smrg  alias in your environment])
878945aa7e3Smrg     fi
879945aa7e3Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
880945aa7e3Smrg       break
881945aa7e3Smrg     fi
882945aa7e3Smrg     # Just in case.
883945aa7e3Smrg     sleep 1
884945aa7e3Smrg     am_has_slept=yes
885945aa7e3Smrg   done
886b3eb03f3Smrg   test "$[2]" = conftest.file
887b3eb03f3Smrg   )
888b3eb03f3Smrgthen
889b3eb03f3Smrg   # Ok.
890b3eb03f3Smrg   :
891b3eb03f3Smrgelse
892b3eb03f3Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
893b3eb03f3SmrgCheck your system clock])
894b3eb03f3Smrgfi
895945aa7e3SmrgAC_MSG_RESULT([yes])
896945aa7e3Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
897945aa7e3Smrg# generated files are strictly newer.
898945aa7e3Smrgam_sleep_pid=
899945aa7e3Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
900945aa7e3Smrg  ( sleep 1 ) &
901945aa7e3Smrg  am_sleep_pid=$!
902945aa7e3Smrgfi
903945aa7e3SmrgAC_CONFIG_COMMANDS_PRE(
904945aa7e3Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
905945aa7e3Smrg   if test -n "$am_sleep_pid"; then
906945aa7e3Smrg     # Hide warnings about reused PIDs.
907945aa7e3Smrg     wait $am_sleep_pid 2>/dev/null
908945aa7e3Smrg   fi
909945aa7e3Smrg   AC_MSG_RESULT([done])])
910945aa7e3Smrgrm -f conftest.file
911945aa7e3Smrg])
912b3eb03f3Smrg
913945aa7e3Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
914b3eb03f3Smrg#
915b3eb03f3Smrg# This file is free software; the Free Software Foundation
916b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
917b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
918b3eb03f3Smrg
919b3eb03f3Smrg# AM_SILENT_RULES([DEFAULT])
920b3eb03f3Smrg# --------------------------
921b3eb03f3Smrg# Enable less verbose build rules; with the default set to DEFAULT
922945aa7e3Smrg# ("yes" being less verbose, "no" or empty being verbose).
923b3eb03f3SmrgAC_DEFUN([AM_SILENT_RULES],
924945aa7e3Smrg[AC_ARG_ENABLE([silent-rules], [dnl
925945aa7e3SmrgAS_HELP_STRING(
926945aa7e3Smrg  [--enable-silent-rules],
927945aa7e3Smrg  [less verbose build output (undo: "make V=1")])
928945aa7e3SmrgAS_HELP_STRING(
929945aa7e3Smrg  [--disable-silent-rules],
930945aa7e3Smrg  [verbose build output (undo: "make V=0")])dnl
931945aa7e3Smrg])
932945aa7e3Smrgcase $enable_silent_rules in @%:@ (((
933945aa7e3Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
934945aa7e3Smrg   no) AM_DEFAULT_VERBOSITY=1;;
935945aa7e3Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
936b3eb03f3Smrgesac
937945aa7e3Smrgdnl
938945aa7e3Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
939945aa7e3Smrgdnl do not support nested variable expansions.
940945aa7e3Smrgdnl See automake bug#9928 and bug#10237.
941945aa7e3Smrgam_make=${MAKE-make}
942945aa7e3SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
943945aa7e3Smrg   [am_cv_make_support_nested_variables],
944945aa7e3Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
945945aa7e3SmrgBAR0=false
946945aa7e3SmrgBAR1=true
947945aa7e3SmrgV=1
948945aa7e3Smrgam__doit:
949945aa7e3Smrg	@$(TRUE)
950945aa7e3Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
951945aa7e3Smrg  am_cv_make_support_nested_variables=yes
952945aa7e3Smrgelse
953945aa7e3Smrg  am_cv_make_support_nested_variables=no
954945aa7e3Smrgfi])
955945aa7e3Smrgif test $am_cv_make_support_nested_variables = yes; then
956945aa7e3Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
957945aa7e3Smrg  AM_V='$(V)'
958945aa7e3Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
959945aa7e3Smrgelse
960945aa7e3Smrg  AM_V=$AM_DEFAULT_VERBOSITY
961945aa7e3Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
962945aa7e3Smrgfi
963945aa7e3SmrgAC_SUBST([AM_V])dnl
964945aa7e3SmrgAM_SUBST_NOTMAKE([AM_V])dnl
965945aa7e3SmrgAC_SUBST([AM_DEFAULT_V])dnl
966945aa7e3SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
967b3eb03f3SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
968b3eb03f3SmrgAM_BACKSLASH='\'
969b3eb03f3SmrgAC_SUBST([AM_BACKSLASH])dnl
970b3eb03f3Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
971b3eb03f3Smrg])
972b3eb03f3Smrg
973945aa7e3Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
974b3eb03f3Smrg#
975b3eb03f3Smrg# This file is free software; the Free Software Foundation
976b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
977b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
978b3eb03f3Smrg
979b3eb03f3Smrg# AM_PROG_INSTALL_STRIP
980b3eb03f3Smrg# ---------------------
981945aa7e3Smrg# One issue with vendor 'install' (even GNU) is that you can't
982b3eb03f3Smrg# specify the program used to strip binaries.  This is especially
983b3eb03f3Smrg# annoying in cross-compiling environments, where the build's strip
984b3eb03f3Smrg# is unlikely to handle the host's binaries.
985b3eb03f3Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
986945aa7e3Smrg# always use install-sh in "make install-strip", and initialize
987b3eb03f3Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
988b3eb03f3SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
989b3eb03f3Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
990945aa7e3Smrg# Installed binaries are usually stripped using 'strip' when the user
991945aa7e3Smrg# run "make install-strip".  However 'strip' might not be the right
992b3eb03f3Smrg# tool to use in cross-compilation environments, therefore Automake
993945aa7e3Smrg# will honor the 'STRIP' environment variable to overrule this program.
994945aa7e3Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
995b3eb03f3Smrgif test "$cross_compiling" != no; then
996b3eb03f3Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
997b3eb03f3Smrgfi
998b3eb03f3SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
999b3eb03f3SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1000b3eb03f3Smrg
1001945aa7e3Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
1002b3eb03f3Smrg#
1003b3eb03f3Smrg# This file is free software; the Free Software Foundation
1004b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
1005b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
1006b3eb03f3Smrg
1007b3eb03f3Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
1008b3eb03f3Smrg# ---------------------------
1009b3eb03f3Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1010b3eb03f3Smrg# This macro is traced by Automake.
1011b3eb03f3SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1012b3eb03f3Smrg
1013b3eb03f3Smrg# AM_SUBST_NOTMAKE(VARIABLE)
1014b4485a66Smrg# --------------------------
1015b3eb03f3Smrg# Public sister of _AM_SUBST_NOTMAKE.
1016b3eb03f3SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1017b3eb03f3Smrg
1018b3eb03f3Smrg# Check how to create a tarball.                            -*- Autoconf -*-
1019b3eb03f3Smrg
1020945aa7e3Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
1021b3eb03f3Smrg#
1022b3eb03f3Smrg# This file is free software; the Free Software Foundation
1023b3eb03f3Smrg# gives unlimited permission to copy and/or distribute it,
1024b3eb03f3Smrg# with or without modifications, as long as this notice is preserved.
1025b3eb03f3Smrg
1026b3eb03f3Smrg# _AM_PROG_TAR(FORMAT)
1027b3eb03f3Smrg# --------------------
1028b3eb03f3Smrg# Check how to create a tarball in format FORMAT.
1029945aa7e3Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1030b3eb03f3Smrg#
1031b3eb03f3Smrg# Substitute a variable $(am__tar) that is a command
1032b3eb03f3Smrg# writing to stdout a FORMAT-tarball containing the directory
1033b3eb03f3Smrg# $tardir.
1034b3eb03f3Smrg#     tardir=directory && $(am__tar) > result.tar
1035b3eb03f3Smrg#
1036b3eb03f3Smrg# Substitute a variable $(am__untar) that extract such
1037b3eb03f3Smrg# a tarball read from stdin.
1038b3eb03f3Smrg#     $(am__untar) < result.tar
1039945aa7e3Smrg#
1040b3eb03f3SmrgAC_DEFUN([_AM_PROG_TAR],
1041945aa7e3Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1042945aa7e3Smrg# in the wild :-(  We should find a proper way to deprecate it ...
1043945aa7e3SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1044945aa7e3Smrg
1045945aa7e3Smrg# We'll loop over all known methods to create a tar archive until one works.
1046b3eb03f3Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1047b3eb03f3Smrg
1048945aa7e3Smrgm4_if([$1], [v7],
1049945aa7e3Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1050945aa7e3Smrg
1051945aa7e3Smrg  [m4_case([$1],
1052945aa7e3Smrg    [ustar],
1053945aa7e3Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1054945aa7e3Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1055945aa7e3Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1056945aa7e3Smrg      # and bug#13588).
1057945aa7e3Smrg      am_max_uid=2097151 # 2^21 - 1
1058945aa7e3Smrg      am_max_gid=$am_max_uid
1059945aa7e3Smrg      # The $UID and $GID variables are not portable, so we need to resort
1060945aa7e3Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1061945aa7e3Smrg      # below are definitely unexpected, so allow the users to see them
1062945aa7e3Smrg      # (that is, avoid stderr redirection).
1063945aa7e3Smrg      am_uid=`id -u || echo unknown`
1064945aa7e3Smrg      am_gid=`id -g || echo unknown`
1065945aa7e3Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1066945aa7e3Smrg      if test $am_uid -le $am_max_uid; then
1067945aa7e3Smrg         AC_MSG_RESULT([yes])
1068945aa7e3Smrg      else
1069945aa7e3Smrg         AC_MSG_RESULT([no])
1070945aa7e3Smrg         _am_tools=none
1071945aa7e3Smrg      fi
1072945aa7e3Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1073945aa7e3Smrg      if test $am_gid -le $am_max_gid; then
1074945aa7e3Smrg         AC_MSG_RESULT([yes])
1075945aa7e3Smrg      else
1076945aa7e3Smrg        AC_MSG_RESULT([no])
1077945aa7e3Smrg        _am_tools=none
1078945aa7e3Smrg      fi],
1079945aa7e3Smrg
1080945aa7e3Smrg  [pax],
1081945aa7e3Smrg    [],
1082945aa7e3Smrg
1083945aa7e3Smrg  [m4_fatal([Unknown tar format])])
1084945aa7e3Smrg
1085945aa7e3Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1086945aa7e3Smrg
1087945aa7e3Smrg  # Go ahead even if we have the value already cached.  We do so because we
1088945aa7e3Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1089945aa7e3Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1090945aa7e3Smrg
1091945aa7e3Smrg  for _am_tool in $_am_tools; do
1092945aa7e3Smrg    case $_am_tool in
1093945aa7e3Smrg    gnutar)
1094945aa7e3Smrg      for _am_tar in tar gnutar gtar; do
1095945aa7e3Smrg        AM_RUN_LOG([$_am_tar --version]) && break
1096945aa7e3Smrg      done
1097945aa7e3Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1098945aa7e3Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1099945aa7e3Smrg      am__untar="$_am_tar -xf -"
1100945aa7e3Smrg      ;;
1101945aa7e3Smrg    plaintar)
1102945aa7e3Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1103945aa7e3Smrg      # ustar tarball either.
1104945aa7e3Smrg      (tar --version) >/dev/null 2>&1 && continue
1105945aa7e3Smrg      am__tar='tar chf - "$$tardir"'
1106945aa7e3Smrg      am__tar_='tar chf - "$tardir"'
1107945aa7e3Smrg      am__untar='tar xf -'
1108945aa7e3Smrg      ;;
1109945aa7e3Smrg    pax)
1110945aa7e3Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
1111945aa7e3Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
1112945aa7e3Smrg      am__untar='pax -r'
1113945aa7e3Smrg      ;;
1114945aa7e3Smrg    cpio)
1115945aa7e3Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1116945aa7e3Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1117945aa7e3Smrg      am__untar='cpio -i -H $1 -d'
1118945aa7e3Smrg      ;;
1119945aa7e3Smrg    none)
1120945aa7e3Smrg      am__tar=false
1121945aa7e3Smrg      am__tar_=false
1122945aa7e3Smrg      am__untar=false
1123945aa7e3Smrg      ;;
1124945aa7e3Smrg    esac
1125b3eb03f3Smrg
1126945aa7e3Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
1127945aa7e3Smrg    # and am__untar set.
1128945aa7e3Smrg    test -n "${am_cv_prog_tar_$1}" && break
1129945aa7e3Smrg
1130945aa7e3Smrg    # tar/untar a dummy directory, and stop if the command works.
1131945aa7e3Smrg    rm -rf conftest.dir
1132945aa7e3Smrg    mkdir conftest.dir
1133945aa7e3Smrg    echo GrepMe > conftest.dir/file
1134945aa7e3Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1135945aa7e3Smrg    rm -rf conftest.dir
1136945aa7e3Smrg    if test -s conftest.tar; then
1137945aa7e3Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
1138945aa7e3Smrg      AM_RUN_LOG([cat conftest.dir/file])
1139945aa7e3Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1140945aa7e3Smrg    fi
1141945aa7e3Smrg  done
1142b3eb03f3Smrg  rm -rf conftest.dir
1143b3eb03f3Smrg
1144945aa7e3Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1145945aa7e3Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1146945aa7e3Smrg
1147b3eb03f3SmrgAC_SUBST([am__tar])
1148b3eb03f3SmrgAC_SUBST([am__untar])
1149b3eb03f3Smrg]) # _AM_PROG_TAR
1150b3eb03f3Smrg
1151945aa7e3Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1152945aa7e3Smrgdnl serial 11 (pkg-config-0.29)
1153945aa7e3Smrgdnl
1154945aa7e3Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1155945aa7e3Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1156945aa7e3Smrgdnl
1157945aa7e3Smrgdnl This program is free software; you can redistribute it and/or modify
1158945aa7e3Smrgdnl it under the terms of the GNU General Public License as published by
1159945aa7e3Smrgdnl the Free Software Foundation; either version 2 of the License, or
1160945aa7e3Smrgdnl (at your option) any later version.
1161945aa7e3Smrgdnl
1162945aa7e3Smrgdnl This program is distributed in the hope that it will be useful, but
1163945aa7e3Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1164945aa7e3Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1165945aa7e3Smrgdnl General Public License for more details.
1166945aa7e3Smrgdnl
1167945aa7e3Smrgdnl You should have received a copy of the GNU General Public License
1168945aa7e3Smrgdnl along with this program; if not, write to the Free Software
1169945aa7e3Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1170945aa7e3Smrgdnl 02111-1307, USA.
1171945aa7e3Smrgdnl
1172945aa7e3Smrgdnl As a special exception to the GNU General Public License, if you
1173945aa7e3Smrgdnl distribute this file as part of a program that contains a
1174945aa7e3Smrgdnl configuration script generated by Autoconf, you may include it under
1175945aa7e3Smrgdnl the same distribution terms that you use for the rest of that
1176945aa7e3Smrgdnl program.
1177945aa7e3Smrg
1178945aa7e3Smrgdnl PKG_PREREQ(MIN-VERSION)
1179945aa7e3Smrgdnl -----------------------
1180945aa7e3Smrgdnl Since: 0.29
1181945aa7e3Smrgdnl
1182945aa7e3Smrgdnl Verify that the version of the pkg-config macros are at least
1183945aa7e3Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1184945aa7e3Smrgdnl installed version of pkg-config, this checks the developer's version
1185945aa7e3Smrgdnl of pkg.m4 when generating configure.
1186945aa7e3Smrgdnl
1187945aa7e3Smrgdnl To ensure that this macro is defined, also add:
1188945aa7e3Smrgdnl m4_ifndef([PKG_PREREQ],
1189945aa7e3Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1190945aa7e3Smrgdnl
1191945aa7e3Smrgdnl See the "Since" comment for each macro you use to see what version
1192945aa7e3Smrgdnl of the macros you require.
1193945aa7e3Smrgm4_defun([PKG_PREREQ],
1194945aa7e3Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
1195945aa7e3Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1196945aa7e3Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1197945aa7e3Smrg])dnl PKG_PREREQ
1198945aa7e3Smrg
1199945aa7e3Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1200945aa7e3Smrgdnl ----------------------------------
1201945aa7e3Smrgdnl Since: 0.16
1202945aa7e3Smrgdnl
1203945aa7e3Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1204945aa7e3Smrgdnl first found in the path. Checks that the version of pkg-config found
1205945aa7e3Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1206945aa7e3Smrgdnl used since that's the first version where most current features of
1207945aa7e3Smrgdnl pkg-config existed.
1208b4485a66SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1209b4485a66Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1210945aa7e3Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1211945aa7e3Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1212945aa7e3SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1213945aa7e3SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1214945aa7e3SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1215945aa7e3Smrg
1216b4485a66Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1217b4485a66Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1218b4485a66Smrgfi
1219b4485a66Smrgif test -n "$PKG_CONFIG"; then
1220b4485a66Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
1221b4485a66Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1222b4485a66Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1223b4485a66Smrg		AC_MSG_RESULT([yes])
1224b4485a66Smrg	else
1225b4485a66Smrg		AC_MSG_RESULT([no])
1226b4485a66Smrg		PKG_CONFIG=""
1227b4485a66Smrg	fi
1228b4485a66Smrgfi[]dnl
1229945aa7e3Smrg])dnl PKG_PROG_PKG_CONFIG
1230b4485a66Smrg
1231945aa7e3Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1232945aa7e3Smrgdnl -------------------------------------------------------------------
1233945aa7e3Smrgdnl Since: 0.18
1234945aa7e3Smrgdnl
1235945aa7e3Smrgdnl Check to see whether a particular set of modules exists. Similar to
1236945aa7e3Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1237945aa7e3Smrgdnl
1238945aa7e3Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1239945aa7e3Smrgdnl only at the first occurence in configure.ac, so if the first place
1240945aa7e3Smrgdnl it's called might be skipped (such as if it is within an "if", you
1241945aa7e3Smrgdnl have to call PKG_CHECK_EXISTS manually
1242b4485a66SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1243b4485a66Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1244b4485a66Smrgif test -n "$PKG_CONFIG" && \
1245b4485a66Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1246945aa7e3Smrg  m4_default([$2], [:])
1247b4485a66Smrgm4_ifvaln([$3], [else
1248b4485a66Smrg  $3])dnl
1249b4485a66Smrgfi])
1250b4485a66Smrg
1251945aa7e3Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1252945aa7e3Smrgdnl ---------------------------------------------
1253945aa7e3Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1254945aa7e3Smrgdnl pkg_failed based on the result.
1255b4485a66Smrgm4_define([_PKG_CONFIG],
1256b4485a66Smrg[if test -n "$$1"; then
1257b4485a66Smrg    pkg_cv_[]$1="$$1"
1258b4485a66Smrg elif test -n "$PKG_CONFIG"; then
1259b4485a66Smrg    PKG_CHECK_EXISTS([$3],
1260945aa7e3Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1261945aa7e3Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
1262b4485a66Smrg		     [pkg_failed=yes])
1263b4485a66Smrg else
1264b4485a66Smrg    pkg_failed=untried
1265b4485a66Smrgfi[]dnl
1266945aa7e3Smrg])dnl _PKG_CONFIG
1267b4485a66Smrg
1268945aa7e3Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1269945aa7e3Smrgdnl ---------------------------
1270945aa7e3Smrgdnl Internal check to see if pkg-config supports short errors.
1271b4485a66SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1272b4485a66Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1273b4485a66Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1274b4485a66Smrg        _pkg_short_errors_supported=yes
1275b4485a66Smrgelse
1276b4485a66Smrg        _pkg_short_errors_supported=no
1277b4485a66Smrgfi[]dnl
1278945aa7e3Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1279b4485a66Smrg
1280b4485a66Smrg
1281945aa7e3Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1282945aa7e3Smrgdnl   [ACTION-IF-NOT-FOUND])
1283945aa7e3Smrgdnl --------------------------------------------------------------
1284945aa7e3Smrgdnl Since: 0.4.0
1285945aa7e3Smrgdnl
1286945aa7e3Smrgdnl Note that if there is a possibility the first call to
1287945aa7e3Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1288945aa7e3Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1289b4485a66SmrgAC_DEFUN([PKG_CHECK_MODULES],
1290b4485a66Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1291b4485a66SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1292b4485a66SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1293b4485a66Smrg
1294b4485a66Smrgpkg_failed=no
1295b4485a66SmrgAC_MSG_CHECKING([for $1])
1296b4485a66Smrg
1297b4485a66Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1298b4485a66Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1299b4485a66Smrg
1300b4485a66Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1301b4485a66Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1302b4485a66SmrgSee the pkg-config man page for more details.])
1303b4485a66Smrg
1304b4485a66Smrgif test $pkg_failed = yes; then
1305945aa7e3Smrg   	AC_MSG_RESULT([no])
1306b4485a66Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1307b4485a66Smrg        if test $_pkg_short_errors_supported = yes; then
1308945aa7e3Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1309b4485a66Smrg        else 
1310945aa7e3Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1311b4485a66Smrg        fi
1312b4485a66Smrg	# Put the nasty error message in config.log where it belongs
1313b4485a66Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1314b4485a66Smrg
1315945aa7e3Smrg	m4_default([$4], [AC_MSG_ERROR(
1316b4485a66Smrg[Package requirements ($2) were not met:
1317b4485a66Smrg
1318b4485a66Smrg$$1_PKG_ERRORS
1319b4485a66Smrg
1320b4485a66SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1321b4485a66Smrginstalled software in a non-standard prefix.
1322b4485a66Smrg
1323945aa7e3Smrg_PKG_TEXT])[]dnl
1324945aa7e3Smrg        ])
1325b4485a66Smrgelif test $pkg_failed = untried; then
1326945aa7e3Smrg     	AC_MSG_RESULT([no])
1327945aa7e3Smrg	m4_default([$4], [AC_MSG_FAILURE(
1328b4485a66Smrg[The pkg-config script could not be found or is too old.  Make sure it
1329b4485a66Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1330b4485a66Smrgpath to pkg-config.
1331b4485a66Smrg
1332b4485a66Smrg_PKG_TEXT
1333b4485a66Smrg
1334945aa7e3SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1335945aa7e3Smrg        ])
1336b4485a66Smrgelse
1337b4485a66Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1338b4485a66Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1339b4485a66Smrg        AC_MSG_RESULT([yes])
1340945aa7e3Smrg	$3
1341b4485a66Smrgfi[]dnl
1342945aa7e3Smrg])dnl PKG_CHECK_MODULES
1343945aa7e3Smrg
1344945aa7e3Smrg
1345945aa7e3Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1346945aa7e3Smrgdnl   [ACTION-IF-NOT-FOUND])
1347945aa7e3Smrgdnl ---------------------------------------------------------------------
1348945aa7e3Smrgdnl Since: 0.29
1349945aa7e3Smrgdnl
1350945aa7e3Smrgdnl Checks for existence of MODULES and gathers its build flags with
1351945aa7e3Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1352945aa7e3Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1353945aa7e3Smrgdnl
1354945aa7e3Smrgdnl Note that if there is a possibility the first call to
1355945aa7e3Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1356945aa7e3Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1357945aa7e3Smrgdnl configure.ac.
1358945aa7e3SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1359945aa7e3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1360945aa7e3Smrg_save_PKG_CONFIG=$PKG_CONFIG
1361945aa7e3SmrgPKG_CONFIG="$PKG_CONFIG --static"
1362945aa7e3SmrgPKG_CHECK_MODULES($@)
1363945aa7e3SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1364945aa7e3Smrg])dnl PKG_CHECK_MODULES_STATIC
1365945aa7e3Smrg
1366945aa7e3Smrg
1367945aa7e3Smrgdnl PKG_INSTALLDIR([DIRECTORY])
1368945aa7e3Smrgdnl -------------------------
1369945aa7e3Smrgdnl Since: 0.27
1370945aa7e3Smrgdnl
1371945aa7e3Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
1372945aa7e3Smrgdnl should install pkg-config .pc files. By default the directory is
1373945aa7e3Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
1374945aa7e3Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1375945aa7e3Smrgdnl parameter.
1376945aa7e3SmrgAC_DEFUN([PKG_INSTALLDIR],
1377945aa7e3Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1378945aa7e3Smrgm4_pushdef([pkg_description],
1379945aa7e3Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1380945aa7e3SmrgAC_ARG_WITH([pkgconfigdir],
1381945aa7e3Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1382945aa7e3Smrg    [with_pkgconfigdir=]pkg_default)
1383945aa7e3SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1384945aa7e3Smrgm4_popdef([pkg_default])
1385945aa7e3Smrgm4_popdef([pkg_description])
1386945aa7e3Smrg])dnl PKG_INSTALLDIR
1387945aa7e3Smrg
1388945aa7e3Smrg
1389945aa7e3Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1390945aa7e3Smrgdnl --------------------------------
1391945aa7e3Smrgdnl Since: 0.27
1392945aa7e3Smrgdnl
1393945aa7e3Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1394945aa7e3Smrgdnl module should install arch-independent pkg-config .pc files. By
1395945aa7e3Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
1396945aa7e3Smrgdnl changed by passing DIRECTORY. The user can override through the
1397945aa7e3Smrgdnl --with-noarch-pkgconfigdir parameter.
1398945aa7e3SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1399945aa7e3Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1400945aa7e3Smrgm4_pushdef([pkg_description],
1401945aa7e3Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1402945aa7e3SmrgAC_ARG_WITH([noarch-pkgconfigdir],
1403945aa7e3Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1404945aa7e3Smrg    [with_noarch_pkgconfigdir=]pkg_default)
1405945aa7e3SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1406945aa7e3Smrgm4_popdef([pkg_default])
1407945aa7e3Smrgm4_popdef([pkg_description])
1408945aa7e3Smrg])dnl PKG_NOARCH_INSTALLDIR
1409945aa7e3Smrg
1410945aa7e3Smrg
1411945aa7e3Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1412945aa7e3Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1413945aa7e3Smrgdnl -------------------------------------------
1414945aa7e3Smrgdnl Since: 0.28
1415945aa7e3Smrgdnl
1416945aa7e3Smrgdnl Retrieves the value of the pkg-config variable for the given module.
1417945aa7e3SmrgAC_DEFUN([PKG_CHECK_VAR],
1418945aa7e3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1419945aa7e3SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1420945aa7e3Smrg
1421945aa7e3Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1422945aa7e3SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1423945aa7e3Smrg
1424945aa7e3SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1425945aa7e3Smrg])dnl PKG_CHECK_VAR
1426b4485a66Smrg
1427b3eb03f3Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1428b3eb03f3Smrgdnl
1429affd2f3fSmrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
1430945aa7e3Smrgdnl
1431b3eb03f3Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1432af23b0a6Smrgdnl copy of this software and associated documentation files (the "Software"),
1433af23b0a6Smrgdnl to deal in the Software without restriction, including without limitation
1434af23b0a6Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1435af23b0a6Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1436af23b0a6Smrgdnl Software is furnished to do so, subject to the following conditions:
1437b3eb03f3Smrgdnl
1438af23b0a6Smrgdnl The above copyright notice and this permission notice (including the next
1439af23b0a6Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1440af23b0a6Smrgdnl Software.
1441b3eb03f3Smrgdnl
1442af23b0a6Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1443af23b0a6Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1444af23b0a6Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1445af23b0a6Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1446af23b0a6Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1447af23b0a6Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1448af23b0a6Smrgdnl DEALINGS IN THE SOFTWARE.
1449b3eb03f3Smrg
1450b3eb03f3Smrg# XORG_MACROS_VERSION(required-version)
1451b3eb03f3Smrg# -------------------------------------
1452b3eb03f3Smrg# Minimum version: 1.1.0
1453b3eb03f3Smrg#
1454b3eb03f3Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1455b3eb03f3Smrg# your configure.ac with the minimum required version, such as:
1456b3eb03f3Smrg# XORG_MACROS_VERSION(1.1)
1457b3eb03f3Smrg#
1458b3eb03f3Smrg# To ensure that this macro is defined, also add:
1459b3eb03f3Smrg# m4_ifndef([XORG_MACROS_VERSION],
1460b3eb03f3Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1461b3eb03f3Smrg#
1462b3eb03f3Smrg#
1463945aa7e3Smrg# See the "minimum version" comment for each macro you use to see what
1464b3eb03f3Smrg# version you require.
1465b3eb03f3Smrgm4_defun([XORG_MACROS_VERSION],[
1466affd2f3fSmrgm4_define([vers_have], [1.20.0])
1467b3eb03f3Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1468b3eb03f3Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1469b3eb03f3Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1470b3eb03f3Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1471b3eb03f3Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1472b3eb03f3Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1473b3eb03f3Smrgm4_undefine([vers_have])
1474b3eb03f3Smrgm4_undefine([maj_have])
1475b3eb03f3Smrgm4_undefine([maj_needed])
1476b3eb03f3Smrg]) # XORG_MACROS_VERSION
1477b3eb03f3Smrg
1478b3eb03f3Smrg# XORG_PROG_RAWCPP()
1479b3eb03f3Smrg# ------------------
1480b3eb03f3Smrg# Minimum version: 1.0.0
1481b3eb03f3Smrg#
1482b3eb03f3Smrg# Find cpp program and necessary flags for use in pre-processing text files
1483b3eb03f3Smrg# such as man pages and config files
1484b3eb03f3SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1485b3eb03f3SmrgAC_REQUIRE([AC_PROG_CPP])
1486945aa7e3SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1487b3eb03f3Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1488b3eb03f3Smrg
1489b3eb03f3Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1490b3eb03f3Smrg# which is not the best choice for supporting other OS'es, but covers most
1491b3eb03f3Smrg# of the ones we need for now.
1492b3eb03f3SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1493b4485a66SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1494b3eb03f3Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1495b3eb03f3Smrg	AC_MSG_RESULT([no])
1496b3eb03f3Smrgelse
1497b3eb03f3Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1498b3eb03f3Smrg		RAWCPPFLAGS=-undef
1499b3eb03f3Smrg		AC_MSG_RESULT([yes])
1500b3eb03f3Smrg	# under Cygwin unix is still defined even with -undef
1501b3eb03f3Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1502b3eb03f3Smrg		RAWCPPFLAGS="-undef -ansi"
1503b3eb03f3Smrg		AC_MSG_RESULT([yes, with -ansi])
1504b3eb03f3Smrg	else
1505b3eb03f3Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1506b3eb03f3Smrg	fi
1507b3eb03f3Smrgfi
1508b3eb03f3Smrgrm -f conftest.$ac_ext
1509010cdda0Smrg
1510b3eb03f3SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1511b4485a66SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1512affd2f3fSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1513b3eb03f3Smrg	AC_MSG_RESULT([no])
1514b3eb03f3Smrgelse
1515affd2f3fSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1516945aa7e3Smrg		TRADITIONALCPPFLAGS="-traditional"
1517b3eb03f3Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1518b3eb03f3Smrg		AC_MSG_RESULT([yes])
1519b3eb03f3Smrg	else
1520b3eb03f3Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1521b3eb03f3Smrg	fi
1522b3eb03f3Smrgfi
1523b3eb03f3Smrgrm -f conftest.$ac_ext
1524b3eb03f3SmrgAC_SUBST(RAWCPPFLAGS)
1525945aa7e3SmrgAC_SUBST(TRADITIONALCPPFLAGS)
1526b3eb03f3Smrg]) # XORG_PROG_RAWCPP
1527010cdda0Smrg
1528b3eb03f3Smrg# XORG_MANPAGE_SECTIONS()
1529b3eb03f3Smrg# -----------------------
1530b3eb03f3Smrg# Minimum version: 1.0.0
1531b3eb03f3Smrg#
1532b3eb03f3Smrg# Determine which sections man pages go in for the different man page types
1533b3eb03f3Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1534b3eb03f3Smrg# Not sure if there's any better way than just hardcoding by OS name.
1535b3eb03f3Smrg# Override default settings by setting environment variables
1536af23b0a6Smrg# Added MAN_SUBSTS in version 1.8
1537af23b0a6Smrg# Added AC_PROG_SED in version 1.8
1538010cdda0Smrg
1539b3eb03f3SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1540b3eb03f3SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1541af23b0a6SmrgAC_REQUIRE([AC_PROG_SED])
1542010cdda0Smrg
1543945aa7e3Smrgcase $host_os in
1544945aa7e3Smrg    solaris*)
1545945aa7e3Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1546945aa7e3Smrg        # check for a man page file found in later versions that use
1547945aa7e3Smrg        # traditional section numbers instead
1548945aa7e3Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1549945aa7e3Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1550945aa7e3Smrg        ;;
1551945aa7e3Smrg    *) SYSV_MAN_SECTIONS=false ;;
1552945aa7e3Smrgesac
1553945aa7e3Smrg
1554b3eb03f3Smrgif test x$APP_MAN_SUFFIX = x    ; then
1555b3eb03f3Smrg    APP_MAN_SUFFIX=1
1556b3eb03f3Smrgfi
1557b3eb03f3Smrgif test x$APP_MAN_DIR = x    ; then
1558b3eb03f3Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1559b3eb03f3Smrgfi
1560010cdda0Smrg
1561b3eb03f3Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1562b3eb03f3Smrg    LIB_MAN_SUFFIX=3
1563b3eb03f3Smrgfi
1564b3eb03f3Smrgif test x$LIB_MAN_DIR = x    ; then
1565b3eb03f3Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1566b3eb03f3Smrgfi
1567010cdda0Smrg
1568b3eb03f3Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1569945aa7e3Smrg    case $SYSV_MAN_SECTIONS in
1570945aa7e3Smrg	true)				FILE_MAN_SUFFIX=4  ;;
1571945aa7e3Smrg	*)				FILE_MAN_SUFFIX=5  ;;
1572b3eb03f3Smrg    esac
1573b3eb03f3Smrgfi
1574b3eb03f3Smrgif test x$FILE_MAN_DIR = x    ; then
1575b3eb03f3Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1576b3eb03f3Smrgfi
1577010cdda0Smrg
1578b3eb03f3Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1579945aa7e3Smrg    case $SYSV_MAN_SECTIONS in
1580945aa7e3Smrg	true)				MISC_MAN_SUFFIX=5  ;;
1581945aa7e3Smrg	*)				MISC_MAN_SUFFIX=7  ;;
1582b3eb03f3Smrg    esac
1583b3eb03f3Smrgfi
1584b3eb03f3Smrgif test x$MISC_MAN_DIR = x    ; then
1585b3eb03f3Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1586b3eb03f3Smrgfi
1587010cdda0Smrg
1588b3eb03f3Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1589945aa7e3Smrg    case $SYSV_MAN_SECTIONS in
1590945aa7e3Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1591945aa7e3Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1592b3eb03f3Smrg    esac
1593b3eb03f3Smrgfi
1594b3eb03f3Smrgif test x$DRIVER_MAN_DIR = x    ; then
1595b3eb03f3Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1596b3eb03f3Smrgfi
1597010cdda0Smrg
1598b3eb03f3Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1599945aa7e3Smrg    case $SYSV_MAN_SECTIONS in
1600945aa7e3Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1601945aa7e3Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
1602b3eb03f3Smrg    esac
1603b3eb03f3Smrgfi
1604b3eb03f3Smrgif test x$ADMIN_MAN_DIR = x    ; then
1605b3eb03f3Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1606b3eb03f3Smrgfi
1607010cdda0Smrg
1608010cdda0Smrg
1609b3eb03f3SmrgAC_SUBST([APP_MAN_SUFFIX])
1610b3eb03f3SmrgAC_SUBST([LIB_MAN_SUFFIX])
1611b3eb03f3SmrgAC_SUBST([FILE_MAN_SUFFIX])
1612b3eb03f3SmrgAC_SUBST([MISC_MAN_SUFFIX])
1613b3eb03f3SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1614b3eb03f3SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1615b3eb03f3SmrgAC_SUBST([APP_MAN_DIR])
1616b3eb03f3SmrgAC_SUBST([LIB_MAN_DIR])
1617b3eb03f3SmrgAC_SUBST([FILE_MAN_DIR])
1618b3eb03f3SmrgAC_SUBST([MISC_MAN_DIR])
1619b3eb03f3SmrgAC_SUBST([DRIVER_MAN_DIR])
1620b3eb03f3SmrgAC_SUBST([ADMIN_MAN_DIR])
1621af23b0a6Smrg
1622af23b0a6SmrgXORG_MAN_PAGE="X Version 11"
1623af23b0a6SmrgAC_SUBST([XORG_MAN_PAGE])
1624af23b0a6SmrgMAN_SUBSTS="\
1625af23b0a6Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1626af23b0a6Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1627af23b0a6Smrg	-e 's|__xservername__|Xorg|g' \
1628af23b0a6Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1629af23b0a6Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1630af23b0a6Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1631af23b0a6Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1632af23b0a6Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1633af23b0a6Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1634af23b0a6Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1635af23b0a6Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1636af23b0a6Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1637af23b0a6SmrgAC_SUBST([MAN_SUBSTS])
1638af23b0a6Smrg
1639b3eb03f3Smrg]) # XORG_MANPAGE_SECTIONS
1640b3eb03f3Smrg
1641af23b0a6Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1642af23b0a6Smrg# ------------------------
1643af23b0a6Smrg# Minimum version: 1.7.0
1644af23b0a6Smrg#
1645af23b0a6Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1646af23b0a6Smrg# provided by xorg-sgml-doctools, if installed.
1647af23b0a6SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1648af23b0a6SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1649af23b0a6SmrgXORG_SGML_PATH=
1650af23b0a6SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1651af23b0a6Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1652af23b0a6Smrg    [m4_ifval([$1],[:],
1653af23b0a6Smrg        [if test x"$cross_compiling" != x"yes" ; then
1654af23b0a6Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1655af23b0a6Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1656af23b0a6Smrg         fi])
1657af23b0a6Smrg    ])
1658af23b0a6Smrg
1659af23b0a6Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1660af23b0a6Smrg# the path and the name of the doc stylesheet
1661af23b0a6Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1662af23b0a6Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1663af23b0a6Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1664af23b0a6Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1665af23b0a6Smrgelse
1666af23b0a6Smrg   AC_MSG_RESULT([no])
1667af23b0a6Smrgfi
1668af23b0a6Smrg
1669af23b0a6SmrgAC_SUBST(XORG_SGML_PATH)
1670af23b0a6SmrgAC_SUBST(STYLESHEET_SRCDIR)
1671af23b0a6SmrgAC_SUBST(XSL_STYLESHEET)
1672af23b0a6SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1673af23b0a6Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1674af23b0a6Smrg
1675b3eb03f3Smrg# XORG_CHECK_LINUXDOC
1676b3eb03f3Smrg# -------------------
1677b3eb03f3Smrg# Minimum version: 1.0.0
1678b3eb03f3Smrg#
1679b3eb03f3Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1680b3eb03f3Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1681b3eb03f3Smrg# Whether or not the necessary tools and files are found can be checked
1682b3eb03f3Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1683b3eb03f3SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1684af23b0a6SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1685af23b0a6SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1686010cdda0Smrg
1687b3eb03f3SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1688010cdda0Smrg
1689af23b0a6SmrgAC_MSG_CHECKING([whether to build documentation])
1690010cdda0Smrg
1691af23b0a6Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1692b3eb03f3Smrg   BUILDDOC=yes
1693b3eb03f3Smrgelse
1694b3eb03f3Smrg   BUILDDOC=no
1695010cdda0Smrgfi
1696010cdda0Smrg
1697b3eb03f3SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1698010cdda0Smrg
1699b3eb03f3SmrgAC_MSG_RESULT([$BUILDDOC])
1700010cdda0Smrg
1701af23b0a6SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1702010cdda0Smrg
1703af23b0a6Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1704b3eb03f3Smrg   BUILDPDFDOC=yes
1705b3eb03f3Smrgelse
1706b3eb03f3Smrg   BUILDPDFDOC=no
1707b3eb03f3Smrgfi
1708010cdda0Smrg
1709b3eb03f3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1710010cdda0Smrg
1711b3eb03f3SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1712010cdda0Smrg
1713af23b0a6SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1714b3eb03f3SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1715b3eb03f3SmrgMAKE_PDF="$PS2PDF"
1716b3eb03f3SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1717010cdda0Smrg
1718b3eb03f3SmrgAC_SUBST(MAKE_TEXT)
1719b3eb03f3SmrgAC_SUBST(MAKE_PS)
1720b3eb03f3SmrgAC_SUBST(MAKE_PDF)
1721b3eb03f3SmrgAC_SUBST(MAKE_HTML)
1722b3eb03f3Smrg]) # XORG_CHECK_LINUXDOC
1723b3eb03f3Smrg
1724b3eb03f3Smrg# XORG_CHECK_DOCBOOK
1725b3eb03f3Smrg# -------------------
1726b3eb03f3Smrg# Minimum version: 1.0.0
1727b3eb03f3Smrg#
1728b3eb03f3Smrg# Checks for the ability to build output formats from SGML DocBook source.
1729b3eb03f3Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1730b3eb03f3Smrg# indicates whether the necessary tools and files are found and, if set,
1731b3eb03f3Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1732b3eb03f3SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1733af23b0a6SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1734af23b0a6Smrg
1735b3eb03f3SmrgBUILDTXTDOC=no
1736b3eb03f3SmrgBUILDPDFDOC=no
1737b3eb03f3SmrgBUILDPSDOC=no
1738b3eb03f3SmrgBUILDHTMLDOC=no
1739b3eb03f3Smrg
1740b3eb03f3SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1741b3eb03f3SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1742b3eb03f3SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1743b3eb03f3SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1744b3eb03f3Smrg
1745af23b0a6SmrgAC_MSG_CHECKING([whether to build text documentation])
1746af23b0a6Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1747b3eb03f3Smrg   test x$BUILD_TXTDOC != xno; then
1748b3eb03f3Smrg	BUILDTXTDOC=yes
1749b3eb03f3Smrgfi
1750b3eb03f3SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1751b3eb03f3SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1752010cdda0Smrg
1753af23b0a6SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1754af23b0a6Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1755b3eb03f3Smrg   test x$BUILD_PDFDOC != xno; then
1756b3eb03f3Smrg	BUILDPDFDOC=yes
1757b3eb03f3Smrgfi
1758b3eb03f3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1759b3eb03f3SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1760010cdda0Smrg
1761af23b0a6SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1762af23b0a6Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1763b3eb03f3Smrg   test x$BUILD_PSDOC != xno; then
1764b3eb03f3Smrg	BUILDPSDOC=yes
1765b3eb03f3Smrgfi
1766b3eb03f3SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1767b3eb03f3SmrgAC_MSG_RESULT([$BUILDPSDOC])
1768010cdda0Smrg
1769af23b0a6SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1770af23b0a6Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1771b3eb03f3Smrg   test x$BUILD_HTMLDOC != xno; then
1772b3eb03f3Smrg	BUILDHTMLDOC=yes
1773b3eb03f3Smrgfi
1774b3eb03f3SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1775b3eb03f3SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1776010cdda0Smrg
1777b3eb03f3SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1778b3eb03f3SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1779b3eb03f3SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1780b3eb03f3SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1781010cdda0Smrg
1782b3eb03f3SmrgAC_SUBST(MAKE_TEXT)
1783b3eb03f3SmrgAC_SUBST(MAKE_PS)
1784b3eb03f3SmrgAC_SUBST(MAKE_PDF)
1785b3eb03f3SmrgAC_SUBST(MAKE_HTML)
1786b3eb03f3Smrg]) # XORG_CHECK_DOCBOOK
1787010cdda0Smrg
1788af23b0a6Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1789af23b0a6Smrg# ----------------
1790af23b0a6Smrg# Minimum version: 1.5.0
1791af23b0a6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1792af23b0a6Smrg#
1793af23b0a6Smrg# Documentation tools are not always available on all platforms and sometimes
1794af23b0a6Smrg# not at the appropriate level. This macro enables a module to test for the
1795af23b0a6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1796affd2f3fSmrg# the --with-xmlto option, it allows maximum flexibility in making decisions
1797af23b0a6Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1798af23b0a6Smrg# --with-xmlto assumes 'auto'.
1799af23b0a6Smrg#
1800af23b0a6Smrg# Interface to module:
1801af23b0a6Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1802af23b0a6Smrg# XMLTO:	returns the path of the xmlto program found
1803af23b0a6Smrg#		returns the path set by the user in the environment
1804af23b0a6Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1805af23b0a6Smrg#		'no' user instructs the module not to use xmlto
1806af23b0a6Smrg#
1807af23b0a6Smrg# Added in version 1.10.0
1808af23b0a6Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1809af23b0a6Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1810af23b0a6Smrg#
1811af23b0a6Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1812af23b0a6Smrg#
1813af23b0a6SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1814af23b0a6SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1815af23b0a6Smrgm4_define([_defopt], m4_default([$2], [auto]))
1816af23b0a6SmrgAC_ARG_WITH(xmlto,
1817af23b0a6Smrg	AS_HELP_STRING([--with-xmlto],
1818af23b0a6Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1819af23b0a6Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1820af23b0a6Smrgm4_undefine([_defopt])
1821af23b0a6Smrg
1822af23b0a6Smrgif test "x$use_xmlto" = x"auto"; then
1823af23b0a6Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1824af23b0a6Smrg   if test "x$XMLTO" = "x"; then
1825af23b0a6Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1826af23b0a6Smrg	have_xmlto=no
1827af23b0a6Smrg   else
1828af23b0a6Smrg        have_xmlto=yes
1829af23b0a6Smrg   fi
1830af23b0a6Smrgelif test "x$use_xmlto" = x"yes" ; then
1831af23b0a6Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1832af23b0a6Smrg   if test "x$XMLTO" = "x"; then
1833af23b0a6Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1834af23b0a6Smrg   fi
1835af23b0a6Smrg   have_xmlto=yes
1836af23b0a6Smrgelif test "x$use_xmlto" = x"no" ; then
1837af23b0a6Smrg   if test "x$XMLTO" != "x"; then
1838af23b0a6Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1839af23b0a6Smrg   fi
1840af23b0a6Smrg   have_xmlto=no
1841af23b0a6Smrgelse
1842af23b0a6Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1843af23b0a6Smrgfi
1844af23b0a6Smrg
1845af23b0a6Smrg# Test for a minimum version of xmlto, if provided.
1846af23b0a6Smrgm4_ifval([$1],
1847af23b0a6Smrg[if test "$have_xmlto" = yes; then
1848af23b0a6Smrg    # scrape the xmlto version
1849af23b0a6Smrg    AC_MSG_CHECKING([the xmlto version])
1850af23b0a6Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1851af23b0a6Smrg    AC_MSG_RESULT([$xmlto_version])
1852af23b0a6Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1853af23b0a6Smrg        [if test "x$use_xmlto" = xauto; then
1854af23b0a6Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1855af23b0a6Smrg            have_xmlto=no
1856af23b0a6Smrg        else
1857af23b0a6Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1858af23b0a6Smrg        fi])
1859af23b0a6Smrgfi])
1860af23b0a6Smrg
1861af23b0a6Smrg# Test for the ability of xmlto to generate a text target
1862945aa7e3Smrg#
1863945aa7e3Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
1864945aa7e3Smrg# following test for empty XML docbook files.
1865945aa7e3Smrg# For compatibility reasons use the following empty XML docbook file and if
1866945aa7e3Smrg# it fails try it again with a non-empty XML file.
1867af23b0a6Smrghave_xmlto_text=no
1868af23b0a6Smrgcat > conftest.xml << "EOF"
1869af23b0a6SmrgEOF
1870af23b0a6SmrgAS_IF([test "$have_xmlto" = yes],
1871af23b0a6Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1872af23b0a6Smrg             [have_xmlto_text=yes],
1873945aa7e3Smrg             [# Try it again with a non-empty XML file.
1874945aa7e3Smrg              cat > conftest.xml << "EOF"
1875945aa7e3Smrg<x></x>
1876945aa7e3SmrgEOF
1877945aa7e3Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1878945aa7e3Smrg                    [have_xmlto_text=yes],
1879945aa7e3Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
1880af23b0a6Smrgrm -f conftest.xml
1881af23b0a6SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1882af23b0a6SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1883af23b0a6Smrg]) # XORG_WITH_XMLTO
1884af23b0a6Smrg
1885b4485a66Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1886b4485a66Smrg# --------------------------------------------
1887b4485a66Smrg# Minimum version: 1.12.0
1888b4485a66Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1889b4485a66Smrg#
1890b4485a66Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1891b4485a66Smrg# XML-based language used for the transformation of XML documents.
1892b4485a66Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1893b4485a66Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1894b4485a66Smrg# The XSLT processor is often used as a standalone tool for transformations.
1895b4485a66Smrg# It should not be assumed that this tool is used only to work with documnetation.
1896b4485a66Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1897b4485a66Smrg#
1898b4485a66Smrg# Interface to module:
1899b4485a66Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1900b4485a66Smrg# XSLTPROC:	 returns the path of the xsltproc program found
1901b4485a66Smrg#		 returns the path set by the user in the environment
1902b4485a66Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1903b4485a66Smrg#		  'no' user instructs the module not to use xsltproc
1904b4485a66Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1905b4485a66Smrg#
1906b4485a66Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1907b4485a66Smrg#
1908b4485a66SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1909b4485a66SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1910b4485a66Smrg# Preserves the interface, should it be implemented later
1911b4485a66Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1912b4485a66Smrgm4_define([_defopt], m4_default([$2], [auto]))
1913b4485a66SmrgAC_ARG_WITH(xsltproc,
1914b4485a66Smrg	AS_HELP_STRING([--with-xsltproc],
1915b4485a66Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1916b4485a66Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1917b4485a66Smrgm4_undefine([_defopt])
1918b4485a66Smrg
1919b4485a66Smrgif test "x$use_xsltproc" = x"auto"; then
1920b4485a66Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1921b4485a66Smrg   if test "x$XSLTPROC" = "x"; then
1922b4485a66Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1923b4485a66Smrg	have_xsltproc=no
1924b4485a66Smrg   else
1925b4485a66Smrg        have_xsltproc=yes
1926b4485a66Smrg   fi
1927b4485a66Smrgelif test "x$use_xsltproc" = x"yes" ; then
1928b4485a66Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1929b4485a66Smrg   if test "x$XSLTPROC" = "x"; then
1930b4485a66Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1931b4485a66Smrg   fi
1932b4485a66Smrg   have_xsltproc=yes
1933b4485a66Smrgelif test "x$use_xsltproc" = x"no" ; then
1934b4485a66Smrg   if test "x$XSLTPROC" != "x"; then
1935b4485a66Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1936b4485a66Smrg   fi
1937b4485a66Smrg   have_xsltproc=no
1938b4485a66Smrgelse
1939b4485a66Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1940b4485a66Smrgfi
1941b4485a66Smrg
1942b4485a66SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1943b4485a66Smrg]) # XORG_WITH_XSLTPROC
1944b4485a66Smrg
1945b4485a66Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1946b4485a66Smrg# ----------------------------------------
1947b4485a66Smrg# Minimum version: 1.15.0
1948b4485a66Smrg#
1949b4485a66Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
1950b4485a66Smrg# scanning arbitrary text files, extracting information from those text files,
1951b4485a66Smrg# and printing reports based on that information.
1952b4485a66Smrg#
1953b4485a66Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1954b4485a66Smrg#
1955b4485a66Smrg# Interface to module:
1956b4485a66Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
1957b4485a66Smrg# PERL:	     returns the path of the perl program found
1958b4485a66Smrg#	     returns the path set by the user in the environment
1959b4485a66Smrg# --with-perl: 'yes' user instructs the module to use perl
1960b4485a66Smrg#	       'no' user instructs the module not to use perl
1961b4485a66Smrg# have_perl: returns yes if perl found in PATH or no
1962b4485a66Smrg#
1963b4485a66Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1964b4485a66Smrg#
1965b4485a66SmrgAC_DEFUN([XORG_WITH_PERL],[
1966b4485a66SmrgAC_ARG_VAR([PERL], [Path to perl command])
1967b4485a66Smrg# Preserves the interface, should it be implemented later
1968b4485a66Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1969b4485a66Smrgm4_define([_defopt], m4_default([$2], [auto]))
1970b4485a66SmrgAC_ARG_WITH(perl,
1971b4485a66Smrg	AS_HELP_STRING([--with-perl],
1972b4485a66Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1973b4485a66Smrg	   [use_perl=$withval], [use_perl=]_defopt)
1974b4485a66Smrgm4_undefine([_defopt])
1975b4485a66Smrg
1976b4485a66Smrgif test "x$use_perl" = x"auto"; then
1977b4485a66Smrg   AC_PATH_PROG([PERL], [perl])
1978b4485a66Smrg   if test "x$PERL" = "x"; then
1979b4485a66Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1980b4485a66Smrg	have_perl=no
1981b4485a66Smrg   else
1982b4485a66Smrg        have_perl=yes
1983b4485a66Smrg   fi
1984b4485a66Smrgelif test "x$use_perl" = x"yes" ; then
1985b4485a66Smrg   AC_PATH_PROG([PERL], [perl])
1986b4485a66Smrg   if test "x$PERL" = "x"; then
1987b4485a66Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1988b4485a66Smrg   fi
1989b4485a66Smrg   have_perl=yes
1990b4485a66Smrgelif test "x$use_perl" = x"no" ; then
1991b4485a66Smrg   if test "x$PERL" != "x"; then
1992b4485a66Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1993b4485a66Smrg   fi
1994b4485a66Smrg   have_perl=no
1995b4485a66Smrgelse
1996b4485a66Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1997b4485a66Smrgfi
1998b4485a66Smrg
1999b4485a66SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2000b4485a66Smrg]) # XORG_WITH_PERL
2001b4485a66Smrg
2002af23b0a6Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2003af23b0a6Smrg# ----------------
2004af23b0a6Smrg# Minimum version: 1.5.0
2005af23b0a6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2006af23b0a6Smrg#
2007af23b0a6Smrg# Documentation tools are not always available on all platforms and sometimes
2008af23b0a6Smrg# not at the appropriate level. This macro enables a module to test for the
2009af23b0a6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2010affd2f3fSmrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
2011af23b0a6Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2012af23b0a6Smrg# --with-asciidoc assumes 'auto'.
2013af23b0a6Smrg#
2014af23b0a6Smrg# Interface to module:
2015af23b0a6Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2016af23b0a6Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
2017af23b0a6Smrg#		 returns the path set by the user in the environment
2018af23b0a6Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2019af23b0a6Smrg#		  'no' user instructs the module not to use asciidoc
2020af23b0a6Smrg#
2021af23b0a6Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2022af23b0a6Smrg#
2023af23b0a6SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2024af23b0a6SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2025af23b0a6Smrgm4_define([_defopt], m4_default([$2], [auto]))
2026af23b0a6SmrgAC_ARG_WITH(asciidoc,
2027af23b0a6Smrg	AS_HELP_STRING([--with-asciidoc],
2028af23b0a6Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2029af23b0a6Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2030af23b0a6Smrgm4_undefine([_defopt])
2031af23b0a6Smrg
2032af23b0a6Smrgif test "x$use_asciidoc" = x"auto"; then
2033af23b0a6Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2034af23b0a6Smrg   if test "x$ASCIIDOC" = "x"; then
2035af23b0a6Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2036af23b0a6Smrg	have_asciidoc=no
2037af23b0a6Smrg   else
2038af23b0a6Smrg        have_asciidoc=yes
2039af23b0a6Smrg   fi
2040af23b0a6Smrgelif test "x$use_asciidoc" = x"yes" ; then
2041af23b0a6Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2042af23b0a6Smrg   if test "x$ASCIIDOC" = "x"; then
2043af23b0a6Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2044af23b0a6Smrg   fi
2045af23b0a6Smrg   have_asciidoc=yes
2046af23b0a6Smrgelif test "x$use_asciidoc" = x"no" ; then
2047af23b0a6Smrg   if test "x$ASCIIDOC" != "x"; then
2048af23b0a6Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2049af23b0a6Smrg   fi
2050af23b0a6Smrg   have_asciidoc=no
2051af23b0a6Smrgelse
2052af23b0a6Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2053af23b0a6Smrgfi
2054af23b0a6Smrgm4_ifval([$1],
2055af23b0a6Smrg[if test "$have_asciidoc" = yes; then
2056af23b0a6Smrg    # scrape the asciidoc version
2057af23b0a6Smrg    AC_MSG_CHECKING([the asciidoc version])
2058af23b0a6Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2059af23b0a6Smrg    AC_MSG_RESULT([$asciidoc_version])
2060af23b0a6Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2061af23b0a6Smrg        [if test "x$use_asciidoc" = xauto; then
2062af23b0a6Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2063af23b0a6Smrg            have_asciidoc=no
2064af23b0a6Smrg        else
2065af23b0a6Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2066af23b0a6Smrg        fi])
2067af23b0a6Smrgfi])
2068af23b0a6SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2069af23b0a6Smrg]) # XORG_WITH_ASCIIDOC
2070af23b0a6Smrg
2071af23b0a6Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
2072945aa7e3Smrg# -------------------------------------------
2073af23b0a6Smrg# Minimum version: 1.5.0
2074af23b0a6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2075945aa7e3Smrg# Minimum version for optional DOT checking: 1.18.0
2076af23b0a6Smrg#
2077af23b0a6Smrg# Documentation tools are not always available on all platforms and sometimes
2078af23b0a6Smrg# not at the appropriate level. This macro enables a module to test for the
2079af23b0a6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2080affd2f3fSmrg# the --with-doxygen option, it allows maximum flexibility in making decisions
2081af23b0a6Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2082af23b0a6Smrg# --with-doxygen assumes 'auto'.
2083af23b0a6Smrg#
2084af23b0a6Smrg# Interface to module:
2085af23b0a6Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2086af23b0a6Smrg# DOXYGEN:	 returns the path of the doxygen program found
2087af23b0a6Smrg#		 returns the path set by the user in the environment
2088af23b0a6Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2089af23b0a6Smrg#		  'no' user instructs the module not to use doxygen
2090af23b0a6Smrg#
2091af23b0a6Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2092af23b0a6Smrg#
2093af23b0a6SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2094af23b0a6SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2095945aa7e3SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
2096af23b0a6Smrgm4_define([_defopt], m4_default([$2], [auto]))
2097af23b0a6SmrgAC_ARG_WITH(doxygen,
2098af23b0a6Smrg	AS_HELP_STRING([--with-doxygen],
2099af23b0a6Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2100af23b0a6Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2101af23b0a6Smrgm4_undefine([_defopt])
2102af23b0a6Smrg
2103af23b0a6Smrgif test "x$use_doxygen" = x"auto"; then
2104af23b0a6Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2105af23b0a6Smrg   if test "x$DOXYGEN" = "x"; then
2106af23b0a6Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2107af23b0a6Smrg	have_doxygen=no
2108af23b0a6Smrg   else
2109af23b0a6Smrg        have_doxygen=yes
2110af23b0a6Smrg   fi
2111af23b0a6Smrgelif test "x$use_doxygen" = x"yes" ; then
2112af23b0a6Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2113af23b0a6Smrg   if test "x$DOXYGEN" = "x"; then
2114af23b0a6Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2115af23b0a6Smrg   fi
2116af23b0a6Smrg   have_doxygen=yes
2117af23b0a6Smrgelif test "x$use_doxygen" = x"no" ; then
2118af23b0a6Smrg   if test "x$DOXYGEN" != "x"; then
2119af23b0a6Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2120af23b0a6Smrg   fi
2121af23b0a6Smrg   have_doxygen=no
2122af23b0a6Smrgelse
2123af23b0a6Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2124af23b0a6Smrgfi
2125af23b0a6Smrgm4_ifval([$1],
2126af23b0a6Smrg[if test "$have_doxygen" = yes; then
2127af23b0a6Smrg    # scrape the doxygen version
2128af23b0a6Smrg    AC_MSG_CHECKING([the doxygen version])
2129af23b0a6Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2130af23b0a6Smrg    AC_MSG_RESULT([$doxygen_version])
2131af23b0a6Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2132af23b0a6Smrg        [if test "x$use_doxygen" = xauto; then
2133af23b0a6Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2134af23b0a6Smrg            have_doxygen=no
2135af23b0a6Smrg        else
2136af23b0a6Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2137af23b0a6Smrg        fi])
2138af23b0a6Smrgfi])
2139945aa7e3Smrg
2140945aa7e3Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2141945aa7e3Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2142945aa7e3Smrgdnl 	HAVE_DOT = @HAVE_DOT@
2143945aa7e3SmrgHAVE_DOT=no
2144945aa7e3Smrgif test "x$have_doxygen" = "xyes"; then
2145945aa7e3Smrg  AC_PATH_PROG([DOT], [dot])
2146945aa7e3Smrg    if test "x$DOT" != "x"; then
2147945aa7e3Smrg      HAVE_DOT=yes
2148945aa7e3Smrg    fi
2149945aa7e3Smrgfi
2150945aa7e3Smrg
2151945aa7e3SmrgAC_SUBST([HAVE_DOT])
2152945aa7e3SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2153af23b0a6SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2154af23b0a6Smrg]) # XORG_WITH_DOXYGEN
2155af23b0a6Smrg
2156af23b0a6Smrg# XORG_WITH_GROFF([DEFAULT])
2157af23b0a6Smrg# ----------------
2158af23b0a6Smrg# Minimum version: 1.6.0
2159af23b0a6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2160af23b0a6Smrg#
2161af23b0a6Smrg# Documentation tools are not always available on all platforms and sometimes
2162af23b0a6Smrg# not at the appropriate level. This macro enables a module to test for the
2163af23b0a6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2164affd2f3fSmrg# the --with-groff option, it allows maximum flexibility in making decisions
2165af23b0a6Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
2166af23b0a6Smrg# --with-groff assumes 'auto'.
2167af23b0a6Smrg#
2168af23b0a6Smrg# Interface to module:
2169af23b0a6Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2170af23b0a6Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2171af23b0a6Smrg# HAVE_GROFF_MS: the -ms macros package
2172af23b0a6Smrg# GROFF:	 returns the path of the groff program found
2173af23b0a6Smrg#		 returns the path set by the user in the environment
2174af23b0a6Smrg# --with-groff:	 'yes' user instructs the module to use groff
2175af23b0a6Smrg#		 'no' user instructs the module not to use groff
2176af23b0a6Smrg#
2177af23b0a6Smrg# Added in version 1.9.0:
2178af23b0a6Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2179af23b0a6Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2180af23b0a6Smrg#		   psselect from the psutils package.
2181af23b0a6Smrg#		   the ghostcript package. Refer to the grohtml man pages
2182af23b0a6Smrg#
2183af23b0a6Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2184af23b0a6Smrg#
2185af23b0a6Smrg# OS and distros often splits groff in a basic and full package, the former
2186af23b0a6Smrg# having the groff program and the later having devices, fonts and macros
2187af23b0a6Smrg# Checking for the groff executable is not enough.
2188af23b0a6Smrg#
2189af23b0a6Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
2190af23b0a6Smrg# unset HAVE_GROFF or GROFF env variables.
2191af23b0a6Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2192af23b0a6Smrg#
2193af23b0a6SmrgAC_DEFUN([XORG_WITH_GROFF],[
2194af23b0a6SmrgAC_ARG_VAR([GROFF], [Path to groff command])
2195af23b0a6Smrgm4_define([_defopt], m4_default([$1], [auto]))
2196af23b0a6SmrgAC_ARG_WITH(groff,
2197af23b0a6Smrg	AS_HELP_STRING([--with-groff],
2198af23b0a6Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2199af23b0a6Smrg	   [use_groff=$withval], [use_groff=]_defopt)
2200af23b0a6Smrgm4_undefine([_defopt])
2201af23b0a6Smrg
2202af23b0a6Smrgif test "x$use_groff" = x"auto"; then
2203af23b0a6Smrg   AC_PATH_PROG([GROFF], [groff])
2204af23b0a6Smrg   if test "x$GROFF" = "x"; then
2205af23b0a6Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2206af23b0a6Smrg	have_groff=no
2207af23b0a6Smrg   else
2208af23b0a6Smrg        have_groff=yes
2209af23b0a6Smrg   fi
2210af23b0a6Smrgelif test "x$use_groff" = x"yes" ; then
2211af23b0a6Smrg   AC_PATH_PROG([GROFF], [groff])
2212af23b0a6Smrg   if test "x$GROFF" = "x"; then
2213af23b0a6Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2214af23b0a6Smrg   fi
2215af23b0a6Smrg   have_groff=yes
2216af23b0a6Smrgelif test "x$use_groff" = x"no" ; then
2217af23b0a6Smrg   if test "x$GROFF" != "x"; then
2218af23b0a6Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2219af23b0a6Smrg   fi
2220af23b0a6Smrg   have_groff=no
2221af23b0a6Smrgelse
2222af23b0a6Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2223af23b0a6Smrgfi
2224af23b0a6Smrg
2225af23b0a6Smrg# We have groff, test for the presence of the macro packages
2226af23b0a6Smrgif test "x$have_groff" = x"yes"; then
2227af23b0a6Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2228af23b0a6Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2229af23b0a6Smrg        groff_ms_works=yes
2230af23b0a6Smrg    else
2231af23b0a6Smrg        groff_ms_works=no
2232af23b0a6Smrg    fi
2233af23b0a6Smrg    AC_MSG_RESULT([$groff_ms_works])
2234af23b0a6Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2235af23b0a6Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2236af23b0a6Smrg        groff_mm_works=yes
2237af23b0a6Smrg    else
2238af23b0a6Smrg        groff_mm_works=no
2239af23b0a6Smrg    fi
2240af23b0a6Smrg    AC_MSG_RESULT([$groff_mm_works])
2241af23b0a6Smrgfi
2242af23b0a6Smrg
2243af23b0a6Smrg# We have groff, test for HTML dependencies, one command per package
2244af23b0a6Smrgif test "x$have_groff" = x"yes"; then
2245af23b0a6Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2246af23b0a6Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2247af23b0a6Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2248af23b0a6Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2249af23b0a6Smrg      have_groff_html=yes
2250af23b0a6Smrg   else
2251af23b0a6Smrg      have_groff_html=no
2252af23b0a6Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2253af23b0a6Smrg   fi
2254af23b0a6Smrgfi
2255af23b0a6Smrg
2256af23b0a6Smrg# Set Automake conditionals for Makefiles
2257af23b0a6SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2258af23b0a6SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2259af23b0a6SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2260af23b0a6SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2261af23b0a6Smrg]) # XORG_WITH_GROFF
2262af23b0a6Smrg
2263b4485a66Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2264b4485a66Smrg# ---------------------------------------
2265af23b0a6Smrg# Minimum version: 1.6.0
2266af23b0a6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2267b4485a66Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2268af23b0a6Smrg#
2269af23b0a6Smrg# Documentation tools are not always available on all platforms and sometimes
2270af23b0a6Smrg# not at the appropriate level. This macro enables a module to test for the
2271af23b0a6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2272affd2f3fSmrg# the --with-fop option, it allows maximum flexibility in making decisions
2273af23b0a6Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
2274af23b0a6Smrg# --with-fop assumes 'auto'.
2275af23b0a6Smrg#
2276af23b0a6Smrg# Interface to module:
2277af23b0a6Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2278af23b0a6Smrg# FOP:	 	returns the path of the fop program found
2279af23b0a6Smrg#		returns the path set by the user in the environment
2280af23b0a6Smrg# --with-fop: 	'yes' user instructs the module to use fop
2281af23b0a6Smrg#		'no' user instructs the module not to use fop
2282af23b0a6Smrg#
2283af23b0a6Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2284af23b0a6Smrg#
2285af23b0a6SmrgAC_DEFUN([XORG_WITH_FOP],[
2286af23b0a6SmrgAC_ARG_VAR([FOP], [Path to fop command])
2287b4485a66Smrgm4_define([_defopt], m4_default([$2], [auto]))
2288af23b0a6SmrgAC_ARG_WITH(fop,
2289af23b0a6Smrg	AS_HELP_STRING([--with-fop],
2290af23b0a6Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2291af23b0a6Smrg	   [use_fop=$withval], [use_fop=]_defopt)
2292af23b0a6Smrgm4_undefine([_defopt])
2293af23b0a6Smrg
2294af23b0a6Smrgif test "x$use_fop" = x"auto"; then
2295af23b0a6Smrg   AC_PATH_PROG([FOP], [fop])
2296af23b0a6Smrg   if test "x$FOP" = "x"; then
2297af23b0a6Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2298af23b0a6Smrg	have_fop=no
2299af23b0a6Smrg   else
2300af23b0a6Smrg        have_fop=yes
2301af23b0a6Smrg   fi
2302af23b0a6Smrgelif test "x$use_fop" = x"yes" ; then
2303af23b0a6Smrg   AC_PATH_PROG([FOP], [fop])
2304af23b0a6Smrg   if test "x$FOP" = "x"; then
2305af23b0a6Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2306af23b0a6Smrg   fi
2307af23b0a6Smrg   have_fop=yes
2308af23b0a6Smrgelif test "x$use_fop" = x"no" ; then
2309af23b0a6Smrg   if test "x$FOP" != "x"; then
2310af23b0a6Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2311af23b0a6Smrg   fi
2312af23b0a6Smrg   have_fop=no
2313af23b0a6Smrgelse
2314af23b0a6Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2315af23b0a6Smrgfi
2316b4485a66Smrg
2317b4485a66Smrg# Test for a minimum version of fop, if provided.
2318b4485a66Smrgm4_ifval([$1],
2319b4485a66Smrg[if test "$have_fop" = yes; then
2320b4485a66Smrg    # scrape the fop version
2321b4485a66Smrg    AC_MSG_CHECKING([for fop minimum version])
2322b4485a66Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2323b4485a66Smrg    AC_MSG_RESULT([$fop_version])
2324b4485a66Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2325b4485a66Smrg        [if test "x$use_fop" = xauto; then
2326b4485a66Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2327b4485a66Smrg            have_fop=no
2328b4485a66Smrg        else
2329b4485a66Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2330b4485a66Smrg        fi])
2331b4485a66Smrgfi])
2332af23b0a6SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2333af23b0a6Smrg]) # XORG_WITH_FOP
2334af23b0a6Smrg
2335945aa7e3Smrg# XORG_WITH_M4([MIN-VERSION])
2336945aa7e3Smrg# ---------------------------
2337945aa7e3Smrg# Minimum version: 1.19.0
2338945aa7e3Smrg#
2339945aa7e3Smrg# This macro attempts to locate an m4 macro processor which supports
2340945aa7e3Smrg# -I option and is only useful for modules relying on M4 in order to
2341945aa7e3Smrg# expand macros in source code files.
2342945aa7e3Smrg#
2343945aa7e3Smrg# Interface to module:
2344945aa7e3Smrg# M4:	 	returns the path of the m4 program found
2345945aa7e3Smrg#		returns the path set by the user in the environment
2346945aa7e3Smrg#
2347945aa7e3SmrgAC_DEFUN([XORG_WITH_M4], [
2348945aa7e3SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2349945aa7e3Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2350945aa7e3Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2351945aa7e3Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2352945aa7e3Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2353945aa7e3Smrg   [$PATH:/usr/gnu/bin])])
2354945aa7e3Smrg
2355945aa7e3SmrgAC_SUBST([M4], [$ac_cv_path_M4])
2356945aa7e3Smrg]) # XORG_WITH_M4
2357945aa7e3Smrg
2358af23b0a6Smrg# XORG_WITH_PS2PDF([DEFAULT])
2359af23b0a6Smrg# ----------------
2360af23b0a6Smrg# Minimum version: 1.6.0
2361af23b0a6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2362af23b0a6Smrg#
2363af23b0a6Smrg# Documentation tools are not always available on all platforms and sometimes
2364af23b0a6Smrg# not at the appropriate level. This macro enables a module to test for the
2365af23b0a6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2366affd2f3fSmrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
2367af23b0a6Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2368af23b0a6Smrg# --with-ps2pdf assumes 'auto'.
2369af23b0a6Smrg#
2370af23b0a6Smrg# Interface to module:
2371af23b0a6Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2372af23b0a6Smrg# PS2PDF:	returns the path of the ps2pdf program found
2373af23b0a6Smrg#		returns the path set by the user in the environment
2374af23b0a6Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2375af23b0a6Smrg#		 'no' user instructs the module not to use ps2pdf
2376af23b0a6Smrg#
2377af23b0a6Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2378af23b0a6Smrg#
2379af23b0a6SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2380af23b0a6SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2381af23b0a6Smrgm4_define([_defopt], m4_default([$1], [auto]))
2382af23b0a6SmrgAC_ARG_WITH(ps2pdf,
2383af23b0a6Smrg	AS_HELP_STRING([--with-ps2pdf],
2384af23b0a6Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2385af23b0a6Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2386af23b0a6Smrgm4_undefine([_defopt])
2387af23b0a6Smrg
2388af23b0a6Smrgif test "x$use_ps2pdf" = x"auto"; then
2389af23b0a6Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2390af23b0a6Smrg   if test "x$PS2PDF" = "x"; then
2391af23b0a6Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2392af23b0a6Smrg	have_ps2pdf=no
2393af23b0a6Smrg   else
2394af23b0a6Smrg        have_ps2pdf=yes
2395af23b0a6Smrg   fi
2396af23b0a6Smrgelif test "x$use_ps2pdf" = x"yes" ; then
2397af23b0a6Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2398af23b0a6Smrg   if test "x$PS2PDF" = "x"; then
2399af23b0a6Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2400af23b0a6Smrg   fi
2401af23b0a6Smrg   have_ps2pdf=yes
2402af23b0a6Smrgelif test "x$use_ps2pdf" = x"no" ; then
2403af23b0a6Smrg   if test "x$PS2PDF" != "x"; then
2404af23b0a6Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2405af23b0a6Smrg   fi
2406af23b0a6Smrg   have_ps2pdf=no
2407af23b0a6Smrgelse
2408af23b0a6Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2409af23b0a6Smrgfi
2410af23b0a6SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2411af23b0a6Smrg]) # XORG_WITH_PS2PDF
2412af23b0a6Smrg
2413af23b0a6Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
2414af23b0a6Smrg# ----------------
2415af23b0a6Smrg# Minimum version: 1.6.0
2416af23b0a6Smrg#
2417af23b0a6Smrg# Documentation tools are not always available on all platforms and sometimes
2418af23b0a6Smrg# not at the appropriate level. This macro enables a builder to skip all
2419af23b0a6Smrg# documentation targets except traditional man pages.
2420af23b0a6Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2421affd2f3fSmrg# maximum flexibility in controlling documentation building.
2422af23b0a6Smrg# Refer to:
2423af23b0a6Smrg# XORG_WITH_XMLTO         --with-xmlto
2424af23b0a6Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2425af23b0a6Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2426af23b0a6Smrg# XORG_WITH_FOP           --with-fop
2427af23b0a6Smrg# XORG_WITH_GROFF         --with-groff
2428af23b0a6Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2429af23b0a6Smrg#
2430af23b0a6Smrg# Interface to module:
2431af23b0a6Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2432af23b0a6Smrg# --enable-docs: 'yes' user instructs the module to generate docs
2433af23b0a6Smrg#		 'no' user instructs the module not to generate docs
2434af23b0a6Smrg# parm1:	specify the default value, yes or no.
2435af23b0a6Smrg#
2436af23b0a6SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2437b4485a66Smrgm4_define([docs_default], m4_default([$1], [yes]))
2438af23b0a6SmrgAC_ARG_ENABLE(docs,
2439af23b0a6Smrg	AS_HELP_STRING([--enable-docs],
2440b4485a66Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2441b4485a66Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2442b4485a66Smrgm4_undefine([docs_default])
2443af23b0a6SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2444af23b0a6SmrgAC_MSG_CHECKING([whether to build documentation])
2445af23b0a6SmrgAC_MSG_RESULT([$build_docs])
2446af23b0a6Smrg]) # XORG_ENABLE_DOCS
2447af23b0a6Smrg
2448af23b0a6Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2449af23b0a6Smrg# ----------------
2450af23b0a6Smrg# Minimum version: 1.6.0
2451af23b0a6Smrg#
2452af23b0a6Smrg# This macro enables a builder to skip all developer documentation.
2453af23b0a6Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2454affd2f3fSmrg# maximum flexibility in controlling documentation building.
2455af23b0a6Smrg# Refer to:
2456af23b0a6Smrg# XORG_WITH_XMLTO         --with-xmlto
2457af23b0a6Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2458af23b0a6Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2459af23b0a6Smrg# XORG_WITH_FOP           --with-fop
2460af23b0a6Smrg# XORG_WITH_GROFF         --with-groff
2461af23b0a6Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2462af23b0a6Smrg#
2463af23b0a6Smrg# Interface to module:
2464af23b0a6Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2465af23b0a6Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2466af23b0a6Smrg#			'no' user instructs the module not to generate developer docs
2467af23b0a6Smrg# parm1:		specify the default value, yes or no.
2468af23b0a6Smrg#
2469af23b0a6SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2470af23b0a6Smrgm4_define([devel_default], m4_default([$1], [yes]))
2471af23b0a6SmrgAC_ARG_ENABLE(devel-docs,
2472af23b0a6Smrg	AS_HELP_STRING([--enable-devel-docs],
2473af23b0a6Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2474af23b0a6Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2475af23b0a6Smrgm4_undefine([devel_default])
2476af23b0a6SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2477af23b0a6SmrgAC_MSG_CHECKING([whether to build developer documentation])
2478af23b0a6SmrgAC_MSG_RESULT([$build_devel_docs])
2479af23b0a6Smrg]) # XORG_ENABLE_DEVEL_DOCS
2480af23b0a6Smrg
2481af23b0a6Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2482af23b0a6Smrg# ----------------
2483af23b0a6Smrg# Minimum version: 1.6.0
2484af23b0a6Smrg#
2485af23b0a6Smrg# This macro enables a builder to skip all functional specification targets.
2486af23b0a6Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2487affd2f3fSmrg# maximum flexibility in controlling documentation building.
2488af23b0a6Smrg# Refer to:
2489af23b0a6Smrg# XORG_WITH_XMLTO         --with-xmlto
2490af23b0a6Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2491af23b0a6Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2492af23b0a6Smrg# XORG_WITH_FOP           --with-fop
2493af23b0a6Smrg# XORG_WITH_GROFF         --with-groff
2494af23b0a6Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2495af23b0a6Smrg#
2496af23b0a6Smrg# Interface to module:
2497af23b0a6Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2498af23b0a6Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2499af23b0a6Smrg#			'no' user instructs the module not to generate specs
2500af23b0a6Smrg# parm1:		specify the default value, yes or no.
2501af23b0a6Smrg#
2502af23b0a6SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2503af23b0a6Smrgm4_define([spec_default], m4_default([$1], [yes]))
2504af23b0a6SmrgAC_ARG_ENABLE(specs,
2505af23b0a6Smrg	AS_HELP_STRING([--enable-specs],
2506af23b0a6Smrg	   [Enable building the specs (default: ]spec_default[)]),
2507af23b0a6Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2508af23b0a6Smrgm4_undefine([spec_default])
2509af23b0a6SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2510af23b0a6SmrgAC_MSG_CHECKING([whether to build functional specifications])
2511af23b0a6SmrgAC_MSG_RESULT([$build_specs])
2512af23b0a6Smrg]) # XORG_ENABLE_SPECS
2513af23b0a6Smrg
2514b4485a66Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2515b4485a66Smrg# ----------------------------------------------
2516b4485a66Smrg# Minimum version: 1.13.0
2517b4485a66Smrg#
2518b4485a66Smrg# This macro enables a builder to enable/disable unit testing
2519b4485a66Smrg# It makes no assumption about the test cases implementation
2520b4485a66Smrg# Test cases may or may not use Automake "Support for test suites"
2521b4485a66Smrg# They may or may not use the software utility library GLib
2522b4485a66Smrg#
2523b4485a66Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2524b4485a66Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2525b4485a66Smrg# The variable enable_unit_tests is used by other macros in this file.
2526b4485a66Smrg#
2527b4485a66Smrg# Interface to module:
2528b4485a66Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2529b4485a66Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2530b4485a66Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2531b4485a66Smrg#			'no' user instructs the module not to build tests
2532b4485a66Smrg# parm1:		specify the default value, yes or no.
2533b4485a66Smrg#
2534b4485a66SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2535b4485a66SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2536b4485a66SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2537b4485a66SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2538b4485a66Smrgm4_define([_defopt], m4_default([$1], [auto]))
2539b4485a66SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2540b4485a66Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2541b4485a66Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2542b4485a66Smrgm4_undefine([_defopt])
2543b4485a66SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2544b4485a66SmrgAC_MSG_CHECKING([whether to build unit test cases])
2545b4485a66SmrgAC_MSG_RESULT([$enable_unit_tests])
2546b4485a66Smrg]) # XORG_ENABLE_UNIT_TESTS
2547b4485a66Smrg
2548b4485a66Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2549b4485a66Smrg# ------------------------------------------------------
2550b4485a66Smrg# Minimum version: 1.17.0
2551b4485a66Smrg#
2552b4485a66Smrg# This macro enables a builder to enable/disable integration testing
2553b4485a66Smrg# It makes no assumption about the test cases' implementation
2554b4485a66Smrg# Test cases may or may not use Automake "Support for test suites"
2555b4485a66Smrg#
2556b4485a66Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2557b4485a66Smrg# usually requires less dependencies and may be built and run under less
2558b4485a66Smrg# stringent environments than integration tests.
2559b4485a66Smrg#
2560b4485a66Smrg# Interface to module:
2561b4485a66Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2562b4485a66Smrg# enable_integration_tests:   used in configure.ac for additional configuration
2563b4485a66Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2564b4485a66Smrg#                             'no' user instructs the module not to build tests
2565b4485a66Smrg# parm1:                      specify the default value, yes or no.
2566b4485a66Smrg#
2567b4485a66SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2568b4485a66SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2569b4485a66Smrgm4_define([_defopt], m4_default([$1], [auto]))
2570b4485a66SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2571b4485a66Smrg	[Enable building integration test cases (default: ]_defopt[)]),
2572b4485a66Smrg	[enable_integration_tests=$enableval],
2573b4485a66Smrg	[enable_integration_tests=]_defopt)
2574b4485a66Smrgm4_undefine([_defopt])
2575b4485a66SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2576b4485a66Smrg	[test "x$enable_integration_tests" != xno])
2577b4485a66SmrgAC_MSG_CHECKING([whether to build unit test cases])
2578b4485a66SmrgAC_MSG_RESULT([$enable_integration_tests])
2579b4485a66Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2580b4485a66Smrg
2581b4485a66Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2582b4485a66Smrg# ----------------------------------------
2583b4485a66Smrg# Minimum version: 1.13.0
2584b4485a66Smrg#
2585b4485a66Smrg# GLib is a library which provides advanced data structures and functions.
2586b4485a66Smrg# This macro enables a module to test for the presence of Glib.
2587b4485a66Smrg#
2588b4485a66Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2589b4485a66Smrg# Otherwise the value of $enable_unit_tests is blank.
2590b4485a66Smrg#
2591b4485a66Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2592b4485a66Smrg# test support usually requires less dependencies and may be built and run under
2593b4485a66Smrg# less stringent environments than integration tests.
2594b4485a66Smrg#
2595b4485a66Smrg# Interface to module:
2596b4485a66Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2597b4485a66Smrg# with_glib: used in configure.ac to know if GLib has been found
2598b4485a66Smrg# --with-glib:	'yes' user instructs the module to use glib
2599b4485a66Smrg#		'no' user instructs the module not to use glib
2600b4485a66Smrg#
2601b4485a66SmrgAC_DEFUN([XORG_WITH_GLIB],[
2602b4485a66SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2603b4485a66Smrgm4_define([_defopt], m4_default([$2], [auto]))
2604b4485a66SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2605b4485a66Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2606b4485a66Smrg	[with_glib=$withval], [with_glib=]_defopt)
2607b4485a66Smrgm4_undefine([_defopt])
2608b4485a66Smrg
2609b4485a66Smrghave_glib=no
2610b4485a66Smrg# Do not probe GLib if user explicitly disabled unit testing
2611b4485a66Smrgif test "x$enable_unit_tests" != x"no"; then
2612b4485a66Smrg  # Do not probe GLib if user explicitly disabled it
2613b4485a66Smrg  if test "x$with_glib" != x"no"; then
2614b4485a66Smrg    m4_ifval(
2615b4485a66Smrg      [$1],
2616b4485a66Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2617b4485a66Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2618b4485a66Smrg    )
2619b4485a66Smrg  fi
2620b4485a66Smrgfi
2621b4485a66Smrg
2622b4485a66Smrg# Not having GLib when unit testing has been explicitly requested is an error
2623b4485a66Smrgif test "x$enable_unit_tests" = x"yes"; then
2624b4485a66Smrg  if test "x$have_glib" = x"no"; then
2625b4485a66Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2626b4485a66Smrg  fi
2627b4485a66Smrgfi
2628b4485a66Smrg
2629b4485a66Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2630b4485a66Smrgif test "x$enable_unit_tests" = x"no"; then
2631b4485a66Smrg  if test "x$with_glib" = x"yes"; then
2632b4485a66Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2633b4485a66Smrg  fi
2634b4485a66Smrgfi
2635b4485a66Smrg
2636b4485a66Smrg# Not having GLib when it has been explicitly requested is an error
2637b4485a66Smrgif test "x$with_glib" = x"yes"; then
2638b4485a66Smrg  if test "x$have_glib" = x"no"; then
2639b4485a66Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2640b4485a66Smrg  fi
2641b4485a66Smrgfi
2642b4485a66Smrg
2643b4485a66SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2644b4485a66Smrg]) # XORG_WITH_GLIB
2645b4485a66Smrg
2646b4485a66Smrg# XORG_LD_WRAP([required|optional])
2647b4485a66Smrg# ---------------------------------
2648b4485a66Smrg# Minimum version: 1.13.0
2649b4485a66Smrg#
2650b4485a66Smrg# Check if linker supports -wrap, passed via compiler flags
2651b4485a66Smrg#
2652b4485a66Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2653b4485a66Smrg# Otherwise the value of $enable_unit_tests is blank.
2654b4485a66Smrg#
2655b4485a66Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2656b4485a66Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2657b4485a66Smrg# available, an argument of "optional" allows use when some unit tests require
2658b4485a66Smrg# ld -wrap and others do not.
2659b4485a66Smrg#
2660b4485a66SmrgAC_DEFUN([XORG_LD_WRAP],[
2661b4485a66SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2662b4485a66Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2663b4485a66Smrg                      void __wrap_exit(int status) { return; }],
2664b4485a66Smrg                     [exit(0);])])
2665b4485a66Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2666b4485a66Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2667b4485a66Smrg  if test "x$have_ld_wrap" = x"no"; then
2668b4485a66Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2669b4485a66Smrg  fi
2670b4485a66Smrgfi
2671b4485a66SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2672b4485a66Smrg#
2673b4485a66Smrg]) # XORG_LD_WRAP
2674b4485a66Smrg
2675b4485a66Smrg# XORG_CHECK_LINKER_FLAGS
2676b4485a66Smrg# -----------------------
2677b4485a66Smrg# SYNOPSIS
2678b4485a66Smrg#
2679b4485a66Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2680b4485a66Smrg#
2681b4485a66Smrg# DESCRIPTION
2682b4485a66Smrg#
2683b4485a66Smrg#   Check whether the given linker FLAGS work with the current language's
2684b4485a66Smrg#   linker, or whether they give an error.
2685b4485a66Smrg#
2686b4485a66Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2687b4485a66Smrg#   success/failure.
2688b4485a66Smrg#
2689b4485a66Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2690b4485a66Smrg#
2691b4485a66Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2692b4485a66Smrg#
2693b4485a66Smrg# LICENSE
2694b4485a66Smrg#
2695b4485a66Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2696b4485a66Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2697b4485a66Smrg#   Copyright (c) 2009 Matteo Frigo
2698b4485a66Smrg#
2699b4485a66Smrg#   This program is free software: you can redistribute it and/or modify it
2700b4485a66Smrg#   under the terms of the GNU General Public License as published by the
2701b4485a66Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2702b4485a66Smrg#   option) any later version.
2703b4485a66Smrg#
2704b4485a66Smrg#   This program is distributed in the hope that it will be useful, but
2705b4485a66Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2706b4485a66Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2707b4485a66Smrg#   Public License for more details.
2708b4485a66Smrg#
2709b4485a66Smrg#   You should have received a copy of the GNU General Public License along
2710b4485a66Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2711b4485a66Smrg#
2712b4485a66Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2713b4485a66Smrg#   gives unlimited permission to copy, distribute and modify the configure
2714b4485a66Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2715b4485a66Smrg#   need not follow the terms of the GNU General Public License when using
2716b4485a66Smrg#   or distributing such scripts, even though portions of the text of the
2717b4485a66Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2718b4485a66Smrg#   all other use of the material that constitutes the Autoconf Macro.
2719b4485a66Smrg#
2720b4485a66Smrg#   This special exception to the GPL applies to versions of the Autoconf
2721b4485a66Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2722b4485a66Smrg#   modified version of the Autoconf Macro, you may extend this special
2723b4485a66Smrg#   exception to the GPL to apply to your modified version as well.#
2724b4485a66SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2725b4485a66Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2726b4485a66Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2727b4485a66SmrgAS_LITERAL_IF([$1],
2728b4485a66Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2729b4485a66Smrg      ax_save_FLAGS=$LDFLAGS
2730b4485a66Smrg      LDFLAGS="$1"
2731b4485a66Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2732b4485a66Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2733b4485a66Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2734b4485a66Smrg      LDFLAGS=$ax_save_FLAGS])],
2735b4485a66Smrg  [ax_save_FLAGS=$LDFLAGS
2736b4485a66Smrg   LDFLAGS="$1"
2737b4485a66Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2738b4485a66Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2739b4485a66Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2740b4485a66Smrg   LDFLAGS=$ax_save_FLAGS])
2741b4485a66Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2742b4485a66SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2743b4485a66Smrgif test "x$xorg_check_linker_flags" = xyes; then
2744b4485a66Smrg	m4_default([$2], :)
2745b4485a66Smrgelse
2746b4485a66Smrg	m4_default([$3], :)
2747b4485a66Smrgfi
2748b4485a66Smrg]) # XORG_CHECK_LINKER_FLAGS
2749b4485a66Smrg
2750b4485a66Smrg# XORG_MEMORY_CHECK_FLAGS
2751b4485a66Smrg# -----------------------
2752b4485a66Smrg# Minimum version: 1.16.0
2753b4485a66Smrg#
2754b4485a66Smrg# This macro attempts to find appropriate memory checking functionality
2755b4485a66Smrg# for various platforms which unit testing code may use to catch various
2756b4485a66Smrg# forms of memory allocation and access errors in testing.
2757b4485a66Smrg#
2758b4485a66Smrg# Interface to module:
2759b4485a66Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2760b4485a66Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2761b4485a66Smrg#
2762b4485a66Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2763b4485a66Smrg#
2764b4485a66SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2765b4485a66Smrg
2766b4485a66SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2767b4485a66SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2768b4485a66Smrg           [Environment variables to enable memory checking in tests])
2769b4485a66Smrg
2770b4485a66Smrg# Check for different types of support on different platforms
2771b4485a66Smrgcase $host_os in
2772b4485a66Smrg    solaris*)
2773b4485a66Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2774b4485a66Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2775b4485a66Smrg        ;;
2776b4485a66Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2777b4485a66Smrg        # both directly and inverted, so should not be 0 or 255.
2778b4485a66Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2779b4485a66Smrg        ;;
2780b4485a66Smrg    darwin*)
2781b4485a66Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2782b4485a66Smrg        ;;
2783b4485a66Smrg    *bsd*)
2784b4485a66Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2785b4485a66Smrg        ;;
2786b4485a66Smrgesac
2787b4485a66Smrg
2788b4485a66Smrg# User supplied flags override default flags
2789b4485a66Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2790b4485a66Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2791b4485a66Smrgfi
2792b4485a66Smrg
2793b4485a66SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2794b4485a66Smrg]) # XORG_WITH_LINT
2795b4485a66Smrg
2796b3eb03f3Smrg# XORG_CHECK_MALLOC_ZERO
2797b3eb03f3Smrg# ----------------------
2798b3eb03f3Smrg# Minimum version: 1.0.0
2799b3eb03f3Smrg#
2800b3eb03f3Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2801b3eb03f3Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2802b3eb03f3Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2803b3eb03f3SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2804b3eb03f3SmrgAC_ARG_ENABLE(malloc0returnsnull,
2805b3eb03f3Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2806b3eb03f3Smrg		       [malloc(0) returns NULL (default: auto)]),
2807b3eb03f3Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2808b3eb03f3Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2809b3eb03f3Smrg
2810b3eb03f3SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2811b3eb03f3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2812945aa7e3SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
2813945aa7e3Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2814b4485a66Smrg#include <stdlib.h>
2815b4485a66Smrg],[
2816b3eb03f3Smrg    char *m0, *r0, *c0, *p;
2817b3eb03f3Smrg    m0 = malloc(0);
2818b3eb03f3Smrg    p = malloc(10);
2819b3eb03f3Smrg    r0 = realloc(p,0);
2820b4485a66Smrg    c0 = calloc(0,10);
2821b4485a66Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2822b4485a66Smrg])],
2823945aa7e3Smrg		[xorg_cv_malloc0_returns_null=yes],
2824945aa7e3Smrg		[xorg_cv_malloc0_returns_null=no])])
2825945aa7e3SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2826b3eb03f3Smrgfi
2827b3eb03f3SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2828010cdda0Smrg
2829b3eb03f3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2830b3eb03f3Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2831b3eb03f3Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2832b3eb03f3Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2833b3eb03f3Smrgelse
2834b3eb03f3Smrg	MALLOC_ZERO_CFLAGS=""
2835b3eb03f3Smrg	XMALLOC_ZERO_CFLAGS=""
2836b3eb03f3Smrg	XTMALLOC_ZERO_CFLAGS=""
2837b3eb03f3Smrgfi
2838010cdda0Smrg
2839b3eb03f3SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2840b3eb03f3SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2841b3eb03f3SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2842b3eb03f3Smrg]) # XORG_CHECK_MALLOC_ZERO
2843010cdda0Smrg
2844b3eb03f3Smrg# XORG_WITH_LINT()
2845b3eb03f3Smrg# ----------------
2846b3eb03f3Smrg# Minimum version: 1.1.0
2847b3eb03f3Smrg#
2848af23b0a6Smrg# This macro enables the use of a tool that flags some suspicious and
2849af23b0a6Smrg# non-portable constructs (likely to be bugs) in C language source code.
2850af23b0a6Smrg# It will attempt to locate the tool and use appropriate options.
2851af23b0a6Smrg# There are various lint type tools on different platforms.
2852af23b0a6Smrg#
2853af23b0a6Smrg# Interface to module:
2854af23b0a6Smrg# LINT:		returns the path to the tool found on the platform
2855af23b0a6Smrg#		or the value set to LINT on the configure cmd line
2856af23b0a6Smrg#		also an Automake conditional
2857af23b0a6Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
2858af23b0a6Smrg#
2859af23b0a6Smrg# --with-lint:	'yes' user instructs the module to use lint
2860af23b0a6Smrg#		'no' user instructs the module not to use lint (default)
2861af23b0a6Smrg#
2862af23b0a6Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2863af23b0a6Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2864b3eb03f3Smrg#
2865b3eb03f3SmrgAC_DEFUN([XORG_WITH_LINT],[
2866b3eb03f3Smrg
2867af23b0a6SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2868af23b0a6SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2869b3eb03f3SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2870b3eb03f3Smrg		[Use a lint-style source code checker (default: disabled)])],
2871b3eb03f3Smrg		[use_lint=$withval], [use_lint=no])
2872af23b0a6Smrg
2873af23b0a6Smrg# Obtain platform specific info like program name and options
2874af23b0a6Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2875af23b0a6Smrgcase $host_os in
2876af23b0a6Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2877af23b0a6Smrg	lint_name=splint
2878af23b0a6Smrg	lint_options="-badflag"
2879af23b0a6Smrg	;;
2880af23b0a6Smrg  *freebsd* | *netbsd*)
2881af23b0a6Smrg	lint_name=lint
2882af23b0a6Smrg	lint_options="-u -b"
2883af23b0a6Smrg	;;
2884af23b0a6Smrg  *solaris*)
2885af23b0a6Smrg	lint_name=lint
2886af23b0a6Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2887af23b0a6Smrg	;;
2888af23b0a6Smrgesac
2889af23b0a6Smrg
2890af23b0a6Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2891af23b0a6Smrgif test "x$use_lint" = x"yes" ; then
2892af23b0a6Smrg   AC_PATH_PROG([LINT], [$lint_name])
2893af23b0a6Smrg   if test "x$LINT" = "x"; then
2894af23b0a6Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2895af23b0a6Smrg   fi
2896af23b0a6Smrgelif test "x$use_lint" = x"no" ; then
2897af23b0a6Smrg   if test "x$LINT" != "x"; then
2898af23b0a6Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2899af23b0a6Smrg   fi
2900b3eb03f3Smrgelse
2901af23b0a6Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2902b3eb03f3Smrgfi
2903af23b0a6Smrg
2904af23b0a6Smrg# User supplied flags override default flags
2905af23b0a6Smrgif test "x$LINT_FLAGS" != "x"; then
2906af23b0a6Smrg   lint_options=$LINT_FLAGS
2907b3eb03f3Smrgfi
2908010cdda0Smrg
2909af23b0a6SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2910af23b0a6SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2911010cdda0Smrg
2912b3eb03f3Smrg]) # XORG_WITH_LINT
2913010cdda0Smrg
2914b3eb03f3Smrg# XORG_LINT_LIBRARY(LIBNAME)
2915b3eb03f3Smrg# --------------------------
2916b3eb03f3Smrg# Minimum version: 1.1.0
2917b3eb03f3Smrg#
2918b3eb03f3Smrg# Sets up flags for building lint libraries for checking programs that call
2919b3eb03f3Smrg# functions in the library.
2920b3eb03f3Smrg#
2921af23b0a6Smrg# Interface to module:
2922af23b0a6Smrg# LINTLIB		- Automake variable with the name of lint library file to make
2923af23b0a6Smrg# MAKE_LINT_LIB		- Automake conditional
2924af23b0a6Smrg#
2925af23b0a6Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2926af23b0a6Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2927010cdda0Smrg
2928b3eb03f3SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2929b3eb03f3SmrgAC_REQUIRE([XORG_WITH_LINT])
2930b3eb03f3SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2931b3eb03f3Smrg	[Create lint library (default: disabled)])],
2932b3eb03f3Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2933af23b0a6Smrg
2934af23b0a6Smrgif test "x$make_lint_lib" = x"yes" ; then
2935af23b0a6Smrg   LINTLIB=llib-l$1.ln
2936af23b0a6Smrg   if test "x$LINT" = "x"; then
2937af23b0a6Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2938af23b0a6Smrg   fi
2939af23b0a6Smrgelif test "x$make_lint_lib" != x"no" ; then
2940af23b0a6Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2941b3eb03f3Smrgfi
2942af23b0a6Smrg
2943b3eb03f3SmrgAC_SUBST(LINTLIB)
2944b3eb03f3SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2945010cdda0Smrg
2946b3eb03f3Smrg]) # XORG_LINT_LIBRARY
2947010cdda0Smrg
2948b4485a66Smrg# XORG_COMPILER_BRAND
2949b4485a66Smrg# -------------------
2950b4485a66Smrg# Minimum version: 1.14.0
2951b4485a66Smrg#
2952b4485a66Smrg# Checks for various brands of compilers and sets flags as appropriate:
2953b4485a66Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2954b4485a66Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2955b4485a66Smrg#   clang compiler - sets CLANGCC to "yes"
2956b4485a66Smrg#   Intel compiler - sets INTELCC to "yes"
2957b4485a66Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2958b4485a66Smrg#
2959b4485a66SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2960b4485a66SmrgAC_LANG_CASE(
2961b4485a66Smrg	[C], [
2962affd2f3fSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
2963affd2f3fSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
2964affd2f3fSmrg		m4_version_prereq([2.70],
2965affd2f3fSmrg			[AC_REQUIRE([AC_PROG_CC])],
2966affd2f3fSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
2967b4485a66Smrg	],
2968b4485a66Smrg	[C++], [
2969b4485a66Smrg		AC_REQUIRE([AC_PROG_CXX])
2970b4485a66Smrg	]
2971b4485a66Smrg)
2972b4485a66SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2973b4485a66SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2974b4485a66SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2975b4485a66Smrg]) # XORG_COMPILER_BRAND
2976b4485a66Smrg
2977b4485a66Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2978b4485a66Smrg# ---------------
2979b4485a66Smrg# Minimum version: 1.16.0
2980b4485a66Smrg#
2981b4485a66Smrg# Test if the compiler works when passed the given flag as a command line argument.
2982affd2f3fSmrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
2983b4485a66Smrg# next flag in the list until there are no more options.
2984b4485a66Smrg#
2985b4485a66Smrg# Note that this does not guarantee that the compiler supports the flag as some
2986b4485a66Smrg# compilers will simply ignore arguments that they do not understand, but we do
2987b4485a66Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2988b4485a66Smrg# -Werror=unused-command-line-argument
2989b4485a66Smrg#
2990b4485a66SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2991b4485a66Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2992b4485a66Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2993b4485a66Smrg
2994b4485a66SmrgAC_LANG_COMPILER_REQUIRE
2995b4485a66Smrg
2996b4485a66SmrgAC_LANG_CASE(
2997b4485a66Smrg	[C], [
2998affd2f3fSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
2999affd2f3fSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3000affd2f3fSmrg		m4_version_prereq([2.70],
3001affd2f3fSmrg			[AC_REQUIRE([AC_PROG_CC])],
3002affd2f3fSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3003b4485a66Smrg		define([PREFIX], [C])
3004b4485a66Smrg		define([CACHE_PREFIX], [cc])
3005b4485a66Smrg		define([COMPILER], [$CC])
3006b4485a66Smrg	],
3007b4485a66Smrg	[C++], [
3008b4485a66Smrg		define([PREFIX], [CXX])
3009b4485a66Smrg		define([CACHE_PREFIX], [cxx])
3010b4485a66Smrg		define([COMPILER], [$CXX])
3011b4485a66Smrg	]
3012b4485a66Smrg)
3013b4485a66Smrg
3014b4485a66Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
3015b4485a66Smrg
3016b4485a66Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
3017b4485a66Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3018b4485a66Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
3019b4485a66Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3020b4485a66Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3021b4485a66Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
3022b4485a66Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
3023b4485a66Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
3024b4485a66Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3025b4485a66Smrgfi
3026b4485a66Smrg
3027b4485a66Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
3028b4485a66Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
3029b4485a66Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3030b4485a66Smrg	fi
3031b4485a66Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3032b4485a66Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
3033b4485a66Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3034b4485a66Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3035b4485a66Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
3036b4485a66Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
3037b4485a66Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
3038b4485a66Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3039b4485a66Smrgfi
3040b4485a66Smrg
3041b4485a66Smrgfound="no"
3042b4485a66Smrgm4_foreach([flag], m4_cdr($@), [
3043b4485a66Smrg	if test $found = "no" ; then
3044945aa7e3Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
3045b4485a66Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3046b4485a66Smrg		fi
3047b4485a66Smrg
3048945aa7e3Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
3049b4485a66Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3050b4485a66Smrg		fi
3051b4485a66Smrg
3052b4485a66Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
3053b4485a66Smrg
3054b4485a66Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
3055b4485a66Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
3056b4485a66Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
3057b4485a66Smrg		AC_CACHE_VAL($cacheid,
3058b4485a66Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3059b4485a66Smrg					     [eval $cacheid=yes],
3060b4485a66Smrg					     [eval $cacheid=no])])
3061b4485a66Smrg
3062b4485a66Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3063b4485a66Smrg
3064b4485a66Smrg		eval supported=\$$cacheid
3065b4485a66Smrg		AC_MSG_RESULT([$supported])
3066b4485a66Smrg		if test "$supported" = "yes" ; then
3067b4485a66Smrg			$1="$$1 ]flag["
3068b4485a66Smrg			found="yes"
3069b4485a66Smrg		fi
3070b4485a66Smrg	fi
3071b4485a66Smrg])
3072b4485a66Smrg]) # XORG_TESTSET_CFLAG
3073b4485a66Smrg
3074b4485a66Smrg# XORG_COMPILER_FLAGS
3075b4485a66Smrg# ---------------
3076b4485a66Smrg# Minimum version: 1.16.0
3077b4485a66Smrg#
3078b4485a66Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
3079b4485a66Smrg# arguments supported by the selected compiler which do NOT alter the generated
3080b4485a66Smrg# code.  These arguments will cause the compiler to print various warnings
3081b4485a66Smrg# during compilation AND turn a conservative set of warnings into errors.
3082b4485a66Smrg#
3083b4485a66Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
3084b4485a66Smrg# future versions of util-macros as options are added to new compilers.
3085b4485a66Smrg#
3086b4485a66SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
3087b4485a66SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3088b4485a66Smrg
3089b4485a66SmrgAC_ARG_ENABLE(selective-werror,
3090b4485a66Smrg              AS_HELP_STRING([--disable-selective-werror],
3091b4485a66Smrg                             [Turn off selective compiler errors. (default: enabled)]),
3092b4485a66Smrg              [SELECTIVE_WERROR=$enableval],
3093b4485a66Smrg              [SELECTIVE_WERROR=yes])
3094b4485a66Smrg
3095b4485a66SmrgAC_LANG_CASE(
3096b4485a66Smrg        [C], [
3097b4485a66Smrg                define([PREFIX], [C])
3098b4485a66Smrg        ],
3099b4485a66Smrg        [C++], [
3100b4485a66Smrg                define([PREFIX], [CXX])
3101b4485a66Smrg        ]
3102b4485a66Smrg)
3103b4485a66Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
3104b4485a66Smrgif test "x$SUNCC" = "xyes"; then
3105b4485a66Smrg    [BASE_]PREFIX[FLAGS]="-v"
3106b4485a66Smrgelse
3107b4485a66Smrg    [BASE_]PREFIX[FLAGS]=""
3108b4485a66Smrgfi
3109b4485a66Smrg
3110b4485a66Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3111b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
3112b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
3113b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
3114b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3115b4485a66Smrg
3116b4485a66SmrgAC_LANG_CASE(
3117b4485a66Smrg	[C], [
3118b4485a66Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
3119b4485a66Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
3120b4485a66Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
3121b4485a66Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
3122945aa7e3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
3123b4485a66Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
3124b4485a66Smrg	]
3125b4485a66Smrg)
3126b4485a66Smrg
3127b4485a66Smrg# This chunk adds additional warnings that could catch undesired effects.
3128b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
3129b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
3130b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
3131b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
3132b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
3133b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
3134945aa7e3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3135b4485a66Smrg
3136b4485a66Smrg# These are currently disabled because they are noisy.  They will be enabled
3137b4485a66Smrg# in the future once the codebase is sufficiently modernized to silence
3138b4485a66Smrg# them.  For now, I don't want them to drown out the other warnings.
3139b4485a66Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3140b4485a66Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3141945aa7e3Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3142b4485a66Smrg
3143affd2f3fSmrg# Turn some warnings into errors, so we don't accidentally get successful builds
3144b4485a66Smrg# when there are problems that should be fixed.
3145b4485a66Smrg
3146b4485a66Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3147b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3148b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3149b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3150b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3151b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3152b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3153b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3154b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3155b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3156b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3157b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3158b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3159b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3160b4485a66Smrgelse
3161b4485a66SmrgAC_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])
3162b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3163b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3164b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3165b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3166b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3167b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3168b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3169b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3170b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3171b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3172b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3173b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3174b4485a66SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3175b4485a66Smrgfi
3176b4485a66Smrg
3177b4485a66SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3178b4485a66Smrg]) # XORG_COMPILER_FLAGS
3179b4485a66Smrg
3180b3eb03f3Smrg# XORG_CWARNFLAGS
3181b3eb03f3Smrg# ---------------
3182b3eb03f3Smrg# Minimum version: 1.2.0
3183b4485a66Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3184b3eb03f3Smrg#
3185b3eb03f3Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3186b3eb03f3Smrg#
3187b4485a66Smrg# This function is deprecated because it defines -fno-strict-aliasing
3188b4485a66Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3189b4485a66Smrg# is needed, then it should be added explicitly in the module when
3190b4485a66Smrg# it is updated to use BASE_CFLAGS.
3191b4485a66Smrg#
3192b3eb03f3SmrgAC_DEFUN([XORG_CWARNFLAGS], [
3193b4485a66SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3194b4485a66SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3195b4485a66SmrgAC_LANG_CASE(
3196b4485a66Smrg	[C], [
3197b4485a66Smrg		CWARNFLAGS="$BASE_CFLAGS"
3198b4485a66Smrg		if  test "x$GCC" = xyes ; then
3199b4485a66Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3200b4485a66Smrg		fi
3201b4485a66Smrg		AC_SUBST(CWARNFLAGS)
3202b4485a66Smrg	]
3203b4485a66Smrg)
3204b3eb03f3Smrg]) # XORG_CWARNFLAGS
3205010cdda0Smrg
3206b3eb03f3Smrg# XORG_STRICT_OPTION
3207b3eb03f3Smrg# -----------------------
3208b3eb03f3Smrg# Minimum version: 1.3.0
3209b3eb03f3Smrg#
3210b4485a66Smrg# Add configure option to enable strict compilation flags, such as treating
3211b4485a66Smrg# warnings as fatal errors.
3212b4485a66Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3213b4485a66Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3214b4485a66Smrg#
3215b4485a66Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3216b4485a66Smrg# when strict compilation is unconditionally desired.
3217b3eb03f3SmrgAC_DEFUN([XORG_STRICT_OPTION], [
3218b3eb03f3SmrgAC_REQUIRE([XORG_CWARNFLAGS])
3219b4485a66SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3220b3eb03f3Smrg
3221b3eb03f3SmrgAC_ARG_ENABLE(strict-compilation,
3222b3eb03f3Smrg			  AS_HELP_STRING([--enable-strict-compilation],
3223b3eb03f3Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3224b3eb03f3Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3225b4485a66Smrg
3226b4485a66SmrgAC_LANG_CASE(
3227b4485a66Smrg        [C], [
3228b4485a66Smrg                define([PREFIX], [C])
3229b4485a66Smrg        ],
3230b4485a66Smrg        [C++], [
3231b4485a66Smrg                define([PREFIX], [CXX])
3232b4485a66Smrg        ]
3233b4485a66Smrg)
3234b4485a66Smrg
3235b4485a66Smrg[STRICT_]PREFIX[FLAGS]=""
3236b4485a66SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3237b4485a66SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3238b4485a66Smrg
3239b4485a66Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3240b4485a66Smrg# activate it with -Werror, so we add it here explicitly.
3241b4485a66SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3242b4485a66Smrg
3243b3eb03f3Smrgif test "x$STRICT_COMPILE" = "xyes"; then
3244b4485a66Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3245b4485a66Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3246b3eb03f3Smrgfi
3247b4485a66SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3248b4485a66SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3249b4485a66SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3250b3eb03f3Smrg]) # XORG_STRICT_OPTION
3251010cdda0Smrg
3252affd2f3fSmrg# XORG_DEFAULT_NOCODE_OPTIONS
3253affd2f3fSmrg# ---------------------------
3254affd2f3fSmrg# Minimum version: 1.20.0
3255affd2f3fSmrg#
3256affd2f3fSmrg# Defines default options for X.Org modules which don't compile code,
3257affd2f3fSmrg# such as fonts, bitmaps, cursors, and docs.
3258affd2f3fSmrg#
3259affd2f3fSmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
3260affd2f3fSmrgAC_REQUIRE([AC_PROG_INSTALL])
3261affd2f3fSmrgXORG_RELEASE_VERSION
3262affd2f3fSmrgXORG_CHANGELOG
3263affd2f3fSmrgXORG_INSTALL
3264affd2f3fSmrgXORG_MANPAGE_SECTIONS
3265affd2f3fSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3266affd2f3fSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3267affd2f3fSmrg]) # XORG_DEFAULT_NOCODE_OPTIONS
3268affd2f3fSmrg
3269b3eb03f3Smrg# XORG_DEFAULT_OPTIONS
3270b3eb03f3Smrg# --------------------
3271b3eb03f3Smrg# Minimum version: 1.3.0
3272b3eb03f3Smrg#
3273affd2f3fSmrg# Defines default options for X.Org modules which compile code.
3274b3eb03f3Smrg#
3275b3eb03f3SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3276af23b0a6SmrgAC_REQUIRE([AC_PROG_INSTALL])
3277b4485a66SmrgXORG_COMPILER_FLAGS
3278b3eb03f3SmrgXORG_CWARNFLAGS
3279b3eb03f3SmrgXORG_STRICT_OPTION
3280affd2f3fSmrgXORG_DEFAULT_NOCODE_OPTIONS
3281b3eb03f3Smrg]) # XORG_DEFAULT_OPTIONS
3282af23b0a6Smrg
3283af23b0a6Smrg# XORG_INSTALL()
3284af23b0a6Smrg# ----------------
3285af23b0a6Smrg# Minimum version: 1.4.0
3286af23b0a6Smrg#
3287af23b0a6Smrg# Defines the variable INSTALL_CMD as the command to copy
3288af23b0a6Smrg# INSTALL from $prefix/share/util-macros.
3289af23b0a6Smrg#
3290af23b0a6SmrgAC_DEFUN([XORG_INSTALL], [
3291af23b0a6SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3292af23b0a6Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3293af23b0a6SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3294af23b0a6Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3295945aa7e3Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3296945aa7e3Smrgtouch \$(top_srcdir)/INSTALL; \
3297945aa7e3Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3298af23b0a6SmrgAC_SUBST([INSTALL_CMD])
3299af23b0a6Smrg]) # XORG_INSTALL
3300010cdda0Smrgdnl Copyright 2005 Red Hat, Inc
3301b3eb03f3Smrgdnl
3302010cdda0Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3303010cdda0Smrgdnl documentation for any purpose is hereby granted without fee, provided that
3304010cdda0Smrgdnl the above copyright notice appear in all copies and that both that
3305010cdda0Smrgdnl copyright notice and this permission notice appear in supporting
3306010cdda0Smrgdnl documentation.
3307b3eb03f3Smrgdnl
3308010cdda0Smrgdnl The above copyright notice and this permission notice shall be included
3309010cdda0Smrgdnl in all copies or substantial portions of the Software.
3310b3eb03f3Smrgdnl
3311010cdda0Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3312010cdda0Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3313010cdda0Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3314010cdda0Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3315010cdda0Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3316010cdda0Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3317010cdda0Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3318b3eb03f3Smrgdnl
3319010cdda0Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3320010cdda0Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3321010cdda0Smrgdnl other dealings in this Software without prior written authorization
3322010cdda0Smrgdnl from the copyright holders.
3323b3eb03f3Smrgdnl
3324010cdda0Smrg
3325b3eb03f3Smrg# XORG_RELEASE_VERSION
3326b3eb03f3Smrg# --------------------
3327af23b0a6Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3328945aa7e3Smrg
3329b3eb03f3SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3330b3eb03f3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3331b3eb03f3Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3332b3eb03f3Smrg		[Major version of this package])
3333b3eb03f3Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3334b3eb03f3Smrg	if test "x$PVM" = "x"; then
3335b3eb03f3Smrg		PVM="0"
3336010cdda0Smrg	fi
3337b3eb03f3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3338b3eb03f3Smrg		[$PVM],
3339b3eb03f3Smrg		[Minor version of this package])
3340b3eb03f3Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3341b3eb03f3Smrg	if test "x$PVP" = "x"; then
3342b3eb03f3Smrg		PVP="0"
3343010cdda0Smrg	fi
3344b3eb03f3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3345b3eb03f3Smrg		[$PVP],
3346b3eb03f3Smrg		[Patch version of this package])
3347010cdda0Smrg])
3348010cdda0Smrg
3349b3eb03f3Smrg# XORG_CHANGELOG()
3350b3eb03f3Smrg# ----------------
3351b3eb03f3Smrg# Minimum version: 1.2.0
3352b3eb03f3Smrg#
3353b3eb03f3Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3354b3eb03f3Smrg# ChangeLog from git.
3355b3eb03f3Smrg#
3356b3eb03f3Smrg#
3357b3eb03f3SmrgAC_DEFUN([XORG_CHANGELOG], [
3358945aa7e3SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3359af23b0a6Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3360945aa7e3Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3361945aa7e3Smrgtouch \$(top_srcdir)/ChangeLog; \
3362945aa7e3Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3363b3eb03f3SmrgAC_SUBST([CHANGELOG_CMD])
3364b3eb03f3Smrg]) # XORG_CHANGELOG
3365b3eb03f3Smrg
3366