1433d0511Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2cbc4e2beSmrg
3433d0511Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4eaef79e5Smrg
5eaef79e5Smrg# This file is free software; the Free Software Foundation
6eaef79e5Smrg# gives unlimited permission to copy and/or distribute it,
7eaef79e5Smrg# with or without modifications, as long as this notice is preserved.
8eaef79e5Smrg
9eaef79e5Smrg# This program is distributed in the hope that it will be useful,
10eaef79e5Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11eaef79e5Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12eaef79e5Smrg# PARTICULAR PURPOSE.
13eaef79e5Smrg
14cbc4e2beSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
152b32c8f7Smrgm4_ifndef([AC_AUTOCONF_VERSION],
162b32c8f7Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17433d0511Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
18433d0511Smrg[m4_warning([this file was generated for autoconf 2.72.
192b32c8f7SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
202b32c8f7SmrgIf you have problems, you may need to regenerate the build system entirely.
21cbc4e2beSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
222b32c8f7Smrg
23433d0511Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
24433d0511Smrg#
25433d0511Smrg# This file is free software; the Free Software Foundation
26433d0511Smrg# gives unlimited permission to copy and/or distribute it,
27433d0511Smrg# with or without modifications, as long as this notice is preserved.
286654de8bSmrg
29433d0511Smrg# AM_AUTOMAKE_VERSION(VERSION)
30433d0511Smrg# ----------------------------
31433d0511Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32433d0511Smrg# generated from the m4 files accompanying Automake X.Y.
33433d0511Smrg# (This private macro should not be called outside this file.)
34433d0511SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35433d0511Smrg[am__api_version='1.16'
36433d0511Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37433d0511Smrgdnl require some minimum version.  Point them to the right macro.
38433d0511Smrgm4_if([$1], [1.16.5], [],
39433d0511Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40433d0511Smrg])
416654de8bSmrg
42433d0511Smrg# _AM_AUTOCONF_VERSION(VERSION)
43433d0511Smrg# -----------------------------
44433d0511Smrg# aclocal traces this macro to find the Autoconf version.
45433d0511Smrg# This is a private macro too.  Using m4_define simplifies
46433d0511Smrg# the logic in aclocal, which can simply ignore this definition.
47433d0511Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48eaef79e5Smrg
49433d0511Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50433d0511Smrg# -------------------------------
51433d0511Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52433d0511Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53433d0511SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54433d0511Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
55433d0511Smrgm4_ifndef([AC_AUTOCONF_VERSION],
56433d0511Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57433d0511Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
582b32c8f7Smrg
59433d0511Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60eaef79e5Smrg
61433d0511Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
62433d0511Smrg#
63433d0511Smrg# This file is free software; the Free Software Foundation
64433d0511Smrg# gives unlimited permission to copy and/or distribute it,
65433d0511Smrg# with or without modifications, as long as this notice is preserved.
66eaef79e5Smrg
67433d0511Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68433d0511Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69433d0511Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70433d0511Smrg#
71433d0511Smrg# Of course, Automake must honor this variable whenever it calls a
72433d0511Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73433d0511Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74433d0511Smrg# depending on how configure is run.  This is pretty annoying, since
75433d0511Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76433d0511Smrg# source directory, any form will work fine, but in subdirectories a
77433d0511Smrg# relative path needs to be adjusted first.
78433d0511Smrg#
79433d0511Smrg# $ac_aux_dir/missing
80433d0511Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81433d0511Smrg# $top_srcdir/$ac_aux_dir/missing
82433d0511Smrg#    fails if $ac_aux_dir is absolute,
83433d0511Smrg#    fails when called from a subdirectory in a VPATH build with
84433d0511Smrg#          a relative $ac_aux_dir
85433d0511Smrg#
86433d0511Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87433d0511Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
88433d0511Smrg# harmless because $srcdir is '.', but things will broke when you
89433d0511Smrg# start a VPATH build or use an absolute $srcdir.
90433d0511Smrg#
91433d0511Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92433d0511Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93433d0511Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94433d0511Smrg# and then we would define $MISSING as
95433d0511Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96433d0511Smrg# This will work as long as MISSING is not called from configure, because
97433d0511Smrg# unfortunately $(top_srcdir) has no meaning in configure.
98433d0511Smrg# However there are other variables, like CC, which are often used in
99433d0511Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100433d0511Smrg#
101433d0511Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
102433d0511Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
103433d0511Smrg# configured tree to be moved without reconfiguration.
104eaef79e5Smrg
105433d0511SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106433d0511Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107433d0511Smrg# Expand $ac_aux_dir to an absolute path.
108433d0511Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109433d0511Smrg])
110eaef79e5Smrg
111433d0511Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112eaef79e5Smrg
113433d0511Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
114433d0511Smrg#
115433d0511Smrg# This file is free software; the Free Software Foundation
116433d0511Smrg# gives unlimited permission to copy and/or distribute it,
117433d0511Smrg# with or without modifications, as long as this notice is preserved.
118eaef79e5Smrg
119433d0511Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120433d0511Smrg# -------------------------------------
121433d0511Smrg# Define a conditional.
122433d0511SmrgAC_DEFUN([AM_CONDITIONAL],
123433d0511Smrg[AC_PREREQ([2.52])dnl
124433d0511Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
125433d0511Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126433d0511SmrgAC_SUBST([$1_TRUE])dnl
127433d0511SmrgAC_SUBST([$1_FALSE])dnl
128433d0511Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129433d0511Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130433d0511Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131433d0511Smrgif $2; then
132433d0511Smrg  $1_TRUE=
133433d0511Smrg  $1_FALSE='#'
134433d0511Smrgelse
135433d0511Smrg  $1_TRUE='#'
136433d0511Smrg  $1_FALSE=
137433d0511Smrgfi
138433d0511SmrgAC_CONFIG_COMMANDS_PRE(
139433d0511Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140433d0511Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141433d0511SmrgUsually this means the macro was only invoked conditionally.]])
142433d0511Smrgfi])])
143eaef79e5Smrg
144433d0511Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
145433d0511Smrg#
146433d0511Smrg# This file is free software; the Free Software Foundation
147433d0511Smrg# gives unlimited permission to copy and/or distribute it,
148433d0511Smrg# with or without modifications, as long as this notice is preserved.
149eaef79e5Smrg
150eaef79e5Smrg
151433d0511Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
152433d0511Smrg# written in clear, in which case automake, when reading aclocal.m4,
153433d0511Smrg# will think it sees a *use*, and therefore will trigger all it's
154433d0511Smrg# C support machinery.  Also note that it means that autoscan, seeing
155433d0511Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156eaef79e5Smrg
157eaef79e5Smrg
158433d0511Smrg# _AM_DEPENDENCIES(NAME)
159433d0511Smrg# ----------------------
160433d0511Smrg# See how the compiler implements dependency checking.
161433d0511Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
162433d0511Smrg# We try a few techniques and use that to set a single cache variable.
163433d0511Smrg#
164433d0511Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
165433d0511Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
166433d0511Smrg# dependency, and given that the user is not expected to run this macro,
167433d0511Smrg# just rely on AC_PROG_CC.
168433d0511SmrgAC_DEFUN([_AM_DEPENDENCIES],
169433d0511Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
170433d0511SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
171433d0511SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
172433d0511SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173eaef79e5Smrg
174433d0511Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
175433d0511Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
176433d0511Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
177433d0511Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
178433d0511Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
179433d0511Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
180433d0511Smrg                    [depcc="$$1"   am_compiler_list=])
181eaef79e5Smrg
182433d0511SmrgAC_CACHE_CHECK([dependency style of $depcc],
183433d0511Smrg               [am_cv_$1_dependencies_compiler_type],
184433d0511Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
185433d0511Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
186433d0511Smrg  # making bogus files that we don't know about and never remove.  For
187433d0511Smrg  # instance it was reported that on HP-UX the gcc test will end up
188433d0511Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
189433d0511Smrg  # in D".
190433d0511Smrg  rm -rf conftest.dir
191433d0511Smrg  mkdir conftest.dir
192433d0511Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
193433d0511Smrg  # using a relative directory.
194433d0511Smrg  cp "$am_depcomp" conftest.dir
195433d0511Smrg  cd conftest.dir
196433d0511Smrg  # We will build objects and dependencies in a subdirectory because
197433d0511Smrg  # it helps to detect inapplicable dependency modes.  For instance
198433d0511Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
199433d0511Smrg  # side effect of compilation, but ICC will put the dependencies in
200433d0511Smrg  # the current directory while Tru64 will put them in the object
201433d0511Smrg  # directory.
202433d0511Smrg  mkdir sub
203eaef79e5Smrg
204433d0511Smrg  am_cv_$1_dependencies_compiler_type=none
205433d0511Smrg  if test "$am_compiler_list" = ""; then
206433d0511Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
207433d0511Smrg  fi
208433d0511Smrg  am__universal=false
209433d0511Smrg  m4_case([$1], [CC],
210433d0511Smrg    [case " $depcc " in #(
211433d0511Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212433d0511Smrg     esac],
213433d0511Smrg    [CXX],
214433d0511Smrg    [case " $depcc " in #(
215433d0511Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216433d0511Smrg     esac])
217eaef79e5Smrg
218433d0511Smrg  for depmode in $am_compiler_list; do
219433d0511Smrg    # Setup a source with many dependencies, because some compilers
220433d0511Smrg    # like to wrap large dependency lists on column 80 (with \), and
221433d0511Smrg    # we should not choose a depcomp mode which is confused by this.
222433d0511Smrg    #
223433d0511Smrg    # We need to recreate these files for each test, as the compiler may
224433d0511Smrg    # overwrite some of them when testing with obscure command lines.
225433d0511Smrg    # This happens at least with the AIX C compiler.
226433d0511Smrg    : > sub/conftest.c
227433d0511Smrg    for i in 1 2 3 4 5 6; do
228433d0511Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
229433d0511Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
230433d0511Smrg      # Solaris 10 /bin/sh.
231433d0511Smrg      echo '/* dummy */' > sub/conftst$i.h
232433d0511Smrg    done
233433d0511Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234eaef79e5Smrg
235433d0511Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236433d0511Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
237433d0511Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
238433d0511Smrg    # versions had trouble with output in subdirs.
239433d0511Smrg    am__obj=sub/conftest.${OBJEXT-o}
240433d0511Smrg    am__minus_obj="-o $am__obj"
241433d0511Smrg    case $depmode in
242433d0511Smrg    gcc)
243433d0511Smrg      # This depmode causes a compiler race in universal mode.
244433d0511Smrg      test "$am__universal" = false || continue
245433d0511Smrg      ;;
246433d0511Smrg    nosideeffect)
247433d0511Smrg      # After this tag, mechanisms are not by side-effect, so they'll
248433d0511Smrg      # only be used when explicitly requested.
249433d0511Smrg      if test "x$enable_dependency_tracking" = xyes; then
250433d0511Smrg	continue
251433d0511Smrg      else
252433d0511Smrg	break
253433d0511Smrg      fi
254433d0511Smrg      ;;
255433d0511Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
256433d0511Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
257433d0511Smrg      # not run yet.  These depmodes are late enough in the game, and
258433d0511Smrg      # so weak that their functioning should not be impacted.
259433d0511Smrg      am__obj=conftest.${OBJEXT-o}
260433d0511Smrg      am__minus_obj=
261433d0511Smrg      ;;
262433d0511Smrg    none) break ;;
263433d0511Smrg    esac
264433d0511Smrg    if depmode=$depmode \
265433d0511Smrg       source=sub/conftest.c object=$am__obj \
266433d0511Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267433d0511Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
268433d0511Smrg         >/dev/null 2>conftest.err &&
269433d0511Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
270433d0511Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271433d0511Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
272433d0511Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
273433d0511Smrg      # icc doesn't choke on unknown options, it will just issue warnings
274433d0511Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
275433d0511Smrg      # that says an option was ignored or not supported.
276433d0511Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
277433d0511Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
278433d0511Smrg      # The diagnosis changed in icc 8.0:
279433d0511Smrg      #   icc: Command line remark: option '-MP' not supported
280433d0511Smrg      if (grep 'ignoring option' conftest.err ||
281433d0511Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
282433d0511Smrg        am_cv_$1_dependencies_compiler_type=$depmode
283433d0511Smrg        break
284433d0511Smrg      fi
285433d0511Smrg    fi
286433d0511Smrg  done
2872b32c8f7Smrg
288433d0511Smrg  cd ..
289433d0511Smrg  rm -rf conftest.dir
290433d0511Smrgelse
291433d0511Smrg  am_cv_$1_dependencies_compiler_type=none
292433d0511Smrgfi
293433d0511Smrg])
294433d0511SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
295433d0511SmrgAM_CONDITIONAL([am__fastdep$1], [
296433d0511Smrg  test "x$enable_dependency_tracking" != xno \
297433d0511Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298433d0511Smrg])
299eaef79e5Smrg
3006654de8bSmrg
301433d0511Smrg# AM_SET_DEPDIR
302433d0511Smrg# -------------
303433d0511Smrg# Choose a directory name for dependency files.
304433d0511Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
305433d0511SmrgAC_DEFUN([AM_SET_DEPDIR],
306433d0511Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
307433d0511SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
308433d0511Smrg])
3096654de8bSmrg
3106654de8bSmrg
311433d0511Smrg# AM_DEP_TRACK
312433d0511Smrg# ------------
313433d0511SmrgAC_DEFUN([AM_DEP_TRACK],
314433d0511Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
315433d0511SmrgAS_HELP_STRING(
316433d0511Smrg  [--enable-dependency-tracking],
317433d0511Smrg  [do not reject slow dependency extractors])
318433d0511SmrgAS_HELP_STRING(
319433d0511Smrg  [--disable-dependency-tracking],
320433d0511Smrg  [speeds up one-time build])])
321433d0511Smrgif test "x$enable_dependency_tracking" != xno; then
322433d0511Smrg  am_depcomp="$ac_aux_dir/depcomp"
323433d0511Smrg  AMDEPBACKSLASH='\'
324433d0511Smrg  am__nodep='_no'
325433d0511Smrgfi
326433d0511SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
327433d0511SmrgAC_SUBST([AMDEPBACKSLASH])dnl
328433d0511Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
329433d0511SmrgAC_SUBST([am__nodep])dnl
330433d0511Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
331433d0511Smrg])
3326654de8bSmrg
333433d0511Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334eaef79e5Smrg
335433d0511Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
336433d0511Smrg#
337433d0511Smrg# This file is free software; the Free Software Foundation
338433d0511Smrg# gives unlimited permission to copy and/or distribute it,
339433d0511Smrg# with or without modifications, as long as this notice is preserved.
3406654de8bSmrg
341433d0511Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
342433d0511Smrg# ------------------------------
343433d0511SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
344433d0511Smrg[{
345433d0511Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
346433d0511Smrg  # are listed without --file.  Let's play safe and only enable the eval
347433d0511Smrg  # if we detect the quoting.
348433d0511Smrg  # TODO: see whether this extra hack can be removed once we start
349433d0511Smrg  # requiring Autoconf 2.70 or later.
350433d0511Smrg  AS_CASE([$CONFIG_FILES],
351433d0511Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
352433d0511Smrg          [*], [set x $CONFIG_FILES])
353433d0511Smrg  shift
354433d0511Smrg  # Used to flag and report bootstrapping failures.
355433d0511Smrg  am_rc=0
356433d0511Smrg  for am_mf
357433d0511Smrg  do
358433d0511Smrg    # Strip MF so we end up with the name of the file.
359433d0511Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
360433d0511Smrg    # Check whether this is an Automake generated Makefile which includes
361433d0511Smrg    # dependency-tracking related rules and includes.
362433d0511Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
363433d0511Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
364433d0511Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
365433d0511Smrg      || continue
366433d0511Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
367433d0511Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
368433d0511Smrg    AM_RUN_LOG([cd "$am_dirpart" \
369433d0511Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
370433d0511Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
371433d0511Smrg  done
372433d0511Smrg  if test $am_rc -ne 0; then
373433d0511Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
374433d0511Smrg    for automatic dependency tracking.  If GNU make was not used, consider
375433d0511Smrg    re-running the configure script with MAKE="gmake" (or whatever is
376433d0511Smrg    necessary).  You can also try re-running configure with the
377433d0511Smrg    '--disable-dependency-tracking' option to at least be able to build
378433d0511Smrg    the package (albeit without support for automatic dependency tracking).])
379433d0511Smrg  fi
380433d0511Smrg  AS_UNSET([am_dirpart])
381433d0511Smrg  AS_UNSET([am_filepart])
382433d0511Smrg  AS_UNSET([am_mf])
383433d0511Smrg  AS_UNSET([am_rc])
384433d0511Smrg  rm -f conftest-deps.mk
385433d0511Smrg}
386433d0511Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3876654de8bSmrg
3886654de8bSmrg
389433d0511Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
390433d0511Smrg# -----------------------------
391433d0511Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
3926654de8bSmrg#
393433d0511Smrg# This code is only required when automatic dependency tracking is enabled.
394433d0511Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
395433d0511Smrg# order to bootstrap the dependency handling code.
396433d0511SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
397433d0511Smrg[AC_CONFIG_COMMANDS([depfiles],
398433d0511Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
399433d0511Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
4006654de8bSmrg
401433d0511Smrg# Do all the work for Automake.                             -*- Autoconf -*-
402433d0511Smrg
403433d0511Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4046654de8bSmrg#
405433d0511Smrg# This file is free software; the Free Software Foundation
406433d0511Smrg# gives unlimited permission to copy and/or distribute it,
407433d0511Smrg# with or without modifications, as long as this notice is preserved.
4086654de8bSmrg
409433d0511Smrg# This macro actually does too much.  Some checks are only needed if
410433d0511Smrg# your package does certain things.  But this isn't really a big deal.
411433d0511Smrg
412433d0511Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
413433d0511Smrgm4_define([AC_PROG_CC],
414433d0511Smrgm4_defn([AC_PROG_CC])
415433d0511Smrg[_AM_PROG_CC_C_O
416433d0511Smrg])
417433d0511Smrg
418433d0511Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
419433d0511Smrg# AM_INIT_AUTOMAKE([OPTIONS])
420433d0511Smrg# -----------------------------------------------
421433d0511Smrg# The call with PACKAGE and VERSION arguments is the old style
422433d0511Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
423433d0511Smrg# and VERSION should now be passed to AC_INIT and removed from
424433d0511Smrg# the call to AM_INIT_AUTOMAKE.
425433d0511Smrg# We support both call styles for the transition.  After
426433d0511Smrg# the next Automake release, Autoconf can make the AC_INIT
427433d0511Smrg# arguments mandatory, and then we can depend on a new Autoconf
428433d0511Smrg# release and drop the old call support.
429433d0511SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
430433d0511Smrg[AC_PREREQ([2.65])dnl
431433d0511Smrgm4_ifdef([_$0_ALREADY_INIT],
432433d0511Smrg  [m4_fatal([$0 expanded multiple times
433433d0511Smrg]m4_defn([_$0_ALREADY_INIT]))],
434433d0511Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
435433d0511Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
436433d0511Smrgdnl the ones we care about.
437433d0511Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
438433d0511SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
439433d0511SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
440433d0511Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
441433d0511Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
442433d0511Smrg  # is not polluted with repeated "-I."
443433d0511Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
444433d0511Smrg  # test to see if srcdir already configured
445433d0511Smrg  if test -f $srcdir/config.status; then
446433d0511Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
447433d0511Smrg  fi
448eaef79e5Smrgfi
449eaef79e5Smrg
450433d0511Smrg# test whether we have cygpath
451433d0511Smrgif test -z "$CYGPATH_W"; then
452433d0511Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
453433d0511Smrg    CYGPATH_W='cygpath -w'
454433d0511Smrg  else
455433d0511Smrg    CYGPATH_W=echo
456433d0511Smrg  fi
4576654de8bSmrgfi
458433d0511SmrgAC_SUBST([CYGPATH_W])
459eaef79e5Smrg
460433d0511Smrg# Define the identity of the package.
461433d0511Smrgdnl Distinguish between old-style and new-style calls.
462433d0511Smrgm4_ifval([$2],
463433d0511Smrg[AC_DIAGNOSE([obsolete],
464433d0511Smrg             [$0: two- and three-arguments forms are deprecated.])
465433d0511Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
466433d0511Smrg AC_SUBST([PACKAGE], [$1])dnl
467433d0511Smrg AC_SUBST([VERSION], [$2])],
468433d0511Smrg[_AM_SET_OPTIONS([$1])dnl
469433d0511Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
470433d0511Smrgm4_if(
471433d0511Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
472433d0511Smrg  [ok:ok],,
473433d0511Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
474433d0511Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
475433d0511Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476eaef79e5Smrg
477433d0511Smrg_AM_IF_OPTION([no-define],,
478433d0511Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
479433d0511Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480eaef79e5Smrg
481433d0511Smrg# Some tools Automake needs.
482433d0511SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
483433d0511SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
484433d0511SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
485433d0511SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
486433d0511SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
487433d0511SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
488433d0511SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
489433d0511SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
490433d0511SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
491433d0511SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
492433d0511Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
493433d0511Smrg# dies out for good.  For more background, see:
494433d0511Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
495433d0511Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
496433d0511SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
497433d0511Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
498433d0511Smrg# system "awk" is bad on some platforms.
499433d0511SmrgAC_REQUIRE([AC_PROG_AWK])dnl
500433d0511SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
501433d0511SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
502433d0511Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
503433d0511Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
504433d0511Smrg			     [_AM_PROG_TAR([v7])])])
505433d0511Smrg_AM_IF_OPTION([no-dependencies],,
506433d0511Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
507433d0511Smrg		  [_AM_DEPENDENCIES([CC])],
508433d0511Smrg		  [m4_define([AC_PROG_CC],
509433d0511Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
510433d0511SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
511433d0511Smrg		  [_AM_DEPENDENCIES([CXX])],
512433d0511Smrg		  [m4_define([AC_PROG_CXX],
513433d0511Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
514433d0511SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
515433d0511Smrg		  [_AM_DEPENDENCIES([OBJC])],
516433d0511Smrg		  [m4_define([AC_PROG_OBJC],
517433d0511Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
518433d0511SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
519433d0511Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
520433d0511Smrg		  [m4_define([AC_PROG_OBJCXX],
521433d0511Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
522433d0511Smrg])
523433d0511Smrg# Variables for tags utilities; see am/tags.am
524433d0511Smrgif test -z "$CTAGS"; then
525433d0511Smrg  CTAGS=ctags
526eaef79e5Smrgfi
527433d0511SmrgAC_SUBST([CTAGS])
528433d0511Smrgif test -z "$ETAGS"; then
529433d0511Smrg  ETAGS=etags
5306654de8bSmrgfi
531433d0511SmrgAC_SUBST([ETAGS])
532433d0511Smrgif test -z "$CSCOPE"; then
533433d0511Smrg  CSCOPE=cscope
5346654de8bSmrgfi
535433d0511SmrgAC_SUBST([CSCOPE])
536eaef79e5Smrg
537433d0511SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
538433d0511Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
539433d0511Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
540433d0511Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
541433d0511SmrgAC_CONFIG_COMMANDS_PRE(dnl
542433d0511Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
543433d0511Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5446654de8bSmrg
545433d0511Smrg# POSIX will say in a future version that running "rm -f" with no argument
546433d0511Smrg# is OK; and we want to be able to make that assumption in our Makefile
547433d0511Smrg# recipes.  So use an aggressive probe to check that the usage we want is
548433d0511Smrg# actually supported "in the wild" to an acceptable degree.
549433d0511Smrg# See automake bug#10828.
550433d0511Smrg# To make any issue more visible, cause the running configure to be aborted
551433d0511Smrg# by default if the 'rm' program in use doesn't match our expectations; the
552433d0511Smrg# user can still override this though.
553433d0511Smrgif rm -f && rm -fr && rm -rf; then : OK; else
554433d0511Smrg  cat >&2 <<'END'
555433d0511SmrgOops!
556eaef79e5Smrg
557433d0511SmrgYour 'rm' program seems unable to run without file operands specified
558433d0511Smrgon the command line, even when the '-f' option is present.  This is contrary
559433d0511Smrgto the behaviour of most rm programs out there, and not conforming with
560433d0511Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
561eaef79e5Smrg
562433d0511SmrgPlease tell bug-automake@gnu.org about your system, including the value
563433d0511Smrgof your $PATH and any error possibly output before this message.  This
564433d0511Smrgcan help us improve future automake versions.
5656654de8bSmrg
566433d0511SmrgEND
567433d0511Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
568433d0511Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
569433d0511Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
570433d0511Smrg    echo >&2
571433d0511Smrg  else
572433d0511Smrg    cat >&2 <<'END'
573433d0511SmrgAborting the configuration process, to ensure you take notice of the issue.
5746654de8bSmrg
575433d0511SmrgYou can download and install GNU coreutils to get an 'rm' implementation
576433d0511Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
5776654de8bSmrg
578433d0511SmrgIf you want to complete the configuration process using your problematic
579433d0511Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
580433d0511Smrgto "yes", and re-run configure.
581eaef79e5Smrg
582433d0511SmrgEND
583433d0511Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
584433d0511Smrg  fi
5856654de8bSmrgfi
586433d0511Smrgdnl The trailing newline in this macro's definition is deliberate, for
587433d0511Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
588433d0511Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
589433d0511Smrg])
590eaef79e5Smrg
591433d0511Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
592433d0511Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
593433d0511Smrgdnl mangled by Autoconf and run in a shell conditional statement.
594433d0511Smrgm4_define([_AC_COMPILER_EXEEXT],
595433d0511Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5966654de8bSmrg
597433d0511Smrg# When config.status generates a header, we must update the stamp-h file.
598433d0511Smrg# This file resides in the same directory as the config header
599433d0511Smrg# that is generated.  The stamp files are numbered to have different names.
600eaef79e5Smrg
601433d0511Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
602433d0511Smrg# loop where config.status creates the headers, so we can generate
603433d0511Smrg# our stamp files there.
604433d0511SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
605433d0511Smrg[# Compute $1's index in $config_headers.
606433d0511Smrg_am_arg=$1
607433d0511Smrg_am_stamp_count=1
608433d0511Smrgfor _am_header in $config_headers :; do
609433d0511Smrg  case $_am_header in
610433d0511Smrg    $_am_arg | $_am_arg:* )
611433d0511Smrg      break ;;
612433d0511Smrg    * )
613433d0511Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
614433d0511Smrg  esac
615433d0511Smrgdone
616433d0511Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
617eaef79e5Smrg
618433d0511Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
619433d0511Smrg#
620433d0511Smrg# This file is free software; the Free Software Foundation
621433d0511Smrg# gives unlimited permission to copy and/or distribute it,
622433d0511Smrg# with or without modifications, as long as this notice is preserved.
623d1a7ce7bSmrg
624433d0511Smrg# AM_PROG_INSTALL_SH
625433d0511Smrg# ------------------
626433d0511Smrg# Define $install_sh.
627433d0511SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
628433d0511Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
629433d0511Smrgif test x"${install_sh+set}" != xset; then
630433d0511Smrg  case $am_aux_dir in
631433d0511Smrg  *\ * | *\	*)
632433d0511Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
633433d0511Smrg  *)
634433d0511Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
635433d0511Smrg  esac
636eaef79e5Smrgfi
637433d0511SmrgAC_SUBST([install_sh])])
638eaef79e5Smrg
639433d0511Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
640433d0511Smrg#
641433d0511Smrg# This file is free software; the Free Software Foundation
642433d0511Smrg# gives unlimited permission to copy and/or distribute it,
643433d0511Smrg# with or without modifications, as long as this notice is preserved.
6446654de8bSmrg
645433d0511Smrg# Check whether the underlying file-system supports filenames
646433d0511Smrg# with a leading dot.  For instance MS-DOS doesn't.
647433d0511SmrgAC_DEFUN([AM_SET_LEADING_DOT],
648433d0511Smrg[rm -rf .tst 2>/dev/null
649433d0511Smrgmkdir .tst 2>/dev/null
650433d0511Smrgif test -d .tst; then
651433d0511Smrg  am__leading_dot=.
6526654de8bSmrgelse
653433d0511Smrg  am__leading_dot=_
654eaef79e5Smrgfi
655433d0511Smrgrmdir .tst 2>/dev/null
656433d0511SmrgAC_SUBST([am__leading_dot])])
657eaef79e5Smrg
658433d0511Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
659eaef79e5Smrg
660433d0511Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
661433d0511Smrg#
662433d0511Smrg# This file is free software; the Free Software Foundation
663433d0511Smrg# gives unlimited permission to copy and/or distribute it,
664433d0511Smrg# with or without modifications, as long as this notice is preserved.
665eaef79e5Smrg
666433d0511Smrg# AM_MAKE_INCLUDE()
667433d0511Smrg# -----------------
668433d0511Smrg# Check whether make has an 'include' directive that can support all
669433d0511Smrg# the idioms we need for our automatic dependency tracking code.
670433d0511SmrgAC_DEFUN([AM_MAKE_INCLUDE],
671433d0511Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
672433d0511Smrgcat > confinc.mk << 'END'
673433d0511Smrgam__doit:
674433d0511Smrg	@echo this is the am__doit target >confinc.out
675433d0511Smrg.PHONY: am__doit
676433d0511SmrgEND
677433d0511Smrgam__include="#"
678433d0511Smrgam__quote=
679433d0511Smrg# BSD make does it like this.
680433d0511Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
681433d0511Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
682433d0511Smrgecho 'include confinc.mk # ignored' > confmf.GNU
683433d0511Smrg_am_result=no
684433d0511Smrgfor s in GNU BSD; do
685433d0511Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
686433d0511Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
687433d0511Smrg      ['0:this is the am__doit target'],
688433d0511Smrg      [AS_CASE([$s],
689433d0511Smrg          [BSD], [am__include='.include' am__quote='"'],
690433d0511Smrg          [am__include='include' am__quote=''])])
691433d0511Smrg  if test "$am__include" != "#"; then
692433d0511Smrg    _am_result="yes ($s style)"
693433d0511Smrg    break
694433d0511Smrg  fi
695433d0511Smrgdone
696433d0511Smrgrm -f confinc.* confmf.*
697433d0511SmrgAC_MSG_RESULT([${_am_result}])
698433d0511SmrgAC_SUBST([am__include])])
699433d0511SmrgAC_SUBST([am__quote])])
700d1a7ce7bSmrg
701433d0511Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
702d1a7ce7bSmrg
703433d0511Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
7046654de8bSmrg#
705433d0511Smrg# This file is free software; the Free Software Foundation
706433d0511Smrg# gives unlimited permission to copy and/or distribute it,
707433d0511Smrg# with or without modifications, as long as this notice is preserved.
708d1a7ce7bSmrg
709433d0511Smrg# AM_MISSING_PROG(NAME, PROGRAM)
710433d0511Smrg# ------------------------------
711433d0511SmrgAC_DEFUN([AM_MISSING_PROG],
712433d0511Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
713433d0511Smrg$1=${$1-"${am_missing_run}$2"}
714433d0511SmrgAC_SUBST($1)])
715d1a7ce7bSmrg
716433d0511Smrg# AM_MISSING_HAS_RUN
717433d0511Smrg# ------------------
718433d0511Smrg# Define MISSING if not defined so far and test if it is modern enough.
719433d0511Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
720433d0511SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
721433d0511Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
722433d0511SmrgAC_REQUIRE_AUX_FILE([missing])dnl
723433d0511Smrgif test x"${MISSING+set}" != xset; then
724433d0511Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
7256654de8bSmrgfi
726433d0511Smrg# Use eval to expand $SHELL
727433d0511Smrgif eval "$MISSING --is-lightweight"; then
728433d0511Smrg  am_missing_run="$MISSING "
729433d0511Smrgelse
730433d0511Smrg  am_missing_run=
731433d0511Smrg  AC_MSG_WARN(['missing' script is too old or missing])
7326654de8bSmrgfi
733433d0511Smrg])
734d1a7ce7bSmrg
735433d0511Smrg# Helper functions for option handling.                     -*- Autoconf -*-
736eaef79e5Smrg
737433d0511Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
738433d0511Smrg#
739433d0511Smrg# This file is free software; the Free Software Foundation
740433d0511Smrg# gives unlimited permission to copy and/or distribute it,
741433d0511Smrg# with or without modifications, as long as this notice is preserved.
7422b32c8f7Smrg
743433d0511Smrg# _AM_MANGLE_OPTION(NAME)
744433d0511Smrg# -----------------------
745433d0511SmrgAC_DEFUN([_AM_MANGLE_OPTION],
746433d0511Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
747eaef79e5Smrg
748433d0511Smrg# _AM_SET_OPTION(NAME)
749433d0511Smrg# --------------------
750433d0511Smrg# Set option NAME.  Presently that only means defining a flag for this option.
751433d0511SmrgAC_DEFUN([_AM_SET_OPTION],
752433d0511Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
753eaef79e5Smrg
754433d0511Smrg# _AM_SET_OPTIONS(OPTIONS)
755433d0511Smrg# ------------------------
756433d0511Smrg# OPTIONS is a space-separated list of Automake options.
757433d0511SmrgAC_DEFUN([_AM_SET_OPTIONS],
758433d0511Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
759433d0511Smrg
760433d0511Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
761433d0511Smrg# -------------------------------------------
762433d0511Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
763433d0511SmrgAC_DEFUN([_AM_IF_OPTION],
764433d0511Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
765433d0511Smrg
766433d0511Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
7676654de8bSmrg#
768433d0511Smrg# This file is free software; the Free Software Foundation
769433d0511Smrg# gives unlimited permission to copy and/or distribute it,
770433d0511Smrg# with or without modifications, as long as this notice is preserved.
771eaef79e5Smrg
772433d0511Smrg# _AM_PROG_CC_C_O
773433d0511Smrg# ---------------
774433d0511Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
775433d0511Smrg# to automatically call this.
776433d0511SmrgAC_DEFUN([_AM_PROG_CC_C_O],
777433d0511Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
778433d0511SmrgAC_REQUIRE_AUX_FILE([compile])dnl
779433d0511SmrgAC_LANG_PUSH([C])dnl
780433d0511SmrgAC_CACHE_CHECK(
781433d0511Smrg  [whether $CC understands -c and -o together],
782433d0511Smrg  [am_cv_prog_cc_c_o],
783433d0511Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
784433d0511Smrg  # Make sure it works both with $CC and with simple cc.
785433d0511Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
786433d0511Smrg  # compilers refuse to overwrite an existing .o file with -o,
787433d0511Smrg  # though they will create one.
788433d0511Smrg  am_cv_prog_cc_c_o=yes
789433d0511Smrg  for am_i in 1 2; do
790433d0511Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
791433d0511Smrg         && test -f conftest2.$ac_objext; then
792433d0511Smrg      : OK
793433d0511Smrg    else
794433d0511Smrg      am_cv_prog_cc_c_o=no
795433d0511Smrg      break
796433d0511Smrg    fi
797433d0511Smrg  done
798433d0511Smrg  rm -f core conftest*
799433d0511Smrg  unset am_i])
800433d0511Smrgif test "$am_cv_prog_cc_c_o" != yes; then
801433d0511Smrg   # Losing compiler, so override with the script.
802433d0511Smrg   # FIXME: It is wrong to rewrite CC.
803433d0511Smrg   # But if we don't then we get into trouble of one sort or another.
804433d0511Smrg   # A longer-term fix would be to have automake use am__CC in this case,
805433d0511Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
806433d0511Smrg   CC="$am_aux_dir/compile $CC"
807eaef79e5Smrgfi
808433d0511SmrgAC_LANG_POP([C])])
809eaef79e5Smrg
810433d0511Smrg# For backward compatibility.
811433d0511SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
812eaef79e5Smrg
813433d0511Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
814eaef79e5Smrg#
815433d0511Smrg# This file is free software; the Free Software Foundation
816433d0511Smrg# gives unlimited permission to copy and/or distribute it,
817433d0511Smrg# with or without modifications, as long as this notice is preserved.
818eaef79e5Smrg
819433d0511Smrg# AM_RUN_LOG(COMMAND)
820433d0511Smrg# -------------------
821433d0511Smrg# Run COMMAND, save the exit status in ac_status, and log it.
822433d0511Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
823433d0511SmrgAC_DEFUN([AM_RUN_LOG],
824433d0511Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
825433d0511Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
826433d0511Smrg   ac_status=$?
827433d0511Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
828433d0511Smrg   (exit $ac_status); }])
829433d0511Smrg
830433d0511Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
831433d0511Smrg
832433d0511Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
8336654de8bSmrg#
834433d0511Smrg# This file is free software; the Free Software Foundation
835433d0511Smrg# gives unlimited permission to copy and/or distribute it,
836433d0511Smrg# with or without modifications, as long as this notice is preserved.
837eaef79e5Smrg
838433d0511Smrg# AM_SANITY_CHECK
839433d0511Smrg# ---------------
840433d0511SmrgAC_DEFUN([AM_SANITY_CHECK],
841433d0511Smrg[AC_MSG_CHECKING([whether build environment is sane])
842433d0511Smrg# Reject unsafe characters in $srcdir or the absolute working directory
843433d0511Smrg# name.  Accept space and tab only in the latter.
844433d0511Smrgam_lf='
845433d0511Smrg'
846433d0511Smrgcase `pwd` in
847433d0511Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
848433d0511Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
849433d0511Smrgesac
850433d0511Smrgcase $srcdir in
851433d0511Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
852433d0511Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
853433d0511Smrgesac
854433d0511Smrg
855433d0511Smrg# Do 'set' in a subshell so we don't clobber the current shell's
856433d0511Smrg# arguments.  Must try -L first in case configure is actually a
857433d0511Smrg# symlink; some systems play weird games with the mod time of symlinks
858433d0511Smrg# (eg FreeBSD returns the mod time of the symlink's containing
859433d0511Smrg# directory).
860433d0511Smrgif (
861433d0511Smrg   am_has_slept=no
862433d0511Smrg   for am_try in 1 2; do
863433d0511Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
864433d0511Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
865433d0511Smrg     if test "$[*]" = "X"; then
866433d0511Smrg	# -L didn't work.
867433d0511Smrg	set X `ls -t "$srcdir/configure" conftest.file`
868433d0511Smrg     fi
869433d0511Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
870433d0511Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
871433d0511Smrg
872433d0511Smrg	# If neither matched, then we have a broken ls.  This can happen
873433d0511Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
874433d0511Smrg	# broken ls alias from the environment.  This has actually
875433d0511Smrg	# happened.  Such a system could not be considered "sane".
876433d0511Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
877433d0511Smrg  alias in your environment])
878433d0511Smrg     fi
879433d0511Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
880433d0511Smrg       break
881433d0511Smrg     fi
882433d0511Smrg     # Just in case.
883433d0511Smrg     sleep 1
884433d0511Smrg     am_has_slept=yes
885433d0511Smrg   done
886433d0511Smrg   test "$[2]" = conftest.file
887433d0511Smrg   )
888433d0511Smrgthen
889433d0511Smrg   # Ok.
890433d0511Smrg   :
891433d0511Smrgelse
892433d0511Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
893433d0511SmrgCheck your system clock])
894433d0511Smrgfi
895433d0511SmrgAC_MSG_RESULT([yes])
896433d0511Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
897433d0511Smrg# generated files are strictly newer.
898433d0511Smrgam_sleep_pid=
899433d0511Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
900433d0511Smrg  ( sleep 1 ) &
901433d0511Smrg  am_sleep_pid=$!
902433d0511Smrgfi
903433d0511SmrgAC_CONFIG_COMMANDS_PRE(
904433d0511Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
905433d0511Smrg   if test -n "$am_sleep_pid"; then
906433d0511Smrg     # Hide warnings about reused PIDs.
907433d0511Smrg     wait $am_sleep_pid 2>/dev/null
9086654de8bSmrg   fi
909433d0511Smrg   AC_MSG_RESULT([done])])
910433d0511Smrgrm -f conftest.file
911433d0511Smrg])
912433d0511Smrg
913433d0511Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
914433d0511Smrg#
915433d0511Smrg# This file is free software; the Free Software Foundation
916433d0511Smrg# gives unlimited permission to copy and/or distribute it,
917433d0511Smrg# with or without modifications, as long as this notice is preserved.
918433d0511Smrg
919433d0511Smrg# AM_SILENT_RULES([DEFAULT])
920433d0511Smrg# --------------------------
921433d0511Smrg# Enable less verbose build rules; with the default set to DEFAULT
922433d0511Smrg# ("yes" being less verbose, "no" or empty being verbose).
923433d0511SmrgAC_DEFUN([AM_SILENT_RULES],
924433d0511Smrg[AC_ARG_ENABLE([silent-rules], [dnl
925433d0511SmrgAS_HELP_STRING(
926433d0511Smrg  [--enable-silent-rules],
927433d0511Smrg  [less verbose build output (undo: "make V=1")])
928433d0511SmrgAS_HELP_STRING(
929433d0511Smrg  [--disable-silent-rules],
930433d0511Smrg  [verbose build output (undo: "make V=0")])dnl
931433d0511Smrg])
932433d0511Smrgcase $enable_silent_rules in @%:@ (((
933433d0511Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
934433d0511Smrg   no) AM_DEFAULT_VERBOSITY=1;;
935433d0511Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
936433d0511Smrgesac
937433d0511Smrgdnl
938433d0511Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
939433d0511Smrgdnl do not support nested variable expansions.
940433d0511Smrgdnl See automake bug#9928 and bug#10237.
941433d0511Smrgam_make=${MAKE-make}
942433d0511SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
943433d0511Smrg   [am_cv_make_support_nested_variables],
944433d0511Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
945433d0511SmrgBAR0=false
946433d0511SmrgBAR1=true
947433d0511SmrgV=1
948433d0511Smrgam__doit:
949433d0511Smrg	@$(TRUE)
950433d0511Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
951433d0511Smrg  am_cv_make_support_nested_variables=yes
952eaef79e5Smrgelse
953433d0511Smrg  am_cv_make_support_nested_variables=no
954433d0511Smrgfi])
955433d0511Smrgif test $am_cv_make_support_nested_variables = yes; then
956433d0511Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
957433d0511Smrg  AM_V='$(V)'
958433d0511Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
959433d0511Smrgelse
960433d0511Smrg  AM_V=$AM_DEFAULT_VERBOSITY
961433d0511Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
962eaef79e5Smrgfi
963433d0511SmrgAC_SUBST([AM_V])dnl
964433d0511SmrgAM_SUBST_NOTMAKE([AM_V])dnl
965433d0511SmrgAC_SUBST([AM_DEFAULT_V])dnl
966433d0511SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
967433d0511SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
968433d0511SmrgAM_BACKSLASH='\'
969433d0511SmrgAC_SUBST([AM_BACKSLASH])dnl
970433d0511Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
971433d0511Smrg])
972eaef79e5Smrg
973433d0511Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
974433d0511Smrg#
975433d0511Smrg# This file is free software; the Free Software Foundation
976433d0511Smrg# gives unlimited permission to copy and/or distribute it,
977433d0511Smrg# with or without modifications, as long as this notice is preserved.
978eaef79e5Smrg
979433d0511Smrg# AM_PROG_INSTALL_STRIP
980433d0511Smrg# ---------------------
981433d0511Smrg# One issue with vendor 'install' (even GNU) is that you can't
982433d0511Smrg# specify the program used to strip binaries.  This is especially
983433d0511Smrg# annoying in cross-compiling environments, where the build's strip
984433d0511Smrg# is unlikely to handle the host's binaries.
985433d0511Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
986433d0511Smrg# always use install-sh in "make install-strip", and initialize
987433d0511Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
988433d0511SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
989433d0511Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
990433d0511Smrg# Installed binaries are usually stripped using 'strip' when the user
991433d0511Smrg# run "make install-strip".  However 'strip' might not be the right
992433d0511Smrg# tool to use in cross-compilation environments, therefore Automake
993433d0511Smrg# will honor the 'STRIP' environment variable to overrule this program.
994433d0511Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
995433d0511Smrgif test "$cross_compiling" != no; then
996433d0511Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
997433d0511Smrgfi
998433d0511SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
999433d0511SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1000433d0511Smrg
1001433d0511Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
1002eaef79e5Smrg#
1003433d0511Smrg# This file is free software; the Free Software Foundation
1004433d0511Smrg# gives unlimited permission to copy and/or distribute it,
1005433d0511Smrg# with or without modifications, as long as this notice is preserved.
1006433d0511Smrg
1007433d0511Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
1008433d0511Smrg# ---------------------------
1009433d0511Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1010433d0511Smrg# This macro is traced by Automake.
1011433d0511SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1012433d0511Smrg
1013433d0511Smrg# AM_SUBST_NOTMAKE(VARIABLE)
1014433d0511Smrg# --------------------------
1015433d0511Smrg# Public sister of _AM_SUBST_NOTMAKE.
1016433d0511SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1017433d0511Smrg
1018433d0511Smrg# Check how to create a tarball.                            -*- Autoconf -*-
1019433d0511Smrg
1020433d0511Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
10216654de8bSmrg#
1022433d0511Smrg# This file is free software; the Free Software Foundation
1023433d0511Smrg# gives unlimited permission to copy and/or distribute it,
1024433d0511Smrg# with or without modifications, as long as this notice is preserved.
1025433d0511Smrg
1026433d0511Smrg# _AM_PROG_TAR(FORMAT)
1027433d0511Smrg# --------------------
1028433d0511Smrg# Check how to create a tarball in format FORMAT.
1029433d0511Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10306654de8bSmrg#
1031433d0511Smrg# Substitute a variable $(am__tar) that is a command
1032433d0511Smrg# writing to stdout a FORMAT-tarball containing the directory
1033433d0511Smrg# $tardir.
1034433d0511Smrg#     tardir=directory && $(am__tar) > result.tar
10356654de8bSmrg#
1036433d0511Smrg# Substitute a variable $(am__untar) that extract such
1037433d0511Smrg# a tarball read from stdin.
1038433d0511Smrg#     $(am__untar) < result.tar
10396654de8bSmrg#
1040433d0511SmrgAC_DEFUN([_AM_PROG_TAR],
1041433d0511Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1042433d0511Smrg# in the wild :-(  We should find a proper way to deprecate it ...
1043433d0511SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1044eaef79e5Smrg
1045433d0511Smrg# We'll loop over all known methods to create a tar archive until one works.
1046433d0511Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1047eaef79e5Smrg
1048433d0511Smrgm4_if([$1], [v7],
1049433d0511Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1050eaef79e5Smrg
1051433d0511Smrg  [m4_case([$1],
1052433d0511Smrg    [ustar],
1053433d0511Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1054433d0511Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1055433d0511Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1056433d0511Smrg      # and bug#13588).
1057433d0511Smrg      am_max_uid=2097151 # 2^21 - 1
1058433d0511Smrg      am_max_gid=$am_max_uid
1059433d0511Smrg      # The $UID and $GID variables are not portable, so we need to resort
1060433d0511Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1061433d0511Smrg      # below are definitely unexpected, so allow the users to see them
1062433d0511Smrg      # (that is, avoid stderr redirection).
1063433d0511Smrg      am_uid=`id -u || echo unknown`
1064433d0511Smrg      am_gid=`id -g || echo unknown`
1065433d0511Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1066433d0511Smrg      if test $am_uid -le $am_max_uid; then
1067433d0511Smrg         AC_MSG_RESULT([yes])
1068433d0511Smrg      else
1069433d0511Smrg         AC_MSG_RESULT([no])
1070433d0511Smrg         _am_tools=none
1071433d0511Smrg      fi
1072433d0511Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1073433d0511Smrg      if test $am_gid -le $am_max_gid; then
1074433d0511Smrg         AC_MSG_RESULT([yes])
1075433d0511Smrg      else
1076433d0511Smrg        AC_MSG_RESULT([no])
1077433d0511Smrg        _am_tools=none
1078433d0511Smrg      fi],
1079d1a7ce7bSmrg
1080433d0511Smrg  [pax],
1081433d0511Smrg    [],
1082d1a7ce7bSmrg
1083433d0511Smrg  [m4_fatal([Unknown tar format])])
1084cbc4e2beSmrg
1085433d0511Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
10866654de8bSmrg
1087433d0511Smrg  # Go ahead even if we have the value already cached.  We do so because we
1088433d0511Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1089433d0511Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1090433d0511Smrg
1091433d0511Smrg  for _am_tool in $_am_tools; do
1092433d0511Smrg    case $_am_tool in
1093433d0511Smrg    gnutar)
1094433d0511Smrg      for _am_tar in tar gnutar gtar; do
1095433d0511Smrg        AM_RUN_LOG([$_am_tar --version]) && break
1096433d0511Smrg      done
1097433d0511Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1098433d0511Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1099433d0511Smrg      am__untar="$_am_tar -xf -"
1100433d0511Smrg      ;;
1101433d0511Smrg    plaintar)
1102433d0511Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1103433d0511Smrg      # ustar tarball either.
1104433d0511Smrg      (tar --version) >/dev/null 2>&1 && continue
1105433d0511Smrg      am__tar='tar chf - "$$tardir"'
1106433d0511Smrg      am__tar_='tar chf - "$tardir"'
1107433d0511Smrg      am__untar='tar xf -'
1108433d0511Smrg      ;;
1109433d0511Smrg    pax)
1110433d0511Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
1111433d0511Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
1112433d0511Smrg      am__untar='pax -r'
1113433d0511Smrg      ;;
1114433d0511Smrg    cpio)
1115433d0511Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1116433d0511Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1117433d0511Smrg      am__untar='cpio -i -H $1 -d'
1118433d0511Smrg      ;;
1119433d0511Smrg    none)
1120433d0511Smrg      am__tar=false
1121433d0511Smrg      am__tar_=false
1122433d0511Smrg      am__untar=false
1123433d0511Smrg      ;;
1124433d0511Smrg    esac
1125433d0511Smrg
1126433d0511Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
1127433d0511Smrg    # and am__untar set.
1128433d0511Smrg    test -n "${am_cv_prog_tar_$1}" && break
1129433d0511Smrg
1130433d0511Smrg    # tar/untar a dummy directory, and stop if the command works.
1131433d0511Smrg    rm -rf conftest.dir
1132433d0511Smrg    mkdir conftest.dir
1133433d0511Smrg    echo GrepMe > conftest.dir/file
1134433d0511Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1135433d0511Smrg    rm -rf conftest.dir
1136433d0511Smrg    if test -s conftest.tar; then
1137433d0511Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
1138433d0511Smrg      AM_RUN_LOG([cat conftest.dir/file])
1139433d0511Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
11406654de8bSmrg    fi
1141433d0511Smrg  done
1142433d0511Smrg  rm -rf conftest.dir
1143eaef79e5Smrg
1144433d0511Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1145433d0511Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
11462b32c8f7Smrg
1147433d0511SmrgAC_SUBST([am__tar])
1148433d0511SmrgAC_SUBST([am__untar])
1149433d0511Smrg]) # _AM_PROG_TAR
1150cbc4e2beSmrg
1151433d0511Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1152433d0511Smrgdnl serial 11 (pkg-config-0.29)
1153433d0511Smrgdnl
1154433d0511Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1155433d0511Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1156433d0511Smrgdnl
1157433d0511Smrgdnl This program is free software; you can redistribute it and/or modify
1158433d0511Smrgdnl it under the terms of the GNU General Public License as published by
1159433d0511Smrgdnl the Free Software Foundation; either version 2 of the License, or
1160433d0511Smrgdnl (at your option) any later version.
1161433d0511Smrgdnl
1162433d0511Smrgdnl This program is distributed in the hope that it will be useful, but
1163433d0511Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1164433d0511Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1165433d0511Smrgdnl General Public License for more details.
1166433d0511Smrgdnl
1167433d0511Smrgdnl You should have received a copy of the GNU General Public License
1168433d0511Smrgdnl along with this program; if not, write to the Free Software
1169433d0511Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1170433d0511Smrgdnl 02111-1307, USA.
1171433d0511Smrgdnl
1172433d0511Smrgdnl As a special exception to the GNU General Public License, if you
1173433d0511Smrgdnl distribute this file as part of a program that contains a
1174433d0511Smrgdnl configuration script generated by Autoconf, you may include it under
1175433d0511Smrgdnl the same distribution terms that you use for the rest of that
1176433d0511Smrgdnl program.
1177cbc4e2beSmrg
1178433d0511Smrgdnl PKG_PREREQ(MIN-VERSION)
1179433d0511Smrgdnl -----------------------
1180433d0511Smrgdnl Since: 0.29
1181433d0511Smrgdnl
1182433d0511Smrgdnl Verify that the version of the pkg-config macros are at least
1183433d0511Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1184433d0511Smrgdnl installed version of pkg-config, this checks the developer's version
1185433d0511Smrgdnl of pkg.m4 when generating configure.
1186433d0511Smrgdnl
1187433d0511Smrgdnl To ensure that this macro is defined, also add:
1188433d0511Smrgdnl m4_ifndef([PKG_PREREQ],
1189433d0511Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1190433d0511Smrgdnl
1191433d0511Smrgdnl See the "Since" comment for each macro you use to see what version
1192433d0511Smrgdnl of the macros you require.
1193433d0511Smrgm4_defun([PKG_PREREQ],
1194433d0511Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
1195433d0511Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1196433d0511Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1197433d0511Smrg])dnl PKG_PREREQ
1198cbc4e2beSmrg
1199433d0511Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1200433d0511Smrgdnl ----------------------------------
1201433d0511Smrgdnl Since: 0.16
1202433d0511Smrgdnl
1203433d0511Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1204433d0511Smrgdnl first found in the path. Checks that the version of pkg-config found
1205433d0511Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1206433d0511Smrgdnl used since that's the first version where most current features of
1207433d0511Smrgdnl pkg-config existed.
1208433d0511SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1209433d0511Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1210433d0511Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1211433d0511Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1212433d0511SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1213433d0511SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1214433d0511SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1215eaef79e5Smrg
1216433d0511Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1217433d0511Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1218eaef79e5Smrgfi
1219433d0511Smrgif test -n "$PKG_CONFIG"; then
1220433d0511Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
1221433d0511Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1222433d0511Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1223433d0511Smrg		AC_MSG_RESULT([yes])
1224433d0511Smrg	else
1225433d0511Smrg		AC_MSG_RESULT([no])
1226433d0511Smrg		PKG_CONFIG=""
1227433d0511Smrg	fi
1228433d0511Smrgfi[]dnl
1229433d0511Smrg])dnl PKG_PROG_PKG_CONFIG
1230433d0511Smrg
1231433d0511Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1232433d0511Smrgdnl -------------------------------------------------------------------
1233433d0511Smrgdnl Since: 0.18
1234433d0511Smrgdnl
1235433d0511Smrgdnl Check to see whether a particular set of modules exists. Similar to
1236433d0511Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1237433d0511Smrgdnl
1238433d0511Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1239433d0511Smrgdnl only at the first occurence in configure.ac, so if the first place
1240433d0511Smrgdnl it's called might be skipped (such as if it is within an "if", you
1241433d0511Smrgdnl have to call PKG_CHECK_EXISTS manually
1242433d0511SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1243433d0511Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1244433d0511Smrgif test -n "$PKG_CONFIG" && \
1245433d0511Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1246433d0511Smrg  m4_default([$2], [:])
1247433d0511Smrgm4_ifvaln([$3], [else
1248433d0511Smrg  $3])dnl
1249433d0511Smrgfi])
1250433d0511Smrg
1251433d0511Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1252433d0511Smrgdnl ---------------------------------------------
1253433d0511Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1254433d0511Smrgdnl pkg_failed based on the result.
1255433d0511Smrgm4_define([_PKG_CONFIG],
1256433d0511Smrg[if test -n "$$1"; then
1257433d0511Smrg    pkg_cv_[]$1="$$1"
1258433d0511Smrg elif test -n "$PKG_CONFIG"; then
1259433d0511Smrg    PKG_CHECK_EXISTS([$3],
1260433d0511Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1261433d0511Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
1262433d0511Smrg		     [pkg_failed=yes])
1263433d0511Smrg else
1264433d0511Smrg    pkg_failed=untried
1265433d0511Smrgfi[]dnl
1266433d0511Smrg])dnl _PKG_CONFIG
1267433d0511Smrg
1268433d0511Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1269433d0511Smrgdnl ---------------------------
1270433d0511Smrgdnl Internal check to see if pkg-config supports short errors.
1271433d0511SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1272433d0511Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1273433d0511Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1274433d0511Smrg        _pkg_short_errors_supported=yes
1275eaef79e5Smrgelse
1276433d0511Smrg        _pkg_short_errors_supported=no
1277433d0511Smrgfi[]dnl
1278433d0511Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1279eaef79e5Smrg
1280eaef79e5Smrg
1281433d0511Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1282433d0511Smrgdnl   [ACTION-IF-NOT-FOUND])
1283433d0511Smrgdnl --------------------------------------------------------------
1284433d0511Smrgdnl Since: 0.4.0
1285433d0511Smrgdnl
1286433d0511Smrgdnl Note that if there is a possibility the first call to
1287433d0511Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1288433d0511Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1289433d0511SmrgAC_DEFUN([PKG_CHECK_MODULES],
1290433d0511Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1291433d0511SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1292433d0511SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1293eaef79e5Smrg
1294433d0511Smrgpkg_failed=no
1295433d0511SmrgAC_MSG_CHECKING([for $1])
1296eaef79e5Smrg
1297433d0511Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1298433d0511Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1299eaef79e5Smrg
1300433d0511Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1301433d0511Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1302433d0511SmrgSee the pkg-config man page for more details.])
1303eaef79e5Smrg
1304433d0511Smrgif test $pkg_failed = yes; then
1305433d0511Smrg   	AC_MSG_RESULT([no])
1306433d0511Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1307433d0511Smrg        if test $_pkg_short_errors_supported = yes; then
1308433d0511Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1309433d0511Smrg        else 
1310433d0511Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1311433d0511Smrg        fi
1312433d0511Smrg	# Put the nasty error message in config.log where it belongs
1313433d0511Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1314eaef79e5Smrg
1315433d0511Smrg	m4_default([$4], [AC_MSG_ERROR(
1316433d0511Smrg[Package requirements ($2) were not met:
1317eaef79e5Smrg
1318433d0511Smrg$$1_PKG_ERRORS
1319433d0511Smrg
1320433d0511SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1321433d0511Smrginstalled software in a non-standard prefix.
1322433d0511Smrg
1323433d0511Smrg_PKG_TEXT])[]dnl
1324433d0511Smrg        ])
1325433d0511Smrgelif test $pkg_failed = untried; then
1326433d0511Smrg     	AC_MSG_RESULT([no])
1327433d0511Smrg	m4_default([$4], [AC_MSG_FAILURE(
1328433d0511Smrg[The pkg-config script could not be found or is too old.  Make sure it
1329433d0511Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1330433d0511Smrgpath to pkg-config.
1331433d0511Smrg
1332433d0511Smrg_PKG_TEXT
1333433d0511Smrg
1334433d0511SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1335433d0511Smrg        ])
133695e0246bSmrgelse
1337433d0511Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1338433d0511Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1339433d0511Smrg        AC_MSG_RESULT([yes])
1340433d0511Smrg	$3
1341433d0511Smrgfi[]dnl
1342433d0511Smrg])dnl PKG_CHECK_MODULES
134395e0246bSmrg
134495e0246bSmrg
1345433d0511Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1346433d0511Smrgdnl   [ACTION-IF-NOT-FOUND])
1347433d0511Smrgdnl ---------------------------------------------------------------------
1348433d0511Smrgdnl Since: 0.29
1349433d0511Smrgdnl
1350433d0511Smrgdnl Checks for existence of MODULES and gathers its build flags with
1351433d0511Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1352433d0511Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1353433d0511Smrgdnl
1354433d0511Smrgdnl Note that if there is a possibility the first call to
1355433d0511Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1356433d0511Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1357433d0511Smrgdnl configure.ac.
1358433d0511SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1359433d0511Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1360433d0511Smrg_save_PKG_CONFIG=$PKG_CONFIG
1361433d0511SmrgPKG_CONFIG="$PKG_CONFIG --static"
1362433d0511SmrgPKG_CHECK_MODULES($@)
1363433d0511SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1364433d0511Smrg])dnl PKG_CHECK_MODULES_STATIC
1365433d0511Smrg
1366433d0511Smrg
1367433d0511Smrgdnl PKG_INSTALLDIR([DIRECTORY])
1368433d0511Smrgdnl -------------------------
1369433d0511Smrgdnl Since: 0.27
1370433d0511Smrgdnl
1371433d0511Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
1372433d0511Smrgdnl should install pkg-config .pc files. By default the directory is
1373433d0511Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
1374433d0511Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1375433d0511Smrgdnl parameter.
1376433d0511SmrgAC_DEFUN([PKG_INSTALLDIR],
1377433d0511Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1378433d0511Smrgm4_pushdef([pkg_description],
1379433d0511Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1380433d0511SmrgAC_ARG_WITH([pkgconfigdir],
1381433d0511Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1382433d0511Smrg    [with_pkgconfigdir=]pkg_default)
1383433d0511SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1384433d0511Smrgm4_popdef([pkg_default])
1385433d0511Smrgm4_popdef([pkg_description])
1386433d0511Smrg])dnl PKG_INSTALLDIR
1387eaef79e5Smrg
1388eaef79e5Smrg
1389433d0511Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1390433d0511Smrgdnl --------------------------------
1391433d0511Smrgdnl Since: 0.27
1392433d0511Smrgdnl
1393433d0511Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1394433d0511Smrgdnl module should install arch-independent pkg-config .pc files. By
1395433d0511Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
1396433d0511Smrgdnl changed by passing DIRECTORY. The user can override through the
1397433d0511Smrgdnl --with-noarch-pkgconfigdir parameter.
1398433d0511SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1399433d0511Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1400433d0511Smrgm4_pushdef([pkg_description],
1401433d0511Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1402433d0511SmrgAC_ARG_WITH([noarch-pkgconfigdir],
1403433d0511Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1404433d0511Smrg    [with_noarch_pkgconfigdir=]pkg_default)
1405433d0511SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1406433d0511Smrgm4_popdef([pkg_default])
1407433d0511Smrgm4_popdef([pkg_description])
1408433d0511Smrg])dnl PKG_NOARCH_INSTALLDIR
1409eaef79e5Smrg
1410eaef79e5Smrg
1411433d0511Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1412433d0511Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1413433d0511Smrgdnl -------------------------------------------
1414433d0511Smrgdnl Since: 0.28
1415433d0511Smrgdnl
1416433d0511Smrgdnl Retrieves the value of the pkg-config variable for the given module.
1417433d0511SmrgAC_DEFUN([PKG_CHECK_VAR],
1418433d0511Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1419433d0511SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1420eaef79e5Smrg
1421433d0511Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1422433d0511SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1423eaef79e5Smrg
1424433d0511SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1425433d0511Smrg])dnl PKG_CHECK_VAR
1426eaef79e5Smrg
1427433d0511Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1428433d0511Smrgdnl
1429433d0511Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
1430433d0511Smrgdnl
1431433d0511Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1432433d0511Smrgdnl copy of this software and associated documentation files (the "Software"),
1433433d0511Smrgdnl to deal in the Software without restriction, including without limitation
1434433d0511Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1435433d0511Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1436433d0511Smrgdnl Software is furnished to do so, subject to the following conditions:
1437433d0511Smrgdnl
1438433d0511Smrgdnl The above copyright notice and this permission notice (including the next
1439433d0511Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1440433d0511Smrgdnl Software.
1441433d0511Smrgdnl
1442433d0511Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1443433d0511Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1444433d0511Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1445433d0511Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1446433d0511Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1447433d0511Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1448433d0511Smrgdnl DEALINGS IN THE SOFTWARE.
1449433d0511Smrg
1450433d0511Smrg# XORG_MACROS_VERSION(required-version)
1451433d0511Smrg# -------------------------------------
14526654de8bSmrg# Minimum version: 1.1.0
1453eaef79e5Smrg#
1454433d0511Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1455433d0511Smrg# your configure.ac with the minimum required version, such as:
1456433d0511Smrg# XORG_MACROS_VERSION(1.1)
14576654de8bSmrg#
1458433d0511Smrg# To ensure that this macro is defined, also add:
1459433d0511Smrg# m4_ifndef([XORG_MACROS_VERSION],
1460433d0511Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
14616654de8bSmrg#
1462433d0511Smrg#
1463433d0511Smrg# See the "minimum version" comment for each macro you use to see what
1464433d0511Smrg# version you require.
1465433d0511Smrgm4_defun([XORG_MACROS_VERSION],[
1466433d0511Smrgm4_define([vers_have], [1.20.0])
1467433d0511Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1468433d0511Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1469433d0511Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1470433d0511Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1471433d0511Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1472433d0511Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1473433d0511Smrgm4_undefine([vers_have])
1474433d0511Smrgm4_undefine([maj_have])
1475433d0511Smrgm4_undefine([maj_needed])
1476433d0511Smrg]) # XORG_MACROS_VERSION
1477eaef79e5Smrg
1478433d0511Smrg# XORG_PROG_RAWCPP()
1479433d0511Smrg# ------------------
1480433d0511Smrg# Minimum version: 1.0.0
1481433d0511Smrg#
1482433d0511Smrg# Find cpp program and necessary flags for use in pre-processing text files
1483433d0511Smrg# such as man pages and config files
1484433d0511SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1485433d0511SmrgAC_REQUIRE([AC_PROG_CPP])
1486433d0511SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1487433d0511Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1488eaef79e5Smrg
1489433d0511Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1490433d0511Smrg# which is not the best choice for supporting other OS'es, but covers most
1491433d0511Smrg# of the ones we need for now.
1492433d0511SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1493433d0511SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1494433d0511Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1495433d0511Smrg	AC_MSG_RESULT([no])
1496433d0511Smrgelse
1497433d0511Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1498433d0511Smrg		RAWCPPFLAGS=-undef
1499433d0511Smrg		AC_MSG_RESULT([yes])
1500433d0511Smrg	# under Cygwin unix is still defined even with -undef
1501433d0511Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1502433d0511Smrg		RAWCPPFLAGS="-undef -ansi"
1503433d0511Smrg		AC_MSG_RESULT([yes, with -ansi])
1504433d0511Smrg	else
1505433d0511Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1506433d0511Smrg	fi
1507eaef79e5Smrgfi
1508433d0511Smrgrm -f conftest.$ac_ext
1509eaef79e5Smrg
1510433d0511SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1511433d0511SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1512433d0511Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1513433d0511Smrg	AC_MSG_RESULT([no])
1514433d0511Smrgelse
1515433d0511Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1516433d0511Smrg		TRADITIONALCPPFLAGS="-traditional"
1517433d0511Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1518433d0511Smrg		AC_MSG_RESULT([yes])
1519433d0511Smrg	else
1520433d0511Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1521433d0511Smrg	fi
1522433d0511Smrgfi
1523433d0511Smrgrm -f conftest.$ac_ext
1524433d0511SmrgAC_SUBST(RAWCPPFLAGS)
1525433d0511SmrgAC_SUBST(TRADITIONALCPPFLAGS)
1526433d0511Smrg]) # XORG_PROG_RAWCPP
15276654de8bSmrg
1528433d0511Smrg# XORG_MANPAGE_SECTIONS()
1529433d0511Smrg# -----------------------
1530433d0511Smrg# Minimum version: 1.0.0
153195e0246bSmrg#
1532433d0511Smrg# Determine which sections man pages go in for the different man page types
1533433d0511Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1534433d0511Smrg# Not sure if there's any better way than just hardcoding by OS name.
1535433d0511Smrg# Override default settings by setting environment variables
1536433d0511Smrg# Added MAN_SUBSTS in version 1.8
1537433d0511Smrg# Added AC_PROG_SED in version 1.8
15386654de8bSmrg
1539433d0511SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1540433d0511SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1541433d0511SmrgAC_REQUIRE([AC_PROG_SED])
15426654de8bSmrg
1543433d0511Smrgcase $host_os in
1544433d0511Smrg    solaris*)
1545433d0511Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1546433d0511Smrg        # check for a man page file found in later versions that use
1547433d0511Smrg        # traditional section numbers instead
1548433d0511Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1549433d0511Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1550433d0511Smrg        ;;
1551433d0511Smrg    *) SYSV_MAN_SECTIONS=false ;;
1552433d0511Smrgesac
15536654de8bSmrg
1554433d0511Smrgif test x$APP_MAN_SUFFIX = x    ; then
1555433d0511Smrg    APP_MAN_SUFFIX=1
1556433d0511Smrgfi
1557433d0511Smrgif test x$APP_MAN_DIR = x    ; then
1558433d0511Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
155995e0246bSmrgfi
156095e0246bSmrg
1561433d0511Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1562433d0511Smrg    LIB_MAN_SUFFIX=3
1563433d0511Smrgfi
1564433d0511Smrgif test x$LIB_MAN_DIR = x    ; then
1565433d0511Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
15666654de8bSmrgfi
156795e0246bSmrg
1568433d0511Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1569433d0511Smrg    case $SYSV_MAN_SECTIONS in
1570433d0511Smrg	true)				FILE_MAN_SUFFIX=4  ;;
1571433d0511Smrg	*)				FILE_MAN_SUFFIX=5  ;;
1572433d0511Smrg    esac
1573433d0511Smrgfi
1574433d0511Smrgif test x$FILE_MAN_DIR = x    ; then
1575433d0511Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1576433d0511Smrgfi
157795e0246bSmrg
1578433d0511Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1579433d0511Smrg    case $SYSV_MAN_SECTIONS in
1580433d0511Smrg	true)				MISC_MAN_SUFFIX=5  ;;
1581433d0511Smrg	*)				MISC_MAN_SUFFIX=7  ;;
1582433d0511Smrg    esac
1583433d0511Smrgfi
1584433d0511Smrgif test x$MISC_MAN_DIR = x    ; then
1585433d0511Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1586433d0511Smrgfi
15876654de8bSmrg
1588433d0511Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1589433d0511Smrg    case $SYSV_MAN_SECTIONS in
1590433d0511Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1591433d0511Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1592433d0511Smrg    esac
1593433d0511Smrgfi
1594433d0511Smrgif test x$DRIVER_MAN_DIR = x    ; then
1595433d0511Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1596433d0511Smrgfi
15976654de8bSmrg
1598433d0511Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1599433d0511Smrg    case $SYSV_MAN_SECTIONS in
1600433d0511Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1601433d0511Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
1602433d0511Smrg    esac
1603433d0511Smrgfi
1604433d0511Smrgif test x$ADMIN_MAN_DIR = x    ; then
1605433d0511Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1606433d0511Smrgfi
16076654de8bSmrg
16086654de8bSmrg
1609433d0511SmrgAC_SUBST([APP_MAN_SUFFIX])
1610433d0511SmrgAC_SUBST([LIB_MAN_SUFFIX])
1611433d0511SmrgAC_SUBST([FILE_MAN_SUFFIX])
1612433d0511SmrgAC_SUBST([MISC_MAN_SUFFIX])
1613433d0511SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1614433d0511SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1615433d0511SmrgAC_SUBST([APP_MAN_DIR])
1616433d0511SmrgAC_SUBST([LIB_MAN_DIR])
1617433d0511SmrgAC_SUBST([FILE_MAN_DIR])
1618433d0511SmrgAC_SUBST([MISC_MAN_DIR])
1619433d0511SmrgAC_SUBST([DRIVER_MAN_DIR])
1620433d0511SmrgAC_SUBST([ADMIN_MAN_DIR])
16216654de8bSmrg
1622433d0511SmrgXORG_MAN_PAGE="X Version 11"
1623433d0511SmrgAC_SUBST([XORG_MAN_PAGE])
1624433d0511SmrgMAN_SUBSTS="\
1625433d0511Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1626433d0511Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1627433d0511Smrg	-e 's|__xservername__|Xorg|g' \
1628433d0511Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1629433d0511Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1630433d0511Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1631433d0511Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1632433d0511Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1633433d0511Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1634433d0511Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1635433d0511Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1636433d0511Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1637433d0511SmrgAC_SUBST([MAN_SUBSTS])
1638cbc4e2beSmrg
1639433d0511Smrg]) # XORG_MANPAGE_SECTIONS
16406654de8bSmrg
1641433d0511Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1642433d0511Smrg# ------------------------
1643433d0511Smrg# Minimum version: 1.7.0
1644433d0511Smrg#
1645433d0511Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1646433d0511Smrg# provided by xorg-sgml-doctools, if installed.
1647433d0511SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1648433d0511SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1649433d0511SmrgXORG_SGML_PATH=
1650433d0511SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1651433d0511Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1652433d0511Smrg    [m4_ifval([$1],[:],
1653433d0511Smrg        [if test x"$cross_compiling" != x"yes" ; then
1654433d0511Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1655433d0511Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1656433d0511Smrg         fi])
1657433d0511Smrg    ])
1658433d0511Smrg
1659433d0511Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1660433d0511Smrg# the path and the name of the doc stylesheet
1661433d0511Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1662433d0511Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1663433d0511Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1664433d0511Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1665cbc4e2beSmrgelse
1666433d0511Smrg   AC_MSG_RESULT([no])
1667cbc4e2beSmrgfi
1668cbc4e2beSmrg
1669433d0511SmrgAC_SUBST(XORG_SGML_PATH)
1670433d0511SmrgAC_SUBST(STYLESHEET_SRCDIR)
1671433d0511SmrgAC_SUBST(XSL_STYLESHEET)
1672433d0511SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1673433d0511Smrg]) # XORG_CHECK_SGML_DOCTOOLS
16746654de8bSmrg
1675433d0511Smrg# XORG_CHECK_LINUXDOC
1676433d0511Smrg# -------------------
1677433d0511Smrg# Minimum version: 1.0.0
1678433d0511Smrg#
1679433d0511Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1680433d0511Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1681433d0511Smrg# Whether or not the necessary tools and files are found can be checked
1682433d0511Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1683433d0511SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1684433d0511SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1685433d0511SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
16866654de8bSmrg
1687433d0511SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
16886654de8bSmrg
1689433d0511SmrgAC_MSG_CHECKING([whether to build documentation])
16906654de8bSmrg
1691433d0511Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1692433d0511Smrg   BUILDDOC=yes
1693433d0511Smrgelse
1694433d0511Smrg   BUILDDOC=no
16956654de8bSmrgfi
16966654de8bSmrg
1697433d0511SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
16986654de8bSmrg
1699433d0511SmrgAC_MSG_RESULT([$BUILDDOC])
17006654de8bSmrg
1701433d0511SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1702433d0511Smrg
1703433d0511Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1704433d0511Smrg   BUILDPDFDOC=yes
1705433d0511Smrgelse
1706433d0511Smrg   BUILDPDFDOC=no
1707433d0511Smrgfi
1708433d0511Smrg
1709433d0511SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1710433d0511Smrg
1711433d0511SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1712433d0511Smrg
1713433d0511SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1714433d0511SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1715433d0511SmrgMAKE_PDF="$PS2PDF"
1716433d0511SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1717433d0511Smrg
1718433d0511SmrgAC_SUBST(MAKE_TEXT)
1719433d0511SmrgAC_SUBST(MAKE_PS)
1720433d0511SmrgAC_SUBST(MAKE_PDF)
1721433d0511SmrgAC_SUBST(MAKE_HTML)
1722433d0511Smrg]) # XORG_CHECK_LINUXDOC
1723433d0511Smrg
1724433d0511Smrg# XORG_CHECK_DOCBOOK
1725433d0511Smrg# -------------------
1726433d0511Smrg# Minimum version: 1.0.0
1727cbc4e2beSmrg#
1728433d0511Smrg# Checks for the ability to build output formats from SGML DocBook source.
1729433d0511Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1730433d0511Smrg# indicates whether the necessary tools and files are found and, if set,
1731433d0511Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1732433d0511SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1733433d0511SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1734cbc4e2beSmrg
1735433d0511SmrgBUILDTXTDOC=no
1736433d0511SmrgBUILDPDFDOC=no
1737433d0511SmrgBUILDPSDOC=no
1738433d0511SmrgBUILDHTMLDOC=no
1739cbc4e2beSmrg
1740433d0511SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1741433d0511SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1742433d0511SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1743433d0511SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1744cbc4e2beSmrg
1745433d0511SmrgAC_MSG_CHECKING([whether to build text documentation])
1746433d0511Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1747433d0511Smrg   test x$BUILD_TXTDOC != xno; then
1748433d0511Smrg	BUILDTXTDOC=yes
1749433d0511Smrgfi
1750433d0511SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1751433d0511SmrgAC_MSG_RESULT([$BUILDTXTDOC])
17526654de8bSmrg
1753433d0511SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1754433d0511Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1755433d0511Smrg   test x$BUILD_PDFDOC != xno; then
1756433d0511Smrg	BUILDPDFDOC=yes
1757433d0511Smrgfi
1758433d0511SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1759433d0511SmrgAC_MSG_RESULT([$BUILDPDFDOC])
17606654de8bSmrg
1761433d0511SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1762433d0511Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1763433d0511Smrg   test x$BUILD_PSDOC != xno; then
1764433d0511Smrg	BUILDPSDOC=yes
17656654de8bSmrgfi
1766433d0511SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1767433d0511SmrgAC_MSG_RESULT([$BUILDPSDOC])
17686654de8bSmrg
1769433d0511SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1770433d0511Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1771433d0511Smrg   test x$BUILD_HTMLDOC != xno; then
1772433d0511Smrg	BUILDHTMLDOC=yes
1773433d0511Smrgfi
1774433d0511SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1775433d0511SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
17766654de8bSmrg
1777433d0511SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1778433d0511SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1779433d0511SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1780433d0511SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1781433d0511Smrg
1782433d0511SmrgAC_SUBST(MAKE_TEXT)
1783433d0511SmrgAC_SUBST(MAKE_PS)
1784433d0511SmrgAC_SUBST(MAKE_PDF)
1785433d0511SmrgAC_SUBST(MAKE_HTML)
1786433d0511Smrg]) # XORG_CHECK_DOCBOOK
1787433d0511Smrg
1788433d0511Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
17896654de8bSmrg# ----------------
1790433d0511Smrg# Minimum version: 1.5.0
1791433d0511Smrg# Minimum version for optional DEFAULT argument: 1.11.0
179295e0246bSmrg#
1793433d0511Smrg# Documentation tools are not always available on all platforms and sometimes
1794433d0511Smrg# not at the appropriate level. This macro enables a module to test for the
1795433d0511Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1796433d0511Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
1797433d0511Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1798433d0511Smrg# --with-xmlto assumes 'auto'.
179995e0246bSmrg#
1800433d0511Smrg# Interface to module:
1801433d0511Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1802433d0511Smrg# XMLTO:	returns the path of the xmlto program found
1803433d0511Smrg#		returns the path set by the user in the environment
1804433d0511Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1805433d0511Smrg#		'no' user instructs the module not to use xmlto
1806433d0511Smrg#
1807433d0511Smrg# Added in version 1.10.0
1808433d0511Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1809433d0511Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1810433d0511Smrg#
1811433d0511Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1812433d0511Smrg#
1813433d0511SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1814433d0511SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1815433d0511Smrgm4_define([_defopt], m4_default([$2], [auto]))
1816433d0511SmrgAC_ARG_WITH(xmlto,
1817433d0511Smrg	AS_HELP_STRING([--with-xmlto],
1818433d0511Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1819433d0511Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1820433d0511Smrgm4_undefine([_defopt])
182195e0246bSmrg
1822433d0511Smrgif test "x$use_xmlto" = x"auto"; then
1823433d0511Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1824433d0511Smrg   if test "x$XMLTO" = "x"; then
1825433d0511Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1826433d0511Smrg	have_xmlto=no
1827433d0511Smrg   else
1828433d0511Smrg        have_xmlto=yes
1829433d0511Smrg   fi
1830433d0511Smrgelif test "x$use_xmlto" = x"yes" ; then
1831433d0511Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1832433d0511Smrg   if test "x$XMLTO" = "x"; then
1833433d0511Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1834433d0511Smrg   fi
1835433d0511Smrg   have_xmlto=yes
1836433d0511Smrgelif test "x$use_xmlto" = x"no" ; then
1837433d0511Smrg   if test "x$XMLTO" != "x"; then
1838433d0511Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1839433d0511Smrg   fi
1840433d0511Smrg   have_xmlto=no
1841433d0511Smrgelse
1842433d0511Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1843433d0511Smrgfi
1844433d0511Smrg
1845433d0511Smrg# Test for a minimum version of xmlto, if provided.
1846433d0511Smrgm4_ifval([$1],
1847433d0511Smrg[if test "$have_xmlto" = yes; then
1848433d0511Smrg    # scrape the xmlto version
1849433d0511Smrg    AC_MSG_CHECKING([the xmlto version])
1850433d0511Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1851433d0511Smrg    AC_MSG_RESULT([$xmlto_version])
1852433d0511Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1853433d0511Smrg        [if test "x$use_xmlto" = xauto; then
1854433d0511Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1855433d0511Smrg            have_xmlto=no
1856433d0511Smrg        else
1857433d0511Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1858433d0511Smrg        fi])
1859433d0511Smrgfi])
18606654de8bSmrg
1861433d0511Smrg# Test for the ability of xmlto to generate a text target
1862433d0511Smrg#
1863433d0511Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
1864433d0511Smrg# following test for empty XML docbook files.
1865433d0511Smrg# For compatibility reasons use the following empty XML docbook file and if
1866433d0511Smrg# it fails try it again with a non-empty XML file.
1867433d0511Smrghave_xmlto_text=no
1868433d0511Smrgcat > conftest.xml << "EOF"
1869433d0511SmrgEOF
1870433d0511SmrgAS_IF([test "$have_xmlto" = yes],
1871433d0511Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1872433d0511Smrg             [have_xmlto_text=yes],
1873433d0511Smrg             [# Try it again with a non-empty XML file.
1874433d0511Smrg              cat > conftest.xml << "EOF"
1875433d0511Smrg<x></x>
1876433d0511SmrgEOF
1877433d0511Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1878433d0511Smrg                    [have_xmlto_text=yes],
1879433d0511Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
1880433d0511Smrgrm -f conftest.xml
1881433d0511SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1882433d0511SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1883433d0511Smrg]) # XORG_WITH_XMLTO
18846654de8bSmrg
1885433d0511Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1886433d0511Smrg# --------------------------------------------
1887433d0511Smrg# Minimum version: 1.12.0
1888433d0511Smrg# Minimum version for optional DEFAULT argument: 1.12.0
188995e0246bSmrg#
1890433d0511Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1891433d0511Smrg# XML-based language used for the transformation of XML documents.
1892433d0511Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1893433d0511Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1894433d0511Smrg# The XSLT processor is often used as a standalone tool for transformations.
1895433d0511Smrg# It should not be assumed that this tool is used only to work with documnetation.
1896433d0511Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
189795e0246bSmrg#
1898433d0511Smrg# Interface to module:
1899433d0511Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1900433d0511Smrg# XSLTPROC:	 returns the path of the xsltproc program found
1901433d0511Smrg#		 returns the path set by the user in the environment
1902433d0511Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1903433d0511Smrg#		  'no' user instructs the module not to use xsltproc
1904433d0511Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
190595e0246bSmrg#
1906433d0511Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
190795e0246bSmrg#
1908433d0511SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1909433d0511SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1910433d0511Smrg# Preserves the interface, should it be implemented later
1911433d0511Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1912433d0511Smrgm4_define([_defopt], m4_default([$2], [auto]))
1913433d0511SmrgAC_ARG_WITH(xsltproc,
1914433d0511Smrg	AS_HELP_STRING([--with-xsltproc],
1915433d0511Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1916433d0511Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1917433d0511Smrgm4_undefine([_defopt])
191895e0246bSmrg
1919433d0511Smrgif test "x$use_xsltproc" = x"auto"; then
1920433d0511Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1921433d0511Smrg   if test "x$XSLTPROC" = "x"; then
1922433d0511Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1923433d0511Smrg	have_xsltproc=no
1924433d0511Smrg   else
1925433d0511Smrg        have_xsltproc=yes
1926433d0511Smrg   fi
1927433d0511Smrgelif test "x$use_xsltproc" = x"yes" ; then
1928433d0511Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1929433d0511Smrg   if test "x$XSLTPROC" = "x"; then
1930433d0511Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1931433d0511Smrg   fi
1932433d0511Smrg   have_xsltproc=yes
1933433d0511Smrgelif test "x$use_xsltproc" = x"no" ; then
1934433d0511Smrg   if test "x$XSLTPROC" != "x"; then
1935433d0511Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1936433d0511Smrg   fi
1937433d0511Smrg   have_xsltproc=no
1938433d0511Smrgelse
1939433d0511Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1940433d0511Smrgfi
19416654de8bSmrg
1942433d0511SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1943433d0511Smrg]) # XORG_WITH_XSLTPROC
19446654de8bSmrg
1945433d0511Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1946433d0511Smrg# ----------------------------------------
1947433d0511Smrg# Minimum version: 1.15.0
194895e0246bSmrg#
1949433d0511Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
1950433d0511Smrg# scanning arbitrary text files, extracting information from those text files,
1951433d0511Smrg# and printing reports based on that information.
195295e0246bSmrg#
1953433d0511Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
195495e0246bSmrg#
1955433d0511Smrg# Interface to module:
1956433d0511Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
1957433d0511Smrg# PERL:	     returns the path of the perl program found
1958433d0511Smrg#	     returns the path set by the user in the environment
1959433d0511Smrg# --with-perl: 'yes' user instructs the module to use perl
1960433d0511Smrg#	       'no' user instructs the module not to use perl
1961433d0511Smrg# have_perl: returns yes if perl found in PATH or no
196295e0246bSmrg#
1963433d0511Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
196495e0246bSmrg#
1965433d0511SmrgAC_DEFUN([XORG_WITH_PERL],[
1966433d0511SmrgAC_ARG_VAR([PERL], [Path to perl command])
1967433d0511Smrg# Preserves the interface, should it be implemented later
1968433d0511Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1969433d0511Smrgm4_define([_defopt], m4_default([$2], [auto]))
1970433d0511SmrgAC_ARG_WITH(perl,
1971433d0511Smrg	AS_HELP_STRING([--with-perl],
1972433d0511Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1973433d0511Smrg	   [use_perl=$withval], [use_perl=]_defopt)
1974433d0511Smrgm4_undefine([_defopt])
197595e0246bSmrg
1976433d0511Smrgif test "x$use_perl" = x"auto"; then
1977433d0511Smrg   AC_PATH_PROG([PERL], [perl])
1978433d0511Smrg   if test "x$PERL" = "x"; then
1979433d0511Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1980433d0511Smrg	have_perl=no
1981433d0511Smrg   else
1982433d0511Smrg        have_perl=yes
1983433d0511Smrg   fi
1984433d0511Smrgelif test "x$use_perl" = x"yes" ; then
1985433d0511Smrg   AC_PATH_PROG([PERL], [perl])
1986433d0511Smrg   if test "x$PERL" = "x"; then
1987433d0511Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1988433d0511Smrg   fi
1989433d0511Smrg   have_perl=yes
1990433d0511Smrgelif test "x$use_perl" = x"no" ; then
1991433d0511Smrg   if test "x$PERL" != "x"; then
1992433d0511Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1993433d0511Smrg   fi
1994433d0511Smrg   have_perl=no
1995433d0511Smrgelse
1996433d0511Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1997433d0511Smrgfi
19986654de8bSmrg
1999433d0511SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2000433d0511Smrg]) # XORG_WITH_PERL
20016654de8bSmrg
2002433d0511Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2003433d0511Smrg# ----------------
2004433d0511Smrg# Minimum version: 1.5.0
2005433d0511Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2006433d0511Smrg#
2007433d0511Smrg# Documentation tools are not always available on all platforms and sometimes
2008433d0511Smrg# not at the appropriate level. This macro enables a module to test for the
2009433d0511Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2010433d0511Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
2011433d0511Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2012433d0511Smrg# --with-asciidoc assumes 'auto'.
2013433d0511Smrg#
2014433d0511Smrg# Interface to module:
2015433d0511Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2016433d0511Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
2017433d0511Smrg#		 returns the path set by the user in the environment
2018433d0511Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2019433d0511Smrg#		  'no' user instructs the module not to use asciidoc
20206654de8bSmrg#
2021433d0511Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2022433d0511Smrg#
2023433d0511SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2024433d0511SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2025433d0511Smrgm4_define([_defopt], m4_default([$2], [auto]))
2026433d0511SmrgAC_ARG_WITH(asciidoc,
2027433d0511Smrg	AS_HELP_STRING([--with-asciidoc],
2028433d0511Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2029433d0511Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2030433d0511Smrgm4_undefine([_defopt])
20316654de8bSmrg
2032433d0511Smrgif test "x$use_asciidoc" = x"auto"; then
2033433d0511Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2034433d0511Smrg   if test "x$ASCIIDOC" = "x"; then
2035433d0511Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2036433d0511Smrg	have_asciidoc=no
2037433d0511Smrg   else
2038433d0511Smrg        have_asciidoc=yes
2039433d0511Smrg   fi
2040433d0511Smrgelif test "x$use_asciidoc" = x"yes" ; then
2041433d0511Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2042433d0511Smrg   if test "x$ASCIIDOC" = "x"; then
2043433d0511Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2044433d0511Smrg   fi
2045433d0511Smrg   have_asciidoc=yes
2046433d0511Smrgelif test "x$use_asciidoc" = x"no" ; then
2047433d0511Smrg   if test "x$ASCIIDOC" != "x"; then
2048433d0511Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2049433d0511Smrg   fi
2050433d0511Smrg   have_asciidoc=no
205195e0246bSmrgelse
2052433d0511Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
205395e0246bSmrgfi
2054433d0511Smrgm4_ifval([$1],
2055433d0511Smrg[if test "$have_asciidoc" = yes; then
2056433d0511Smrg    # scrape the asciidoc version
2057433d0511Smrg    AC_MSG_CHECKING([the asciidoc version])
2058433d0511Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2059433d0511Smrg    AC_MSG_RESULT([$asciidoc_version])
2060433d0511Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2061433d0511Smrg        [if test "x$use_asciidoc" = xauto; then
2062433d0511Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2063433d0511Smrg            have_asciidoc=no
2064433d0511Smrg        else
2065433d0511Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2066433d0511Smrg        fi])
2067433d0511Smrgfi])
2068433d0511SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2069433d0511Smrg]) # XORG_WITH_ASCIIDOC
207095e0246bSmrg
2071433d0511Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
2072433d0511Smrg# -------------------------------------------
2073433d0511Smrg# Minimum version: 1.5.0
2074433d0511Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2075433d0511Smrg# Minimum version for optional DOT checking: 1.18.0
20766654de8bSmrg#
2077433d0511Smrg# Documentation tools are not always available on all platforms and sometimes
2078433d0511Smrg# not at the appropriate level. This macro enables a module to test for the
2079433d0511Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2080433d0511Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
2081433d0511Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2082433d0511Smrg# --with-doxygen assumes 'auto'.
208395e0246bSmrg#
2084433d0511Smrg# Interface to module:
2085433d0511Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2086433d0511Smrg# DOXYGEN:	 returns the path of the doxygen program found
2087433d0511Smrg#		 returns the path set by the user in the environment
2088433d0511Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2089433d0511Smrg#		  'no' user instructs the module not to use doxygen
2090433d0511Smrg#
2091433d0511Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2092433d0511Smrg#
2093433d0511SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2094433d0511SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2095433d0511SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
2096433d0511Smrgm4_define([_defopt], m4_default([$2], [auto]))
2097433d0511SmrgAC_ARG_WITH(doxygen,
2098433d0511Smrg	AS_HELP_STRING([--with-doxygen],
2099433d0511Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2100433d0511Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2101433d0511Smrgm4_undefine([_defopt])
2102d1a7ce7bSmrg
2103433d0511Smrgif test "x$use_doxygen" = x"auto"; then
2104433d0511Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2105433d0511Smrg   if test "x$DOXYGEN" = "x"; then
2106433d0511Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2107433d0511Smrg	have_doxygen=no
2108433d0511Smrg   else
2109433d0511Smrg        have_doxygen=yes
2110433d0511Smrg   fi
2111433d0511Smrgelif test "x$use_doxygen" = x"yes" ; then
2112433d0511Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2113433d0511Smrg   if test "x$DOXYGEN" = "x"; then
2114433d0511Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2115433d0511Smrg   fi
2116433d0511Smrg   have_doxygen=yes
2117433d0511Smrgelif test "x$use_doxygen" = x"no" ; then
2118433d0511Smrg   if test "x$DOXYGEN" != "x"; then
2119433d0511Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2120433d0511Smrg   fi
2121433d0511Smrg   have_doxygen=no
2122433d0511Smrgelse
2123433d0511Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2124433d0511Smrgfi
2125433d0511Smrgm4_ifval([$1],
2126433d0511Smrg[if test "$have_doxygen" = yes; then
2127433d0511Smrg    # scrape the doxygen version
2128433d0511Smrg    AC_MSG_CHECKING([the doxygen version])
2129433d0511Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2130433d0511Smrg    AC_MSG_RESULT([$doxygen_version])
2131433d0511Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2132433d0511Smrg        [if test "x$use_doxygen" = xauto; then
2133433d0511Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2134433d0511Smrg            have_doxygen=no
2135433d0511Smrg        else
2136433d0511Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2137433d0511Smrg        fi])
2138433d0511Smrgfi])
2139433d0511Smrg
2140433d0511Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2141433d0511Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2142433d0511Smrgdnl 	HAVE_DOT = @HAVE_DOT@
2143433d0511SmrgHAVE_DOT=no
2144433d0511Smrgif test "x$have_doxygen" = "xyes"; then
2145433d0511Smrg  AC_PATH_PROG([DOT], [dot])
2146433d0511Smrg    if test "x$DOT" != "x"; then
2147433d0511Smrg      HAVE_DOT=yes
21486654de8bSmrg    fi
2149433d0511Smrgfi
215095e0246bSmrg
2151433d0511SmrgAC_SUBST([HAVE_DOT])
2152433d0511SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2153433d0511SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2154433d0511Smrg]) # XORG_WITH_DOXYGEN
2155433d0511Smrg
2156433d0511Smrg# XORG_WITH_GROFF([DEFAULT])
2157433d0511Smrg# ----------------
2158433d0511Smrg# Minimum version: 1.6.0
2159433d0511Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2160433d0511Smrg#
2161433d0511Smrg# Documentation tools are not always available on all platforms and sometimes
2162433d0511Smrg# not at the appropriate level. This macro enables a module to test for the
2163433d0511Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2164433d0511Smrg# the --with-groff option, it allows maximum flexibility in making decisions
2165433d0511Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
2166433d0511Smrg# --with-groff assumes 'auto'.
2167433d0511Smrg#
2168433d0511Smrg# Interface to module:
2169433d0511Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2170433d0511Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2171433d0511Smrg# HAVE_GROFF_MS: the -ms macros package
2172433d0511Smrg# GROFF:	 returns the path of the groff program found
2173433d0511Smrg#		 returns the path set by the user in the environment
2174433d0511Smrg# --with-groff:	 'yes' user instructs the module to use groff
2175433d0511Smrg#		 'no' user instructs the module not to use groff
2176433d0511Smrg#
2177433d0511Smrg# Added in version 1.9.0:
2178433d0511Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2179433d0511Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2180433d0511Smrg#		   psselect from the psutils package.
2181433d0511Smrg#		   the ghostcript package. Refer to the grohtml man pages
2182433d0511Smrg#
2183433d0511Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2184433d0511Smrg#
2185433d0511Smrg# OS and distros often splits groff in a basic and full package, the former
2186433d0511Smrg# having the groff program and the later having devices, fonts and macros
2187433d0511Smrg# Checking for the groff executable is not enough.
2188433d0511Smrg#
2189433d0511Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
2190433d0511Smrg# unset HAVE_GROFF or GROFF env variables.
2191433d0511Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2192433d0511Smrg#
2193433d0511SmrgAC_DEFUN([XORG_WITH_GROFF],[
2194433d0511SmrgAC_ARG_VAR([GROFF], [Path to groff command])
2195433d0511Smrgm4_define([_defopt], m4_default([$1], [auto]))
2196433d0511SmrgAC_ARG_WITH(groff,
2197433d0511Smrg	AS_HELP_STRING([--with-groff],
2198433d0511Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2199433d0511Smrg	   [use_groff=$withval], [use_groff=]_defopt)
2200433d0511Smrgm4_undefine([_defopt])
2201433d0511Smrg
2202433d0511Smrgif test "x$use_groff" = x"auto"; then
2203433d0511Smrg   AC_PATH_PROG([GROFF], [groff])
2204433d0511Smrg   if test "x$GROFF" = "x"; then
2205433d0511Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2206433d0511Smrg	have_groff=no
2207433d0511Smrg   else
2208433d0511Smrg        have_groff=yes
2209433d0511Smrg   fi
2210433d0511Smrgelif test "x$use_groff" = x"yes" ; then
2211433d0511Smrg   AC_PATH_PROG([GROFF], [groff])
2212433d0511Smrg   if test "x$GROFF" = "x"; then
2213433d0511Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2214433d0511Smrg   fi
2215433d0511Smrg   have_groff=yes
2216433d0511Smrgelif test "x$use_groff" = x"no" ; then
2217433d0511Smrg   if test "x$GROFF" != "x"; then
2218433d0511Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2219433d0511Smrg   fi
2220433d0511Smrg   have_groff=no
222195e0246bSmrgelse
2222433d0511Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
222395e0246bSmrgfi
222495e0246bSmrg
2225433d0511Smrg# We have groff, test for the presence of the macro packages
2226433d0511Smrgif test "x$have_groff" = x"yes"; then
2227433d0511Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2228433d0511Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2229433d0511Smrg        groff_ms_works=yes
2230433d0511Smrg    else
2231433d0511Smrg        groff_ms_works=no
2232433d0511Smrg    fi
2233433d0511Smrg    AC_MSG_RESULT([$groff_ms_works])
2234433d0511Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2235433d0511Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2236433d0511Smrg        groff_mm_works=yes
2237433d0511Smrg    else
2238433d0511Smrg        groff_mm_works=no
2239433d0511Smrg    fi
2240433d0511Smrg    AC_MSG_RESULT([$groff_mm_works])
2241433d0511Smrgfi
224295e0246bSmrg
2243433d0511Smrg# We have groff, test for HTML dependencies, one command per package
2244433d0511Smrgif test "x$have_groff" = x"yes"; then
2245433d0511Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2246433d0511Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2247433d0511Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2248433d0511Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2249433d0511Smrg      have_groff_html=yes
2250433d0511Smrg   else
2251433d0511Smrg      have_groff_html=no
2252433d0511Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2253433d0511Smrg   fi
2254433d0511Smrgfi
22556654de8bSmrg
2256433d0511Smrg# Set Automake conditionals for Makefiles
2257433d0511SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2258433d0511SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2259433d0511SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2260433d0511SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2261433d0511Smrg]) # XORG_WITH_GROFF
22626654de8bSmrg
2263433d0511Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2264433d0511Smrg# ---------------------------------------
2265433d0511Smrg# Minimum version: 1.6.0
2266433d0511Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2267433d0511Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2268433d0511Smrg#
2269433d0511Smrg# Documentation tools are not always available on all platforms and sometimes
2270433d0511Smrg# not at the appropriate level. This macro enables a module to test for the
2271433d0511Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2272433d0511Smrg# the --with-fop option, it allows maximum flexibility in making decisions
2273433d0511Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
2274433d0511Smrg# --with-fop assumes 'auto'.
2275433d0511Smrg#
2276433d0511Smrg# Interface to module:
2277433d0511Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2278433d0511Smrg# FOP:	 	returns the path of the fop program found
2279433d0511Smrg#		returns the path set by the user in the environment
2280433d0511Smrg# --with-fop: 	'yes' user instructs the module to use fop
2281433d0511Smrg#		'no' user instructs the module not to use fop
2282433d0511Smrg#
2283433d0511Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2284433d0511Smrg#
2285433d0511SmrgAC_DEFUN([XORG_WITH_FOP],[
2286433d0511SmrgAC_ARG_VAR([FOP], [Path to fop command])
2287433d0511Smrgm4_define([_defopt], m4_default([$2], [auto]))
2288433d0511SmrgAC_ARG_WITH(fop,
2289433d0511Smrg	AS_HELP_STRING([--with-fop],
2290433d0511Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2291433d0511Smrg	   [use_fop=$withval], [use_fop=]_defopt)
2292433d0511Smrgm4_undefine([_defopt])
2293433d0511Smrg
2294433d0511Smrgif test "x$use_fop" = x"auto"; then
2295433d0511Smrg   AC_PATH_PROG([FOP], [fop])
2296433d0511Smrg   if test "x$FOP" = "x"; then
2297433d0511Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2298433d0511Smrg	have_fop=no
2299433d0511Smrg   else
2300433d0511Smrg        have_fop=yes
2301433d0511Smrg   fi
2302433d0511Smrgelif test "x$use_fop" = x"yes" ; then
2303433d0511Smrg   AC_PATH_PROG([FOP], [fop])
2304433d0511Smrg   if test "x$FOP" = "x"; then
2305433d0511Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2306433d0511Smrg   fi
2307433d0511Smrg   have_fop=yes
2308433d0511Smrgelif test "x$use_fop" = x"no" ; then
2309433d0511Smrg   if test "x$FOP" != "x"; then
2310433d0511Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2311433d0511Smrg   fi
2312433d0511Smrg   have_fop=no
2313433d0511Smrgelse
2314433d0511Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
23156654de8bSmrgfi
231695e0246bSmrg
2317433d0511Smrg# Test for a minimum version of fop, if provided.
2318433d0511Smrgm4_ifval([$1],
2319433d0511Smrg[if test "$have_fop" = yes; then
2320433d0511Smrg    # scrape the fop version
2321433d0511Smrg    AC_MSG_CHECKING([for fop minimum version])
2322433d0511Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2323433d0511Smrg    AC_MSG_RESULT([$fop_version])
2324433d0511Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2325433d0511Smrg        [if test "x$use_fop" = xauto; then
2326433d0511Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2327433d0511Smrg            have_fop=no
2328433d0511Smrg        else
2329433d0511Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2330433d0511Smrg        fi])
2331433d0511Smrgfi])
2332433d0511SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2333433d0511Smrg]) # XORG_WITH_FOP
2334433d0511Smrg
2335433d0511Smrg# XORG_WITH_M4([MIN-VERSION])
2336433d0511Smrg# ---------------------------
2337433d0511Smrg# Minimum version: 1.19.0
2338433d0511Smrg#
2339433d0511Smrg# This macro attempts to locate an m4 macro processor which supports
2340433d0511Smrg# -I option and is only useful for modules relying on M4 in order to
2341433d0511Smrg# expand macros in source code files.
2342433d0511Smrg#
2343433d0511Smrg# Interface to module:
2344433d0511Smrg# M4:	 	returns the path of the m4 program found
2345433d0511Smrg#		returns the path set by the user in the environment
2346433d0511Smrg#
2347433d0511SmrgAC_DEFUN([XORG_WITH_M4], [
2348433d0511SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2349433d0511Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2350433d0511Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2351433d0511Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2352433d0511Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2353433d0511Smrg   [$PATH:/usr/gnu/bin])])
2354433d0511Smrg
2355433d0511SmrgAC_SUBST([M4], [$ac_cv_path_M4])
2356433d0511Smrg]) # XORG_WITH_M4
235795e0246bSmrg
2358433d0511Smrg# XORG_WITH_PS2PDF([DEFAULT])
2359433d0511Smrg# ----------------
2360433d0511Smrg# Minimum version: 1.6.0
2361433d0511Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2362cbc4e2beSmrg#
2363433d0511Smrg# Documentation tools are not always available on all platforms and sometimes
2364433d0511Smrg# not at the appropriate level. This macro enables a module to test for the
2365433d0511Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2366433d0511Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
2367433d0511Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2368433d0511Smrg# --with-ps2pdf assumes 'auto'.
2369433d0511Smrg#
2370433d0511Smrg# Interface to module:
2371433d0511Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2372433d0511Smrg# PS2PDF:	returns the path of the ps2pdf program found
2373433d0511Smrg#		returns the path set by the user in the environment
2374433d0511Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2375433d0511Smrg#		 'no' user instructs the module not to use ps2pdf
2376433d0511Smrg#
2377433d0511Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2378433d0511Smrg#
2379433d0511SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2380433d0511SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2381433d0511Smrgm4_define([_defopt], m4_default([$1], [auto]))
2382433d0511SmrgAC_ARG_WITH(ps2pdf,
2383433d0511Smrg	AS_HELP_STRING([--with-ps2pdf],
2384433d0511Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2385433d0511Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2386433d0511Smrgm4_undefine([_defopt])
2387cbc4e2beSmrg
2388433d0511Smrgif test "x$use_ps2pdf" = x"auto"; then
2389433d0511Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2390433d0511Smrg   if test "x$PS2PDF" = "x"; then
2391433d0511Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2392433d0511Smrg	have_ps2pdf=no
2393433d0511Smrg   else
2394433d0511Smrg        have_ps2pdf=yes
2395433d0511Smrg   fi
2396433d0511Smrgelif test "x$use_ps2pdf" = x"yes" ; then
2397433d0511Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2398433d0511Smrg   if test "x$PS2PDF" = "x"; then
2399433d0511Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2400433d0511Smrg   fi
2401433d0511Smrg   have_ps2pdf=yes
2402433d0511Smrgelif test "x$use_ps2pdf" = x"no" ; then
2403433d0511Smrg   if test "x$PS2PDF" != "x"; then
2404433d0511Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2405433d0511Smrg   fi
2406433d0511Smrg   have_ps2pdf=no
2407433d0511Smrgelse
2408433d0511Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2409433d0511Smrgfi
2410433d0511SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2411433d0511Smrg]) # XORG_WITH_PS2PDF
2412cbc4e2beSmrg
2413433d0511Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
2414433d0511Smrg# ----------------
2415433d0511Smrg# Minimum version: 1.6.0
2416433d0511Smrg#
2417433d0511Smrg# Documentation tools are not always available on all platforms and sometimes
2418433d0511Smrg# not at the appropriate level. This macro enables a builder to skip all
2419433d0511Smrg# documentation targets except traditional man pages.
2420433d0511Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2421433d0511Smrg# maximum flexibility in controlling documentation building.
2422433d0511Smrg# Refer to:
2423433d0511Smrg# XORG_WITH_XMLTO         --with-xmlto
2424433d0511Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2425433d0511Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2426433d0511Smrg# XORG_WITH_FOP           --with-fop
2427433d0511Smrg# XORG_WITH_GROFF         --with-groff
2428433d0511Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2429433d0511Smrg#
2430433d0511Smrg# Interface to module:
2431433d0511Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2432433d0511Smrg# --enable-docs: 'yes' user instructs the module to generate docs
2433433d0511Smrg#		 'no' user instructs the module not to generate docs
2434433d0511Smrg# parm1:	specify the default value, yes or no.
2435433d0511Smrg#
2436433d0511SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2437433d0511Smrgm4_define([docs_default], m4_default([$1], [yes]))
2438433d0511SmrgAC_ARG_ENABLE(docs,
2439433d0511Smrg	AS_HELP_STRING([--enable-docs],
2440433d0511Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2441433d0511Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2442433d0511Smrgm4_undefine([docs_default])
2443433d0511SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2444433d0511SmrgAC_MSG_CHECKING([whether to build documentation])
2445433d0511SmrgAC_MSG_RESULT([$build_docs])
2446433d0511Smrg]) # XORG_ENABLE_DOCS
2447433d0511Smrg
2448433d0511Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2449433d0511Smrg# ----------------
2450433d0511Smrg# Minimum version: 1.6.0
2451433d0511Smrg#
2452433d0511Smrg# This macro enables a builder to skip all developer documentation.
2453433d0511Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2454433d0511Smrg# maximum flexibility in controlling documentation building.
2455433d0511Smrg# Refer to:
2456433d0511Smrg# XORG_WITH_XMLTO         --with-xmlto
2457433d0511Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2458433d0511Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2459433d0511Smrg# XORG_WITH_FOP           --with-fop
2460433d0511Smrg# XORG_WITH_GROFF         --with-groff
2461433d0511Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2462433d0511Smrg#
2463433d0511Smrg# Interface to module:
2464433d0511Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2465433d0511Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2466433d0511Smrg#			'no' user instructs the module not to generate developer docs
2467433d0511Smrg# parm1:		specify the default value, yes or no.
2468433d0511Smrg#
2469433d0511SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2470433d0511Smrgm4_define([devel_default], m4_default([$1], [yes]))
2471433d0511SmrgAC_ARG_ENABLE(devel-docs,
2472433d0511Smrg	AS_HELP_STRING([--enable-devel-docs],
2473433d0511Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2474433d0511Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2475433d0511Smrgm4_undefine([devel_default])
2476433d0511SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2477433d0511SmrgAC_MSG_CHECKING([whether to build developer documentation])
2478433d0511SmrgAC_MSG_RESULT([$build_devel_docs])
2479433d0511Smrg]) # XORG_ENABLE_DEVEL_DOCS
24806654de8bSmrg
2481433d0511Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2482433d0511Smrg# ----------------
2483433d0511Smrg# Minimum version: 1.6.0
2484433d0511Smrg#
2485433d0511Smrg# This macro enables a builder to skip all functional specification targets.
2486433d0511Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2487433d0511Smrg# maximum flexibility in controlling documentation building.
2488433d0511Smrg# Refer to:
2489433d0511Smrg# XORG_WITH_XMLTO         --with-xmlto
2490433d0511Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2491433d0511Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2492433d0511Smrg# XORG_WITH_FOP           --with-fop
2493433d0511Smrg# XORG_WITH_GROFF         --with-groff
2494433d0511Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2495433d0511Smrg#
2496433d0511Smrg# Interface to module:
2497433d0511Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2498433d0511Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2499433d0511Smrg#			'no' user instructs the module not to generate specs
2500433d0511Smrg# parm1:		specify the default value, yes or no.
2501433d0511Smrg#
2502433d0511SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2503433d0511Smrgm4_define([spec_default], m4_default([$1], [yes]))
2504433d0511SmrgAC_ARG_ENABLE(specs,
2505433d0511Smrg	AS_HELP_STRING([--enable-specs],
2506433d0511Smrg	   [Enable building the specs (default: ]spec_default[)]),
2507433d0511Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2508433d0511Smrgm4_undefine([spec_default])
2509433d0511SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2510433d0511SmrgAC_MSG_CHECKING([whether to build functional specifications])
2511433d0511SmrgAC_MSG_RESULT([$build_specs])
2512433d0511Smrg]) # XORG_ENABLE_SPECS
25136654de8bSmrg
2514433d0511Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2515433d0511Smrg# ----------------------------------------------
2516433d0511Smrg# Minimum version: 1.13.0
2517cbc4e2beSmrg#
2518433d0511Smrg# This macro enables a builder to enable/disable unit testing
2519433d0511Smrg# It makes no assumption about the test cases implementation
2520433d0511Smrg# Test cases may or may not use Automake "Support for test suites"
2521433d0511Smrg# They may or may not use the software utility library GLib
2522433d0511Smrg#
2523433d0511Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2524433d0511Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2525433d0511Smrg# The variable enable_unit_tests is used by other macros in this file.
2526433d0511Smrg#
2527433d0511Smrg# Interface to module:
2528433d0511Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2529433d0511Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2530433d0511Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2531433d0511Smrg#			'no' user instructs the module not to build tests
2532433d0511Smrg# parm1:		specify the default value, yes or no.
2533433d0511Smrg#
2534433d0511SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2535433d0511SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2536433d0511SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2537433d0511SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2538433d0511Smrgm4_define([_defopt], m4_default([$1], [auto]))
2539433d0511SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2540433d0511Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2541433d0511Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2542433d0511Smrgm4_undefine([_defopt])
2543433d0511SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2544433d0511SmrgAC_MSG_CHECKING([whether to build unit test cases])
2545433d0511SmrgAC_MSG_RESULT([$enable_unit_tests])
2546433d0511Smrg]) # XORG_ENABLE_UNIT_TESTS
25476654de8bSmrg
2548433d0511Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2549433d0511Smrg# ------------------------------------------------------
2550433d0511Smrg# Minimum version: 1.17.0
2551433d0511Smrg#
2552433d0511Smrg# This macro enables a builder to enable/disable integration testing
2553433d0511Smrg# It makes no assumption about the test cases' implementation
2554433d0511Smrg# Test cases may or may not use Automake "Support for test suites"
2555433d0511Smrg#
2556433d0511Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2557433d0511Smrg# usually requires less dependencies and may be built and run under less
2558433d0511Smrg# stringent environments than integration tests.
2559433d0511Smrg#
2560433d0511Smrg# Interface to module:
2561433d0511Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2562433d0511Smrg# enable_integration_tests:   used in configure.ac for additional configuration
2563433d0511Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2564433d0511Smrg#                             'no' user instructs the module not to build tests
2565433d0511Smrg# parm1:                      specify the default value, yes or no.
2566433d0511Smrg#
2567433d0511SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2568433d0511SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2569433d0511Smrgm4_define([_defopt], m4_default([$1], [auto]))
2570433d0511SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2571433d0511Smrg	[Enable building integration test cases (default: ]_defopt[)]),
2572433d0511Smrg	[enable_integration_tests=$enableval],
2573433d0511Smrg	[enable_integration_tests=]_defopt)
2574433d0511Smrgm4_undefine([_defopt])
2575433d0511SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2576433d0511Smrg	[test "x$enable_integration_tests" != xno])
2577433d0511SmrgAC_MSG_CHECKING([whether to build unit test cases])
2578433d0511SmrgAC_MSG_RESULT([$enable_integration_tests])
2579433d0511Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
25806654de8bSmrg
2581433d0511Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2582433d0511Smrg# ----------------------------------------
2583433d0511Smrg# Minimum version: 1.13.0
2584433d0511Smrg#
2585433d0511Smrg# GLib is a library which provides advanced data structures and functions.
2586433d0511Smrg# This macro enables a module to test for the presence of Glib.
2587433d0511Smrg#
2588433d0511Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2589433d0511Smrg# Otherwise the value of $enable_unit_tests is blank.
2590433d0511Smrg#
2591433d0511Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2592433d0511Smrg# test support usually requires less dependencies and may be built and run under
2593433d0511Smrg# less stringent environments than integration tests.
2594cbc4e2beSmrg#
2595433d0511Smrg# Interface to module:
2596433d0511Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2597433d0511Smrg# with_glib: used in configure.ac to know if GLib has been found
2598433d0511Smrg# --with-glib:	'yes' user instructs the module to use glib
2599433d0511Smrg#		'no' user instructs the module not to use glib
2600433d0511Smrg#
2601433d0511SmrgAC_DEFUN([XORG_WITH_GLIB],[
2602433d0511SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2603433d0511Smrgm4_define([_defopt], m4_default([$2], [auto]))
2604433d0511SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2605433d0511Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2606433d0511Smrg	[with_glib=$withval], [with_glib=]_defopt)
2607433d0511Smrgm4_undefine([_defopt])
2608cbc4e2beSmrg
2609433d0511Smrghave_glib=no
2610433d0511Smrg# Do not probe GLib if user explicitly disabled unit testing
2611433d0511Smrgif test "x$enable_unit_tests" != x"no"; then
2612433d0511Smrg  # Do not probe GLib if user explicitly disabled it
2613433d0511Smrg  if test "x$with_glib" != x"no"; then
2614433d0511Smrg    m4_ifval(
2615433d0511Smrg      [$1],
2616433d0511Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2617433d0511Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2618433d0511Smrg    )
2619cbc4e2beSmrg  fi
2620cbc4e2beSmrgfi
2621cbc4e2beSmrg
2622433d0511Smrg# Not having GLib when unit testing has been explicitly requested is an error
2623433d0511Smrgif test "x$enable_unit_tests" = x"yes"; then
2624433d0511Smrg  if test "x$have_glib" = x"no"; then
2625433d0511Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2626cbc4e2beSmrg  fi
2627cbc4e2beSmrgfi
2628cbc4e2beSmrg
2629433d0511Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2630433d0511Smrgif test "x$enable_unit_tests" = x"no"; then
2631433d0511Smrg  if test "x$with_glib" = x"yes"; then
2632433d0511Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2633433d0511Smrg  fi
2634433d0511Smrgfi
2635cbc4e2beSmrg
2636433d0511Smrg# Not having GLib when it has been explicitly requested is an error
2637433d0511Smrgif test "x$with_glib" = x"yes"; then
2638433d0511Smrg  if test "x$have_glib" = x"no"; then
2639433d0511Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2640433d0511Smrg  fi
2641433d0511Smrgfi
2642cbc4e2beSmrg
2643433d0511SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2644433d0511Smrg]) # XORG_WITH_GLIB
2645cbc4e2beSmrg
2646433d0511Smrg# XORG_LD_WRAP([required|optional])
2647433d0511Smrg# ---------------------------------
2648433d0511Smrg# Minimum version: 1.13.0
2649433d0511Smrg#
2650433d0511Smrg# Check if linker supports -wrap, passed via compiler flags
2651433d0511Smrg#
2652433d0511Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2653433d0511Smrg# Otherwise the value of $enable_unit_tests is blank.
2654433d0511Smrg#
2655433d0511Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2656433d0511Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2657433d0511Smrg# available, an argument of "optional" allows use when some unit tests require
2658433d0511Smrg# ld -wrap and others do not.
2659433d0511Smrg#
2660433d0511SmrgAC_DEFUN([XORG_LD_WRAP],[
2661433d0511SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2662433d0511Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2663433d0511Smrg                      void __wrap_exit(int status) { return; }],
2664433d0511Smrg                     [exit(0);])])
2665433d0511Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2666433d0511Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2667433d0511Smrg  if test "x$have_ld_wrap" = x"no"; then
2668433d0511Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2669433d0511Smrg  fi
2670433d0511Smrgfi
2671433d0511SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2672433d0511Smrg#
2673433d0511Smrg]) # XORG_LD_WRAP
2674cbc4e2beSmrg
2675433d0511Smrg# XORG_CHECK_LINKER_FLAGS
2676433d0511Smrg# -----------------------
2677433d0511Smrg# SYNOPSIS
2678433d0511Smrg#
2679433d0511Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2680433d0511Smrg#
2681433d0511Smrg# DESCRIPTION
2682433d0511Smrg#
2683433d0511Smrg#   Check whether the given linker FLAGS work with the current language's
2684433d0511Smrg#   linker, or whether they give an error.
2685433d0511Smrg#
2686433d0511Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2687433d0511Smrg#   success/failure.
2688433d0511Smrg#
2689433d0511Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2690433d0511Smrg#
2691433d0511Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2692433d0511Smrg#
2693433d0511Smrg# LICENSE
2694433d0511Smrg#
2695433d0511Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2696433d0511Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2697433d0511Smrg#   Copyright (c) 2009 Matteo Frigo
2698433d0511Smrg#
2699433d0511Smrg#   This program is free software: you can redistribute it and/or modify it
2700433d0511Smrg#   under the terms of the GNU General Public License as published by the
2701433d0511Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2702433d0511Smrg#   option) any later version.
2703433d0511Smrg#
2704433d0511Smrg#   This program is distributed in the hope that it will be useful, but
2705433d0511Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2706433d0511Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2707433d0511Smrg#   Public License for more details.
2708433d0511Smrg#
2709433d0511Smrg#   You should have received a copy of the GNU General Public License along
2710433d0511Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2711433d0511Smrg#
2712433d0511Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2713433d0511Smrg#   gives unlimited permission to copy, distribute and modify the configure
2714433d0511Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2715433d0511Smrg#   need not follow the terms of the GNU General Public License when using
2716433d0511Smrg#   or distributing such scripts, even though portions of the text of the
2717433d0511Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2718433d0511Smrg#   all other use of the material that constitutes the Autoconf Macro.
2719433d0511Smrg#
2720433d0511Smrg#   This special exception to the GPL applies to versions of the Autoconf
2721433d0511Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2722433d0511Smrg#   modified version of the Autoconf Macro, you may extend this special
2723433d0511Smrg#   exception to the GPL to apply to your modified version as well.#
2724433d0511SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2725433d0511Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2726433d0511Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2727433d0511SmrgAS_LITERAL_IF([$1],
2728433d0511Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2729433d0511Smrg      ax_save_FLAGS=$LDFLAGS
2730433d0511Smrg      LDFLAGS="$1"
2731433d0511Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2732433d0511Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2733433d0511Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2734433d0511Smrg      LDFLAGS=$ax_save_FLAGS])],
2735433d0511Smrg  [ax_save_FLAGS=$LDFLAGS
2736433d0511Smrg   LDFLAGS="$1"
2737433d0511Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2738433d0511Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2739433d0511Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2740433d0511Smrg   LDFLAGS=$ax_save_FLAGS])
2741433d0511Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2742433d0511SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2743433d0511Smrgif test "x$xorg_check_linker_flags" = xyes; then
2744433d0511Smrg	m4_default([$2], :)
2745433d0511Smrgelse
2746433d0511Smrg	m4_default([$3], :)
2747433d0511Smrgfi
2748433d0511Smrg]) # XORG_CHECK_LINKER_FLAGS
2749cbc4e2beSmrg
2750433d0511Smrg# XORG_MEMORY_CHECK_FLAGS
2751433d0511Smrg# -----------------------
2752433d0511Smrg# Minimum version: 1.16.0
2753433d0511Smrg#
2754433d0511Smrg# This macro attempts to find appropriate memory checking functionality
2755433d0511Smrg# for various platforms which unit testing code may use to catch various
2756433d0511Smrg# forms of memory allocation and access errors in testing.
2757433d0511Smrg#
2758433d0511Smrg# Interface to module:
2759433d0511Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2760433d0511Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2761433d0511Smrg#
2762433d0511Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2763433d0511Smrg#
2764433d0511SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2765cbc4e2beSmrg
2766433d0511SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2767433d0511SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2768433d0511Smrg           [Environment variables to enable memory checking in tests])
2769cbc4e2beSmrg
2770433d0511Smrg# Check for different types of support on different platforms
2771433d0511Smrgcase $host_os in
2772433d0511Smrg    solaris*)
2773433d0511Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2774433d0511Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2775433d0511Smrg        ;;
2776433d0511Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2777433d0511Smrg        # both directly and inverted, so should not be 0 or 255.
2778433d0511Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2779433d0511Smrg        ;;
2780433d0511Smrg    darwin*)
2781433d0511Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2782433d0511Smrg        ;;
2783433d0511Smrg    *bsd*)
2784433d0511Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2785433d0511Smrg        ;;
2786433d0511Smrgesac
2787eaef79e5Smrg
2788433d0511Smrg# User supplied flags override default flags
2789433d0511Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2790433d0511Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2791eaef79e5Smrgfi
2792eaef79e5Smrg
2793433d0511SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2794433d0511Smrg]) # XORG_WITH_LINT
27956654de8bSmrg
2796433d0511Smrg# XORG_CHECK_MALLOC_ZERO
2797433d0511Smrg# ----------------------
2798433d0511Smrg# Minimum version: 1.0.0
2799eaef79e5Smrg#
2800433d0511Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2801433d0511Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2802433d0511Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2803433d0511SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2804433d0511SmrgAC_ARG_ENABLE(malloc0returnsnull,
2805433d0511Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2806433d0511Smrg		       [malloc(0) returns NULL (default: auto)]),
2807433d0511Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2808433d0511Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2809eaef79e5Smrg
2810433d0511SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2811433d0511Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2812433d0511SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
2813433d0511Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2814433d0511Smrg#include <stdlib.h>
2815433d0511Smrg],[
2816433d0511Smrg    char *m0, *r0, *c0, *p;
2817433d0511Smrg    m0 = malloc(0);
2818433d0511Smrg    p = malloc(10);
2819433d0511Smrg    r0 = realloc(p,0);
2820433d0511Smrg    c0 = calloc(0,10);
2821433d0511Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2822433d0511Smrg])],
2823433d0511Smrg		[xorg_cv_malloc0_returns_null=yes],
2824433d0511Smrg		[xorg_cv_malloc0_returns_null=no])])
2825433d0511SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
28266654de8bSmrgfi
2827433d0511SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
282895e0246bSmrg
2829433d0511Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2830433d0511Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2831433d0511Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2832433d0511Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2833eaef79e5Smrgelse
2834433d0511Smrg	MALLOC_ZERO_CFLAGS=""
2835433d0511Smrg	XMALLOC_ZERO_CFLAGS=""
2836433d0511Smrg	XTMALLOC_ZERO_CFLAGS=""
2837eaef79e5Smrgfi
2838eaef79e5Smrg
2839433d0511SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2840433d0511SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2841433d0511SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2842433d0511Smrg]) # XORG_CHECK_MALLOC_ZERO
2843eaef79e5Smrg
2844433d0511Smrg# XORG_WITH_LINT()
2845433d0511Smrg# ----------------
2846433d0511Smrg# Minimum version: 1.1.0
284795e0246bSmrg#
2848433d0511Smrg# This macro enables the use of a tool that flags some suspicious and
2849433d0511Smrg# non-portable constructs (likely to be bugs) in C language source code.
2850433d0511Smrg# It will attempt to locate the tool and use appropriate options.
2851433d0511Smrg# There are various lint type tools on different platforms.
2852cbc4e2beSmrg#
2853433d0511Smrg# Interface to module:
2854433d0511Smrg# LINT:		returns the path to the tool found on the platform
2855433d0511Smrg#		or the value set to LINT on the configure cmd line
2856433d0511Smrg#		also an Automake conditional
2857433d0511Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
2858433d0511Smrg#
2859433d0511Smrg# --with-lint:	'yes' user instructs the module to use lint
2860433d0511Smrg#		'no' user instructs the module not to use lint (default)
2861433d0511Smrg#
2862433d0511Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2863433d0511Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2864433d0511Smrg#
2865433d0511SmrgAC_DEFUN([XORG_WITH_LINT],[
2866cbc4e2beSmrg
2867433d0511SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2868433d0511SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2869433d0511SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2870433d0511Smrg		[Use a lint-style source code checker (default: disabled)])],
2871433d0511Smrg		[use_lint=$withval], [use_lint=no])
2872cbc4e2beSmrg
2873433d0511Smrg# Obtain platform specific info like program name and options
2874433d0511Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2875433d0511Smrgcase $host_os in
2876433d0511Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2877433d0511Smrg	lint_name=splint
2878433d0511Smrg	lint_options="-badflag"
2879433d0511Smrg	;;
2880433d0511Smrg  *freebsd* | *netbsd*)
2881433d0511Smrg	lint_name=lint
2882433d0511Smrg	lint_options="-u -b"
2883433d0511Smrg	;;
2884433d0511Smrg  *solaris*)
2885433d0511Smrg	lint_name=lint
2886433d0511Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2887433d0511Smrg	;;
2888433d0511Smrgesac
2889433d0511Smrg
2890433d0511Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2891433d0511Smrgif test "x$use_lint" = x"yes" ; then
2892433d0511Smrg   AC_PATH_PROG([LINT], [$lint_name])
2893433d0511Smrg   if test "x$LINT" = "x"; then
2894433d0511Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2895433d0511Smrg   fi
2896433d0511Smrgelif test "x$use_lint" = x"no" ; then
2897433d0511Smrg   if test "x$LINT" != "x"; then
2898433d0511Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2899433d0511Smrg   fi
29006654de8bSmrgelse
2901433d0511Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2902cbc4e2beSmrgfi
2903cbc4e2beSmrg
2904433d0511Smrg# User supplied flags override default flags
2905433d0511Smrgif test "x$LINT_FLAGS" != "x"; then
2906433d0511Smrg   lint_options=$LINT_FLAGS
2907433d0511Smrgfi
2908cbc4e2beSmrg
2909433d0511SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2910433d0511SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2911cbc4e2beSmrg
2912433d0511Smrg]) # XORG_WITH_LINT
2913cbc4e2beSmrg
2914433d0511Smrg# XORG_LINT_LIBRARY(LIBNAME)
2915433d0511Smrg# --------------------------
2916433d0511Smrg# Minimum version: 1.1.0
2917cbc4e2beSmrg#
2918433d0511Smrg# Sets up flags for building lint libraries for checking programs that call
2919433d0511Smrg# functions in the library.
2920433d0511Smrg#
2921433d0511Smrg# Interface to module:
2922433d0511Smrg# LINTLIB		- Automake variable with the name of lint library file to make
2923433d0511Smrg# MAKE_LINT_LIB		- Automake conditional
2924433d0511Smrg#
2925433d0511Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2926433d0511Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2927cbc4e2beSmrg
2928433d0511SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2929433d0511SmrgAC_REQUIRE([XORG_WITH_LINT])
2930433d0511SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2931433d0511Smrg	[Create lint library (default: disabled)])],
2932433d0511Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2933433d0511Smrg
2934433d0511Smrgif test "x$make_lint_lib" = x"yes" ; then
2935433d0511Smrg   LINTLIB=llib-l$1.ln
2936433d0511Smrg   if test "x$LINT" = "x"; then
2937433d0511Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2938433d0511Smrg   fi
2939433d0511Smrgelif test "x$make_lint_lib" != x"no" ; then
2940433d0511Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2941cbc4e2beSmrgfi
2942cbc4e2beSmrg
2943433d0511SmrgAC_SUBST(LINTLIB)
2944433d0511SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
29456654de8bSmrg
2946433d0511Smrg]) # XORG_LINT_LIBRARY
29476654de8bSmrg
2948433d0511Smrg# XORG_COMPILER_BRAND
29496654de8bSmrg# -------------------
2950433d0511Smrg# Minimum version: 1.14.0
29516654de8bSmrg#
2952433d0511Smrg# Checks for various brands of compilers and sets flags as appropriate:
2953433d0511Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2954433d0511Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2955433d0511Smrg#   clang compiler - sets CLANGCC to "yes"
2956433d0511Smrg#   Intel compiler - sets INTELCC to "yes"
2957433d0511Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2958433d0511Smrg#
2959433d0511SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2960433d0511SmrgAC_LANG_CASE(
2961433d0511Smrg	[C], [
2962433d0511Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
2963433d0511Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
2964433d0511Smrg		m4_version_prereq([2.70],
2965433d0511Smrg			[AC_REQUIRE([AC_PROG_CC])],
2966433d0511Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
2967433d0511Smrg	],
2968433d0511Smrg	[C++], [
2969433d0511Smrg		AC_REQUIRE([AC_PROG_CXX])
2970433d0511Smrg	]
2971433d0511Smrg)
2972433d0511SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2973433d0511SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2974433d0511SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2975433d0511Smrg]) # XORG_COMPILER_BRAND
2976cbc4e2beSmrg
2977433d0511Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
29786654de8bSmrg# ---------------
2979433d0511Smrg# Minimum version: 1.16.0
2980433d0511Smrg#
2981433d0511Smrg# Test if the compiler works when passed the given flag as a command line argument.
2982433d0511Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
2983433d0511Smrg# next flag in the list until there are no more options.
2984433d0511Smrg#
2985433d0511Smrg# Note that this does not guarantee that the compiler supports the flag as some
2986433d0511Smrg# compilers will simply ignore arguments that they do not understand, but we do
2987433d0511Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2988433d0511Smrg# -Werror=unused-command-line-argument
2989433d0511Smrg#
2990433d0511SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2991433d0511Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2992433d0511Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2993cbc4e2beSmrg
2994433d0511SmrgAC_LANG_COMPILER_REQUIRE
2995cbc4e2beSmrg
2996433d0511SmrgAC_LANG_CASE(
2997433d0511Smrg	[C], [
2998433d0511Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
2999433d0511Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3000433d0511Smrg		m4_version_prereq([2.70],
3001433d0511Smrg			[AC_REQUIRE([AC_PROG_CC])],
3002433d0511Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3003433d0511Smrg		define([PREFIX], [C])
3004433d0511Smrg		define([CACHE_PREFIX], [cc])
3005433d0511Smrg		define([COMPILER], [$CC])
3006433d0511Smrg	],
3007433d0511Smrg	[C++], [
3008433d0511Smrg		define([PREFIX], [CXX])
3009433d0511Smrg		define([CACHE_PREFIX], [cxx])
3010433d0511Smrg		define([COMPILER], [$CXX])
3011433d0511Smrg	]
3012433d0511Smrg)
3013433d0511Smrg
3014433d0511Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
3015433d0511Smrg
3016433d0511Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
3017433d0511Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3018433d0511Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
3019433d0511Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3020433d0511Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3021433d0511Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
3022433d0511Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
3023433d0511Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
3024433d0511Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30256654de8bSmrgfi
3026433d0511Smrg
3027433d0511Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
3028433d0511Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
3029433d0511Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3030433d0511Smrg	fi
3031433d0511Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3032433d0511Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
3033433d0511Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3034433d0511Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3035433d0511Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
3036433d0511Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
3037433d0511Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
3038433d0511Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3039433d0511Smrgfi
3040433d0511Smrg
3041433d0511Smrgfound="no"
3042433d0511Smrgm4_foreach([flag], m4_cdr($@), [
3043433d0511Smrg	if test $found = "no" ; then
3044433d0511Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
3045433d0511Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3046433d0511Smrg		fi
3047433d0511Smrg
3048433d0511Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
3049433d0511Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3050433d0511Smrg		fi
3051433d0511Smrg
3052433d0511Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
3053433d0511Smrg
3054433d0511Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
3055433d0511Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
3056433d0511Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
3057433d0511Smrg		AC_CACHE_VAL($cacheid,
3058433d0511Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3059433d0511Smrg					     [eval $cacheid=yes],
3060433d0511Smrg					     [eval $cacheid=no])])
3061433d0511Smrg
3062433d0511Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3063433d0511Smrg
3064433d0511Smrg		eval supported=\$$cacheid
3065433d0511Smrg		AC_MSG_RESULT([$supported])
3066433d0511Smrg		if test "$supported" = "yes" ; then
3067433d0511Smrg			$1="$$1 ]flag["
3068433d0511Smrg			found="yes"
3069433d0511Smrg		fi
3070433d0511Smrg	fi
30716654de8bSmrg])
3072433d0511Smrg]) # XORG_TESTSET_CFLAG
3073cbc4e2beSmrg
3074433d0511Smrg# XORG_COMPILER_FLAGS
3075433d0511Smrg# ---------------
3076433d0511Smrg# Minimum version: 1.16.0
3077cbc4e2beSmrg#
3078433d0511Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
3079433d0511Smrg# arguments supported by the selected compiler which do NOT alter the generated
3080433d0511Smrg# code.  These arguments will cause the compiler to print various warnings
3081433d0511Smrg# during compilation AND turn a conservative set of warnings into errors.
3082433d0511Smrg#
3083433d0511Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
3084433d0511Smrg# future versions of util-macros as options are added to new compilers.
3085433d0511Smrg#
3086433d0511SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
3087433d0511SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
30882b32c8f7Smrg
3089433d0511SmrgAC_ARG_ENABLE(selective-werror,
3090433d0511Smrg              AS_HELP_STRING([--disable-selective-werror],
3091433d0511Smrg                             [Turn off selective compiler errors. (default: enabled)]),
3092433d0511Smrg              [SELECTIVE_WERROR=$enableval],
3093433d0511Smrg              [SELECTIVE_WERROR=yes])
3094433d0511Smrg
3095433d0511SmrgAC_LANG_CASE(
3096433d0511Smrg        [C], [
3097433d0511Smrg                define([PREFIX], [C])
3098433d0511Smrg        ],
3099433d0511Smrg        [C++], [
3100433d0511Smrg                define([PREFIX], [CXX])
3101433d0511Smrg        ]
3102433d0511Smrg)
3103433d0511Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
3104433d0511Smrgif test "x$SUNCC" = "xyes"; then
3105433d0511Smrg    [BASE_]PREFIX[FLAGS]="-v"
31066654de8bSmrgelse
3107433d0511Smrg    [BASE_]PREFIX[FLAGS]=""
31086654de8bSmrgfi
31096654de8bSmrg
3110433d0511Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3111433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
3112433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
3113433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
3114433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
31156654de8bSmrg
3116433d0511SmrgAC_LANG_CASE(
3117433d0511Smrg	[C], [
3118433d0511Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
3119433d0511Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
3120433d0511Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
3121433d0511Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
3122433d0511Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
3123433d0511Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
3124433d0511Smrg	]
3125433d0511Smrg)
31262b32c8f7Smrg
3127433d0511Smrg# This chunk adds additional warnings that could catch undesired effects.
3128433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
3129433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
3130433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
3131433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
3132433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
3133433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
3134433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3135cbc4e2beSmrg
3136433d0511Smrg# These are currently disabled because they are noisy.  They will be enabled
3137433d0511Smrg# in the future once the codebase is sufficiently modernized to silence
3138433d0511Smrg# them.  For now, I don't want them to drown out the other warnings.
3139433d0511Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3140433d0511Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3141433d0511Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3142cbc4e2beSmrg
3143433d0511Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
3144433d0511Smrg# when there are problems that should be fixed.
3145cbc4e2beSmrg
3146433d0511Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3147433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3148433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3149433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3150433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3151433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3152433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3153433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3154433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3155433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3156433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3157433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3158433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3159433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3160433d0511Smrgelse
3161433d0511SmrgAC_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])
3162433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3163433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3164433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3165433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3166433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3167433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3168433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3169433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3170433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3171433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3172433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3173433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3174433d0511SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3175433d0511Smrgfi
3176cbc4e2beSmrg
3177433d0511SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3178433d0511Smrg]) # XORG_COMPILER_FLAGS
31792b32c8f7Smrg
3180433d0511Smrg# XORG_CWARNFLAGS
3181433d0511Smrg# ---------------
3182433d0511Smrg# Minimum version: 1.2.0
3183433d0511Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
31842b32c8f7Smrg#
3185433d0511Smrg# Defines CWARNFLAGS to enable C compiler warnings.
318695e0246bSmrg#
3187433d0511Smrg# This function is deprecated because it defines -fno-strict-aliasing
3188433d0511Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3189433d0511Smrg# is needed, then it should be added explicitly in the module when
3190433d0511Smrg# it is updated to use BASE_CFLAGS.
319195e0246bSmrg#
3192433d0511SmrgAC_DEFUN([XORG_CWARNFLAGS], [
3193433d0511SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3194433d0511SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3195433d0511SmrgAC_LANG_CASE(
3196433d0511Smrg	[C], [
3197433d0511Smrg		CWARNFLAGS="$BASE_CFLAGS"
3198433d0511Smrg		if  test "x$GCC" = xyes ; then
3199433d0511Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3200433d0511Smrg		fi
3201433d0511Smrg		AC_SUBST(CWARNFLAGS)
3202433d0511Smrg	]
3203433d0511Smrg)
3204433d0511Smrg]) # XORG_CWARNFLAGS
3205eaef79e5Smrg
3206433d0511Smrg# XORG_STRICT_OPTION
3207433d0511Smrg# -----------------------
3208433d0511Smrg# Minimum version: 1.3.0
3209433d0511Smrg#
3210433d0511Smrg# Add configure option to enable strict compilation flags, such as treating
3211433d0511Smrg# warnings as fatal errors.
3212433d0511Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3213433d0511Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3214433d0511Smrg#
3215433d0511Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3216433d0511Smrg# when strict compilation is unconditionally desired.
3217433d0511SmrgAC_DEFUN([XORG_STRICT_OPTION], [
3218433d0511SmrgAC_REQUIRE([XORG_CWARNFLAGS])
3219433d0511SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3220d1a7ce7bSmrg
3221433d0511SmrgAC_ARG_ENABLE(strict-compilation,
3222433d0511Smrg			  AS_HELP_STRING([--enable-strict-compilation],
3223433d0511Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3224433d0511Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3225eaef79e5Smrg
3226433d0511SmrgAC_LANG_CASE(
3227433d0511Smrg        [C], [
3228433d0511Smrg                define([PREFIX], [C])
3229433d0511Smrg        ],
3230433d0511Smrg        [C++], [
3231433d0511Smrg                define([PREFIX], [CXX])
3232433d0511Smrg        ]
3233433d0511Smrg)
32346654de8bSmrg
3235433d0511Smrg[STRICT_]PREFIX[FLAGS]=""
3236433d0511SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3237433d0511SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
32386654de8bSmrg
3239433d0511Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3240433d0511Smrg# activate it with -Werror, so we add it here explicitly.
3241433d0511SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
32426654de8bSmrg
3243433d0511Smrgif test "x$STRICT_COMPILE" = "xyes"; then
3244433d0511Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3245433d0511Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3246433d0511Smrgfi
3247433d0511SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3248433d0511SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3249433d0511SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3250433d0511Smrg]) # XORG_STRICT_OPTION
32516654de8bSmrg
3252433d0511Smrg# XORG_DEFAULT_NOCODE_OPTIONS
3253433d0511Smrg# ---------------------------
3254433d0511Smrg# Minimum version: 1.20.0
3255433d0511Smrg#
3256433d0511Smrg# Defines default options for X.Org modules which don't compile code,
3257433d0511Smrg# such as fonts, bitmaps, cursors, and docs.
3258433d0511Smrg#
3259433d0511SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
3260433d0511SmrgAC_REQUIRE([AC_PROG_INSTALL])
3261433d0511SmrgXORG_RELEASE_VERSION
3262433d0511SmrgXORG_CHANGELOG
3263433d0511SmrgXORG_INSTALL
3264433d0511SmrgXORG_MANPAGE_SECTIONS
3265433d0511Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3266433d0511Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3267433d0511Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
32686654de8bSmrg
3269433d0511Smrg# XORG_DEFAULT_OPTIONS
3270433d0511Smrg# --------------------
3271433d0511Smrg# Minimum version: 1.3.0
3272433d0511Smrg#
3273433d0511Smrg# Defines default options for X.Org modules which compile code.
3274433d0511Smrg#
3275433d0511SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3276433d0511SmrgAC_REQUIRE([AC_PROG_INSTALL])
3277433d0511SmrgXORG_COMPILER_FLAGS
3278433d0511SmrgXORG_CWARNFLAGS
3279433d0511SmrgXORG_STRICT_OPTION
3280433d0511SmrgXORG_DEFAULT_NOCODE_OPTIONS
3281433d0511Smrg]) # XORG_DEFAULT_OPTIONS
32826654de8bSmrg
3283433d0511Smrg# XORG_INSTALL()
3284433d0511Smrg# ----------------
3285433d0511Smrg# Minimum version: 1.4.0
3286433d0511Smrg#
3287433d0511Smrg# Defines the variable INSTALL_CMD as the command to copy
3288433d0511Smrg# INSTALL from $prefix/share/util-macros.
3289433d0511Smrg#
3290433d0511SmrgAC_DEFUN([XORG_INSTALL], [
3291433d0511SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3292433d0511Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3293433d0511SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3294433d0511Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3295433d0511Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3296433d0511Smrgtouch \$(top_srcdir)/INSTALL; \
3297433d0511Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3298433d0511SmrgAC_SUBST([INSTALL_CMD])
3299433d0511Smrg]) # XORG_INSTALL
3300433d0511Smrgdnl Copyright 2005 Red Hat, Inc
3301433d0511Smrgdnl
3302433d0511Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3303433d0511Smrgdnl documentation for any purpose is hereby granted without fee, provided that
3304433d0511Smrgdnl the above copyright notice appear in all copies and that both that
3305433d0511Smrgdnl copyright notice and this permission notice appear in supporting
3306433d0511Smrgdnl documentation.
3307433d0511Smrgdnl
3308433d0511Smrgdnl The above copyright notice and this permission notice shall be included
3309433d0511Smrgdnl in all copies or substantial portions of the Software.
3310433d0511Smrgdnl
3311433d0511Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3312433d0511Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3313433d0511Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3314433d0511Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3315433d0511Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3316433d0511Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3317433d0511Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3318433d0511Smrgdnl
3319433d0511Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3320433d0511Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3321433d0511Smrgdnl other dealings in this Software without prior written authorization
3322433d0511Smrgdnl from the copyright holders.
3323433d0511Smrgdnl
33246654de8bSmrg
3325433d0511Smrg# XORG_RELEASE_VERSION
3326433d0511Smrg# --------------------
3327433d0511Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
33286654de8bSmrg
3329433d0511SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3330433d0511Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3331433d0511Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3332433d0511Smrg		[Major version of this package])
3333433d0511Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3334433d0511Smrg	if test "x$PVM" = "x"; then
3335433d0511Smrg		PVM="0"
3336433d0511Smrg	fi
3337433d0511Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3338433d0511Smrg		[$PVM],
3339433d0511Smrg		[Minor version of this package])
3340433d0511Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3341433d0511Smrg	if test "x$PVP" = "x"; then
3342433d0511Smrg		PVP="0"
3343433d0511Smrg	fi
3344433d0511Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3345433d0511Smrg		[$PVP],
3346433d0511Smrg		[Patch version of this package])
3347433d0511Smrg])
33486654de8bSmrg
3349433d0511Smrg# XORG_CHANGELOG()
3350433d0511Smrg# ----------------
3351433d0511Smrg# Minimum version: 1.2.0
3352433d0511Smrg#
3353433d0511Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3354433d0511Smrg# ChangeLog from git.
3355433d0511Smrg#
3356433d0511Smrg#
3357433d0511SmrgAC_DEFUN([XORG_CHANGELOG], [
3358433d0511SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3359433d0511Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3360433d0511Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3361433d0511Smrgtouch \$(top_srcdir)/ChangeLog; \
3362433d0511Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3363433d0511SmrgAC_SUBST([CHANGELOG_CMD])
3364433d0511Smrg]) # XORG_CHANGELOG
33652b32c8f7Smrg
3366