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