1742aa962Smrg# generated automatically by aclocal 1.17 -*- Autoconf -*-
269ef5f27Smrg
3742aa962Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
4d1333322Smrg
5d1333322Smrg# This file is free software; the Free Software Foundation
6d1333322Smrg# gives unlimited permission to copy and/or distribute it,
7d1333322Smrg# with or without modifications, as long as this notice is preserved.
8d1333322Smrg
9d1333322Smrg# This program is distributed in the hope that it will be useful,
10d1333322Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11d1333322Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12d1333322Smrg# PARTICULAR PURPOSE.
13d1333322Smrg
1469ef5f27Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
154f9ac78aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
164f9ac78aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17742aa962Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
18742aa962Smrg[m4_warning([this file was generated for autoconf 2.72.
194f9ac78aSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
204f9ac78aSmrgIf you have problems, you may need to regenerate the build system entirely.
2169ef5f27SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22d1333322Smrg
23742aa962Smrg# Copyright (C) 2002-2024 Free Software Foundation, Inc.
24d1333322Smrg#
25d1333322Smrg# This file is free software; the Free Software Foundation
26d1333322Smrg# gives unlimited permission to copy and/or distribute it,
27d1333322Smrg# with or without modifications, as long as this notice is preserved.
28d1333322Smrg
29d1333322Smrg# AM_AUTOMAKE_VERSION(VERSION)
30d1333322Smrg# ----------------------------
31d1333322Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32d1333322Smrg# generated from the m4 files accompanying Automake X.Y.
33d1333322Smrg# (This private macro should not be called outside this file.)
34d1333322SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35742aa962Smrg[am__api_version='1.17'
36d1333322Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37d1333322Smrgdnl require some minimum version.  Point them to the right macro.
38742aa962Smrgm4_if([$1], [1.17], [],
39d1333322Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40d1333322Smrg])
41d1333322Smrg
42d1333322Smrg# _AM_AUTOCONF_VERSION(VERSION)
43d1333322Smrg# -----------------------------
44d1333322Smrg# aclocal traces this macro to find the Autoconf version.
45d1333322Smrg# This is a private macro too.  Using m4_define simplifies
46d1333322Smrg# the logic in aclocal, which can simply ignore this definition.
47d1333322Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48d1333322Smrg
49d1333322Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50d1333322Smrg# -------------------------------
51d1333322Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
524f9ac78aSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53d1333322SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54742aa962Smrg[AM_AUTOMAKE_VERSION([1.17])dnl
554f9ac78aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
564f9ac78aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
574f9ac78aSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58d1333322Smrg
59d1333322Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60d1333322Smrg
61742aa962Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
62d1333322Smrg#
63d1333322Smrg# This file is free software; the Free Software Foundation
64d1333322Smrg# gives unlimited permission to copy and/or distribute it,
65d1333322Smrg# with or without modifications, as long as this notice is preserved.
66d1333322Smrg
67d1333322Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6869ef5f27Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6969ef5f27Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70d1333322Smrg#
71d1333322Smrg# Of course, Automake must honor this variable whenever it calls a
72d1333322Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73d1333322Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74d1333322Smrg# depending on how configure is run.  This is pretty annoying, since
75d1333322Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76d1333322Smrg# source directory, any form will work fine, but in subdirectories a
77d1333322Smrg# relative path needs to be adjusted first.
78d1333322Smrg#
79d1333322Smrg# $ac_aux_dir/missing
80d1333322Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81d1333322Smrg# $top_srcdir/$ac_aux_dir/missing
82d1333322Smrg#    fails if $ac_aux_dir is absolute,
83d1333322Smrg#    fails when called from a subdirectory in a VPATH build with
84d1333322Smrg#          a relative $ac_aux_dir
85d1333322Smrg#
86d1333322Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87d1333322Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
8869ef5f27Smrg# harmless because $srcdir is '.', but things will broke when you
89d1333322Smrg# start a VPATH build or use an absolute $srcdir.
90d1333322Smrg#
91d1333322Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92d1333322Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93d1333322Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94d1333322Smrg# and then we would define $MISSING as
95d1333322Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96d1333322Smrg# This will work as long as MISSING is not called from configure, because
97d1333322Smrg# unfortunately $(top_srcdir) has no meaning in configure.
98d1333322Smrg# However there are other variables, like CC, which are often used in
99d1333322Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100d1333322Smrg#
101d1333322Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
102d1333322Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
103d1333322Smrg# configured tree to be moved without reconfiguration.
104d1333322Smrg
105d1333322SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106d04472e1Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107d04472e1Smrg# Expand $ac_aux_dir to an absolute path.
108d04472e1Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109d1333322Smrg])
110d1333322Smrg
111d1333322Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112d1333322Smrg
113742aa962Smrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
114d1333322Smrg#
115d1333322Smrg# This file is free software; the Free Software Foundation
116d1333322Smrg# gives unlimited permission to copy and/or distribute it,
117d1333322Smrg# with or without modifications, as long as this notice is preserved.
118d1333322Smrg
119d1333322Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120d1333322Smrg# -------------------------------------
121d1333322Smrg# Define a conditional.
122d1333322SmrgAC_DEFUN([AM_CONDITIONAL],
12369ef5f27Smrg[AC_PREREQ([2.52])dnl
12469ef5f27Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12569ef5f27Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126d1333322SmrgAC_SUBST([$1_TRUE])dnl
127d1333322SmrgAC_SUBST([$1_FALSE])dnl
128d1333322Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129d1333322Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1304f9ac78aSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131d1333322Smrgif $2; then
132d1333322Smrg  $1_TRUE=
133d1333322Smrg  $1_FALSE='#'
134d1333322Smrgelse
135d1333322Smrg  $1_TRUE='#'
136d1333322Smrg  $1_FALSE=
137d1333322Smrgfi
138d1333322SmrgAC_CONFIG_COMMANDS_PRE(
139d1333322Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140d1333322Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141d1333322SmrgUsually this means the macro was only invoked conditionally.]])
142d1333322Smrgfi])])
143d1333322Smrg
144742aa962Smrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
145d1333322Smrg#
146d1333322Smrg# This file is free software; the Free Software Foundation
147d1333322Smrg# gives unlimited permission to copy and/or distribute it,
148d1333322Smrg# with or without modifications, as long as this notice is preserved.
149d1333322Smrg
150d1333322Smrg
15169ef5f27Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
152d1333322Smrg# written in clear, in which case automake, when reading aclocal.m4,
153d1333322Smrg# will think it sees a *use*, and therefore will trigger all it's
154d1333322Smrg# C support machinery.  Also note that it means that autoscan, seeing
155d1333322Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156d1333322Smrg
157d1333322Smrg
158d1333322Smrg# _AM_DEPENDENCIES(NAME)
159d1333322Smrg# ----------------------
160d1333322Smrg# See how the compiler implements dependency checking.
16169ef5f27Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
162d1333322Smrg# We try a few techniques and use that to set a single cache variable.
163d1333322Smrg#
164d1333322Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
165d1333322Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
166d1333322Smrg# dependency, and given that the user is not expected to run this macro,
167d1333322Smrg# just rely on AC_PROG_CC.
168d1333322SmrgAC_DEFUN([_AM_DEPENDENCIES],
169d1333322Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
170d1333322SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
171d1333322SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
172d1333322SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173d1333322Smrg
17469ef5f27Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17569ef5f27Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17669ef5f27Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17769ef5f27Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17869ef5f27Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
17969ef5f27Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18069ef5f27Smrg                    [depcc="$$1"   am_compiler_list=])
181d1333322Smrg
182d1333322SmrgAC_CACHE_CHECK([dependency style of $depcc],
183d1333322Smrg               [am_cv_$1_dependencies_compiler_type],
184d1333322Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
185d1333322Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
186d1333322Smrg  # making bogus files that we don't know about and never remove.  For
187d1333322Smrg  # instance it was reported that on HP-UX the gcc test will end up
18869ef5f27Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
18969ef5f27Smrg  # in D".
190c27291ebSmrg  rm -rf conftest.dir
191d1333322Smrg  mkdir conftest.dir
192d1333322Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
193d1333322Smrg  # using a relative directory.
194d1333322Smrg  cp "$am_depcomp" conftest.dir
195d1333322Smrg  cd conftest.dir
196d1333322Smrg  # We will build objects and dependencies in a subdirectory because
197d1333322Smrg  # it helps to detect inapplicable dependency modes.  For instance
198d1333322Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
199d1333322Smrg  # side effect of compilation, but ICC will put the dependencies in
200d1333322Smrg  # the current directory while Tru64 will put them in the object
201d1333322Smrg  # directory.
202d1333322Smrg  mkdir sub
203d1333322Smrg
204d1333322Smrg  am_cv_$1_dependencies_compiler_type=none
205d1333322Smrg  if test "$am_compiler_list" = ""; then
206d1333322Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
207d1333322Smrg  fi
2084f9ac78aSmrg  am__universal=false
2094f9ac78aSmrg  m4_case([$1], [CC],
2104f9ac78aSmrg    [case " $depcc " in #(
2114f9ac78aSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2124f9ac78aSmrg     esac],
2134f9ac78aSmrg    [CXX],
2144f9ac78aSmrg    [case " $depcc " in #(
2154f9ac78aSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2164f9ac78aSmrg     esac])
2174f9ac78aSmrg
218d1333322Smrg  for depmode in $am_compiler_list; do
219d1333322Smrg    # Setup a source with many dependencies, because some compilers
220d1333322Smrg    # like to wrap large dependency lists on column 80 (with \), and
221d1333322Smrg    # we should not choose a depcomp mode which is confused by this.
222d1333322Smrg    #
223d1333322Smrg    # We need to recreate these files for each test, as the compiler may
224d1333322Smrg    # overwrite some of them when testing with obscure command lines.
225d1333322Smrg    # This happens at least with the AIX C compiler.
226d1333322Smrg    : > sub/conftest.c
227d1333322Smrg    for i in 1 2 3 4 5 6; do
228d1333322Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
22969ef5f27Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23069ef5f27Smrg      # Solaris 10 /bin/sh.
23169ef5f27Smrg      echo '/* dummy */' > sub/conftst$i.h
232d1333322Smrg    done
233d1333322Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234d1333322Smrg
23569ef5f27Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2364f9ac78aSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23769ef5f27Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23869ef5f27Smrg    # versions had trouble with output in subdirs.
2394f9ac78aSmrg    am__obj=sub/conftest.${OBJEXT-o}
2404f9ac78aSmrg    am__minus_obj="-o $am__obj"
241d1333322Smrg    case $depmode in
2424f9ac78aSmrg    gcc)
2434f9ac78aSmrg      # This depmode causes a compiler race in universal mode.
2444f9ac78aSmrg      test "$am__universal" = false || continue
2454f9ac78aSmrg      ;;
246d1333322Smrg    nosideeffect)
24769ef5f27Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24869ef5f27Smrg      # only be used when explicitly requested.
249d1333322Smrg      if test "x$enable_dependency_tracking" = xyes; then
250d1333322Smrg	continue
251d1333322Smrg      else
252d1333322Smrg	break
253d1333322Smrg      fi
254d1333322Smrg      ;;
255c27291ebSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25669ef5f27Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
2574f9ac78aSmrg      # not run yet.  These depmodes are late enough in the game, and
2584f9ac78aSmrg      # so weak that their functioning should not be impacted.
2594f9ac78aSmrg      am__obj=conftest.${OBJEXT-o}
2604f9ac78aSmrg      am__minus_obj=
2614f9ac78aSmrg      ;;
262d1333322Smrg    none) break ;;
263d1333322Smrg    esac
264d1333322Smrg    if depmode=$depmode \
2654f9ac78aSmrg       source=sub/conftest.c object=$am__obj \
266d1333322Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2674f9ac78aSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
268d1333322Smrg         >/dev/null 2>conftest.err &&
269d1333322Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
270d1333322Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2714f9ac78aSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
272d1333322Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
273d1333322Smrg      # icc doesn't choke on unknown options, it will just issue warnings
274d1333322Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
275d1333322Smrg      # that says an option was ignored or not supported.
276742aa962Smrg      # When given -MP, icc 7.0 and 7.1 complain thus:
277d1333322Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
278d1333322Smrg      # The diagnosis changed in icc 8.0:
279d1333322Smrg      #   icc: Command line remark: option '-MP' not supported
280d1333322Smrg      if (grep 'ignoring option' conftest.err ||
281d1333322Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
282d1333322Smrg        am_cv_$1_dependencies_compiler_type=$depmode
283d1333322Smrg        break
284d1333322Smrg      fi
285d1333322Smrg    fi
286d1333322Smrg  done
287d1333322Smrg
288d1333322Smrg  cd ..
289d1333322Smrg  rm -rf conftest.dir
290d1333322Smrgelse
291d1333322Smrg  am_cv_$1_dependencies_compiler_type=none
292d1333322Smrgfi
293d1333322Smrg])
294d1333322SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
295d1333322SmrgAM_CONDITIONAL([am__fastdep$1], [
296d1333322Smrg  test "x$enable_dependency_tracking" != xno \
297d1333322Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298d1333322Smrg])
299d1333322Smrg
300d1333322Smrg
301d1333322Smrg# AM_SET_DEPDIR
302d1333322Smrg# -------------
303d1333322Smrg# Choose a directory name for dependency files.
30469ef5f27Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
305d1333322SmrgAC_DEFUN([AM_SET_DEPDIR],
306d1333322Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
307d1333322SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
308d1333322Smrg])
309d1333322Smrg
310d1333322Smrg
311d1333322Smrg# AM_DEP_TRACK
312d1333322Smrg# ------------
313d1333322SmrgAC_DEFUN([AM_DEP_TRACK],
31469ef5f27Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31569ef5f27SmrgAS_HELP_STRING(
31669ef5f27Smrg  [--enable-dependency-tracking],
31769ef5f27Smrg  [do not reject slow dependency extractors])
31869ef5f27SmrgAS_HELP_STRING(
31969ef5f27Smrg  [--disable-dependency-tracking],
32069ef5f27Smrg  [speeds up one-time build])])
321d1333322Smrgif test "x$enable_dependency_tracking" != xno; then
322d1333322Smrg  am_depcomp="$ac_aux_dir/depcomp"
323d1333322Smrg  AMDEPBACKSLASH='\'
324c27291ebSmrg  am__nodep='_no'
325d1333322Smrgfi
326d1333322SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
327d1333322SmrgAC_SUBST([AMDEPBACKSLASH])dnl
328d1333322Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
329c27291ebSmrgAC_SUBST([am__nodep])dnl
330c27291ebSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
331d1333322Smrg])
332d1333322Smrg
333d1333322Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334d1333322Smrg
335742aa962Smrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
336d1333322Smrg#
337d1333322Smrg# This file is free software; the Free Software Foundation
338d1333322Smrg# gives unlimited permission to copy and/or distribute it,
339d1333322Smrg# with or without modifications, as long as this notice is preserved.
340d1333322Smrg
341d1333322Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
342d1333322Smrg# ------------------------------
343d1333322SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3444f9ac78aSmrg[{
34569ef5f27Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
3464f9ac78aSmrg  # are listed without --file.  Let's play safe and only enable the eval
3474f9ac78aSmrg  # if we detect the quoting.
348d04472e1Smrg  # TODO: see whether this extra hack can be removed once we start
349d04472e1Smrg  # requiring Autoconf 2.70 or later.
350d04472e1Smrg  AS_CASE([$CONFIG_FILES],
351d04472e1Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
352d04472e1Smrg          [*], [set x $CONFIG_FILES])
3534f9ac78aSmrg  shift
354d04472e1Smrg  # Used to flag and report bootstrapping failures.
355d04472e1Smrg  am_rc=0
356d04472e1Smrg  for am_mf
3574f9ac78aSmrg  do
3584f9ac78aSmrg    # Strip MF so we end up with the name of the file.
359d04472e1Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
360d04472e1Smrg    # Check whether this is an Automake generated Makefile which includes
361d04472e1Smrg    # dependency-tracking related rules and includes.
362d04472e1Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
3634f9ac78aSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
364d04472e1Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
365d04472e1Smrg      || continue
366d04472e1Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
367d04472e1Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
368d04472e1Smrg    AM_RUN_LOG([cd "$am_dirpart" \
369d04472e1Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
370d04472e1Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
371d1333322Smrg  done
372d04472e1Smrg  if test $am_rc -ne 0; then
373d04472e1Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
374d04472e1Smrg    for automatic dependency tracking.  If GNU make was not used, consider
375d04472e1Smrg    re-running the configure script with MAKE="gmake" (or whatever is
376d04472e1Smrg    necessary).  You can also try re-running configure with the
377d04472e1Smrg    '--disable-dependency-tracking' option to at least be able to build
378d04472e1Smrg    the package (albeit without support for automatic dependency tracking).])
379d04472e1Smrg  fi
380d04472e1Smrg  AS_UNSET([am_dirpart])
381d04472e1Smrg  AS_UNSET([am_filepart])
382d04472e1Smrg  AS_UNSET([am_mf])
383d04472e1Smrg  AS_UNSET([am_rc])
384d04472e1Smrg  rm -f conftest-deps.mk
3854f9ac78aSmrg}
386d1333322Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387d1333322Smrg
388d1333322Smrg
389d1333322Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
390d1333322Smrg# -----------------------------
391d1333322Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
392d1333322Smrg#
393d04472e1Smrg# This code is only required when automatic dependency tracking is enabled.
394d04472e1Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
395d04472e1Smrg# order to bootstrap the dependency handling code.
396d1333322SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
397d1333322Smrg[AC_CONFIG_COMMANDS([depfiles],
398d1333322Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
399d04472e1Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400d1333322Smrg
401d1333322Smrg# Do all the work for Automake.                             -*- Autoconf -*-
402d1333322Smrg
403742aa962Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
404d1333322Smrg#
405d1333322Smrg# This file is free software; the Free Software Foundation
406d1333322Smrg# gives unlimited permission to copy and/or distribute it,
407d1333322Smrg# with or without modifications, as long as this notice is preserved.
408d1333322Smrg
409d1333322Smrg# This macro actually does too much.  Some checks are only needed if
410d1333322Smrg# your package does certain things.  But this isn't really a big deal.
411d1333322Smrg
41269ef5f27Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
41369ef5f27Smrgm4_define([AC_PROG_CC],
41469ef5f27Smrgm4_defn([AC_PROG_CC])
41569ef5f27Smrg[_AM_PROG_CC_C_O
41669ef5f27Smrg])
41769ef5f27Smrg
418d1333322Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
419d1333322Smrg# AM_INIT_AUTOMAKE([OPTIONS])
420d1333322Smrg# -----------------------------------------------
421d1333322Smrg# The call with PACKAGE and VERSION arguments is the old style
422d1333322Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
423d1333322Smrg# and VERSION should now be passed to AC_INIT and removed from
424d1333322Smrg# the call to AM_INIT_AUTOMAKE.
425d1333322Smrg# We support both call styles for the transition.  After
426d1333322Smrg# the next Automake release, Autoconf can make the AC_INIT
427d1333322Smrg# arguments mandatory, and then we can depend on a new Autoconf
428d1333322Smrg# release and drop the old call support.
429d1333322SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43069ef5f27Smrg[AC_PREREQ([2.65])dnl
431d04472e1Smrgm4_ifdef([_$0_ALREADY_INIT],
432d04472e1Smrg  [m4_fatal([$0 expanded multiple times
433d04472e1Smrg]m4_defn([_$0_ALREADY_INIT]))],
434d04472e1Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
435d1333322Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
436d1333322Smrgdnl the ones we care about.
437d1333322Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
438d1333322SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
439d1333322SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
440d1333322Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
441d1333322Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
442d1333322Smrg  # is not polluted with repeated "-I."
443d1333322Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
444d1333322Smrg  # test to see if srcdir already configured
445d1333322Smrg  if test -f $srcdir/config.status; then
446d1333322Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
447d1333322Smrg  fi
448d1333322Smrgfi
449d1333322Smrg
450d1333322Smrg# test whether we have cygpath
451d1333322Smrgif test -z "$CYGPATH_W"; then
452d1333322Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
453d1333322Smrg    CYGPATH_W='cygpath -w'
454d1333322Smrg  else
455d1333322Smrg    CYGPATH_W=echo
456d1333322Smrg  fi
457d1333322Smrgfi
458d1333322SmrgAC_SUBST([CYGPATH_W])
459d1333322Smrg
460d1333322Smrg# Define the identity of the package.
461d1333322Smrgdnl Distinguish between old-style and new-style calls.
462d1333322Smrgm4_ifval([$2],
46369ef5f27Smrg[AC_DIAGNOSE([obsolete],
46469ef5f27Smrg             [$0: two- and three-arguments forms are deprecated.])
46569ef5f27Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
466d1333322Smrg AC_SUBST([PACKAGE], [$1])dnl
467d1333322Smrg AC_SUBST([VERSION], [$2])],
468d1333322Smrg[_AM_SET_OPTIONS([$1])dnl
469d1333322Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47069ef5f27Smrgm4_if(
471d04472e1Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
47269ef5f27Smrg  [ok:ok],,
473d1333322Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
474d1333322Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
475d1333322Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476d1333322Smrg
477d1333322Smrg_AM_IF_OPTION([no-define],,
47869ef5f27Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
47969ef5f27Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480d1333322Smrg
481d1333322Smrg# Some tools Automake needs.
482d1333322SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
483d1333322SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48469ef5f27SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
48569ef5f27SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
48669ef5f27SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
48769ef5f27SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
48869ef5f27SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4894f9ac78aSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4904f9ac78aSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49169ef5f27SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49269ef5f27Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
49369ef5f27Smrg# dies out for good.  For more background, see:
494d04472e1Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
495d04472e1Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
49669ef5f27SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
497d04472e1Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
498d04472e1Smrg# system "awk" is bad on some platforms.
499d1333322SmrgAC_REQUIRE([AC_PROG_AWK])dnl
500d1333322SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
501d1333322SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
502d1333322Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5034f9ac78aSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5044f9ac78aSmrg			     [_AM_PROG_TAR([v7])])])
505d1333322Smrg_AM_IF_OPTION([no-dependencies],,
506d1333322Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
50769ef5f27Smrg		  [_AM_DEPENDENCIES([CC])],
50869ef5f27Smrg		  [m4_define([AC_PROG_CC],
50969ef5f27Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
510d1333322SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51169ef5f27Smrg		  [_AM_DEPENDENCIES([CXX])],
51269ef5f27Smrg		  [m4_define([AC_PROG_CXX],
51369ef5f27Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
514d1333322SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51569ef5f27Smrg		  [_AM_DEPENDENCIES([OBJC])],
51669ef5f27Smrg		  [m4_define([AC_PROG_OBJC],
51769ef5f27Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
51869ef5f27SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
51969ef5f27Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
52069ef5f27Smrg		  [m4_define([AC_PROG_OBJCXX],
52169ef5f27Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
522d1333322Smrg])
523d04472e1Smrg# Variables for tags utilities; see am/tags.am
524d04472e1Smrgif test -z "$CTAGS"; then
525d04472e1Smrg  CTAGS=ctags
526d04472e1Smrgfi
527d04472e1SmrgAC_SUBST([CTAGS])
528d04472e1Smrgif test -z "$ETAGS"; then
529d04472e1Smrg  ETAGS=etags
530d04472e1Smrgfi
531d04472e1SmrgAC_SUBST([ETAGS])
532d04472e1Smrgif test -z "$CSCOPE"; then
533d04472e1Smrg  CSCOPE=cscope
534d04472e1Smrgfi
535d04472e1SmrgAC_SUBST([CSCOPE])
536d04472e1Smrg
537742aa962SmrgAC_REQUIRE([_AM_SILENT_RULES])dnl
53869ef5f27Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
53969ef5f27Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
54069ef5f27Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5414f9ac78aSmrgAC_CONFIG_COMMANDS_PRE(dnl
5424f9ac78aSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5434f9ac78aSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
544d1333322Smrg
545742aa962SmrgAC_REQUIRE([_AM_PROG_RM_F])
546742aa962SmrgAC_REQUIRE([_AM_PROG_XARGS_N])
54769ef5f27Smrg
548d04472e1Smrgdnl The trailing newline in this macro's definition is deliberate, for
549d04472e1Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
550d04472e1Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
551d04472e1Smrg])
55269ef5f27Smrg
55369ef5f27Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5544f9ac78aSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5554f9ac78aSmrgdnl mangled by Autoconf and run in a shell conditional statement.
5564f9ac78aSmrgm4_define([_AC_COMPILER_EXEEXT],
5574f9ac78aSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5584f9ac78aSmrg
559d1333322Smrg# When config.status generates a header, we must update the stamp-h file.
560d1333322Smrg# This file resides in the same directory as the config header
561d1333322Smrg# that is generated.  The stamp files are numbered to have different names.
562d1333322Smrg
563d1333322Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
564d1333322Smrg# loop where config.status creates the headers, so we can generate
565d1333322Smrg# our stamp files there.
566d1333322SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
567d1333322Smrg[# Compute $1's index in $config_headers.
5684f9ac78aSmrg_am_arg=$1
569d1333322Smrg_am_stamp_count=1
570d1333322Smrgfor _am_header in $config_headers :; do
571d1333322Smrg  case $_am_header in
5724f9ac78aSmrg    $_am_arg | $_am_arg:* )
573d1333322Smrg      break ;;
574d1333322Smrg    * )
575d1333322Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
576d1333322Smrg  esac
577d1333322Smrgdone
5784f9ac78aSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
579d1333322Smrg
580742aa962Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
581d1333322Smrg#
582d1333322Smrg# This file is free software; the Free Software Foundation
583d1333322Smrg# gives unlimited permission to copy and/or distribute it,
584d1333322Smrg# with or without modifications, as long as this notice is preserved.
585d1333322Smrg
586d1333322Smrg# AM_PROG_INSTALL_SH
587d1333322Smrg# ------------------
588d1333322Smrg# Define $install_sh.
589d1333322SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
590d1333322Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
591d04472e1Smrgif test x"${install_sh+set}" != xset; then
5924f9ac78aSmrg  case $am_aux_dir in
5934f9ac78aSmrg  *\ * | *\	*)
5944f9ac78aSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
5954f9ac78aSmrg  *)
5964f9ac78aSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
5974f9ac78aSmrg  esac
5984f9ac78aSmrgfi
59969ef5f27SmrgAC_SUBST([install_sh])])
600d1333322Smrg
601742aa962Smrg# Copyright (C) 2003-2024 Free Software Foundation, Inc.
602d1333322Smrg#
603d1333322Smrg# This file is free software; the Free Software Foundation
604d1333322Smrg# gives unlimited permission to copy and/or distribute it,
605d1333322Smrg# with or without modifications, as long as this notice is preserved.
606d1333322Smrg
607d1333322Smrg# Check whether the underlying file-system supports filenames
608d1333322Smrg# with a leading dot.  For instance MS-DOS doesn't.
609d1333322SmrgAC_DEFUN([AM_SET_LEADING_DOT],
610d1333322Smrg[rm -rf .tst 2>/dev/null
611d1333322Smrgmkdir .tst 2>/dev/null
612d1333322Smrgif test -d .tst; then
613d1333322Smrg  am__leading_dot=.
614d1333322Smrgelse
615d1333322Smrg  am__leading_dot=_
616d1333322Smrgfi
617d1333322Smrgrmdir .tst 2>/dev/null
618d1333322SmrgAC_SUBST([am__leading_dot])])
619d1333322Smrg
620d1333322Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
621d1333322Smrg
622742aa962Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
623d1333322Smrg#
624d1333322Smrg# This file is free software; the Free Software Foundation
625d1333322Smrg# gives unlimited permission to copy and/or distribute it,
626d1333322Smrg# with or without modifications, as long as this notice is preserved.
627d1333322Smrg
628d1333322Smrg# AM_MAKE_INCLUDE()
629d1333322Smrg# -----------------
630d04472e1Smrg# Check whether make has an 'include' directive that can support all
631d04472e1Smrg# the idioms we need for our automatic dependency tracking code.
632d1333322SmrgAC_DEFUN([AM_MAKE_INCLUDE],
633d04472e1Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
634d04472e1Smrgcat > confinc.mk << 'END'
635d1333322Smrgam__doit:
636d04472e1Smrg	@echo this is the am__doit target >confinc.out
637d1333322Smrg.PHONY: am__doit
638d1333322SmrgEND
639d1333322Smrgam__include="#"
640d1333322Smrgam__quote=
641d04472e1Smrg# BSD make does it like this.
642d04472e1Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
643d04472e1Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
644d04472e1Smrgecho 'include confinc.mk # ignored' > confmf.GNU
645d04472e1Smrg_am_result=no
646d04472e1Smrgfor s in GNU BSD; do
647d04472e1Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
648d04472e1Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
649d04472e1Smrg      ['0:this is the am__doit target'],
650d04472e1Smrg      [AS_CASE([$s],
651d04472e1Smrg          [BSD], [am__include='.include' am__quote='"'],
652d04472e1Smrg          [am__include='include' am__quote=''])])
653d04472e1Smrg  if test "$am__include" != "#"; then
654d04472e1Smrg    _am_result="yes ($s style)"
655d04472e1Smrg    break
656d04472e1Smrg  fi
657d04472e1Smrgdone
658d04472e1Smrgrm -f confinc.* confmf.*
659d04472e1SmrgAC_MSG_RESULT([${_am_result}])
660d04472e1SmrgAC_SUBST([am__include])])
661d04472e1SmrgAC_SUBST([am__quote])])
662d1333322Smrg
663d1333322Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
664d1333322Smrg
665742aa962Smrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
666d1333322Smrg#
667d1333322Smrg# This file is free software; the Free Software Foundation
668d1333322Smrg# gives unlimited permission to copy and/or distribute it,
669d1333322Smrg# with or without modifications, as long as this notice is preserved.
670d1333322Smrg
671d1333322Smrg# AM_MISSING_PROG(NAME, PROGRAM)
672d1333322Smrg# ------------------------------
673d1333322SmrgAC_DEFUN([AM_MISSING_PROG],
674d1333322Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
675d1333322Smrg$1=${$1-"${am_missing_run}$2"}
676d1333322SmrgAC_SUBST($1)])
677d1333322Smrg
678d1333322Smrg# AM_MISSING_HAS_RUN
679d1333322Smrg# ------------------
68069ef5f27Smrg# Define MISSING if not defined so far and test if it is modern enough.
68169ef5f27Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
682d1333322SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
683d1333322Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
684d1333322SmrgAC_REQUIRE_AUX_FILE([missing])dnl
6854f9ac78aSmrgif test x"${MISSING+set}" != xset; then
686d04472e1Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
6874f9ac78aSmrgfi
688d1333322Smrg# Use eval to expand $SHELL
68969ef5f27Smrgif eval "$MISSING --is-lightweight"; then
69069ef5f27Smrg  am_missing_run="$MISSING "
691d1333322Smrgelse
692d1333322Smrg  am_missing_run=
69369ef5f27Smrg  AC_MSG_WARN(['missing' script is too old or missing])
694d1333322Smrgfi
695d1333322Smrg])
696d1333322Smrg
697d1333322Smrg# Helper functions for option handling.                     -*- Autoconf -*-
698d1333322Smrg
699742aa962Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
700d1333322Smrg#
701d1333322Smrg# This file is free software; the Free Software Foundation
702d1333322Smrg# gives unlimited permission to copy and/or distribute it,
703d1333322Smrg# with or without modifications, as long as this notice is preserved.
704d1333322Smrg
705d1333322Smrg# _AM_MANGLE_OPTION(NAME)
706d1333322Smrg# -----------------------
707d1333322SmrgAC_DEFUN([_AM_MANGLE_OPTION],
708d1333322Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
709d1333322Smrg
710d1333322Smrg# _AM_SET_OPTION(NAME)
711c27291ebSmrg# --------------------
712d1333322Smrg# Set option NAME.  Presently that only means defining a flag for this option.
713d1333322SmrgAC_DEFUN([_AM_SET_OPTION],
71469ef5f27Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
715d1333322Smrg
716d1333322Smrg# _AM_SET_OPTIONS(OPTIONS)
717c27291ebSmrg# ------------------------
718d1333322Smrg# OPTIONS is a space-separated list of Automake options.
719d1333322SmrgAC_DEFUN([_AM_SET_OPTIONS],
7204f9ac78aSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
721d1333322Smrg
722d1333322Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
723d1333322Smrg# -------------------------------------------
724d1333322Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
725d1333322SmrgAC_DEFUN([_AM_IF_OPTION],
726d1333322Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
727d1333322Smrg
728742aa962Smrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
72969ef5f27Smrg#
73069ef5f27Smrg# This file is free software; the Free Software Foundation
73169ef5f27Smrg# gives unlimited permission to copy and/or distribute it,
73269ef5f27Smrg# with or without modifications, as long as this notice is preserved.
733d1333322Smrg
73469ef5f27Smrg# _AM_PROG_CC_C_O
73569ef5f27Smrg# ---------------
73669ef5f27Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
73769ef5f27Smrg# to automatically call this.
73869ef5f27SmrgAC_DEFUN([_AM_PROG_CC_C_O],
73969ef5f27Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
74069ef5f27SmrgAC_REQUIRE_AUX_FILE([compile])dnl
74169ef5f27SmrgAC_LANG_PUSH([C])dnl
74269ef5f27SmrgAC_CACHE_CHECK(
74369ef5f27Smrg  [whether $CC understands -c and -o together],
74469ef5f27Smrg  [am_cv_prog_cc_c_o],
74569ef5f27Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
74669ef5f27Smrg  # Make sure it works both with $CC and with simple cc.
74769ef5f27Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
74869ef5f27Smrg  # compilers refuse to overwrite an existing .o file with -o,
74969ef5f27Smrg  # though they will create one.
75069ef5f27Smrg  am_cv_prog_cc_c_o=yes
75169ef5f27Smrg  for am_i in 1 2; do
75269ef5f27Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
75369ef5f27Smrg         && test -f conftest2.$ac_objext; then
75469ef5f27Smrg      : OK
75569ef5f27Smrg    else
75669ef5f27Smrg      am_cv_prog_cc_c_o=no
75769ef5f27Smrg      break
75869ef5f27Smrg    fi
75969ef5f27Smrg  done
76069ef5f27Smrg  rm -f core conftest*
76169ef5f27Smrg  unset am_i])
76269ef5f27Smrgif test "$am_cv_prog_cc_c_o" != yes; then
76369ef5f27Smrg   # Losing compiler, so override with the script.
76469ef5f27Smrg   # FIXME: It is wrong to rewrite CC.
76569ef5f27Smrg   # But if we don't then we get into trouble of one sort or another.
76669ef5f27Smrg   # A longer-term fix would be to have automake use am__CC in this case,
76769ef5f27Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
76869ef5f27Smrg   CC="$am_aux_dir/compile $CC"
76969ef5f27Smrgfi
77069ef5f27SmrgAC_LANG_POP([C])])
77169ef5f27Smrg
77269ef5f27Smrg# For backward compatibility.
77369ef5f27SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
77469ef5f27Smrg
775742aa962Smrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
776742aa962Smrg#
777742aa962Smrg# This file is free software; the Free Software Foundation
778742aa962Smrg# gives unlimited permission to copy and/or distribute it,
779742aa962Smrg# with or without modifications, as long as this notice is preserved.
780742aa962Smrg
781742aa962Smrg# _AM_PROG_RM_F
782742aa962Smrg# ---------------
783742aa962Smrg# Check whether 'rm -f' without any arguments works.
784742aa962Smrg# https://bugs.gnu.org/10828
785742aa962SmrgAC_DEFUN([_AM_PROG_RM_F],
786742aa962Smrg[am__rm_f_notfound=
787742aa962SmrgAS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""'])
788742aa962SmrgAC_SUBST(am__rm_f_notfound)
789742aa962Smrg])
790742aa962Smrg
791742aa962Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
792d1333322Smrg#
793d1333322Smrg# This file is free software; the Free Software Foundation
794d1333322Smrg# gives unlimited permission to copy and/or distribute it,
795d1333322Smrg# with or without modifications, as long as this notice is preserved.
796d1333322Smrg
79769ef5f27Smrg# AM_RUN_LOG(COMMAND)
79869ef5f27Smrg# -------------------
79969ef5f27Smrg# Run COMMAND, save the exit status in ac_status, and log it.
80069ef5f27Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
80169ef5f27SmrgAC_DEFUN([AM_RUN_LOG],
80269ef5f27Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
80369ef5f27Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
80469ef5f27Smrg   ac_status=$?
80569ef5f27Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
80669ef5f27Smrg   (exit $ac_status); }])
80769ef5f27Smrg
80869ef5f27Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
80969ef5f27Smrg
810742aa962Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
81169ef5f27Smrg#
81269ef5f27Smrg# This file is free software; the Free Software Foundation
81369ef5f27Smrg# gives unlimited permission to copy and/or distribute it,
81469ef5f27Smrg# with or without modifications, as long as this notice is preserved.
815d1333322Smrg
816742aa962Smrg# _AM_SLEEP_FRACTIONAL_SECONDS
817742aa962Smrg# ----------------------------
818742aa962SmrgAC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl
819742aa962SmrgAC_CACHE_CHECK([whether sleep supports fractional seconds],
820742aa962Smrg               am_cv_sleep_fractional_seconds, [dnl
821742aa962SmrgAS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes],
822742aa962Smrg                                 [am_cv_sleep_fractional_seconds=no])
823742aa962Smrg])])
824742aa962Smrg
825742aa962Smrg# _AM_FILESYSTEM_TIMESTAMP_RESOLUTION
826742aa962Smrg# -----------------------------------
827742aa962Smrg# Determine the filesystem's resolution for file modification
828742aa962Smrg# timestamps.  The coarsest we know of is FAT, with a resolution
829742aa962Smrg# of only two seconds, even with the most recent "exFAT" extensions.
830742aa962Smrg# The finest (e.g. ext4 with large inodes, XFS, ZFS) is one
831742aa962Smrg# nanosecond, matching clock_gettime.  However, it is probably not
832742aa962Smrg# possible to delay execution of a shell script for less than one
833742aa962Smrg# millisecond, due to process creation overhead and scheduling
834742aa962Smrg# granularity, so we don't check for anything finer than that. (See below.)
835742aa962SmrgAC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl
836742aa962SmrgAC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS])
837742aa962SmrgAC_CACHE_CHECK([filesystem timestamp resolution],
838742aa962Smrg               am_cv_filesystem_timestamp_resolution, [dnl
839742aa962Smrg# Default to the worst case.
840742aa962Smrgam_cv_filesystem_timestamp_resolution=2
841742aa962Smrg
842742aa962Smrg# Only try to go finer than 1 sec if sleep can do it.
843742aa962Smrg# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work,
844742aa962Smrg# - 1 sec is not much of a win compared to 2 sec, and
845742aa962Smrg# - it takes 2 seconds to perform the test whether 1 sec works.
846742aa962Smrg# 
847742aa962Smrg# Instead, just use the default 2s on platforms that have 1s resolution,
848742aa962Smrg# accept the extra 1s delay when using $sleep in the Automake tests, in
849742aa962Smrg# exchange for not incurring the 2s delay for running the test for all
850742aa962Smrg# packages.
851742aa962Smrg#
852742aa962Smrgam_try_resolutions=
853742aa962Smrgif test "$am_cv_sleep_fractional_seconds" = yes; then
854742aa962Smrg  # Even a millisecond often causes a bunch of false positives,
855742aa962Smrg  # so just try a hundredth of a second. The time saved between .001 and
856742aa962Smrg  # .01 is not terribly consequential.
857742aa962Smrg  am_try_resolutions="0.01 0.1 $am_try_resolutions"
858742aa962Smrgfi
859742aa962Smrg
860742aa962Smrg# In order to catch current-generation FAT out, we must *modify* files
861742aa962Smrg# that already exist; the *creation* timestamp is finer.  Use names
862742aa962Smrg# that make ls -t sort them differently when they have equal
863742aa962Smrg# timestamps than when they have distinct timestamps, keeping
864742aa962Smrg# in mind that ls -t prints the *newest* file first.
865742aa962Smrgrm -f conftest.ts?
866742aa962Smrg: > conftest.ts1
867742aa962Smrg: > conftest.ts2
868742aa962Smrg: > conftest.ts3
869742aa962Smrg
870742aa962Smrg# Make sure ls -t actually works.  Do 'set' in a subshell so we don't
871742aa962Smrg# clobber the current shell's arguments. (Outer-level square brackets
872742aa962Smrg# are removed by m4; they're present so that m4 does not expand
873742aa962Smrg# <dollar><star>; be careful, easy to get confused.)
874742aa962Smrgif (
875742aa962Smrg     set X `[ls -t conftest.ts[12]]` &&
876742aa962Smrg     {
877742aa962Smrg       test "$[]*" != "X conftest.ts1 conftest.ts2" ||
878742aa962Smrg       test "$[]*" != "X conftest.ts2 conftest.ts1";
879742aa962Smrg     }
880742aa962Smrg); then :; else
881742aa962Smrg  # If neither matched, then we have a broken ls.  This can happen
882742aa962Smrg  # if, for instance, CONFIG_SHELL is bash and it inherits a
883742aa962Smrg  # broken ls alias from the environment.  This has actually
884742aa962Smrg  # happened.  Such a system could not be considered "sane".
885742aa962Smrg  _AS_ECHO_UNQUOTED(
886742aa962Smrg    ["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""],
887742aa962Smrg    [AS_MESSAGE_LOG_FD])
888742aa962Smrg  AC_MSG_FAILURE([ls -t produces unexpected output.
889742aa962SmrgMake sure there is not a broken ls alias in your environment.])
890742aa962Smrgfi
891742aa962Smrg
892742aa962Smrgfor am_try_res in $am_try_resolutions; do
893742aa962Smrg  # Any one fine-grained sleep might happen to cross the boundary
894742aa962Smrg  # between two values of a coarser actual resolution, but if we do
895742aa962Smrg  # two fine-grained sleeps in a row, at least one of them will fall
896742aa962Smrg  # entirely within a coarse interval.
897742aa962Smrg  echo alpha > conftest.ts1
898742aa962Smrg  sleep $am_try_res
899742aa962Smrg  echo beta > conftest.ts2
900742aa962Smrg  sleep $am_try_res
901742aa962Smrg  echo gamma > conftest.ts3
902742aa962Smrg
903742aa962Smrg  # We assume that 'ls -t' will make use of high-resolution
904742aa962Smrg  # timestamps if the operating system supports them at all.
905742aa962Smrg  if (set X `ls -t conftest.ts?` &&
906742aa962Smrg      test "$[]2" = conftest.ts3 &&
907742aa962Smrg      test "$[]3" = conftest.ts2 &&
908742aa962Smrg      test "$[]4" = conftest.ts1); then
909742aa962Smrg    #
910742aa962Smrg    # Ok, ls -t worked. If we're at a resolution of 1 second, we're done,
911742aa962Smrg    # because we don't need to test make.
912742aa962Smrg    make_ok=true
913742aa962Smrg    if test $am_try_res != 1; then
914742aa962Smrg      # But if we've succeeded so far with a subsecond resolution, we
915742aa962Smrg      # have one more thing to check: make. It can happen that
916742aa962Smrg      # everything else supports the subsecond mtimes, but make doesn't;
917742aa962Smrg      # notably on macOS, which ships make 3.81 from 2006 (the last one
918742aa962Smrg      # released under GPLv2). https://bugs.gnu.org/68808
919742aa962Smrg      # 
920742aa962Smrg      # We test $MAKE if it is defined in the environment, else "make".
921742aa962Smrg      # It might get overridden later, but our hope is that in practice
922742aa962Smrg      # it does not matter: it is the system "make" which is (by far)
923742aa962Smrg      # the most likely to be broken, whereas if the user overrides it,
924742aa962Smrg      # probably they did so with a better, or at least not worse, make.
925742aa962Smrg      # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html
926742aa962Smrg      #
927742aa962Smrg      # Create a Makefile (real tab character here):
928742aa962Smrg      rm -f conftest.mk
929742aa962Smrg      echo 'conftest.ts1: conftest.ts2' >conftest.mk
930742aa962Smrg      echo '	touch conftest.ts2' >>conftest.mk
931742aa962Smrg      #
932742aa962Smrg      # Now, running
933742aa962Smrg      #   touch conftest.ts1; touch conftest.ts2; make
934742aa962Smrg      # should touch ts1 because ts2 is newer. This could happen by luck,
935742aa962Smrg      # but most often, it will fail if make's support is insufficient. So
936742aa962Smrg      # test for several consecutive successes.
937742aa962Smrg      #
938742aa962Smrg      # (We reuse conftest.ts[12] because we still want to modify existing
939742aa962Smrg      # files, not create new ones, per above.)
940742aa962Smrg      n=0
941742aa962Smrg      make=${MAKE-make}
942742aa962Smrg      until test $n -eq 3; do
943742aa962Smrg        echo one > conftest.ts1
944742aa962Smrg        sleep $am_try_res
945742aa962Smrg        echo two > conftest.ts2 # ts2 should now be newer than ts1
946742aa962Smrg        if $make -f conftest.mk | grep 'up to date' >/dev/null; then
947742aa962Smrg          make_ok=false
948742aa962Smrg          break # out of $n loop
949742aa962Smrg        fi
950742aa962Smrg        n=`expr $n + 1`
951742aa962Smrg      done
952742aa962Smrg    fi
953742aa962Smrg    #
954742aa962Smrg    if $make_ok; then
955742aa962Smrg      # Everything we know to check worked out, so call this resolution good.
956742aa962Smrg      am_cv_filesystem_timestamp_resolution=$am_try_res
957742aa962Smrg      break # out of $am_try_res loop
958742aa962Smrg    fi
959742aa962Smrg    # Otherwise, we'll go on to check the next resolution.
960742aa962Smrg  fi
961742aa962Smrgdone
962742aa962Smrgrm -f conftest.ts?
963742aa962Smrg# (end _am_filesystem_timestamp_resolution)
964742aa962Smrg])])
965742aa962Smrg
966d1333322Smrg# AM_SANITY_CHECK
967d1333322Smrg# ---------------
968d1333322SmrgAC_DEFUN([AM_SANITY_CHECK],
969742aa962Smrg[AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION])
970742aa962Smrg# This check should not be cached, as it may vary across builds of
971742aa962Smrg# different projects.
972742aa962SmrgAC_MSG_CHECKING([whether build environment is sane])
9734f9ac78aSmrg# Reject unsafe characters in $srcdir or the absolute working directory
9744f9ac78aSmrg# name.  Accept space and tab only in the latter.
9754f9ac78aSmrgam_lf='
9764f9ac78aSmrg'
9774f9ac78aSmrgcase `pwd` in
9784f9ac78aSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
9794f9ac78aSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
9804f9ac78aSmrgesac
9814f9ac78aSmrgcase $srcdir in
9824f9ac78aSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
98369ef5f27Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
9844f9ac78aSmrgesac
9854f9ac78aSmrg
98669ef5f27Smrg# Do 'set' in a subshell so we don't clobber the current shell's
987d1333322Smrg# arguments.  Must try -L first in case configure is actually a
988d1333322Smrg# symlink; some systems play weird games with the mod time of symlinks
989d1333322Smrg# (eg FreeBSD returns the mod time of the symlink's containing
990d1333322Smrg# directory).
991742aa962Smrgam_build_env_is_sane=no
992742aa962Smrgam_has_slept=no
993742aa962Smrgrm -f conftest.file
994742aa962Smrgfor am_try in 1 2; do
995742aa962Smrg  echo "timestamp, slept: $am_has_slept" > conftest.file
996742aa962Smrg  if (
997742aa962Smrg    set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
998742aa962Smrg    if test "$[]*" = "X"; then
999742aa962Smrg      # -L didn't work.
1000742aa962Smrg      set X `ls -t "$srcdir/configure" conftest.file`
1001742aa962Smrg    fi
1002742aa962Smrg    test "$[]2" = conftest.file
1003742aa962Smrg  ); then
1004742aa962Smrg    am_build_env_is_sane=yes
1005742aa962Smrg    break
1006742aa962Smrg  fi
1007742aa962Smrg  # Just in case.
1008742aa962Smrg  sleep "$am_cv_filesystem_timestamp_resolution"
1009742aa962Smrg  am_has_slept=yes
1010742aa962Smrgdone
1011742aa962Smrg
1012742aa962SmrgAC_MSG_RESULT([$am_build_env_is_sane])
1013742aa962Smrgif test "$am_build_env_is_sane" = no; then
1014742aa962Smrg  AC_MSG_ERROR([newly created file is older than distributed files!
1015d1333322SmrgCheck your system clock])
1016d1333322Smrgfi
1017742aa962Smrg
101869ef5f27Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
101969ef5f27Smrg# generated files are strictly newer.
102069ef5f27Smrgam_sleep_pid=
1021742aa962SmrgAS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl
1022742aa962Smrg  ( sleep "$am_cv_filesystem_timestamp_resolution" ) &
102369ef5f27Smrg  am_sleep_pid=$!
1024742aa962Smrg])
102569ef5f27SmrgAC_CONFIG_COMMANDS_PRE(
102669ef5f27Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
102769ef5f27Smrg   if test -n "$am_sleep_pid"; then
102869ef5f27Smrg     # Hide warnings about reused PIDs.
102969ef5f27Smrg     wait $am_sleep_pid 2>/dev/null
103069ef5f27Smrg   fi
103169ef5f27Smrg   AC_MSG_RESULT([done])])
103269ef5f27Smrgrm -f conftest.file
103369ef5f27Smrg])
1034d1333322Smrg
1035742aa962Smrg# Copyright (C) 2009-2024 Free Software Foundation, Inc.
10364f9ac78aSmrg#
10374f9ac78aSmrg# This file is free software; the Free Software Foundation
10384f9ac78aSmrg# gives unlimited permission to copy and/or distribute it,
10394f9ac78aSmrg# with or without modifications, as long as this notice is preserved.
10404f9ac78aSmrg
1041742aa962Smrg# _AM_SILENT_RULES
1042742aa962Smrg# ----------------
1043742aa962Smrg# Enable less verbose build rules support.
1044742aa962SmrgAC_DEFUN([_AM_SILENT_RULES],
1045742aa962Smrg[AM_DEFAULT_VERBOSITY=1
1046742aa962SmrgAC_ARG_ENABLE([silent-rules], [dnl
104769ef5f27SmrgAS_HELP_STRING(
104869ef5f27Smrg  [--enable-silent-rules],
104969ef5f27Smrg  [less verbose build output (undo: "make V=1")])
105069ef5f27SmrgAS_HELP_STRING(
105169ef5f27Smrg  [--disable-silent-rules],
105269ef5f27Smrg  [verbose build output (undo: "make V=0")])dnl
105369ef5f27Smrg])
105469ef5f27Smrgdnl
105569ef5f27Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
105669ef5f27Smrgdnl do not support nested variable expansions.
105769ef5f27Smrgdnl See automake bug#9928 and bug#10237.
105869ef5f27Smrgam_make=${MAKE-make}
105969ef5f27SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
106069ef5f27Smrg   [am_cv_make_support_nested_variables],
106169ef5f27Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
106269ef5f27SmrgBAR0=false
106369ef5f27SmrgBAR1=true
106469ef5f27SmrgV=1
106569ef5f27Smrgam__doit:
106669ef5f27Smrg	@$(TRUE)
106769ef5f27Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
106869ef5f27Smrg  am_cv_make_support_nested_variables=yes
106969ef5f27Smrgelse
107069ef5f27Smrg  am_cv_make_support_nested_variables=no
107169ef5f27Smrgfi])
107269ef5f27SmrgAC_SUBST([AM_V])dnl
107369ef5f27SmrgAM_SUBST_NOTMAKE([AM_V])dnl
107469ef5f27SmrgAC_SUBST([AM_DEFAULT_V])dnl
107569ef5f27SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
10764f9ac78aSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
10774f9ac78aSmrgAM_BACKSLASH='\'
10784f9ac78aSmrgAC_SUBST([AM_BACKSLASH])dnl
10794f9ac78aSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
1080742aa962Smrgdnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls
1081742aa962Smrgdnl to AM_SILENT_RULES to change the default value.
1082742aa962SmrgAC_CONFIG_COMMANDS_PRE([dnl
1083742aa962Smrgcase $enable_silent_rules in @%:@ (((
1084742aa962Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
1085742aa962Smrg   no) AM_DEFAULT_VERBOSITY=1;;
1086742aa962Smrgesac
1087742aa962Smrgif test $am_cv_make_support_nested_variables = yes; then
1088742aa962Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
1089742aa962Smrg  AM_V='$(V)'
1090742aa962Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
1091742aa962Smrgelse
1092742aa962Smrg  AM_V=$AM_DEFAULT_VERBOSITY
1093742aa962Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
1094742aa962Smrgfi
1095742aa962Smrg])dnl
10964f9ac78aSmrg])
10974f9ac78aSmrg
1098742aa962Smrg# AM_SILENT_RULES([DEFAULT])
1099742aa962Smrg# --------------------------
1100742aa962Smrg# Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or
1101742aa962Smrg# empty being verbose).
1102742aa962SmrgAC_DEFUN([AM_SILENT_RULES],
1103742aa962Smrg[AC_REQUIRE([_AM_SILENT_RULES])
1104742aa962SmrgAM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])])
1105742aa962Smrg
1106742aa962Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
1107d1333322Smrg#
1108d1333322Smrg# This file is free software; the Free Software Foundation
1109d1333322Smrg# gives unlimited permission to copy and/or distribute it,
1110d1333322Smrg# with or without modifications, as long as this notice is preserved.
1111d1333322Smrg
1112d1333322Smrg# AM_PROG_INSTALL_STRIP
1113d1333322Smrg# ---------------------
111469ef5f27Smrg# One issue with vendor 'install' (even GNU) is that you can't
1115d1333322Smrg# specify the program used to strip binaries.  This is especially
1116d1333322Smrg# annoying in cross-compiling environments, where the build's strip
1117d1333322Smrg# is unlikely to handle the host's binaries.
1118d1333322Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
111969ef5f27Smrg# always use install-sh in "make install-strip", and initialize
1120d1333322Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
1121d1333322SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
1122d1333322Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
112369ef5f27Smrg# Installed binaries are usually stripped using 'strip' when the user
112469ef5f27Smrg# run "make install-strip".  However 'strip' might not be the right
1125d1333322Smrg# tool to use in cross-compilation environments, therefore Automake
112669ef5f27Smrg# will honor the 'STRIP' environment variable to overrule this program.
112769ef5f27Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
1128d1333322Smrgif test "$cross_compiling" != no; then
1129d1333322Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
1130d1333322Smrgfi
1131d1333322SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
1132d1333322SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1133d1333322Smrg
1134742aa962Smrg# Copyright (C) 2006-2024 Free Software Foundation, Inc.
1135d1333322Smrg#
1136d1333322Smrg# This file is free software; the Free Software Foundation
1137d1333322Smrg# gives unlimited permission to copy and/or distribute it,
1138d1333322Smrg# with or without modifications, as long as this notice is preserved.
1139d1333322Smrg
1140d1333322Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
1141d1333322Smrg# ---------------------------
11424f9ac78aSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1143d1333322Smrg# This macro is traced by Automake.
1144d1333322SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1145d1333322Smrg
11464f9ac78aSmrg# AM_SUBST_NOTMAKE(VARIABLE)
1147c27291ebSmrg# --------------------------
11484f9ac78aSmrg# Public sister of _AM_SUBST_NOTMAKE.
11494f9ac78aSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
11504f9ac78aSmrg
1151d1333322Smrg# Check how to create a tarball.                            -*- Autoconf -*-
1152d1333322Smrg
1153742aa962Smrg# Copyright (C) 2004-2024 Free Software Foundation, Inc.
1154d1333322Smrg#
1155d1333322Smrg# This file is free software; the Free Software Foundation
1156d1333322Smrg# gives unlimited permission to copy and/or distribute it,
1157d1333322Smrg# with or without modifications, as long as this notice is preserved.
1158d1333322Smrg
1159d1333322Smrg# _AM_PROG_TAR(FORMAT)
1160d1333322Smrg# --------------------
1161d1333322Smrg# Check how to create a tarball in format FORMAT.
116269ef5f27Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1163d1333322Smrg#
1164d1333322Smrg# Substitute a variable $(am__tar) that is a command
1165d1333322Smrg# writing to stdout a FORMAT-tarball containing the directory
1166d1333322Smrg# $tardir.
1167d1333322Smrg#     tardir=directory && $(am__tar) > result.tar
1168d1333322Smrg#
1169d1333322Smrg# Substitute a variable $(am__untar) that extract such
1170d1333322Smrg# a tarball read from stdin.
1171d1333322Smrg#     $(am__untar) < result.tar
117269ef5f27Smrg#
1173d1333322SmrgAC_DEFUN([_AM_PROG_TAR],
117469ef5f27Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
117569ef5f27Smrg# in the wild :-(  We should find a proper way to deprecate it ...
117669ef5f27SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
117769ef5f27Smrg
117869ef5f27Smrg# We'll loop over all known methods to create a tar archive until one works.
1179d1333322Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1180d1333322Smrg
118169ef5f27Smrgm4_if([$1], [v7],
118269ef5f27Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
118369ef5f27Smrg
118469ef5f27Smrg  [m4_case([$1],
118569ef5f27Smrg    [ustar],
118669ef5f27Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
118769ef5f27Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
118869ef5f27Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
118969ef5f27Smrg      # and bug#13588).
119069ef5f27Smrg      am_max_uid=2097151 # 2^21 - 1
119169ef5f27Smrg      am_max_gid=$am_max_uid
119269ef5f27Smrg      # The $UID and $GID variables are not portable, so we need to resort
119369ef5f27Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
119469ef5f27Smrg      # below are definitely unexpected, so allow the users to see them
119569ef5f27Smrg      # (that is, avoid stderr redirection).
119669ef5f27Smrg      am_uid=`id -u || echo unknown`
119769ef5f27Smrg      am_gid=`id -g || echo unknown`
119869ef5f27Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1199742aa962Smrg      if test x$am_uid = xunknown; then
1200742aa962Smrg        AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work])
1201742aa962Smrg      elif test $am_uid -le $am_max_uid; then
1202742aa962Smrg        AC_MSG_RESULT([yes])
120369ef5f27Smrg      else
1204742aa962Smrg        AC_MSG_RESULT([no])
1205742aa962Smrg        _am_tools=none
120669ef5f27Smrg      fi
120769ef5f27Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1208742aa962Smrg      if test x$gm_gid = xunknown; then
1209742aa962Smrg        AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work])
1210742aa962Smrg      elif test $am_gid -le $am_max_gid; then
1211742aa962Smrg        AC_MSG_RESULT([yes])
121269ef5f27Smrg      else
121369ef5f27Smrg        AC_MSG_RESULT([no])
121469ef5f27Smrg        _am_tools=none
121569ef5f27Smrg      fi],
121669ef5f27Smrg
121769ef5f27Smrg  [pax],
121869ef5f27Smrg    [],
121969ef5f27Smrg
122069ef5f27Smrg  [m4_fatal([Unknown tar format])])
122169ef5f27Smrg
122269ef5f27Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
122369ef5f27Smrg
122469ef5f27Smrg  # Go ahead even if we have the value already cached.  We do so because we
122569ef5f27Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
122669ef5f27Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
122769ef5f27Smrg
122869ef5f27Smrg  for _am_tool in $_am_tools; do
122969ef5f27Smrg    case $_am_tool in
123069ef5f27Smrg    gnutar)
123169ef5f27Smrg      for _am_tar in tar gnutar gtar; do
123269ef5f27Smrg        AM_RUN_LOG([$_am_tar --version]) && break
123369ef5f27Smrg      done
123469ef5f27Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
123569ef5f27Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
123669ef5f27Smrg      am__untar="$_am_tar -xf -"
123769ef5f27Smrg      ;;
123869ef5f27Smrg    plaintar)
123969ef5f27Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
124069ef5f27Smrg      # ustar tarball either.
124169ef5f27Smrg      (tar --version) >/dev/null 2>&1 && continue
124269ef5f27Smrg      am__tar='tar chf - "$$tardir"'
124369ef5f27Smrg      am__tar_='tar chf - "$tardir"'
124469ef5f27Smrg      am__untar='tar xf -'
124569ef5f27Smrg      ;;
124669ef5f27Smrg    pax)
124769ef5f27Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
124869ef5f27Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
124969ef5f27Smrg      am__untar='pax -r'
125069ef5f27Smrg      ;;
125169ef5f27Smrg    cpio)
125269ef5f27Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
125369ef5f27Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
125469ef5f27Smrg      am__untar='cpio -i -H $1 -d'
125569ef5f27Smrg      ;;
125669ef5f27Smrg    none)
125769ef5f27Smrg      am__tar=false
125869ef5f27Smrg      am__tar_=false
125969ef5f27Smrg      am__untar=false
126069ef5f27Smrg      ;;
126169ef5f27Smrg    esac
1262d1333322Smrg
126369ef5f27Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
126469ef5f27Smrg    # and am__untar set.
126569ef5f27Smrg    test -n "${am_cv_prog_tar_$1}" && break
126669ef5f27Smrg
126769ef5f27Smrg    # tar/untar a dummy directory, and stop if the command works.
126869ef5f27Smrg    rm -rf conftest.dir
126969ef5f27Smrg    mkdir conftest.dir
127069ef5f27Smrg    echo GrepMe > conftest.dir/file
127169ef5f27Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
127269ef5f27Smrg    rm -rf conftest.dir
127369ef5f27Smrg    if test -s conftest.tar; then
127469ef5f27Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
127569ef5f27Smrg      AM_RUN_LOG([cat conftest.dir/file])
127669ef5f27Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
127769ef5f27Smrg    fi
127869ef5f27Smrg  done
1279d1333322Smrg  rm -rf conftest.dir
1280d1333322Smrg
128169ef5f27Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
128269ef5f27Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
128369ef5f27Smrg
1284d1333322SmrgAC_SUBST([am__tar])
1285d1333322SmrgAC_SUBST([am__untar])
1286d1333322Smrg]) # _AM_PROG_TAR
1287d1333322Smrg
1288742aa962Smrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
1289742aa962Smrg#
1290742aa962Smrg# This file is free software; the Free Software Foundation
1291742aa962Smrg# gives unlimited permission to copy and/or distribute it,
1292742aa962Smrg# with or without modifications, as long as this notice is preserved.
1293742aa962Smrg
1294742aa962Smrg# _AM_PROG_XARGS_N
1295742aa962Smrg# ----------------
1296742aa962Smrg# Check whether 'xargs -n' works.  It should work everywhere, so the fallback
1297742aa962Smrg# is not optimized at all as we never expect to use it.
1298742aa962SmrgAC_DEFUN([_AM_PROG_XARGS_N],
1299742aa962Smrg[AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl
1300742aa962SmrgAS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2
1301742aa962Smrg3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])])
1302742aa962SmrgAS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl
1303742aa962Smrg  am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }'
1304742aa962Smrg])dnl
1305742aa962SmrgAC_SUBST(am__xargs_n)
1306742aa962Smrg])
1307742aa962Smrg
1308d04472e1Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1309d04472e1Smrgdnl serial 11 (pkg-config-0.29)
1310d04472e1Smrgdnl
1311d04472e1Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1312d04472e1Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1313d04472e1Smrgdnl
1314d04472e1Smrgdnl This program is free software; you can redistribute it and/or modify
1315d04472e1Smrgdnl it under the terms of the GNU General Public License as published by
1316d04472e1Smrgdnl the Free Software Foundation; either version 2 of the License, or
1317d04472e1Smrgdnl (at your option) any later version.
1318d04472e1Smrgdnl
1319d04472e1Smrgdnl This program is distributed in the hope that it will be useful, but
1320d04472e1Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1321d04472e1Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1322d04472e1Smrgdnl General Public License for more details.
1323d04472e1Smrgdnl
1324d04472e1Smrgdnl You should have received a copy of the GNU General Public License
1325d04472e1Smrgdnl along with this program; if not, write to the Free Software
1326d04472e1Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1327d04472e1Smrgdnl 02111-1307, USA.
1328d04472e1Smrgdnl
1329d04472e1Smrgdnl As a special exception to the GNU General Public License, if you
1330d04472e1Smrgdnl distribute this file as part of a program that contains a
1331d04472e1Smrgdnl configuration script generated by Autoconf, you may include it under
1332d04472e1Smrgdnl the same distribution terms that you use for the rest of that
1333d04472e1Smrgdnl program.
1334d04472e1Smrg
1335d04472e1Smrgdnl PKG_PREREQ(MIN-VERSION)
1336d04472e1Smrgdnl -----------------------
1337d04472e1Smrgdnl Since: 0.29
1338d04472e1Smrgdnl
1339d04472e1Smrgdnl Verify that the version of the pkg-config macros are at least
1340d04472e1Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1341d04472e1Smrgdnl installed version of pkg-config, this checks the developer's version
1342d04472e1Smrgdnl of pkg.m4 when generating configure.
1343d04472e1Smrgdnl
1344d04472e1Smrgdnl To ensure that this macro is defined, also add:
1345d04472e1Smrgdnl m4_ifndef([PKG_PREREQ],
1346d04472e1Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1347d04472e1Smrgdnl
1348d04472e1Smrgdnl See the "Since" comment for each macro you use to see what version
1349d04472e1Smrgdnl of the macros you require.
1350d04472e1Smrgm4_defun([PKG_PREREQ],
1351d04472e1Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
1352d04472e1Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1353d04472e1Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1354d04472e1Smrg])dnl PKG_PREREQ
1355d04472e1Smrg
1356d04472e1Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1357d04472e1Smrgdnl ----------------------------------
1358d04472e1Smrgdnl Since: 0.16
1359d04472e1Smrgdnl
1360d04472e1Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1361d04472e1Smrgdnl first found in the path. Checks that the version of pkg-config found
1362d04472e1Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1363d04472e1Smrgdnl used since that's the first version where most current features of
1364d04472e1Smrgdnl pkg-config existed.
1365c27291ebSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1366c27291ebSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1367d04472e1Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1368d04472e1Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1369d04472e1SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1370d04472e1SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1371d04472e1SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1372d04472e1Smrg
1373c27291ebSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1374c27291ebSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1375c27291ebSmrgfi
1376c27291ebSmrgif test -n "$PKG_CONFIG"; then
1377c27291ebSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
1378c27291ebSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1379c27291ebSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1380c27291ebSmrg		AC_MSG_RESULT([yes])
1381c27291ebSmrg	else
1382c27291ebSmrg		AC_MSG_RESULT([no])
1383c27291ebSmrg		PKG_CONFIG=""
1384c27291ebSmrg	fi
1385c27291ebSmrgfi[]dnl
1386d04472e1Smrg])dnl PKG_PROG_PKG_CONFIG
1387c27291ebSmrg
1388d04472e1Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1389d04472e1Smrgdnl -------------------------------------------------------------------
1390d04472e1Smrgdnl Since: 0.18
1391d04472e1Smrgdnl
1392d04472e1Smrgdnl Check to see whether a particular set of modules exists. Similar to
1393d04472e1Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1394d04472e1Smrgdnl
1395d04472e1Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1396d04472e1Smrgdnl only at the first occurence in configure.ac, so if the first place
1397d04472e1Smrgdnl it's called might be skipped (such as if it is within an "if", you
1398d04472e1Smrgdnl have to call PKG_CHECK_EXISTS manually
1399c27291ebSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1400c27291ebSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1401c27291ebSmrgif test -n "$PKG_CONFIG" && \
1402c27291ebSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1403d04472e1Smrg  m4_default([$2], [:])
1404c27291ebSmrgm4_ifvaln([$3], [else
1405c27291ebSmrg  $3])dnl
1406c27291ebSmrgfi])
1407c27291ebSmrg
1408d04472e1Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1409d04472e1Smrgdnl ---------------------------------------------
1410d04472e1Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1411d04472e1Smrgdnl pkg_failed based on the result.
1412c27291ebSmrgm4_define([_PKG_CONFIG],
1413c27291ebSmrg[if test -n "$$1"; then
1414c27291ebSmrg    pkg_cv_[]$1="$$1"
1415c27291ebSmrg elif test -n "$PKG_CONFIG"; then
1416c27291ebSmrg    PKG_CHECK_EXISTS([$3],
1417d04472e1Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1418d04472e1Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
1419c27291ebSmrg		     [pkg_failed=yes])
1420c27291ebSmrg else
1421c27291ebSmrg    pkg_failed=untried
1422c27291ebSmrgfi[]dnl
1423d04472e1Smrg])dnl _PKG_CONFIG
1424c27291ebSmrg
1425d04472e1Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1426d04472e1Smrgdnl ---------------------------
1427d04472e1Smrgdnl Internal check to see if pkg-config supports short errors.
1428c27291ebSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1429c27291ebSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1430c27291ebSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1431c27291ebSmrg        _pkg_short_errors_supported=yes
1432c27291ebSmrgelse
1433c27291ebSmrg        _pkg_short_errors_supported=no
1434c27291ebSmrgfi[]dnl
1435d04472e1Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1436c27291ebSmrg
1437c27291ebSmrg
1438d04472e1Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1439d04472e1Smrgdnl   [ACTION-IF-NOT-FOUND])
1440d04472e1Smrgdnl --------------------------------------------------------------
1441d04472e1Smrgdnl Since: 0.4.0
1442d04472e1Smrgdnl
1443d04472e1Smrgdnl Note that if there is a possibility the first call to
1444d04472e1Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1445d04472e1Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1446c27291ebSmrgAC_DEFUN([PKG_CHECK_MODULES],
1447c27291ebSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1448c27291ebSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1449c27291ebSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1450c27291ebSmrg
1451c27291ebSmrgpkg_failed=no
1452c27291ebSmrgAC_MSG_CHECKING([for $1])
1453c27291ebSmrg
1454c27291ebSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1455c27291ebSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1456c27291ebSmrg
1457c27291ebSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1458c27291ebSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1459c27291ebSmrgSee the pkg-config man page for more details.])
1460c27291ebSmrg
1461c27291ebSmrgif test $pkg_failed = yes; then
1462d04472e1Smrg   	AC_MSG_RESULT([no])
1463c27291ebSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1464c27291ebSmrg        if test $_pkg_short_errors_supported = yes; then
1465d04472e1Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1466c27291ebSmrg        else 
1467d04472e1Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1468c27291ebSmrg        fi
1469c27291ebSmrg	# Put the nasty error message in config.log where it belongs
1470c27291ebSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1471c27291ebSmrg
1472d04472e1Smrg	m4_default([$4], [AC_MSG_ERROR(
1473c27291ebSmrg[Package requirements ($2) were not met:
1474c27291ebSmrg
1475c27291ebSmrg$$1_PKG_ERRORS
1476c27291ebSmrg
1477c27291ebSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1478c27291ebSmrginstalled software in a non-standard prefix.
1479c27291ebSmrg
1480d04472e1Smrg_PKG_TEXT])[]dnl
1481d04472e1Smrg        ])
1482c27291ebSmrgelif test $pkg_failed = untried; then
1483d04472e1Smrg     	AC_MSG_RESULT([no])
1484d04472e1Smrg	m4_default([$4], [AC_MSG_FAILURE(
1485c27291ebSmrg[The pkg-config script could not be found or is too old.  Make sure it
1486c27291ebSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
1487c27291ebSmrgpath to pkg-config.
1488c27291ebSmrg
1489c27291ebSmrg_PKG_TEXT
1490c27291ebSmrg
1491d04472e1SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1492d04472e1Smrg        ])
1493c27291ebSmrgelse
1494c27291ebSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1495c27291ebSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1496c27291ebSmrg        AC_MSG_RESULT([yes])
1497d04472e1Smrg	$3
1498c27291ebSmrgfi[]dnl
1499d04472e1Smrg])dnl PKG_CHECK_MODULES
1500d04472e1Smrg
1501d04472e1Smrg
1502d04472e1Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1503d04472e1Smrgdnl   [ACTION-IF-NOT-FOUND])
1504d04472e1Smrgdnl ---------------------------------------------------------------------
1505d04472e1Smrgdnl Since: 0.29
1506d04472e1Smrgdnl
1507d04472e1Smrgdnl Checks for existence of MODULES and gathers its build flags with
1508d04472e1Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1509d04472e1Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1510d04472e1Smrgdnl
1511d04472e1Smrgdnl Note that if there is a possibility the first call to
1512d04472e1Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1513d04472e1Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1514d04472e1Smrgdnl configure.ac.
1515d04472e1SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1516d04472e1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1517d04472e1Smrg_save_PKG_CONFIG=$PKG_CONFIG
1518d04472e1SmrgPKG_CONFIG="$PKG_CONFIG --static"
1519d04472e1SmrgPKG_CHECK_MODULES($@)
1520d04472e1SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1521d04472e1Smrg])dnl PKG_CHECK_MODULES_STATIC
1522d04472e1Smrg
1523d04472e1Smrg
1524d04472e1Smrgdnl PKG_INSTALLDIR([DIRECTORY])
1525d04472e1Smrgdnl -------------------------
1526d04472e1Smrgdnl Since: 0.27
1527d04472e1Smrgdnl
1528d04472e1Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
1529d04472e1Smrgdnl should install pkg-config .pc files. By default the directory is
1530d04472e1Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
1531d04472e1Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1532d04472e1Smrgdnl parameter.
1533d04472e1SmrgAC_DEFUN([PKG_INSTALLDIR],
1534d04472e1Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1535d04472e1Smrgm4_pushdef([pkg_description],
1536d04472e1Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1537d04472e1SmrgAC_ARG_WITH([pkgconfigdir],
1538d04472e1Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1539d04472e1Smrg    [with_pkgconfigdir=]pkg_default)
1540d04472e1SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1541d04472e1Smrgm4_popdef([pkg_default])
1542d04472e1Smrgm4_popdef([pkg_description])
1543d04472e1Smrg])dnl PKG_INSTALLDIR
1544d04472e1Smrg
1545d04472e1Smrg
1546d04472e1Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1547d04472e1Smrgdnl --------------------------------
1548d04472e1Smrgdnl Since: 0.27
1549d04472e1Smrgdnl
1550d04472e1Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1551d04472e1Smrgdnl module should install arch-independent pkg-config .pc files. By
1552d04472e1Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
1553d04472e1Smrgdnl changed by passing DIRECTORY. The user can override through the
1554d04472e1Smrgdnl --with-noarch-pkgconfigdir parameter.
1555d04472e1SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1556d04472e1Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1557d04472e1Smrgm4_pushdef([pkg_description],
1558d04472e1Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1559d04472e1SmrgAC_ARG_WITH([noarch-pkgconfigdir],
1560d04472e1Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1561d04472e1Smrg    [with_noarch_pkgconfigdir=]pkg_default)
1562d04472e1SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1563d04472e1Smrgm4_popdef([pkg_default])
1564d04472e1Smrgm4_popdef([pkg_description])
1565d04472e1Smrg])dnl PKG_NOARCH_INSTALLDIR
1566d04472e1Smrg
1567d04472e1Smrg
1568d04472e1Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1569d04472e1Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1570d04472e1Smrgdnl -------------------------------------------
1571d04472e1Smrgdnl Since: 0.28
1572d04472e1Smrgdnl
1573d04472e1Smrgdnl Retrieves the value of the pkg-config variable for the given module.
1574d04472e1SmrgAC_DEFUN([PKG_CHECK_VAR],
1575d04472e1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1576d04472e1SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1577d04472e1Smrg
1578d04472e1Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1579d04472e1SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1580d04472e1Smrg
1581d04472e1SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1582d04472e1Smrg])dnl PKG_CHECK_VAR
1583c27291ebSmrg
15844f9ac78aSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1585d1333322Smrgdnl
1586742aa962Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
158769ef5f27Smrgdnl
1588d1333322Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
15894f9ac78aSmrgdnl copy of this software and associated documentation files (the "Software"),
15904f9ac78aSmrgdnl to deal in the Software without restriction, including without limitation
15914f9ac78aSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
15924f9ac78aSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
15934f9ac78aSmrgdnl Software is furnished to do so, subject to the following conditions:
1594d1333322Smrgdnl
15954f9ac78aSmrgdnl The above copyright notice and this permission notice (including the next
15964f9ac78aSmrgdnl paragraph) shall be included in all copies or substantial portions of the
15974f9ac78aSmrgdnl Software.
1598d1333322Smrgdnl
15994f9ac78aSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16004f9ac78aSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16014f9ac78aSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
16024f9ac78aSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16034f9ac78aSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
16044f9ac78aSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
16054f9ac78aSmrgdnl DEALINGS IN THE SOFTWARE.
1606d1333322Smrg
1607d1333322Smrg# XORG_MACROS_VERSION(required-version)
1608d1333322Smrg# -------------------------------------
1609d1333322Smrg# Minimum version: 1.1.0
1610d1333322Smrg#
1611d1333322Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1612d1333322Smrg# your configure.ac with the minimum required version, such as:
1613d1333322Smrg# XORG_MACROS_VERSION(1.1)
1614d1333322Smrg#
16154f9ac78aSmrg# To ensure that this macro is defined, also add:
16164f9ac78aSmrg# m4_ifndef([XORG_MACROS_VERSION],
16174f9ac78aSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1618d1333322Smrg#
1619d1333322Smrg#
162069ef5f27Smrg# See the "minimum version" comment for each macro you use to see what
1621d1333322Smrg# version you require.
16224f9ac78aSmrgm4_defun([XORG_MACROS_VERSION],[
1623742aa962Smrgm4_define([vers_have], [1.20.2])
16244f9ac78aSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
16254f9ac78aSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
16264f9ac78aSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
16274f9ac78aSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
16284f9ac78aSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
16294f9ac78aSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
16304f9ac78aSmrgm4_undefine([vers_have])
16314f9ac78aSmrgm4_undefine([maj_have])
16324f9ac78aSmrgm4_undefine([maj_needed])
1633d1333322Smrg]) # XORG_MACROS_VERSION
1634d1333322Smrg
1635d1333322Smrg# XORG_PROG_RAWCPP()
1636d1333322Smrg# ------------------
1637d1333322Smrg# Minimum version: 1.0.0
1638d1333322Smrg#
1639d1333322Smrg# Find cpp program and necessary flags for use in pre-processing text files
1640d1333322Smrg# such as man pages and config files
1641d1333322SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1642d1333322SmrgAC_REQUIRE([AC_PROG_CPP])
1643d04472e1SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1644d1333322Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1645d1333322Smrg
1646d1333322Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1647d1333322Smrg# which is not the best choice for supporting other OS'es, but covers most
1648d1333322Smrg# of the ones we need for now.
1649d1333322SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1650c27291ebSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1651d1333322Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1652d1333322Smrg	AC_MSG_RESULT([no])
1653d1333322Smrgelse
1654d1333322Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1655d1333322Smrg		RAWCPPFLAGS=-undef
1656d1333322Smrg		AC_MSG_RESULT([yes])
16574f9ac78aSmrg	# under Cygwin unix is still defined even with -undef
16584f9ac78aSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
16594f9ac78aSmrg		RAWCPPFLAGS="-undef -ansi"
16604f9ac78aSmrg		AC_MSG_RESULT([yes, with -ansi])
1661d1333322Smrg	else
1662d1333322Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1663d1333322Smrg	fi
1664d1333322Smrgfi
1665d1333322Smrgrm -f conftest.$ac_ext
1666d1333322Smrg
1667d1333322SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1668c27291ebSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1669742aa962Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1670d1333322Smrg	AC_MSG_RESULT([no])
1671d1333322Smrgelse
1672742aa962Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
167369ef5f27Smrg		TRADITIONALCPPFLAGS="-traditional"
1674d1333322Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1675d1333322Smrg		AC_MSG_RESULT([yes])
1676d1333322Smrg	else
1677d1333322Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1678d1333322Smrg	fi
1679d1333322Smrgfi
1680d1333322Smrgrm -f conftest.$ac_ext
1681d1333322SmrgAC_SUBST(RAWCPPFLAGS)
168269ef5f27SmrgAC_SUBST(TRADITIONALCPPFLAGS)
1683d1333322Smrg]) # XORG_PROG_RAWCPP
1684d1333322Smrg
1685d1333322Smrg# XORG_MANPAGE_SECTIONS()
1686d1333322Smrg# -----------------------
1687d1333322Smrg# Minimum version: 1.0.0
1688d1333322Smrg#
1689d1333322Smrg# Determine which sections man pages go in for the different man page types
1690d1333322Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1691d1333322Smrg# Not sure if there's any better way than just hardcoding by OS name.
1692d1333322Smrg# Override default settings by setting environment variables
16934f9ac78aSmrg# Added MAN_SUBSTS in version 1.8
16944f9ac78aSmrg# Added AC_PROG_SED in version 1.8
1695d1333322Smrg
1696d1333322SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1697d1333322SmrgAC_REQUIRE([AC_CANONICAL_HOST])
16984f9ac78aSmrgAC_REQUIRE([AC_PROG_SED])
1699d1333322Smrg
1700d04472e1Smrgcase $host_os in
1701d04472e1Smrg    solaris*)
1702d04472e1Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1703d04472e1Smrg        # check for a man page file found in later versions that use
1704d04472e1Smrg        # traditional section numbers instead
1705d04472e1Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1706d04472e1Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1707d04472e1Smrg        ;;
1708d04472e1Smrg    *) SYSV_MAN_SECTIONS=false ;;
1709d04472e1Smrgesac
1710d04472e1Smrg
1711d1333322Smrgif test x$APP_MAN_SUFFIX = x    ; then
1712d1333322Smrg    APP_MAN_SUFFIX=1
1713d1333322Smrgfi
1714d1333322Smrgif test x$APP_MAN_DIR = x    ; then
1715d1333322Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1716d1333322Smrgfi
1717d1333322Smrg
1718d1333322Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1719d1333322Smrg    LIB_MAN_SUFFIX=3
1720d1333322Smrgfi
1721d1333322Smrgif test x$LIB_MAN_DIR = x    ; then
1722d1333322Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1723d1333322Smrgfi
1724d1333322Smrg
1725d1333322Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1726d04472e1Smrg    case $SYSV_MAN_SECTIONS in
1727d04472e1Smrg	true)				FILE_MAN_SUFFIX=4  ;;
1728d04472e1Smrg	*)				FILE_MAN_SUFFIX=5  ;;
1729d1333322Smrg    esac
1730d1333322Smrgfi
1731d1333322Smrgif test x$FILE_MAN_DIR = x    ; then
1732d1333322Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1733d1333322Smrgfi
1734d1333322Smrg
1735d1333322Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1736d04472e1Smrg    case $SYSV_MAN_SECTIONS in
1737d04472e1Smrg	true)				MISC_MAN_SUFFIX=5  ;;
1738d04472e1Smrg	*)				MISC_MAN_SUFFIX=7  ;;
1739d1333322Smrg    esac
1740d1333322Smrgfi
1741d1333322Smrgif test x$MISC_MAN_DIR = x    ; then
1742d1333322Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1743d1333322Smrgfi
1744d1333322Smrg
1745d1333322Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1746d04472e1Smrg    case $SYSV_MAN_SECTIONS in
1747d04472e1Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1748d04472e1Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1749d1333322Smrg    esac
1750d1333322Smrgfi
1751d1333322Smrgif test x$DRIVER_MAN_DIR = x    ; then
1752d1333322Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1753d1333322Smrgfi
1754d1333322Smrg
1755d1333322Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1756d04472e1Smrg    case $SYSV_MAN_SECTIONS in
1757d04472e1Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1758d04472e1Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
1759d1333322Smrg    esac
1760d1333322Smrgfi
1761d1333322Smrgif test x$ADMIN_MAN_DIR = x    ; then
1762d1333322Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1763d1333322Smrgfi
1764d1333322Smrg
1765d1333322Smrg
1766d1333322SmrgAC_SUBST([APP_MAN_SUFFIX])
1767d1333322SmrgAC_SUBST([LIB_MAN_SUFFIX])
1768d1333322SmrgAC_SUBST([FILE_MAN_SUFFIX])
1769d1333322SmrgAC_SUBST([MISC_MAN_SUFFIX])
1770d1333322SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1771d1333322SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1772d1333322SmrgAC_SUBST([APP_MAN_DIR])
1773d1333322SmrgAC_SUBST([LIB_MAN_DIR])
1774d1333322SmrgAC_SUBST([FILE_MAN_DIR])
1775d1333322SmrgAC_SUBST([MISC_MAN_DIR])
1776d1333322SmrgAC_SUBST([DRIVER_MAN_DIR])
1777d1333322SmrgAC_SUBST([ADMIN_MAN_DIR])
17784f9ac78aSmrg
17794f9ac78aSmrgXORG_MAN_PAGE="X Version 11"
17804f9ac78aSmrgAC_SUBST([XORG_MAN_PAGE])
17814f9ac78aSmrgMAN_SUBSTS="\
17824f9ac78aSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
17834f9ac78aSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
17844f9ac78aSmrg	-e 's|__xservername__|Xorg|g' \
17854f9ac78aSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
17864f9ac78aSmrg	-e 's|__projectroot__|\$(prefix)|g' \
17874f9ac78aSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
17884f9ac78aSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
17894f9ac78aSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
17904f9ac78aSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
17914f9ac78aSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
17924f9ac78aSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
17934f9ac78aSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
17944f9ac78aSmrgAC_SUBST([MAN_SUBSTS])
17954f9ac78aSmrg
1796d1333322Smrg]) # XORG_MANPAGE_SECTIONS
1797d1333322Smrg
17984f9ac78aSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
17994f9ac78aSmrg# ------------------------
18004f9ac78aSmrg# Minimum version: 1.7.0
18014f9ac78aSmrg#
18024f9ac78aSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
18034f9ac78aSmrg# provided by xorg-sgml-doctools, if installed.
18044f9ac78aSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
18054f9ac78aSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
18064f9ac78aSmrgXORG_SGML_PATH=
18074f9ac78aSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
18084f9ac78aSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
18094f9ac78aSmrg    [m4_ifval([$1],[:],
18104f9ac78aSmrg        [if test x"$cross_compiling" != x"yes" ; then
18114f9ac78aSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
18124f9ac78aSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
18134f9ac78aSmrg         fi])
18144f9ac78aSmrg    ])
18154f9ac78aSmrg
18164f9ac78aSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
18174f9ac78aSmrg# the path and the name of the doc stylesheet
18184f9ac78aSmrgif test "x$XORG_SGML_PATH" != "x" ; then
18194f9ac78aSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
18204f9ac78aSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
18214f9ac78aSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
18224f9ac78aSmrgelse
18234f9ac78aSmrg   AC_MSG_RESULT([no])
18244f9ac78aSmrgfi
18254f9ac78aSmrg
18264f9ac78aSmrgAC_SUBST(XORG_SGML_PATH)
18274f9ac78aSmrgAC_SUBST(STYLESHEET_SRCDIR)
18284f9ac78aSmrgAC_SUBST(XSL_STYLESHEET)
18294f9ac78aSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
18304f9ac78aSmrg]) # XORG_CHECK_SGML_DOCTOOLS
18314f9ac78aSmrg
1832d1333322Smrg# XORG_CHECK_LINUXDOC
1833d1333322Smrg# -------------------
1834d1333322Smrg# Minimum version: 1.0.0
1835d1333322Smrg#
1836d1333322Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1837d1333322Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1838d1333322Smrg# Whether or not the necessary tools and files are found can be checked
1839d1333322Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1840d1333322SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
18414f9ac78aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
18424f9ac78aSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1843d1333322Smrg
1844d1333322SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1845d1333322Smrg
18464f9ac78aSmrgAC_MSG_CHECKING([whether to build documentation])
1847d1333322Smrg
18484f9ac78aSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1849d1333322Smrg   BUILDDOC=yes
1850d1333322Smrgelse
1851d1333322Smrg   BUILDDOC=no
1852d1333322Smrgfi
1853d1333322Smrg
1854d1333322SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1855d1333322Smrg
1856d1333322SmrgAC_MSG_RESULT([$BUILDDOC])
1857d1333322Smrg
18584f9ac78aSmrgAC_MSG_CHECKING([whether to build pdf documentation])
1859d1333322Smrg
18604f9ac78aSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1861d1333322Smrg   BUILDPDFDOC=yes
1862d1333322Smrgelse
1863d1333322Smrg   BUILDPDFDOC=no
1864d1333322Smrgfi
1865d1333322Smrg
1866d1333322SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1867d1333322Smrg
1868d1333322SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1869d1333322Smrg
18704f9ac78aSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1871d1333322SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1872d1333322SmrgMAKE_PDF="$PS2PDF"
1873d1333322SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1874d1333322Smrg
1875d1333322SmrgAC_SUBST(MAKE_TEXT)
1876d1333322SmrgAC_SUBST(MAKE_PS)
1877d1333322SmrgAC_SUBST(MAKE_PDF)
1878d1333322SmrgAC_SUBST(MAKE_HTML)
1879d1333322Smrg]) # XORG_CHECK_LINUXDOC
1880d1333322Smrg
1881d1333322Smrg# XORG_CHECK_DOCBOOK
1882d1333322Smrg# -------------------
1883d1333322Smrg# Minimum version: 1.0.0
1884d1333322Smrg#
1885d1333322Smrg# Checks for the ability to build output formats from SGML DocBook source.
1886d1333322Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1887d1333322Smrg# indicates whether the necessary tools and files are found and, if set,
1888d1333322Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1889d1333322SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
18904f9ac78aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
18914f9ac78aSmrg
1892d1333322SmrgBUILDTXTDOC=no
1893d1333322SmrgBUILDPDFDOC=no
1894d1333322SmrgBUILDPSDOC=no
1895d1333322SmrgBUILDHTMLDOC=no
1896d1333322Smrg
1897d1333322SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1898d1333322SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1899d1333322SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1900d1333322SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1901d1333322Smrg
19024f9ac78aSmrgAC_MSG_CHECKING([whether to build text documentation])
19034f9ac78aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1904d1333322Smrg   test x$BUILD_TXTDOC != xno; then
1905d1333322Smrg	BUILDTXTDOC=yes
1906d1333322Smrgfi
1907d1333322SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1908d1333322SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1909d1333322Smrg
19104f9ac78aSmrgAC_MSG_CHECKING([whether to build PDF documentation])
19114f9ac78aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1912d1333322Smrg   test x$BUILD_PDFDOC != xno; then
1913d1333322Smrg	BUILDPDFDOC=yes
1914d1333322Smrgfi
1915d1333322SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1916d1333322SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1917d1333322Smrg
19184f9ac78aSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
19194f9ac78aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1920d1333322Smrg   test x$BUILD_PSDOC != xno; then
1921d1333322Smrg	BUILDPSDOC=yes
1922d1333322Smrgfi
1923d1333322SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1924d1333322SmrgAC_MSG_RESULT([$BUILDPSDOC])
1925d1333322Smrg
19264f9ac78aSmrgAC_MSG_CHECKING([whether to build HTML documentation])
19274f9ac78aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1928d1333322Smrg   test x$BUILD_HTMLDOC != xno; then
1929d1333322Smrg	BUILDHTMLDOC=yes
1930d1333322Smrgfi
1931d1333322SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1932d1333322SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1933d1333322Smrg
1934d1333322SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1935d1333322SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1936d1333322SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1937d1333322SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1938d1333322Smrg
1939d1333322SmrgAC_SUBST(MAKE_TEXT)
1940d1333322SmrgAC_SUBST(MAKE_PS)
1941d1333322SmrgAC_SUBST(MAKE_PDF)
1942d1333322SmrgAC_SUBST(MAKE_HTML)
1943d1333322Smrg]) # XORG_CHECK_DOCBOOK
1944d1333322Smrg
19454f9ac78aSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
19464f9ac78aSmrg# ----------------
19474f9ac78aSmrg# Minimum version: 1.5.0
19484f9ac78aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
19494f9ac78aSmrg#
19504f9ac78aSmrg# Documentation tools are not always available on all platforms and sometimes
19514f9ac78aSmrg# not at the appropriate level. This macro enables a module to test for the
19524f9ac78aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1953742aa962Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
19544f9ac78aSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
19554f9ac78aSmrg# --with-xmlto assumes 'auto'.
19564f9ac78aSmrg#
19574f9ac78aSmrg# Interface to module:
19584f9ac78aSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
19594f9ac78aSmrg# XMLTO:	returns the path of the xmlto program found
19604f9ac78aSmrg#		returns the path set by the user in the environment
19614f9ac78aSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
19624f9ac78aSmrg#		'no' user instructs the module not to use xmlto
19634f9ac78aSmrg#
19644f9ac78aSmrg# Added in version 1.10.0
19654f9ac78aSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
19664f9ac78aSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
19674f9ac78aSmrg#
19684f9ac78aSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
19694f9ac78aSmrg#
19704f9ac78aSmrgAC_DEFUN([XORG_WITH_XMLTO],[
19714f9ac78aSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
19724f9ac78aSmrgm4_define([_defopt], m4_default([$2], [auto]))
19734f9ac78aSmrgAC_ARG_WITH(xmlto,
19744f9ac78aSmrg	AS_HELP_STRING([--with-xmlto],
19754f9ac78aSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
19764f9ac78aSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
19774f9ac78aSmrgm4_undefine([_defopt])
19784f9ac78aSmrg
19794f9ac78aSmrgif test "x$use_xmlto" = x"auto"; then
19804f9ac78aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
19814f9ac78aSmrg   if test "x$XMLTO" = "x"; then
19824f9ac78aSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
19834f9ac78aSmrg	have_xmlto=no
19844f9ac78aSmrg   else
19854f9ac78aSmrg        have_xmlto=yes
19864f9ac78aSmrg   fi
19874f9ac78aSmrgelif test "x$use_xmlto" = x"yes" ; then
19884f9ac78aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
19894f9ac78aSmrg   if test "x$XMLTO" = "x"; then
19904f9ac78aSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
19914f9ac78aSmrg   fi
19924f9ac78aSmrg   have_xmlto=yes
19934f9ac78aSmrgelif test "x$use_xmlto" = x"no" ; then
19944f9ac78aSmrg   if test "x$XMLTO" != "x"; then
19954f9ac78aSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
19964f9ac78aSmrg   fi
19974f9ac78aSmrg   have_xmlto=no
19984f9ac78aSmrgelse
19994f9ac78aSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
20004f9ac78aSmrgfi
20014f9ac78aSmrg
20024f9ac78aSmrg# Test for a minimum version of xmlto, if provided.
20034f9ac78aSmrgm4_ifval([$1],
20044f9ac78aSmrg[if test "$have_xmlto" = yes; then
20054f9ac78aSmrg    # scrape the xmlto version
20064f9ac78aSmrg    AC_MSG_CHECKING([the xmlto version])
20074f9ac78aSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
20084f9ac78aSmrg    AC_MSG_RESULT([$xmlto_version])
20094f9ac78aSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
20104f9ac78aSmrg        [if test "x$use_xmlto" = xauto; then
20114f9ac78aSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
20124f9ac78aSmrg            have_xmlto=no
20134f9ac78aSmrg        else
20144f9ac78aSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
20154f9ac78aSmrg        fi])
20164f9ac78aSmrgfi])
20174f9ac78aSmrg
20184f9ac78aSmrg# Test for the ability of xmlto to generate a text target
2019d04472e1Smrg#
2020d04472e1Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
2021d04472e1Smrg# following test for empty XML docbook files.
2022d04472e1Smrg# For compatibility reasons use the following empty XML docbook file and if
2023d04472e1Smrg# it fails try it again with a non-empty XML file.
20244f9ac78aSmrghave_xmlto_text=no
20254f9ac78aSmrgcat > conftest.xml << "EOF"
20264f9ac78aSmrgEOF
20274f9ac78aSmrgAS_IF([test "$have_xmlto" = yes],
20284f9ac78aSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
20294f9ac78aSmrg             [have_xmlto_text=yes],
2030d04472e1Smrg             [# Try it again with a non-empty XML file.
2031d04472e1Smrg              cat > conftest.xml << "EOF"
2032d04472e1Smrg<x></x>
2033d04472e1SmrgEOF
2034d04472e1Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2035d04472e1Smrg                    [have_xmlto_text=yes],
2036d04472e1Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
20374f9ac78aSmrgrm -f conftest.xml
20384f9ac78aSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
20394f9ac78aSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
20404f9ac78aSmrg]) # XORG_WITH_XMLTO
20414f9ac78aSmrg
2042c27291ebSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
2043c27291ebSmrg# --------------------------------------------
2044c27291ebSmrg# Minimum version: 1.12.0
2045c27291ebSmrg# Minimum version for optional DEFAULT argument: 1.12.0
2046c27291ebSmrg#
2047c27291ebSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
2048c27291ebSmrg# XML-based language used for the transformation of XML documents.
2049c27291ebSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
2050c27291ebSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
2051c27291ebSmrg# The XSLT processor is often used as a standalone tool for transformations.
2052c27291ebSmrg# It should not be assumed that this tool is used only to work with documnetation.
2053c27291ebSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
2054c27291ebSmrg#
2055c27291ebSmrg# Interface to module:
2056c27291ebSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
2057c27291ebSmrg# XSLTPROC:	 returns the path of the xsltproc program found
2058c27291ebSmrg#		 returns the path set by the user in the environment
2059c27291ebSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
2060c27291ebSmrg#		  'no' user instructs the module not to use xsltproc
2061c27291ebSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
2062c27291ebSmrg#
2063c27291ebSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
2064c27291ebSmrg#
2065c27291ebSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
2066c27291ebSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
2067c27291ebSmrg# Preserves the interface, should it be implemented later
2068c27291ebSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
2069c27291ebSmrgm4_define([_defopt], m4_default([$2], [auto]))
2070c27291ebSmrgAC_ARG_WITH(xsltproc,
2071c27291ebSmrg	AS_HELP_STRING([--with-xsltproc],
2072c27291ebSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
2073c27291ebSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
2074c27291ebSmrgm4_undefine([_defopt])
2075c27291ebSmrg
2076c27291ebSmrgif test "x$use_xsltproc" = x"auto"; then
2077c27291ebSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
2078c27291ebSmrg   if test "x$XSLTPROC" = "x"; then
2079c27291ebSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
2080c27291ebSmrg	have_xsltproc=no
2081c27291ebSmrg   else
2082c27291ebSmrg        have_xsltproc=yes
2083c27291ebSmrg   fi
2084c27291ebSmrgelif test "x$use_xsltproc" = x"yes" ; then
2085c27291ebSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
2086c27291ebSmrg   if test "x$XSLTPROC" = "x"; then
2087c27291ebSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
2088c27291ebSmrg   fi
2089c27291ebSmrg   have_xsltproc=yes
2090c27291ebSmrgelif test "x$use_xsltproc" = x"no" ; then
2091c27291ebSmrg   if test "x$XSLTPROC" != "x"; then
2092c27291ebSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
2093c27291ebSmrg   fi
2094c27291ebSmrg   have_xsltproc=no
2095c27291ebSmrgelse
2096c27291ebSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
2097c27291ebSmrgfi
2098c27291ebSmrg
2099c27291ebSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
2100c27291ebSmrg]) # XORG_WITH_XSLTPROC
2101c27291ebSmrg
2102c27291ebSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
2103c27291ebSmrg# ----------------------------------------
2104c27291ebSmrg# Minimum version: 1.15.0
2105c27291ebSmrg#
2106c27291ebSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
2107c27291ebSmrg# scanning arbitrary text files, extracting information from those text files,
2108c27291ebSmrg# and printing reports based on that information.
2109c27291ebSmrg#
2110c27291ebSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
2111c27291ebSmrg#
2112c27291ebSmrg# Interface to module:
2113c27291ebSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
2114c27291ebSmrg# PERL:	     returns the path of the perl program found
2115c27291ebSmrg#	     returns the path set by the user in the environment
2116c27291ebSmrg# --with-perl: 'yes' user instructs the module to use perl
2117c27291ebSmrg#	       'no' user instructs the module not to use perl
2118c27291ebSmrg# have_perl: returns yes if perl found in PATH or no
2119c27291ebSmrg#
2120c27291ebSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
2121c27291ebSmrg#
2122c27291ebSmrgAC_DEFUN([XORG_WITH_PERL],[
2123c27291ebSmrgAC_ARG_VAR([PERL], [Path to perl command])
2124c27291ebSmrg# Preserves the interface, should it be implemented later
2125c27291ebSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
2126c27291ebSmrgm4_define([_defopt], m4_default([$2], [auto]))
2127c27291ebSmrgAC_ARG_WITH(perl,
2128c27291ebSmrg	AS_HELP_STRING([--with-perl],
2129c27291ebSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
2130c27291ebSmrg	   [use_perl=$withval], [use_perl=]_defopt)
2131c27291ebSmrgm4_undefine([_defopt])
2132c27291ebSmrg
2133c27291ebSmrgif test "x$use_perl" = x"auto"; then
2134c27291ebSmrg   AC_PATH_PROG([PERL], [perl])
2135c27291ebSmrg   if test "x$PERL" = "x"; then
2136c27291ebSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
2137c27291ebSmrg	have_perl=no
2138c27291ebSmrg   else
2139c27291ebSmrg        have_perl=yes
2140c27291ebSmrg   fi
2141c27291ebSmrgelif test "x$use_perl" = x"yes" ; then
2142c27291ebSmrg   AC_PATH_PROG([PERL], [perl])
2143c27291ebSmrg   if test "x$PERL" = "x"; then
2144c27291ebSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
2145c27291ebSmrg   fi
2146c27291ebSmrg   have_perl=yes
2147c27291ebSmrgelif test "x$use_perl" = x"no" ; then
2148c27291ebSmrg   if test "x$PERL" != "x"; then
2149c27291ebSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
2150c27291ebSmrg   fi
2151c27291ebSmrg   have_perl=no
2152c27291ebSmrgelse
2153c27291ebSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
2154c27291ebSmrgfi
2155c27291ebSmrg
2156c27291ebSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2157c27291ebSmrg]) # XORG_WITH_PERL
2158c27291ebSmrg
21594f9ac78aSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
21604f9ac78aSmrg# ----------------
21614f9ac78aSmrg# Minimum version: 1.5.0
21624f9ac78aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
21634f9ac78aSmrg#
21644f9ac78aSmrg# Documentation tools are not always available on all platforms and sometimes
21654f9ac78aSmrg# not at the appropriate level. This macro enables a module to test for the
21664f9ac78aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2167742aa962Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
21684f9ac78aSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
21694f9ac78aSmrg# --with-asciidoc assumes 'auto'.
21704f9ac78aSmrg#
21714f9ac78aSmrg# Interface to module:
21724f9ac78aSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
21734f9ac78aSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
21744f9ac78aSmrg#		 returns the path set by the user in the environment
21754f9ac78aSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
21764f9ac78aSmrg#		  'no' user instructs the module not to use asciidoc
21774f9ac78aSmrg#
21784f9ac78aSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
21794f9ac78aSmrg#
21804f9ac78aSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
21814f9ac78aSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
21824f9ac78aSmrgm4_define([_defopt], m4_default([$2], [auto]))
21834f9ac78aSmrgAC_ARG_WITH(asciidoc,
21844f9ac78aSmrg	AS_HELP_STRING([--with-asciidoc],
21854f9ac78aSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
21864f9ac78aSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
21874f9ac78aSmrgm4_undefine([_defopt])
21884f9ac78aSmrg
21894f9ac78aSmrgif test "x$use_asciidoc" = x"auto"; then
21904f9ac78aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
21914f9ac78aSmrg   if test "x$ASCIIDOC" = "x"; then
21924f9ac78aSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
21934f9ac78aSmrg	have_asciidoc=no
21944f9ac78aSmrg   else
21954f9ac78aSmrg        have_asciidoc=yes
21964f9ac78aSmrg   fi
21974f9ac78aSmrgelif test "x$use_asciidoc" = x"yes" ; then
21984f9ac78aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
21994f9ac78aSmrg   if test "x$ASCIIDOC" = "x"; then
22004f9ac78aSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
22014f9ac78aSmrg   fi
22024f9ac78aSmrg   have_asciidoc=yes
22034f9ac78aSmrgelif test "x$use_asciidoc" = x"no" ; then
22044f9ac78aSmrg   if test "x$ASCIIDOC" != "x"; then
22054f9ac78aSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
22064f9ac78aSmrg   fi
22074f9ac78aSmrg   have_asciidoc=no
22084f9ac78aSmrgelse
22094f9ac78aSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
22104f9ac78aSmrgfi
22114f9ac78aSmrgm4_ifval([$1],
22124f9ac78aSmrg[if test "$have_asciidoc" = yes; then
22134f9ac78aSmrg    # scrape the asciidoc version
22144f9ac78aSmrg    AC_MSG_CHECKING([the asciidoc version])
22154f9ac78aSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
22164f9ac78aSmrg    AC_MSG_RESULT([$asciidoc_version])
22174f9ac78aSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
22184f9ac78aSmrg        [if test "x$use_asciidoc" = xauto; then
22194f9ac78aSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
22204f9ac78aSmrg            have_asciidoc=no
22214f9ac78aSmrg        else
22224f9ac78aSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
22234f9ac78aSmrg        fi])
22244f9ac78aSmrgfi])
22254f9ac78aSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
22264f9ac78aSmrg]) # XORG_WITH_ASCIIDOC
22274f9ac78aSmrg
22284f9ac78aSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
222969ef5f27Smrg# -------------------------------------------
22304f9ac78aSmrg# Minimum version: 1.5.0
22314f9ac78aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
223269ef5f27Smrg# Minimum version for optional DOT checking: 1.18.0
22334f9ac78aSmrg#
22344f9ac78aSmrg# Documentation tools are not always available on all platforms and sometimes
22354f9ac78aSmrg# not at the appropriate level. This macro enables a module to test for the
22364f9ac78aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2237742aa962Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
22384f9ac78aSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
22394f9ac78aSmrg# --with-doxygen assumes 'auto'.
22404f9ac78aSmrg#
22414f9ac78aSmrg# Interface to module:
22424f9ac78aSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
22434f9ac78aSmrg# DOXYGEN:	 returns the path of the doxygen program found
22444f9ac78aSmrg#		 returns the path set by the user in the environment
22454f9ac78aSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
22464f9ac78aSmrg#		  'no' user instructs the module not to use doxygen
22474f9ac78aSmrg#
22484f9ac78aSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
22494f9ac78aSmrg#
22504f9ac78aSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
22514f9ac78aSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
225269ef5f27SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
22534f9ac78aSmrgm4_define([_defopt], m4_default([$2], [auto]))
22544f9ac78aSmrgAC_ARG_WITH(doxygen,
22554f9ac78aSmrg	AS_HELP_STRING([--with-doxygen],
22564f9ac78aSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
22574f9ac78aSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
22584f9ac78aSmrgm4_undefine([_defopt])
22594f9ac78aSmrg
22604f9ac78aSmrgif test "x$use_doxygen" = x"auto"; then
22614f9ac78aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
22624f9ac78aSmrg   if test "x$DOXYGEN" = "x"; then
22634f9ac78aSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
22644f9ac78aSmrg	have_doxygen=no
22654f9ac78aSmrg   else
22664f9ac78aSmrg        have_doxygen=yes
22674f9ac78aSmrg   fi
22684f9ac78aSmrgelif test "x$use_doxygen" = x"yes" ; then
22694f9ac78aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
22704f9ac78aSmrg   if test "x$DOXYGEN" = "x"; then
22714f9ac78aSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
22724f9ac78aSmrg   fi
22734f9ac78aSmrg   have_doxygen=yes
22744f9ac78aSmrgelif test "x$use_doxygen" = x"no" ; then
22754f9ac78aSmrg   if test "x$DOXYGEN" != "x"; then
22764f9ac78aSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
22774f9ac78aSmrg   fi
22784f9ac78aSmrg   have_doxygen=no
22794f9ac78aSmrgelse
22804f9ac78aSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
22814f9ac78aSmrgfi
22824f9ac78aSmrgm4_ifval([$1],
22834f9ac78aSmrg[if test "$have_doxygen" = yes; then
22844f9ac78aSmrg    # scrape the doxygen version
22854f9ac78aSmrg    AC_MSG_CHECKING([the doxygen version])
22864f9ac78aSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
22874f9ac78aSmrg    AC_MSG_RESULT([$doxygen_version])
22884f9ac78aSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
22894f9ac78aSmrg        [if test "x$use_doxygen" = xauto; then
22904f9ac78aSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
22914f9ac78aSmrg            have_doxygen=no
22924f9ac78aSmrg        else
22934f9ac78aSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
22944f9ac78aSmrg        fi])
22954f9ac78aSmrgfi])
229669ef5f27Smrg
229769ef5f27Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
229869ef5f27Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
229969ef5f27Smrgdnl 	HAVE_DOT = @HAVE_DOT@
230069ef5f27SmrgHAVE_DOT=no
230169ef5f27Smrgif test "x$have_doxygen" = "xyes"; then
230269ef5f27Smrg  AC_PATH_PROG([DOT], [dot])
230369ef5f27Smrg    if test "x$DOT" != "x"; then
230469ef5f27Smrg      HAVE_DOT=yes
230569ef5f27Smrg    fi
230669ef5f27Smrgfi
230769ef5f27Smrg
230869ef5f27SmrgAC_SUBST([HAVE_DOT])
230969ef5f27SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
23104f9ac78aSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
23114f9ac78aSmrg]) # XORG_WITH_DOXYGEN
23124f9ac78aSmrg
23134f9ac78aSmrg# XORG_WITH_GROFF([DEFAULT])
23144f9ac78aSmrg# ----------------
23154f9ac78aSmrg# Minimum version: 1.6.0
23164f9ac78aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
23174f9ac78aSmrg#
23184f9ac78aSmrg# Documentation tools are not always available on all platforms and sometimes
23194f9ac78aSmrg# not at the appropriate level. This macro enables a module to test for the
23204f9ac78aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2321742aa962Smrg# the --with-groff option, it allows maximum flexibility in making decisions
23224f9ac78aSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
23234f9ac78aSmrg# --with-groff assumes 'auto'.
23244f9ac78aSmrg#
23254f9ac78aSmrg# Interface to module:
23264f9ac78aSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
23274f9ac78aSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
23284f9ac78aSmrg# HAVE_GROFF_MS: the -ms macros package
23294f9ac78aSmrg# GROFF:	 returns the path of the groff program found
23304f9ac78aSmrg#		 returns the path set by the user in the environment
23314f9ac78aSmrg# --with-groff:	 'yes' user instructs the module to use groff
23324f9ac78aSmrg#		 'no' user instructs the module not to use groff
23334f9ac78aSmrg#
23344f9ac78aSmrg# Added in version 1.9.0:
23354f9ac78aSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
23364f9ac78aSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
23374f9ac78aSmrg#		   psselect from the psutils package.
23384f9ac78aSmrg#		   the ghostcript package. Refer to the grohtml man pages
23394f9ac78aSmrg#
23404f9ac78aSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
23414f9ac78aSmrg#
23424f9ac78aSmrg# OS and distros often splits groff in a basic and full package, the former
23434f9ac78aSmrg# having the groff program and the later having devices, fonts and macros
23444f9ac78aSmrg# Checking for the groff executable is not enough.
23454f9ac78aSmrg#
23464f9ac78aSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
23474f9ac78aSmrg# unset HAVE_GROFF or GROFF env variables.
23484f9ac78aSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
23494f9ac78aSmrg#
23504f9ac78aSmrgAC_DEFUN([XORG_WITH_GROFF],[
23514f9ac78aSmrgAC_ARG_VAR([GROFF], [Path to groff command])
23524f9ac78aSmrgm4_define([_defopt], m4_default([$1], [auto]))
23534f9ac78aSmrgAC_ARG_WITH(groff,
23544f9ac78aSmrg	AS_HELP_STRING([--with-groff],
23554f9ac78aSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
23564f9ac78aSmrg	   [use_groff=$withval], [use_groff=]_defopt)
23574f9ac78aSmrgm4_undefine([_defopt])
23584f9ac78aSmrg
23594f9ac78aSmrgif test "x$use_groff" = x"auto"; then
23604f9ac78aSmrg   AC_PATH_PROG([GROFF], [groff])
23614f9ac78aSmrg   if test "x$GROFF" = "x"; then
23624f9ac78aSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
23634f9ac78aSmrg	have_groff=no
23644f9ac78aSmrg   else
23654f9ac78aSmrg        have_groff=yes
23664f9ac78aSmrg   fi
23674f9ac78aSmrgelif test "x$use_groff" = x"yes" ; then
23684f9ac78aSmrg   AC_PATH_PROG([GROFF], [groff])
23694f9ac78aSmrg   if test "x$GROFF" = "x"; then
23704f9ac78aSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
23714f9ac78aSmrg   fi
23724f9ac78aSmrg   have_groff=yes
23734f9ac78aSmrgelif test "x$use_groff" = x"no" ; then
23744f9ac78aSmrg   if test "x$GROFF" != "x"; then
23754f9ac78aSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
23764f9ac78aSmrg   fi
23774f9ac78aSmrg   have_groff=no
23784f9ac78aSmrgelse
23794f9ac78aSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
23804f9ac78aSmrgfi
23814f9ac78aSmrg
23824f9ac78aSmrg# We have groff, test for the presence of the macro packages
23834f9ac78aSmrgif test "x$have_groff" = x"yes"; then
23844f9ac78aSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
23854f9ac78aSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
23864f9ac78aSmrg        groff_ms_works=yes
23874f9ac78aSmrg    else
23884f9ac78aSmrg        groff_ms_works=no
23894f9ac78aSmrg    fi
23904f9ac78aSmrg    AC_MSG_RESULT([$groff_ms_works])
23914f9ac78aSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
23924f9ac78aSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
23934f9ac78aSmrg        groff_mm_works=yes
23944f9ac78aSmrg    else
23954f9ac78aSmrg        groff_mm_works=no
23964f9ac78aSmrg    fi
23974f9ac78aSmrg    AC_MSG_RESULT([$groff_mm_works])
23984f9ac78aSmrgfi
23994f9ac78aSmrg
24004f9ac78aSmrg# We have groff, test for HTML dependencies, one command per package
24014f9ac78aSmrgif test "x$have_groff" = x"yes"; then
24024f9ac78aSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
24034f9ac78aSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
24044f9ac78aSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
24054f9ac78aSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
24064f9ac78aSmrg      have_groff_html=yes
24074f9ac78aSmrg   else
24084f9ac78aSmrg      have_groff_html=no
24094f9ac78aSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
24104f9ac78aSmrg   fi
24114f9ac78aSmrgfi
24124f9ac78aSmrg
24134f9ac78aSmrg# Set Automake conditionals for Makefiles
24144f9ac78aSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
24154f9ac78aSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
24164f9ac78aSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
24174f9ac78aSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
24184f9ac78aSmrg]) # XORG_WITH_GROFF
24194f9ac78aSmrg
2420c27291ebSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2421c27291ebSmrg# ---------------------------------------
24224f9ac78aSmrg# Minimum version: 1.6.0
24234f9ac78aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2424c27291ebSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
24254f9ac78aSmrg#
24264f9ac78aSmrg# Documentation tools are not always available on all platforms and sometimes
24274f9ac78aSmrg# not at the appropriate level. This macro enables a module to test for the
24284f9ac78aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2429742aa962Smrg# the --with-fop option, it allows maximum flexibility in making decisions
24304f9ac78aSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
24314f9ac78aSmrg# --with-fop assumes 'auto'.
24324f9ac78aSmrg#
24334f9ac78aSmrg# Interface to module:
24344f9ac78aSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
24354f9ac78aSmrg# FOP:	 	returns the path of the fop program found
24364f9ac78aSmrg#		returns the path set by the user in the environment
24374f9ac78aSmrg# --with-fop: 	'yes' user instructs the module to use fop
24384f9ac78aSmrg#		'no' user instructs the module not to use fop
24394f9ac78aSmrg#
24404f9ac78aSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
24414f9ac78aSmrg#
24424f9ac78aSmrgAC_DEFUN([XORG_WITH_FOP],[
24434f9ac78aSmrgAC_ARG_VAR([FOP], [Path to fop command])
2444c27291ebSmrgm4_define([_defopt], m4_default([$2], [auto]))
24454f9ac78aSmrgAC_ARG_WITH(fop,
24464f9ac78aSmrg	AS_HELP_STRING([--with-fop],
24474f9ac78aSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
24484f9ac78aSmrg	   [use_fop=$withval], [use_fop=]_defopt)
24494f9ac78aSmrgm4_undefine([_defopt])
24504f9ac78aSmrg
24514f9ac78aSmrgif test "x$use_fop" = x"auto"; then
24524f9ac78aSmrg   AC_PATH_PROG([FOP], [fop])
24534f9ac78aSmrg   if test "x$FOP" = "x"; then
24544f9ac78aSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
24554f9ac78aSmrg	have_fop=no
24564f9ac78aSmrg   else
24574f9ac78aSmrg        have_fop=yes
24584f9ac78aSmrg   fi
24594f9ac78aSmrgelif test "x$use_fop" = x"yes" ; then
24604f9ac78aSmrg   AC_PATH_PROG([FOP], [fop])
24614f9ac78aSmrg   if test "x$FOP" = "x"; then
24624f9ac78aSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
24634f9ac78aSmrg   fi
24644f9ac78aSmrg   have_fop=yes
24654f9ac78aSmrgelif test "x$use_fop" = x"no" ; then
24664f9ac78aSmrg   if test "x$FOP" != "x"; then
24674f9ac78aSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
24684f9ac78aSmrg   fi
24694f9ac78aSmrg   have_fop=no
24704f9ac78aSmrgelse
24714f9ac78aSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
24724f9ac78aSmrgfi
2473c27291ebSmrg
2474c27291ebSmrg# Test for a minimum version of fop, if provided.
2475c27291ebSmrgm4_ifval([$1],
2476c27291ebSmrg[if test "$have_fop" = yes; then
2477c27291ebSmrg    # scrape the fop version
2478c27291ebSmrg    AC_MSG_CHECKING([for fop minimum version])
2479c27291ebSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2480c27291ebSmrg    AC_MSG_RESULT([$fop_version])
2481c27291ebSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
2482c27291ebSmrg        [if test "x$use_fop" = xauto; then
2483c27291ebSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2484c27291ebSmrg            have_fop=no
2485c27291ebSmrg        else
2486c27291ebSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2487c27291ebSmrg        fi])
2488c27291ebSmrgfi])
24894f9ac78aSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
24904f9ac78aSmrg]) # XORG_WITH_FOP
24914f9ac78aSmrg
249269ef5f27Smrg# XORG_WITH_M4([MIN-VERSION])
249369ef5f27Smrg# ---------------------------
249469ef5f27Smrg# Minimum version: 1.19.0
249569ef5f27Smrg#
249669ef5f27Smrg# This macro attempts to locate an m4 macro processor which supports
249769ef5f27Smrg# -I option and is only useful for modules relying on M4 in order to
249869ef5f27Smrg# expand macros in source code files.
249969ef5f27Smrg#
250069ef5f27Smrg# Interface to module:
250169ef5f27Smrg# M4:	 	returns the path of the m4 program found
250269ef5f27Smrg#		returns the path set by the user in the environment
250369ef5f27Smrg#
250469ef5f27SmrgAC_DEFUN([XORG_WITH_M4], [
250569ef5f27SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
250669ef5f27Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
250769ef5f27Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
250869ef5f27Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
250969ef5f27Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
251069ef5f27Smrg   [$PATH:/usr/gnu/bin])])
251169ef5f27Smrg
251269ef5f27SmrgAC_SUBST([M4], [$ac_cv_path_M4])
251369ef5f27Smrg]) # XORG_WITH_M4
251469ef5f27Smrg
25154f9ac78aSmrg# XORG_WITH_PS2PDF([DEFAULT])
25164f9ac78aSmrg# ----------------
25174f9ac78aSmrg# Minimum version: 1.6.0
25184f9ac78aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
25194f9ac78aSmrg#
25204f9ac78aSmrg# Documentation tools are not always available on all platforms and sometimes
25214f9ac78aSmrg# not at the appropriate level. This macro enables a module to test for the
25224f9ac78aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2523742aa962Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
25244f9ac78aSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
25254f9ac78aSmrg# --with-ps2pdf assumes 'auto'.
25264f9ac78aSmrg#
25274f9ac78aSmrg# Interface to module:
25284f9ac78aSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
25294f9ac78aSmrg# PS2PDF:	returns the path of the ps2pdf program found
25304f9ac78aSmrg#		returns the path set by the user in the environment
25314f9ac78aSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
25324f9ac78aSmrg#		 'no' user instructs the module not to use ps2pdf
25334f9ac78aSmrg#
25344f9ac78aSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
25354f9ac78aSmrg#
25364f9ac78aSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
25374f9ac78aSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
25384f9ac78aSmrgm4_define([_defopt], m4_default([$1], [auto]))
25394f9ac78aSmrgAC_ARG_WITH(ps2pdf,
25404f9ac78aSmrg	AS_HELP_STRING([--with-ps2pdf],
25414f9ac78aSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
25424f9ac78aSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
25434f9ac78aSmrgm4_undefine([_defopt])
25444f9ac78aSmrg
25454f9ac78aSmrgif test "x$use_ps2pdf" = x"auto"; then
25464f9ac78aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
25474f9ac78aSmrg   if test "x$PS2PDF" = "x"; then
25484f9ac78aSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
25494f9ac78aSmrg	have_ps2pdf=no
25504f9ac78aSmrg   else
25514f9ac78aSmrg        have_ps2pdf=yes
25524f9ac78aSmrg   fi
25534f9ac78aSmrgelif test "x$use_ps2pdf" = x"yes" ; then
25544f9ac78aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
25554f9ac78aSmrg   if test "x$PS2PDF" = "x"; then
25564f9ac78aSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
25574f9ac78aSmrg   fi
25584f9ac78aSmrg   have_ps2pdf=yes
25594f9ac78aSmrgelif test "x$use_ps2pdf" = x"no" ; then
25604f9ac78aSmrg   if test "x$PS2PDF" != "x"; then
25614f9ac78aSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
25624f9ac78aSmrg   fi
25634f9ac78aSmrg   have_ps2pdf=no
25644f9ac78aSmrgelse
25654f9ac78aSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
25664f9ac78aSmrgfi
25674f9ac78aSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
25684f9ac78aSmrg]) # XORG_WITH_PS2PDF
25694f9ac78aSmrg
25704f9ac78aSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
25714f9ac78aSmrg# ----------------
25724f9ac78aSmrg# Minimum version: 1.6.0
25734f9ac78aSmrg#
25744f9ac78aSmrg# Documentation tools are not always available on all platforms and sometimes
25754f9ac78aSmrg# not at the appropriate level. This macro enables a builder to skip all
25764f9ac78aSmrg# documentation targets except traditional man pages.
25774f9ac78aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2578742aa962Smrg# maximum flexibility in controlling documentation building.
25794f9ac78aSmrg# Refer to:
25804f9ac78aSmrg# XORG_WITH_XMLTO         --with-xmlto
25814f9ac78aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
25824f9ac78aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
25834f9ac78aSmrg# XORG_WITH_FOP           --with-fop
25844f9ac78aSmrg# XORG_WITH_GROFF         --with-groff
25854f9ac78aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
25864f9ac78aSmrg#
25874f9ac78aSmrg# Interface to module:
25884f9ac78aSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
25894f9ac78aSmrg# --enable-docs: 'yes' user instructs the module to generate docs
25904f9ac78aSmrg#		 'no' user instructs the module not to generate docs
25914f9ac78aSmrg# parm1:	specify the default value, yes or no.
25924f9ac78aSmrg#
25934f9ac78aSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2594c27291ebSmrgm4_define([docs_default], m4_default([$1], [yes]))
25954f9ac78aSmrgAC_ARG_ENABLE(docs,
25964f9ac78aSmrg	AS_HELP_STRING([--enable-docs],
2597c27291ebSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2598c27291ebSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2599c27291ebSmrgm4_undefine([docs_default])
26004f9ac78aSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
26014f9ac78aSmrgAC_MSG_CHECKING([whether to build documentation])
26024f9ac78aSmrgAC_MSG_RESULT([$build_docs])
26034f9ac78aSmrg]) # XORG_ENABLE_DOCS
26044f9ac78aSmrg
26054f9ac78aSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
26064f9ac78aSmrg# ----------------
26074f9ac78aSmrg# Minimum version: 1.6.0
26084f9ac78aSmrg#
26094f9ac78aSmrg# This macro enables a builder to skip all developer documentation.
26104f9ac78aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2611742aa962Smrg# maximum flexibility in controlling documentation building.
26124f9ac78aSmrg# Refer to:
26134f9ac78aSmrg# XORG_WITH_XMLTO         --with-xmlto
26144f9ac78aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
26154f9ac78aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
26164f9ac78aSmrg# XORG_WITH_FOP           --with-fop
26174f9ac78aSmrg# XORG_WITH_GROFF         --with-groff
26184f9ac78aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
26194f9ac78aSmrg#
26204f9ac78aSmrg# Interface to module:
26214f9ac78aSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
26224f9ac78aSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
26234f9ac78aSmrg#			'no' user instructs the module not to generate developer docs
26244f9ac78aSmrg# parm1:		specify the default value, yes or no.
26254f9ac78aSmrg#
26264f9ac78aSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
26274f9ac78aSmrgm4_define([devel_default], m4_default([$1], [yes]))
26284f9ac78aSmrgAC_ARG_ENABLE(devel-docs,
26294f9ac78aSmrg	AS_HELP_STRING([--enable-devel-docs],
26304f9ac78aSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
26314f9ac78aSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
26324f9ac78aSmrgm4_undefine([devel_default])
26334f9ac78aSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
26344f9ac78aSmrgAC_MSG_CHECKING([whether to build developer documentation])
26354f9ac78aSmrgAC_MSG_RESULT([$build_devel_docs])
26364f9ac78aSmrg]) # XORG_ENABLE_DEVEL_DOCS
26374f9ac78aSmrg
26384f9ac78aSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
26394f9ac78aSmrg# ----------------
26404f9ac78aSmrg# Minimum version: 1.6.0
26414f9ac78aSmrg#
26424f9ac78aSmrg# This macro enables a builder to skip all functional specification targets.
26434f9ac78aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2644742aa962Smrg# maximum flexibility in controlling documentation building.
26454f9ac78aSmrg# Refer to:
26464f9ac78aSmrg# XORG_WITH_XMLTO         --with-xmlto
26474f9ac78aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
26484f9ac78aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
26494f9ac78aSmrg# XORG_WITH_FOP           --with-fop
26504f9ac78aSmrg# XORG_WITH_GROFF         --with-groff
26514f9ac78aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
26524f9ac78aSmrg#
26534f9ac78aSmrg# Interface to module:
26544f9ac78aSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
26554f9ac78aSmrg# --enable-specs:	'yes' user instructs the module to generate specs
26564f9ac78aSmrg#			'no' user instructs the module not to generate specs
26574f9ac78aSmrg# parm1:		specify the default value, yes or no.
26584f9ac78aSmrg#
26594f9ac78aSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
26604f9ac78aSmrgm4_define([spec_default], m4_default([$1], [yes]))
26614f9ac78aSmrgAC_ARG_ENABLE(specs,
26624f9ac78aSmrg	AS_HELP_STRING([--enable-specs],
26634f9ac78aSmrg	   [Enable building the specs (default: ]spec_default[)]),
26644f9ac78aSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
26654f9ac78aSmrgm4_undefine([spec_default])
26664f9ac78aSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
26674f9ac78aSmrgAC_MSG_CHECKING([whether to build functional specifications])
26684f9ac78aSmrgAC_MSG_RESULT([$build_specs])
26694f9ac78aSmrg]) # XORG_ENABLE_SPECS
26704f9ac78aSmrg
2671c27291ebSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2672c27291ebSmrg# ----------------------------------------------
2673c27291ebSmrg# Minimum version: 1.13.0
2674c27291ebSmrg#
2675c27291ebSmrg# This macro enables a builder to enable/disable unit testing
2676c27291ebSmrg# It makes no assumption about the test cases implementation
2677c27291ebSmrg# Test cases may or may not use Automake "Support for test suites"
2678c27291ebSmrg# They may or may not use the software utility library GLib
2679c27291ebSmrg#
2680c27291ebSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2681c27291ebSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2682c27291ebSmrg# The variable enable_unit_tests is used by other macros in this file.
2683c27291ebSmrg#
2684c27291ebSmrg# Interface to module:
2685c27291ebSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2686c27291ebSmrg# enable_unit_tests:    used in configure.ac for additional configuration
2687c27291ebSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2688c27291ebSmrg#			'no' user instructs the module not to build tests
2689c27291ebSmrg# parm1:		specify the default value, yes or no.
2690c27291ebSmrg#
2691c27291ebSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2692c27291ebSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2693c27291ebSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2694c27291ebSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2695c27291ebSmrgm4_define([_defopt], m4_default([$1], [auto]))
2696c27291ebSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2697c27291ebSmrg	[Enable building unit test cases (default: ]_defopt[)]),
2698c27291ebSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2699c27291ebSmrgm4_undefine([_defopt])
2700c27291ebSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2701c27291ebSmrgAC_MSG_CHECKING([whether to build unit test cases])
2702c27291ebSmrgAC_MSG_RESULT([$enable_unit_tests])
2703c27291ebSmrg]) # XORG_ENABLE_UNIT_TESTS
2704c27291ebSmrg
2705c27291ebSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2706c27291ebSmrg# ------------------------------------------------------
2707c27291ebSmrg# Minimum version: 1.17.0
2708c27291ebSmrg#
2709c27291ebSmrg# This macro enables a builder to enable/disable integration testing
2710c27291ebSmrg# It makes no assumption about the test cases' implementation
2711c27291ebSmrg# Test cases may or may not use Automake "Support for test suites"
2712c27291ebSmrg#
2713c27291ebSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2714c27291ebSmrg# usually requires less dependencies and may be built and run under less
2715c27291ebSmrg# stringent environments than integration tests.
2716c27291ebSmrg#
2717c27291ebSmrg# Interface to module:
2718c27291ebSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2719c27291ebSmrg# enable_integration_tests:   used in configure.ac for additional configuration
2720c27291ebSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2721c27291ebSmrg#                             'no' user instructs the module not to build tests
2722c27291ebSmrg# parm1:                      specify the default value, yes or no.
2723c27291ebSmrg#
2724c27291ebSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2725c27291ebSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2726c27291ebSmrgm4_define([_defopt], m4_default([$1], [auto]))
2727c27291ebSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2728c27291ebSmrg	[Enable building integration test cases (default: ]_defopt[)]),
2729c27291ebSmrg	[enable_integration_tests=$enableval],
2730c27291ebSmrg	[enable_integration_tests=]_defopt)
2731c27291ebSmrgm4_undefine([_defopt])
2732c27291ebSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2733c27291ebSmrg	[test "x$enable_integration_tests" != xno])
2734c27291ebSmrgAC_MSG_CHECKING([whether to build unit test cases])
2735c27291ebSmrgAC_MSG_RESULT([$enable_integration_tests])
2736c27291ebSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
2737c27291ebSmrg
2738c27291ebSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2739c27291ebSmrg# ----------------------------------------
2740c27291ebSmrg# Minimum version: 1.13.0
2741c27291ebSmrg#
2742c27291ebSmrg# GLib is a library which provides advanced data structures and functions.
2743c27291ebSmrg# This macro enables a module to test for the presence of Glib.
2744c27291ebSmrg#
2745c27291ebSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2746c27291ebSmrg# Otherwise the value of $enable_unit_tests is blank.
2747c27291ebSmrg#
2748c27291ebSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2749c27291ebSmrg# test support usually requires less dependencies and may be built and run under
2750c27291ebSmrg# less stringent environments than integration tests.
2751c27291ebSmrg#
2752c27291ebSmrg# Interface to module:
2753c27291ebSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
2754c27291ebSmrg# with_glib: used in configure.ac to know if GLib has been found
2755c27291ebSmrg# --with-glib:	'yes' user instructs the module to use glib
2756c27291ebSmrg#		'no' user instructs the module not to use glib
2757c27291ebSmrg#
2758c27291ebSmrgAC_DEFUN([XORG_WITH_GLIB],[
2759c27291ebSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2760c27291ebSmrgm4_define([_defopt], m4_default([$2], [auto]))
2761c27291ebSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2762c27291ebSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2763c27291ebSmrg	[with_glib=$withval], [with_glib=]_defopt)
2764c27291ebSmrgm4_undefine([_defopt])
2765c27291ebSmrg
2766c27291ebSmrghave_glib=no
2767c27291ebSmrg# Do not probe GLib if user explicitly disabled unit testing
2768c27291ebSmrgif test "x$enable_unit_tests" != x"no"; then
2769c27291ebSmrg  # Do not probe GLib if user explicitly disabled it
2770c27291ebSmrg  if test "x$with_glib" != x"no"; then
2771c27291ebSmrg    m4_ifval(
2772c27291ebSmrg      [$1],
2773c27291ebSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2774c27291ebSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2775c27291ebSmrg    )
2776c27291ebSmrg  fi
2777c27291ebSmrgfi
2778c27291ebSmrg
2779c27291ebSmrg# Not having GLib when unit testing has been explicitly requested is an error
2780c27291ebSmrgif test "x$enable_unit_tests" = x"yes"; then
2781c27291ebSmrg  if test "x$have_glib" = x"no"; then
2782c27291ebSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2783c27291ebSmrg  fi
2784c27291ebSmrgfi
2785c27291ebSmrg
2786c27291ebSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
2787c27291ebSmrgif test "x$enable_unit_tests" = x"no"; then
2788c27291ebSmrg  if test "x$with_glib" = x"yes"; then
2789c27291ebSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2790c27291ebSmrg  fi
2791c27291ebSmrgfi
2792c27291ebSmrg
2793c27291ebSmrg# Not having GLib when it has been explicitly requested is an error
2794c27291ebSmrgif test "x$with_glib" = x"yes"; then
2795c27291ebSmrg  if test "x$have_glib" = x"no"; then
2796c27291ebSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2797c27291ebSmrg  fi
2798c27291ebSmrgfi
2799c27291ebSmrg
2800c27291ebSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2801c27291ebSmrg]) # XORG_WITH_GLIB
2802c27291ebSmrg
2803c27291ebSmrg# XORG_LD_WRAP([required|optional])
2804c27291ebSmrg# ---------------------------------
2805c27291ebSmrg# Minimum version: 1.13.0
2806c27291ebSmrg#
2807c27291ebSmrg# Check if linker supports -wrap, passed via compiler flags
2808c27291ebSmrg#
2809c27291ebSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2810c27291ebSmrg# Otherwise the value of $enable_unit_tests is blank.
2811c27291ebSmrg#
2812c27291ebSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2813c27291ebSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2814c27291ebSmrg# available, an argument of "optional" allows use when some unit tests require
2815c27291ebSmrg# ld -wrap and others do not.
2816c27291ebSmrg#
2817c27291ebSmrgAC_DEFUN([XORG_LD_WRAP],[
2818c27291ebSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2819c27291ebSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2820c27291ebSmrg                      void __wrap_exit(int status) { return; }],
2821c27291ebSmrg                     [exit(0);])])
2822c27291ebSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
2823c27291ebSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2824c27291ebSmrg  if test "x$have_ld_wrap" = x"no"; then
2825c27291ebSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2826c27291ebSmrg  fi
2827c27291ebSmrgfi
2828c27291ebSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2829c27291ebSmrg#
2830c27291ebSmrg]) # XORG_LD_WRAP
2831c27291ebSmrg
2832c27291ebSmrg# XORG_CHECK_LINKER_FLAGS
2833c27291ebSmrg# -----------------------
2834c27291ebSmrg# SYNOPSIS
2835c27291ebSmrg#
2836c27291ebSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2837c27291ebSmrg#
2838c27291ebSmrg# DESCRIPTION
2839c27291ebSmrg#
2840c27291ebSmrg#   Check whether the given linker FLAGS work with the current language's
2841c27291ebSmrg#   linker, or whether they give an error.
2842c27291ebSmrg#
2843c27291ebSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2844c27291ebSmrg#   success/failure.
2845c27291ebSmrg#
2846c27291ebSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
2847c27291ebSmrg#
2848c27291ebSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2849c27291ebSmrg#
2850c27291ebSmrg# LICENSE
2851c27291ebSmrg#
2852c27291ebSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2853c27291ebSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2854c27291ebSmrg#   Copyright (c) 2009 Matteo Frigo
2855c27291ebSmrg#
2856c27291ebSmrg#   This program is free software: you can redistribute it and/or modify it
2857c27291ebSmrg#   under the terms of the GNU General Public License as published by the
2858c27291ebSmrg#   Free Software Foundation, either version 3 of the License, or (at your
2859c27291ebSmrg#   option) any later version.
2860c27291ebSmrg#
2861c27291ebSmrg#   This program is distributed in the hope that it will be useful, but
2862c27291ebSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2863c27291ebSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2864c27291ebSmrg#   Public License for more details.
2865c27291ebSmrg#
2866c27291ebSmrg#   You should have received a copy of the GNU General Public License along
2867c27291ebSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2868c27291ebSmrg#
2869c27291ebSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
2870c27291ebSmrg#   gives unlimited permission to copy, distribute and modify the configure
2871c27291ebSmrg#   scripts that are the output of Autoconf when processing the Macro. You
2872c27291ebSmrg#   need not follow the terms of the GNU General Public License when using
2873c27291ebSmrg#   or distributing such scripts, even though portions of the text of the
2874c27291ebSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2875c27291ebSmrg#   all other use of the material that constitutes the Autoconf Macro.
2876c27291ebSmrg#
2877c27291ebSmrg#   This special exception to the GPL applies to versions of the Autoconf
2878c27291ebSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
2879c27291ebSmrg#   modified version of the Autoconf Macro, you may extend this special
2880c27291ebSmrg#   exception to the GPL to apply to your modified version as well.#
2881c27291ebSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2882c27291ebSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
2883c27291ebSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2884c27291ebSmrgAS_LITERAL_IF([$1],
2885c27291ebSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2886c27291ebSmrg      ax_save_FLAGS=$LDFLAGS
2887c27291ebSmrg      LDFLAGS="$1"
2888c27291ebSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2889c27291ebSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2890c27291ebSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2891c27291ebSmrg      LDFLAGS=$ax_save_FLAGS])],
2892c27291ebSmrg  [ax_save_FLAGS=$LDFLAGS
2893c27291ebSmrg   LDFLAGS="$1"
2894c27291ebSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2895c27291ebSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2896c27291ebSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2897c27291ebSmrg   LDFLAGS=$ax_save_FLAGS])
2898c27291ebSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2899c27291ebSmrgAC_MSG_RESULT($xorg_check_linker_flags)
2900c27291ebSmrgif test "x$xorg_check_linker_flags" = xyes; then
2901c27291ebSmrg	m4_default([$2], :)
2902c27291ebSmrgelse
2903c27291ebSmrg	m4_default([$3], :)
2904c27291ebSmrgfi
2905c27291ebSmrg]) # XORG_CHECK_LINKER_FLAGS
2906c27291ebSmrg
2907c27291ebSmrg# XORG_MEMORY_CHECK_FLAGS
2908c27291ebSmrg# -----------------------
2909c27291ebSmrg# Minimum version: 1.16.0
2910c27291ebSmrg#
2911c27291ebSmrg# This macro attempts to find appropriate memory checking functionality
2912c27291ebSmrg# for various platforms which unit testing code may use to catch various
2913c27291ebSmrg# forms of memory allocation and access errors in testing.
2914c27291ebSmrg#
2915c27291ebSmrg# Interface to module:
2916c27291ebSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2917c27291ebSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2918c27291ebSmrg#
2919c27291ebSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2920c27291ebSmrg#
2921c27291ebSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2922c27291ebSmrg
2923c27291ebSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2924c27291ebSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2925c27291ebSmrg           [Environment variables to enable memory checking in tests])
2926c27291ebSmrg
2927c27291ebSmrg# Check for different types of support on different platforms
2928c27291ebSmrgcase $host_os in
2929c27291ebSmrg    solaris*)
2930c27291ebSmrg        AC_CHECK_LIB([umem], [umem_alloc],
2931c27291ebSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2932c27291ebSmrg        ;;
2933c27291ebSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2934c27291ebSmrg        # both directly and inverted, so should not be 0 or 255.
2935c27291ebSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
2936c27291ebSmrg        ;;
2937c27291ebSmrg    darwin*)
2938c27291ebSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2939c27291ebSmrg        ;;
2940c27291ebSmrg    *bsd*)
2941c27291ebSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2942c27291ebSmrg        ;;
2943c27291ebSmrgesac
2944c27291ebSmrg
2945c27291ebSmrg# User supplied flags override default flags
2946c27291ebSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2947c27291ebSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2948c27291ebSmrgfi
2949c27291ebSmrg
2950c27291ebSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2951c27291ebSmrg]) # XORG_WITH_LINT
2952c27291ebSmrg
2953d1333322Smrg# XORG_CHECK_MALLOC_ZERO
2954d1333322Smrg# ----------------------
2955d1333322Smrg# Minimum version: 1.0.0
2956d1333322Smrg#
2957d1333322Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2958d1333322Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2959d1333322Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2960742aa962Smrg#
2961742aa962Smrg# No longer actually tests since there is no guarantee applications will
2962742aa962Smrg# run with the same malloc implementation we tested against, and the cost
2963742aa962Smrg# of always ensuring the size passed to malloc is non-zero is minimal now.
2964742aa962Smrg# Still allows builders to override when they have complete control over
2965742aa962Smrg# which malloc implementation will be used.
2966d1333322SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2967d1333322SmrgAC_ARG_ENABLE(malloc0returnsnull,
29684f9ac78aSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2969742aa962Smrg		       [assume malloc(0) can return NULL (default: yes)]),
2970d1333322Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2971742aa962Smrg	[MALLOC_ZERO_RETURNS_NULL=yes])
2972742aa962Smrg
2973742aa962SmrgAC_MSG_CHECKING([whether to act as if malloc(0) can return NULL])
2974d1333322SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2975d1333322Smrg
2976d1333322Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2977d1333322Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2978d1333322Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2979d1333322Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2980d1333322Smrgelse
2981d1333322Smrg	MALLOC_ZERO_CFLAGS=""
2982d1333322Smrg	XMALLOC_ZERO_CFLAGS=""
2983d1333322Smrg	XTMALLOC_ZERO_CFLAGS=""
2984d1333322Smrgfi
2985d1333322Smrg
2986d1333322SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2987d1333322SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2988d1333322SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2989d1333322Smrg]) # XORG_CHECK_MALLOC_ZERO
2990d1333322Smrg
2991d1333322Smrg# XORG_WITH_LINT()
2992d1333322Smrg# ----------------
2993d1333322Smrg# Minimum version: 1.1.0
2994d1333322Smrg#
29954f9ac78aSmrg# This macro enables the use of a tool that flags some suspicious and
29964f9ac78aSmrg# non-portable constructs (likely to be bugs) in C language source code.
29974f9ac78aSmrg# It will attempt to locate the tool and use appropriate options.
29984f9ac78aSmrg# There are various lint type tools on different platforms.
29994f9ac78aSmrg#
30004f9ac78aSmrg# Interface to module:
30014f9ac78aSmrg# LINT:		returns the path to the tool found on the platform
30024f9ac78aSmrg#		or the value set to LINT on the configure cmd line
30034f9ac78aSmrg#		also an Automake conditional
30044f9ac78aSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
30054f9ac78aSmrg#
30064f9ac78aSmrg# --with-lint:	'yes' user instructs the module to use lint
30074f9ac78aSmrg#		'no' user instructs the module not to use lint (default)
30084f9ac78aSmrg#
30094f9ac78aSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
30104f9ac78aSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
3011d1333322Smrg#
3012d1333322SmrgAC_DEFUN([XORG_WITH_LINT],[
3013d1333322Smrg
30144f9ac78aSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
30154f9ac78aSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
30164f9ac78aSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
3017d1333322Smrg		[Use a lint-style source code checker (default: disabled)])],
3018d1333322Smrg		[use_lint=$withval], [use_lint=no])
30194f9ac78aSmrg
30204f9ac78aSmrg# Obtain platform specific info like program name and options
30214f9ac78aSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
30224f9ac78aSmrgcase $host_os in
30234f9ac78aSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
30244f9ac78aSmrg	lint_name=splint
30254f9ac78aSmrg	lint_options="-badflag"
30264f9ac78aSmrg	;;
30274f9ac78aSmrg  *freebsd* | *netbsd*)
30284f9ac78aSmrg	lint_name=lint
30294f9ac78aSmrg	lint_options="-u -b"
30304f9ac78aSmrg	;;
30314f9ac78aSmrg  *solaris*)
30324f9ac78aSmrg	lint_name=lint
30334f9ac78aSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
30344f9ac78aSmrg	;;
30354f9ac78aSmrgesac
30364f9ac78aSmrg
30374f9ac78aSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
30384f9ac78aSmrgif test "x$use_lint" = x"yes" ; then
30394f9ac78aSmrg   AC_PATH_PROG([LINT], [$lint_name])
30404f9ac78aSmrg   if test "x$LINT" = "x"; then
30414f9ac78aSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
30424f9ac78aSmrg   fi
30434f9ac78aSmrgelif test "x$use_lint" = x"no" ; then
30444f9ac78aSmrg   if test "x$LINT" != "x"; then
30454f9ac78aSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
30464f9ac78aSmrg   fi
3047d1333322Smrgelse
30484f9ac78aSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
3049d1333322Smrgfi
30504f9ac78aSmrg
30514f9ac78aSmrg# User supplied flags override default flags
30524f9ac78aSmrgif test "x$LINT_FLAGS" != "x"; then
30534f9ac78aSmrg   lint_options=$LINT_FLAGS
3054d1333322Smrgfi
3055d1333322Smrg
30564f9ac78aSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
30574f9ac78aSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
3058d1333322Smrg
3059d1333322Smrg]) # XORG_WITH_LINT
3060d1333322Smrg
3061d1333322Smrg# XORG_LINT_LIBRARY(LIBNAME)
3062d1333322Smrg# --------------------------
3063d1333322Smrg# Minimum version: 1.1.0
3064d1333322Smrg#
3065d1333322Smrg# Sets up flags for building lint libraries for checking programs that call
3066d1333322Smrg# functions in the library.
3067d1333322Smrg#
30684f9ac78aSmrg# Interface to module:
30694f9ac78aSmrg# LINTLIB		- Automake variable with the name of lint library file to make
30704f9ac78aSmrg# MAKE_LINT_LIB		- Automake conditional
30714f9ac78aSmrg#
30724f9ac78aSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
30734f9ac78aSmrg#			  - 'no' user instructs the module not to create a lint library (default)
3074d1333322Smrg
3075d1333322SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
3076d1333322SmrgAC_REQUIRE([XORG_WITH_LINT])
30774f9ac78aSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
3078d1333322Smrg	[Create lint library (default: disabled)])],
3079d1333322Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
30804f9ac78aSmrg
30814f9ac78aSmrgif test "x$make_lint_lib" = x"yes" ; then
30824f9ac78aSmrg   LINTLIB=llib-l$1.ln
30834f9ac78aSmrg   if test "x$LINT" = "x"; then
30844f9ac78aSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
30854f9ac78aSmrg   fi
30864f9ac78aSmrgelif test "x$make_lint_lib" != x"no" ; then
30874f9ac78aSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
3088d1333322Smrgfi
30894f9ac78aSmrg
3090d1333322SmrgAC_SUBST(LINTLIB)
3091d1333322SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
3092d1333322Smrg
3093d1333322Smrg]) # XORG_LINT_LIBRARY
3094d1333322Smrg
3095c27291ebSmrg# XORG_COMPILER_BRAND
3096c27291ebSmrg# -------------------
3097c27291ebSmrg# Minimum version: 1.14.0
3098c27291ebSmrg#
3099c27291ebSmrg# Checks for various brands of compilers and sets flags as appropriate:
3100c27291ebSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
3101c27291ebSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
3102c27291ebSmrg#   clang compiler - sets CLANGCC to "yes"
3103c27291ebSmrg#   Intel compiler - sets INTELCC to "yes"
3104c27291ebSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
3105c27291ebSmrg#
3106c27291ebSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
3107c27291ebSmrgAC_LANG_CASE(
3108c27291ebSmrg	[C], [
3109742aa962Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
3110742aa962Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3111742aa962Smrg		m4_version_prereq([2.70],
3112742aa962Smrg			[AC_REQUIRE([AC_PROG_CC])],
3113742aa962Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3114c27291ebSmrg	],
3115c27291ebSmrg	[C++], [
3116c27291ebSmrg		AC_REQUIRE([AC_PROG_CXX])
3117c27291ebSmrg	]
3118c27291ebSmrg)
3119c27291ebSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
3120c27291ebSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
3121c27291ebSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
3122c27291ebSmrg]) # XORG_COMPILER_BRAND
3123c27291ebSmrg
3124c27291ebSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
3125c27291ebSmrg# ---------------
3126c27291ebSmrg# Minimum version: 1.16.0
3127c27291ebSmrg#
3128c27291ebSmrg# Test if the compiler works when passed the given flag as a command line argument.
3129742aa962Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
3130c27291ebSmrg# next flag in the list until there are no more options.
3131c27291ebSmrg#
3132c27291ebSmrg# Note that this does not guarantee that the compiler supports the flag as some
3133c27291ebSmrg# compilers will simply ignore arguments that they do not understand, but we do
3134c27291ebSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
3135c27291ebSmrg# -Werror=unused-command-line-argument
3136c27291ebSmrg#
3137c27291ebSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
3138c27291ebSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3139c27291ebSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3140c27291ebSmrg
3141c27291ebSmrgAC_LANG_COMPILER_REQUIRE
3142c27291ebSmrg
3143c27291ebSmrgAC_LANG_CASE(
3144c27291ebSmrg	[C], [
3145742aa962Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
3146742aa962Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3147742aa962Smrg		m4_version_prereq([2.70],
3148742aa962Smrg			[AC_REQUIRE([AC_PROG_CC])],
3149742aa962Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3150c27291ebSmrg		define([PREFIX], [C])
3151c27291ebSmrg		define([CACHE_PREFIX], [cc])
3152c27291ebSmrg		define([COMPILER], [$CC])
3153c27291ebSmrg	],
3154c27291ebSmrg	[C++], [
3155c27291ebSmrg		define([PREFIX], [CXX])
3156c27291ebSmrg		define([CACHE_PREFIX], [cxx])
3157c27291ebSmrg		define([COMPILER], [$CXX])
3158c27291ebSmrg	]
3159c27291ebSmrg)
3160c27291ebSmrg
3161c27291ebSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
3162c27291ebSmrg
3163c27291ebSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
3164c27291ebSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3165c27291ebSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
3166c27291ebSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3167c27291ebSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3168c27291ebSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
3169c27291ebSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
3170c27291ebSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
3171c27291ebSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3172c27291ebSmrgfi
3173c27291ebSmrg
3174c27291ebSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
3175c27291ebSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
3176c27291ebSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3177c27291ebSmrg	fi
3178c27291ebSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3179c27291ebSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
3180c27291ebSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3181c27291ebSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3182c27291ebSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
3183c27291ebSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
3184c27291ebSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
3185c27291ebSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3186c27291ebSmrgfi
3187c27291ebSmrg
3188c27291ebSmrgfound="no"
3189c27291ebSmrgm4_foreach([flag], m4_cdr($@), [
3190c27291ebSmrg	if test $found = "no" ; then
319169ef5f27Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
3192c27291ebSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3193c27291ebSmrg		fi
3194c27291ebSmrg
319569ef5f27Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
3196c27291ebSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3197c27291ebSmrg		fi
3198c27291ebSmrg
3199c27291ebSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
3200c27291ebSmrg
3201c27291ebSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
3202c27291ebSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
3203c27291ebSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
3204c27291ebSmrg		AC_CACHE_VAL($cacheid,
3205c27291ebSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3206c27291ebSmrg					     [eval $cacheid=yes],
3207c27291ebSmrg					     [eval $cacheid=no])])
3208c27291ebSmrg
3209c27291ebSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3210c27291ebSmrg
3211c27291ebSmrg		eval supported=\$$cacheid
3212c27291ebSmrg		AC_MSG_RESULT([$supported])
3213c27291ebSmrg		if test "$supported" = "yes" ; then
3214c27291ebSmrg			$1="$$1 ]flag["
3215c27291ebSmrg			found="yes"
3216c27291ebSmrg		fi
3217c27291ebSmrg	fi
3218c27291ebSmrg])
3219c27291ebSmrg]) # XORG_TESTSET_CFLAG
3220c27291ebSmrg
3221c27291ebSmrg# XORG_COMPILER_FLAGS
3222c27291ebSmrg# ---------------
3223c27291ebSmrg# Minimum version: 1.16.0
3224c27291ebSmrg#
3225c27291ebSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
3226c27291ebSmrg# arguments supported by the selected compiler which do NOT alter the generated
3227c27291ebSmrg# code.  These arguments will cause the compiler to print various warnings
3228c27291ebSmrg# during compilation AND turn a conservative set of warnings into errors.
3229c27291ebSmrg#
3230c27291ebSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
3231c27291ebSmrg# future versions of util-macros as options are added to new compilers.
3232c27291ebSmrg#
3233c27291ebSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
3234c27291ebSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3235c27291ebSmrg
3236c27291ebSmrgAC_ARG_ENABLE(selective-werror,
3237c27291ebSmrg              AS_HELP_STRING([--disable-selective-werror],
3238c27291ebSmrg                             [Turn off selective compiler errors. (default: enabled)]),
3239c27291ebSmrg              [SELECTIVE_WERROR=$enableval],
3240c27291ebSmrg              [SELECTIVE_WERROR=yes])
3241c27291ebSmrg
3242c27291ebSmrgAC_LANG_CASE(
3243c27291ebSmrg        [C], [
3244c27291ebSmrg                define([PREFIX], [C])
3245c27291ebSmrg        ],
3246c27291ebSmrg        [C++], [
3247c27291ebSmrg                define([PREFIX], [CXX])
3248c27291ebSmrg        ]
3249c27291ebSmrg)
3250c27291ebSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
3251c27291ebSmrgif test "x$SUNCC" = "xyes"; then
3252c27291ebSmrg    [BASE_]PREFIX[FLAGS]="-v"
3253c27291ebSmrgelse
3254c27291ebSmrg    [BASE_]PREFIX[FLAGS]=""
3255c27291ebSmrgfi
3256c27291ebSmrg
3257c27291ebSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3258c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
3259c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
3260c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
3261c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3262c27291ebSmrg
3263c27291ebSmrgAC_LANG_CASE(
3264c27291ebSmrg	[C], [
3265c27291ebSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
3266c27291ebSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
3267c27291ebSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
3268c27291ebSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
326969ef5f27Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
3270c27291ebSmrg	]
3271c27291ebSmrg)
3272c27291ebSmrg
3273c27291ebSmrg# This chunk adds additional warnings that could catch undesired effects.
3274c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
3275c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
3276c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
3277c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
3278c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
3279c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
328069ef5f27SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3281c27291ebSmrg
3282c27291ebSmrg# These are currently disabled because they are noisy.  They will be enabled
3283c27291ebSmrg# in the future once the codebase is sufficiently modernized to silence
3284c27291ebSmrg# them.  For now, I don't want them to drown out the other warnings.
3285c27291ebSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3286c27291ebSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
328769ef5f27Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3288c27291ebSmrg
3289742aa962Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
3290c27291ebSmrg# when there are problems that should be fixed.
3291c27291ebSmrg
3292c27291ebSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3293c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3294c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3295c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3296c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3297c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3298c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3299c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3300c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3301c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3302c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3303c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3304c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3305c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3306c27291ebSmrgelse
3307c27291ebSmrgAC_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])
3308c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3309c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3310c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3311c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3312c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3313c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3314c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3315c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3316c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3317c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3318c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3319c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3320c27291ebSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3321c27291ebSmrgfi
3322c27291ebSmrg
3323c27291ebSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3324c27291ebSmrg]) # XORG_COMPILER_FLAGS
3325c27291ebSmrg
33264f9ac78aSmrg# XORG_CWARNFLAGS
33274f9ac78aSmrg# ---------------
33284f9ac78aSmrg# Minimum version: 1.2.0
3329c27291ebSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
33304f9ac78aSmrg#
33314f9ac78aSmrg# Defines CWARNFLAGS to enable C compiler warnings.
33324f9ac78aSmrg#
3333c27291ebSmrg# This function is deprecated because it defines -fno-strict-aliasing
3334c27291ebSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3335c27291ebSmrg# is needed, then it should be added explicitly in the module when
3336c27291ebSmrg# it is updated to use BASE_CFLAGS.
3337c27291ebSmrg#
33384f9ac78aSmrgAC_DEFUN([XORG_CWARNFLAGS], [
3339c27291ebSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3340c27291ebSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3341c27291ebSmrgAC_LANG_CASE(
3342c27291ebSmrg	[C], [
3343c27291ebSmrg		CWARNFLAGS="$BASE_CFLAGS"
3344c27291ebSmrg		if  test "x$GCC" = xyes ; then
3345c27291ebSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3346c27291ebSmrg		fi
3347c27291ebSmrg		AC_SUBST(CWARNFLAGS)
3348c27291ebSmrg	]
3349c27291ebSmrg)
33504f9ac78aSmrg]) # XORG_CWARNFLAGS
33514f9ac78aSmrg
33524f9ac78aSmrg# XORG_STRICT_OPTION
33534f9ac78aSmrg# -----------------------
33544f9ac78aSmrg# Minimum version: 1.3.0
33554f9ac78aSmrg#
3356c27291ebSmrg# Add configure option to enable strict compilation flags, such as treating
3357c27291ebSmrg# warnings as fatal errors.
3358c27291ebSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3359c27291ebSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3360c27291ebSmrg#
3361c27291ebSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3362c27291ebSmrg# when strict compilation is unconditionally desired.
33634f9ac78aSmrgAC_DEFUN([XORG_STRICT_OPTION], [
33644f9ac78aSmrgAC_REQUIRE([XORG_CWARNFLAGS])
3365c27291ebSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
33664f9ac78aSmrg
33674f9ac78aSmrgAC_ARG_ENABLE(strict-compilation,
33684f9ac78aSmrg			  AS_HELP_STRING([--enable-strict-compilation],
33694f9ac78aSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
33704f9ac78aSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3371c27291ebSmrg
3372c27291ebSmrgAC_LANG_CASE(
3373c27291ebSmrg        [C], [
3374c27291ebSmrg                define([PREFIX], [C])
3375c27291ebSmrg        ],
3376c27291ebSmrg        [C++], [
3377c27291ebSmrg                define([PREFIX], [CXX])
3378c27291ebSmrg        ]
3379c27291ebSmrg)
3380c27291ebSmrg
3381c27291ebSmrg[STRICT_]PREFIX[FLAGS]=""
3382c27291ebSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3383c27291ebSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3384c27291ebSmrg
3385c27291ebSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3386c27291ebSmrg# activate it with -Werror, so we add it here explicitly.
3387c27291ebSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3388c27291ebSmrg
33894f9ac78aSmrgif test "x$STRICT_COMPILE" = "xyes"; then
3390c27291ebSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3391c27291ebSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
33924f9ac78aSmrgfi
3393c27291ebSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3394c27291ebSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3395c27291ebSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
33964f9ac78aSmrg]) # XORG_STRICT_OPTION
33974f9ac78aSmrg
3398742aa962Smrg# XORG_DEFAULT_NOCODE_OPTIONS
3399742aa962Smrg# ---------------------------
3400742aa962Smrg# Minimum version: 1.20.0
3401742aa962Smrg#
3402742aa962Smrg# Defines default options for X.Org modules which don't compile code,
3403742aa962Smrg# such as fonts, bitmaps, cursors, and docs.
3404742aa962Smrg#
3405742aa962SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
3406742aa962SmrgAC_REQUIRE([AC_PROG_INSTALL])
3407742aa962SmrgXORG_RELEASE_VERSION
3408742aa962SmrgXORG_CHANGELOG
3409742aa962SmrgXORG_INSTALL
3410742aa962SmrgXORG_MANPAGE_SECTIONS
3411742aa962Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3412742aa962Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3413742aa962Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
3414742aa962Smrg
34154f9ac78aSmrg# XORG_DEFAULT_OPTIONS
34164f9ac78aSmrg# --------------------
34174f9ac78aSmrg# Minimum version: 1.3.0
34184f9ac78aSmrg#
3419742aa962Smrg# Defines default options for X.Org modules which compile code.
34204f9ac78aSmrg#
34214f9ac78aSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
34224f9ac78aSmrgAC_REQUIRE([AC_PROG_INSTALL])
3423c27291ebSmrgXORG_COMPILER_FLAGS
34244f9ac78aSmrgXORG_CWARNFLAGS
34254f9ac78aSmrgXORG_STRICT_OPTION
3426742aa962SmrgXORG_DEFAULT_NOCODE_OPTIONS
34274f9ac78aSmrg]) # XORG_DEFAULT_OPTIONS
34284f9ac78aSmrg
34294f9ac78aSmrg# XORG_INSTALL()
34304f9ac78aSmrg# ----------------
34314f9ac78aSmrg# Minimum version: 1.4.0
34324f9ac78aSmrg#
34334f9ac78aSmrg# Defines the variable INSTALL_CMD as the command to copy
34344f9ac78aSmrg# INSTALL from $prefix/share/util-macros.
34354f9ac78aSmrg#
34364f9ac78aSmrgAC_DEFUN([XORG_INSTALL], [
34374f9ac78aSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
34384f9ac78aSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
34394f9ac78aSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
34404f9ac78aSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3441d04472e1Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3442d04472e1Smrgtouch \$(top_srcdir)/INSTALL; \
3443d04472e1Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
34444f9ac78aSmrgAC_SUBST([INSTALL_CMD])
34454f9ac78aSmrg]) # XORG_INSTALL
3446d1333322Smrgdnl Copyright 2005 Red Hat, Inc
3447d1333322Smrgdnl
3448d1333322Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3449d1333322Smrgdnl documentation for any purpose is hereby granted without fee, provided that
3450d1333322Smrgdnl the above copyright notice appear in all copies and that both that
3451d1333322Smrgdnl copyright notice and this permission notice appear in supporting
3452d1333322Smrgdnl documentation.
3453d1333322Smrgdnl
3454d1333322Smrgdnl The above copyright notice and this permission notice shall be included
3455d1333322Smrgdnl in all copies or substantial portions of the Software.
3456d1333322Smrgdnl
3457d1333322Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3458d1333322Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3459d1333322Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3460d1333322Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3461d1333322Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3462d1333322Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3463d1333322Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3464d1333322Smrgdnl
3465d1333322Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3466d1333322Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3467d1333322Smrgdnl other dealings in this Software without prior written authorization
3468d1333322Smrgdnl from the copyright holders.
3469d1333322Smrgdnl
3470d1333322Smrg
3471d1333322Smrg# XORG_RELEASE_VERSION
3472d1333322Smrg# --------------------
34734f9ac78aSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
347469ef5f27Smrg
3475d1333322SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3476d1333322Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3477d1333322Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3478d1333322Smrg		[Major version of this package])
3479d1333322Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3480d1333322Smrg	if test "x$PVM" = "x"; then
3481d1333322Smrg		PVM="0"
3482d1333322Smrg	fi
3483d1333322Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3484d1333322Smrg		[$PVM],
3485d1333322Smrg		[Minor version of this package])
3486d1333322Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3487d1333322Smrg	if test "x$PVP" = "x"; then
3488d1333322Smrg		PVP="0"
3489d1333322Smrg	fi
3490d1333322Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3491d1333322Smrg		[$PVP],
3492d1333322Smrg		[Patch version of this package])
3493d1333322Smrg])
3494d1333322Smrg
34954f9ac78aSmrg# XORG_CHANGELOG()
34964f9ac78aSmrg# ----------------
34974f9ac78aSmrg# Minimum version: 1.2.0
34984f9ac78aSmrg#
34994f9ac78aSmrg# Defines the variable CHANGELOG_CMD as the command to generate
35004f9ac78aSmrg# ChangeLog from git.
35014f9ac78aSmrg#
35024f9ac78aSmrg#
35034f9ac78aSmrgAC_DEFUN([XORG_CHANGELOG], [
3504d04472e1SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
35054f9ac78aSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3506d04472e1Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3507d04472e1Smrgtouch \$(top_srcdir)/ChangeLog; \
3508d04472e1Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
35094f9ac78aSmrgAC_SUBST([CHANGELOG_CMD])
35104f9ac78aSmrg]) # XORG_CHANGELOG
35114f9ac78aSmrg
3512