aclocal.m4 revision 6ee7d557
16ee7d557Smrg# generated automatically by aclocal 1.17 -*- Autoconf -*-
289c04b6cSmrg
36ee7d557Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
41f0ac6a5Smrg
51f0ac6a5Smrg# This file is free software; the Free Software Foundation
61f0ac6a5Smrg# gives unlimited permission to copy and/or distribute it,
71f0ac6a5Smrg# with or without modifications, as long as this notice is preserved.
81f0ac6a5Smrg
91f0ac6a5Smrg# This program is distributed in the hope that it will be useful,
101f0ac6a5Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
111f0ac6a5Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
121f0ac6a5Smrg# PARTICULAR PURPOSE.
131f0ac6a5Smrg
1489c04b6cSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15e5410a46Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16e5410a46Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
176ee7d557Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
186ee7d557Smrg[m4_warning([this file was generated for autoconf 2.72.
19e5410a46SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20e5410a46SmrgIf you have problems, you may need to regenerate the build system entirely.
2189c04b6cSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
221f0ac6a5Smrg
236ee7d557Smrg# Copyright (C) 2002-2024 Free Software Foundation, Inc.
241f0ac6a5Smrg#
25d21ab8bcSmrg# This file is free software; the Free Software Foundation
26d21ab8bcSmrg# gives unlimited permission to copy and/or distribute it,
27d21ab8bcSmrg# with or without modifications, as long as this notice is preserved.
28d21ab8bcSmrg
29d21ab8bcSmrg# AM_AUTOMAKE_VERSION(VERSION)
30d21ab8bcSmrg# ----------------------------
31d21ab8bcSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32d21ab8bcSmrg# generated from the m4 files accompanying Automake X.Y.
33d21ab8bcSmrg# (This private macro should not be called outside this file.)
34d21ab8bcSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
356ee7d557Smrg[am__api_version='1.17'
36d21ab8bcSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37d21ab8bcSmrgdnl require some minimum version.  Point them to the right macro.
386ee7d557Smrgm4_if([$1], [1.17], [],
39d21ab8bcSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40d21ab8bcSmrg])
41d21ab8bcSmrg
42d21ab8bcSmrg# _AM_AUTOCONF_VERSION(VERSION)
43d21ab8bcSmrg# -----------------------------
44d21ab8bcSmrg# aclocal traces this macro to find the Autoconf version.
45d21ab8bcSmrg# This is a private macro too.  Using m4_define simplifies
46d21ab8bcSmrg# the logic in aclocal, which can simply ignore this definition.
47d21ab8bcSmrgm4_define([_AM_AUTOCONF_VERSION], [])
48d21ab8bcSmrg
49d21ab8bcSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50d21ab8bcSmrg# -------------------------------
51d21ab8bcSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52d21ab8bcSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53d21ab8bcSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
546ee7d557Smrg[AM_AUTOMAKE_VERSION([1.17])dnl
55d21ab8bcSmrgm4_ifndef([AC_AUTOCONF_VERSION],
56d21ab8bcSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57d21ab8bcSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58d21ab8bcSmrg
59d21ab8bcSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60d21ab8bcSmrg
616ee7d557Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
62e5410a46Smrg#
63d21ab8bcSmrg# This file is free software; the Free Software Foundation
64d21ab8bcSmrg# gives unlimited permission to copy and/or distribute it,
65d21ab8bcSmrg# with or without modifications, as long as this notice is preserved.
661f0ac6a5Smrg
67d21ab8bcSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68d21ab8bcSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69d21ab8bcSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
701f0ac6a5Smrg#
71d21ab8bcSmrg# Of course, Automake must honor this variable whenever it calls a
72d21ab8bcSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73d21ab8bcSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74d21ab8bcSmrg# depending on how configure is run.  This is pretty annoying, since
75d21ab8bcSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76d21ab8bcSmrg# source directory, any form will work fine, but in subdirectories a
77d21ab8bcSmrg# relative path needs to be adjusted first.
781f0ac6a5Smrg#
79d21ab8bcSmrg# $ac_aux_dir/missing
80d21ab8bcSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81d21ab8bcSmrg# $top_srcdir/$ac_aux_dir/missing
82d21ab8bcSmrg#    fails if $ac_aux_dir is absolute,
83d21ab8bcSmrg#    fails when called from a subdirectory in a VPATH build with
84d21ab8bcSmrg#          a relative $ac_aux_dir
851f0ac6a5Smrg#
86d21ab8bcSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87d21ab8bcSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
88d21ab8bcSmrg# harmless because $srcdir is '.', but things will broke when you
89d21ab8bcSmrg# start a VPATH build or use an absolute $srcdir.
901f0ac6a5Smrg#
91d21ab8bcSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92d21ab8bcSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93d21ab8bcSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94d21ab8bcSmrg# and then we would define $MISSING as
95d21ab8bcSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96d21ab8bcSmrg# This will work as long as MISSING is not called from configure, because
97d21ab8bcSmrg# unfortunately $(top_srcdir) has no meaning in configure.
98d21ab8bcSmrg# However there are other variables, like CC, which are often used in
99d21ab8bcSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100e5410a46Smrg#
101d21ab8bcSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
102d21ab8bcSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
103d21ab8bcSmrg# configured tree to be moved without reconfiguration.
1042fd96bc7Smrg
105d21ab8bcSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106d21ab8bcSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107d21ab8bcSmrg# Expand $ac_aux_dir to an absolute path.
108d21ab8bcSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109e5410a46Smrg])
1101f0ac6a5Smrg
111d21ab8bcSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1121f0ac6a5Smrg
1136ee7d557Smrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
114d21ab8bcSmrg#
115d21ab8bcSmrg# This file is free software; the Free Software Foundation
116d21ab8bcSmrg# gives unlimited permission to copy and/or distribute it,
117d21ab8bcSmrg# with or without modifications, as long as this notice is preserved.
1181f0ac6a5Smrg
119d21ab8bcSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120d21ab8bcSmrg# -------------------------------------
121d21ab8bcSmrg# Define a conditional.
122d21ab8bcSmrgAC_DEFUN([AM_CONDITIONAL],
123d21ab8bcSmrg[AC_PREREQ([2.52])dnl
124d21ab8bcSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
125d21ab8bcSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126d21ab8bcSmrgAC_SUBST([$1_TRUE])dnl
127d21ab8bcSmrgAC_SUBST([$1_FALSE])dnl
128d21ab8bcSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129d21ab8bcSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130d21ab8bcSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131d21ab8bcSmrgif $2; then
132d21ab8bcSmrg  $1_TRUE=
133d21ab8bcSmrg  $1_FALSE='#'
134d21ab8bcSmrgelse
135d21ab8bcSmrg  $1_TRUE='#'
136d21ab8bcSmrg  $1_FALSE=
137d21ab8bcSmrgfi
138d21ab8bcSmrgAC_CONFIG_COMMANDS_PRE(
139d21ab8bcSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140d21ab8bcSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141d21ab8bcSmrgUsually this means the macro was only invoked conditionally.]])
142d21ab8bcSmrgfi])])
1431f0ac6a5Smrg
1446ee7d557Smrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
145d21ab8bcSmrg#
146d21ab8bcSmrg# This file is free software; the Free Software Foundation
147d21ab8bcSmrg# gives unlimited permission to copy and/or distribute it,
148d21ab8bcSmrg# with or without modifications, as long as this notice is preserved.
1491f0ac6a5Smrg
1501f0ac6a5Smrg
151d21ab8bcSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
152d21ab8bcSmrg# written in clear, in which case automake, when reading aclocal.m4,
153d21ab8bcSmrg# will think it sees a *use*, and therefore will trigger all it's
154d21ab8bcSmrg# C support machinery.  Also note that it means that autoscan, seeing
155d21ab8bcSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1561f0ac6a5Smrg
1571f0ac6a5Smrg
158d21ab8bcSmrg# _AM_DEPENDENCIES(NAME)
159d21ab8bcSmrg# ----------------------
160d21ab8bcSmrg# See how the compiler implements dependency checking.
161d21ab8bcSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
162d21ab8bcSmrg# We try a few techniques and use that to set a single cache variable.
163d21ab8bcSmrg#
164d21ab8bcSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
165d21ab8bcSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
166d21ab8bcSmrg# dependency, and given that the user is not expected to run this macro,
167d21ab8bcSmrg# just rely on AC_PROG_CC.
168d21ab8bcSmrgAC_DEFUN([_AM_DEPENDENCIES],
169d21ab8bcSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
170d21ab8bcSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
171d21ab8bcSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
172d21ab8bcSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1731f0ac6a5Smrg
174d21ab8bcSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
175d21ab8bcSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
176d21ab8bcSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
177d21ab8bcSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
178d21ab8bcSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
179d21ab8bcSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
180d21ab8bcSmrg                    [depcc="$$1"   am_compiler_list=])
1811f0ac6a5Smrg
182d21ab8bcSmrgAC_CACHE_CHECK([dependency style of $depcc],
183d21ab8bcSmrg               [am_cv_$1_dependencies_compiler_type],
184d21ab8bcSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
185d21ab8bcSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
186d21ab8bcSmrg  # making bogus files that we don't know about and never remove.  For
187d21ab8bcSmrg  # instance it was reported that on HP-UX the gcc test will end up
188d21ab8bcSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
189d21ab8bcSmrg  # in D".
190d21ab8bcSmrg  rm -rf conftest.dir
191d21ab8bcSmrg  mkdir conftest.dir
192d21ab8bcSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
193d21ab8bcSmrg  # using a relative directory.
194d21ab8bcSmrg  cp "$am_depcomp" conftest.dir
195d21ab8bcSmrg  cd conftest.dir
196d21ab8bcSmrg  # We will build objects and dependencies in a subdirectory because
197d21ab8bcSmrg  # it helps to detect inapplicable dependency modes.  For instance
198d21ab8bcSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
199d21ab8bcSmrg  # side effect of compilation, but ICC will put the dependencies in
200d21ab8bcSmrg  # the current directory while Tru64 will put them in the object
201d21ab8bcSmrg  # directory.
202d21ab8bcSmrg  mkdir sub
2031f0ac6a5Smrg
204d21ab8bcSmrg  am_cv_$1_dependencies_compiler_type=none
205d21ab8bcSmrg  if test "$am_compiler_list" = ""; then
206d21ab8bcSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
207d21ab8bcSmrg  fi
208d21ab8bcSmrg  am__universal=false
209d21ab8bcSmrg  m4_case([$1], [CC],
210d21ab8bcSmrg    [case " $depcc " in #(
211d21ab8bcSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212d21ab8bcSmrg     esac],
213d21ab8bcSmrg    [CXX],
214d21ab8bcSmrg    [case " $depcc " in #(
215d21ab8bcSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216d21ab8bcSmrg     esac])
217e5410a46Smrg
218d21ab8bcSmrg  for depmode in $am_compiler_list; do
219d21ab8bcSmrg    # Setup a source with many dependencies, because some compilers
220d21ab8bcSmrg    # like to wrap large dependency lists on column 80 (with \), and
221d21ab8bcSmrg    # we should not choose a depcomp mode which is confused by this.
222d21ab8bcSmrg    #
223d21ab8bcSmrg    # We need to recreate these files for each test, as the compiler may
224d21ab8bcSmrg    # overwrite some of them when testing with obscure command lines.
225d21ab8bcSmrg    # This happens at least with the AIX C compiler.
226d21ab8bcSmrg    : > sub/conftest.c
227d21ab8bcSmrg    for i in 1 2 3 4 5 6; do
228d21ab8bcSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
229d21ab8bcSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
230d21ab8bcSmrg      # Solaris 10 /bin/sh.
231d21ab8bcSmrg      echo '/* dummy */' > sub/conftst$i.h
232d21ab8bcSmrg    done
233d21ab8bcSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234e5410a46Smrg
235d21ab8bcSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236d21ab8bcSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
237d21ab8bcSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
238d21ab8bcSmrg    # versions had trouble with output in subdirs.
239d21ab8bcSmrg    am__obj=sub/conftest.${OBJEXT-o}
240d21ab8bcSmrg    am__minus_obj="-o $am__obj"
241d21ab8bcSmrg    case $depmode in
242d21ab8bcSmrg    gcc)
243d21ab8bcSmrg      # This depmode causes a compiler race in universal mode.
244d21ab8bcSmrg      test "$am__universal" = false || continue
245d21ab8bcSmrg      ;;
246d21ab8bcSmrg    nosideeffect)
247d21ab8bcSmrg      # After this tag, mechanisms are not by side-effect, so they'll
248d21ab8bcSmrg      # only be used when explicitly requested.
249d21ab8bcSmrg      if test "x$enable_dependency_tracking" = xyes; then
250d21ab8bcSmrg	continue
251d21ab8bcSmrg      else
252d21ab8bcSmrg	break
253d21ab8bcSmrg      fi
254d21ab8bcSmrg      ;;
255d21ab8bcSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
256d21ab8bcSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
257d21ab8bcSmrg      # not run yet.  These depmodes are late enough in the game, and
258d21ab8bcSmrg      # so weak that their functioning should not be impacted.
259d21ab8bcSmrg      am__obj=conftest.${OBJEXT-o}
260d21ab8bcSmrg      am__minus_obj=
261d21ab8bcSmrg      ;;
262d21ab8bcSmrg    none) break ;;
263d21ab8bcSmrg    esac
264d21ab8bcSmrg    if depmode=$depmode \
265d21ab8bcSmrg       source=sub/conftest.c object=$am__obj \
266d21ab8bcSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267d21ab8bcSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
268d21ab8bcSmrg         >/dev/null 2>conftest.err &&
269d21ab8bcSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
270d21ab8bcSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271d21ab8bcSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
272d21ab8bcSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
273d21ab8bcSmrg      # icc doesn't choke on unknown options, it will just issue warnings
274d21ab8bcSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
275d21ab8bcSmrg      # that says an option was ignored or not supported.
2766ee7d557Smrg      # When given -MP, icc 7.0 and 7.1 complain thus:
277d21ab8bcSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
278d21ab8bcSmrg      # The diagnosis changed in icc 8.0:
279d21ab8bcSmrg      #   icc: Command line remark: option '-MP' not supported
280d21ab8bcSmrg      if (grep 'ignoring option' conftest.err ||
281d21ab8bcSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
282d21ab8bcSmrg        am_cv_$1_dependencies_compiler_type=$depmode
283d21ab8bcSmrg        break
284d21ab8bcSmrg      fi
285d21ab8bcSmrg    fi
286d21ab8bcSmrg  done
287d21ab8bcSmrg
288d21ab8bcSmrg  cd ..
289d21ab8bcSmrg  rm -rf conftest.dir
290d21ab8bcSmrgelse
291d21ab8bcSmrg  am_cv_$1_dependencies_compiler_type=none
292d21ab8bcSmrgfi
293d21ab8bcSmrg])
294d21ab8bcSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
295d21ab8bcSmrgAM_CONDITIONAL([am__fastdep$1], [
296d21ab8bcSmrg  test "x$enable_dependency_tracking" != xno \
297d21ab8bcSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298d21ab8bcSmrg])
2991f0ac6a5Smrg
300e5410a46Smrg
301d21ab8bcSmrg# AM_SET_DEPDIR
302d21ab8bcSmrg# -------------
303d21ab8bcSmrg# Choose a directory name for dependency files.
304d21ab8bcSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
305d21ab8bcSmrgAC_DEFUN([AM_SET_DEPDIR],
306d21ab8bcSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
307d21ab8bcSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
308d21ab8bcSmrg])
309e5410a46Smrg
310e5410a46Smrg
311d21ab8bcSmrg# AM_DEP_TRACK
312d21ab8bcSmrg# ------------
313d21ab8bcSmrgAC_DEFUN([AM_DEP_TRACK],
314d21ab8bcSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
315d21ab8bcSmrgAS_HELP_STRING(
316d21ab8bcSmrg  [--enable-dependency-tracking],
317d21ab8bcSmrg  [do not reject slow dependency extractors])
318d21ab8bcSmrgAS_HELP_STRING(
319d21ab8bcSmrg  [--disable-dependency-tracking],
320d21ab8bcSmrg  [speeds up one-time build])])
321d21ab8bcSmrgif test "x$enable_dependency_tracking" != xno; then
322d21ab8bcSmrg  am_depcomp="$ac_aux_dir/depcomp"
323d21ab8bcSmrg  AMDEPBACKSLASH='\'
324d21ab8bcSmrg  am__nodep='_no'
3251f0ac6a5Smrgfi
326d21ab8bcSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
327d21ab8bcSmrgAC_SUBST([AMDEPBACKSLASH])dnl
328d21ab8bcSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
329d21ab8bcSmrgAC_SUBST([am__nodep])dnl
330d21ab8bcSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
331e5410a46Smrg])
3321f0ac6a5Smrg
333d21ab8bcSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334e5410a46Smrg
3356ee7d557Smrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
336d21ab8bcSmrg#
337d21ab8bcSmrg# This file is free software; the Free Software Foundation
338d21ab8bcSmrg# gives unlimited permission to copy and/or distribute it,
339d21ab8bcSmrg# with or without modifications, as long as this notice is preserved.
3401f0ac6a5Smrg
341d21ab8bcSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
342d21ab8bcSmrg# ------------------------------
343d21ab8bcSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
344d21ab8bcSmrg[{
345d21ab8bcSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
346d21ab8bcSmrg  # are listed without --file.  Let's play safe and only enable the eval
347d21ab8bcSmrg  # if we detect the quoting.
348d21ab8bcSmrg  # TODO: see whether this extra hack can be removed once we start
349d21ab8bcSmrg  # requiring Autoconf 2.70 or later.
350d21ab8bcSmrg  AS_CASE([$CONFIG_FILES],
351d21ab8bcSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
352d21ab8bcSmrg          [*], [set x $CONFIG_FILES])
353d21ab8bcSmrg  shift
354d21ab8bcSmrg  # Used to flag and report bootstrapping failures.
355d21ab8bcSmrg  am_rc=0
356d21ab8bcSmrg  for am_mf
357d21ab8bcSmrg  do
358d21ab8bcSmrg    # Strip MF so we end up with the name of the file.
359d21ab8bcSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
360d21ab8bcSmrg    # Check whether this is an Automake generated Makefile which includes
361d21ab8bcSmrg    # dependency-tracking related rules and includes.
362d21ab8bcSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
363d21ab8bcSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
364d21ab8bcSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
365d21ab8bcSmrg      || continue
366d21ab8bcSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
367d21ab8bcSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
368d21ab8bcSmrg    AM_RUN_LOG([cd "$am_dirpart" \
369d21ab8bcSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
370d21ab8bcSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
371d21ab8bcSmrg  done
372d21ab8bcSmrg  if test $am_rc -ne 0; then
373d21ab8bcSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
374d21ab8bcSmrg    for automatic dependency tracking.  If GNU make was not used, consider
375d21ab8bcSmrg    re-running the configure script with MAKE="gmake" (or whatever is
376d21ab8bcSmrg    necessary).  You can also try re-running configure with the
377d21ab8bcSmrg    '--disable-dependency-tracking' option to at least be able to build
378d21ab8bcSmrg    the package (albeit without support for automatic dependency tracking).])
3792fd96bc7Smrg  fi
380d21ab8bcSmrg  AS_UNSET([am_dirpart])
381d21ab8bcSmrg  AS_UNSET([am_filepart])
382d21ab8bcSmrg  AS_UNSET([am_mf])
383d21ab8bcSmrg  AS_UNSET([am_rc])
384d21ab8bcSmrg  rm -f conftest-deps.mk
385d21ab8bcSmrg}
386d21ab8bcSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3871f0ac6a5Smrg
3881f0ac6a5Smrg
389d21ab8bcSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
390d21ab8bcSmrg# -----------------------------
391d21ab8bcSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
392d21ab8bcSmrg#
393d21ab8bcSmrg# This code is only required when automatic dependency tracking is enabled.
394d21ab8bcSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
395d21ab8bcSmrg# order to bootstrap the dependency handling code.
396d21ab8bcSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
397d21ab8bcSmrg[AC_CONFIG_COMMANDS([depfiles],
398d21ab8bcSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
399d21ab8bcSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
4001f0ac6a5Smrg
401d21ab8bcSmrg# Do all the work for Automake.                             -*- Autoconf -*-
402e5410a46Smrg
4036ee7d557Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
404d21ab8bcSmrg#
405d21ab8bcSmrg# This file is free software; the Free Software Foundation
406d21ab8bcSmrg# gives unlimited permission to copy and/or distribute it,
407d21ab8bcSmrg# with or without modifications, as long as this notice is preserved.
408e5410a46Smrg
409d21ab8bcSmrg# This macro actually does too much.  Some checks are only needed if
410d21ab8bcSmrg# your package does certain things.  But this isn't really a big deal.
411e5410a46Smrg
412d21ab8bcSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
413d21ab8bcSmrgm4_define([AC_PROG_CC],
414d21ab8bcSmrgm4_defn([AC_PROG_CC])
415d21ab8bcSmrg[_AM_PROG_CC_C_O
416d21ab8bcSmrg])
417b9867631Smrg
418d21ab8bcSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
419d21ab8bcSmrg# AM_INIT_AUTOMAKE([OPTIONS])
420d21ab8bcSmrg# -----------------------------------------------
421d21ab8bcSmrg# The call with PACKAGE and VERSION arguments is the old style
422d21ab8bcSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
423d21ab8bcSmrg# and VERSION should now be passed to AC_INIT and removed from
424d21ab8bcSmrg# the call to AM_INIT_AUTOMAKE.
425d21ab8bcSmrg# We support both call styles for the transition.  After
426d21ab8bcSmrg# the next Automake release, Autoconf can make the AC_INIT
427d21ab8bcSmrg# arguments mandatory, and then we can depend on a new Autoconf
428d21ab8bcSmrg# release and drop the old call support.
429d21ab8bcSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
430d21ab8bcSmrg[AC_PREREQ([2.65])dnl
431d21ab8bcSmrgm4_ifdef([_$0_ALREADY_INIT],
432d21ab8bcSmrg  [m4_fatal([$0 expanded multiple times
433d21ab8bcSmrg]m4_defn([_$0_ALREADY_INIT]))],
434d21ab8bcSmrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
435d21ab8bcSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
436d21ab8bcSmrgdnl the ones we care about.
437d21ab8bcSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
438d21ab8bcSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
439d21ab8bcSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
440d21ab8bcSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
441d21ab8bcSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
442d21ab8bcSmrg  # is not polluted with repeated "-I."
443d21ab8bcSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
444d21ab8bcSmrg  # test to see if srcdir already configured
445d21ab8bcSmrg  if test -f $srcdir/config.status; then
446d21ab8bcSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
447e5410a46Smrg  fi
448d21ab8bcSmrgfi
449e5410a46Smrg
450d21ab8bcSmrg# test whether we have cygpath
451d21ab8bcSmrgif test -z "$CYGPATH_W"; then
452d21ab8bcSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
453d21ab8bcSmrg    CYGPATH_W='cygpath -w'
454d21ab8bcSmrg  else
455d21ab8bcSmrg    CYGPATH_W=echo
456d21ab8bcSmrg  fi
457d21ab8bcSmrgfi
458d21ab8bcSmrgAC_SUBST([CYGPATH_W])
459e5410a46Smrg
460d21ab8bcSmrg# Define the identity of the package.
461d21ab8bcSmrgdnl Distinguish between old-style and new-style calls.
462d21ab8bcSmrgm4_ifval([$2],
463d21ab8bcSmrg[AC_DIAGNOSE([obsolete],
464d21ab8bcSmrg             [$0: two- and three-arguments forms are deprecated.])
465d21ab8bcSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
466d21ab8bcSmrg AC_SUBST([PACKAGE], [$1])dnl
467d21ab8bcSmrg AC_SUBST([VERSION], [$2])],
468d21ab8bcSmrg[_AM_SET_OPTIONS([$1])dnl
469d21ab8bcSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
470d21ab8bcSmrgm4_if(
471d21ab8bcSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
472d21ab8bcSmrg  [ok:ok],,
473d21ab8bcSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
474d21ab8bcSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
475d21ab8bcSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476b9867631Smrg
477d21ab8bcSmrg_AM_IF_OPTION([no-define],,
478d21ab8bcSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
479d21ab8bcSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480b9867631Smrg
481d21ab8bcSmrg# Some tools Automake needs.
482d21ab8bcSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
483d21ab8bcSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
484d21ab8bcSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
485d21ab8bcSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
486d21ab8bcSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
487d21ab8bcSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
488d21ab8bcSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
489d21ab8bcSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
490d21ab8bcSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
491d21ab8bcSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
492d21ab8bcSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
493d21ab8bcSmrg# dies out for good.  For more background, see:
494d21ab8bcSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
495d21ab8bcSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
496d21ab8bcSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
497d21ab8bcSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
498d21ab8bcSmrg# system "awk" is bad on some platforms.
499d21ab8bcSmrgAC_REQUIRE([AC_PROG_AWK])dnl
500d21ab8bcSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
501d21ab8bcSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
502d21ab8bcSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
503d21ab8bcSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
504d21ab8bcSmrg			     [_AM_PROG_TAR([v7])])])
505d21ab8bcSmrg_AM_IF_OPTION([no-dependencies],,
506d21ab8bcSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
507d21ab8bcSmrg		  [_AM_DEPENDENCIES([CC])],
508d21ab8bcSmrg		  [m4_define([AC_PROG_CC],
509d21ab8bcSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
510d21ab8bcSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
511d21ab8bcSmrg		  [_AM_DEPENDENCIES([CXX])],
512d21ab8bcSmrg		  [m4_define([AC_PROG_CXX],
513d21ab8bcSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
514d21ab8bcSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
515d21ab8bcSmrg		  [_AM_DEPENDENCIES([OBJC])],
516d21ab8bcSmrg		  [m4_define([AC_PROG_OBJC],
517d21ab8bcSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
518d21ab8bcSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
519d21ab8bcSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
520d21ab8bcSmrg		  [m4_define([AC_PROG_OBJCXX],
521d21ab8bcSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5222fd96bc7Smrg])
523d21ab8bcSmrg# Variables for tags utilities; see am/tags.am
524d21ab8bcSmrgif test -z "$CTAGS"; then
525d21ab8bcSmrg  CTAGS=ctags
526d21ab8bcSmrgfi
527d21ab8bcSmrgAC_SUBST([CTAGS])
528d21ab8bcSmrgif test -z "$ETAGS"; then
529d21ab8bcSmrg  ETAGS=etags
530d21ab8bcSmrgfi
531d21ab8bcSmrgAC_SUBST([ETAGS])
532d21ab8bcSmrgif test -z "$CSCOPE"; then
533d21ab8bcSmrg  CSCOPE=cscope
534d21ab8bcSmrgfi
535d21ab8bcSmrgAC_SUBST([CSCOPE])
536b9867631Smrg
5376ee7d557SmrgAC_REQUIRE([_AM_SILENT_RULES])dnl
538d21ab8bcSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
539d21ab8bcSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
540d21ab8bcSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
541d21ab8bcSmrgAC_CONFIG_COMMANDS_PRE(dnl
542d21ab8bcSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
543d21ab8bcSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
544b9867631Smrg
5456ee7d557SmrgAC_REQUIRE([_AM_PROG_RM_F])
5466ee7d557SmrgAC_REQUIRE([_AM_PROG_XARGS_N])
5471f0ac6a5Smrg
548d21ab8bcSmrgdnl The trailing newline in this macro's definition is deliberate, for
549d21ab8bcSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
550d21ab8bcSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
551d21ab8bcSmrg])
5521f0ac6a5Smrg
553d21ab8bcSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
554d21ab8bcSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
555d21ab8bcSmrgdnl mangled by Autoconf and run in a shell conditional statement.
556d21ab8bcSmrgm4_define([_AC_COMPILER_EXEEXT],
557d21ab8bcSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5581f0ac6a5Smrg
559d21ab8bcSmrg# When config.status generates a header, we must update the stamp-h file.
560d21ab8bcSmrg# This file resides in the same directory as the config header
561d21ab8bcSmrg# that is generated.  The stamp files are numbered to have different names.
5621f0ac6a5Smrg
563d21ab8bcSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
564d21ab8bcSmrg# loop where config.status creates the headers, so we can generate
565d21ab8bcSmrg# our stamp files there.
566d21ab8bcSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
567d21ab8bcSmrg[# Compute $1's index in $config_headers.
568d21ab8bcSmrg_am_arg=$1
569d21ab8bcSmrg_am_stamp_count=1
570d21ab8bcSmrgfor _am_header in $config_headers :; do
571d21ab8bcSmrg  case $_am_header in
572d21ab8bcSmrg    $_am_arg | $_am_arg:* )
573d21ab8bcSmrg      break ;;
574d21ab8bcSmrg    * )
575d21ab8bcSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
576d21ab8bcSmrg  esac
577d21ab8bcSmrgdone
578d21ab8bcSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
579e5410a46Smrg
5806ee7d557Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
581d21ab8bcSmrg#
582d21ab8bcSmrg# This file is free software; the Free Software Foundation
583d21ab8bcSmrg# gives unlimited permission to copy and/or distribute it,
584d21ab8bcSmrg# with or without modifications, as long as this notice is preserved.
585e5410a46Smrg
586d21ab8bcSmrg# AM_PROG_INSTALL_SH
587d21ab8bcSmrg# ------------------
588d21ab8bcSmrg# Define $install_sh.
589d21ab8bcSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
590d21ab8bcSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
591d21ab8bcSmrgif test x"${install_sh+set}" != xset; then
592d21ab8bcSmrg  case $am_aux_dir in
593d21ab8bcSmrg  *\ * | *\	*)
594d21ab8bcSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
595d21ab8bcSmrg  *)
596d21ab8bcSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
597d21ab8bcSmrg  esac
598d21ab8bcSmrgfi
599d21ab8bcSmrgAC_SUBST([install_sh])])
6001f0ac6a5Smrg
6016ee7d557Smrg# Copyright (C) 2003-2024 Free Software Foundation, Inc.
602d21ab8bcSmrg#
603d21ab8bcSmrg# This file is free software; the Free Software Foundation
604d21ab8bcSmrg# gives unlimited permission to copy and/or distribute it,
605d21ab8bcSmrg# with or without modifications, as long as this notice is preserved.
6061f0ac6a5Smrg
607d21ab8bcSmrg# Check whether the underlying file-system supports filenames
608d21ab8bcSmrg# with a leading dot.  For instance MS-DOS doesn't.
609d21ab8bcSmrgAC_DEFUN([AM_SET_LEADING_DOT],
610d21ab8bcSmrg[rm -rf .tst 2>/dev/null
611d21ab8bcSmrgmkdir .tst 2>/dev/null
612d21ab8bcSmrgif test -d .tst; then
613d21ab8bcSmrg  am__leading_dot=.
614d21ab8bcSmrgelse
615d21ab8bcSmrg  am__leading_dot=_
616d21ab8bcSmrgfi
617d21ab8bcSmrgrmdir .tst 2>/dev/null
618d21ab8bcSmrgAC_SUBST([am__leading_dot])])
619e5410a46Smrg
620d21ab8bcSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6211f0ac6a5Smrg
6226ee7d557Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
623d21ab8bcSmrg#
624d21ab8bcSmrg# This file is free software; the Free Software Foundation
625d21ab8bcSmrg# gives unlimited permission to copy and/or distribute it,
626d21ab8bcSmrg# with or without modifications, as long as this notice is preserved.
6271f0ac6a5Smrg
628d21ab8bcSmrg# AM_MAKE_INCLUDE()
629d21ab8bcSmrg# -----------------
630d21ab8bcSmrg# Check whether make has an 'include' directive that can support all
631d21ab8bcSmrg# the idioms we need for our automatic dependency tracking code.
632d21ab8bcSmrgAC_DEFUN([AM_MAKE_INCLUDE],
633d21ab8bcSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
634d21ab8bcSmrgcat > confinc.mk << 'END'
635d21ab8bcSmrgam__doit:
636d21ab8bcSmrg	@echo this is the am__doit target >confinc.out
637d21ab8bcSmrg.PHONY: am__doit
638d21ab8bcSmrgEND
639d21ab8bcSmrgam__include="#"
640d21ab8bcSmrgam__quote=
641d21ab8bcSmrg# BSD make does it like this.
642d21ab8bcSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
643d21ab8bcSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
644d21ab8bcSmrgecho 'include confinc.mk # ignored' > confmf.GNU
645d21ab8bcSmrg_am_result=no
646d21ab8bcSmrgfor s in GNU BSD; do
647d21ab8bcSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
648d21ab8bcSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
649d21ab8bcSmrg      ['0:this is the am__doit target'],
650d21ab8bcSmrg      [AS_CASE([$s],
651d21ab8bcSmrg          [BSD], [am__include='.include' am__quote='"'],
652d21ab8bcSmrg          [am__include='include' am__quote=''])])
653d21ab8bcSmrg  if test "$am__include" != "#"; then
654d21ab8bcSmrg    _am_result="yes ($s style)"
655d21ab8bcSmrg    break
656d21ab8bcSmrg  fi
657d21ab8bcSmrgdone
658d21ab8bcSmrgrm -f confinc.* confmf.*
659d21ab8bcSmrgAC_MSG_RESULT([${_am_result}])
660d21ab8bcSmrgAC_SUBST([am__include])])
661d21ab8bcSmrgAC_SUBST([am__quote])])
6621f0ac6a5Smrg
663d21ab8bcSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
6641f0ac6a5Smrg
6656ee7d557Smrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
666d21ab8bcSmrg#
667d21ab8bcSmrg# This file is free software; the Free Software Foundation
668d21ab8bcSmrg# gives unlimited permission to copy and/or distribute it,
669d21ab8bcSmrg# with or without modifications, as long as this notice is preserved.
670b9867631Smrg
671d21ab8bcSmrg# AM_MISSING_PROG(NAME, PROGRAM)
672d21ab8bcSmrg# ------------------------------
673d21ab8bcSmrgAC_DEFUN([AM_MISSING_PROG],
674d21ab8bcSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
675d21ab8bcSmrg$1=${$1-"${am_missing_run}$2"}
676d21ab8bcSmrgAC_SUBST($1)])
677b9867631Smrg
678d21ab8bcSmrg# AM_MISSING_HAS_RUN
679d21ab8bcSmrg# ------------------
680d21ab8bcSmrg# Define MISSING if not defined so far and test if it is modern enough.
681d21ab8bcSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
682d21ab8bcSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
683d21ab8bcSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
684d21ab8bcSmrgAC_REQUIRE_AUX_FILE([missing])dnl
685d21ab8bcSmrgif test x"${MISSING+set}" != xset; then
686d21ab8bcSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
687d21ab8bcSmrgfi
688d21ab8bcSmrg# Use eval to expand $SHELL
689d21ab8bcSmrgif eval "$MISSING --is-lightweight"; then
690d21ab8bcSmrg  am_missing_run="$MISSING "
691d21ab8bcSmrgelse
692d21ab8bcSmrg  am_missing_run=
693d21ab8bcSmrg  AC_MSG_WARN(['missing' script is too old or missing])
694d21ab8bcSmrgfi
6952fd96bc7Smrg])
696b9867631Smrg
697d21ab8bcSmrg# Helper functions for option handling.                     -*- Autoconf -*-
698b9867631Smrg
6996ee7d557Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
700d21ab8bcSmrg#
701d21ab8bcSmrg# This file is free software; the Free Software Foundation
702d21ab8bcSmrg# gives unlimited permission to copy and/or distribute it,
703d21ab8bcSmrg# with or without modifications, as long as this notice is preserved.
7041f0ac6a5Smrg
705d21ab8bcSmrg# _AM_MANGLE_OPTION(NAME)
706d21ab8bcSmrg# -----------------------
707d21ab8bcSmrgAC_DEFUN([_AM_MANGLE_OPTION],
708d21ab8bcSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7091f0ac6a5Smrg
710d21ab8bcSmrg# _AM_SET_OPTION(NAME)
711d21ab8bcSmrg# --------------------
712d21ab8bcSmrg# Set option NAME.  Presently that only means defining a flag for this option.
713d21ab8bcSmrgAC_DEFUN([_AM_SET_OPTION],
714d21ab8bcSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
715e5410a46Smrg
716d21ab8bcSmrg# _AM_SET_OPTIONS(OPTIONS)
717d21ab8bcSmrg# ------------------------
718d21ab8bcSmrg# OPTIONS is a space-separated list of Automake options.
719d21ab8bcSmrgAC_DEFUN([_AM_SET_OPTIONS],
720d21ab8bcSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
721e5410a46Smrg
722d21ab8bcSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
723d21ab8bcSmrg# -------------------------------------------
724d21ab8bcSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
725d21ab8bcSmrgAC_DEFUN([_AM_IF_OPTION],
726d21ab8bcSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7271f0ac6a5Smrg
7286ee7d557Smrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
7292fd96bc7Smrg#
730d21ab8bcSmrg# This file is free software; the Free Software Foundation
731d21ab8bcSmrg# gives unlimited permission to copy and/or distribute it,
732d21ab8bcSmrg# with or without modifications, as long as this notice is preserved.
7331f0ac6a5Smrg
734d21ab8bcSmrg# _AM_PROG_CC_C_O
735d21ab8bcSmrg# ---------------
736d21ab8bcSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
737d21ab8bcSmrg# to automatically call this.
738d21ab8bcSmrgAC_DEFUN([_AM_PROG_CC_C_O],
739d21ab8bcSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
740d21ab8bcSmrgAC_REQUIRE_AUX_FILE([compile])dnl
741d21ab8bcSmrgAC_LANG_PUSH([C])dnl
742d21ab8bcSmrgAC_CACHE_CHECK(
743d21ab8bcSmrg  [whether $CC understands -c and -o together],
744d21ab8bcSmrg  [am_cv_prog_cc_c_o],
745d21ab8bcSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
746d21ab8bcSmrg  # Make sure it works both with $CC and with simple cc.
747d21ab8bcSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
748d21ab8bcSmrg  # compilers refuse to overwrite an existing .o file with -o,
749d21ab8bcSmrg  # though they will create one.
750d21ab8bcSmrg  am_cv_prog_cc_c_o=yes
751d21ab8bcSmrg  for am_i in 1 2; do
752d21ab8bcSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
753d21ab8bcSmrg         && test -f conftest2.$ac_objext; then
754d21ab8bcSmrg      : OK
755d21ab8bcSmrg    else
756d21ab8bcSmrg      am_cv_prog_cc_c_o=no
757d21ab8bcSmrg      break
758d21ab8bcSmrg    fi
759d21ab8bcSmrg  done
760d21ab8bcSmrg  rm -f core conftest*
761d21ab8bcSmrg  unset am_i])
762d21ab8bcSmrgif test "$am_cv_prog_cc_c_o" != yes; then
763d21ab8bcSmrg   # Losing compiler, so override with the script.
764d21ab8bcSmrg   # FIXME: It is wrong to rewrite CC.
765d21ab8bcSmrg   # But if we don't then we get into trouble of one sort or another.
766d21ab8bcSmrg   # A longer-term fix would be to have automake use am__CC in this case,
767d21ab8bcSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
768d21ab8bcSmrg   CC="$am_aux_dir/compile $CC"
769d21ab8bcSmrgfi
770d21ab8bcSmrgAC_LANG_POP([C])])
7711f0ac6a5Smrg
772d21ab8bcSmrg# For backward compatibility.
773d21ab8bcSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
7741f0ac6a5Smrg
7756ee7d557Smrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
7766ee7d557Smrg#
7776ee7d557Smrg# This file is free software; the Free Software Foundation
7786ee7d557Smrg# gives unlimited permission to copy and/or distribute it,
7796ee7d557Smrg# with or without modifications, as long as this notice is preserved.
7806ee7d557Smrg
7816ee7d557Smrg# _AM_PROG_RM_F
7826ee7d557Smrg# ---------------
7836ee7d557Smrg# Check whether 'rm -f' without any arguments works.
7846ee7d557Smrg# https://bugs.gnu.org/10828
7856ee7d557SmrgAC_DEFUN([_AM_PROG_RM_F],
7866ee7d557Smrg[am__rm_f_notfound=
7876ee7d557SmrgAS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""'])
7886ee7d557SmrgAC_SUBST(am__rm_f_notfound)
7896ee7d557Smrg])
7906ee7d557Smrg
7916ee7d557Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
7926fae4e5dSmrg#
793d21ab8bcSmrg# This file is free software; the Free Software Foundation
794d21ab8bcSmrg# gives unlimited permission to copy and/or distribute it,
795d21ab8bcSmrg# with or without modifications, as long as this notice is preserved.
7969c9ff80cSmrg
797d21ab8bcSmrg# AM_RUN_LOG(COMMAND)
798d21ab8bcSmrg# -------------------
799d21ab8bcSmrg# Run COMMAND, save the exit status in ac_status, and log it.
800d21ab8bcSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
801d21ab8bcSmrgAC_DEFUN([AM_RUN_LOG],
802d21ab8bcSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
803d21ab8bcSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
804d21ab8bcSmrg   ac_status=$?
805d21ab8bcSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
806d21ab8bcSmrg   (exit $ac_status); }])
8079c9ff80cSmrg
808d21ab8bcSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8091f0ac6a5Smrg
8106ee7d557Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
811d21ab8bcSmrg#
812d21ab8bcSmrg# This file is free software; the Free Software Foundation
813d21ab8bcSmrg# gives unlimited permission to copy and/or distribute it,
814d21ab8bcSmrg# with or without modifications, as long as this notice is preserved.
8159c9ff80cSmrg
8166ee7d557Smrg# _AM_SLEEP_FRACTIONAL_SECONDS
8176ee7d557Smrg# ----------------------------
8186ee7d557SmrgAC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl
8196ee7d557SmrgAC_CACHE_CHECK([whether sleep supports fractional seconds],
8206ee7d557Smrg               am_cv_sleep_fractional_seconds, [dnl
8216ee7d557SmrgAS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes],
8226ee7d557Smrg                                 [am_cv_sleep_fractional_seconds=no])
8236ee7d557Smrg])])
8246ee7d557Smrg
8256ee7d557Smrg# _AM_FILESYSTEM_TIMESTAMP_RESOLUTION
8266ee7d557Smrg# -----------------------------------
8276ee7d557Smrg# Determine the filesystem's resolution for file modification
8286ee7d557Smrg# timestamps.  The coarsest we know of is FAT, with a resolution
8296ee7d557Smrg# of only two seconds, even with the most recent "exFAT" extensions.
8306ee7d557Smrg# The finest (e.g. ext4 with large inodes, XFS, ZFS) is one
8316ee7d557Smrg# nanosecond, matching clock_gettime.  However, it is probably not
8326ee7d557Smrg# possible to delay execution of a shell script for less than one
8336ee7d557Smrg# millisecond, due to process creation overhead and scheduling
8346ee7d557Smrg# granularity, so we don't check for anything finer than that. (See below.)
8356ee7d557SmrgAC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl
8366ee7d557SmrgAC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS])
8376ee7d557SmrgAC_CACHE_CHECK([filesystem timestamp resolution],
8386ee7d557Smrg               am_cv_filesystem_timestamp_resolution, [dnl
8396ee7d557Smrg# Default to the worst case.
8406ee7d557Smrgam_cv_filesystem_timestamp_resolution=2
8416ee7d557Smrg
8426ee7d557Smrg# Only try to go finer than 1 sec if sleep can do it.
8436ee7d557Smrg# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work,
8446ee7d557Smrg# - 1 sec is not much of a win compared to 2 sec, and
8456ee7d557Smrg# - it takes 2 seconds to perform the test whether 1 sec works.
8466ee7d557Smrg# 
8476ee7d557Smrg# Instead, just use the default 2s on platforms that have 1s resolution,
8486ee7d557Smrg# accept the extra 1s delay when using $sleep in the Automake tests, in
8496ee7d557Smrg# exchange for not incurring the 2s delay for running the test for all
8506ee7d557Smrg# packages.
8516ee7d557Smrg#
8526ee7d557Smrgam_try_resolutions=
8536ee7d557Smrgif test "$am_cv_sleep_fractional_seconds" = yes; then
8546ee7d557Smrg  # Even a millisecond often causes a bunch of false positives,
8556ee7d557Smrg  # so just try a hundredth of a second. The time saved between .001 and
8566ee7d557Smrg  # .01 is not terribly consequential.
8576ee7d557Smrg  am_try_resolutions="0.01 0.1 $am_try_resolutions"
8586ee7d557Smrgfi
8596ee7d557Smrg
8606ee7d557Smrg# In order to catch current-generation FAT out, we must *modify* files
8616ee7d557Smrg# that already exist; the *creation* timestamp is finer.  Use names
8626ee7d557Smrg# that make ls -t sort them differently when they have equal
8636ee7d557Smrg# timestamps than when they have distinct timestamps, keeping
8646ee7d557Smrg# in mind that ls -t prints the *newest* file first.
8656ee7d557Smrgrm -f conftest.ts?
8666ee7d557Smrg: > conftest.ts1
8676ee7d557Smrg: > conftest.ts2
8686ee7d557Smrg: > conftest.ts3
8696ee7d557Smrg
8706ee7d557Smrg# Make sure ls -t actually works.  Do 'set' in a subshell so we don't
8716ee7d557Smrg# clobber the current shell's arguments. (Outer-level square brackets
8726ee7d557Smrg# are removed by m4; they're present so that m4 does not expand
8736ee7d557Smrg# <dollar><star>; be careful, easy to get confused.)
8746ee7d557Smrgif (
8756ee7d557Smrg     set X `[ls -t conftest.ts[12]]` &&
8766ee7d557Smrg     {
8776ee7d557Smrg       test "$[]*" != "X conftest.ts1 conftest.ts2" ||
8786ee7d557Smrg       test "$[]*" != "X conftest.ts2 conftest.ts1";
8796ee7d557Smrg     }
8806ee7d557Smrg); then :; else
8816ee7d557Smrg  # If neither matched, then we have a broken ls.  This can happen
8826ee7d557Smrg  # if, for instance, CONFIG_SHELL is bash and it inherits a
8836ee7d557Smrg  # broken ls alias from the environment.  This has actually
8846ee7d557Smrg  # happened.  Such a system could not be considered "sane".
8856ee7d557Smrg  _AS_ECHO_UNQUOTED(
8866ee7d557Smrg    ["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""],
8876ee7d557Smrg    [AS_MESSAGE_LOG_FD])
8886ee7d557Smrg  AC_MSG_FAILURE([ls -t produces unexpected output.
8896ee7d557SmrgMake sure there is not a broken ls alias in your environment.])
8906ee7d557Smrgfi
8916ee7d557Smrg
8926ee7d557Smrgfor am_try_res in $am_try_resolutions; do
8936ee7d557Smrg  # Any one fine-grained sleep might happen to cross the boundary
8946ee7d557Smrg  # between two values of a coarser actual resolution, but if we do
8956ee7d557Smrg  # two fine-grained sleeps in a row, at least one of them will fall
8966ee7d557Smrg  # entirely within a coarse interval.
8976ee7d557Smrg  echo alpha > conftest.ts1
8986ee7d557Smrg  sleep $am_try_res
8996ee7d557Smrg  echo beta > conftest.ts2
9006ee7d557Smrg  sleep $am_try_res
9016ee7d557Smrg  echo gamma > conftest.ts3
9026ee7d557Smrg
9036ee7d557Smrg  # We assume that 'ls -t' will make use of high-resolution
9046ee7d557Smrg  # timestamps if the operating system supports them at all.
9056ee7d557Smrg  if (set X `ls -t conftest.ts?` &&
9066ee7d557Smrg      test "$[]2" = conftest.ts3 &&
9076ee7d557Smrg      test "$[]3" = conftest.ts2 &&
9086ee7d557Smrg      test "$[]4" = conftest.ts1); then
9096ee7d557Smrg    #
9106ee7d557Smrg    # Ok, ls -t worked. If we're at a resolution of 1 second, we're done,
9116ee7d557Smrg    # because we don't need to test make.
9126ee7d557Smrg    make_ok=true
9136ee7d557Smrg    if test $am_try_res != 1; then
9146ee7d557Smrg      # But if we've succeeded so far with a subsecond resolution, we
9156ee7d557Smrg      # have one more thing to check: make. It can happen that
9166ee7d557Smrg      # everything else supports the subsecond mtimes, but make doesn't;
9176ee7d557Smrg      # notably on macOS, which ships make 3.81 from 2006 (the last one
9186ee7d557Smrg      # released under GPLv2). https://bugs.gnu.org/68808
9196ee7d557Smrg      # 
9206ee7d557Smrg      # We test $MAKE if it is defined in the environment, else "make".
9216ee7d557Smrg      # It might get overridden later, but our hope is that in practice
9226ee7d557Smrg      # it does not matter: it is the system "make" which is (by far)
9236ee7d557Smrg      # the most likely to be broken, whereas if the user overrides it,
9246ee7d557Smrg      # probably they did so with a better, or at least not worse, make.
9256ee7d557Smrg      # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html
9266ee7d557Smrg      #
9276ee7d557Smrg      # Create a Makefile (real tab character here):
9286ee7d557Smrg      rm -f conftest.mk
9296ee7d557Smrg      echo 'conftest.ts1: conftest.ts2' >conftest.mk
9306ee7d557Smrg      echo '	touch conftest.ts2' >>conftest.mk
9316ee7d557Smrg      #
9326ee7d557Smrg      # Now, running
9336ee7d557Smrg      #   touch conftest.ts1; touch conftest.ts2; make
9346ee7d557Smrg      # should touch ts1 because ts2 is newer. This could happen by luck,
9356ee7d557Smrg      # but most often, it will fail if make's support is insufficient. So
9366ee7d557Smrg      # test for several consecutive successes.
9376ee7d557Smrg      #
9386ee7d557Smrg      # (We reuse conftest.ts[12] because we still want to modify existing
9396ee7d557Smrg      # files, not create new ones, per above.)
9406ee7d557Smrg      n=0
9416ee7d557Smrg      make=${MAKE-make}
9426ee7d557Smrg      until test $n -eq 3; do
9436ee7d557Smrg        echo one > conftest.ts1
9446ee7d557Smrg        sleep $am_try_res
9456ee7d557Smrg        echo two > conftest.ts2 # ts2 should now be newer than ts1
9466ee7d557Smrg        if $make -f conftest.mk | grep 'up to date' >/dev/null; then
9476ee7d557Smrg          make_ok=false
9486ee7d557Smrg          break # out of $n loop
9496ee7d557Smrg        fi
9506ee7d557Smrg        n=`expr $n + 1`
9516ee7d557Smrg      done
9526ee7d557Smrg    fi
9536ee7d557Smrg    #
9546ee7d557Smrg    if $make_ok; then
9556ee7d557Smrg      # Everything we know to check worked out, so call this resolution good.
9566ee7d557Smrg      am_cv_filesystem_timestamp_resolution=$am_try_res
9576ee7d557Smrg      break # out of $am_try_res loop
9586ee7d557Smrg    fi
9596ee7d557Smrg    # Otherwise, we'll go on to check the next resolution.
9606ee7d557Smrg  fi
9616ee7d557Smrgdone
9626ee7d557Smrgrm -f conftest.ts?
9636ee7d557Smrg# (end _am_filesystem_timestamp_resolution)
9646ee7d557Smrg])])
9656ee7d557Smrg
966d21ab8bcSmrg# AM_SANITY_CHECK
967d21ab8bcSmrg# ---------------
968d21ab8bcSmrgAC_DEFUN([AM_SANITY_CHECK],
9696ee7d557Smrg[AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION])
9706ee7d557Smrg# This check should not be cached, as it may vary across builds of
9716ee7d557Smrg# different projects.
9726ee7d557SmrgAC_MSG_CHECKING([whether build environment is sane])
973d21ab8bcSmrg# Reject unsafe characters in $srcdir or the absolute working directory
974d21ab8bcSmrg# name.  Accept space and tab only in the latter.
975d21ab8bcSmrgam_lf='
976d21ab8bcSmrg'
977d21ab8bcSmrgcase `pwd` in
978d21ab8bcSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
979d21ab8bcSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
980d21ab8bcSmrgesac
981d21ab8bcSmrgcase $srcdir in
982d21ab8bcSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
983d21ab8bcSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
984d21ab8bcSmrgesac
98589c04b6cSmrg
986d21ab8bcSmrg# Do 'set' in a subshell so we don't clobber the current shell's
987d21ab8bcSmrg# arguments.  Must try -L first in case configure is actually a
988d21ab8bcSmrg# symlink; some systems play weird games with the mod time of symlinks
989d21ab8bcSmrg# (eg FreeBSD returns the mod time of the symlink's containing
990d21ab8bcSmrg# directory).
9916ee7d557Smrgam_build_env_is_sane=no
9926ee7d557Smrgam_has_slept=no
9936ee7d557Smrgrm -f conftest.file
9946ee7d557Smrgfor am_try in 1 2; do
9956ee7d557Smrg  echo "timestamp, slept: $am_has_slept" > conftest.file
9966ee7d557Smrg  if (
9976ee7d557Smrg    set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
9986ee7d557Smrg    if test "$[]*" = "X"; then
9996ee7d557Smrg      # -L didn't work.
10006ee7d557Smrg      set X `ls -t "$srcdir/configure" conftest.file`
10016ee7d557Smrg    fi
10026ee7d557Smrg    test "$[]2" = conftest.file
10036ee7d557Smrg  ); then
10046ee7d557Smrg    am_build_env_is_sane=yes
10056ee7d557Smrg    break
10066ee7d557Smrg  fi
10076ee7d557Smrg  # Just in case.
10086ee7d557Smrg  sleep "$am_cv_filesystem_timestamp_resolution"
10096ee7d557Smrg  am_has_slept=yes
10106ee7d557Smrgdone
10116ee7d557Smrg
10126ee7d557SmrgAC_MSG_RESULT([$am_build_env_is_sane])
10136ee7d557Smrgif test "$am_build_env_is_sane" = no; then
10146ee7d557Smrg  AC_MSG_ERROR([newly created file is older than distributed files!
1015d21ab8bcSmrgCheck your system clock])
1016d21ab8bcSmrgfi
10176ee7d557Smrg
1018d21ab8bcSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
1019d21ab8bcSmrg# generated files are strictly newer.
1020d21ab8bcSmrgam_sleep_pid=
10216ee7d557SmrgAS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl
10226ee7d557Smrg  ( sleep "$am_cv_filesystem_timestamp_resolution" ) &
1023d21ab8bcSmrg  am_sleep_pid=$!
10246ee7d557Smrg])
1025d21ab8bcSmrgAC_CONFIG_COMMANDS_PRE(
1026d21ab8bcSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
1027d21ab8bcSmrg   if test -n "$am_sleep_pid"; then
1028d21ab8bcSmrg     # Hide warnings about reused PIDs.
1029d21ab8bcSmrg     wait $am_sleep_pid 2>/dev/null
1030d21ab8bcSmrg   fi
1031d21ab8bcSmrg   AC_MSG_RESULT([done])])
1032d21ab8bcSmrgrm -f conftest.file
1033d21ab8bcSmrg])
10341f0ac6a5Smrg
10356ee7d557Smrg# Copyright (C) 2009-2024 Free Software Foundation, Inc.
1036d21ab8bcSmrg#
1037d21ab8bcSmrg# This file is free software; the Free Software Foundation
1038d21ab8bcSmrg# gives unlimited permission to copy and/or distribute it,
1039d21ab8bcSmrg# with or without modifications, as long as this notice is preserved.
1040e5410a46Smrg
10416ee7d557Smrg# _AM_SILENT_RULES
10426ee7d557Smrg# ----------------
10436ee7d557Smrg# Enable less verbose build rules support.
10446ee7d557SmrgAC_DEFUN([_AM_SILENT_RULES],
10456ee7d557Smrg[AM_DEFAULT_VERBOSITY=1
10466ee7d557SmrgAC_ARG_ENABLE([silent-rules], [dnl
1047d21ab8bcSmrgAS_HELP_STRING(
1048d21ab8bcSmrg  [--enable-silent-rules],
1049d21ab8bcSmrg  [less verbose build output (undo: "make V=1")])
1050d21ab8bcSmrgAS_HELP_STRING(
1051d21ab8bcSmrg  [--disable-silent-rules],
1052d21ab8bcSmrg  [verbose build output (undo: "make V=0")])dnl
1053d21ab8bcSmrg])
1054d21ab8bcSmrgdnl
1055d21ab8bcSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
1056d21ab8bcSmrgdnl do not support nested variable expansions.
1057d21ab8bcSmrgdnl See automake bug#9928 and bug#10237.
1058d21ab8bcSmrgam_make=${MAKE-make}
1059d21ab8bcSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
1060d21ab8bcSmrg   [am_cv_make_support_nested_variables],
1061d21ab8bcSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
1062d21ab8bcSmrgBAR0=false
1063d21ab8bcSmrgBAR1=true
1064d21ab8bcSmrgV=1
1065d21ab8bcSmrgam__doit:
1066d21ab8bcSmrg	@$(TRUE)
1067d21ab8bcSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
1068d21ab8bcSmrg  am_cv_make_support_nested_variables=yes
1069d21ab8bcSmrgelse
1070d21ab8bcSmrg  am_cv_make_support_nested_variables=no
1071d21ab8bcSmrgfi])
1072d21ab8bcSmrgAC_SUBST([AM_V])dnl
1073d21ab8bcSmrgAM_SUBST_NOTMAKE([AM_V])dnl
1074d21ab8bcSmrgAC_SUBST([AM_DEFAULT_V])dnl
1075d21ab8bcSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
1076d21ab8bcSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
1077d21ab8bcSmrgAM_BACKSLASH='\'
1078d21ab8bcSmrgAC_SUBST([AM_BACKSLASH])dnl
1079d21ab8bcSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
10806ee7d557Smrgdnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls
10816ee7d557Smrgdnl to AM_SILENT_RULES to change the default value.
10826ee7d557SmrgAC_CONFIG_COMMANDS_PRE([dnl
10836ee7d557Smrgcase $enable_silent_rules in @%:@ (((
10846ee7d557Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
10856ee7d557Smrg   no) AM_DEFAULT_VERBOSITY=1;;
10866ee7d557Smrgesac
10876ee7d557Smrgif test $am_cv_make_support_nested_variables = yes; then
10886ee7d557Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
10896ee7d557Smrg  AM_V='$(V)'
10906ee7d557Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
10916ee7d557Smrgelse
10926ee7d557Smrg  AM_V=$AM_DEFAULT_VERBOSITY
10936ee7d557Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
10946ee7d557Smrgfi
10956ee7d557Smrg])dnl
10966fae4e5dSmrg])
1097e5410a46Smrg
10986ee7d557Smrg# AM_SILENT_RULES([DEFAULT])
10996ee7d557Smrg# --------------------------
11006ee7d557Smrg# Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or
11016ee7d557Smrg# empty being verbose).
11026ee7d557SmrgAC_DEFUN([AM_SILENT_RULES],
11036ee7d557Smrg[AC_REQUIRE([_AM_SILENT_RULES])
11046ee7d557SmrgAM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])])
11056ee7d557Smrg
11066ee7d557Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
1107d21ab8bcSmrg#
1108d21ab8bcSmrg# This file is free software; the Free Software Foundation
1109d21ab8bcSmrg# gives unlimited permission to copy and/or distribute it,
1110d21ab8bcSmrg# with or without modifications, as long as this notice is preserved.
11119c9ff80cSmrg
1112d21ab8bcSmrg# AM_PROG_INSTALL_STRIP
1113d21ab8bcSmrg# ---------------------
1114d21ab8bcSmrg# One issue with vendor 'install' (even GNU) is that you can't
1115d21ab8bcSmrg# specify the program used to strip binaries.  This is especially
1116d21ab8bcSmrg# annoying in cross-compiling environments, where the build's strip
1117d21ab8bcSmrg# is unlikely to handle the host's binaries.
1118d21ab8bcSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
1119d21ab8bcSmrg# always use install-sh in "make install-strip", and initialize
1120d21ab8bcSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
1121d21ab8bcSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
1122d21ab8bcSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
1123d21ab8bcSmrg# Installed binaries are usually stripped using 'strip' when the user
1124d21ab8bcSmrg# run "make install-strip".  However 'strip' might not be the right
1125d21ab8bcSmrg# tool to use in cross-compilation environments, therefore Automake
1126d21ab8bcSmrg# will honor the 'STRIP' environment variable to overrule this program.
1127d21ab8bcSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
1128d21ab8bcSmrgif test "$cross_compiling" != no; then
1129d21ab8bcSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
1130d21ab8bcSmrgfi
1131d21ab8bcSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
1132d21ab8bcSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
11331f0ac6a5Smrg
11346ee7d557Smrg# Copyright (C) 2006-2024 Free Software Foundation, Inc.
1135d21ab8bcSmrg#
1136d21ab8bcSmrg# This file is free software; the Free Software Foundation
1137d21ab8bcSmrg# gives unlimited permission to copy and/or distribute it,
1138d21ab8bcSmrg# with or without modifications, as long as this notice is preserved.
11391f0ac6a5Smrg
1140d21ab8bcSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
1141d21ab8bcSmrg# ---------------------------
1142d21ab8bcSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1143d21ab8bcSmrg# This macro is traced by Automake.
1144d21ab8bcSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
11451f0ac6a5Smrg
1146d21ab8bcSmrg# AM_SUBST_NOTMAKE(VARIABLE)
1147d21ab8bcSmrg# --------------------------
1148d21ab8bcSmrg# Public sister of _AM_SUBST_NOTMAKE.
1149d21ab8bcSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
11501f0ac6a5Smrg
1151d21ab8bcSmrg# Check how to create a tarball.                            -*- Autoconf -*-
11521f0ac6a5Smrg
11536ee7d557Smrg# Copyright (C) 2004-2024 Free Software Foundation, Inc.
1154d21ab8bcSmrg#
1155d21ab8bcSmrg# This file is free software; the Free Software Foundation
1156d21ab8bcSmrg# gives unlimited permission to copy and/or distribute it,
1157d21ab8bcSmrg# with or without modifications, as long as this notice is preserved.
11581f0ac6a5Smrg
1159d21ab8bcSmrg# _AM_PROG_TAR(FORMAT)
1160d21ab8bcSmrg# --------------------
1161d21ab8bcSmrg# Check how to create a tarball in format FORMAT.
1162d21ab8bcSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1163d21ab8bcSmrg#
1164d21ab8bcSmrg# Substitute a variable $(am__tar) that is a command
1165d21ab8bcSmrg# writing to stdout a FORMAT-tarball containing the directory
1166d21ab8bcSmrg# $tardir.
1167d21ab8bcSmrg#     tardir=directory && $(am__tar) > result.tar
1168d21ab8bcSmrg#
1169d21ab8bcSmrg# Substitute a variable $(am__untar) that extract such
1170d21ab8bcSmrg# a tarball read from stdin.
1171d21ab8bcSmrg#     $(am__untar) < result.tar
1172d21ab8bcSmrg#
1173d21ab8bcSmrgAC_DEFUN([_AM_PROG_TAR],
1174d21ab8bcSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1175d21ab8bcSmrg# in the wild :-(  We should find a proper way to deprecate it ...
1176d21ab8bcSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1177e5410a46Smrg
1178d21ab8bcSmrg# We'll loop over all known methods to create a tar archive until one works.
1179d21ab8bcSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
11809c9ff80cSmrg
1181d21ab8bcSmrgm4_if([$1], [v7],
1182d21ab8bcSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
11836fae4e5dSmrg
1184d21ab8bcSmrg  [m4_case([$1],
1185d21ab8bcSmrg    [ustar],
1186d21ab8bcSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1187d21ab8bcSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1188d21ab8bcSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1189d21ab8bcSmrg      # and bug#13588).
1190d21ab8bcSmrg      am_max_uid=2097151 # 2^21 - 1
1191d21ab8bcSmrg      am_max_gid=$am_max_uid
1192d21ab8bcSmrg      # The $UID and $GID variables are not portable, so we need to resort
1193d21ab8bcSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1194d21ab8bcSmrg      # below are definitely unexpected, so allow the users to see them
1195d21ab8bcSmrg      # (that is, avoid stderr redirection).
1196d21ab8bcSmrg      am_uid=`id -u || echo unknown`
1197d21ab8bcSmrg      am_gid=`id -g || echo unknown`
1198d21ab8bcSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
11996ee7d557Smrg      if test x$am_uid = xunknown; then
12006ee7d557Smrg        AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work])
12016ee7d557Smrg      elif test $am_uid -le $am_max_uid; then
12026ee7d557Smrg        AC_MSG_RESULT([yes])
1203d21ab8bcSmrg      else
12046ee7d557Smrg        AC_MSG_RESULT([no])
12056ee7d557Smrg        _am_tools=none
1206d21ab8bcSmrg      fi
1207d21ab8bcSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
12086ee7d557Smrg      if test x$gm_gid = xunknown; then
12096ee7d557Smrg        AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work])
12106ee7d557Smrg      elif test $am_gid -le $am_max_gid; then
12116ee7d557Smrg        AC_MSG_RESULT([yes])
1212d21ab8bcSmrg      else
1213d21ab8bcSmrg        AC_MSG_RESULT([no])
1214d21ab8bcSmrg        _am_tools=none
1215d21ab8bcSmrg      fi],
12169c9ff80cSmrg
1217d21ab8bcSmrg  [pax],
1218d21ab8bcSmrg    [],
12199c9ff80cSmrg
1220d21ab8bcSmrg  [m4_fatal([Unknown tar format])])
12219c9ff80cSmrg
1222d21ab8bcSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
12239c9ff80cSmrg
1224d21ab8bcSmrg  # Go ahead even if we have the value already cached.  We do so because we
1225d21ab8bcSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1226d21ab8bcSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
12279c9ff80cSmrg
1228d21ab8bcSmrg  for _am_tool in $_am_tools; do
1229d21ab8bcSmrg    case $_am_tool in
1230d21ab8bcSmrg    gnutar)
1231d21ab8bcSmrg      for _am_tar in tar gnutar gtar; do
1232d21ab8bcSmrg        AM_RUN_LOG([$_am_tar --version]) && break
1233d21ab8bcSmrg      done
1234d21ab8bcSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1235d21ab8bcSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1236d21ab8bcSmrg      am__untar="$_am_tar -xf -"
1237d21ab8bcSmrg      ;;
1238d21ab8bcSmrg    plaintar)
1239d21ab8bcSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1240d21ab8bcSmrg      # ustar tarball either.
1241d21ab8bcSmrg      (tar --version) >/dev/null 2>&1 && continue
1242d21ab8bcSmrg      am__tar='tar chf - "$$tardir"'
1243d21ab8bcSmrg      am__tar_='tar chf - "$tardir"'
1244d21ab8bcSmrg      am__untar='tar xf -'
1245d21ab8bcSmrg      ;;
1246d21ab8bcSmrg    pax)
1247d21ab8bcSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
1248d21ab8bcSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
1249d21ab8bcSmrg      am__untar='pax -r'
1250d21ab8bcSmrg      ;;
1251d21ab8bcSmrg    cpio)
1252d21ab8bcSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1253d21ab8bcSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1254d21ab8bcSmrg      am__untar='cpio -i -H $1 -d'
1255d21ab8bcSmrg      ;;
1256d21ab8bcSmrg    none)
1257d21ab8bcSmrg      am__tar=false
1258d21ab8bcSmrg      am__tar_=false
1259d21ab8bcSmrg      am__untar=false
1260d21ab8bcSmrg      ;;
1261d21ab8bcSmrg    esac
12629c9ff80cSmrg
1263d21ab8bcSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
1264d21ab8bcSmrg    # and am__untar set.
1265d21ab8bcSmrg    test -n "${am_cv_prog_tar_$1}" && break
12669c9ff80cSmrg
1267d21ab8bcSmrg    # tar/untar a dummy directory, and stop if the command works.
1268d21ab8bcSmrg    rm -rf conftest.dir
1269d21ab8bcSmrg    mkdir conftest.dir
1270d21ab8bcSmrg    echo GrepMe > conftest.dir/file
1271d21ab8bcSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1272d21ab8bcSmrg    rm -rf conftest.dir
1273d21ab8bcSmrg    if test -s conftest.tar; then
1274d21ab8bcSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
1275d21ab8bcSmrg      AM_RUN_LOG([cat conftest.dir/file])
1276d21ab8bcSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1277d21ab8bcSmrg    fi
1278d21ab8bcSmrg  done
1279d21ab8bcSmrg  rm -rf conftest.dir
12809c9ff80cSmrg
1281d21ab8bcSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1282d21ab8bcSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
12839c9ff80cSmrg
1284d21ab8bcSmrgAC_SUBST([am__tar])
1285d21ab8bcSmrgAC_SUBST([am__untar])
1286d21ab8bcSmrg]) # _AM_PROG_TAR
12879c9ff80cSmrg
12886ee7d557Smrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
12896ee7d557Smrg#
12906ee7d557Smrg# This file is free software; the Free Software Foundation
12916ee7d557Smrg# gives unlimited permission to copy and/or distribute it,
12926ee7d557Smrg# with or without modifications, as long as this notice is preserved.
12936ee7d557Smrg
12946ee7d557Smrg# _AM_PROG_XARGS_N
12956ee7d557Smrg# ----------------
12966ee7d557Smrg# Check whether 'xargs -n' works.  It should work everywhere, so the fallback
12976ee7d557Smrg# is not optimized at all as we never expect to use it.
12986ee7d557SmrgAC_DEFUN([_AM_PROG_XARGS_N],
12996ee7d557Smrg[AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl
13006ee7d557SmrgAS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2
13016ee7d557Smrg3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])])
13026ee7d557SmrgAS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl
13036ee7d557Smrg  am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }'
13046ee7d557Smrg])dnl
13056ee7d557SmrgAC_SUBST(am__xargs_n)
13066ee7d557Smrg])
13076ee7d557Smrg
1308d21ab8bcSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1309d21ab8bcSmrgdnl serial 11 (pkg-config-0.29)
1310d21ab8bcSmrgdnl
1311d21ab8bcSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1312d21ab8bcSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1313d21ab8bcSmrgdnl
1314d21ab8bcSmrgdnl This program is free software; you can redistribute it and/or modify
1315d21ab8bcSmrgdnl it under the terms of the GNU General Public License as published by
1316d21ab8bcSmrgdnl the Free Software Foundation; either version 2 of the License, or
1317d21ab8bcSmrgdnl (at your option) any later version.
1318d21ab8bcSmrgdnl
1319d21ab8bcSmrgdnl This program is distributed in the hope that it will be useful, but
1320d21ab8bcSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1321d21ab8bcSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1322d21ab8bcSmrgdnl General Public License for more details.
1323d21ab8bcSmrgdnl
1324d21ab8bcSmrgdnl You should have received a copy of the GNU General Public License
1325d21ab8bcSmrgdnl along with this program; if not, write to the Free Software
1326d21ab8bcSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1327d21ab8bcSmrgdnl 02111-1307, USA.
1328d21ab8bcSmrgdnl
1329d21ab8bcSmrgdnl As a special exception to the GNU General Public License, if you
1330d21ab8bcSmrgdnl distribute this file as part of a program that contains a
1331d21ab8bcSmrgdnl configuration script generated by Autoconf, you may include it under
1332d21ab8bcSmrgdnl the same distribution terms that you use for the rest of that
1333d21ab8bcSmrgdnl program.
1334d21ab8bcSmrg
1335d21ab8bcSmrgdnl PKG_PREREQ(MIN-VERSION)
1336d21ab8bcSmrgdnl -----------------------
1337d21ab8bcSmrgdnl Since: 0.29
1338d21ab8bcSmrgdnl
1339d21ab8bcSmrgdnl Verify that the version of the pkg-config macros are at least
1340d21ab8bcSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1341d21ab8bcSmrgdnl installed version of pkg-config, this checks the developer's version
1342d21ab8bcSmrgdnl of pkg.m4 when generating configure.
1343d21ab8bcSmrgdnl
1344d21ab8bcSmrgdnl To ensure that this macro is defined, also add:
1345d21ab8bcSmrgdnl m4_ifndef([PKG_PREREQ],
1346d21ab8bcSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1347d21ab8bcSmrgdnl
1348d21ab8bcSmrgdnl See the "Since" comment for each macro you use to see what version
1349d21ab8bcSmrgdnl of the macros you require.
1350d21ab8bcSmrgm4_defun([PKG_PREREQ],
1351d21ab8bcSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
1352d21ab8bcSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1353d21ab8bcSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1354d21ab8bcSmrg])dnl PKG_PREREQ
1355d21ab8bcSmrg
1356d21ab8bcSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1357d21ab8bcSmrgdnl ----------------------------------
1358d21ab8bcSmrgdnl Since: 0.16
1359d21ab8bcSmrgdnl
1360d21ab8bcSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1361d21ab8bcSmrgdnl first found in the path. Checks that the version of pkg-config found
1362d21ab8bcSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1363d21ab8bcSmrgdnl used since that's the first version where most current features of
1364d21ab8bcSmrgdnl pkg-config existed.
1365d21ab8bcSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1366d21ab8bcSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1367d21ab8bcSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1368d21ab8bcSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1369d21ab8bcSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1370d21ab8bcSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1371d21ab8bcSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
13729c9ff80cSmrg
1373d21ab8bcSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1374d21ab8bcSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
13752fd96bc7Smrgfi
1376d21ab8bcSmrgif test -n "$PKG_CONFIG"; then
1377d21ab8bcSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
1378d21ab8bcSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1379d21ab8bcSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1380d21ab8bcSmrg		AC_MSG_RESULT([yes])
1381d21ab8bcSmrg	else
1382d21ab8bcSmrg		AC_MSG_RESULT([no])
1383d21ab8bcSmrg		PKG_CONFIG=""
1384d21ab8bcSmrg	fi
1385d21ab8bcSmrgfi[]dnl
1386d21ab8bcSmrg])dnl PKG_PROG_PKG_CONFIG
13879c9ff80cSmrg
1388d21ab8bcSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1389d21ab8bcSmrgdnl -------------------------------------------------------------------
1390d21ab8bcSmrgdnl Since: 0.18
1391d21ab8bcSmrgdnl
1392d21ab8bcSmrgdnl Check to see whether a particular set of modules exists. Similar to
1393d21ab8bcSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1394d21ab8bcSmrgdnl
1395d21ab8bcSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1396d21ab8bcSmrgdnl only at the first occurence in configure.ac, so if the first place
1397d21ab8bcSmrgdnl it's called might be skipped (such as if it is within an "if", you
1398d21ab8bcSmrgdnl have to call PKG_CHECK_EXISTS manually
1399d21ab8bcSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1400d21ab8bcSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1401d21ab8bcSmrgif test -n "$PKG_CONFIG" && \
1402d21ab8bcSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1403d21ab8bcSmrg  m4_default([$2], [:])
1404d21ab8bcSmrgm4_ifvaln([$3], [else
1405d21ab8bcSmrg  $3])dnl
1406d21ab8bcSmrgfi])
14079c9ff80cSmrg
1408d21ab8bcSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1409d21ab8bcSmrgdnl ---------------------------------------------
1410d21ab8bcSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1411d21ab8bcSmrgdnl pkg_failed based on the result.
1412d21ab8bcSmrgm4_define([_PKG_CONFIG],
1413d21ab8bcSmrg[if test -n "$$1"; then
1414d21ab8bcSmrg    pkg_cv_[]$1="$$1"
1415d21ab8bcSmrg elif test -n "$PKG_CONFIG"; then
1416d21ab8bcSmrg    PKG_CHECK_EXISTS([$3],
1417d21ab8bcSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1418d21ab8bcSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
1419d21ab8bcSmrg		     [pkg_failed=yes])
1420d21ab8bcSmrg else
1421d21ab8bcSmrg    pkg_failed=untried
1422d21ab8bcSmrgfi[]dnl
1423d21ab8bcSmrg])dnl _PKG_CONFIG
14249c9ff80cSmrg
1425d21ab8bcSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1426d21ab8bcSmrgdnl ---------------------------
1427d21ab8bcSmrgdnl Internal check to see if pkg-config supports short errors.
1428d21ab8bcSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1429d21ab8bcSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1430d21ab8bcSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1431d21ab8bcSmrg        _pkg_short_errors_supported=yes
1432d21ab8bcSmrgelse
1433d21ab8bcSmrg        _pkg_short_errors_supported=no
1434d21ab8bcSmrgfi[]dnl
1435d21ab8bcSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1436e5410a46Smrg
14371f0ac6a5Smrg
1438d21ab8bcSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1439d21ab8bcSmrgdnl   [ACTION-IF-NOT-FOUND])
1440d21ab8bcSmrgdnl --------------------------------------------------------------
1441d21ab8bcSmrgdnl Since: 0.4.0
1442d21ab8bcSmrgdnl
1443d21ab8bcSmrgdnl Note that if there is a possibility the first call to
1444d21ab8bcSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1445d21ab8bcSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1446d21ab8bcSmrgAC_DEFUN([PKG_CHECK_MODULES],
1447d21ab8bcSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1448d21ab8bcSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1449d21ab8bcSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
14501f0ac6a5Smrg
1451d21ab8bcSmrgpkg_failed=no
1452d21ab8bcSmrgAC_MSG_CHECKING([for $1])
14531f0ac6a5Smrg
1454d21ab8bcSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1455d21ab8bcSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
14561f0ac6a5Smrg
1457d21ab8bcSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1458d21ab8bcSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1459d21ab8bcSmrgSee the pkg-config man page for more details.])
14609c9ff80cSmrg
1461d21ab8bcSmrgif test $pkg_failed = yes; then
1462d21ab8bcSmrg   	AC_MSG_RESULT([no])
1463d21ab8bcSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1464d21ab8bcSmrg        if test $_pkg_short_errors_supported = yes; then
1465d21ab8bcSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1466d21ab8bcSmrg        else 
1467d21ab8bcSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1468d21ab8bcSmrg        fi
1469d21ab8bcSmrg	# Put the nasty error message in config.log where it belongs
1470d21ab8bcSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
14719c9ff80cSmrg
1472d21ab8bcSmrg	m4_default([$4], [AC_MSG_ERROR(
1473d21ab8bcSmrg[Package requirements ($2) were not met:
14749c9ff80cSmrg
1475d21ab8bcSmrg$$1_PKG_ERRORS
14761f0ac6a5Smrg
1477d21ab8bcSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1478d21ab8bcSmrginstalled software in a non-standard prefix.
14791f0ac6a5Smrg
1480d21ab8bcSmrg_PKG_TEXT])[]dnl
1481d21ab8bcSmrg        ])
1482d21ab8bcSmrgelif test $pkg_failed = untried; then
1483d21ab8bcSmrg     	AC_MSG_RESULT([no])
1484d21ab8bcSmrg	m4_default([$4], [AC_MSG_FAILURE(
1485d21ab8bcSmrg[The pkg-config script could not be found or is too old.  Make sure it
1486d21ab8bcSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
1487d21ab8bcSmrgpath to pkg-config.
14881f0ac6a5Smrg
1489d21ab8bcSmrg_PKG_TEXT
14901f0ac6a5Smrg
1491d21ab8bcSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1492d21ab8bcSmrg        ])
1493d21ab8bcSmrgelse
1494d21ab8bcSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1495d21ab8bcSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1496d21ab8bcSmrg        AC_MSG_RESULT([yes])
1497d21ab8bcSmrg	$3
1498d21ab8bcSmrgfi[]dnl
1499d21ab8bcSmrg])dnl PKG_CHECK_MODULES
15009c9ff80cSmrg
15019c9ff80cSmrg
1502d21ab8bcSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1503d21ab8bcSmrgdnl   [ACTION-IF-NOT-FOUND])
1504d21ab8bcSmrgdnl ---------------------------------------------------------------------
1505d21ab8bcSmrgdnl Since: 0.29
1506d21ab8bcSmrgdnl
1507d21ab8bcSmrgdnl Checks for existence of MODULES and gathers its build flags with
1508d21ab8bcSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1509d21ab8bcSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1510d21ab8bcSmrgdnl
1511d21ab8bcSmrgdnl Note that if there is a possibility the first call to
1512d21ab8bcSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1513d21ab8bcSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1514d21ab8bcSmrgdnl configure.ac.
1515d21ab8bcSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1516d21ab8bcSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1517d21ab8bcSmrg_save_PKG_CONFIG=$PKG_CONFIG
1518d21ab8bcSmrgPKG_CONFIG="$PKG_CONFIG --static"
1519d21ab8bcSmrgPKG_CHECK_MODULES($@)
1520d21ab8bcSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1521d21ab8bcSmrg])dnl PKG_CHECK_MODULES_STATIC
1522e5410a46Smrg
1523e5410a46Smrg
1524d21ab8bcSmrgdnl PKG_INSTALLDIR([DIRECTORY])
1525d21ab8bcSmrgdnl -------------------------
1526d21ab8bcSmrgdnl Since: 0.27
1527d21ab8bcSmrgdnl
1528d21ab8bcSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
1529d21ab8bcSmrgdnl should install pkg-config .pc files. By default the directory is
1530d21ab8bcSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
1531d21ab8bcSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1532d21ab8bcSmrgdnl parameter.
1533d21ab8bcSmrgAC_DEFUN([PKG_INSTALLDIR],
1534d21ab8bcSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1535d21ab8bcSmrgm4_pushdef([pkg_description],
1536d21ab8bcSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1537d21ab8bcSmrgAC_ARG_WITH([pkgconfigdir],
1538d21ab8bcSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1539d21ab8bcSmrg    [with_pkgconfigdir=]pkg_default)
1540d21ab8bcSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1541d21ab8bcSmrgm4_popdef([pkg_default])
1542d21ab8bcSmrgm4_popdef([pkg_description])
1543d21ab8bcSmrg])dnl PKG_INSTALLDIR
1544d21ab8bcSmrg
1545d21ab8bcSmrg
1546d21ab8bcSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1547d21ab8bcSmrgdnl --------------------------------
1548d21ab8bcSmrgdnl Since: 0.27
1549d21ab8bcSmrgdnl
1550d21ab8bcSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1551d21ab8bcSmrgdnl module should install arch-independent pkg-config .pc files. By
1552d21ab8bcSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
1553d21ab8bcSmrgdnl changed by passing DIRECTORY. The user can override through the
1554d21ab8bcSmrgdnl --with-noarch-pkgconfigdir parameter.
1555d21ab8bcSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1556d21ab8bcSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1557d21ab8bcSmrgm4_pushdef([pkg_description],
1558d21ab8bcSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1559d21ab8bcSmrgAC_ARG_WITH([noarch-pkgconfigdir],
1560d21ab8bcSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1561d21ab8bcSmrg    [with_noarch_pkgconfigdir=]pkg_default)
1562d21ab8bcSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1563d21ab8bcSmrgm4_popdef([pkg_default])
1564d21ab8bcSmrgm4_popdef([pkg_description])
1565d21ab8bcSmrg])dnl PKG_NOARCH_INSTALLDIR
1566d21ab8bcSmrg
1567d21ab8bcSmrg
1568d21ab8bcSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1569d21ab8bcSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1570d21ab8bcSmrgdnl -------------------------------------------
1571d21ab8bcSmrgdnl Since: 0.28
1572d21ab8bcSmrgdnl
1573d21ab8bcSmrgdnl Retrieves the value of the pkg-config variable for the given module.
1574d21ab8bcSmrgAC_DEFUN([PKG_CHECK_VAR],
1575d21ab8bcSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1576d21ab8bcSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
15771f0ac6a5Smrg
1578d21ab8bcSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1579d21ab8bcSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1580e5410a46Smrg
1581d21ab8bcSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1582d21ab8bcSmrg])dnl PKG_CHECK_VAR
15831f0ac6a5Smrg
1584d21ab8bcSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1585d21ab8bcSmrgdnl
15866ee7d557Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
1587d21ab8bcSmrgdnl
1588d21ab8bcSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1589d21ab8bcSmrgdnl copy of this software and associated documentation files (the "Software"),
1590d21ab8bcSmrgdnl to deal in the Software without restriction, including without limitation
1591d21ab8bcSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1592d21ab8bcSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1593d21ab8bcSmrgdnl Software is furnished to do so, subject to the following conditions:
1594d21ab8bcSmrgdnl
1595d21ab8bcSmrgdnl The above copyright notice and this permission notice (including the next
1596d21ab8bcSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1597d21ab8bcSmrgdnl Software.
1598d21ab8bcSmrgdnl
1599d21ab8bcSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1600d21ab8bcSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1601d21ab8bcSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1602d21ab8bcSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1603d21ab8bcSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1604d21ab8bcSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1605d21ab8bcSmrgdnl DEALINGS IN THE SOFTWARE.
16061f0ac6a5Smrg
1607d21ab8bcSmrg# XORG_MACROS_VERSION(required-version)
1608d21ab8bcSmrg# -------------------------------------
1609d21ab8bcSmrg# Minimum version: 1.1.0
1610d21ab8bcSmrg#
1611d21ab8bcSmrg# If you're using a macro added in Version 1.1 or newer, include this in
1612d21ab8bcSmrg# your configure.ac with the minimum required version, such as:
1613d21ab8bcSmrg# XORG_MACROS_VERSION(1.1)
1614d21ab8bcSmrg#
1615d21ab8bcSmrg# To ensure that this macro is defined, also add:
1616d21ab8bcSmrg# m4_ifndef([XORG_MACROS_VERSION],
1617d21ab8bcSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1618d21ab8bcSmrg#
1619d21ab8bcSmrg#
1620d21ab8bcSmrg# See the "minimum version" comment for each macro you use to see what
1621d21ab8bcSmrg# version you require.
1622d21ab8bcSmrgm4_defun([XORG_MACROS_VERSION],[
16236ee7d557Smrgm4_define([vers_have], [1.20.2])
1624d21ab8bcSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1625d21ab8bcSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1626d21ab8bcSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1627d21ab8bcSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1628d21ab8bcSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1629d21ab8bcSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1630d21ab8bcSmrgm4_undefine([vers_have])
1631d21ab8bcSmrgm4_undefine([maj_have])
1632d21ab8bcSmrgm4_undefine([maj_needed])
1633d21ab8bcSmrg]) # XORG_MACROS_VERSION
16341f0ac6a5Smrg
1635d21ab8bcSmrg# XORG_PROG_RAWCPP()
1636d21ab8bcSmrg# ------------------
1637d21ab8bcSmrg# Minimum version: 1.0.0
1638d21ab8bcSmrg#
1639d21ab8bcSmrg# Find cpp program and necessary flags for use in pre-processing text files
1640d21ab8bcSmrg# such as man pages and config files
1641d21ab8bcSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1642d21ab8bcSmrgAC_REQUIRE([AC_PROG_CPP])
1643d21ab8bcSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1644d21ab8bcSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
16451f0ac6a5Smrg
1646d21ab8bcSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1647d21ab8bcSmrg# which is not the best choice for supporting other OS'es, but covers most
1648d21ab8bcSmrg# of the ones we need for now.
1649d21ab8bcSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1650d21ab8bcSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1651d21ab8bcSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1652d21ab8bcSmrg	AC_MSG_RESULT([no])
1653d21ab8bcSmrgelse
1654d21ab8bcSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1655d21ab8bcSmrg		RAWCPPFLAGS=-undef
1656d21ab8bcSmrg		AC_MSG_RESULT([yes])
1657d21ab8bcSmrg	# under Cygwin unix is still defined even with -undef
1658d21ab8bcSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1659d21ab8bcSmrg		RAWCPPFLAGS="-undef -ansi"
1660d21ab8bcSmrg		AC_MSG_RESULT([yes, with -ansi])
1661d21ab8bcSmrg	else
1662d21ab8bcSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1663d21ab8bcSmrg	fi
1664d21ab8bcSmrgfi
1665d21ab8bcSmrgrm -f conftest.$ac_ext
16661f0ac6a5Smrg
1667d21ab8bcSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1668d21ab8bcSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
16696ee7d557Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1670d21ab8bcSmrg	AC_MSG_RESULT([no])
1671d21ab8bcSmrgelse
16726ee7d557Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1673d21ab8bcSmrg		TRADITIONALCPPFLAGS="-traditional"
1674d21ab8bcSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1675d21ab8bcSmrg		AC_MSG_RESULT([yes])
1676d21ab8bcSmrg	else
1677d21ab8bcSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1678d21ab8bcSmrg	fi
1679d21ab8bcSmrgfi
1680d21ab8bcSmrgrm -f conftest.$ac_ext
1681d21ab8bcSmrgAC_SUBST(RAWCPPFLAGS)
1682d21ab8bcSmrgAC_SUBST(TRADITIONALCPPFLAGS)
1683d21ab8bcSmrg]) # XORG_PROG_RAWCPP
16841f0ac6a5Smrg
1685d21ab8bcSmrg# XORG_MANPAGE_SECTIONS()
1686d21ab8bcSmrg# -----------------------
1687d21ab8bcSmrg# Minimum version: 1.0.0
1688d21ab8bcSmrg#
1689d21ab8bcSmrg# Determine which sections man pages go in for the different man page types
1690d21ab8bcSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1691d21ab8bcSmrg# Not sure if there's any better way than just hardcoding by OS name.
1692d21ab8bcSmrg# Override default settings by setting environment variables
1693d21ab8bcSmrg# Added MAN_SUBSTS in version 1.8
1694d21ab8bcSmrg# Added AC_PROG_SED in version 1.8
16951f0ac6a5Smrg
1696d21ab8bcSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1697d21ab8bcSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1698d21ab8bcSmrgAC_REQUIRE([AC_PROG_SED])
16991f0ac6a5Smrg
1700d21ab8bcSmrgcase $host_os in
1701d21ab8bcSmrg    solaris*)
1702d21ab8bcSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1703d21ab8bcSmrg        # check for a man page file found in later versions that use
1704d21ab8bcSmrg        # traditional section numbers instead
1705d21ab8bcSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1706d21ab8bcSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1707d21ab8bcSmrg        ;;
1708d21ab8bcSmrg    *) SYSV_MAN_SECTIONS=false ;;
1709d21ab8bcSmrgesac
17101f0ac6a5Smrg
1711d21ab8bcSmrgif test x$APP_MAN_SUFFIX = x    ; then
1712d21ab8bcSmrg    APP_MAN_SUFFIX=1
1713d21ab8bcSmrgfi
1714d21ab8bcSmrgif test x$APP_MAN_DIR = x    ; then
1715d21ab8bcSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1716d21ab8bcSmrgfi
17171f0ac6a5Smrg
1718d21ab8bcSmrgif test x$LIB_MAN_SUFFIX = x    ; then
1719d21ab8bcSmrg    LIB_MAN_SUFFIX=3
1720d21ab8bcSmrgfi
1721d21ab8bcSmrgif test x$LIB_MAN_DIR = x    ; then
1722d21ab8bcSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1723d21ab8bcSmrgfi
17241f0ac6a5Smrg
1725d21ab8bcSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1726d21ab8bcSmrg    case $SYSV_MAN_SECTIONS in
1727d21ab8bcSmrg	true)				FILE_MAN_SUFFIX=4  ;;
1728d21ab8bcSmrg	*)				FILE_MAN_SUFFIX=5  ;;
1729d21ab8bcSmrg    esac
1730d21ab8bcSmrgfi
1731d21ab8bcSmrgif test x$FILE_MAN_DIR = x    ; then
1732d21ab8bcSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1733d21ab8bcSmrgfi
17349c9ff80cSmrg
1735d21ab8bcSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1736d21ab8bcSmrg    case $SYSV_MAN_SECTIONS in
1737d21ab8bcSmrg	true)				MISC_MAN_SUFFIX=5  ;;
1738d21ab8bcSmrg	*)				MISC_MAN_SUFFIX=7  ;;
1739d21ab8bcSmrg    esac
1740d21ab8bcSmrgfi
1741d21ab8bcSmrgif test x$MISC_MAN_DIR = x    ; then
1742d21ab8bcSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1743d21ab8bcSmrgfi
17449c9ff80cSmrg
1745d21ab8bcSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1746d21ab8bcSmrg    case $SYSV_MAN_SECTIONS in
1747d21ab8bcSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1748d21ab8bcSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1749d21ab8bcSmrg    esac
1750d21ab8bcSmrgfi
1751d21ab8bcSmrgif test x$DRIVER_MAN_DIR = x    ; then
1752d21ab8bcSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1753d21ab8bcSmrgfi
17549c9ff80cSmrg
1755d21ab8bcSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1756d21ab8bcSmrg    case $SYSV_MAN_SECTIONS in
1757d21ab8bcSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1758d21ab8bcSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
1759d21ab8bcSmrg    esac
1760d21ab8bcSmrgfi
1761d21ab8bcSmrgif test x$ADMIN_MAN_DIR = x    ; then
1762d21ab8bcSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1763d21ab8bcSmrgfi
17649c9ff80cSmrg
17659c9ff80cSmrg
1766d21ab8bcSmrgAC_SUBST([APP_MAN_SUFFIX])
1767d21ab8bcSmrgAC_SUBST([LIB_MAN_SUFFIX])
1768d21ab8bcSmrgAC_SUBST([FILE_MAN_SUFFIX])
1769d21ab8bcSmrgAC_SUBST([MISC_MAN_SUFFIX])
1770d21ab8bcSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1771d21ab8bcSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1772d21ab8bcSmrgAC_SUBST([APP_MAN_DIR])
1773d21ab8bcSmrgAC_SUBST([LIB_MAN_DIR])
1774d21ab8bcSmrgAC_SUBST([FILE_MAN_DIR])
1775d21ab8bcSmrgAC_SUBST([MISC_MAN_DIR])
1776d21ab8bcSmrgAC_SUBST([DRIVER_MAN_DIR])
1777d21ab8bcSmrgAC_SUBST([ADMIN_MAN_DIR])
17789c9ff80cSmrg
1779d21ab8bcSmrgXORG_MAN_PAGE="X Version 11"
1780d21ab8bcSmrgAC_SUBST([XORG_MAN_PAGE])
1781d21ab8bcSmrgMAN_SUBSTS="\
1782d21ab8bcSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1783d21ab8bcSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1784d21ab8bcSmrg	-e 's|__xservername__|Xorg|g' \
1785d21ab8bcSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
1786d21ab8bcSmrg	-e 's|__projectroot__|\$(prefix)|g' \
1787d21ab8bcSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1788d21ab8bcSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1789d21ab8bcSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1790d21ab8bcSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1791d21ab8bcSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1792d21ab8bcSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1793d21ab8bcSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1794d21ab8bcSmrgAC_SUBST([MAN_SUBSTS])
17959c9ff80cSmrg
1796d21ab8bcSmrg]) # XORG_MANPAGE_SECTIONS
17979c9ff80cSmrg
1798d21ab8bcSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1799d21ab8bcSmrg# ------------------------
1800d21ab8bcSmrg# Minimum version: 1.7.0
1801d21ab8bcSmrg#
1802d21ab8bcSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1803d21ab8bcSmrg# provided by xorg-sgml-doctools, if installed.
1804d21ab8bcSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1805d21ab8bcSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1806d21ab8bcSmrgXORG_SGML_PATH=
1807d21ab8bcSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1808d21ab8bcSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1809d21ab8bcSmrg    [m4_ifval([$1],[:],
1810d21ab8bcSmrg        [if test x"$cross_compiling" != x"yes" ; then
1811d21ab8bcSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1812d21ab8bcSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1813d21ab8bcSmrg         fi])
1814d21ab8bcSmrg    ])
1815d21ab8bcSmrg
1816d21ab8bcSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1817d21ab8bcSmrg# the path and the name of the doc stylesheet
1818d21ab8bcSmrgif test "x$XORG_SGML_PATH" != "x" ; then
1819d21ab8bcSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1820d21ab8bcSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1821d21ab8bcSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
18222fd96bc7Smrgelse
1823d21ab8bcSmrg   AC_MSG_RESULT([no])
18242fd96bc7Smrgfi
18259c9ff80cSmrg
1826d21ab8bcSmrgAC_SUBST(XORG_SGML_PATH)
1827d21ab8bcSmrgAC_SUBST(STYLESHEET_SRCDIR)
1828d21ab8bcSmrgAC_SUBST(XSL_STYLESHEET)
1829d21ab8bcSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1830d21ab8bcSmrg]) # XORG_CHECK_SGML_DOCTOOLS
18319c9ff80cSmrg
1832d21ab8bcSmrg# XORG_CHECK_LINUXDOC
18336fae4e5dSmrg# -------------------
1834d21ab8bcSmrg# Minimum version: 1.0.0
1835d21ab8bcSmrg#
1836d21ab8bcSmrg# Defines the variable MAKE_TEXT if the necessary tools and
1837d21ab8bcSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1838d21ab8bcSmrg# Whether or not the necessary tools and files are found can be checked
1839d21ab8bcSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1840d21ab8bcSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1841d21ab8bcSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1842d21ab8bcSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
18439c9ff80cSmrg
1844d21ab8bcSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
18459c9ff80cSmrg
1846d21ab8bcSmrgAC_MSG_CHECKING([whether to build documentation])
18479c9ff80cSmrg
1848d21ab8bcSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1849d21ab8bcSmrg   BUILDDOC=yes
18502fd96bc7Smrgelse
1851d21ab8bcSmrg   BUILDDOC=no
18522fd96bc7Smrgfi
18539c9ff80cSmrg
1854d21ab8bcSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
18559c9ff80cSmrg
1856d21ab8bcSmrgAC_MSG_RESULT([$BUILDDOC])
18571f0ac6a5Smrg
1858d21ab8bcSmrgAC_MSG_CHECKING([whether to build pdf documentation])
18591f0ac6a5Smrg
1860d21ab8bcSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1861d21ab8bcSmrg   BUILDPDFDOC=yes
1862d21ab8bcSmrgelse
1863d21ab8bcSmrg   BUILDPDFDOC=no
1864d21ab8bcSmrgfi
18651f0ac6a5Smrg
1866d21ab8bcSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
18671f0ac6a5Smrg
1868d21ab8bcSmrgAC_MSG_RESULT([$BUILDPDFDOC])
18691f0ac6a5Smrg
1870d21ab8bcSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1871d21ab8bcSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1872d21ab8bcSmrgMAKE_PDF="$PS2PDF"
1873d21ab8bcSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
18741f0ac6a5Smrg
1875d21ab8bcSmrgAC_SUBST(MAKE_TEXT)
1876d21ab8bcSmrgAC_SUBST(MAKE_PS)
1877d21ab8bcSmrgAC_SUBST(MAKE_PDF)
1878d21ab8bcSmrgAC_SUBST(MAKE_HTML)
1879d21ab8bcSmrg]) # XORG_CHECK_LINUXDOC
18809c9ff80cSmrg
1881d21ab8bcSmrg# XORG_CHECK_DOCBOOK
1882d21ab8bcSmrg# -------------------
1883d21ab8bcSmrg# Minimum version: 1.0.0
1884d21ab8bcSmrg#
1885d21ab8bcSmrg# Checks for the ability to build output formats from SGML DocBook source.
1886d21ab8bcSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1887d21ab8bcSmrg# indicates whether the necessary tools and files are found and, if set,
1888d21ab8bcSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1889d21ab8bcSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1890d21ab8bcSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
18911f0ac6a5Smrg
1892d21ab8bcSmrgBUILDTXTDOC=no
1893d21ab8bcSmrgBUILDPDFDOC=no
1894d21ab8bcSmrgBUILDPSDOC=no
1895d21ab8bcSmrgBUILDHTMLDOC=no
18961f0ac6a5Smrg
1897d21ab8bcSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1898d21ab8bcSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1899d21ab8bcSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1900d21ab8bcSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
19011f0ac6a5Smrg
1902d21ab8bcSmrgAC_MSG_CHECKING([whether to build text documentation])
1903d21ab8bcSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1904d21ab8bcSmrg   test x$BUILD_TXTDOC != xno; then
1905d21ab8bcSmrg	BUILDTXTDOC=yes
1906d21ab8bcSmrgfi
1907d21ab8bcSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1908d21ab8bcSmrgAC_MSG_RESULT([$BUILDTXTDOC])
19091f0ac6a5Smrg
1910d21ab8bcSmrgAC_MSG_CHECKING([whether to build PDF documentation])
1911d21ab8bcSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1912d21ab8bcSmrg   test x$BUILD_PDFDOC != xno; then
1913d21ab8bcSmrg	BUILDPDFDOC=yes
19142fd96bc7Smrgfi
1915d21ab8bcSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1916d21ab8bcSmrgAC_MSG_RESULT([$BUILDPDFDOC])
19171f0ac6a5Smrg
1918d21ab8bcSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1919d21ab8bcSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1920d21ab8bcSmrg   test x$BUILD_PSDOC != xno; then
1921d21ab8bcSmrg	BUILDPSDOC=yes
1922d21ab8bcSmrgfi
1923d21ab8bcSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1924d21ab8bcSmrgAC_MSG_RESULT([$BUILDPSDOC])
19251f0ac6a5Smrg
1926d21ab8bcSmrgAC_MSG_CHECKING([whether to build HTML documentation])
1927d21ab8bcSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1928d21ab8bcSmrg   test x$BUILD_HTMLDOC != xno; then
1929d21ab8bcSmrg	BUILDHTMLDOC=yes
1930d21ab8bcSmrgfi
1931d21ab8bcSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1932d21ab8bcSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
19331f0ac6a5Smrg
1934d21ab8bcSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1935d21ab8bcSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1936d21ab8bcSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1937d21ab8bcSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
19381f0ac6a5Smrg
1939d21ab8bcSmrgAC_SUBST(MAKE_TEXT)
1940d21ab8bcSmrgAC_SUBST(MAKE_PS)
1941d21ab8bcSmrgAC_SUBST(MAKE_PDF)
1942d21ab8bcSmrgAC_SUBST(MAKE_HTML)
1943d21ab8bcSmrg]) # XORG_CHECK_DOCBOOK
19441f0ac6a5Smrg
1945d21ab8bcSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1946d21ab8bcSmrg# ----------------
1947d21ab8bcSmrg# Minimum version: 1.5.0
1948d21ab8bcSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1949d21ab8bcSmrg#
1950d21ab8bcSmrg# Documentation tools are not always available on all platforms and sometimes
1951d21ab8bcSmrg# not at the appropriate level. This macro enables a module to test for the
1952d21ab8bcSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
19536ee7d557Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
1954d21ab8bcSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1955d21ab8bcSmrg# --with-xmlto assumes 'auto'.
1956d21ab8bcSmrg#
1957d21ab8bcSmrg# Interface to module:
1958d21ab8bcSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1959d21ab8bcSmrg# XMLTO:	returns the path of the xmlto program found
1960d21ab8bcSmrg#		returns the path set by the user in the environment
1961d21ab8bcSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1962d21ab8bcSmrg#		'no' user instructs the module not to use xmlto
1963d21ab8bcSmrg#
1964d21ab8bcSmrg# Added in version 1.10.0
1965d21ab8bcSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1966d21ab8bcSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1967d21ab8bcSmrg#
1968d21ab8bcSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1969d21ab8bcSmrg#
1970d21ab8bcSmrgAC_DEFUN([XORG_WITH_XMLTO],[
1971d21ab8bcSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1972d21ab8bcSmrgm4_define([_defopt], m4_default([$2], [auto]))
1973d21ab8bcSmrgAC_ARG_WITH(xmlto,
1974d21ab8bcSmrg	AS_HELP_STRING([--with-xmlto],
1975d21ab8bcSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1976d21ab8bcSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1977d21ab8bcSmrgm4_undefine([_defopt])
19781f0ac6a5Smrg
1979d21ab8bcSmrgif test "x$use_xmlto" = x"auto"; then
1980d21ab8bcSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1981d21ab8bcSmrg   if test "x$XMLTO" = "x"; then
1982d21ab8bcSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1983d21ab8bcSmrg	have_xmlto=no
1984d21ab8bcSmrg   else
1985d21ab8bcSmrg        have_xmlto=yes
1986d21ab8bcSmrg   fi
1987d21ab8bcSmrgelif test "x$use_xmlto" = x"yes" ; then
1988d21ab8bcSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1989d21ab8bcSmrg   if test "x$XMLTO" = "x"; then
1990d21ab8bcSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1991d21ab8bcSmrg   fi
1992d21ab8bcSmrg   have_xmlto=yes
1993d21ab8bcSmrgelif test "x$use_xmlto" = x"no" ; then
1994d21ab8bcSmrg   if test "x$XMLTO" != "x"; then
1995d21ab8bcSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1996d21ab8bcSmrg   fi
1997d21ab8bcSmrg   have_xmlto=no
1998d21ab8bcSmrgelse
1999d21ab8bcSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
20002fd96bc7Smrgfi
20011f0ac6a5Smrg
2002d21ab8bcSmrg# Test for a minimum version of xmlto, if provided.
2003d21ab8bcSmrgm4_ifval([$1],
2004d21ab8bcSmrg[if test "$have_xmlto" = yes; then
2005d21ab8bcSmrg    # scrape the xmlto version
2006d21ab8bcSmrg    AC_MSG_CHECKING([the xmlto version])
2007d21ab8bcSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
2008d21ab8bcSmrg    AC_MSG_RESULT([$xmlto_version])
2009d21ab8bcSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
2010d21ab8bcSmrg        [if test "x$use_xmlto" = xauto; then
2011d21ab8bcSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
2012d21ab8bcSmrg            have_xmlto=no
2013d21ab8bcSmrg        else
2014d21ab8bcSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
2015d21ab8bcSmrg        fi])
2016d21ab8bcSmrgfi])
20179c9ff80cSmrg
2018d21ab8bcSmrg# Test for the ability of xmlto to generate a text target
2019d21ab8bcSmrg#
2020d21ab8bcSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
2021d21ab8bcSmrg# following test for empty XML docbook files.
2022d21ab8bcSmrg# For compatibility reasons use the following empty XML docbook file and if
2023d21ab8bcSmrg# it fails try it again with a non-empty XML file.
2024d21ab8bcSmrghave_xmlto_text=no
2025d21ab8bcSmrgcat > conftest.xml << "EOF"
2026d21ab8bcSmrgEOF
2027d21ab8bcSmrgAS_IF([test "$have_xmlto" = yes],
2028d21ab8bcSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2029d21ab8bcSmrg             [have_xmlto_text=yes],
2030d21ab8bcSmrg             [# Try it again with a non-empty XML file.
2031d21ab8bcSmrg              cat > conftest.xml << "EOF"
2032d21ab8bcSmrg<x></x>
2033d21ab8bcSmrgEOF
2034d21ab8bcSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2035d21ab8bcSmrg                    [have_xmlto_text=yes],
2036d21ab8bcSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
2037d21ab8bcSmrgrm -f conftest.xml
2038d21ab8bcSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
2039d21ab8bcSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
2040d21ab8bcSmrg]) # XORG_WITH_XMLTO
20419c9ff80cSmrg
2042d21ab8bcSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
2043d21ab8bcSmrg# --------------------------------------------
2044d21ab8bcSmrg# Minimum version: 1.12.0
2045d21ab8bcSmrg# Minimum version for optional DEFAULT argument: 1.12.0
2046d21ab8bcSmrg#
2047d21ab8bcSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
2048d21ab8bcSmrg# XML-based language used for the transformation of XML documents.
2049d21ab8bcSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
2050d21ab8bcSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
2051d21ab8bcSmrg# The XSLT processor is often used as a standalone tool for transformations.
2052d21ab8bcSmrg# It should not be assumed that this tool is used only to work with documnetation.
2053d21ab8bcSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
2054d21ab8bcSmrg#
2055d21ab8bcSmrg# Interface to module:
2056d21ab8bcSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
2057d21ab8bcSmrg# XSLTPROC:	 returns the path of the xsltproc program found
2058d21ab8bcSmrg#		 returns the path set by the user in the environment
2059d21ab8bcSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
2060d21ab8bcSmrg#		  'no' user instructs the module not to use xsltproc
2061d21ab8bcSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
2062d21ab8bcSmrg#
2063d21ab8bcSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
2064d21ab8bcSmrg#
2065d21ab8bcSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
2066d21ab8bcSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
2067d21ab8bcSmrg# Preserves the interface, should it be implemented later
2068d21ab8bcSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
2069d21ab8bcSmrgm4_define([_defopt], m4_default([$2], [auto]))
2070d21ab8bcSmrgAC_ARG_WITH(xsltproc,
2071d21ab8bcSmrg	AS_HELP_STRING([--with-xsltproc],
2072d21ab8bcSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
2073d21ab8bcSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
2074d21ab8bcSmrgm4_undefine([_defopt])
2075d21ab8bcSmrg
2076d21ab8bcSmrgif test "x$use_xsltproc" = x"auto"; then
2077d21ab8bcSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
2078d21ab8bcSmrg   if test "x$XSLTPROC" = "x"; then
2079d21ab8bcSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
2080d21ab8bcSmrg	have_xsltproc=no
2081d21ab8bcSmrg   else
2082d21ab8bcSmrg        have_xsltproc=yes
2083d21ab8bcSmrg   fi
2084d21ab8bcSmrgelif test "x$use_xsltproc" = x"yes" ; then
2085d21ab8bcSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
2086d21ab8bcSmrg   if test "x$XSLTPROC" = "x"; then
2087d21ab8bcSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
2088d21ab8bcSmrg   fi
2089d21ab8bcSmrg   have_xsltproc=yes
2090d21ab8bcSmrgelif test "x$use_xsltproc" = x"no" ; then
2091d21ab8bcSmrg   if test "x$XSLTPROC" != "x"; then
2092d21ab8bcSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
2093d21ab8bcSmrg   fi
2094d21ab8bcSmrg   have_xsltproc=no
20952fd96bc7Smrgelse
2096d21ab8bcSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
20972fd96bc7Smrgfi
20989c9ff80cSmrg
2099d21ab8bcSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
2100d21ab8bcSmrg]) # XORG_WITH_XSLTPROC
21019c9ff80cSmrg
2102d21ab8bcSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
2103d21ab8bcSmrg# ----------------------------------------
2104d21ab8bcSmrg# Minimum version: 1.15.0
2105d21ab8bcSmrg#
2106d21ab8bcSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
2107d21ab8bcSmrg# scanning arbitrary text files, extracting information from those text files,
2108d21ab8bcSmrg# and printing reports based on that information.
2109d21ab8bcSmrg#
2110d21ab8bcSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
2111d21ab8bcSmrg#
2112d21ab8bcSmrg# Interface to module:
2113d21ab8bcSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
2114d21ab8bcSmrg# PERL:	     returns the path of the perl program found
2115d21ab8bcSmrg#	     returns the path set by the user in the environment
2116d21ab8bcSmrg# --with-perl: 'yes' user instructs the module to use perl
2117d21ab8bcSmrg#	       'no' user instructs the module not to use perl
2118d21ab8bcSmrg# have_perl: returns yes if perl found in PATH or no
2119d21ab8bcSmrg#
2120d21ab8bcSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
2121d21ab8bcSmrg#
2122d21ab8bcSmrgAC_DEFUN([XORG_WITH_PERL],[
2123d21ab8bcSmrgAC_ARG_VAR([PERL], [Path to perl command])
2124d21ab8bcSmrg# Preserves the interface, should it be implemented later
2125d21ab8bcSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
2126d21ab8bcSmrgm4_define([_defopt], m4_default([$2], [auto]))
2127d21ab8bcSmrgAC_ARG_WITH(perl,
2128d21ab8bcSmrg	AS_HELP_STRING([--with-perl],
2129d21ab8bcSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
2130d21ab8bcSmrg	   [use_perl=$withval], [use_perl=]_defopt)
2131d21ab8bcSmrgm4_undefine([_defopt])
21329c9ff80cSmrg
2133d21ab8bcSmrgif test "x$use_perl" = x"auto"; then
2134d21ab8bcSmrg   AC_PATH_PROG([PERL], [perl])
2135d21ab8bcSmrg   if test "x$PERL" = "x"; then
2136d21ab8bcSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
2137d21ab8bcSmrg	have_perl=no
2138d21ab8bcSmrg   else
2139d21ab8bcSmrg        have_perl=yes
21402fd96bc7Smrg   fi
2141d21ab8bcSmrgelif test "x$use_perl" = x"yes" ; then
2142d21ab8bcSmrg   AC_PATH_PROG([PERL], [perl])
2143d21ab8bcSmrg   if test "x$PERL" = "x"; then
2144d21ab8bcSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
2145d21ab8bcSmrg   fi
2146d21ab8bcSmrg   have_perl=yes
2147d21ab8bcSmrgelif test "x$use_perl" = x"no" ; then
2148d21ab8bcSmrg   if test "x$PERL" != "x"; then
2149d21ab8bcSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
2150d21ab8bcSmrg   fi
2151d21ab8bcSmrg   have_perl=no
21522fd96bc7Smrgelse
2153d21ab8bcSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
21542fd96bc7Smrgfi
21551f0ac6a5Smrg
2156d21ab8bcSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2157d21ab8bcSmrg]) # XORG_WITH_PERL
21581f0ac6a5Smrg
2159d21ab8bcSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2160d21ab8bcSmrg# ----------------
2161d21ab8bcSmrg# Minimum version: 1.5.0
2162d21ab8bcSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2163d21ab8bcSmrg#
2164d21ab8bcSmrg# Documentation tools are not always available on all platforms and sometimes
2165d21ab8bcSmrg# not at the appropriate level. This macro enables a module to test for the
2166d21ab8bcSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
21676ee7d557Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
2168d21ab8bcSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2169d21ab8bcSmrg# --with-asciidoc assumes 'auto'.
2170d21ab8bcSmrg#
2171d21ab8bcSmrg# Interface to module:
2172d21ab8bcSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2173d21ab8bcSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
2174d21ab8bcSmrg#		 returns the path set by the user in the environment
2175d21ab8bcSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2176d21ab8bcSmrg#		  'no' user instructs the module not to use asciidoc
2177d21ab8bcSmrg#
2178d21ab8bcSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2179d21ab8bcSmrg#
2180d21ab8bcSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2181d21ab8bcSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2182d21ab8bcSmrgm4_define([_defopt], m4_default([$2], [auto]))
2183d21ab8bcSmrgAC_ARG_WITH(asciidoc,
2184d21ab8bcSmrg	AS_HELP_STRING([--with-asciidoc],
2185d21ab8bcSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2186d21ab8bcSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2187d21ab8bcSmrgm4_undefine([_defopt])
218889c04b6cSmrg
2189d21ab8bcSmrgif test "x$use_asciidoc" = x"auto"; then
2190d21ab8bcSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2191d21ab8bcSmrg   if test "x$ASCIIDOC" = "x"; then
2192d21ab8bcSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2193d21ab8bcSmrg	have_asciidoc=no
2194d21ab8bcSmrg   else
2195d21ab8bcSmrg        have_asciidoc=yes
2196d21ab8bcSmrg   fi
2197d21ab8bcSmrgelif test "x$use_asciidoc" = x"yes" ; then
2198d21ab8bcSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2199d21ab8bcSmrg   if test "x$ASCIIDOC" = "x"; then
2200d21ab8bcSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2201d21ab8bcSmrg   fi
2202d21ab8bcSmrg   have_asciidoc=yes
2203d21ab8bcSmrgelif test "x$use_asciidoc" = x"no" ; then
2204d21ab8bcSmrg   if test "x$ASCIIDOC" != "x"; then
2205d21ab8bcSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2206d21ab8bcSmrg   fi
2207d21ab8bcSmrg   have_asciidoc=no
2208d21ab8bcSmrgelse
2209d21ab8bcSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2210d21ab8bcSmrgfi
2211d21ab8bcSmrgm4_ifval([$1],
2212d21ab8bcSmrg[if test "$have_asciidoc" = yes; then
2213d21ab8bcSmrg    # scrape the asciidoc version
2214d21ab8bcSmrg    AC_MSG_CHECKING([the asciidoc version])
2215d21ab8bcSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2216d21ab8bcSmrg    AC_MSG_RESULT([$asciidoc_version])
2217d21ab8bcSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2218d21ab8bcSmrg        [if test "x$use_asciidoc" = xauto; then
2219d21ab8bcSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2220d21ab8bcSmrg            have_asciidoc=no
2221d21ab8bcSmrg        else
2222d21ab8bcSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2223d21ab8bcSmrg        fi])
2224d21ab8bcSmrgfi])
2225d21ab8bcSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2226d21ab8bcSmrg]) # XORG_WITH_ASCIIDOC
222789c04b6cSmrg
2228d21ab8bcSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
2229d21ab8bcSmrg# -------------------------------------------
2230d21ab8bcSmrg# Minimum version: 1.5.0
2231d21ab8bcSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2232d21ab8bcSmrg# Minimum version for optional DOT checking: 1.18.0
2233d21ab8bcSmrg#
2234d21ab8bcSmrg# Documentation tools are not always available on all platforms and sometimes
2235d21ab8bcSmrg# not at the appropriate level. This macro enables a module to test for the
2236d21ab8bcSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
22376ee7d557Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
2238d21ab8bcSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2239d21ab8bcSmrg# --with-doxygen assumes 'auto'.
2240d21ab8bcSmrg#
2241d21ab8bcSmrg# Interface to module:
2242d21ab8bcSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2243d21ab8bcSmrg# DOXYGEN:	 returns the path of the doxygen program found
2244d21ab8bcSmrg#		 returns the path set by the user in the environment
2245d21ab8bcSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2246d21ab8bcSmrg#		  'no' user instructs the module not to use doxygen
2247d21ab8bcSmrg#
2248d21ab8bcSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2249d21ab8bcSmrg#
2250d21ab8bcSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2251d21ab8bcSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2252d21ab8bcSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
2253d21ab8bcSmrgm4_define([_defopt], m4_default([$2], [auto]))
2254d21ab8bcSmrgAC_ARG_WITH(doxygen,
2255d21ab8bcSmrg	AS_HELP_STRING([--with-doxygen],
2256d21ab8bcSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2257d21ab8bcSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2258d21ab8bcSmrgm4_undefine([_defopt])
2259e5410a46Smrg
2260d21ab8bcSmrgif test "x$use_doxygen" = x"auto"; then
2261d21ab8bcSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2262d21ab8bcSmrg   if test "x$DOXYGEN" = "x"; then
2263d21ab8bcSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2264d21ab8bcSmrg	have_doxygen=no
2265d21ab8bcSmrg   else
2266d21ab8bcSmrg        have_doxygen=yes
2267d21ab8bcSmrg   fi
2268d21ab8bcSmrgelif test "x$use_doxygen" = x"yes" ; then
2269d21ab8bcSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2270d21ab8bcSmrg   if test "x$DOXYGEN" = "x"; then
2271d21ab8bcSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2272d21ab8bcSmrg   fi
2273d21ab8bcSmrg   have_doxygen=yes
2274d21ab8bcSmrgelif test "x$use_doxygen" = x"no" ; then
2275d21ab8bcSmrg   if test "x$DOXYGEN" != "x"; then
2276d21ab8bcSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2277d21ab8bcSmrg   fi
2278d21ab8bcSmrg   have_doxygen=no
2279d21ab8bcSmrgelse
2280d21ab8bcSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2281d21ab8bcSmrgfi
2282d21ab8bcSmrgm4_ifval([$1],
2283d21ab8bcSmrg[if test "$have_doxygen" = yes; then
2284d21ab8bcSmrg    # scrape the doxygen version
2285d21ab8bcSmrg    AC_MSG_CHECKING([the doxygen version])
2286d21ab8bcSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2287d21ab8bcSmrg    AC_MSG_RESULT([$doxygen_version])
2288d21ab8bcSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2289d21ab8bcSmrg        [if test "x$use_doxygen" = xauto; then
2290d21ab8bcSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2291d21ab8bcSmrg            have_doxygen=no
2292d21ab8bcSmrg        else
2293d21ab8bcSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2294d21ab8bcSmrg        fi])
2295d21ab8bcSmrgfi])
22961f0ac6a5Smrg
2297d21ab8bcSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2298d21ab8bcSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2299d21ab8bcSmrgdnl 	HAVE_DOT = @HAVE_DOT@
2300d21ab8bcSmrgHAVE_DOT=no
2301d21ab8bcSmrgif test "x$have_doxygen" = "xyes"; then
2302d21ab8bcSmrg  AC_PATH_PROG([DOT], [dot])
2303d21ab8bcSmrg    if test "x$DOT" != "x"; then
2304d21ab8bcSmrg      HAVE_DOT=yes
23052fd96bc7Smrg    fi
2306d21ab8bcSmrgfi
23071f0ac6a5Smrg
2308d21ab8bcSmrgAC_SUBST([HAVE_DOT])
2309d21ab8bcSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2310d21ab8bcSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2311d21ab8bcSmrg]) # XORG_WITH_DOXYGEN
23129c9ff80cSmrg
2313d21ab8bcSmrg# XORG_WITH_GROFF([DEFAULT])
2314d21ab8bcSmrg# ----------------
2315d21ab8bcSmrg# Minimum version: 1.6.0
2316d21ab8bcSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2317d21ab8bcSmrg#
2318d21ab8bcSmrg# Documentation tools are not always available on all platforms and sometimes
2319d21ab8bcSmrg# not at the appropriate level. This macro enables a module to test for the
2320d21ab8bcSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
23216ee7d557Smrg# the --with-groff option, it allows maximum flexibility in making decisions
2322d21ab8bcSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
2323d21ab8bcSmrg# --with-groff assumes 'auto'.
2324d21ab8bcSmrg#
2325d21ab8bcSmrg# Interface to module:
2326d21ab8bcSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2327d21ab8bcSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2328d21ab8bcSmrg# HAVE_GROFF_MS: the -ms macros package
2329d21ab8bcSmrg# GROFF:	 returns the path of the groff program found
2330d21ab8bcSmrg#		 returns the path set by the user in the environment
2331d21ab8bcSmrg# --with-groff:	 'yes' user instructs the module to use groff
2332d21ab8bcSmrg#		 'no' user instructs the module not to use groff
2333d21ab8bcSmrg#
2334d21ab8bcSmrg# Added in version 1.9.0:
2335d21ab8bcSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2336d21ab8bcSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2337d21ab8bcSmrg#		   psselect from the psutils package.
2338d21ab8bcSmrg#		   the ghostcript package. Refer to the grohtml man pages
2339d21ab8bcSmrg#
2340d21ab8bcSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2341d21ab8bcSmrg#
2342d21ab8bcSmrg# OS and distros often splits groff in a basic and full package, the former
2343d21ab8bcSmrg# having the groff program and the later having devices, fonts and macros
2344d21ab8bcSmrg# Checking for the groff executable is not enough.
2345d21ab8bcSmrg#
2346d21ab8bcSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
2347d21ab8bcSmrg# unset HAVE_GROFF or GROFF env variables.
2348d21ab8bcSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2349d21ab8bcSmrg#
2350d21ab8bcSmrgAC_DEFUN([XORG_WITH_GROFF],[
2351d21ab8bcSmrgAC_ARG_VAR([GROFF], [Path to groff command])
2352d21ab8bcSmrgm4_define([_defopt], m4_default([$1], [auto]))
2353d21ab8bcSmrgAC_ARG_WITH(groff,
2354d21ab8bcSmrg	AS_HELP_STRING([--with-groff],
2355d21ab8bcSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2356d21ab8bcSmrg	   [use_groff=$withval], [use_groff=]_defopt)
2357d21ab8bcSmrgm4_undefine([_defopt])
235889c04b6cSmrg
2359d21ab8bcSmrgif test "x$use_groff" = x"auto"; then
2360d21ab8bcSmrg   AC_PATH_PROG([GROFF], [groff])
2361d21ab8bcSmrg   if test "x$GROFF" = "x"; then
2362d21ab8bcSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2363d21ab8bcSmrg	have_groff=no
2364d21ab8bcSmrg   else
2365d21ab8bcSmrg        have_groff=yes
2366d21ab8bcSmrg   fi
2367d21ab8bcSmrgelif test "x$use_groff" = x"yes" ; then
2368d21ab8bcSmrg   AC_PATH_PROG([GROFF], [groff])
2369d21ab8bcSmrg   if test "x$GROFF" = "x"; then
2370d21ab8bcSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2371d21ab8bcSmrg   fi
2372d21ab8bcSmrg   have_groff=yes
2373d21ab8bcSmrgelif test "x$use_groff" = x"no" ; then
2374d21ab8bcSmrg   if test "x$GROFF" != "x"; then
2375d21ab8bcSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2376d21ab8bcSmrg   fi
2377d21ab8bcSmrg   have_groff=no
2378d21ab8bcSmrgelse
2379d21ab8bcSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2380d21ab8bcSmrgfi
2381d21ab8bcSmrg
2382d21ab8bcSmrg# We have groff, test for the presence of the macro packages
2383d21ab8bcSmrgif test "x$have_groff" = x"yes"; then
2384d21ab8bcSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2385d21ab8bcSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2386d21ab8bcSmrg        groff_ms_works=yes
2387d21ab8bcSmrg    else
2388d21ab8bcSmrg        groff_ms_works=no
23892fd96bc7Smrg    fi
2390d21ab8bcSmrg    AC_MSG_RESULT([$groff_ms_works])
2391d21ab8bcSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2392d21ab8bcSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2393d21ab8bcSmrg        groff_mm_works=yes
23942fd96bc7Smrg    else
2395d21ab8bcSmrg        groff_mm_works=no
23962fd96bc7Smrg    fi
2397d21ab8bcSmrg    AC_MSG_RESULT([$groff_mm_works])
23982fd96bc7Smrgfi
23999c9ff80cSmrg
2400d21ab8bcSmrg# We have groff, test for HTML dependencies, one command per package
2401d21ab8bcSmrgif test "x$have_groff" = x"yes"; then
2402d21ab8bcSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2403d21ab8bcSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2404d21ab8bcSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2405d21ab8bcSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2406d21ab8bcSmrg      have_groff_html=yes
2407d21ab8bcSmrg   else
2408d21ab8bcSmrg      have_groff_html=no
2409d21ab8bcSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2410d21ab8bcSmrg   fi
2411d21ab8bcSmrgfi
24129c9ff80cSmrg
2413d21ab8bcSmrg# Set Automake conditionals for Makefiles
2414d21ab8bcSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2415d21ab8bcSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2416d21ab8bcSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2417d21ab8bcSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2418d21ab8bcSmrg]) # XORG_WITH_GROFF
24199c9ff80cSmrg
2420d21ab8bcSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2421d21ab8bcSmrg# ---------------------------------------
2422d21ab8bcSmrg# Minimum version: 1.6.0
2423d21ab8bcSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2424d21ab8bcSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2425d21ab8bcSmrg#
2426d21ab8bcSmrg# Documentation tools are not always available on all platforms and sometimes
2427d21ab8bcSmrg# not at the appropriate level. This macro enables a module to test for the
2428d21ab8bcSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
24296ee7d557Smrg# the --with-fop option, it allows maximum flexibility in making decisions
2430d21ab8bcSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
2431d21ab8bcSmrg# --with-fop assumes 'auto'.
2432d21ab8bcSmrg#
2433d21ab8bcSmrg# Interface to module:
2434d21ab8bcSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2435d21ab8bcSmrg# FOP:	 	returns the path of the fop program found
2436d21ab8bcSmrg#		returns the path set by the user in the environment
2437d21ab8bcSmrg# --with-fop: 	'yes' user instructs the module to use fop
2438d21ab8bcSmrg#		'no' user instructs the module not to use fop
2439d21ab8bcSmrg#
2440d21ab8bcSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2441d21ab8bcSmrg#
2442d21ab8bcSmrgAC_DEFUN([XORG_WITH_FOP],[
2443d21ab8bcSmrgAC_ARG_VAR([FOP], [Path to fop command])
2444d21ab8bcSmrgm4_define([_defopt], m4_default([$2], [auto]))
2445d21ab8bcSmrgAC_ARG_WITH(fop,
2446d21ab8bcSmrg	AS_HELP_STRING([--with-fop],
2447d21ab8bcSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2448d21ab8bcSmrg	   [use_fop=$withval], [use_fop=]_defopt)
2449d21ab8bcSmrgm4_undefine([_defopt])
24509c9ff80cSmrg
2451d21ab8bcSmrgif test "x$use_fop" = x"auto"; then
2452d21ab8bcSmrg   AC_PATH_PROG([FOP], [fop])
2453d21ab8bcSmrg   if test "x$FOP" = "x"; then
2454d21ab8bcSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2455d21ab8bcSmrg	have_fop=no
2456d21ab8bcSmrg   else
2457d21ab8bcSmrg        have_fop=yes
2458d21ab8bcSmrg   fi
2459d21ab8bcSmrgelif test "x$use_fop" = x"yes" ; then
2460d21ab8bcSmrg   AC_PATH_PROG([FOP], [fop])
2461d21ab8bcSmrg   if test "x$FOP" = "x"; then
2462d21ab8bcSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2463d21ab8bcSmrg   fi
2464d21ab8bcSmrg   have_fop=yes
2465d21ab8bcSmrgelif test "x$use_fop" = x"no" ; then
2466d21ab8bcSmrg   if test "x$FOP" != "x"; then
2467d21ab8bcSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2468d21ab8bcSmrg   fi
2469d21ab8bcSmrg   have_fop=no
24702fd96bc7Smrgelse
2471d21ab8bcSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2472d21ab8bcSmrgfi
24739c9ff80cSmrg
2474d21ab8bcSmrg# Test for a minimum version of fop, if provided.
2475d21ab8bcSmrgm4_ifval([$1],
2476d21ab8bcSmrg[if test "$have_fop" = yes; then
2477d21ab8bcSmrg    # scrape the fop version
2478d21ab8bcSmrg    AC_MSG_CHECKING([for fop minimum version])
2479d21ab8bcSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2480d21ab8bcSmrg    AC_MSG_RESULT([$fop_version])
2481d21ab8bcSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
2482d21ab8bcSmrg        [if test "x$use_fop" = xauto; then
2483d21ab8bcSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2484d21ab8bcSmrg            have_fop=no
2485d21ab8bcSmrg        else
2486d21ab8bcSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2487d21ab8bcSmrg        fi])
2488d21ab8bcSmrgfi])
2489d21ab8bcSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2490d21ab8bcSmrg]) # XORG_WITH_FOP
24919c9ff80cSmrg
2492d21ab8bcSmrg# XORG_WITH_M4([MIN-VERSION])
2493d21ab8bcSmrg# ---------------------------
2494d21ab8bcSmrg# Minimum version: 1.19.0
2495d21ab8bcSmrg#
2496d21ab8bcSmrg# This macro attempts to locate an m4 macro processor which supports
2497d21ab8bcSmrg# -I option and is only useful for modules relying on M4 in order to
2498d21ab8bcSmrg# expand macros in source code files.
2499d21ab8bcSmrg#
2500d21ab8bcSmrg# Interface to module:
2501d21ab8bcSmrg# M4:	 	returns the path of the m4 program found
2502d21ab8bcSmrg#		returns the path set by the user in the environment
2503d21ab8bcSmrg#
2504d21ab8bcSmrgAC_DEFUN([XORG_WITH_M4], [
2505d21ab8bcSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2506d21ab8bcSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2507d21ab8bcSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2508d21ab8bcSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2509d21ab8bcSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2510d21ab8bcSmrg   [$PATH:/usr/gnu/bin])])
25119c9ff80cSmrg
2512d21ab8bcSmrgAC_SUBST([M4], [$ac_cv_path_M4])
2513d21ab8bcSmrg]) # XORG_WITH_M4
25149c9ff80cSmrg
2515d21ab8bcSmrg# XORG_WITH_PS2PDF([DEFAULT])
2516d21ab8bcSmrg# ----------------
2517d21ab8bcSmrg# Minimum version: 1.6.0
2518d21ab8bcSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2519d21ab8bcSmrg#
2520d21ab8bcSmrg# Documentation tools are not always available on all platforms and sometimes
2521d21ab8bcSmrg# not at the appropriate level. This macro enables a module to test for the
2522d21ab8bcSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
25236ee7d557Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
2524d21ab8bcSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2525d21ab8bcSmrg# --with-ps2pdf assumes 'auto'.
2526d21ab8bcSmrg#
2527d21ab8bcSmrg# Interface to module:
2528d21ab8bcSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2529d21ab8bcSmrg# PS2PDF:	returns the path of the ps2pdf program found
2530d21ab8bcSmrg#		returns the path set by the user in the environment
2531d21ab8bcSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2532d21ab8bcSmrg#		 'no' user instructs the module not to use ps2pdf
2533d21ab8bcSmrg#
2534d21ab8bcSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2535d21ab8bcSmrg#
2536d21ab8bcSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2537d21ab8bcSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2538d21ab8bcSmrgm4_define([_defopt], m4_default([$1], [auto]))
2539d21ab8bcSmrgAC_ARG_WITH(ps2pdf,
2540d21ab8bcSmrg	AS_HELP_STRING([--with-ps2pdf],
2541d21ab8bcSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2542d21ab8bcSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2543d21ab8bcSmrgm4_undefine([_defopt])
25449c9ff80cSmrg
2545d21ab8bcSmrgif test "x$use_ps2pdf" = x"auto"; then
2546d21ab8bcSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2547d21ab8bcSmrg   if test "x$PS2PDF" = "x"; then
2548d21ab8bcSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2549d21ab8bcSmrg	have_ps2pdf=no
2550d21ab8bcSmrg   else
2551d21ab8bcSmrg        have_ps2pdf=yes
2552d21ab8bcSmrg   fi
2553d21ab8bcSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2554d21ab8bcSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2555d21ab8bcSmrg   if test "x$PS2PDF" = "x"; then
2556d21ab8bcSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2557d21ab8bcSmrg   fi
2558d21ab8bcSmrg   have_ps2pdf=yes
2559d21ab8bcSmrgelif test "x$use_ps2pdf" = x"no" ; then
2560d21ab8bcSmrg   if test "x$PS2PDF" != "x"; then
2561d21ab8bcSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2562d21ab8bcSmrg   fi
2563d21ab8bcSmrg   have_ps2pdf=no
2564d21ab8bcSmrgelse
2565d21ab8bcSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2566d21ab8bcSmrgfi
2567d21ab8bcSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2568d21ab8bcSmrg]) # XORG_WITH_PS2PDF
256989c04b6cSmrg
2570d21ab8bcSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2571d21ab8bcSmrg# ----------------
2572d21ab8bcSmrg# Minimum version: 1.6.0
2573d21ab8bcSmrg#
2574d21ab8bcSmrg# Documentation tools are not always available on all platforms and sometimes
2575d21ab8bcSmrg# not at the appropriate level. This macro enables a builder to skip all
2576d21ab8bcSmrg# documentation targets except traditional man pages.
2577d21ab8bcSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
25786ee7d557Smrg# maximum flexibility in controlling documentation building.
2579d21ab8bcSmrg# Refer to:
2580d21ab8bcSmrg# XORG_WITH_XMLTO         --with-xmlto
2581d21ab8bcSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2582d21ab8bcSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2583d21ab8bcSmrg# XORG_WITH_FOP           --with-fop
2584d21ab8bcSmrg# XORG_WITH_GROFF         --with-groff
2585d21ab8bcSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2586d21ab8bcSmrg#
2587d21ab8bcSmrg# Interface to module:
2588d21ab8bcSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2589d21ab8bcSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2590d21ab8bcSmrg#		 'no' user instructs the module not to generate docs
2591d21ab8bcSmrg# parm1:	specify the default value, yes or no.
2592d21ab8bcSmrg#
2593d21ab8bcSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2594d21ab8bcSmrgm4_define([docs_default], m4_default([$1], [yes]))
2595d21ab8bcSmrgAC_ARG_ENABLE(docs,
2596d21ab8bcSmrg	AS_HELP_STRING([--enable-docs],
2597d21ab8bcSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2598d21ab8bcSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2599d21ab8bcSmrgm4_undefine([docs_default])
2600d21ab8bcSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2601d21ab8bcSmrgAC_MSG_CHECKING([whether to build documentation])
2602d21ab8bcSmrgAC_MSG_RESULT([$build_docs])
2603d21ab8bcSmrg]) # XORG_ENABLE_DOCS
26042fd96bc7Smrg
2605d21ab8bcSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2606d21ab8bcSmrg# ----------------
2607d21ab8bcSmrg# Minimum version: 1.6.0
2608d21ab8bcSmrg#
2609d21ab8bcSmrg# This macro enables a builder to skip all developer documentation.
2610d21ab8bcSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
26116ee7d557Smrg# maximum flexibility in controlling documentation building.
2612d21ab8bcSmrg# Refer to:
2613d21ab8bcSmrg# XORG_WITH_XMLTO         --with-xmlto
2614d21ab8bcSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2615d21ab8bcSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2616d21ab8bcSmrg# XORG_WITH_FOP           --with-fop
2617d21ab8bcSmrg# XORG_WITH_GROFF         --with-groff
2618d21ab8bcSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2619d21ab8bcSmrg#
2620d21ab8bcSmrg# Interface to module:
2621d21ab8bcSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2622d21ab8bcSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2623d21ab8bcSmrg#			'no' user instructs the module not to generate developer docs
2624d21ab8bcSmrg# parm1:		specify the default value, yes or no.
2625d21ab8bcSmrg#
2626d21ab8bcSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2627d21ab8bcSmrgm4_define([devel_default], m4_default([$1], [yes]))
2628d21ab8bcSmrgAC_ARG_ENABLE(devel-docs,
2629d21ab8bcSmrg	AS_HELP_STRING([--enable-devel-docs],
2630d21ab8bcSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2631d21ab8bcSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2632d21ab8bcSmrgm4_undefine([devel_default])
2633d21ab8bcSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2634d21ab8bcSmrgAC_MSG_CHECKING([whether to build developer documentation])
2635d21ab8bcSmrgAC_MSG_RESULT([$build_devel_docs])
2636d21ab8bcSmrg]) # XORG_ENABLE_DEVEL_DOCS
26372fd96bc7Smrg
2638d21ab8bcSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
2639d21ab8bcSmrg# ----------------
2640d21ab8bcSmrg# Minimum version: 1.6.0
2641d21ab8bcSmrg#
2642d21ab8bcSmrg# This macro enables a builder to skip all functional specification targets.
2643d21ab8bcSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
26446ee7d557Smrg# maximum flexibility in controlling documentation building.
2645d21ab8bcSmrg# Refer to:
2646d21ab8bcSmrg# XORG_WITH_XMLTO         --with-xmlto
2647d21ab8bcSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2648d21ab8bcSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2649d21ab8bcSmrg# XORG_WITH_FOP           --with-fop
2650d21ab8bcSmrg# XORG_WITH_GROFF         --with-groff
2651d21ab8bcSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2652d21ab8bcSmrg#
2653d21ab8bcSmrg# Interface to module:
2654d21ab8bcSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2655d21ab8bcSmrg# --enable-specs:	'yes' user instructs the module to generate specs
2656d21ab8bcSmrg#			'no' user instructs the module not to generate specs
2657d21ab8bcSmrg# parm1:		specify the default value, yes or no.
2658d21ab8bcSmrg#
2659d21ab8bcSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2660d21ab8bcSmrgm4_define([spec_default], m4_default([$1], [yes]))
2661d21ab8bcSmrgAC_ARG_ENABLE(specs,
2662d21ab8bcSmrg	AS_HELP_STRING([--enable-specs],
2663d21ab8bcSmrg	   [Enable building the specs (default: ]spec_default[)]),
2664d21ab8bcSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
2665d21ab8bcSmrgm4_undefine([spec_default])
2666d21ab8bcSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2667d21ab8bcSmrgAC_MSG_CHECKING([whether to build functional specifications])
2668d21ab8bcSmrgAC_MSG_RESULT([$build_specs])
2669d21ab8bcSmrg]) # XORG_ENABLE_SPECS
26702fd96bc7Smrg
2671d21ab8bcSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2672d21ab8bcSmrg# ----------------------------------------------
2673d21ab8bcSmrg# Minimum version: 1.13.0
2674d21ab8bcSmrg#
2675d21ab8bcSmrg# This macro enables a builder to enable/disable unit testing
2676d21ab8bcSmrg# It makes no assumption about the test cases implementation
2677d21ab8bcSmrg# Test cases may or may not use Automake "Support for test suites"
2678d21ab8bcSmrg# They may or may not use the software utility library GLib
2679d21ab8bcSmrg#
2680d21ab8bcSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2681d21ab8bcSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2682d21ab8bcSmrg# The variable enable_unit_tests is used by other macros in this file.
2683d21ab8bcSmrg#
2684d21ab8bcSmrg# Interface to module:
2685d21ab8bcSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2686d21ab8bcSmrg# enable_unit_tests:    used in configure.ac for additional configuration
2687d21ab8bcSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2688d21ab8bcSmrg#			'no' user instructs the module not to build tests
2689d21ab8bcSmrg# parm1:		specify the default value, yes or no.
2690d21ab8bcSmrg#
2691d21ab8bcSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2692d21ab8bcSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2693d21ab8bcSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2694d21ab8bcSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2695d21ab8bcSmrgm4_define([_defopt], m4_default([$1], [auto]))
2696d21ab8bcSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2697d21ab8bcSmrg	[Enable building unit test cases (default: ]_defopt[)]),
2698d21ab8bcSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2699d21ab8bcSmrgm4_undefine([_defopt])
2700d21ab8bcSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2701d21ab8bcSmrgAC_MSG_CHECKING([whether to build unit test cases])
2702d21ab8bcSmrgAC_MSG_RESULT([$enable_unit_tests])
2703d21ab8bcSmrg]) # XORG_ENABLE_UNIT_TESTS
27042fd96bc7Smrg
2705d21ab8bcSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2706d21ab8bcSmrg# ------------------------------------------------------
2707d21ab8bcSmrg# Minimum version: 1.17.0
2708d21ab8bcSmrg#
2709d21ab8bcSmrg# This macro enables a builder to enable/disable integration testing
2710d21ab8bcSmrg# It makes no assumption about the test cases' implementation
2711d21ab8bcSmrg# Test cases may or may not use Automake "Support for test suites"
2712d21ab8bcSmrg#
2713d21ab8bcSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2714d21ab8bcSmrg# usually requires less dependencies and may be built and run under less
2715d21ab8bcSmrg# stringent environments than integration tests.
2716d21ab8bcSmrg#
2717d21ab8bcSmrg# Interface to module:
2718d21ab8bcSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2719d21ab8bcSmrg# enable_integration_tests:   used in configure.ac for additional configuration
2720d21ab8bcSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2721d21ab8bcSmrg#                             'no' user instructs the module not to build tests
2722d21ab8bcSmrg# parm1:                      specify the default value, yes or no.
2723d21ab8bcSmrg#
2724d21ab8bcSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2725d21ab8bcSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2726d21ab8bcSmrgm4_define([_defopt], m4_default([$1], [auto]))
2727d21ab8bcSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2728d21ab8bcSmrg	[Enable building integration test cases (default: ]_defopt[)]),
2729d21ab8bcSmrg	[enable_integration_tests=$enableval],
2730d21ab8bcSmrg	[enable_integration_tests=]_defopt)
2731d21ab8bcSmrgm4_undefine([_defopt])
2732d21ab8bcSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2733d21ab8bcSmrg	[test "x$enable_integration_tests" != xno])
2734d21ab8bcSmrgAC_MSG_CHECKING([whether to build unit test cases])
2735d21ab8bcSmrgAC_MSG_RESULT([$enable_integration_tests])
2736d21ab8bcSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
27372fd96bc7Smrg
2738d21ab8bcSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2739d21ab8bcSmrg# ----------------------------------------
2740d21ab8bcSmrg# Minimum version: 1.13.0
2741d21ab8bcSmrg#
2742d21ab8bcSmrg# GLib is a library which provides advanced data structures and functions.
2743d21ab8bcSmrg# This macro enables a module to test for the presence of Glib.
2744d21ab8bcSmrg#
2745d21ab8bcSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2746d21ab8bcSmrg# Otherwise the value of $enable_unit_tests is blank.
2747d21ab8bcSmrg#
2748d21ab8bcSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2749d21ab8bcSmrg# test support usually requires less dependencies and may be built and run under
2750d21ab8bcSmrg# less stringent environments than integration tests.
2751d21ab8bcSmrg#
2752d21ab8bcSmrg# Interface to module:
2753d21ab8bcSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
2754d21ab8bcSmrg# with_glib: used in configure.ac to know if GLib has been found
2755d21ab8bcSmrg# --with-glib:	'yes' user instructs the module to use glib
2756d21ab8bcSmrg#		'no' user instructs the module not to use glib
2757d21ab8bcSmrg#
2758d21ab8bcSmrgAC_DEFUN([XORG_WITH_GLIB],[
2759d21ab8bcSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2760d21ab8bcSmrgm4_define([_defopt], m4_default([$2], [auto]))
2761d21ab8bcSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2762d21ab8bcSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2763d21ab8bcSmrg	[with_glib=$withval], [with_glib=]_defopt)
2764d21ab8bcSmrgm4_undefine([_defopt])
27652fd96bc7Smrg
2766d21ab8bcSmrghave_glib=no
2767d21ab8bcSmrg# Do not probe GLib if user explicitly disabled unit testing
2768d21ab8bcSmrgif test "x$enable_unit_tests" != x"no"; then
2769d21ab8bcSmrg  # Do not probe GLib if user explicitly disabled it
2770d21ab8bcSmrg  if test "x$with_glib" != x"no"; then
2771d21ab8bcSmrg    m4_ifval(
2772d21ab8bcSmrg      [$1],
2773d21ab8bcSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2774d21ab8bcSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2775d21ab8bcSmrg    )
2776d21ab8bcSmrg  fi
2777d21ab8bcSmrgfi
27782fd96bc7Smrg
2779d21ab8bcSmrg# Not having GLib when unit testing has been explicitly requested is an error
2780d21ab8bcSmrgif test "x$enable_unit_tests" = x"yes"; then
2781d21ab8bcSmrg  if test "x$have_glib" = x"no"; then
2782d21ab8bcSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2783d21ab8bcSmrg  fi
2784d21ab8bcSmrgfi
27859c9ff80cSmrg
2786d21ab8bcSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
2787d21ab8bcSmrgif test "x$enable_unit_tests" = x"no"; then
2788d21ab8bcSmrg  if test "x$with_glib" = x"yes"; then
2789d21ab8bcSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
27906fae4e5dSmrg  fi
2791d21ab8bcSmrgfi
27929c9ff80cSmrg
2793d21ab8bcSmrg# Not having GLib when it has been explicitly requested is an error
2794d21ab8bcSmrgif test "x$with_glib" = x"yes"; then
2795d21ab8bcSmrg  if test "x$have_glib" = x"no"; then
2796d21ab8bcSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2797d21ab8bcSmrg  fi
2798d21ab8bcSmrgfi
27999c9ff80cSmrg
2800d21ab8bcSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2801d21ab8bcSmrg]) # XORG_WITH_GLIB
28029c9ff80cSmrg
2803d21ab8bcSmrg# XORG_LD_WRAP([required|optional])
2804d21ab8bcSmrg# ---------------------------------
2805d21ab8bcSmrg# Minimum version: 1.13.0
2806d21ab8bcSmrg#
2807d21ab8bcSmrg# Check if linker supports -wrap, passed via compiler flags
2808d21ab8bcSmrg#
2809d21ab8bcSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2810d21ab8bcSmrg# Otherwise the value of $enable_unit_tests is blank.
2811d21ab8bcSmrg#
2812d21ab8bcSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2813d21ab8bcSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2814d21ab8bcSmrg# available, an argument of "optional" allows use when some unit tests require
2815d21ab8bcSmrg# ld -wrap and others do not.
2816d21ab8bcSmrg#
2817d21ab8bcSmrgAC_DEFUN([XORG_LD_WRAP],[
2818d21ab8bcSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2819d21ab8bcSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2820d21ab8bcSmrg                      void __wrap_exit(int status) { return; }],
2821d21ab8bcSmrg                     [exit(0);])])
2822d21ab8bcSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
2823d21ab8bcSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2824d21ab8bcSmrg  if test "x$have_ld_wrap" = x"no"; then
2825d21ab8bcSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2826d21ab8bcSmrg  fi
2827d21ab8bcSmrgfi
2828d21ab8bcSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2829d21ab8bcSmrg#
2830d21ab8bcSmrg]) # XORG_LD_WRAP
28319c9ff80cSmrg
2832d21ab8bcSmrg# XORG_CHECK_LINKER_FLAGS
2833d21ab8bcSmrg# -----------------------
2834d21ab8bcSmrg# SYNOPSIS
2835d21ab8bcSmrg#
2836d21ab8bcSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2837d21ab8bcSmrg#
2838d21ab8bcSmrg# DESCRIPTION
2839d21ab8bcSmrg#
2840d21ab8bcSmrg#   Check whether the given linker FLAGS work with the current language's
2841d21ab8bcSmrg#   linker, or whether they give an error.
2842d21ab8bcSmrg#
2843d21ab8bcSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2844d21ab8bcSmrg#   success/failure.
2845d21ab8bcSmrg#
2846d21ab8bcSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
2847d21ab8bcSmrg#
2848d21ab8bcSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2849d21ab8bcSmrg#
2850d21ab8bcSmrg# LICENSE
2851d21ab8bcSmrg#
2852d21ab8bcSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2853d21ab8bcSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2854d21ab8bcSmrg#   Copyright (c) 2009 Matteo Frigo
2855d21ab8bcSmrg#
2856d21ab8bcSmrg#   This program is free software: you can redistribute it and/or modify it
2857d21ab8bcSmrg#   under the terms of the GNU General Public License as published by the
2858d21ab8bcSmrg#   Free Software Foundation, either version 3 of the License, or (at your
2859d21ab8bcSmrg#   option) any later version.
2860d21ab8bcSmrg#
2861d21ab8bcSmrg#   This program is distributed in the hope that it will be useful, but
2862d21ab8bcSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2863d21ab8bcSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2864d21ab8bcSmrg#   Public License for more details.
2865d21ab8bcSmrg#
2866d21ab8bcSmrg#   You should have received a copy of the GNU General Public License along
2867d21ab8bcSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2868d21ab8bcSmrg#
2869d21ab8bcSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
2870d21ab8bcSmrg#   gives unlimited permission to copy, distribute and modify the configure
2871d21ab8bcSmrg#   scripts that are the output of Autoconf when processing the Macro. You
2872d21ab8bcSmrg#   need not follow the terms of the GNU General Public License when using
2873d21ab8bcSmrg#   or distributing such scripts, even though portions of the text of the
2874d21ab8bcSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2875d21ab8bcSmrg#   all other use of the material that constitutes the Autoconf Macro.
2876d21ab8bcSmrg#
2877d21ab8bcSmrg#   This special exception to the GPL applies to versions of the Autoconf
2878d21ab8bcSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
2879d21ab8bcSmrg#   modified version of the Autoconf Macro, you may extend this special
2880d21ab8bcSmrg#   exception to the GPL to apply to your modified version as well.#
2881d21ab8bcSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2882d21ab8bcSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
2883d21ab8bcSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2884d21ab8bcSmrgAS_LITERAL_IF([$1],
2885d21ab8bcSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2886d21ab8bcSmrg      ax_save_FLAGS=$LDFLAGS
2887d21ab8bcSmrg      LDFLAGS="$1"
2888d21ab8bcSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2889d21ab8bcSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2890d21ab8bcSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2891d21ab8bcSmrg      LDFLAGS=$ax_save_FLAGS])],
2892d21ab8bcSmrg  [ax_save_FLAGS=$LDFLAGS
2893d21ab8bcSmrg   LDFLAGS="$1"
2894d21ab8bcSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2895d21ab8bcSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2896d21ab8bcSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2897d21ab8bcSmrg   LDFLAGS=$ax_save_FLAGS])
2898d21ab8bcSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2899d21ab8bcSmrgAC_MSG_RESULT($xorg_check_linker_flags)
2900d21ab8bcSmrgif test "x$xorg_check_linker_flags" = xyes; then
2901d21ab8bcSmrg	m4_default([$2], :)
2902d21ab8bcSmrgelse
2903d21ab8bcSmrg	m4_default([$3], :)
2904d21ab8bcSmrgfi
2905d21ab8bcSmrg]) # XORG_CHECK_LINKER_FLAGS
29066fae4e5dSmrg
2907d21ab8bcSmrg# XORG_MEMORY_CHECK_FLAGS
2908d21ab8bcSmrg# -----------------------
2909d21ab8bcSmrg# Minimum version: 1.16.0
2910d21ab8bcSmrg#
2911d21ab8bcSmrg# This macro attempts to find appropriate memory checking functionality
2912d21ab8bcSmrg# for various platforms which unit testing code may use to catch various
2913d21ab8bcSmrg# forms of memory allocation and access errors in testing.
2914d21ab8bcSmrg#
2915d21ab8bcSmrg# Interface to module:
2916d21ab8bcSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2917d21ab8bcSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2918d21ab8bcSmrg#
2919d21ab8bcSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2920d21ab8bcSmrg#
2921d21ab8bcSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
29229c9ff80cSmrg
2923d21ab8bcSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2924d21ab8bcSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2925d21ab8bcSmrg           [Environment variables to enable memory checking in tests])
29269c9ff80cSmrg
2927d21ab8bcSmrg# Check for different types of support on different platforms
2928d21ab8bcSmrgcase $host_os in
2929d21ab8bcSmrg    solaris*)
2930d21ab8bcSmrg        AC_CHECK_LIB([umem], [umem_alloc],
2931d21ab8bcSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2932d21ab8bcSmrg        ;;
2933d21ab8bcSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2934d21ab8bcSmrg        # both directly and inverted, so should not be 0 or 255.
2935d21ab8bcSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
2936d21ab8bcSmrg        ;;
2937d21ab8bcSmrg    darwin*)
2938d21ab8bcSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2939d21ab8bcSmrg        ;;
2940d21ab8bcSmrg    *bsd*)
2941d21ab8bcSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2942d21ab8bcSmrg        ;;
2943d21ab8bcSmrgesac
29449c9ff80cSmrg
2945d21ab8bcSmrg# User supplied flags override default flags
2946d21ab8bcSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2947d21ab8bcSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
29482fd96bc7Smrgfi
29499c9ff80cSmrg
2950d21ab8bcSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2951d21ab8bcSmrg]) # XORG_WITH_LINT
29529c9ff80cSmrg
2953d21ab8bcSmrg# XORG_CHECK_MALLOC_ZERO
2954d21ab8bcSmrg# ----------------------
2955d21ab8bcSmrg# Minimum version: 1.0.0
2956d21ab8bcSmrg#
2957d21ab8bcSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2958d21ab8bcSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2959d21ab8bcSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
29606ee7d557Smrg#
29616ee7d557Smrg# No longer actually tests since there is no guarantee applications will
29626ee7d557Smrg# run with the same malloc implementation we tested against, and the cost
29636ee7d557Smrg# of always ensuring the size passed to malloc is non-zero is minimal now.
29646ee7d557Smrg# Still allows builders to override when they have complete control over
29656ee7d557Smrg# which malloc implementation will be used.
2966d21ab8bcSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2967d21ab8bcSmrgAC_ARG_ENABLE(malloc0returnsnull,
2968d21ab8bcSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
29696ee7d557Smrg		       [assume malloc(0) can return NULL (default: yes)]),
2970d21ab8bcSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
29716ee7d557Smrg	[MALLOC_ZERO_RETURNS_NULL=yes])
29726ee7d557Smrg
29736ee7d557SmrgAC_MSG_CHECKING([whether to act as if malloc(0) can return NULL])
2974d21ab8bcSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
29759c9ff80cSmrg
2976d21ab8bcSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2977d21ab8bcSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2978d21ab8bcSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2979d21ab8bcSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
29802fd96bc7Smrgelse
2981d21ab8bcSmrg	MALLOC_ZERO_CFLAGS=""
2982d21ab8bcSmrg	XMALLOC_ZERO_CFLAGS=""
2983d21ab8bcSmrg	XTMALLOC_ZERO_CFLAGS=""
29842fd96bc7Smrgfi
29859c9ff80cSmrg
2986d21ab8bcSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2987d21ab8bcSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2988d21ab8bcSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2989d21ab8bcSmrg]) # XORG_CHECK_MALLOC_ZERO
29909c9ff80cSmrg
2991d21ab8bcSmrg# XORG_WITH_LINT()
29922fd96bc7Smrg# ----------------
2993d21ab8bcSmrg# Minimum version: 1.1.0
2994d21ab8bcSmrg#
2995d21ab8bcSmrg# This macro enables the use of a tool that flags some suspicious and
2996d21ab8bcSmrg# non-portable constructs (likely to be bugs) in C language source code.
2997d21ab8bcSmrg# It will attempt to locate the tool and use appropriate options.
2998d21ab8bcSmrg# There are various lint type tools on different platforms.
2999d21ab8bcSmrg#
3000d21ab8bcSmrg# Interface to module:
3001d21ab8bcSmrg# LINT:		returns the path to the tool found on the platform
3002d21ab8bcSmrg#		or the value set to LINT on the configure cmd line
3003d21ab8bcSmrg#		also an Automake conditional
3004d21ab8bcSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
3005d21ab8bcSmrg#
3006d21ab8bcSmrg# --with-lint:	'yes' user instructs the module to use lint
3007d21ab8bcSmrg#		'no' user instructs the module not to use lint (default)
3008d21ab8bcSmrg#
3009d21ab8bcSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
3010d21ab8bcSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
3011d21ab8bcSmrg#
3012d21ab8bcSmrgAC_DEFUN([XORG_WITH_LINT],[
30139c9ff80cSmrg
3014d21ab8bcSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
3015d21ab8bcSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
3016d21ab8bcSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
3017d21ab8bcSmrg		[Use a lint-style source code checker (default: disabled)])],
3018d21ab8bcSmrg		[use_lint=$withval], [use_lint=no])
30196fae4e5dSmrg
3020d21ab8bcSmrg# Obtain platform specific info like program name and options
3021d21ab8bcSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
3022d21ab8bcSmrgcase $host_os in
3023d21ab8bcSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
3024d21ab8bcSmrg	lint_name=splint
3025d21ab8bcSmrg	lint_options="-badflag"
3026d21ab8bcSmrg	;;
3027d21ab8bcSmrg  *freebsd* | *netbsd*)
3028d21ab8bcSmrg	lint_name=lint
3029d21ab8bcSmrg	lint_options="-u -b"
3030d21ab8bcSmrg	;;
3031d21ab8bcSmrg  *solaris*)
3032d21ab8bcSmrg	lint_name=lint
3033d21ab8bcSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
3034d21ab8bcSmrg	;;
3035d21ab8bcSmrgesac
30369c9ff80cSmrg
3037d21ab8bcSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
3038d21ab8bcSmrgif test "x$use_lint" = x"yes" ; then
3039d21ab8bcSmrg   AC_PATH_PROG([LINT], [$lint_name])
3040d21ab8bcSmrg   if test "x$LINT" = "x"; then
3041d21ab8bcSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
3042d21ab8bcSmrg   fi
3043d21ab8bcSmrgelif test "x$use_lint" = x"no" ; then
3044d21ab8bcSmrg   if test "x$LINT" != "x"; then
3045d21ab8bcSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
3046d21ab8bcSmrg   fi
30476fae4e5dSmrgelse
3048d21ab8bcSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
30499c9ff80cSmrgfi
30509c9ff80cSmrg
3051d21ab8bcSmrg# User supplied flags override default flags
3052d21ab8bcSmrgif test "x$LINT_FLAGS" != "x"; then
3053d21ab8bcSmrg   lint_options=$LINT_FLAGS
30542fd96bc7Smrgfi
30559c9ff80cSmrg
3056d21ab8bcSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
3057d21ab8bcSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
30589c9ff80cSmrg
3059d21ab8bcSmrg]) # XORG_WITH_LINT
3060d21ab8bcSmrg
3061d21ab8bcSmrg# XORG_LINT_LIBRARY(LIBNAME)
3062d21ab8bcSmrg# --------------------------
3063d21ab8bcSmrg# Minimum version: 1.1.0
3064d21ab8bcSmrg#
3065d21ab8bcSmrg# Sets up flags for building lint libraries for checking programs that call
3066d21ab8bcSmrg# functions in the library.
3067d21ab8bcSmrg#
3068d21ab8bcSmrg# Interface to module:
3069d21ab8bcSmrg# LINTLIB		- Automake variable with the name of lint library file to make
3070d21ab8bcSmrg# MAKE_LINT_LIB		- Automake conditional
3071d21ab8bcSmrg#
3072d21ab8bcSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
3073d21ab8bcSmrg#			  - 'no' user instructs the module not to create a lint library (default)
3074d21ab8bcSmrg
3075d21ab8bcSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
3076d21ab8bcSmrgAC_REQUIRE([XORG_WITH_LINT])
3077d21ab8bcSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
3078d21ab8bcSmrg	[Create lint library (default: disabled)])],
3079d21ab8bcSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
3080d21ab8bcSmrg
3081d21ab8bcSmrgif test "x$make_lint_lib" = x"yes" ; then
3082d21ab8bcSmrg   LINTLIB=llib-l$1.ln
3083d21ab8bcSmrg   if test "x$LINT" = "x"; then
3084d21ab8bcSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
3085d21ab8bcSmrg   fi
3086d21ab8bcSmrgelif test "x$make_lint_lib" != x"no" ; then
3087d21ab8bcSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
30889c9ff80cSmrgfi
30899c9ff80cSmrg
3090d21ab8bcSmrgAC_SUBST(LINTLIB)
3091d21ab8bcSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
30929c9ff80cSmrg
3093d21ab8bcSmrg]) # XORG_LINT_LIBRARY
30949c9ff80cSmrg
3095d21ab8bcSmrg# XORG_COMPILER_BRAND
3096d21ab8bcSmrg# -------------------
3097d21ab8bcSmrg# Minimum version: 1.14.0
3098d21ab8bcSmrg#
3099d21ab8bcSmrg# Checks for various brands of compilers and sets flags as appropriate:
3100d21ab8bcSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
3101d21ab8bcSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
3102d21ab8bcSmrg#   clang compiler - sets CLANGCC to "yes"
3103d21ab8bcSmrg#   Intel compiler - sets INTELCC to "yes"
3104d21ab8bcSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
3105d21ab8bcSmrg#
3106d21ab8bcSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
3107d21ab8bcSmrgAC_LANG_CASE(
3108d21ab8bcSmrg	[C], [
31096ee7d557Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
31106ee7d557Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
31116ee7d557Smrg		m4_version_prereq([2.70],
31126ee7d557Smrg			[AC_REQUIRE([AC_PROG_CC])],
31136ee7d557Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3114d21ab8bcSmrg	],
3115d21ab8bcSmrg	[C++], [
3116d21ab8bcSmrg		AC_REQUIRE([AC_PROG_CXX])
3117d21ab8bcSmrg	]
3118d21ab8bcSmrg)
3119d21ab8bcSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
3120d21ab8bcSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
3121d21ab8bcSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
3122d21ab8bcSmrg]) # XORG_COMPILER_BRAND
31239c9ff80cSmrg
3124d21ab8bcSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
3125d21ab8bcSmrg# ---------------
3126d21ab8bcSmrg# Minimum version: 1.16.0
3127d21ab8bcSmrg#
3128d21ab8bcSmrg# Test if the compiler works when passed the given flag as a command line argument.
31296ee7d557Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
3130d21ab8bcSmrg# next flag in the list until there are no more options.
3131d21ab8bcSmrg#
3132d21ab8bcSmrg# Note that this does not guarantee that the compiler supports the flag as some
3133d21ab8bcSmrg# compilers will simply ignore arguments that they do not understand, but we do
3134d21ab8bcSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
3135d21ab8bcSmrg# -Werror=unused-command-line-argument
3136d21ab8bcSmrg#
3137d21ab8bcSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
3138d21ab8bcSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3139d21ab8bcSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
31409c9ff80cSmrg
3141d21ab8bcSmrgAC_LANG_COMPILER_REQUIRE
31429c9ff80cSmrg
3143d21ab8bcSmrgAC_LANG_CASE(
3144d21ab8bcSmrg	[C], [
31456ee7d557Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
31466ee7d557Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
31476ee7d557Smrg		m4_version_prereq([2.70],
31486ee7d557Smrg			[AC_REQUIRE([AC_PROG_CC])],
31496ee7d557Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3150d21ab8bcSmrg		define([PREFIX], [C])
3151d21ab8bcSmrg		define([CACHE_PREFIX], [cc])
3152d21ab8bcSmrg		define([COMPILER], [$CC])
3153d21ab8bcSmrg	],
3154d21ab8bcSmrg	[C++], [
3155d21ab8bcSmrg		define([PREFIX], [CXX])
3156d21ab8bcSmrg		define([CACHE_PREFIX], [cxx])
3157d21ab8bcSmrg		define([COMPILER], [$CXX])
3158d21ab8bcSmrg	]
3159d21ab8bcSmrg)
316089c04b6cSmrg
3161d21ab8bcSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
31629c9ff80cSmrg
3163d21ab8bcSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
3164d21ab8bcSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3165d21ab8bcSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
3166d21ab8bcSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3167d21ab8bcSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3168d21ab8bcSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
3169d21ab8bcSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
3170d21ab8bcSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
3171d21ab8bcSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3172d21ab8bcSmrgfi
31739c9ff80cSmrg
3174d21ab8bcSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
3175d21ab8bcSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
3176d21ab8bcSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3177d21ab8bcSmrg	fi
3178d21ab8bcSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3179d21ab8bcSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
3180d21ab8bcSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3181d21ab8bcSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3182d21ab8bcSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
3183d21ab8bcSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
3184d21ab8bcSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
3185d21ab8bcSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3186d21ab8bcSmrgfi
31879c9ff80cSmrg
3188d21ab8bcSmrgfound="no"
3189d21ab8bcSmrgm4_foreach([flag], m4_cdr($@), [
3190d21ab8bcSmrg	if test $found = "no" ; then
3191d21ab8bcSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
3192d21ab8bcSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3193d21ab8bcSmrg		fi
31949c9ff80cSmrg
3195d21ab8bcSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
3196d21ab8bcSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3197d21ab8bcSmrg		fi
31981f0ac6a5Smrg
3199d21ab8bcSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
32001f0ac6a5Smrg
3201d21ab8bcSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
3202d21ab8bcSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
3203d21ab8bcSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
3204d21ab8bcSmrg		AC_CACHE_VAL($cacheid,
3205d21ab8bcSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3206d21ab8bcSmrg					     [eval $cacheid=yes],
3207d21ab8bcSmrg					     [eval $cacheid=no])])
32081f0ac6a5Smrg
3209d21ab8bcSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
32101f0ac6a5Smrg
3211d21ab8bcSmrg		eval supported=\$$cacheid
3212d21ab8bcSmrg		AC_MSG_RESULT([$supported])
3213d21ab8bcSmrg		if test "$supported" = "yes" ; then
3214d21ab8bcSmrg			$1="$$1 ]flag["
3215d21ab8bcSmrg			found="yes"
3216d21ab8bcSmrg		fi
3217d21ab8bcSmrg	fi
3218d21ab8bcSmrg])
3219d21ab8bcSmrg]) # XORG_TESTSET_CFLAG
32206fae4e5dSmrg
3221d21ab8bcSmrg# XORG_COMPILER_FLAGS
3222d21ab8bcSmrg# ---------------
3223d21ab8bcSmrg# Minimum version: 1.16.0
3224d21ab8bcSmrg#
3225d21ab8bcSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
3226d21ab8bcSmrg# arguments supported by the selected compiler which do NOT alter the generated
3227d21ab8bcSmrg# code.  These arguments will cause the compiler to print various warnings
3228d21ab8bcSmrg# during compilation AND turn a conservative set of warnings into errors.
3229d21ab8bcSmrg#
3230d21ab8bcSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
3231d21ab8bcSmrg# future versions of util-macros as options are added to new compilers.
3232d21ab8bcSmrg#
3233d21ab8bcSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
3234d21ab8bcSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
32356fae4e5dSmrg
3236d21ab8bcSmrgAC_ARG_ENABLE(selective-werror,
3237d21ab8bcSmrg              AS_HELP_STRING([--disable-selective-werror],
3238d21ab8bcSmrg                             [Turn off selective compiler errors. (default: enabled)]),
3239d21ab8bcSmrg              [SELECTIVE_WERROR=$enableval],
3240d21ab8bcSmrg              [SELECTIVE_WERROR=yes])
32416fae4e5dSmrg
3242d21ab8bcSmrgAC_LANG_CASE(
3243d21ab8bcSmrg        [C], [
3244d21ab8bcSmrg                define([PREFIX], [C])
3245d21ab8bcSmrg        ],
3246d21ab8bcSmrg        [C++], [
3247d21ab8bcSmrg                define([PREFIX], [CXX])
3248d21ab8bcSmrg        ]
3249d21ab8bcSmrg)
3250d21ab8bcSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
3251d21ab8bcSmrgif test "x$SUNCC" = "xyes"; then
3252d21ab8bcSmrg    [BASE_]PREFIX[FLAGS]="-v"
3253d21ab8bcSmrgelse
3254d21ab8bcSmrg    [BASE_]PREFIX[FLAGS]=""
3255d21ab8bcSmrgfi
32566fae4e5dSmrg
3257d21ab8bcSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3258d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
3259d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
3260d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
3261d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
32626fae4e5dSmrg
3263d21ab8bcSmrgAC_LANG_CASE(
3264d21ab8bcSmrg	[C], [
3265d21ab8bcSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
3266d21ab8bcSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
3267d21ab8bcSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
3268d21ab8bcSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
3269d21ab8bcSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
3270d21ab8bcSmrg	]
3271d21ab8bcSmrg)
32721f0ac6a5Smrg
3273d21ab8bcSmrg# This chunk adds additional warnings that could catch undesired effects.
3274d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
3275d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
3276d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
3277d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
3278d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
3279d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
3280d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
32819c9ff80cSmrg
3282d21ab8bcSmrg# These are currently disabled because they are noisy.  They will be enabled
3283d21ab8bcSmrg# in the future once the codebase is sufficiently modernized to silence
3284d21ab8bcSmrg# them.  For now, I don't want them to drown out the other warnings.
3285d21ab8bcSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3286d21ab8bcSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3287d21ab8bcSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
32881f0ac6a5Smrg
32896ee7d557Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
3290d21ab8bcSmrg# when there are problems that should be fixed.
32911f0ac6a5Smrg
3292d21ab8bcSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3293d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3294d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3295d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3296d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3297d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3298d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3299d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3300d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3301d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3302d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3303d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3304d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3305d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3306d21ab8bcSmrgelse
3307d21ab8bcSmrgAC_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])
3308d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3309d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3310d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3311d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3312d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3313d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3314d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3315d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3316d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3317d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3318d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3319d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3320d21ab8bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3321d21ab8bcSmrgfi
33229c9ff80cSmrg
3323d21ab8bcSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3324d21ab8bcSmrg]) # XORG_COMPILER_FLAGS
33251f0ac6a5Smrg
3326d21ab8bcSmrg# XORG_CWARNFLAGS
3327d21ab8bcSmrg# ---------------
3328d21ab8bcSmrg# Minimum version: 1.2.0
3329d21ab8bcSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3330d21ab8bcSmrg#
3331d21ab8bcSmrg# Defines CWARNFLAGS to enable C compiler warnings.
3332d21ab8bcSmrg#
3333d21ab8bcSmrg# This function is deprecated because it defines -fno-strict-aliasing
3334d21ab8bcSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3335d21ab8bcSmrg# is needed, then it should be added explicitly in the module when
3336d21ab8bcSmrg# it is updated to use BASE_CFLAGS.
3337d21ab8bcSmrg#
3338d21ab8bcSmrgAC_DEFUN([XORG_CWARNFLAGS], [
3339d21ab8bcSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3340d21ab8bcSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3341d21ab8bcSmrgAC_LANG_CASE(
3342d21ab8bcSmrg	[C], [
3343d21ab8bcSmrg		CWARNFLAGS="$BASE_CFLAGS"
3344d21ab8bcSmrg		if  test "x$GCC" = xyes ; then
3345d21ab8bcSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3346d21ab8bcSmrg		fi
3347d21ab8bcSmrg		AC_SUBST(CWARNFLAGS)
3348d21ab8bcSmrg	]
3349d21ab8bcSmrg)
3350d21ab8bcSmrg]) # XORG_CWARNFLAGS
33511f0ac6a5Smrg
3352d21ab8bcSmrg# XORG_STRICT_OPTION
3353d21ab8bcSmrg# -----------------------
3354d21ab8bcSmrg# Minimum version: 1.3.0
3355d21ab8bcSmrg#
3356d21ab8bcSmrg# Add configure option to enable strict compilation flags, such as treating
3357d21ab8bcSmrg# warnings as fatal errors.
3358d21ab8bcSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3359d21ab8bcSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3360d21ab8bcSmrg#
3361d21ab8bcSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3362d21ab8bcSmrg# when strict compilation is unconditionally desired.
3363d21ab8bcSmrgAC_DEFUN([XORG_STRICT_OPTION], [
3364d21ab8bcSmrgAC_REQUIRE([XORG_CWARNFLAGS])
3365d21ab8bcSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
33669c9ff80cSmrg
3367d21ab8bcSmrgAC_ARG_ENABLE(strict-compilation,
3368d21ab8bcSmrg			  AS_HELP_STRING([--enable-strict-compilation],
3369d21ab8bcSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3370d21ab8bcSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
33711f0ac6a5Smrg
3372d21ab8bcSmrgAC_LANG_CASE(
3373d21ab8bcSmrg        [C], [
3374d21ab8bcSmrg                define([PREFIX], [C])
3375d21ab8bcSmrg        ],
3376d21ab8bcSmrg        [C++], [
3377d21ab8bcSmrg                define([PREFIX], [CXX])
3378d21ab8bcSmrg        ]
3379d21ab8bcSmrg)
33801f0ac6a5Smrg
3381d21ab8bcSmrg[STRICT_]PREFIX[FLAGS]=""
3382d21ab8bcSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3383d21ab8bcSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
33841f0ac6a5Smrg
3385d21ab8bcSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3386d21ab8bcSmrg# activate it with -Werror, so we add it here explicitly.
3387d21ab8bcSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
33881f0ac6a5Smrg
3389d21ab8bcSmrgif test "x$STRICT_COMPILE" = "xyes"; then
3390d21ab8bcSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3391d21ab8bcSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3392d21ab8bcSmrgfi
3393d21ab8bcSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3394d21ab8bcSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3395d21ab8bcSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3396d21ab8bcSmrg]) # XORG_STRICT_OPTION
33971f0ac6a5Smrg
33986ee7d557Smrg# XORG_DEFAULT_NOCODE_OPTIONS
33996ee7d557Smrg# ---------------------------
34006ee7d557Smrg# Minimum version: 1.20.0
34016ee7d557Smrg#
34026ee7d557Smrg# Defines default options for X.Org modules which don't compile code,
34036ee7d557Smrg# such as fonts, bitmaps, cursors, and docs.
34046ee7d557Smrg#
34056ee7d557SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
34066ee7d557SmrgAC_REQUIRE([AC_PROG_INSTALL])
34076ee7d557SmrgXORG_RELEASE_VERSION
34086ee7d557SmrgXORG_CHANGELOG
34096ee7d557SmrgXORG_INSTALL
34106ee7d557SmrgXORG_MANPAGE_SECTIONS
34116ee7d557Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
34126ee7d557Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
34136ee7d557Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
34146ee7d557Smrg
3415d21ab8bcSmrg# XORG_DEFAULT_OPTIONS
3416d21ab8bcSmrg# --------------------
3417d21ab8bcSmrg# Minimum version: 1.3.0
3418d21ab8bcSmrg#
34196ee7d557Smrg# Defines default options for X.Org modules which compile code.
3420d21ab8bcSmrg#
3421d21ab8bcSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3422d21ab8bcSmrgAC_REQUIRE([AC_PROG_INSTALL])
3423d21ab8bcSmrgXORG_COMPILER_FLAGS
3424d21ab8bcSmrgXORG_CWARNFLAGS
3425d21ab8bcSmrgXORG_STRICT_OPTION
34266ee7d557SmrgXORG_DEFAULT_NOCODE_OPTIONS
3427d21ab8bcSmrg]) # XORG_DEFAULT_OPTIONS
34282fd96bc7Smrg
3429d21ab8bcSmrg# XORG_INSTALL()
3430d21ab8bcSmrg# ----------------
3431d21ab8bcSmrg# Minimum version: 1.4.0
3432d21ab8bcSmrg#
3433d21ab8bcSmrg# Defines the variable INSTALL_CMD as the command to copy
3434d21ab8bcSmrg# INSTALL from $prefix/share/util-macros.
3435d21ab8bcSmrg#
3436d21ab8bcSmrgAC_DEFUN([XORG_INSTALL], [
3437d21ab8bcSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3438d21ab8bcSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3439d21ab8bcSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3440d21ab8bcSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3441d21ab8bcSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3442d21ab8bcSmrgtouch \$(top_srcdir)/INSTALL; \
3443d21ab8bcSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3444d21ab8bcSmrgAC_SUBST([INSTALL_CMD])
3445d21ab8bcSmrg]) # XORG_INSTALL
3446d21ab8bcSmrgdnl Copyright 2005 Red Hat, Inc
3447d21ab8bcSmrgdnl
3448d21ab8bcSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3449d21ab8bcSmrgdnl documentation for any purpose is hereby granted without fee, provided that
3450d21ab8bcSmrgdnl the above copyright notice appear in all copies and that both that
3451d21ab8bcSmrgdnl copyright notice and this permission notice appear in supporting
3452d21ab8bcSmrgdnl documentation.
3453d21ab8bcSmrgdnl
3454d21ab8bcSmrgdnl The above copyright notice and this permission notice shall be included
3455d21ab8bcSmrgdnl in all copies or substantial portions of the Software.
3456d21ab8bcSmrgdnl
3457d21ab8bcSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3458d21ab8bcSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3459d21ab8bcSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3460d21ab8bcSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3461d21ab8bcSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3462d21ab8bcSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3463d21ab8bcSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
3464d21ab8bcSmrgdnl
3465d21ab8bcSmrgdnl Except as contained in this notice, the name of the copyright holders shall
3466d21ab8bcSmrgdnl not be used in advertising or otherwise to promote the sale, use or
3467d21ab8bcSmrgdnl other dealings in this Software without prior written authorization
3468d21ab8bcSmrgdnl from the copyright holders.
3469d21ab8bcSmrgdnl
34701f0ac6a5Smrg
3471d21ab8bcSmrg# XORG_RELEASE_VERSION
3472d21ab8bcSmrg# --------------------
3473d21ab8bcSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
34746fae4e5dSmrg
3475d21ab8bcSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3476d21ab8bcSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3477d21ab8bcSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3478d21ab8bcSmrg		[Major version of this package])
3479d21ab8bcSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3480d21ab8bcSmrg	if test "x$PVM" = "x"; then
3481d21ab8bcSmrg		PVM="0"
3482d21ab8bcSmrg	fi
3483d21ab8bcSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3484d21ab8bcSmrg		[$PVM],
3485d21ab8bcSmrg		[Minor version of this package])
3486d21ab8bcSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3487d21ab8bcSmrg	if test "x$PVP" = "x"; then
3488d21ab8bcSmrg		PVP="0"
3489d21ab8bcSmrg	fi
3490d21ab8bcSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3491d21ab8bcSmrg		[$PVP],
3492d21ab8bcSmrg		[Patch version of this package])
3493d21ab8bcSmrg])
34941f0ac6a5Smrg
3495d21ab8bcSmrg# XORG_CHANGELOG()
3496d21ab8bcSmrg# ----------------
3497d21ab8bcSmrg# Minimum version: 1.2.0
3498d21ab8bcSmrg#
3499d21ab8bcSmrg# Defines the variable CHANGELOG_CMD as the command to generate
3500d21ab8bcSmrg# ChangeLog from git.
3501d21ab8bcSmrg#
3502d21ab8bcSmrg#
3503d21ab8bcSmrgAC_DEFUN([XORG_CHANGELOG], [
3504d21ab8bcSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3505d21ab8bcSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3506d21ab8bcSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3507d21ab8bcSmrgtouch \$(top_srcdir)/ChangeLog; \
3508d21ab8bcSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3509d21ab8bcSmrgAC_SUBST([CHANGELOG_CMD])
3510d21ab8bcSmrg]) # XORG_CHANGELOG
35111f0ac6a5Smrg
35126ee7d557Smrgm4_include([m4/libtool.m4])
35136ee7d557Smrgm4_include([m4/ltoptions.m4])
35146ee7d557Smrgm4_include([m4/ltsugar.m4])
35156ee7d557Smrgm4_include([m4/ltversion.m4])
35166ee7d557Smrgm4_include([m4/lt~obsolete.m4])
3517