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