18b648e79Smrg# generated automatically by aclocal 1.17 -*- Autoconf -*-
22f167a42Smrg
38b648e79Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
40e20ee16Smrg
50e20ee16Smrg# This file is free software; the Free Software Foundation
60e20ee16Smrg# gives unlimited permission to copy and/or distribute it,
70e20ee16Smrg# with or without modifications, as long as this notice is preserved.
80e20ee16Smrg
90e20ee16Smrg# This program is distributed in the hope that it will be useful,
100e20ee16Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
110e20ee16Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
120e20ee16Smrg# PARTICULAR PURPOSE.
130e20ee16Smrg
142f167a42Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
153e6697d4Smrgm4_ifndef([AC_AUTOCONF_VERSION],
163e6697d4Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
178b648e79Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
188b648e79Smrg[m4_warning([this file was generated for autoconf 2.72.
193e6697d4SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
203e6697d4SmrgIf you have problems, you may need to regenerate the build system entirely.
212f167a42SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
220e20ee16Smrg
238b648e79Smrg# Copyright (C) 2002-2024 Free Software Foundation, Inc.
24e6bced22Smrg#
25e6bced22Smrg# This file is free software; the Free Software Foundation
26e6bced22Smrg# gives unlimited permission to copy and/or distribute it,
27e6bced22Smrg# with or without modifications, as long as this notice is preserved.
280e20ee16Smrg
29e6bced22Smrg# AM_AUTOMAKE_VERSION(VERSION)
30e6bced22Smrg# ----------------------------
31e6bced22Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32e6bced22Smrg# generated from the m4 files accompanying Automake X.Y.
33e6bced22Smrg# (This private macro should not be called outside this file.)
34e6bced22SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
358b648e79Smrg[am__api_version='1.17'
36e6bced22Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37e6bced22Smrgdnl require some minimum version.  Point them to the right macro.
388b648e79Smrgm4_if([$1], [1.17], [],
39e6bced22Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40e6bced22Smrg])
41fc34a306Smrg
42e6bced22Smrg# _AM_AUTOCONF_VERSION(VERSION)
43e6bced22Smrg# -----------------------------
44e6bced22Smrg# aclocal traces this macro to find the Autoconf version.
45e6bced22Smrg# This is a private macro too.  Using m4_define simplifies
46e6bced22Smrg# the logic in aclocal, which can simply ignore this definition.
47e6bced22Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48fc34a306Smrg
49e6bced22Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50e6bced22Smrg# -------------------------------
51e6bced22Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52e6bced22Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53e6bced22SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
548b648e79Smrg[AM_AUTOMAKE_VERSION([1.17])dnl
55e6bced22Smrgm4_ifndef([AC_AUTOCONF_VERSION],
56e6bced22Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57e6bced22Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
583e6697d4Smrg
59e6bced22Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
600e20ee16Smrg
618b648e79Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
62e6bced22Smrg#
63e6bced22Smrg# This file is free software; the Free Software Foundation
64e6bced22Smrg# gives unlimited permission to copy and/or distribute it,
65e6bced22Smrg# with or without modifications, as long as this notice is preserved.
660e20ee16Smrg
67e6bced22Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68e6bced22Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69e6bced22Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70e6bced22Smrg#
71e6bced22Smrg# Of course, Automake must honor this variable whenever it calls a
72e6bced22Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73e6bced22Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74e6bced22Smrg# depending on how configure is run.  This is pretty annoying, since
75e6bced22Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76e6bced22Smrg# source directory, any form will work fine, but in subdirectories a
77e6bced22Smrg# relative path needs to be adjusted first.
78e6bced22Smrg#
79e6bced22Smrg# $ac_aux_dir/missing
80e6bced22Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81e6bced22Smrg# $top_srcdir/$ac_aux_dir/missing
82e6bced22Smrg#    fails if $ac_aux_dir is absolute,
83e6bced22Smrg#    fails when called from a subdirectory in a VPATH build with
84e6bced22Smrg#          a relative $ac_aux_dir
85e6bced22Smrg#
86e6bced22Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87e6bced22Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
88e6bced22Smrg# harmless because $srcdir is '.', but things will broke when you
89e6bced22Smrg# start a VPATH build or use an absolute $srcdir.
90e6bced22Smrg#
91e6bced22Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92e6bced22Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93e6bced22Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94e6bced22Smrg# and then we would define $MISSING as
95e6bced22Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96e6bced22Smrg# This will work as long as MISSING is not called from configure, because
97e6bced22Smrg# unfortunately $(top_srcdir) has no meaning in configure.
98e6bced22Smrg# However there are other variables, like CC, which are often used in
99e6bced22Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100e6bced22Smrg#
101e6bced22Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
102e6bced22Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
103e6bced22Smrg# configured tree to be moved without reconfiguration.
1040e20ee16Smrg
105e6bced22SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106e6bced22Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107e6bced22Smrg# Expand $ac_aux_dir to an absolute path.
108e6bced22Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109e6bced22Smrg])
1100e20ee16Smrg
111e6bced22Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1120e20ee16Smrg
1138b648e79Smrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
114e6bced22Smrg#
115e6bced22Smrg# This file is free software; the Free Software Foundation
116e6bced22Smrg# gives unlimited permission to copy and/or distribute it,
117e6bced22Smrg# with or without modifications, as long as this notice is preserved.
1180e20ee16Smrg
119e6bced22Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120e6bced22Smrg# -------------------------------------
121e6bced22Smrg# Define a conditional.
122e6bced22SmrgAC_DEFUN([AM_CONDITIONAL],
123e6bced22Smrg[AC_PREREQ([2.52])dnl
124e6bced22Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
125e6bced22Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126e6bced22SmrgAC_SUBST([$1_TRUE])dnl
127e6bced22SmrgAC_SUBST([$1_FALSE])dnl
128e6bced22Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129e6bced22Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130e6bced22Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131e6bced22Smrgif $2; then
132e6bced22Smrg  $1_TRUE=
133e6bced22Smrg  $1_FALSE='#'
134e6bced22Smrgelse
135e6bced22Smrg  $1_TRUE='#'
136e6bced22Smrg  $1_FALSE=
137e6bced22Smrgfi
138e6bced22SmrgAC_CONFIG_COMMANDS_PRE(
139e6bced22Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140e6bced22Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141e6bced22SmrgUsually this means the macro was only invoked conditionally.]])
142e6bced22Smrgfi])])
1430e20ee16Smrg
1448b648e79Smrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
145e6bced22Smrg#
146e6bced22Smrg# This file is free software; the Free Software Foundation
147e6bced22Smrg# gives unlimited permission to copy and/or distribute it,
148e6bced22Smrg# with or without modifications, as long as this notice is preserved.
1490e20ee16Smrg
1500e20ee16Smrg
151e6bced22Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
152e6bced22Smrg# written in clear, in which case automake, when reading aclocal.m4,
153e6bced22Smrg# will think it sees a *use*, and therefore will trigger all it's
154e6bced22Smrg# C support machinery.  Also note that it means that autoscan, seeing
155e6bced22Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1560e20ee16Smrg
1570e20ee16Smrg
158e6bced22Smrg# _AM_DEPENDENCIES(NAME)
159e6bced22Smrg# ----------------------
160e6bced22Smrg# See how the compiler implements dependency checking.
161e6bced22Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
162e6bced22Smrg# We try a few techniques and use that to set a single cache variable.
163e6bced22Smrg#
164e6bced22Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
165e6bced22Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
166e6bced22Smrg# dependency, and given that the user is not expected to run this macro,
167e6bced22Smrg# just rely on AC_PROG_CC.
168e6bced22SmrgAC_DEFUN([_AM_DEPENDENCIES],
169e6bced22Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
170e6bced22SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
171e6bced22SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
172e6bced22SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1730e20ee16Smrg
174e6bced22Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
175e6bced22Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
176e6bced22Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
177e6bced22Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
178e6bced22Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
179e6bced22Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
180e6bced22Smrg                    [depcc="$$1"   am_compiler_list=])
1810e20ee16Smrg
182e6bced22SmrgAC_CACHE_CHECK([dependency style of $depcc],
183e6bced22Smrg               [am_cv_$1_dependencies_compiler_type],
184e6bced22Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
185e6bced22Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
186e6bced22Smrg  # making bogus files that we don't know about and never remove.  For
187e6bced22Smrg  # instance it was reported that on HP-UX the gcc test will end up
188e6bced22Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
189e6bced22Smrg  # in D".
190e6bced22Smrg  rm -rf conftest.dir
191e6bced22Smrg  mkdir conftest.dir
192e6bced22Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
193e6bced22Smrg  # using a relative directory.
194e6bced22Smrg  cp "$am_depcomp" conftest.dir
195e6bced22Smrg  cd conftest.dir
196e6bced22Smrg  # We will build objects and dependencies in a subdirectory because
197e6bced22Smrg  # it helps to detect inapplicable dependency modes.  For instance
198e6bced22Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
199e6bced22Smrg  # side effect of compilation, but ICC will put the dependencies in
200e6bced22Smrg  # the current directory while Tru64 will put them in the object
201e6bced22Smrg  # directory.
202e6bced22Smrg  mkdir sub
2030e20ee16Smrg
204e6bced22Smrg  am_cv_$1_dependencies_compiler_type=none
205e6bced22Smrg  if test "$am_compiler_list" = ""; then
206e6bced22Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
207e6bced22Smrg  fi
208e6bced22Smrg  am__universal=false
209e6bced22Smrg  m4_case([$1], [CC],
210e6bced22Smrg    [case " $depcc " in #(
211e6bced22Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212e6bced22Smrg     esac],
213e6bced22Smrg    [CXX],
214e6bced22Smrg    [case " $depcc " in #(
215e6bced22Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216e6bced22Smrg     esac])
2170e20ee16Smrg
218e6bced22Smrg  for depmode in $am_compiler_list; do
219e6bced22Smrg    # Setup a source with many dependencies, because some compilers
220e6bced22Smrg    # like to wrap large dependency lists on column 80 (with \), and
221e6bced22Smrg    # we should not choose a depcomp mode which is confused by this.
222e6bced22Smrg    #
223e6bced22Smrg    # We need to recreate these files for each test, as the compiler may
224e6bced22Smrg    # overwrite some of them when testing with obscure command lines.
225e6bced22Smrg    # This happens at least with the AIX C compiler.
226e6bced22Smrg    : > sub/conftest.c
227e6bced22Smrg    for i in 1 2 3 4 5 6; do
228e6bced22Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
229e6bced22Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
230e6bced22Smrg      # Solaris 10 /bin/sh.
231e6bced22Smrg      echo '/* dummy */' > sub/conftst$i.h
232e6bced22Smrg    done
233e6bced22Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2340e20ee16Smrg
235e6bced22Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236e6bced22Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
237e6bced22Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
238e6bced22Smrg    # versions had trouble with output in subdirs.
239e6bced22Smrg    am__obj=sub/conftest.${OBJEXT-o}
240e6bced22Smrg    am__minus_obj="-o $am__obj"
241e6bced22Smrg    case $depmode in
242e6bced22Smrg    gcc)
243e6bced22Smrg      # This depmode causes a compiler race in universal mode.
244e6bced22Smrg      test "$am__universal" = false || continue
245e6bced22Smrg      ;;
246e6bced22Smrg    nosideeffect)
247e6bced22Smrg      # After this tag, mechanisms are not by side-effect, so they'll
248e6bced22Smrg      # only be used when explicitly requested.
249e6bced22Smrg      if test "x$enable_dependency_tracking" = xyes; then
250e6bced22Smrg	continue
251e6bced22Smrg      else
252e6bced22Smrg	break
253e6bced22Smrg      fi
254e6bced22Smrg      ;;
255e6bced22Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
256e6bced22Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
257e6bced22Smrg      # not run yet.  These depmodes are late enough in the game, and
258e6bced22Smrg      # so weak that their functioning should not be impacted.
259e6bced22Smrg      am__obj=conftest.${OBJEXT-o}
260e6bced22Smrg      am__minus_obj=
261e6bced22Smrg      ;;
262e6bced22Smrg    none) break ;;
263e6bced22Smrg    esac
264e6bced22Smrg    if depmode=$depmode \
265e6bced22Smrg       source=sub/conftest.c object=$am__obj \
266e6bced22Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267e6bced22Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
268e6bced22Smrg         >/dev/null 2>conftest.err &&
269e6bced22Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
270e6bced22Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271e6bced22Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
272e6bced22Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
273e6bced22Smrg      # icc doesn't choke on unknown options, it will just issue warnings
274e6bced22Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
275e6bced22Smrg      # that says an option was ignored or not supported.
2768b648e79Smrg      # When given -MP, icc 7.0 and 7.1 complain thus:
277e6bced22Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
278e6bced22Smrg      # The diagnosis changed in icc 8.0:
279e6bced22Smrg      #   icc: Command line remark: option '-MP' not supported
280e6bced22Smrg      if (grep 'ignoring option' conftest.err ||
281e6bced22Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
282e6bced22Smrg        am_cv_$1_dependencies_compiler_type=$depmode
283e6bced22Smrg        break
284e6bced22Smrg      fi
285e6bced22Smrg    fi
286e6bced22Smrg  done
2873e6697d4Smrg
288e6bced22Smrg  cd ..
289e6bced22Smrg  rm -rf conftest.dir
290e6bced22Smrgelse
291e6bced22Smrg  am_cv_$1_dependencies_compiler_type=none
292e6bced22Smrgfi
293e6bced22Smrg])
294e6bced22SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
295e6bced22SmrgAM_CONDITIONAL([am__fastdep$1], [
296e6bced22Smrg  test "x$enable_dependency_tracking" != xno \
297e6bced22Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298e6bced22Smrg])
2990e20ee16Smrg
3000e20ee16Smrg
301e6bced22Smrg# AM_SET_DEPDIR
302e6bced22Smrg# -------------
303e6bced22Smrg# Choose a directory name for dependency files.
304e6bced22Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
305e6bced22SmrgAC_DEFUN([AM_SET_DEPDIR],
306e6bced22Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
307e6bced22SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
308e6bced22Smrg])
309fc34a306Smrg
310fc34a306Smrg
311e6bced22Smrg# AM_DEP_TRACK
312e6bced22Smrg# ------------
313e6bced22SmrgAC_DEFUN([AM_DEP_TRACK],
314e6bced22Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
315e6bced22SmrgAS_HELP_STRING(
316e6bced22Smrg  [--enable-dependency-tracking],
317e6bced22Smrg  [do not reject slow dependency extractors])
318e6bced22SmrgAS_HELP_STRING(
319e6bced22Smrg  [--disable-dependency-tracking],
320e6bced22Smrg  [speeds up one-time build])])
321e6bced22Smrgif test "x$enable_dependency_tracking" != xno; then
322e6bced22Smrg  am_depcomp="$ac_aux_dir/depcomp"
323e6bced22Smrg  AMDEPBACKSLASH='\'
324e6bced22Smrg  am__nodep='_no'
325e6bced22Smrgfi
326e6bced22SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
327e6bced22SmrgAC_SUBST([AMDEPBACKSLASH])dnl
328e6bced22Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
329e6bced22SmrgAC_SUBST([am__nodep])dnl
330e6bced22Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
331e6bced22Smrg])
332fc34a306Smrg
333e6bced22Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334fc34a306Smrg
3358b648e79Smrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
336e6bced22Smrg#
337e6bced22Smrg# This file is free software; the Free Software Foundation
338e6bced22Smrg# gives unlimited permission to copy and/or distribute it,
339e6bced22Smrg# with or without modifications, as long as this notice is preserved.
3400e20ee16Smrg
341e6bced22Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
342e6bced22Smrg# ------------------------------
343e6bced22SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
344e6bced22Smrg[{
345e6bced22Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
346e6bced22Smrg  # are listed without --file.  Let's play safe and only enable the eval
347e6bced22Smrg  # if we detect the quoting.
348e6bced22Smrg  # TODO: see whether this extra hack can be removed once we start
349e6bced22Smrg  # requiring Autoconf 2.70 or later.
350e6bced22Smrg  AS_CASE([$CONFIG_FILES],
351e6bced22Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
352e6bced22Smrg          [*], [set x $CONFIG_FILES])
353e6bced22Smrg  shift
354e6bced22Smrg  # Used to flag and report bootstrapping failures.
355e6bced22Smrg  am_rc=0
356e6bced22Smrg  for am_mf
357e6bced22Smrg  do
358e6bced22Smrg    # Strip MF so we end up with the name of the file.
359e6bced22Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
360e6bced22Smrg    # Check whether this is an Automake generated Makefile which includes
361e6bced22Smrg    # dependency-tracking related rules and includes.
362e6bced22Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
363e6bced22Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
364e6bced22Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
365e6bced22Smrg      || continue
366e6bced22Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
367e6bced22Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
368e6bced22Smrg    AM_RUN_LOG([cd "$am_dirpart" \
369e6bced22Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
370e6bced22Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
371e6bced22Smrg  done
372e6bced22Smrg  if test $am_rc -ne 0; then
373e6bced22Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
374e6bced22Smrg    for automatic dependency tracking.  If GNU make was not used, consider
375e6bced22Smrg    re-running the configure script with MAKE="gmake" (or whatever is
376e6bced22Smrg    necessary).  You can also try re-running configure with the
377e6bced22Smrg    '--disable-dependency-tracking' option to at least be able to build
378e6bced22Smrg    the package (albeit without support for automatic dependency tracking).])
379e6bced22Smrg  fi
380e6bced22Smrg  AS_UNSET([am_dirpart])
381e6bced22Smrg  AS_UNSET([am_filepart])
382e6bced22Smrg  AS_UNSET([am_mf])
383e6bced22Smrg  AS_UNSET([am_rc])
384e6bced22Smrg  rm -f conftest-deps.mk
385e6bced22Smrg}
386e6bced22Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3870e20ee16Smrg
3880e20ee16Smrg
389e6bced22Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
390e6bced22Smrg# -----------------------------
391e6bced22Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
392fc34a306Smrg#
393e6bced22Smrg# This code is only required when automatic dependency tracking is enabled.
394e6bced22Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
395e6bced22Smrg# order to bootstrap the dependency handling code.
396e6bced22SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
397e6bced22Smrg[AC_CONFIG_COMMANDS([depfiles],
398e6bced22Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
399e6bced22Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
4000e20ee16Smrg
401e6bced22Smrg# Do all the work for Automake.                             -*- Autoconf -*-
4020e20ee16Smrg
4038b648e79Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
4040e20ee16Smrg#
405e6bced22Smrg# This file is free software; the Free Software Foundation
406e6bced22Smrg# gives unlimited permission to copy and/or distribute it,
407e6bced22Smrg# with or without modifications, as long as this notice is preserved.
4080e20ee16Smrg
409e6bced22Smrg# This macro actually does too much.  Some checks are only needed if
410e6bced22Smrg# your package does certain things.  But this isn't really a big deal.
4110e20ee16Smrg
412e6bced22Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
413e6bced22Smrgm4_define([AC_PROG_CC],
414e6bced22Smrgm4_defn([AC_PROG_CC])
415e6bced22Smrg[_AM_PROG_CC_C_O
416e6bced22Smrg])
4173e6697d4Smrg
418e6bced22Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
419e6bced22Smrg# AM_INIT_AUTOMAKE([OPTIONS])
420e6bced22Smrg# -----------------------------------------------
421e6bced22Smrg# The call with PACKAGE and VERSION arguments is the old style
422e6bced22Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
423e6bced22Smrg# and VERSION should now be passed to AC_INIT and removed from
424e6bced22Smrg# the call to AM_INIT_AUTOMAKE.
425e6bced22Smrg# We support both call styles for the transition.  After
426e6bced22Smrg# the next Automake release, Autoconf can make the AC_INIT
427e6bced22Smrg# arguments mandatory, and then we can depend on a new Autoconf
428e6bced22Smrg# release and drop the old call support.
429e6bced22SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
430e6bced22Smrg[AC_PREREQ([2.65])dnl
431e6bced22Smrgm4_ifdef([_$0_ALREADY_INIT],
432e6bced22Smrg  [m4_fatal([$0 expanded multiple times
433e6bced22Smrg]m4_defn([_$0_ALREADY_INIT]))],
434e6bced22Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
435e6bced22Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
436e6bced22Smrgdnl the ones we care about.
437e6bced22Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
438e6bced22SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
439e6bced22SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
440e6bced22Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
441e6bced22Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
442e6bced22Smrg  # is not polluted with repeated "-I."
443e6bced22Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
444e6bced22Smrg  # test to see if srcdir already configured
445e6bced22Smrg  if test -f $srcdir/config.status; then
446e6bced22Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
447e6bced22Smrg  fi
448fc34a306Smrgfi
4492f167a42Smrg
450e6bced22Smrg# test whether we have cygpath
451e6bced22Smrgif test -z "$CYGPATH_W"; then
452e6bced22Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
453e6bced22Smrg    CYGPATH_W='cygpath -w'
454e6bced22Smrg  else
455e6bced22Smrg    CYGPATH_W=echo
456e6bced22Smrg  fi
4570e20ee16Smrgfi
458e6bced22SmrgAC_SUBST([CYGPATH_W])
4593e6697d4Smrg
460e6bced22Smrg# Define the identity of the package.
461e6bced22Smrgdnl Distinguish between old-style and new-style calls.
462e6bced22Smrgm4_ifval([$2],
463e6bced22Smrg[AC_DIAGNOSE([obsolete],
464e6bced22Smrg             [$0: two- and three-arguments forms are deprecated.])
465e6bced22Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
466e6bced22Smrg AC_SUBST([PACKAGE], [$1])dnl
467e6bced22Smrg AC_SUBST([VERSION], [$2])],
468e6bced22Smrg[_AM_SET_OPTIONS([$1])dnl
469e6bced22Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
470e6bced22Smrgm4_if(
471e6bced22Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
472e6bced22Smrg  [ok:ok],,
473e6bced22Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
474e6bced22Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
475e6bced22Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4760e20ee16Smrg
477e6bced22Smrg_AM_IF_OPTION([no-define],,
478e6bced22Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
479e6bced22Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4800e20ee16Smrg
481e6bced22Smrg# Some tools Automake needs.
482e6bced22SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
483e6bced22SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
484e6bced22SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
485e6bced22SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
486e6bced22SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
487e6bced22SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
488e6bced22SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
489e6bced22SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
490e6bced22SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
491e6bced22SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
492e6bced22Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
493e6bced22Smrg# dies out for good.  For more background, see:
494e6bced22Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
495e6bced22Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
496e6bced22SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
497e6bced22Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
498e6bced22Smrg# system "awk" is bad on some platforms.
499e6bced22SmrgAC_REQUIRE([AC_PROG_AWK])dnl
500e6bced22SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
501e6bced22SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
502e6bced22Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
503e6bced22Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
504e6bced22Smrg			     [_AM_PROG_TAR([v7])])])
505e6bced22Smrg_AM_IF_OPTION([no-dependencies],,
506e6bced22Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
507e6bced22Smrg		  [_AM_DEPENDENCIES([CC])],
508e6bced22Smrg		  [m4_define([AC_PROG_CC],
509e6bced22Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
510e6bced22SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
511e6bced22Smrg		  [_AM_DEPENDENCIES([CXX])],
512e6bced22Smrg		  [m4_define([AC_PROG_CXX],
513e6bced22Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
514e6bced22SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
515e6bced22Smrg		  [_AM_DEPENDENCIES([OBJC])],
516e6bced22Smrg		  [m4_define([AC_PROG_OBJC],
517e6bced22Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
518e6bced22SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
519e6bced22Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
520e6bced22Smrg		  [m4_define([AC_PROG_OBJCXX],
521e6bced22Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
522e6bced22Smrg])
523e6bced22Smrg# Variables for tags utilities; see am/tags.am
524e6bced22Smrgif test -z "$CTAGS"; then
525e6bced22Smrg  CTAGS=ctags
526fc34a306Smrgfi
527e6bced22SmrgAC_SUBST([CTAGS])
528e6bced22Smrgif test -z "$ETAGS"; then
529e6bced22Smrg  ETAGS=etags
530fc34a306Smrgfi
531e6bced22SmrgAC_SUBST([ETAGS])
532e6bced22Smrgif test -z "$CSCOPE"; then
533e6bced22Smrg  CSCOPE=cscope
534e6bced22Smrgfi
535e6bced22SmrgAC_SUBST([CSCOPE])
5360e20ee16Smrg
5378b648e79SmrgAC_REQUIRE([_AM_SILENT_RULES])dnl
538e6bced22Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
539e6bced22Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
540e6bced22Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
541e6bced22SmrgAC_CONFIG_COMMANDS_PRE(dnl
542e6bced22Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
543e6bced22Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5442f167a42Smrg
5458b648e79SmrgAC_REQUIRE([_AM_PROG_RM_F])
5468b648e79SmrgAC_REQUIRE([_AM_PROG_XARGS_N])
5472f167a42Smrg
548e6bced22Smrgdnl The trailing newline in this macro's definition is deliberate, for
549e6bced22Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
550e6bced22Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
551e6bced22Smrg])
5522f167a42Smrg
553e6bced22Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
554e6bced22Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
555e6bced22Smrgdnl mangled by Autoconf and run in a shell conditional statement.
556e6bced22Smrgm4_define([_AC_COMPILER_EXEEXT],
557e6bced22Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5582f167a42Smrg
559e6bced22Smrg# When config.status generates a header, we must update the stamp-h file.
560e6bced22Smrg# This file resides in the same directory as the config header
561e6bced22Smrg# that is generated.  The stamp files are numbered to have different names.
5620e20ee16Smrg
563e6bced22Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
564e6bced22Smrg# loop where config.status creates the headers, so we can generate
565e6bced22Smrg# our stamp files there.
566e6bced22SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
567e6bced22Smrg[# Compute $1's index in $config_headers.
568e6bced22Smrg_am_arg=$1
569e6bced22Smrg_am_stamp_count=1
570e6bced22Smrgfor _am_header in $config_headers :; do
571e6bced22Smrg  case $_am_header in
572e6bced22Smrg    $_am_arg | $_am_arg:* )
573e6bced22Smrg      break ;;
574e6bced22Smrg    * )
575e6bced22Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
576e6bced22Smrg  esac
577e6bced22Smrgdone
578e6bced22Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
5790e20ee16Smrg
5808b648e79Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
581e6bced22Smrg#
582e6bced22Smrg# This file is free software; the Free Software Foundation
583e6bced22Smrg# gives unlimited permission to copy and/or distribute it,
584e6bced22Smrg# with or without modifications, as long as this notice is preserved.
5853e6697d4Smrg
586e6bced22Smrg# AM_PROG_INSTALL_SH
587e6bced22Smrg# ------------------
588e6bced22Smrg# Define $install_sh.
589e6bced22SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
590e6bced22Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
591e6bced22Smrgif test x"${install_sh+set}" != xset; then
592e6bced22Smrg  case $am_aux_dir in
593e6bced22Smrg  *\ * | *\	*)
594e6bced22Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
595e6bced22Smrg  *)
596e6bced22Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
597e6bced22Smrg  esac
598fc34a306Smrgfi
599e6bced22SmrgAC_SUBST([install_sh])])
6000e20ee16Smrg
6018b648e79Smrg# Copyright (C) 2003-2024 Free Software Foundation, Inc.
602e6bced22Smrg#
603e6bced22Smrg# This file is free software; the Free Software Foundation
604e6bced22Smrg# gives unlimited permission to copy and/or distribute it,
605e6bced22Smrg# with or without modifications, as long as this notice is preserved.
6060e20ee16Smrg
607e6bced22Smrg# Check whether the underlying file-system supports filenames
608e6bced22Smrg# with a leading dot.  For instance MS-DOS doesn't.
609e6bced22SmrgAC_DEFUN([AM_SET_LEADING_DOT],
610e6bced22Smrg[rm -rf .tst 2>/dev/null
611e6bced22Smrgmkdir .tst 2>/dev/null
612e6bced22Smrgif test -d .tst; then
613e6bced22Smrg  am__leading_dot=.
6143e6697d4Smrgelse
615e6bced22Smrg  am__leading_dot=_
6163e6697d4Smrgfi
617e6bced22Smrgrmdir .tst 2>/dev/null
618e6bced22SmrgAC_SUBST([am__leading_dot])])
6190e20ee16Smrg
620e6bced22Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6210e20ee16Smrg
6228b648e79Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
623e6bced22Smrg#
624e6bced22Smrg# This file is free software; the Free Software Foundation
625e6bced22Smrg# gives unlimited permission to copy and/or distribute it,
626e6bced22Smrg# with or without modifications, as long as this notice is preserved.
6270e20ee16Smrg
628e6bced22Smrg# AM_MAKE_INCLUDE()
629e6bced22Smrg# -----------------
630e6bced22Smrg# Check whether make has an 'include' directive that can support all
631e6bced22Smrg# the idioms we need for our automatic dependency tracking code.
632e6bced22SmrgAC_DEFUN([AM_MAKE_INCLUDE],
633e6bced22Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
634e6bced22Smrgcat > confinc.mk << 'END'
635e6bced22Smrgam__doit:
636e6bced22Smrg	@echo this is the am__doit target >confinc.out
637e6bced22Smrg.PHONY: am__doit
638e6bced22SmrgEND
639e6bced22Smrgam__include="#"
640e6bced22Smrgam__quote=
641e6bced22Smrg# BSD make does it like this.
642e6bced22Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
643e6bced22Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
644e6bced22Smrgecho 'include confinc.mk # ignored' > confmf.GNU
645e6bced22Smrg_am_result=no
646e6bced22Smrgfor s in GNU BSD; do
647e6bced22Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
648e6bced22Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
649e6bced22Smrg      ['0:this is the am__doit target'],
650e6bced22Smrg      [AS_CASE([$s],
651e6bced22Smrg          [BSD], [am__include='.include' am__quote='"'],
652e6bced22Smrg          [am__include='include' am__quote=''])])
653e6bced22Smrg  if test "$am__include" != "#"; then
654e6bced22Smrg    _am_result="yes ($s style)"
655e6bced22Smrg    break
656e6bced22Smrg  fi
657e6bced22Smrgdone
658e6bced22Smrgrm -f confinc.* confmf.*
659e6bced22SmrgAC_MSG_RESULT([${_am_result}])
660e6bced22SmrgAC_SUBST([am__include])])
661e6bced22SmrgAC_SUBST([am__quote])])
6620e20ee16Smrg
663e6bced22Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
6640e20ee16Smrg
6658b648e79Smrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
6663e6697d4Smrg#
667e6bced22Smrg# This file is free software; the Free Software Foundation
668e6bced22Smrg# gives unlimited permission to copy and/or distribute it,
669e6bced22Smrg# with or without modifications, as long as this notice is preserved.
6700e20ee16Smrg
671e6bced22Smrg# AM_MISSING_PROG(NAME, PROGRAM)
672e6bced22Smrg# ------------------------------
673e6bced22SmrgAC_DEFUN([AM_MISSING_PROG],
674e6bced22Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
675e6bced22Smrg$1=${$1-"${am_missing_run}$2"}
676e6bced22SmrgAC_SUBST($1)])
6773e6697d4Smrg
678e6bced22Smrg# AM_MISSING_HAS_RUN
679e6bced22Smrg# ------------------
680e6bced22Smrg# Define MISSING if not defined so far and test if it is modern enough.
681e6bced22Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
682e6bced22SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
683e6bced22Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
684e6bced22SmrgAC_REQUIRE_AUX_FILE([missing])dnl
685e6bced22Smrgif test x"${MISSING+set}" != xset; then
686e6bced22Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
687fc34a306Smrgfi
688e6bced22Smrg# Use eval to expand $SHELL
689e6bced22Smrgif eval "$MISSING --is-lightweight"; then
690e6bced22Smrg  am_missing_run="$MISSING "
691e6bced22Smrgelse
692e6bced22Smrg  am_missing_run=
693e6bced22Smrg  AC_MSG_WARN(['missing' script is too old or missing])
694fc34a306Smrgfi
695e6bced22Smrg])
6960e20ee16Smrg
697e6bced22Smrg# Helper functions for option handling.                     -*- Autoconf -*-
6980e20ee16Smrg
6998b648e79Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
700e6bced22Smrg#
701e6bced22Smrg# This file is free software; the Free Software Foundation
702e6bced22Smrg# gives unlimited permission to copy and/or distribute it,
703e6bced22Smrg# with or without modifications, as long as this notice is preserved.
7040e20ee16Smrg
705e6bced22Smrg# _AM_MANGLE_OPTION(NAME)
706e6bced22Smrg# -----------------------
707e6bced22SmrgAC_DEFUN([_AM_MANGLE_OPTION],
708e6bced22Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7093e6697d4Smrg
710e6bced22Smrg# _AM_SET_OPTION(NAME)
711e6bced22Smrg# --------------------
712e6bced22Smrg# Set option NAME.  Presently that only means defining a flag for this option.
713e6bced22SmrgAC_DEFUN([_AM_SET_OPTION],
714e6bced22Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7153e6697d4Smrg
716e6bced22Smrg# _AM_SET_OPTIONS(OPTIONS)
717e6bced22Smrg# ------------------------
718e6bced22Smrg# OPTIONS is a space-separated list of Automake options.
719e6bced22SmrgAC_DEFUN([_AM_SET_OPTIONS],
720e6bced22Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7212f167a42Smrg
722e6bced22Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
723e6bced22Smrg# -------------------------------------------
724e6bced22Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
725e6bced22SmrgAC_DEFUN([_AM_IF_OPTION],
726e6bced22Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7272f167a42Smrg
7288b648e79Smrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
7292f167a42Smrg#
730e6bced22Smrg# This file is free software; the Free Software Foundation
731e6bced22Smrg# gives unlimited permission to copy and/or distribute it,
732e6bced22Smrg# with or without modifications, as long as this notice is preserved.
7332f167a42Smrg
734e6bced22Smrg# _AM_PROG_CC_C_O
735e6bced22Smrg# ---------------
736e6bced22Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
737e6bced22Smrg# to automatically call this.
738e6bced22SmrgAC_DEFUN([_AM_PROG_CC_C_O],
739e6bced22Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
740e6bced22SmrgAC_REQUIRE_AUX_FILE([compile])dnl
741e6bced22SmrgAC_LANG_PUSH([C])dnl
742e6bced22SmrgAC_CACHE_CHECK(
743e6bced22Smrg  [whether $CC understands -c and -o together],
744e6bced22Smrg  [am_cv_prog_cc_c_o],
745e6bced22Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
746e6bced22Smrg  # Make sure it works both with $CC and with simple cc.
747e6bced22Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
748e6bced22Smrg  # compilers refuse to overwrite an existing .o file with -o,
749e6bced22Smrg  # though they will create one.
750e6bced22Smrg  am_cv_prog_cc_c_o=yes
751e6bced22Smrg  for am_i in 1 2; do
752e6bced22Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
753e6bced22Smrg         && test -f conftest2.$ac_objext; then
754e6bced22Smrg      : OK
755e6bced22Smrg    else
756e6bced22Smrg      am_cv_prog_cc_c_o=no
757e6bced22Smrg      break
758e6bced22Smrg    fi
759e6bced22Smrg  done
760e6bced22Smrg  rm -f core conftest*
761e6bced22Smrg  unset am_i])
762e6bced22Smrgif test "$am_cv_prog_cc_c_o" != yes; then
763e6bced22Smrg   # Losing compiler, so override with the script.
764e6bced22Smrg   # FIXME: It is wrong to rewrite CC.
765e6bced22Smrg   # But if we don't then we get into trouble of one sort or another.
766e6bced22Smrg   # A longer-term fix would be to have automake use am__CC in this case,
767e6bced22Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
768e6bced22Smrg   CC="$am_aux_dir/compile $CC"
7692f167a42Smrgfi
770e6bced22SmrgAC_LANG_POP([C])])
7713e6697d4Smrg
772e6bced22Smrg# For backward compatibility.
773e6bced22SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
774fc34a306Smrg
7758b648e79Smrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
7768b648e79Smrg#
7778b648e79Smrg# This file is free software; the Free Software Foundation
7788b648e79Smrg# gives unlimited permission to copy and/or distribute it,
7798b648e79Smrg# with or without modifications, as long as this notice is preserved.
7808b648e79Smrg
7818b648e79Smrg# _AM_PROG_RM_F
7828b648e79Smrg# ---------------
7838b648e79Smrg# Check whether 'rm -f' without any arguments works.
7848b648e79Smrg# https://bugs.gnu.org/10828
7858b648e79SmrgAC_DEFUN([_AM_PROG_RM_F],
7868b648e79Smrg[am__rm_f_notfound=
7878b648e79SmrgAS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""'])
7888b648e79SmrgAC_SUBST(am__rm_f_notfound)
7898b648e79Smrg])
7908b648e79Smrg
7918b648e79Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
792fc34a306Smrg#
793e6bced22Smrg# This file is free software; the Free Software Foundation
794e6bced22Smrg# gives unlimited permission to copy and/or distribute it,
795e6bced22Smrg# with or without modifications, as long as this notice is preserved.
7963e6697d4Smrg
797e6bced22Smrg# AM_RUN_LOG(COMMAND)
798e6bced22Smrg# -------------------
799e6bced22Smrg# Run COMMAND, save the exit status in ac_status, and log it.
800e6bced22Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
801e6bced22SmrgAC_DEFUN([AM_RUN_LOG],
802e6bced22Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
803e6bced22Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
804e6bced22Smrg   ac_status=$?
805e6bced22Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
806e6bced22Smrg   (exit $ac_status); }])
8070e20ee16Smrg
808e6bced22Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8090e20ee16Smrg
8108b648e79Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
811fc34a306Smrg#
812e6bced22Smrg# This file is free software; the Free Software Foundation
813e6bced22Smrg# gives unlimited permission to copy and/or distribute it,
814e6bced22Smrg# with or without modifications, as long as this notice is preserved.
8150e20ee16Smrg
8168b648e79Smrg# _AM_SLEEP_FRACTIONAL_SECONDS
8178b648e79Smrg# ----------------------------
8188b648e79SmrgAC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl
8198b648e79SmrgAC_CACHE_CHECK([whether sleep supports fractional seconds],
8208b648e79Smrg               am_cv_sleep_fractional_seconds, [dnl
8218b648e79SmrgAS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes],
8228b648e79Smrg                                 [am_cv_sleep_fractional_seconds=no])
8238b648e79Smrg])])
8248b648e79Smrg
8258b648e79Smrg# _AM_FILESYSTEM_TIMESTAMP_RESOLUTION
8268b648e79Smrg# -----------------------------------
8278b648e79Smrg# Determine the filesystem's resolution for file modification
8288b648e79Smrg# timestamps.  The coarsest we know of is FAT, with a resolution
8298b648e79Smrg# of only two seconds, even with the most recent "exFAT" extensions.
8308b648e79Smrg# The finest (e.g. ext4 with large inodes, XFS, ZFS) is one
8318b648e79Smrg# nanosecond, matching clock_gettime.  However, it is probably not
8328b648e79Smrg# possible to delay execution of a shell script for less than one
8338b648e79Smrg# millisecond, due to process creation overhead and scheduling
8348b648e79Smrg# granularity, so we don't check for anything finer than that. (See below.)
8358b648e79SmrgAC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl
8368b648e79SmrgAC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS])
8378b648e79SmrgAC_CACHE_CHECK([filesystem timestamp resolution],
8388b648e79Smrg               am_cv_filesystem_timestamp_resolution, [dnl
8398b648e79Smrg# Default to the worst case.
8408b648e79Smrgam_cv_filesystem_timestamp_resolution=2
8418b648e79Smrg
8428b648e79Smrg# Only try to go finer than 1 sec if sleep can do it.
8438b648e79Smrg# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work,
8448b648e79Smrg# - 1 sec is not much of a win compared to 2 sec, and
8458b648e79Smrg# - it takes 2 seconds to perform the test whether 1 sec works.
8468b648e79Smrg# 
8478b648e79Smrg# Instead, just use the default 2s on platforms that have 1s resolution,
8488b648e79Smrg# accept the extra 1s delay when using $sleep in the Automake tests, in
8498b648e79Smrg# exchange for not incurring the 2s delay for running the test for all
8508b648e79Smrg# packages.
8518b648e79Smrg#
8528b648e79Smrgam_try_resolutions=
8538b648e79Smrgif test "$am_cv_sleep_fractional_seconds" = yes; then
8548b648e79Smrg  # Even a millisecond often causes a bunch of false positives,
8558b648e79Smrg  # so just try a hundredth of a second. The time saved between .001 and
8568b648e79Smrg  # .01 is not terribly consequential.
8578b648e79Smrg  am_try_resolutions="0.01 0.1 $am_try_resolutions"
8588b648e79Smrgfi
8598b648e79Smrg
8608b648e79Smrg# In order to catch current-generation FAT out, we must *modify* files
8618b648e79Smrg# that already exist; the *creation* timestamp is finer.  Use names
8628b648e79Smrg# that make ls -t sort them differently when they have equal
8638b648e79Smrg# timestamps than when they have distinct timestamps, keeping
8648b648e79Smrg# in mind that ls -t prints the *newest* file first.
8658b648e79Smrgrm -f conftest.ts?
8668b648e79Smrg: > conftest.ts1
8678b648e79Smrg: > conftest.ts2
8688b648e79Smrg: > conftest.ts3
8698b648e79Smrg
8708b648e79Smrg# Make sure ls -t actually works.  Do 'set' in a subshell so we don't
8718b648e79Smrg# clobber the current shell's arguments. (Outer-level square brackets
8728b648e79Smrg# are removed by m4; they're present so that m4 does not expand
8738b648e79Smrg# <dollar><star>; be careful, easy to get confused.)
8748b648e79Smrgif (
8758b648e79Smrg     set X `[ls -t conftest.ts[12]]` &&
8768b648e79Smrg     {
8778b648e79Smrg       test "$[]*" != "X conftest.ts1 conftest.ts2" ||
8788b648e79Smrg       test "$[]*" != "X conftest.ts2 conftest.ts1";
8798b648e79Smrg     }
8808b648e79Smrg); then :; else
8818b648e79Smrg  # If neither matched, then we have a broken ls.  This can happen
8828b648e79Smrg  # if, for instance, CONFIG_SHELL is bash and it inherits a
8838b648e79Smrg  # broken ls alias from the environment.  This has actually
8848b648e79Smrg  # happened.  Such a system could not be considered "sane".
8858b648e79Smrg  _AS_ECHO_UNQUOTED(
8868b648e79Smrg    ["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""],
8878b648e79Smrg    [AS_MESSAGE_LOG_FD])
8888b648e79Smrg  AC_MSG_FAILURE([ls -t produces unexpected output.
8898b648e79SmrgMake sure there is not a broken ls alias in your environment.])
8908b648e79Smrgfi
8918b648e79Smrg
8928b648e79Smrgfor am_try_res in $am_try_resolutions; do
8938b648e79Smrg  # Any one fine-grained sleep might happen to cross the boundary
8948b648e79Smrg  # between two values of a coarser actual resolution, but if we do
8958b648e79Smrg  # two fine-grained sleeps in a row, at least one of them will fall
8968b648e79Smrg  # entirely within a coarse interval.
8978b648e79Smrg  echo alpha > conftest.ts1
8988b648e79Smrg  sleep $am_try_res
8998b648e79Smrg  echo beta > conftest.ts2
9008b648e79Smrg  sleep $am_try_res
9018b648e79Smrg  echo gamma > conftest.ts3
9028b648e79Smrg
9038b648e79Smrg  # We assume that 'ls -t' will make use of high-resolution
9048b648e79Smrg  # timestamps if the operating system supports them at all.
9058b648e79Smrg  if (set X `ls -t conftest.ts?` &&
9068b648e79Smrg      test "$[]2" = conftest.ts3 &&
9078b648e79Smrg      test "$[]3" = conftest.ts2 &&
9088b648e79Smrg      test "$[]4" = conftest.ts1); then
9098b648e79Smrg    #
9108b648e79Smrg    # Ok, ls -t worked. If we're at a resolution of 1 second, we're done,
9118b648e79Smrg    # because we don't need to test make.
9128b648e79Smrg    make_ok=true
9138b648e79Smrg    if test $am_try_res != 1; then
9148b648e79Smrg      # But if we've succeeded so far with a subsecond resolution, we
9158b648e79Smrg      # have one more thing to check: make. It can happen that
9168b648e79Smrg      # everything else supports the subsecond mtimes, but make doesn't;
9178b648e79Smrg      # notably on macOS, which ships make 3.81 from 2006 (the last one
9188b648e79Smrg      # released under GPLv2). https://bugs.gnu.org/68808
9198b648e79Smrg      # 
9208b648e79Smrg      # We test $MAKE if it is defined in the environment, else "make".
9218b648e79Smrg      # It might get overridden later, but our hope is that in practice
9228b648e79Smrg      # it does not matter: it is the system "make" which is (by far)
9238b648e79Smrg      # the most likely to be broken, whereas if the user overrides it,
9248b648e79Smrg      # probably they did so with a better, or at least not worse, make.
9258b648e79Smrg      # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html
9268b648e79Smrg      #
9278b648e79Smrg      # Create a Makefile (real tab character here):
9288b648e79Smrg      rm -f conftest.mk
9298b648e79Smrg      echo 'conftest.ts1: conftest.ts2' >conftest.mk
9308b648e79Smrg      echo '	touch conftest.ts2' >>conftest.mk
9318b648e79Smrg      #
9328b648e79Smrg      # Now, running
9338b648e79Smrg      #   touch conftest.ts1; touch conftest.ts2; make
9348b648e79Smrg      # should touch ts1 because ts2 is newer. This could happen by luck,
9358b648e79Smrg      # but most often, it will fail if make's support is insufficient. So
9368b648e79Smrg      # test for several consecutive successes.
9378b648e79Smrg      #
9388b648e79Smrg      # (We reuse conftest.ts[12] because we still want to modify existing
9398b648e79Smrg      # files, not create new ones, per above.)
9408b648e79Smrg      n=0
9418b648e79Smrg      make=${MAKE-make}
9428b648e79Smrg      until test $n -eq 3; do
9438b648e79Smrg        echo one > conftest.ts1
9448b648e79Smrg        sleep $am_try_res
9458b648e79Smrg        echo two > conftest.ts2 # ts2 should now be newer than ts1
9468b648e79Smrg        if $make -f conftest.mk | grep 'up to date' >/dev/null; then
9478b648e79Smrg          make_ok=false
9488b648e79Smrg          break # out of $n loop
9498b648e79Smrg        fi
9508b648e79Smrg        n=`expr $n + 1`
9518b648e79Smrg      done
9528b648e79Smrg    fi
9538b648e79Smrg    #
9548b648e79Smrg    if $make_ok; then
9558b648e79Smrg      # Everything we know to check worked out, so call this resolution good.
9568b648e79Smrg      am_cv_filesystem_timestamp_resolution=$am_try_res
9578b648e79Smrg      break # out of $am_try_res loop
9588b648e79Smrg    fi
9598b648e79Smrg    # Otherwise, we'll go on to check the next resolution.
9608b648e79Smrg  fi
9618b648e79Smrgdone
9628b648e79Smrgrm -f conftest.ts?
9638b648e79Smrg# (end _am_filesystem_timestamp_resolution)
9648b648e79Smrg])])
9658b648e79Smrg
966e6bced22Smrg# AM_SANITY_CHECK
967e6bced22Smrg# ---------------
968e6bced22SmrgAC_DEFUN([AM_SANITY_CHECK],
9698b648e79Smrg[AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION])
9708b648e79Smrg# This check should not be cached, as it may vary across builds of
9718b648e79Smrg# different projects.
9728b648e79SmrgAC_MSG_CHECKING([whether build environment is sane])
973e6bced22Smrg# Reject unsafe characters in $srcdir or the absolute working directory
974e6bced22Smrg# name.  Accept space and tab only in the latter.
975e6bced22Smrgam_lf='
976e6bced22Smrg'
977e6bced22Smrgcase `pwd` in
978e6bced22Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
979e6bced22Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
980e6bced22Smrgesac
981e6bced22Smrgcase $srcdir in
982e6bced22Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
983e6bced22Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
984e6bced22Smrgesac
9850e20ee16Smrg
986e6bced22Smrg# Do 'set' in a subshell so we don't clobber the current shell's
987e6bced22Smrg# arguments.  Must try -L first in case configure is actually a
988e6bced22Smrg# symlink; some systems play weird games with the mod time of symlinks
989e6bced22Smrg# (eg FreeBSD returns the mod time of the symlink's containing
990e6bced22Smrg# directory).
9918b648e79Smrgam_build_env_is_sane=no
9928b648e79Smrgam_has_slept=no
9938b648e79Smrgrm -f conftest.file
9948b648e79Smrgfor am_try in 1 2; do
9958b648e79Smrg  echo "timestamp, slept: $am_has_slept" > conftest.file
9968b648e79Smrg  if (
9978b648e79Smrg    set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
9988b648e79Smrg    if test "$[]*" = "X"; then
9998b648e79Smrg      # -L didn't work.
10008b648e79Smrg      set X `ls -t "$srcdir/configure" conftest.file`
10018b648e79Smrg    fi
10028b648e79Smrg    test "$[]2" = conftest.file
10038b648e79Smrg  ); then
10048b648e79Smrg    am_build_env_is_sane=yes
10058b648e79Smrg    break
10068b648e79Smrg  fi
10078b648e79Smrg  # Just in case.
10088b648e79Smrg  sleep "$am_cv_filesystem_timestamp_resolution"
10098b648e79Smrg  am_has_slept=yes
10108b648e79Smrgdone
10118b648e79Smrg
10128b648e79SmrgAC_MSG_RESULT([$am_build_env_is_sane])
10138b648e79Smrgif test "$am_build_env_is_sane" = no; then
10148b648e79Smrg  AC_MSG_ERROR([newly created file is older than distributed files!
1015e6bced22SmrgCheck your system clock])
1016fc34a306Smrgfi
10178b648e79Smrg
1018e6bced22Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
1019e6bced22Smrg# generated files are strictly newer.
1020e6bced22Smrgam_sleep_pid=
10218b648e79SmrgAS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl
10228b648e79Smrg  ( sleep "$am_cv_filesystem_timestamp_resolution" ) &
1023e6bced22Smrg  am_sleep_pid=$!
10248b648e79Smrg])
1025e6bced22SmrgAC_CONFIG_COMMANDS_PRE(
1026e6bced22Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
1027e6bced22Smrg   if test -n "$am_sleep_pid"; then
1028e6bced22Smrg     # Hide warnings about reused PIDs.
1029e6bced22Smrg     wait $am_sleep_pid 2>/dev/null
1030e6bced22Smrg   fi
1031e6bced22Smrg   AC_MSG_RESULT([done])])
1032e6bced22Smrgrm -f conftest.file
1033e6bced22Smrg])
10342f167a42Smrg
10358b648e79Smrg# Copyright (C) 2009-2024 Free Software Foundation, Inc.
10363e6697d4Smrg#
1037e6bced22Smrg# This file is free software; the Free Software Foundation
1038e6bced22Smrg# gives unlimited permission to copy and/or distribute it,
1039e6bced22Smrg# with or without modifications, as long as this notice is preserved.
10400e20ee16Smrg
10418b648e79Smrg# _AM_SILENT_RULES
10428b648e79Smrg# ----------------
10438b648e79Smrg# Enable less verbose build rules support.
10448b648e79SmrgAC_DEFUN([_AM_SILENT_RULES],
10458b648e79Smrg[AM_DEFAULT_VERBOSITY=1
10468b648e79SmrgAC_ARG_ENABLE([silent-rules], [dnl
1047e6bced22SmrgAS_HELP_STRING(
1048e6bced22Smrg  [--enable-silent-rules],
1049e6bced22Smrg  [less verbose build output (undo: "make V=1")])
1050e6bced22SmrgAS_HELP_STRING(
1051e6bced22Smrg  [--disable-silent-rules],
1052e6bced22Smrg  [verbose build output (undo: "make V=0")])dnl
1053e6bced22Smrg])
1054e6bced22Smrgdnl
1055e6bced22Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
1056e6bced22Smrgdnl do not support nested variable expansions.
1057e6bced22Smrgdnl See automake bug#9928 and bug#10237.
1058e6bced22Smrgam_make=${MAKE-make}
1059e6bced22SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
1060e6bced22Smrg   [am_cv_make_support_nested_variables],
1061e6bced22Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
1062e6bced22SmrgBAR0=false
1063e6bced22SmrgBAR1=true
1064e6bced22SmrgV=1
1065e6bced22Smrgam__doit:
1066e6bced22Smrg	@$(TRUE)
1067e6bced22Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
1068e6bced22Smrg  am_cv_make_support_nested_variables=yes
1069fc34a306Smrgelse
1070e6bced22Smrg  am_cv_make_support_nested_variables=no
1071e6bced22Smrgfi])
1072e6bced22SmrgAC_SUBST([AM_V])dnl
1073e6bced22SmrgAM_SUBST_NOTMAKE([AM_V])dnl
1074e6bced22SmrgAC_SUBST([AM_DEFAULT_V])dnl
1075e6bced22SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
1076e6bced22SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
1077e6bced22SmrgAM_BACKSLASH='\'
1078e6bced22SmrgAC_SUBST([AM_BACKSLASH])dnl
1079e6bced22Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
10808b648e79Smrgdnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls
10818b648e79Smrgdnl to AM_SILENT_RULES to change the default value.
10828b648e79SmrgAC_CONFIG_COMMANDS_PRE([dnl
10838b648e79Smrgcase $enable_silent_rules in @%:@ (((
10848b648e79Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
10858b648e79Smrg   no) AM_DEFAULT_VERBOSITY=1;;
10868b648e79Smrgesac
10878b648e79Smrgif test $am_cv_make_support_nested_variables = yes; then
10888b648e79Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
10898b648e79Smrg  AM_V='$(V)'
10908b648e79Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
10918b648e79Smrgelse
10928b648e79Smrg  AM_V=$AM_DEFAULT_VERBOSITY
10938b648e79Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
10948b648e79Smrgfi
10958b648e79Smrg])dnl
1096e6bced22Smrg])
10972f167a42Smrg
10988b648e79Smrg# AM_SILENT_RULES([DEFAULT])
10998b648e79Smrg# --------------------------
11008b648e79Smrg# Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or
11018b648e79Smrg# empty being verbose).
11028b648e79SmrgAC_DEFUN([AM_SILENT_RULES],
11038b648e79Smrg[AC_REQUIRE([_AM_SILENT_RULES])
11048b648e79SmrgAM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])])
11058b648e79Smrg
11068b648e79Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
11072f167a42Smrg#
1108e6bced22Smrg# This file is free software; the Free Software Foundation
1109e6bced22Smrg# gives unlimited permission to copy and/or distribute it,
1110e6bced22Smrg# with or without modifications, as long as this notice is preserved.
11112f167a42Smrg
1112e6bced22Smrg# AM_PROG_INSTALL_STRIP
1113e6bced22Smrg# ---------------------
1114e6bced22Smrg# One issue with vendor 'install' (even GNU) is that you can't
1115e6bced22Smrg# specify the program used to strip binaries.  This is especially
1116e6bced22Smrg# annoying in cross-compiling environments, where the build's strip
1117e6bced22Smrg# is unlikely to handle the host's binaries.
1118e6bced22Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
1119e6bced22Smrg# always use install-sh in "make install-strip", and initialize
1120e6bced22Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
1121e6bced22SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
1122e6bced22Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
1123e6bced22Smrg# Installed binaries are usually stripped using 'strip' when the user
1124e6bced22Smrg# run "make install-strip".  However 'strip' might not be the right
1125e6bced22Smrg# tool to use in cross-compilation environments, therefore Automake
1126e6bced22Smrg# will honor the 'STRIP' environment variable to overrule this program.
1127e6bced22Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
1128e6bced22Smrgif test "$cross_compiling" != no; then
1129e6bced22Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
1130fc34a306Smrgfi
1131e6bced22SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
1132e6bced22SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
11332f167a42Smrg
11348b648e79Smrg# Copyright (C) 2006-2024 Free Software Foundation, Inc.
1135e6bced22Smrg#
1136e6bced22Smrg# This file is free software; the Free Software Foundation
1137e6bced22Smrg# gives unlimited permission to copy and/or distribute it,
1138e6bced22Smrg# with or without modifications, as long as this notice is preserved.
11392f167a42Smrg
1140e6bced22Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
1141fc34a306Smrg# ---------------------------
1142e6bced22Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1143e6bced22Smrg# This macro is traced by Automake.
1144e6bced22SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
11452f167a42Smrg
1146e6bced22Smrg# AM_SUBST_NOTMAKE(VARIABLE)
1147e6bced22Smrg# --------------------------
1148e6bced22Smrg# Public sister of _AM_SUBST_NOTMAKE.
1149e6bced22SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
11502f167a42Smrg
1151e6bced22Smrg# Check how to create a tarball.                            -*- Autoconf -*-
1152e6bced22Smrg
11538b648e79Smrg# Copyright (C) 2004-2024 Free Software Foundation, Inc.
1154fc34a306Smrg#
1155e6bced22Smrg# This file is free software; the Free Software Foundation
1156e6bced22Smrg# gives unlimited permission to copy and/or distribute it,
1157e6bced22Smrg# with or without modifications, as long as this notice is preserved.
1158e6bced22Smrg
1159e6bced22Smrg# _AM_PROG_TAR(FORMAT)
1160e6bced22Smrg# --------------------
1161e6bced22Smrg# Check how to create a tarball in format FORMAT.
1162e6bced22Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1163fc34a306Smrg#
1164e6bced22Smrg# Substitute a variable $(am__tar) that is a command
1165e6bced22Smrg# writing to stdout a FORMAT-tarball containing the directory
1166e6bced22Smrg# $tardir.
1167e6bced22Smrg#     tardir=directory && $(am__tar) > result.tar
1168fc34a306Smrg#
1169e6bced22Smrg# Substitute a variable $(am__untar) that extract such
1170e6bced22Smrg# a tarball read from stdin.
1171e6bced22Smrg#     $(am__untar) < result.tar
1172fc34a306Smrg#
1173e6bced22SmrgAC_DEFUN([_AM_PROG_TAR],
1174e6bced22Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1175e6bced22Smrg# in the wild :-(  We should find a proper way to deprecate it ...
1176e6bced22SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
11772f167a42Smrg
1178e6bced22Smrg# We'll loop over all known methods to create a tar archive until one works.
1179e6bced22Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
11802f167a42Smrg
1181e6bced22Smrgm4_if([$1], [v7],
1182e6bced22Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
11832f167a42Smrg
1184e6bced22Smrg  [m4_case([$1],
1185e6bced22Smrg    [ustar],
1186e6bced22Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1187e6bced22Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1188e6bced22Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1189e6bced22Smrg      # and bug#13588).
1190e6bced22Smrg      am_max_uid=2097151 # 2^21 - 1
1191e6bced22Smrg      am_max_gid=$am_max_uid
1192e6bced22Smrg      # The $UID and $GID variables are not portable, so we need to resort
1193e6bced22Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1194e6bced22Smrg      # below are definitely unexpected, so allow the users to see them
1195e6bced22Smrg      # (that is, avoid stderr redirection).
1196e6bced22Smrg      am_uid=`id -u || echo unknown`
1197e6bced22Smrg      am_gid=`id -g || echo unknown`
1198e6bced22Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
11998b648e79Smrg      if test x$am_uid = xunknown; then
12008b648e79Smrg        AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work])
12018b648e79Smrg      elif test $am_uid -le $am_max_uid; then
12028b648e79Smrg        AC_MSG_RESULT([yes])
1203e6bced22Smrg      else
12048b648e79Smrg        AC_MSG_RESULT([no])
12058b648e79Smrg        _am_tools=none
1206e6bced22Smrg      fi
1207e6bced22Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
12088b648e79Smrg      if test x$gm_gid = xunknown; then
12098b648e79Smrg        AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work])
12108b648e79Smrg      elif test $am_gid -le $am_max_gid; then
12118b648e79Smrg        AC_MSG_RESULT([yes])
1212e6bced22Smrg      else
1213e6bced22Smrg        AC_MSG_RESULT([no])
1214e6bced22Smrg        _am_tools=none
1215e6bced22Smrg      fi],
1216e6bced22Smrg
1217e6bced22Smrg  [pax],
1218e6bced22Smrg    [],
1219e6bced22Smrg
1220e6bced22Smrg  [m4_fatal([Unknown tar format])])
1221e6bced22Smrg
1222e6bced22Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1223e6bced22Smrg
1224e6bced22Smrg  # Go ahead even if we have the value already cached.  We do so because we
1225e6bced22Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1226e6bced22Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1227e6bced22Smrg
1228e6bced22Smrg  for _am_tool in $_am_tools; do
1229e6bced22Smrg    case $_am_tool in
1230e6bced22Smrg    gnutar)
1231e6bced22Smrg      for _am_tar in tar gnutar gtar; do
1232e6bced22Smrg        AM_RUN_LOG([$_am_tar --version]) && break
1233e6bced22Smrg      done
1234e6bced22Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1235e6bced22Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1236e6bced22Smrg      am__untar="$_am_tar -xf -"
1237e6bced22Smrg      ;;
1238e6bced22Smrg    plaintar)
1239e6bced22Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1240e6bced22Smrg      # ustar tarball either.
1241e6bced22Smrg      (tar --version) >/dev/null 2>&1 && continue
1242e6bced22Smrg      am__tar='tar chf - "$$tardir"'
1243e6bced22Smrg      am__tar_='tar chf - "$tardir"'
1244e6bced22Smrg      am__untar='tar xf -'
1245e6bced22Smrg      ;;
1246e6bced22Smrg    pax)
1247e6bced22Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
1248e6bced22Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
1249e6bced22Smrg      am__untar='pax -r'
1250e6bced22Smrg      ;;
1251e6bced22Smrg    cpio)
1252e6bced22Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1253e6bced22Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1254e6bced22Smrg      am__untar='cpio -i -H $1 -d'
1255e6bced22Smrg      ;;
1256e6bced22Smrg    none)
1257e6bced22Smrg      am__tar=false
1258e6bced22Smrg      am__tar_=false
1259e6bced22Smrg      am__untar=false
1260e6bced22Smrg      ;;
1261e6bced22Smrg    esac
1262e6bced22Smrg
1263e6bced22Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
1264e6bced22Smrg    # and am__untar set.
1265e6bced22Smrg    test -n "${am_cv_prog_tar_$1}" && break
1266e6bced22Smrg
1267e6bced22Smrg    # tar/untar a dummy directory, and stop if the command works.
1268e6bced22Smrg    rm -rf conftest.dir
1269e6bced22Smrg    mkdir conftest.dir
1270e6bced22Smrg    echo GrepMe > conftest.dir/file
1271e6bced22Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1272e6bced22Smrg    rm -rf conftest.dir
1273e6bced22Smrg    if test -s conftest.tar; then
1274e6bced22Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
1275e6bced22Smrg      AM_RUN_LOG([cat conftest.dir/file])
1276e6bced22Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1277e6bced22Smrg    fi
1278e6bced22Smrg  done
1279e6bced22Smrg  rm -rf conftest.dir
1280e6bced22Smrg
1281e6bced22Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1282e6bced22Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1283e6bced22Smrg
1284e6bced22SmrgAC_SUBST([am__tar])
1285e6bced22SmrgAC_SUBST([am__untar])
1286e6bced22Smrg]) # _AM_PROG_TAR
1287e6bced22Smrg
12888b648e79Smrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
12898b648e79Smrg#
12908b648e79Smrg# This file is free software; the Free Software Foundation
12918b648e79Smrg# gives unlimited permission to copy and/or distribute it,
12928b648e79Smrg# with or without modifications, as long as this notice is preserved.
12938b648e79Smrg
12948b648e79Smrg# _AM_PROG_XARGS_N
12958b648e79Smrg# ----------------
12968b648e79Smrg# Check whether 'xargs -n' works.  It should work everywhere, so the fallback
12978b648e79Smrg# is not optimized at all as we never expect to use it.
12988b648e79SmrgAC_DEFUN([_AM_PROG_XARGS_N],
12998b648e79Smrg[AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl
13008b648e79SmrgAS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2
13018b648e79Smrg3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])])
13028b648e79SmrgAS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl
13038b648e79Smrg  am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }'
13048b648e79Smrg])dnl
13058b648e79SmrgAC_SUBST(am__xargs_n)
13068b648e79Smrg])
13078b648e79Smrg
1308e6bced22Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1309e6bced22Smrgdnl serial 11 (pkg-config-0.29)
1310e6bced22Smrgdnl
1311e6bced22Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1312e6bced22Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1313e6bced22Smrgdnl
1314e6bced22Smrgdnl This program is free software; you can redistribute it and/or modify
1315e6bced22Smrgdnl it under the terms of the GNU General Public License as published by
1316e6bced22Smrgdnl the Free Software Foundation; either version 2 of the License, or
1317e6bced22Smrgdnl (at your option) any later version.
1318e6bced22Smrgdnl
1319e6bced22Smrgdnl This program is distributed in the hope that it will be useful, but
1320e6bced22Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1321e6bced22Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1322e6bced22Smrgdnl General Public License for more details.
1323e6bced22Smrgdnl
1324e6bced22Smrgdnl You should have received a copy of the GNU General Public License
1325e6bced22Smrgdnl along with this program; if not, write to the Free Software
1326e6bced22Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1327e6bced22Smrgdnl 02111-1307, USA.
1328e6bced22Smrgdnl
1329e6bced22Smrgdnl As a special exception to the GNU General Public License, if you
1330e6bced22Smrgdnl distribute this file as part of a program that contains a
1331e6bced22Smrgdnl configuration script generated by Autoconf, you may include it under
1332e6bced22Smrgdnl the same distribution terms that you use for the rest of that
1333e6bced22Smrgdnl program.
1334e6bced22Smrg
1335e6bced22Smrgdnl PKG_PREREQ(MIN-VERSION)
1336e6bced22Smrgdnl -----------------------
1337e6bced22Smrgdnl Since: 0.29
1338e6bced22Smrgdnl
1339e6bced22Smrgdnl Verify that the version of the pkg-config macros are at least
1340e6bced22Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1341e6bced22Smrgdnl installed version of pkg-config, this checks the developer's version
1342e6bced22Smrgdnl of pkg.m4 when generating configure.
1343e6bced22Smrgdnl
1344e6bced22Smrgdnl To ensure that this macro is defined, also add:
1345e6bced22Smrgdnl m4_ifndef([PKG_PREREQ],
1346e6bced22Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1347e6bced22Smrgdnl
1348e6bced22Smrgdnl See the "Since" comment for each macro you use to see what version
1349e6bced22Smrgdnl of the macros you require.
1350e6bced22Smrgm4_defun([PKG_PREREQ],
1351e6bced22Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
1352e6bced22Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1353e6bced22Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1354e6bced22Smrg])dnl PKG_PREREQ
1355e6bced22Smrg
1356e6bced22Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1357e6bced22Smrgdnl ----------------------------------
1358e6bced22Smrgdnl Since: 0.16
1359e6bced22Smrgdnl
1360e6bced22Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1361e6bced22Smrgdnl first found in the path. Checks that the version of pkg-config found
1362e6bced22Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1363e6bced22Smrgdnl used since that's the first version where most current features of
1364e6bced22Smrgdnl pkg-config existed.
1365e6bced22SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1366e6bced22Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1367e6bced22Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1368e6bced22Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1369e6bced22SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1370e6bced22SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1371e6bced22SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1372e6bced22Smrg
1373e6bced22Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1374e6bced22Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1375e6bced22Smrgfi
1376e6bced22Smrgif test -n "$PKG_CONFIG"; then
1377e6bced22Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
1378e6bced22Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1379e6bced22Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1380e6bced22Smrg		AC_MSG_RESULT([yes])
1381e6bced22Smrg	else
1382e6bced22Smrg		AC_MSG_RESULT([no])
1383e6bced22Smrg		PKG_CONFIG=""
1384e6bced22Smrg	fi
1385e6bced22Smrgfi[]dnl
1386e6bced22Smrg])dnl PKG_PROG_PKG_CONFIG
1387e6bced22Smrg
1388e6bced22Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1389e6bced22Smrgdnl -------------------------------------------------------------------
1390e6bced22Smrgdnl Since: 0.18
1391e6bced22Smrgdnl
1392e6bced22Smrgdnl Check to see whether a particular set of modules exists. Similar to
1393e6bced22Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1394e6bced22Smrgdnl
1395e6bced22Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1396e6bced22Smrgdnl only at the first occurence in configure.ac, so if the first place
1397e6bced22Smrgdnl it's called might be skipped (such as if it is within an "if", you
1398e6bced22Smrgdnl have to call PKG_CHECK_EXISTS manually
1399e6bced22SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1400e6bced22Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1401e6bced22Smrgif test -n "$PKG_CONFIG" && \
1402e6bced22Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1403e6bced22Smrg  m4_default([$2], [:])
1404e6bced22Smrgm4_ifvaln([$3], [else
1405e6bced22Smrg  $3])dnl
1406e6bced22Smrgfi])
1407e6bced22Smrg
1408e6bced22Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1409e6bced22Smrgdnl ---------------------------------------------
1410e6bced22Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1411e6bced22Smrgdnl pkg_failed based on the result.
1412e6bced22Smrgm4_define([_PKG_CONFIG],
1413e6bced22Smrg[if test -n "$$1"; then
1414e6bced22Smrg    pkg_cv_[]$1="$$1"
1415e6bced22Smrg elif test -n "$PKG_CONFIG"; then
1416e6bced22Smrg    PKG_CHECK_EXISTS([$3],
1417e6bced22Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1418e6bced22Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
1419e6bced22Smrg		     [pkg_failed=yes])
1420e6bced22Smrg else
1421e6bced22Smrg    pkg_failed=untried
1422e6bced22Smrgfi[]dnl
1423e6bced22Smrg])dnl _PKG_CONFIG
1424e6bced22Smrg
1425e6bced22Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1426e6bced22Smrgdnl ---------------------------
1427e6bced22Smrgdnl Internal check to see if pkg-config supports short errors.
1428e6bced22SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1429e6bced22Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1430e6bced22Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1431e6bced22Smrg        _pkg_short_errors_supported=yes
1432e6bced22Smrgelse
1433e6bced22Smrg        _pkg_short_errors_supported=no
1434e6bced22Smrgfi[]dnl
1435e6bced22Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1436e6bced22Smrg
1437e6bced22Smrg
1438e6bced22Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1439e6bced22Smrgdnl   [ACTION-IF-NOT-FOUND])
1440e6bced22Smrgdnl --------------------------------------------------------------
1441e6bced22Smrgdnl Since: 0.4.0
1442e6bced22Smrgdnl
1443e6bced22Smrgdnl Note that if there is a possibility the first call to
1444e6bced22Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1445e6bced22Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1446e6bced22SmrgAC_DEFUN([PKG_CHECK_MODULES],
1447e6bced22Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1448e6bced22SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1449e6bced22SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1450e6bced22Smrg
1451e6bced22Smrgpkg_failed=no
1452e6bced22SmrgAC_MSG_CHECKING([for $1])
1453e6bced22Smrg
1454e6bced22Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1455e6bced22Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1456e6bced22Smrg
1457e6bced22Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1458e6bced22Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1459e6bced22SmrgSee the pkg-config man page for more details.])
1460e6bced22Smrg
1461e6bced22Smrgif test $pkg_failed = yes; then
1462e6bced22Smrg   	AC_MSG_RESULT([no])
1463e6bced22Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1464e6bced22Smrg        if test $_pkg_short_errors_supported = yes; then
1465e6bced22Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1466e6bced22Smrg        else 
1467e6bced22Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1468e6bced22Smrg        fi
1469e6bced22Smrg	# Put the nasty error message in config.log where it belongs
1470e6bced22Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
14710e20ee16Smrg
1472e6bced22Smrg	m4_default([$4], [AC_MSG_ERROR(
1473e6bced22Smrg[Package requirements ($2) were not met:
14740e20ee16Smrg
1475e6bced22Smrg$$1_PKG_ERRORS
14760e20ee16Smrg
1477e6bced22SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1478e6bced22Smrginstalled software in a non-standard prefix.
14790e20ee16Smrg
1480e6bced22Smrg_PKG_TEXT])[]dnl
1481e6bced22Smrg        ])
1482e6bced22Smrgelif test $pkg_failed = untried; then
1483e6bced22Smrg     	AC_MSG_RESULT([no])
1484e6bced22Smrg	m4_default([$4], [AC_MSG_FAILURE(
1485e6bced22Smrg[The pkg-config script could not be found or is too old.  Make sure it
1486e6bced22Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1487e6bced22Smrgpath to pkg-config.
14880e20ee16Smrg
1489e6bced22Smrg_PKG_TEXT
14900e20ee16Smrg
1491e6bced22SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1492e6bced22Smrg        ])
1493e6bced22Smrgelse
1494e6bced22Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1495e6bced22Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1496e6bced22Smrg        AC_MSG_RESULT([yes])
1497e6bced22Smrg	$3
1498e6bced22Smrgfi[]dnl
1499e6bced22Smrg])dnl PKG_CHECK_MODULES
15000e20ee16Smrg
15010e20ee16Smrg
1502e6bced22Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1503e6bced22Smrgdnl   [ACTION-IF-NOT-FOUND])
1504e6bced22Smrgdnl ---------------------------------------------------------------------
1505e6bced22Smrgdnl Since: 0.29
1506e6bced22Smrgdnl
1507e6bced22Smrgdnl Checks for existence of MODULES and gathers its build flags with
1508e6bced22Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1509e6bced22Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1510e6bced22Smrgdnl
1511e6bced22Smrgdnl Note that if there is a possibility the first call to
1512e6bced22Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1513e6bced22Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1514e6bced22Smrgdnl configure.ac.
1515e6bced22SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1516e6bced22Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1517e6bced22Smrg_save_PKG_CONFIG=$PKG_CONFIG
1518e6bced22SmrgPKG_CONFIG="$PKG_CONFIG --static"
1519e6bced22SmrgPKG_CHECK_MODULES($@)
1520e6bced22SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1521e6bced22Smrg])dnl PKG_CHECK_MODULES_STATIC
1522e6bced22Smrg
1523e6bced22Smrg
1524e6bced22Smrgdnl PKG_INSTALLDIR([DIRECTORY])
1525e6bced22Smrgdnl -------------------------
1526e6bced22Smrgdnl Since: 0.27
1527e6bced22Smrgdnl
1528e6bced22Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
1529e6bced22Smrgdnl should install pkg-config .pc files. By default the directory is
1530e6bced22Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
1531e6bced22Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1532e6bced22Smrgdnl parameter.
1533e6bced22SmrgAC_DEFUN([PKG_INSTALLDIR],
1534e6bced22Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1535e6bced22Smrgm4_pushdef([pkg_description],
1536e6bced22Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1537e6bced22SmrgAC_ARG_WITH([pkgconfigdir],
1538e6bced22Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1539e6bced22Smrg    [with_pkgconfigdir=]pkg_default)
1540e6bced22SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1541e6bced22Smrgm4_popdef([pkg_default])
1542e6bced22Smrgm4_popdef([pkg_description])
1543e6bced22Smrg])dnl PKG_INSTALLDIR
1544e6bced22Smrg
1545e6bced22Smrg
1546e6bced22Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1547e6bced22Smrgdnl --------------------------------
1548e6bced22Smrgdnl Since: 0.27
1549e6bced22Smrgdnl
1550e6bced22Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1551e6bced22Smrgdnl module should install arch-independent pkg-config .pc files. By
1552e6bced22Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
1553e6bced22Smrgdnl changed by passing DIRECTORY. The user can override through the
1554e6bced22Smrgdnl --with-noarch-pkgconfigdir parameter.
1555e6bced22SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1556e6bced22Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1557e6bced22Smrgm4_pushdef([pkg_description],
1558e6bced22Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1559e6bced22SmrgAC_ARG_WITH([noarch-pkgconfigdir],
1560e6bced22Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1561e6bced22Smrg    [with_noarch_pkgconfigdir=]pkg_default)
1562e6bced22SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1563e6bced22Smrgm4_popdef([pkg_default])
1564e6bced22Smrgm4_popdef([pkg_description])
1565e6bced22Smrg])dnl PKG_NOARCH_INSTALLDIR
1566e6bced22Smrg
1567e6bced22Smrg
1568e6bced22Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1569e6bced22Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1570e6bced22Smrgdnl -------------------------------------------
1571e6bced22Smrgdnl Since: 0.28
1572e6bced22Smrgdnl
1573e6bced22Smrgdnl Retrieves the value of the pkg-config variable for the given module.
1574e6bced22SmrgAC_DEFUN([PKG_CHECK_VAR],
1575e6bced22Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1576e6bced22SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1577c75e344aSmrg
1578e6bced22Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1579e6bced22SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
15800e20ee16Smrg
1581e6bced22SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1582e6bced22Smrg])dnl PKG_CHECK_VAR
15830e20ee16Smrg
1584e6bced22Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1585e6bced22Smrgdnl
15868b648e79Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
1587e6bced22Smrgdnl
1588e6bced22Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1589e6bced22Smrgdnl copy of this software and associated documentation files (the "Software"),
1590e6bced22Smrgdnl to deal in the Software without restriction, including without limitation
1591e6bced22Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1592e6bced22Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1593e6bced22Smrgdnl Software is furnished to do so, subject to the following conditions:
1594e6bced22Smrgdnl
1595e6bced22Smrgdnl The above copyright notice and this permission notice (including the next
1596e6bced22Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1597e6bced22Smrgdnl Software.
1598e6bced22Smrgdnl
1599e6bced22Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1600e6bced22Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1601e6bced22Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1602e6bced22Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1603e6bced22Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1604e6bced22Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1605e6bced22Smrgdnl DEALINGS IN THE SOFTWARE.
16060e20ee16Smrg
1607e6bced22Smrg# XORG_MACROS_VERSION(required-version)
1608e6bced22Smrg# -------------------------------------
1609e6bced22Smrg# Minimum version: 1.1.0
1610fc34a306Smrg#
1611e6bced22Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1612e6bced22Smrg# your configure.ac with the minimum required version, such as:
1613e6bced22Smrg# XORG_MACROS_VERSION(1.1)
1614fc34a306Smrg#
1615e6bced22Smrg# To ensure that this macro is defined, also add:
1616e6bced22Smrg# m4_ifndef([XORG_MACROS_VERSION],
1617e6bced22Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1618fc34a306Smrg#
1619fc34a306Smrg#
1620e6bced22Smrg# See the "minimum version" comment for each macro you use to see what
1621e6bced22Smrg# version you require.
1622e6bced22Smrgm4_defun([XORG_MACROS_VERSION],[
16238b648e79Smrgm4_define([vers_have], [1.20.1])
1624e6bced22Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1625e6bced22Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1626e6bced22Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1627e6bced22Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1628e6bced22Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1629e6bced22Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1630e6bced22Smrgm4_undefine([vers_have])
1631e6bced22Smrgm4_undefine([maj_have])
1632e6bced22Smrgm4_undefine([maj_needed])
1633e6bced22Smrg]) # XORG_MACROS_VERSION
16340e20ee16Smrg
1635e6bced22Smrg# XORG_PROG_RAWCPP()
1636e6bced22Smrg# ------------------
16373e6697d4Smrg# Minimum version: 1.0.0
16383e6697d4Smrg#
1639e6bced22Smrg# Find cpp program and necessary flags for use in pre-processing text files
1640e6bced22Smrg# such as man pages and config files
1641e6bced22SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1642e6bced22SmrgAC_REQUIRE([AC_PROG_CPP])
1643e6bced22SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1644e6bced22Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
16453e6697d4Smrg
1646e6bced22Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1647e6bced22Smrg# which is not the best choice for supporting other OS'es, but covers most
1648e6bced22Smrg# of the ones we need for now.
1649e6bced22SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1650e6bced22SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1651e6bced22Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1652e6bced22Smrg	AC_MSG_RESULT([no])
1653e6bced22Smrgelse
1654e6bced22Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1655e6bced22Smrg		RAWCPPFLAGS=-undef
1656e6bced22Smrg		AC_MSG_RESULT([yes])
1657e6bced22Smrg	# under Cygwin unix is still defined even with -undef
1658e6bced22Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1659e6bced22Smrg		RAWCPPFLAGS="-undef -ansi"
1660e6bced22Smrg		AC_MSG_RESULT([yes, with -ansi])
1661e6bced22Smrg	else
1662e6bced22Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1663e6bced22Smrg	fi
16643e6697d4Smrgfi
1665e6bced22Smrgrm -f conftest.$ac_ext
16663e6697d4Smrg
1667e6bced22SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1668e6bced22SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
16698b648e79Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1670e6bced22Smrg	AC_MSG_RESULT([no])
1671fc34a306Smrgelse
16728b648e79Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1673e6bced22Smrg		TRADITIONALCPPFLAGS="-traditional"
1674e6bced22Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1675e6bced22Smrg		AC_MSG_RESULT([yes])
1676e6bced22Smrg	else
1677e6bced22Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1678e6bced22Smrg	fi
16793e6697d4Smrgfi
1680e6bced22Smrgrm -f conftest.$ac_ext
1681e6bced22SmrgAC_SUBST(RAWCPPFLAGS)
1682e6bced22SmrgAC_SUBST(TRADITIONALCPPFLAGS)
1683e6bced22Smrg]) # XORG_PROG_RAWCPP
16843e6697d4Smrg
1685e6bced22Smrg# XORG_MANPAGE_SECTIONS()
1686e6bced22Smrg# -----------------------
1687e6bced22Smrg# Minimum version: 1.0.0
1688c75e344aSmrg#
1689e6bced22Smrg# Determine which sections man pages go in for the different man page types
1690e6bced22Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1691e6bced22Smrg# Not sure if there's any better way than just hardcoding by OS name.
1692e6bced22Smrg# Override default settings by setting environment variables
1693e6bced22Smrg# Added MAN_SUBSTS in version 1.8
1694e6bced22Smrg# Added AC_PROG_SED in version 1.8
1695c75e344aSmrg
1696e6bced22SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1697e6bced22SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1698e6bced22SmrgAC_REQUIRE([AC_PROG_SED])
1699fc34a306Smrg
1700fc34a306Smrgcase $host_os in
1701e6bced22Smrg    solaris*)
1702e6bced22Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1703e6bced22Smrg        # check for a man page file found in later versions that use
1704e6bced22Smrg        # traditional section numbers instead
1705e6bced22Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1706e6bced22Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1707e6bced22Smrg        ;;
1708e6bced22Smrg    *) SYSV_MAN_SECTIONS=false ;;
1709fc34a306Smrgesac
1710fc34a306Smrg
1711e6bced22Smrgif test x$APP_MAN_SUFFIX = x    ; then
1712e6bced22Smrg    APP_MAN_SUFFIX=1
1713c75e344aSmrgfi
1714e6bced22Smrgif test x$APP_MAN_DIR = x    ; then
1715e6bced22Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1716fc34a306Smrgfi
1717c75e344aSmrg
1718e6bced22Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1719e6bced22Smrg    LIB_MAN_SUFFIX=3
1720e6bced22Smrgfi
1721e6bced22Smrgif test x$LIB_MAN_DIR = x    ; then
1722e6bced22Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1723e6bced22Smrgfi
1724c75e344aSmrg
1725e6bced22Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1726e6bced22Smrg    case $SYSV_MAN_SECTIONS in
1727e6bced22Smrg	true)				FILE_MAN_SUFFIX=4  ;;
1728e6bced22Smrg	*)				FILE_MAN_SUFFIX=5  ;;
1729e6bced22Smrg    esac
1730e6bced22Smrgfi
1731e6bced22Smrgif test x$FILE_MAN_DIR = x    ; then
1732e6bced22Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1733e6bced22Smrgfi
1734fc34a306Smrg
1735e6bced22Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1736e6bced22Smrg    case $SYSV_MAN_SECTIONS in
1737e6bced22Smrg	true)				MISC_MAN_SUFFIX=5  ;;
1738e6bced22Smrg	*)				MISC_MAN_SUFFIX=7  ;;
1739e6bced22Smrg    esac
1740e6bced22Smrgfi
1741e6bced22Smrgif test x$MISC_MAN_DIR = x    ; then
1742e6bced22Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1743e6bced22Smrgfi
17442f167a42Smrg
1745e6bced22Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1746e6bced22Smrg    case $SYSV_MAN_SECTIONS in
1747e6bced22Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1748e6bced22Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1749e6bced22Smrg    esac
1750e6bced22Smrgfi
1751e6bced22Smrgif test x$DRIVER_MAN_DIR = x    ; then
1752e6bced22Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1753e6bced22Smrgfi
1754fc34a306Smrg
1755e6bced22Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1756e6bced22Smrg    case $SYSV_MAN_SECTIONS in
1757e6bced22Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1758e6bced22Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
1759e6bced22Smrg    esac
1760e6bced22Smrgfi
1761e6bced22Smrgif test x$ADMIN_MAN_DIR = x    ; then
1762e6bced22Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
17632f167a42Smrgfi
17642f167a42Smrg
17652f167a42Smrg
1766e6bced22SmrgAC_SUBST([APP_MAN_SUFFIX])
1767e6bced22SmrgAC_SUBST([LIB_MAN_SUFFIX])
1768e6bced22SmrgAC_SUBST([FILE_MAN_SUFFIX])
1769e6bced22SmrgAC_SUBST([MISC_MAN_SUFFIX])
1770e6bced22SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1771e6bced22SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1772e6bced22SmrgAC_SUBST([APP_MAN_DIR])
1773e6bced22SmrgAC_SUBST([LIB_MAN_DIR])
1774e6bced22SmrgAC_SUBST([FILE_MAN_DIR])
1775e6bced22SmrgAC_SUBST([MISC_MAN_DIR])
1776e6bced22SmrgAC_SUBST([DRIVER_MAN_DIR])
1777e6bced22SmrgAC_SUBST([ADMIN_MAN_DIR])
1778fc34a306Smrg
1779e6bced22SmrgXORG_MAN_PAGE="X Version 11"
1780e6bced22SmrgAC_SUBST([XORG_MAN_PAGE])
1781e6bced22SmrgMAN_SUBSTS="\
1782e6bced22Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1783e6bced22Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1784e6bced22Smrg	-e 's|__xservername__|Xorg|g' \
1785e6bced22Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1786e6bced22Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1787e6bced22Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1788e6bced22Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1789e6bced22Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1790e6bced22Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1791e6bced22Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1792e6bced22Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1793e6bced22Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1794e6bced22SmrgAC_SUBST([MAN_SUBSTS])
1795fc34a306Smrg
1796e6bced22Smrg]) # XORG_MANPAGE_SECTIONS
1797e6bced22Smrg
1798e6bced22Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1799e6bced22Smrg# ------------------------
1800e6bced22Smrg# Minimum version: 1.7.0
18012f167a42Smrg#
1802e6bced22Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1803e6bced22Smrg# provided by xorg-sgml-doctools, if installed.
1804e6bced22SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1805e6bced22SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1806e6bced22SmrgXORG_SGML_PATH=
1807e6bced22SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1808e6bced22Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1809e6bced22Smrg    [m4_ifval([$1],[:],
1810e6bced22Smrg        [if test x"$cross_compiling" != x"yes" ; then
1811e6bced22Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1812e6bced22Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1813e6bced22Smrg         fi])
1814e6bced22Smrg    ])
18152f167a42Smrg
1816e6bced22Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1817e6bced22Smrg# the path and the name of the doc stylesheet
1818e6bced22Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1819e6bced22Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1820e6bced22Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1821e6bced22Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1822e6bced22Smrgelse
1823e6bced22Smrg   AC_MSG_RESULT([no])
1824e6bced22Smrgfi
1825fc34a306Smrg
1826e6bced22SmrgAC_SUBST(XORG_SGML_PATH)
1827e6bced22SmrgAC_SUBST(STYLESHEET_SRCDIR)
1828e6bced22SmrgAC_SUBST(XSL_STYLESHEET)
1829e6bced22SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1830e6bced22Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1831fc34a306Smrg
1832e6bced22Smrg# XORG_CHECK_LINUXDOC
1833e6bced22Smrg# -------------------
1834e6bced22Smrg# Minimum version: 1.0.0
1835e6bced22Smrg#
1836e6bced22Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1837e6bced22Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1838e6bced22Smrg# Whether or not the necessary tools and files are found can be checked
1839e6bced22Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1840e6bced22SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1841e6bced22SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1842e6bced22SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1843fc34a306Smrg
1844e6bced22SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
18452f167a42Smrg
1846e6bced22SmrgAC_MSG_CHECKING([whether to build documentation])
1847e6bced22Smrg
1848e6bced22Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1849e6bced22Smrg   BUILDDOC=yes
1850e6bced22Smrgelse
1851e6bced22Smrg   BUILDDOC=no
1852fc34a306Smrgfi
18532f167a42Smrg
1854e6bced22SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1855fc34a306Smrg
1856e6bced22SmrgAC_MSG_RESULT([$BUILDDOC])
1857fc34a306Smrg
1858e6bced22SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1859fc34a306Smrg
1860e6bced22Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1861e6bced22Smrg   BUILDPDFDOC=yes
1862e6bced22Smrgelse
1863e6bced22Smrg   BUILDPDFDOC=no
1864e6bced22Smrgfi
1865fc34a306Smrg
1866e6bced22SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1867fc34a306Smrg
1868e6bced22SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1869fc34a306Smrg
1870e6bced22SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1871e6bced22SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1872e6bced22SmrgMAKE_PDF="$PS2PDF"
1873e6bced22SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1874c75e344aSmrg
1875e6bced22SmrgAC_SUBST(MAKE_TEXT)
1876e6bced22SmrgAC_SUBST(MAKE_PS)
1877e6bced22SmrgAC_SUBST(MAKE_PDF)
1878e6bced22SmrgAC_SUBST(MAKE_HTML)
1879e6bced22Smrg]) # XORG_CHECK_LINUXDOC
1880c75e344aSmrg
1881e6bced22Smrg# XORG_CHECK_DOCBOOK
1882e6bced22Smrg# -------------------
1883e6bced22Smrg# Minimum version: 1.0.0
1884e6bced22Smrg#
1885e6bced22Smrg# Checks for the ability to build output formats from SGML DocBook source.
1886e6bced22Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1887e6bced22Smrg# indicates whether the necessary tools and files are found and, if set,
1888e6bced22Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1889e6bced22SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1890e6bced22SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
18912f167a42Smrg
1892e6bced22SmrgBUILDTXTDOC=no
1893e6bced22SmrgBUILDPDFDOC=no
1894e6bced22SmrgBUILDPSDOC=no
1895e6bced22SmrgBUILDHTMLDOC=no
1896fc34a306Smrg
1897e6bced22SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1898e6bced22SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1899e6bced22SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1900e6bced22SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1901fc34a306Smrg
1902e6bced22SmrgAC_MSG_CHECKING([whether to build text documentation])
1903e6bced22Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1904e6bced22Smrg   test x$BUILD_TXTDOC != xno; then
1905e6bced22Smrg	BUILDTXTDOC=yes
1906e6bced22Smrgfi
1907e6bced22SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1908e6bced22SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1909fc34a306Smrg
1910e6bced22SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1911e6bced22Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1912e6bced22Smrg   test x$BUILD_PDFDOC != xno; then
1913e6bced22Smrg	BUILDPDFDOC=yes
1914e6bced22Smrgfi
1915e6bced22SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1916e6bced22SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1917fc34a306Smrg
1918e6bced22SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1919e6bced22Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1920e6bced22Smrg   test x$BUILD_PSDOC != xno; then
1921e6bced22Smrg	BUILDPSDOC=yes
1922e6bced22Smrgfi
1923e6bced22SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1924e6bced22SmrgAC_MSG_RESULT([$BUILDPSDOC])
1925fc34a306Smrg
1926e6bced22SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1927e6bced22Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1928e6bced22Smrg   test x$BUILD_HTMLDOC != xno; then
1929e6bced22Smrg	BUILDHTMLDOC=yes
19302f167a42Smrgfi
1931e6bced22SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1932e6bced22SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1933e6bced22Smrg
1934e6bced22SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1935e6bced22SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1936e6bced22SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1937e6bced22SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
19382f167a42Smrg
1939e6bced22SmrgAC_SUBST(MAKE_TEXT)
1940e6bced22SmrgAC_SUBST(MAKE_PS)
1941e6bced22SmrgAC_SUBST(MAKE_PDF)
1942e6bced22SmrgAC_SUBST(MAKE_HTML)
1943e6bced22Smrg]) # XORG_CHECK_DOCBOOK
1944c75e344aSmrg
1945e6bced22Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1946e6bced22Smrg# ----------------
1947e6bced22Smrg# Minimum version: 1.5.0
1948e6bced22Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1949c75e344aSmrg#
1950e6bced22Smrg# Documentation tools are not always available on all platforms and sometimes
1951e6bced22Smrg# not at the appropriate level. This macro enables a module to test for the
1952e6bced22Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
19538b648e79Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
1954e6bced22Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1955e6bced22Smrg# --with-xmlto assumes 'auto'.
1956c75e344aSmrg#
1957e6bced22Smrg# Interface to module:
1958e6bced22Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1959e6bced22Smrg# XMLTO:	returns the path of the xmlto program found
1960e6bced22Smrg#		returns the path set by the user in the environment
1961e6bced22Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1962e6bced22Smrg#		'no' user instructs the module not to use xmlto
1963c75e344aSmrg#
1964e6bced22Smrg# Added in version 1.10.0
1965e6bced22Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1966e6bced22Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1967c75e344aSmrg#
1968e6bced22Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1969c75e344aSmrg#
1970e6bced22SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1971e6bced22SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1972e6bced22Smrgm4_define([_defopt], m4_default([$2], [auto]))
1973e6bced22SmrgAC_ARG_WITH(xmlto,
1974e6bced22Smrg	AS_HELP_STRING([--with-xmlto],
1975e6bced22Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1976e6bced22Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1977e6bced22Smrgm4_undefine([_defopt])
1978c75e344aSmrg
1979e6bced22Smrgif test "x$use_xmlto" = x"auto"; then
1980e6bced22Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1981e6bced22Smrg   if test "x$XMLTO" = "x"; then
1982e6bced22Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1983e6bced22Smrg	have_xmlto=no
1984e6bced22Smrg   else
1985e6bced22Smrg        have_xmlto=yes
1986e6bced22Smrg   fi
1987e6bced22Smrgelif test "x$use_xmlto" = x"yes" ; then
1988e6bced22Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1989e6bced22Smrg   if test "x$XMLTO" = "x"; then
1990e6bced22Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1991e6bced22Smrg   fi
1992e6bced22Smrg   have_xmlto=yes
1993e6bced22Smrgelif test "x$use_xmlto" = x"no" ; then
1994e6bced22Smrg   if test "x$XMLTO" != "x"; then
1995e6bced22Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1996e6bced22Smrg   fi
1997e6bced22Smrg   have_xmlto=no
1998e6bced22Smrgelse
1999e6bced22Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
2000e6bced22Smrgfi
2001c75e344aSmrg
2002e6bced22Smrg# Test for a minimum version of xmlto, if provided.
2003e6bced22Smrgm4_ifval([$1],
2004e6bced22Smrg[if test "$have_xmlto" = yes; then
2005e6bced22Smrg    # scrape the xmlto version
2006e6bced22Smrg    AC_MSG_CHECKING([the xmlto version])
2007e6bced22Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
2008e6bced22Smrg    AC_MSG_RESULT([$xmlto_version])
2009e6bced22Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
2010e6bced22Smrg        [if test "x$use_xmlto" = xauto; then
2011e6bced22Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
2012e6bced22Smrg            have_xmlto=no
2013e6bced22Smrg        else
2014e6bced22Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
2015e6bced22Smrg        fi])
2016e6bced22Smrgfi])
2017c75e344aSmrg
2018e6bced22Smrg# Test for the ability of xmlto to generate a text target
2019e6bced22Smrg#
2020e6bced22Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
2021e6bced22Smrg# following test for empty XML docbook files.
2022e6bced22Smrg# For compatibility reasons use the following empty XML docbook file and if
2023e6bced22Smrg# it fails try it again with a non-empty XML file.
2024e6bced22Smrghave_xmlto_text=no
2025e6bced22Smrgcat > conftest.xml << "EOF"
2026e6bced22SmrgEOF
2027e6bced22SmrgAS_IF([test "$have_xmlto" = yes],
2028e6bced22Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2029e6bced22Smrg             [have_xmlto_text=yes],
2030e6bced22Smrg             [# Try it again with a non-empty XML file.
2031e6bced22Smrg              cat > conftest.xml << "EOF"
2032e6bced22Smrg<x></x>
2033e6bced22SmrgEOF
2034e6bced22Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2035e6bced22Smrg                    [have_xmlto_text=yes],
2036e6bced22Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
2037e6bced22Smrgrm -f conftest.xml
2038e6bced22SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
2039e6bced22SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
2040e6bced22Smrg]) # XORG_WITH_XMLTO
2041fc34a306Smrg
2042e6bced22Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
2043e6bced22Smrg# --------------------------------------------
2044e6bced22Smrg# Minimum version: 1.12.0
2045e6bced22Smrg# Minimum version for optional DEFAULT argument: 1.12.0
2046c75e344aSmrg#
2047e6bced22Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
2048e6bced22Smrg# XML-based language used for the transformation of XML documents.
2049e6bced22Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
2050e6bced22Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
2051e6bced22Smrg# The XSLT processor is often used as a standalone tool for transformations.
2052e6bced22Smrg# It should not be assumed that this tool is used only to work with documnetation.
2053e6bced22Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
2054c75e344aSmrg#
2055e6bced22Smrg# Interface to module:
2056e6bced22Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
2057e6bced22Smrg# XSLTPROC:	 returns the path of the xsltproc program found
2058e6bced22Smrg#		 returns the path set by the user in the environment
2059e6bced22Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
2060e6bced22Smrg#		  'no' user instructs the module not to use xsltproc
2061e6bced22Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
2062c75e344aSmrg#
2063e6bced22Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
2064c75e344aSmrg#
2065e6bced22SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
2066e6bced22SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
2067e6bced22Smrg# Preserves the interface, should it be implemented later
2068e6bced22Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
2069e6bced22Smrgm4_define([_defopt], m4_default([$2], [auto]))
2070e6bced22SmrgAC_ARG_WITH(xsltproc,
2071e6bced22Smrg	AS_HELP_STRING([--with-xsltproc],
2072e6bced22Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
2073e6bced22Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
2074e6bced22Smrgm4_undefine([_defopt])
2075c75e344aSmrg
2076e6bced22Smrgif test "x$use_xsltproc" = x"auto"; then
2077e6bced22Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
2078e6bced22Smrg   if test "x$XSLTPROC" = "x"; then
2079e6bced22Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
2080e6bced22Smrg	have_xsltproc=no
2081e6bced22Smrg   else
2082e6bced22Smrg        have_xsltproc=yes
2083e6bced22Smrg   fi
2084e6bced22Smrgelif test "x$use_xsltproc" = x"yes" ; then
2085e6bced22Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
2086e6bced22Smrg   if test "x$XSLTPROC" = "x"; then
2087e6bced22Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
2088e6bced22Smrg   fi
2089e6bced22Smrg   have_xsltproc=yes
2090e6bced22Smrgelif test "x$use_xsltproc" = x"no" ; then
2091e6bced22Smrg   if test "x$XSLTPROC" != "x"; then
2092e6bced22Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
2093e6bced22Smrg   fi
2094e6bced22Smrg   have_xsltproc=no
2095e6bced22Smrgelse
2096e6bced22Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
2097e6bced22Smrgfi
20982f167a42Smrg
2099e6bced22SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
2100e6bced22Smrg]) # XORG_WITH_XSLTPROC
2101c75e344aSmrg
2102e6bced22Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
2103e6bced22Smrg# ----------------------------------------
2104e6bced22Smrg# Minimum version: 1.15.0
21052f167a42Smrg#
2106e6bced22Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
2107e6bced22Smrg# scanning arbitrary text files, extracting information from those text files,
2108e6bced22Smrg# and printing reports based on that information.
21092f167a42Smrg#
2110e6bced22Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
21112f167a42Smrg#
2112e6bced22Smrg# Interface to module:
2113e6bced22Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
2114e6bced22Smrg# PERL:	     returns the path of the perl program found
2115e6bced22Smrg#	     returns the path set by the user in the environment
2116e6bced22Smrg# --with-perl: 'yes' user instructs the module to use perl
2117e6bced22Smrg#	       'no' user instructs the module not to use perl
2118e6bced22Smrg# have_perl: returns yes if perl found in PATH or no
2119c75e344aSmrg#
2120e6bced22Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
2121e6bced22Smrg#
2122e6bced22SmrgAC_DEFUN([XORG_WITH_PERL],[
2123e6bced22SmrgAC_ARG_VAR([PERL], [Path to perl command])
2124e6bced22Smrg# Preserves the interface, should it be implemented later
2125e6bced22Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
2126e6bced22Smrgm4_define([_defopt], m4_default([$2], [auto]))
2127e6bced22SmrgAC_ARG_WITH(perl,
2128e6bced22Smrg	AS_HELP_STRING([--with-perl],
2129e6bced22Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
2130e6bced22Smrg	   [use_perl=$withval], [use_perl=]_defopt)
2131e6bced22Smrgm4_undefine([_defopt])
2132fc34a306Smrg
2133e6bced22Smrgif test "x$use_perl" = x"auto"; then
2134e6bced22Smrg   AC_PATH_PROG([PERL], [perl])
2135e6bced22Smrg   if test "x$PERL" = "x"; then
2136e6bced22Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
2137e6bced22Smrg	have_perl=no
2138e6bced22Smrg   else
2139e6bced22Smrg        have_perl=yes
2140e6bced22Smrg   fi
2141e6bced22Smrgelif test "x$use_perl" = x"yes" ; then
2142e6bced22Smrg   AC_PATH_PROG([PERL], [perl])
2143e6bced22Smrg   if test "x$PERL" = "x"; then
2144e6bced22Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
2145e6bced22Smrg   fi
2146e6bced22Smrg   have_perl=yes
2147e6bced22Smrgelif test "x$use_perl" = x"no" ; then
2148e6bced22Smrg   if test "x$PERL" != "x"; then
2149e6bced22Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
2150e6bced22Smrg   fi
2151e6bced22Smrg   have_perl=no
2152e6bced22Smrgelse
2153e6bced22Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
2154e6bced22Smrgfi
2155fc34a306Smrg
2156e6bced22SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2157e6bced22Smrg]) # XORG_WITH_PERL
2158c75e344aSmrg
2159e6bced22Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2160e6bced22Smrg# ----------------
2161e6bced22Smrg# Minimum version: 1.5.0
2162e6bced22Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2163c75e344aSmrg#
2164e6bced22Smrg# Documentation tools are not always available on all platforms and sometimes
2165e6bced22Smrg# not at the appropriate level. This macro enables a module to test for the
2166e6bced22Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
21678b648e79Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
2168e6bced22Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2169e6bced22Smrg# --with-asciidoc assumes 'auto'.
2170c75e344aSmrg#
2171e6bced22Smrg# Interface to module:
2172e6bced22Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2173e6bced22Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
2174e6bced22Smrg#		 returns the path set by the user in the environment
2175e6bced22Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2176e6bced22Smrg#		  'no' user instructs the module not to use asciidoc
2177c75e344aSmrg#
2178e6bced22Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2179c75e344aSmrg#
2180e6bced22SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2181e6bced22SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2182e6bced22Smrgm4_define([_defopt], m4_default([$2], [auto]))
2183e6bced22SmrgAC_ARG_WITH(asciidoc,
2184e6bced22Smrg	AS_HELP_STRING([--with-asciidoc],
2185e6bced22Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2186e6bced22Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2187e6bced22Smrgm4_undefine([_defopt])
2188fc34a306Smrg
2189e6bced22Smrgif test "x$use_asciidoc" = x"auto"; then
2190e6bced22Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2191e6bced22Smrg   if test "x$ASCIIDOC" = "x"; then
2192e6bced22Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2193e6bced22Smrg	have_asciidoc=no
2194e6bced22Smrg   else
2195e6bced22Smrg        have_asciidoc=yes
2196e6bced22Smrg   fi
2197e6bced22Smrgelif test "x$use_asciidoc" = x"yes" ; then
2198e6bced22Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2199e6bced22Smrg   if test "x$ASCIIDOC" = "x"; then
2200e6bced22Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2201e6bced22Smrg   fi
2202e6bced22Smrg   have_asciidoc=yes
2203e6bced22Smrgelif test "x$use_asciidoc" = x"no" ; then
2204e6bced22Smrg   if test "x$ASCIIDOC" != "x"; then
2205e6bced22Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2206e6bced22Smrg   fi
2207e6bced22Smrg   have_asciidoc=no
2208e6bced22Smrgelse
2209e6bced22Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2210e6bced22Smrgfi
2211e6bced22Smrgm4_ifval([$1],
2212e6bced22Smrg[if test "$have_asciidoc" = yes; then
2213e6bced22Smrg    # scrape the asciidoc version
2214e6bced22Smrg    AC_MSG_CHECKING([the asciidoc version])
2215e6bced22Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2216e6bced22Smrg    AC_MSG_RESULT([$asciidoc_version])
2217e6bced22Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2218e6bced22Smrg        [if test "x$use_asciidoc" = xauto; then
2219e6bced22Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2220e6bced22Smrg            have_asciidoc=no
2221e6bced22Smrg        else
2222e6bced22Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2223e6bced22Smrg        fi])
2224e6bced22Smrgfi])
2225e6bced22SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2226e6bced22Smrg]) # XORG_WITH_ASCIIDOC
2227fc34a306Smrg
2228e6bced22Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
2229e6bced22Smrg# -------------------------------------------
2230e6bced22Smrg# Minimum version: 1.5.0
2231e6bced22Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2232e6bced22Smrg# Minimum version for optional DOT checking: 1.18.0
2233e6bced22Smrg#
2234e6bced22Smrg# Documentation tools are not always available on all platforms and sometimes
2235e6bced22Smrg# not at the appropriate level. This macro enables a module to test for the
2236e6bced22Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
22378b648e79Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
2238e6bced22Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2239e6bced22Smrg# --with-doxygen assumes 'auto'.
2240e6bced22Smrg#
2241e6bced22Smrg# Interface to module:
2242e6bced22Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2243e6bced22Smrg# DOXYGEN:	 returns the path of the doxygen program found
2244e6bced22Smrg#		 returns the path set by the user in the environment
2245e6bced22Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2246e6bced22Smrg#		  'no' user instructs the module not to use doxygen
2247c75e344aSmrg#
2248e6bced22Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2249e6bced22Smrg#
2250e6bced22SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2251e6bced22SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2252e6bced22SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
2253e6bced22Smrgm4_define([_defopt], m4_default([$2], [auto]))
2254e6bced22SmrgAC_ARG_WITH(doxygen,
2255e6bced22Smrg	AS_HELP_STRING([--with-doxygen],
2256e6bced22Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2257e6bced22Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2258e6bced22Smrgm4_undefine([_defopt])
2259c75e344aSmrg
2260e6bced22Smrgif test "x$use_doxygen" = x"auto"; then
2261e6bced22Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2262e6bced22Smrg   if test "x$DOXYGEN" = "x"; then
2263e6bced22Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2264e6bced22Smrg	have_doxygen=no
2265e6bced22Smrg   else
2266e6bced22Smrg        have_doxygen=yes
2267e6bced22Smrg   fi
2268e6bced22Smrgelif test "x$use_doxygen" = x"yes" ; then
2269e6bced22Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2270e6bced22Smrg   if test "x$DOXYGEN" = "x"; then
2271e6bced22Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2272e6bced22Smrg   fi
2273e6bced22Smrg   have_doxygen=yes
2274e6bced22Smrgelif test "x$use_doxygen" = x"no" ; then
2275e6bced22Smrg   if test "x$DOXYGEN" != "x"; then
2276e6bced22Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2277e6bced22Smrg   fi
2278e6bced22Smrg   have_doxygen=no
2279fc34a306Smrgelse
2280e6bced22Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2281fc34a306Smrgfi
2282e6bced22Smrgm4_ifval([$1],
2283e6bced22Smrg[if test "$have_doxygen" = yes; then
2284e6bced22Smrg    # scrape the doxygen version
2285e6bced22Smrg    AC_MSG_CHECKING([the doxygen version])
2286e6bced22Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2287e6bced22Smrg    AC_MSG_RESULT([$doxygen_version])
2288e6bced22Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2289e6bced22Smrg        [if test "x$use_doxygen" = xauto; then
2290e6bced22Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2291e6bced22Smrg            have_doxygen=no
2292e6bced22Smrg        else
2293e6bced22Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2294e6bced22Smrg        fi])
2295e6bced22Smrgfi])
2296fc34a306Smrg
2297e6bced22Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2298e6bced22Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2299e6bced22Smrgdnl 	HAVE_DOT = @HAVE_DOT@
2300e6bced22SmrgHAVE_DOT=no
2301e6bced22Smrgif test "x$have_doxygen" = "xyes"; then
2302e6bced22Smrg  AC_PATH_PROG([DOT], [dot])
2303e6bced22Smrg    if test "x$DOT" != "x"; then
2304e6bced22Smrg      HAVE_DOT=yes
2305e6bced22Smrg    fi
2306e6bced22Smrgfi
2307fc34a306Smrg
2308e6bced22SmrgAC_SUBST([HAVE_DOT])
2309e6bced22SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2310e6bced22SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2311e6bced22Smrg]) # XORG_WITH_DOXYGEN
2312fc34a306Smrg
2313e6bced22Smrg# XORG_WITH_GROFF([DEFAULT])
2314e6bced22Smrg# ----------------
2315e6bced22Smrg# Minimum version: 1.6.0
2316e6bced22Smrg# Minimum version for optional DEFAULT argument: 1.11.0
23172f167a42Smrg#
2318e6bced22Smrg# Documentation tools are not always available on all platforms and sometimes
2319e6bced22Smrg# not at the appropriate level. This macro enables a module to test for the
2320e6bced22Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
23218b648e79Smrg# the --with-groff option, it allows maximum flexibility in making decisions
2322e6bced22Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
2323e6bced22Smrg# --with-groff assumes 'auto'.
2324e6bced22Smrg#
2325e6bced22Smrg# Interface to module:
2326e6bced22Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2327e6bced22Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2328e6bced22Smrg# HAVE_GROFF_MS: the -ms macros package
2329e6bced22Smrg# GROFF:	 returns the path of the groff program found
2330e6bced22Smrg#		 returns the path set by the user in the environment
2331e6bced22Smrg# --with-groff:	 'yes' user instructs the module to use groff
2332e6bced22Smrg#		 'no' user instructs the module not to use groff
2333e6bced22Smrg#
2334e6bced22Smrg# Added in version 1.9.0:
2335e6bced22Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2336e6bced22Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2337e6bced22Smrg#		   psselect from the psutils package.
2338e6bced22Smrg#		   the ghostcript package. Refer to the grohtml man pages
2339e6bced22Smrg#
2340e6bced22Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2341e6bced22Smrg#
2342e6bced22Smrg# OS and distros often splits groff in a basic and full package, the former
2343e6bced22Smrg# having the groff program and the later having devices, fonts and macros
2344e6bced22Smrg# Checking for the groff executable is not enough.
2345e6bced22Smrg#
2346e6bced22Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
2347e6bced22Smrg# unset HAVE_GROFF or GROFF env variables.
2348e6bced22Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2349e6bced22Smrg#
2350e6bced22SmrgAC_DEFUN([XORG_WITH_GROFF],[
2351e6bced22SmrgAC_ARG_VAR([GROFF], [Path to groff command])
2352e6bced22Smrgm4_define([_defopt], m4_default([$1], [auto]))
2353e6bced22SmrgAC_ARG_WITH(groff,
2354e6bced22Smrg	AS_HELP_STRING([--with-groff],
2355e6bced22Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2356e6bced22Smrg	   [use_groff=$withval], [use_groff=]_defopt)
2357e6bced22Smrgm4_undefine([_defopt])
2358fc34a306Smrg
2359e6bced22Smrgif test "x$use_groff" = x"auto"; then
2360e6bced22Smrg   AC_PATH_PROG([GROFF], [groff])
2361e6bced22Smrg   if test "x$GROFF" = "x"; then
2362e6bced22Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2363e6bced22Smrg	have_groff=no
2364e6bced22Smrg   else
2365e6bced22Smrg        have_groff=yes
2366e6bced22Smrg   fi
2367e6bced22Smrgelif test "x$use_groff" = x"yes" ; then
2368e6bced22Smrg   AC_PATH_PROG([GROFF], [groff])
2369e6bced22Smrg   if test "x$GROFF" = "x"; then
2370e6bced22Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2371e6bced22Smrg   fi
2372e6bced22Smrg   have_groff=yes
2373e6bced22Smrgelif test "x$use_groff" = x"no" ; then
2374e6bced22Smrg   if test "x$GROFF" != "x"; then
2375e6bced22Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2376e6bced22Smrg   fi
2377e6bced22Smrg   have_groff=no
2378fc34a306Smrgelse
2379e6bced22Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2380fc34a306Smrgfi
2381fc34a306Smrg
2382e6bced22Smrg# We have groff, test for the presence of the macro packages
2383e6bced22Smrgif test "x$have_groff" = x"yes"; then
2384e6bced22Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2385e6bced22Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2386e6bced22Smrg        groff_ms_works=yes
2387e6bced22Smrg    else
2388e6bced22Smrg        groff_ms_works=no
2389e6bced22Smrg    fi
2390e6bced22Smrg    AC_MSG_RESULT([$groff_ms_works])
2391e6bced22Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2392e6bced22Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2393e6bced22Smrg        groff_mm_works=yes
2394e6bced22Smrg    else
2395e6bced22Smrg        groff_mm_works=no
2396e6bced22Smrg    fi
2397e6bced22Smrg    AC_MSG_RESULT([$groff_mm_works])
2398e6bced22Smrgfi
2399fc34a306Smrg
2400e6bced22Smrg# We have groff, test for HTML dependencies, one command per package
2401e6bced22Smrgif test "x$have_groff" = x"yes"; then
2402e6bced22Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2403e6bced22Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2404e6bced22Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2405e6bced22Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2406e6bced22Smrg      have_groff_html=yes
2407e6bced22Smrg   else
2408e6bced22Smrg      have_groff_html=no
2409e6bced22Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2410e6bced22Smrg   fi
2411e6bced22Smrgfi
2412fc34a306Smrg
2413e6bced22Smrg# Set Automake conditionals for Makefiles
2414e6bced22SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2415e6bced22SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2416e6bced22SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2417e6bced22SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2418e6bced22Smrg]) # XORG_WITH_GROFF
2419fc34a306Smrg
2420e6bced22Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2421e6bced22Smrg# ---------------------------------------
2422e6bced22Smrg# Minimum version: 1.6.0
2423e6bced22Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2424e6bced22Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2425e6bced22Smrg#
2426e6bced22Smrg# Documentation tools are not always available on all platforms and sometimes
2427e6bced22Smrg# not at the appropriate level. This macro enables a module to test for the
2428e6bced22Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
24298b648e79Smrg# the --with-fop option, it allows maximum flexibility in making decisions
2430e6bced22Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
2431e6bced22Smrg# --with-fop assumes 'auto'.
2432e6bced22Smrg#
2433e6bced22Smrg# Interface to module:
2434e6bced22Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2435e6bced22Smrg# FOP:	 	returns the path of the fop program found
2436e6bced22Smrg#		returns the path set by the user in the environment
2437e6bced22Smrg# --with-fop: 	'yes' user instructs the module to use fop
2438e6bced22Smrg#		'no' user instructs the module not to use fop
2439e6bced22Smrg#
2440e6bced22Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2441e6bced22Smrg#
2442e6bced22SmrgAC_DEFUN([XORG_WITH_FOP],[
2443e6bced22SmrgAC_ARG_VAR([FOP], [Path to fop command])
2444e6bced22Smrgm4_define([_defopt], m4_default([$2], [auto]))
2445e6bced22SmrgAC_ARG_WITH(fop,
2446e6bced22Smrg	AS_HELP_STRING([--with-fop],
2447e6bced22Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2448e6bced22Smrg	   [use_fop=$withval], [use_fop=]_defopt)
2449e6bced22Smrgm4_undefine([_defopt])
2450e6bced22Smrg
2451e6bced22Smrgif test "x$use_fop" = x"auto"; then
2452e6bced22Smrg   AC_PATH_PROG([FOP], [fop])
2453e6bced22Smrg   if test "x$FOP" = "x"; then
2454e6bced22Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2455e6bced22Smrg	have_fop=no
2456e6bced22Smrg   else
2457e6bced22Smrg        have_fop=yes
2458e6bced22Smrg   fi
2459e6bced22Smrgelif test "x$use_fop" = x"yes" ; then
2460e6bced22Smrg   AC_PATH_PROG([FOP], [fop])
2461e6bced22Smrg   if test "x$FOP" = "x"; then
2462e6bced22Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2463e6bced22Smrg   fi
2464e6bced22Smrg   have_fop=yes
2465e6bced22Smrgelif test "x$use_fop" = x"no" ; then
2466e6bced22Smrg   if test "x$FOP" != "x"; then
2467e6bced22Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2468e6bced22Smrg   fi
2469e6bced22Smrg   have_fop=no
2470e6bced22Smrgelse
2471e6bced22Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2472fc34a306Smrgfi
2473fc34a306Smrg
2474e6bced22Smrg# Test for a minimum version of fop, if provided.
2475e6bced22Smrgm4_ifval([$1],
2476e6bced22Smrg[if test "$have_fop" = yes; then
2477e6bced22Smrg    # scrape the fop version
2478e6bced22Smrg    AC_MSG_CHECKING([for fop minimum version])
2479e6bced22Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2480e6bced22Smrg    AC_MSG_RESULT([$fop_version])
2481e6bced22Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2482e6bced22Smrg        [if test "x$use_fop" = xauto; then
2483e6bced22Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2484e6bced22Smrg            have_fop=no
2485e6bced22Smrg        else
2486e6bced22Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2487e6bced22Smrg        fi])
2488e6bced22Smrgfi])
2489e6bced22SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2490e6bced22Smrg]) # XORG_WITH_FOP
2491fc34a306Smrg
2492e6bced22Smrg# XORG_WITH_M4([MIN-VERSION])
2493e6bced22Smrg# ---------------------------
2494e6bced22Smrg# Minimum version: 1.19.0
24952f167a42Smrg#
2496e6bced22Smrg# This macro attempts to locate an m4 macro processor which supports
2497e6bced22Smrg# -I option and is only useful for modules relying on M4 in order to
2498e6bced22Smrg# expand macros in source code files.
2499e6bced22Smrg#
2500e6bced22Smrg# Interface to module:
2501e6bced22Smrg# M4:	 	returns the path of the m4 program found
2502e6bced22Smrg#		returns the path set by the user in the environment
2503e6bced22Smrg#
2504e6bced22SmrgAC_DEFUN([XORG_WITH_M4], [
2505e6bced22SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2506e6bced22Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2507e6bced22Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2508e6bced22Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2509e6bced22Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2510e6bced22Smrg   [$PATH:/usr/gnu/bin])])
2511fc34a306Smrg
2512e6bced22SmrgAC_SUBST([M4], [$ac_cv_path_M4])
2513e6bced22Smrg]) # XORG_WITH_M4
2514e6bced22Smrg
2515e6bced22Smrg# XORG_WITH_PS2PDF([DEFAULT])
2516e6bced22Smrg# ----------------
2517e6bced22Smrg# Minimum version: 1.6.0
2518e6bced22Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2519e6bced22Smrg#
2520e6bced22Smrg# Documentation tools are not always available on all platforms and sometimes
2521e6bced22Smrg# not at the appropriate level. This macro enables a module to test for the
2522e6bced22Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
25238b648e79Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
2524e6bced22Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2525e6bced22Smrg# --with-ps2pdf assumes 'auto'.
2526e6bced22Smrg#
2527e6bced22Smrg# Interface to module:
2528e6bced22Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2529e6bced22Smrg# PS2PDF:	returns the path of the ps2pdf program found
2530e6bced22Smrg#		returns the path set by the user in the environment
2531e6bced22Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2532e6bced22Smrg#		 'no' user instructs the module not to use ps2pdf
2533e6bced22Smrg#
2534e6bced22Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2535e6bced22Smrg#
2536e6bced22SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2537e6bced22SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2538e6bced22Smrgm4_define([_defopt], m4_default([$1], [auto]))
2539e6bced22SmrgAC_ARG_WITH(ps2pdf,
2540e6bced22Smrg	AS_HELP_STRING([--with-ps2pdf],
2541e6bced22Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2542e6bced22Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2543e6bced22Smrgm4_undefine([_defopt])
2544fc34a306Smrg
2545e6bced22Smrgif test "x$use_ps2pdf" = x"auto"; then
2546e6bced22Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2547e6bced22Smrg   if test "x$PS2PDF" = "x"; then
2548e6bced22Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2549e6bced22Smrg	have_ps2pdf=no
2550e6bced22Smrg   else
2551e6bced22Smrg        have_ps2pdf=yes
2552e6bced22Smrg   fi
2553e6bced22Smrgelif test "x$use_ps2pdf" = x"yes" ; then
2554e6bced22Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2555e6bced22Smrg   if test "x$PS2PDF" = "x"; then
2556e6bced22Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2557e6bced22Smrg   fi
2558e6bced22Smrg   have_ps2pdf=yes
2559e6bced22Smrgelif test "x$use_ps2pdf" = x"no" ; then
2560e6bced22Smrg   if test "x$PS2PDF" != "x"; then
2561e6bced22Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2562e6bced22Smrg   fi
2563e6bced22Smrg   have_ps2pdf=no
2564e6bced22Smrgelse
2565e6bced22Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2566e6bced22Smrgfi
2567e6bced22SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2568e6bced22Smrg]) # XORG_WITH_PS2PDF
2569fc34a306Smrg
2570e6bced22Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
2571e6bced22Smrg# ----------------
2572e6bced22Smrg# Minimum version: 1.6.0
25732f167a42Smrg#
2574e6bced22Smrg# Documentation tools are not always available on all platforms and sometimes
2575e6bced22Smrg# not at the appropriate level. This macro enables a builder to skip all
2576e6bced22Smrg# documentation targets except traditional man pages.
2577e6bced22Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
25788b648e79Smrg# maximum flexibility in controlling documentation building.
2579e6bced22Smrg# Refer to:
2580e6bced22Smrg# XORG_WITH_XMLTO         --with-xmlto
2581e6bced22Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2582e6bced22Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2583e6bced22Smrg# XORG_WITH_FOP           --with-fop
2584e6bced22Smrg# XORG_WITH_GROFF         --with-groff
2585e6bced22Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2586e6bced22Smrg#
2587e6bced22Smrg# Interface to module:
2588e6bced22Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2589e6bced22Smrg# --enable-docs: 'yes' user instructs the module to generate docs
2590e6bced22Smrg#		 'no' user instructs the module not to generate docs
2591e6bced22Smrg# parm1:	specify the default value, yes or no.
2592e6bced22Smrg#
2593e6bced22SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2594e6bced22Smrgm4_define([docs_default], m4_default([$1], [yes]))
2595e6bced22SmrgAC_ARG_ENABLE(docs,
2596e6bced22Smrg	AS_HELP_STRING([--enable-docs],
2597e6bced22Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2598e6bced22Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2599e6bced22Smrgm4_undefine([docs_default])
2600e6bced22SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2601e6bced22SmrgAC_MSG_CHECKING([whether to build documentation])
2602e6bced22SmrgAC_MSG_RESULT([$build_docs])
2603e6bced22Smrg]) # XORG_ENABLE_DOCS
2604fc34a306Smrg
2605e6bced22Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2606e6bced22Smrg# ----------------
2607e6bced22Smrg# Minimum version: 1.6.0
2608e6bced22Smrg#
2609e6bced22Smrg# This macro enables a builder to skip all developer documentation.
2610e6bced22Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
26118b648e79Smrg# maximum flexibility in controlling documentation building.
2612e6bced22Smrg# Refer to:
2613e6bced22Smrg# XORG_WITH_XMLTO         --with-xmlto
2614e6bced22Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2615e6bced22Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2616e6bced22Smrg# XORG_WITH_FOP           --with-fop
2617e6bced22Smrg# XORG_WITH_GROFF         --with-groff
2618e6bced22Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2619e6bced22Smrg#
2620e6bced22Smrg# Interface to module:
2621e6bced22Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2622e6bced22Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2623e6bced22Smrg#			'no' user instructs the module not to generate developer docs
2624e6bced22Smrg# parm1:		specify the default value, yes or no.
2625e6bced22Smrg#
2626e6bced22SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2627e6bced22Smrgm4_define([devel_default], m4_default([$1], [yes]))
2628e6bced22SmrgAC_ARG_ENABLE(devel-docs,
2629e6bced22Smrg	AS_HELP_STRING([--enable-devel-docs],
2630e6bced22Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2631e6bced22Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2632e6bced22Smrgm4_undefine([devel_default])
2633e6bced22SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2634e6bced22SmrgAC_MSG_CHECKING([whether to build developer documentation])
2635e6bced22SmrgAC_MSG_RESULT([$build_devel_docs])
2636e6bced22Smrg]) # XORG_ENABLE_DEVEL_DOCS
2637fc34a306Smrg
2638e6bced22Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2639e6bced22Smrg# ----------------
2640e6bced22Smrg# Minimum version: 1.6.0
26412f167a42Smrg#
2642e6bced22Smrg# This macro enables a builder to skip all functional specification targets.
2643e6bced22Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
26448b648e79Smrg# maximum flexibility in controlling documentation building.
2645e6bced22Smrg# Refer to:
2646e6bced22Smrg# XORG_WITH_XMLTO         --with-xmlto
2647e6bced22Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2648e6bced22Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2649e6bced22Smrg# XORG_WITH_FOP           --with-fop
2650e6bced22Smrg# XORG_WITH_GROFF         --with-groff
2651e6bced22Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2652e6bced22Smrg#
2653e6bced22Smrg# Interface to module:
2654e6bced22Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2655e6bced22Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2656e6bced22Smrg#			'no' user instructs the module not to generate specs
2657e6bced22Smrg# parm1:		specify the default value, yes or no.
2658e6bced22Smrg#
2659e6bced22SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2660e6bced22Smrgm4_define([spec_default], m4_default([$1], [yes]))
2661e6bced22SmrgAC_ARG_ENABLE(specs,
2662e6bced22Smrg	AS_HELP_STRING([--enable-specs],
2663e6bced22Smrg	   [Enable building the specs (default: ]spec_default[)]),
2664e6bced22Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2665e6bced22Smrgm4_undefine([spec_default])
2666e6bced22SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2667e6bced22SmrgAC_MSG_CHECKING([whether to build functional specifications])
2668e6bced22SmrgAC_MSG_RESULT([$build_specs])
2669e6bced22Smrg]) # XORG_ENABLE_SPECS
26702f167a42Smrg
2671e6bced22Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2672e6bced22Smrg# ----------------------------------------------
2673e6bced22Smrg# Minimum version: 1.13.0
2674e6bced22Smrg#
2675e6bced22Smrg# This macro enables a builder to enable/disable unit testing
2676e6bced22Smrg# It makes no assumption about the test cases implementation
2677e6bced22Smrg# Test cases may or may not use Automake "Support for test suites"
2678e6bced22Smrg# They may or may not use the software utility library GLib
2679e6bced22Smrg#
2680e6bced22Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2681e6bced22Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2682e6bced22Smrg# The variable enable_unit_tests is used by other macros in this file.
2683e6bced22Smrg#
2684e6bced22Smrg# Interface to module:
2685e6bced22Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2686e6bced22Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2687e6bced22Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2688e6bced22Smrg#			'no' user instructs the module not to build tests
2689e6bced22Smrg# parm1:		specify the default value, yes or no.
2690e6bced22Smrg#
2691e6bced22SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2692e6bced22SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2693e6bced22SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2694e6bced22SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2695e6bced22Smrgm4_define([_defopt], m4_default([$1], [auto]))
2696e6bced22SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2697e6bced22Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2698e6bced22Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2699e6bced22Smrgm4_undefine([_defopt])
2700e6bced22SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2701e6bced22SmrgAC_MSG_CHECKING([whether to build unit test cases])
2702e6bced22SmrgAC_MSG_RESULT([$enable_unit_tests])
2703e6bced22Smrg]) # XORG_ENABLE_UNIT_TESTS
27042f167a42Smrg
2705e6bced22Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2706e6bced22Smrg# ------------------------------------------------------
2707e6bced22Smrg# Minimum version: 1.17.0
2708e6bced22Smrg#
2709e6bced22Smrg# This macro enables a builder to enable/disable integration testing
2710e6bced22Smrg# It makes no assumption about the test cases' implementation
2711e6bced22Smrg# Test cases may or may not use Automake "Support for test suites"
2712e6bced22Smrg#
2713e6bced22Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2714e6bced22Smrg# usually requires less dependencies and may be built and run under less
2715e6bced22Smrg# stringent environments than integration tests.
2716e6bced22Smrg#
2717e6bced22Smrg# Interface to module:
2718e6bced22Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2719e6bced22Smrg# enable_integration_tests:   used in configure.ac for additional configuration
2720e6bced22Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2721e6bced22Smrg#                             'no' user instructs the module not to build tests
2722e6bced22Smrg# parm1:                      specify the default value, yes or no.
2723e6bced22Smrg#
2724e6bced22SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2725e6bced22SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2726e6bced22Smrgm4_define([_defopt], m4_default([$1], [auto]))
2727e6bced22SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2728e6bced22Smrg	[Enable building integration test cases (default: ]_defopt[)]),
2729e6bced22Smrg	[enable_integration_tests=$enableval],
2730e6bced22Smrg	[enable_integration_tests=]_defopt)
2731e6bced22Smrgm4_undefine([_defopt])
2732e6bced22SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2733e6bced22Smrg	[test "x$enable_integration_tests" != xno])
2734e6bced22SmrgAC_MSG_CHECKING([whether to build unit test cases])
2735e6bced22SmrgAC_MSG_RESULT([$enable_integration_tests])
2736e6bced22Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
27372f167a42Smrg
2738e6bced22Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2739e6bced22Smrg# ----------------------------------------
2740e6bced22Smrg# Minimum version: 1.13.0
2741e6bced22Smrg#
2742e6bced22Smrg# GLib is a library which provides advanced data structures and functions.
2743e6bced22Smrg# This macro enables a module to test for the presence of Glib.
2744e6bced22Smrg#
2745e6bced22Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2746e6bced22Smrg# Otherwise the value of $enable_unit_tests is blank.
2747e6bced22Smrg#
2748e6bced22Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2749e6bced22Smrg# test support usually requires less dependencies and may be built and run under
2750e6bced22Smrg# less stringent environments than integration tests.
2751e6bced22Smrg#
2752e6bced22Smrg# Interface to module:
2753e6bced22Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2754e6bced22Smrg# with_glib: used in configure.ac to know if GLib has been found
2755e6bced22Smrg# --with-glib:	'yes' user instructs the module to use glib
2756e6bced22Smrg#		'no' user instructs the module not to use glib
2757e6bced22Smrg#
2758e6bced22SmrgAC_DEFUN([XORG_WITH_GLIB],[
2759e6bced22SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2760e6bced22Smrgm4_define([_defopt], m4_default([$2], [auto]))
2761e6bced22SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2762e6bced22Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2763e6bced22Smrg	[with_glib=$withval], [with_glib=]_defopt)
2764e6bced22Smrgm4_undefine([_defopt])
2765e6bced22Smrg
2766e6bced22Smrghave_glib=no
2767e6bced22Smrg# Do not probe GLib if user explicitly disabled unit testing
2768e6bced22Smrgif test "x$enable_unit_tests" != x"no"; then
2769e6bced22Smrg  # Do not probe GLib if user explicitly disabled it
2770e6bced22Smrg  if test "x$with_glib" != x"no"; then
2771e6bced22Smrg    m4_ifval(
2772e6bced22Smrg      [$1],
2773e6bced22Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2774e6bced22Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2775e6bced22Smrg    )
27762f167a42Smrg  fi
27772f167a42Smrgfi
27782f167a42Smrg
2779e6bced22Smrg# Not having GLib when unit testing has been explicitly requested is an error
2780e6bced22Smrgif test "x$enable_unit_tests" = x"yes"; then
2781e6bced22Smrg  if test "x$have_glib" = x"no"; then
2782e6bced22Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
27832f167a42Smrg  fi
27842f167a42Smrgfi
27852f167a42Smrg
2786e6bced22Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2787e6bced22Smrgif test "x$enable_unit_tests" = x"no"; then
2788e6bced22Smrg  if test "x$with_glib" = x"yes"; then
2789e6bced22Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2790e6bced22Smrg  fi
2791e6bced22Smrgfi
27922f167a42Smrg
2793e6bced22Smrg# Not having GLib when it has been explicitly requested is an error
2794e6bced22Smrgif test "x$with_glib" = x"yes"; then
2795e6bced22Smrg  if test "x$have_glib" = x"no"; then
2796e6bced22Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2797e6bced22Smrg  fi
2798e6bced22Smrgfi
2799fc34a306Smrg
2800e6bced22SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2801e6bced22Smrg]) # XORG_WITH_GLIB
28022f167a42Smrg
2803e6bced22Smrg# XORG_LD_WRAP([required|optional])
2804e6bced22Smrg# ---------------------------------
2805e6bced22Smrg# Minimum version: 1.13.0
2806e6bced22Smrg#
2807e6bced22Smrg# Check if linker supports -wrap, passed via compiler flags
2808e6bced22Smrg#
2809e6bced22Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2810e6bced22Smrg# Otherwise the value of $enable_unit_tests is blank.
2811e6bced22Smrg#
2812e6bced22Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2813e6bced22Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2814e6bced22Smrg# available, an argument of "optional" allows use when some unit tests require
2815e6bced22Smrg# ld -wrap and others do not.
2816e6bced22Smrg#
2817e6bced22SmrgAC_DEFUN([XORG_LD_WRAP],[
2818e6bced22SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2819e6bced22Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2820e6bced22Smrg                      void __wrap_exit(int status) { return; }],
2821e6bced22Smrg                     [exit(0);])])
2822e6bced22Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2823e6bced22Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2824e6bced22Smrg  if test "x$have_ld_wrap" = x"no"; then
2825e6bced22Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2826e6bced22Smrg  fi
2827e6bced22Smrgfi
2828e6bced22SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2829e6bced22Smrg#
2830e6bced22Smrg]) # XORG_LD_WRAP
28312f167a42Smrg
2832e6bced22Smrg# XORG_CHECK_LINKER_FLAGS
2833e6bced22Smrg# -----------------------
2834e6bced22Smrg# SYNOPSIS
2835e6bced22Smrg#
2836e6bced22Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2837e6bced22Smrg#
2838e6bced22Smrg# DESCRIPTION
2839e6bced22Smrg#
2840e6bced22Smrg#   Check whether the given linker FLAGS work with the current language's
2841e6bced22Smrg#   linker, or whether they give an error.
2842e6bced22Smrg#
2843e6bced22Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2844e6bced22Smrg#   success/failure.
2845e6bced22Smrg#
2846e6bced22Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2847e6bced22Smrg#
2848e6bced22Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2849e6bced22Smrg#
2850e6bced22Smrg# LICENSE
2851e6bced22Smrg#
2852e6bced22Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2853e6bced22Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2854e6bced22Smrg#   Copyright (c) 2009 Matteo Frigo
2855e6bced22Smrg#
2856e6bced22Smrg#   This program is free software: you can redistribute it and/or modify it
2857e6bced22Smrg#   under the terms of the GNU General Public License as published by the
2858e6bced22Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2859e6bced22Smrg#   option) any later version.
2860e6bced22Smrg#
2861e6bced22Smrg#   This program is distributed in the hope that it will be useful, but
2862e6bced22Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2863e6bced22Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2864e6bced22Smrg#   Public License for more details.
2865e6bced22Smrg#
2866e6bced22Smrg#   You should have received a copy of the GNU General Public License along
2867e6bced22Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2868e6bced22Smrg#
2869e6bced22Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2870e6bced22Smrg#   gives unlimited permission to copy, distribute and modify the configure
2871e6bced22Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2872e6bced22Smrg#   need not follow the terms of the GNU General Public License when using
2873e6bced22Smrg#   or distributing such scripts, even though portions of the text of the
2874e6bced22Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2875e6bced22Smrg#   all other use of the material that constitutes the Autoconf Macro.
2876e6bced22Smrg#
2877e6bced22Smrg#   This special exception to the GPL applies to versions of the Autoconf
2878e6bced22Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2879e6bced22Smrg#   modified version of the Autoconf Macro, you may extend this special
2880e6bced22Smrg#   exception to the GPL to apply to your modified version as well.#
2881e6bced22SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2882e6bced22Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2883e6bced22Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2884e6bced22SmrgAS_LITERAL_IF([$1],
2885e6bced22Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2886e6bced22Smrg      ax_save_FLAGS=$LDFLAGS
2887e6bced22Smrg      LDFLAGS="$1"
2888e6bced22Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2889e6bced22Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2890e6bced22Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2891e6bced22Smrg      LDFLAGS=$ax_save_FLAGS])],
2892e6bced22Smrg  [ax_save_FLAGS=$LDFLAGS
2893e6bced22Smrg   LDFLAGS="$1"
2894e6bced22Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2895e6bced22Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2896e6bced22Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2897e6bced22Smrg   LDFLAGS=$ax_save_FLAGS])
2898e6bced22Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2899e6bced22SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2900e6bced22Smrgif test "x$xorg_check_linker_flags" = xyes; then
2901e6bced22Smrg	m4_default([$2], :)
2902e6bced22Smrgelse
2903e6bced22Smrg	m4_default([$3], :)
2904e6bced22Smrgfi
2905e6bced22Smrg]) # XORG_CHECK_LINKER_FLAGS
29062f167a42Smrg
2907e6bced22Smrg# XORG_MEMORY_CHECK_FLAGS
2908e6bced22Smrg# -----------------------
2909e6bced22Smrg# Minimum version: 1.16.0
2910e6bced22Smrg#
2911e6bced22Smrg# This macro attempts to find appropriate memory checking functionality
2912e6bced22Smrg# for various platforms which unit testing code may use to catch various
2913e6bced22Smrg# forms of memory allocation and access errors in testing.
2914e6bced22Smrg#
2915e6bced22Smrg# Interface to module:
2916e6bced22Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2917e6bced22Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2918e6bced22Smrg#
2919e6bced22Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2920e6bced22Smrg#
2921e6bced22SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
29222f167a42Smrg
2923e6bced22SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2924e6bced22SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2925e6bced22Smrg           [Environment variables to enable memory checking in tests])
2926fc34a306Smrg
2927e6bced22Smrg# Check for different types of support on different platforms
2928e6bced22Smrgcase $host_os in
2929e6bced22Smrg    solaris*)
2930e6bced22Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2931e6bced22Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2932e6bced22Smrg        ;;
2933e6bced22Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2934e6bced22Smrg        # both directly and inverted, so should not be 0 or 255.
2935e6bced22Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2936e6bced22Smrg        ;;
2937e6bced22Smrg    darwin*)
2938e6bced22Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2939e6bced22Smrg        ;;
2940e6bced22Smrg    *bsd*)
2941e6bced22Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2942e6bced22Smrg        ;;
2943e6bced22Smrgesac
2944fc34a306Smrg
2945e6bced22Smrg# User supplied flags override default flags
2946e6bced22Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2947e6bced22Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
29482f167a42Smrgfi
2949fc34a306Smrg
2950e6bced22SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2951e6bced22Smrg]) # XORG_WITH_LINT
2952fc34a306Smrg
2953e6bced22Smrg# XORG_CHECK_MALLOC_ZERO
2954e6bced22Smrg# ----------------------
2955e6bced22Smrg# Minimum version: 1.0.0
29562f167a42Smrg#
2957e6bced22Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2958e6bced22Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2959e6bced22Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
29608b648e79Smrg#
29618b648e79Smrg# No longer actually tests since there is no guarantee applications will
29628b648e79Smrg# run with the same malloc implementation we tested against, and the cost
29638b648e79Smrg# of always ensuring the size passed to malloc is non-zero is minimal now.
29648b648e79Smrg# Still allows builders to override when they have complete control over
29658b648e79Smrg# which malloc implementation will be used.
2966e6bced22SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2967e6bced22SmrgAC_ARG_ENABLE(malloc0returnsnull,
2968e6bced22Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
29698b648e79Smrg		       [malloc(0) returns NULL (default: yes)]),
2970e6bced22Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
29718b648e79Smrg	[MALLOC_ZERO_RETURNS_NULL=yes])
29720e20ee16Smrg
2973e6bced22SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2974e6bced22SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2975fc34a306Smrg
2976e6bced22Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2977e6bced22Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2978e6bced22Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2979e6bced22Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
29800e20ee16Smrgelse
2981e6bced22Smrg	MALLOC_ZERO_CFLAGS=""
2982e6bced22Smrg	XMALLOC_ZERO_CFLAGS=""
2983e6bced22Smrg	XTMALLOC_ZERO_CFLAGS=""
29840e20ee16Smrgfi
29850e20ee16Smrg
2986e6bced22SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2987e6bced22SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2988e6bced22SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2989e6bced22Smrg]) # XORG_CHECK_MALLOC_ZERO
29900e20ee16Smrg
2991e6bced22Smrg# XORG_WITH_LINT()
2992e6bced22Smrg# ----------------
2993e6bced22Smrg# Minimum version: 1.1.0
29943e6697d4Smrg#
2995e6bced22Smrg# This macro enables the use of a tool that flags some suspicious and
2996e6bced22Smrg# non-portable constructs (likely to be bugs) in C language source code.
2997e6bced22Smrg# It will attempt to locate the tool and use appropriate options.
2998e6bced22Smrg# There are various lint type tools on different platforms.
2999fc34a306Smrg#
3000e6bced22Smrg# Interface to module:
3001e6bced22Smrg# LINT:		returns the path to the tool found on the platform
3002e6bced22Smrg#		or the value set to LINT on the configure cmd line
3003e6bced22Smrg#		also an Automake conditional
3004e6bced22Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
3005e6bced22Smrg#
3006e6bced22Smrg# --with-lint:	'yes' user instructs the module to use lint
3007e6bced22Smrg#		'no' user instructs the module not to use lint (default)
3008e6bced22Smrg#
3009e6bced22Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
3010e6bced22Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
3011e6bced22Smrg#
3012e6bced22SmrgAC_DEFUN([XORG_WITH_LINT],[
3013fc34a306Smrg
3014e6bced22SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
3015e6bced22SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
3016e6bced22SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
3017e6bced22Smrg		[Use a lint-style source code checker (default: disabled)])],
3018e6bced22Smrg		[use_lint=$withval], [use_lint=no])
3019fc34a306Smrg
3020e6bced22Smrg# Obtain platform specific info like program name and options
3021e6bced22Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
3022e6bced22Smrgcase $host_os in
3023e6bced22Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
3024e6bced22Smrg	lint_name=splint
3025e6bced22Smrg	lint_options="-badflag"
3026e6bced22Smrg	;;
3027e6bced22Smrg  *freebsd* | *netbsd*)
3028e6bced22Smrg	lint_name=lint
3029e6bced22Smrg	lint_options="-u -b"
3030e6bced22Smrg	;;
3031e6bced22Smrg  *solaris*)
3032e6bced22Smrg	lint_name=lint
3033e6bced22Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
3034e6bced22Smrg	;;
3035e6bced22Smrgesac
3036e6bced22Smrg
3037e6bced22Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
3038e6bced22Smrgif test "x$use_lint" = x"yes" ; then
3039e6bced22Smrg   AC_PATH_PROG([LINT], [$lint_name])
3040e6bced22Smrg   if test "x$LINT" = "x"; then
3041e6bced22Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
3042e6bced22Smrg   fi
3043e6bced22Smrgelif test "x$use_lint" = x"no" ; then
3044e6bced22Smrg   if test "x$LINT" != "x"; then
3045e6bced22Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
3046e6bced22Smrg   fi
3047fc34a306Smrgelse
3048e6bced22Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
30493e6697d4Smrgfi
3050c75e344aSmrg
3051e6bced22Smrg# User supplied flags override default flags
3052e6bced22Smrgif test "x$LINT_FLAGS" != "x"; then
3053e6bced22Smrg   lint_options=$LINT_FLAGS
3054e6bced22Smrgfi
3055c75e344aSmrg
3056e6bced22SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
3057e6bced22SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
30583e6697d4Smrg
3059e6bced22Smrg]) # XORG_WITH_LINT
30603e6697d4Smrg
3061e6bced22Smrg# XORG_LINT_LIBRARY(LIBNAME)
3062e6bced22Smrg# --------------------------
3063e6bced22Smrg# Minimum version: 1.1.0
30642f167a42Smrg#
3065e6bced22Smrg# Sets up flags for building lint libraries for checking programs that call
3066e6bced22Smrg# functions in the library.
3067e6bced22Smrg#
3068e6bced22Smrg# Interface to module:
3069e6bced22Smrg# LINTLIB		- Automake variable with the name of lint library file to make
3070e6bced22Smrg# MAKE_LINT_LIB		- Automake conditional
3071e6bced22Smrg#
3072e6bced22Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
3073e6bced22Smrg#			  - 'no' user instructs the module not to create a lint library (default)
30742f167a42Smrg
3075e6bced22SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
3076e6bced22SmrgAC_REQUIRE([XORG_WITH_LINT])
3077e6bced22SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
3078e6bced22Smrg	[Create lint library (default: disabled)])],
3079e6bced22Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
3080e6bced22Smrg
3081e6bced22Smrgif test "x$make_lint_lib" = x"yes" ; then
3082e6bced22Smrg   LINTLIB=llib-l$1.ln
3083e6bced22Smrg   if test "x$LINT" = "x"; then
3084e6bced22Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
3085e6bced22Smrg   fi
3086e6bced22Smrgelif test "x$make_lint_lib" != x"no" ; then
3087e6bced22Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
30882f167a42Smrgfi
30892f167a42Smrg
3090e6bced22SmrgAC_SUBST(LINTLIB)
3091e6bced22SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
30922f167a42Smrg
3093e6bced22Smrg]) # XORG_LINT_LIBRARY
30942f167a42Smrg
3095e6bced22Smrg# XORG_COMPILER_BRAND
3096fc34a306Smrg# -------------------
3097e6bced22Smrg# Minimum version: 1.14.0
3098fc34a306Smrg#
3099e6bced22Smrg# Checks for various brands of compilers and sets flags as appropriate:
3100e6bced22Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
3101e6bced22Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
3102e6bced22Smrg#   clang compiler - sets CLANGCC to "yes"
3103e6bced22Smrg#   Intel compiler - sets INTELCC to "yes"
3104e6bced22Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
3105e6bced22Smrg#
3106e6bced22SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
3107e6bced22SmrgAC_LANG_CASE(
3108e6bced22Smrg	[C], [
31098b648e79Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
31108b648e79Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
31118b648e79Smrg		m4_version_prereq([2.70],
31128b648e79Smrg			[AC_REQUIRE([AC_PROG_CC])],
31138b648e79Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3114e6bced22Smrg	],
3115e6bced22Smrg	[C++], [
3116e6bced22Smrg		AC_REQUIRE([AC_PROG_CXX])
3117e6bced22Smrg	]
3118e6bced22Smrg)
3119e6bced22SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
3120e6bced22SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
3121e6bced22SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
3122e6bced22Smrg]) # XORG_COMPILER_BRAND
31232f167a42Smrg
3124e6bced22Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
3125fc34a306Smrg# ---------------
3126e6bced22Smrg# Minimum version: 1.16.0
3127e6bced22Smrg#
3128e6bced22Smrg# Test if the compiler works when passed the given flag as a command line argument.
31298b648e79Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
3130e6bced22Smrg# next flag in the list until there are no more options.
3131e6bced22Smrg#
3132e6bced22Smrg# Note that this does not guarantee that the compiler supports the flag as some
3133e6bced22Smrg# compilers will simply ignore arguments that they do not understand, but we do
3134e6bced22Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
3135e6bced22Smrg# -Werror=unused-command-line-argument
3136e6bced22Smrg#
3137e6bced22SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
3138e6bced22Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3139e6bced22Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3140fc34a306Smrg
3141e6bced22SmrgAC_LANG_COMPILER_REQUIRE
31422f167a42Smrg
3143e6bced22SmrgAC_LANG_CASE(
3144e6bced22Smrg	[C], [
31458b648e79Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
31468b648e79Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
31478b648e79Smrg		m4_version_prereq([2.70],
31488b648e79Smrg			[AC_REQUIRE([AC_PROG_CC])],
31498b648e79Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3150e6bced22Smrg		define([PREFIX], [C])
3151e6bced22Smrg		define([CACHE_PREFIX], [cc])
3152e6bced22Smrg		define([COMPILER], [$CC])
3153e6bced22Smrg	],
3154e6bced22Smrg	[C++], [
3155e6bced22Smrg		define([PREFIX], [CXX])
3156e6bced22Smrg		define([CACHE_PREFIX], [cxx])
3157e6bced22Smrg		define([COMPILER], [$CXX])
3158e6bced22Smrg	]
3159e6bced22Smrg)
3160e6bced22Smrg
3161e6bced22Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
3162e6bced22Smrg
3163e6bced22Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
3164e6bced22Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3165e6bced22Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
3166e6bced22Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3167e6bced22Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3168e6bced22Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
3169e6bced22Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
3170e6bced22Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
3171e6bced22Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3172fc34a306Smrgfi
3173e6bced22Smrg
3174e6bced22Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
3175e6bced22Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
3176e6bced22Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3177e6bced22Smrg	fi
3178e6bced22Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3179e6bced22Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
3180e6bced22Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3181e6bced22Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3182e6bced22Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
3183e6bced22Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
3184e6bced22Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
3185e6bced22Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3186fc34a306Smrgfi
3187e6bced22Smrg
3188e6bced22Smrgfound="no"
3189e6bced22Smrgm4_foreach([flag], m4_cdr($@), [
3190e6bced22Smrg	if test $found = "no" ; then
3191e6bced22Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
3192e6bced22Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3193e6bced22Smrg		fi
3194e6bced22Smrg
3195e6bced22Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
3196e6bced22Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3197e6bced22Smrg		fi
3198e6bced22Smrg
3199e6bced22Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
3200e6bced22Smrg
3201e6bced22Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
3202e6bced22Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
3203e6bced22Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
3204e6bced22Smrg		AC_CACHE_VAL($cacheid,
3205e6bced22Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3206e6bced22Smrg					     [eval $cacheid=yes],
3207e6bced22Smrg					     [eval $cacheid=no])])
3208e6bced22Smrg
3209e6bced22Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3210e6bced22Smrg
3211e6bced22Smrg		eval supported=\$$cacheid
3212e6bced22Smrg		AC_MSG_RESULT([$supported])
3213e6bced22Smrg		if test "$supported" = "yes" ; then
3214e6bced22Smrg			$1="$$1 ]flag["
3215e6bced22Smrg			found="yes"
3216e6bced22Smrg		fi
3217e6bced22Smrg	fi
32182f167a42Smrg])
3219e6bced22Smrg]) # XORG_TESTSET_CFLAG
32202f167a42Smrg
3221e6bced22Smrg# XORG_COMPILER_FLAGS
3222e6bced22Smrg# ---------------
3223e6bced22Smrg# Minimum version: 1.16.0
32242f167a42Smrg#
3225e6bced22Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
3226e6bced22Smrg# arguments supported by the selected compiler which do NOT alter the generated
3227e6bced22Smrg# code.  These arguments will cause the compiler to print various warnings
3228e6bced22Smrg# during compilation AND turn a conservative set of warnings into errors.
3229e6bced22Smrg#
3230e6bced22Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
3231e6bced22Smrg# future versions of util-macros as options are added to new compilers.
3232e6bced22Smrg#
3233e6bced22SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
3234e6bced22SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
32352f167a42Smrg
3236e6bced22SmrgAC_ARG_ENABLE(selective-werror,
3237e6bced22Smrg              AS_HELP_STRING([--disable-selective-werror],
3238e6bced22Smrg                             [Turn off selective compiler errors. (default: enabled)]),
3239e6bced22Smrg              [SELECTIVE_WERROR=$enableval],
3240e6bced22Smrg              [SELECTIVE_WERROR=yes])
3241e6bced22Smrg
3242e6bced22SmrgAC_LANG_CASE(
3243e6bced22Smrg        [C], [
3244e6bced22Smrg                define([PREFIX], [C])
3245e6bced22Smrg        ],
3246e6bced22Smrg        [C++], [
3247e6bced22Smrg                define([PREFIX], [CXX])
3248e6bced22Smrg        ]
3249e6bced22Smrg)
3250e6bced22Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
3251e6bced22Smrgif test "x$SUNCC" = "xyes"; then
3252e6bced22Smrg    [BASE_]PREFIX[FLAGS]="-v"
3253fc34a306Smrgelse
3254e6bced22Smrg    [BASE_]PREFIX[FLAGS]=""
32552f167a42Smrgfi
32562f167a42Smrg
3257e6bced22Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3258e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
3259e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
3260e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
3261e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
32622f167a42Smrg
3263e6bced22SmrgAC_LANG_CASE(
3264e6bced22Smrg	[C], [
3265e6bced22Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
3266e6bced22Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
3267e6bced22Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
3268e6bced22Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
3269e6bced22Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
3270e6bced22Smrg	]
3271e6bced22Smrg)
32722f167a42Smrg
3273e6bced22Smrg# This chunk adds additional warnings that could catch undesired effects.
3274e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
3275e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
3276e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
3277e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
3278e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
3279e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
3280e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
32812f167a42Smrg
3282e6bced22Smrg# These are currently disabled because they are noisy.  They will be enabled
3283e6bced22Smrg# in the future once the codebase is sufficiently modernized to silence
3284e6bced22Smrg# them.  For now, I don't want them to drown out the other warnings.
3285e6bced22Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3286e6bced22Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3287e6bced22Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
32882f167a42Smrg
32898b648e79Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
3290e6bced22Smrg# when there are problems that should be fixed.
32912f167a42Smrg
3292e6bced22Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3293e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3294e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3295e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3296e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3297e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3298e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3299e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3300e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3301e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3302e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3303e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3304e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3305e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3306e6bced22Smrgelse
3307e6bced22SmrgAC_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])
3308e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3309e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3310e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3311e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3312e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3313e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3314e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3315e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3316e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3317e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3318e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3319e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3320e6bced22SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3321e6bced22Smrgfi
33222f167a42Smrg
3323e6bced22SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3324e6bced22Smrg]) # XORG_COMPILER_FLAGS
33253e6697d4Smrg
3326e6bced22Smrg# XORG_CWARNFLAGS
3327e6bced22Smrg# ---------------
3328e6bced22Smrg# Minimum version: 1.2.0
3329e6bced22Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
33303e6697d4Smrg#
3331e6bced22Smrg# Defines CWARNFLAGS to enable C compiler warnings.
33322f167a42Smrg#
3333e6bced22Smrg# This function is deprecated because it defines -fno-strict-aliasing
3334e6bced22Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3335e6bced22Smrg# is needed, then it should be added explicitly in the module when
3336e6bced22Smrg# it is updated to use BASE_CFLAGS.
3337fc34a306Smrg#
3338e6bced22SmrgAC_DEFUN([XORG_CWARNFLAGS], [
3339e6bced22SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3340e6bced22SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3341e6bced22SmrgAC_LANG_CASE(
3342e6bced22Smrg	[C], [
3343e6bced22Smrg		CWARNFLAGS="$BASE_CFLAGS"
3344e6bced22Smrg		if  test "x$GCC" = xyes ; then
3345e6bced22Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3346e6bced22Smrg		fi
3347e6bced22Smrg		AC_SUBST(CWARNFLAGS)
3348e6bced22Smrg	]
3349e6bced22Smrg)
3350e6bced22Smrg]) # XORG_CWARNFLAGS
33512f167a42Smrg
3352e6bced22Smrg# XORG_STRICT_OPTION
3353e6bced22Smrg# -----------------------
3354e6bced22Smrg# Minimum version: 1.3.0
3355e6bced22Smrg#
3356e6bced22Smrg# Add configure option to enable strict compilation flags, such as treating
3357e6bced22Smrg# warnings as fatal errors.
3358e6bced22Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3359e6bced22Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3360e6bced22Smrg#
3361e6bced22Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3362e6bced22Smrg# when strict compilation is unconditionally desired.
3363e6bced22SmrgAC_DEFUN([XORG_STRICT_OPTION], [
3364e6bced22SmrgAC_REQUIRE([XORG_CWARNFLAGS])
3365e6bced22SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
33662f167a42Smrg
3367e6bced22SmrgAC_ARG_ENABLE(strict-compilation,
3368e6bced22Smrg			  AS_HELP_STRING([--enable-strict-compilation],
3369e6bced22Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3370e6bced22Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
33712f167a42Smrg
3372e6bced22SmrgAC_LANG_CASE(
3373e6bced22Smrg        [C], [
3374e6bced22Smrg                define([PREFIX], [C])
3375e6bced22Smrg        ],
3376e6bced22Smrg        [C++], [
3377e6bced22Smrg                define([PREFIX], [CXX])
3378e6bced22Smrg        ]
3379e6bced22Smrg)
33802f167a42Smrg
3381e6bced22Smrg[STRICT_]PREFIX[FLAGS]=""
3382e6bced22SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3383e6bced22SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
33843e6697d4Smrg
3385e6bced22Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3386e6bced22Smrg# activate it with -Werror, so we add it here explicitly.
3387e6bced22SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3388c75e344aSmrg
3389e6bced22Smrgif test "x$STRICT_COMPILE" = "xyes"; then
3390e6bced22Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3391e6bced22Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3392e6bced22Smrgfi
3393e6bced22SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3394e6bced22SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3395e6bced22SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3396e6bced22Smrg]) # XORG_STRICT_OPTION
33970e20ee16Smrg
33988b648e79Smrg# XORG_DEFAULT_NOCODE_OPTIONS
33998b648e79Smrg# ---------------------------
34008b648e79Smrg# Minimum version: 1.20.0
34018b648e79Smrg#
34028b648e79Smrg# Defines default options for X.Org modules which don't compile code,
34038b648e79Smrg# such as fonts, bitmaps, cursors, and docs.
34048b648e79Smrg#
34058b648e79SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
34068b648e79SmrgAC_REQUIRE([AC_PROG_INSTALL])
34078b648e79SmrgXORG_RELEASE_VERSION
34088b648e79SmrgXORG_CHANGELOG
34098b648e79SmrgXORG_INSTALL
34108b648e79SmrgXORG_MANPAGE_SECTIONS
34118b648e79Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
34128b648e79Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
34138b648e79Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
34148b648e79Smrg
3415e6bced22Smrg# XORG_DEFAULT_OPTIONS
3416e6bced22Smrg# --------------------
3417e6bced22Smrg# Minimum version: 1.3.0
3418e6bced22Smrg#
34198b648e79Smrg# Defines default options for X.Org modules which compile code.
3420e6bced22Smrg#
3421e6bced22SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3422e6bced22SmrgAC_REQUIRE([AC_PROG_INSTALL])
3423e6bced22SmrgXORG_COMPILER_FLAGS
3424e6bced22SmrgXORG_CWARNFLAGS
3425e6bced22SmrgXORG_STRICT_OPTION
34268b648e79SmrgXORG_DEFAULT_NOCODE_OPTIONS
3427e6bced22Smrg]) # XORG_DEFAULT_OPTIONS
34282f167a42Smrg
3429e6bced22Smrg# XORG_INSTALL()
3430e6bced22Smrg# ----------------
3431e6bced22Smrg# Minimum version: 1.4.0
3432e6bced22Smrg#
3433e6bced22Smrg# Defines the variable INSTALL_CMD as the command to copy
3434e6bced22Smrg# INSTALL from $prefix/share/util-macros.
3435e6bced22Smrg#
3436e6bced22SmrgAC_DEFUN([XORG_INSTALL], [
3437e6bced22SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3438e6bced22Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3439e6bced22SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3440e6bced22Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3441e6bced22Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3442e6bced22Smrgtouch \$(top_srcdir)/INSTALL; \
3443e6bced22Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3444e6bced22SmrgAC_SUBST([INSTALL_CMD])
3445e6bced22Smrg]) # XORG_INSTALL
3446e6bced22Smrgdnl Copyright 2005 Red Hat, Inc
3447e6bced22Smrgdnl
3448e6bced22Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3449e6bced22Smrgdnl documentation for any purpose is hereby granted without fee, provided that
3450e6bced22Smrgdnl the above copyright notice appear in all copies and that both that
3451e6bced22Smrgdnl copyright notice and this permission notice appear in supporting
3452e6bced22Smrgdnl documentation.
3453e6bced22Smrgdnl
3454e6bced22Smrgdnl The above copyright notice and this permission notice shall be included
3455e6bced22Smrgdnl in all copies or substantial portions of the Software.
3456e6bced22Smrgdnl
3457e6bced22Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3458e6bced22Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3459e6bced22Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3460e6bced22Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3461e6bced22Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3462e6bced22Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3463e6bced22Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3464e6bced22Smrgdnl
3465e6bced22Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3466e6bced22Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3467e6bced22Smrgdnl other dealings in this Software without prior written authorization
3468e6bced22Smrgdnl from the copyright holders.
3469e6bced22Smrgdnl
34700e20ee16Smrg
3471e6bced22Smrg# XORG_RELEASE_VERSION
3472e6bced22Smrg# --------------------
3473e6bced22Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3474fc34a306Smrg
3475e6bced22SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3476e6bced22Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3477e6bced22Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3478e6bced22Smrg		[Major version of this package])
3479e6bced22Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3480e6bced22Smrg	if test "x$PVM" = "x"; then
3481e6bced22Smrg		PVM="0"
3482e6bced22Smrg	fi
3483e6bced22Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3484e6bced22Smrg		[$PVM],
3485e6bced22Smrg		[Minor version of this package])
3486e6bced22Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3487e6bced22Smrg	if test "x$PVP" = "x"; then
3488e6bced22Smrg		PVP="0"
3489e6bced22Smrg	fi
3490e6bced22Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3491e6bced22Smrg		[$PVP],
3492e6bced22Smrg		[Patch version of this package])
3493e6bced22Smrg])
3494fc34a306Smrg
3495e6bced22Smrg# XORG_CHANGELOG()
3496e6bced22Smrg# ----------------
3497e6bced22Smrg# Minimum version: 1.2.0
3498e6bced22Smrg#
3499e6bced22Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3500e6bced22Smrg# ChangeLog from git.
3501e6bced22Smrg#
3502e6bced22Smrg#
3503e6bced22SmrgAC_DEFUN([XORG_CHANGELOG], [
3504e6bced22SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3505e6bced22Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3506e6bced22Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3507e6bced22Smrgtouch \$(top_srcdir)/ChangeLog; \
3508e6bced22Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3509e6bced22SmrgAC_SUBST([CHANGELOG_CMD])
3510e6bced22Smrg]) # XORG_CHANGELOG
35113e6697d4Smrg
3512