17015785aSmrg# generated automatically by aclocal 1.17 -*- Autoconf -*-
224047306Smrg
37015785aSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
414c0a534Smrg
514c0a534Smrg# This file is free software; the Free Software Foundation
614c0a534Smrg# gives unlimited permission to copy and/or distribute it,
714c0a534Smrg# with or without modifications, as long as this notice is preserved.
814c0a534Smrg
914c0a534Smrg# This program is distributed in the hope that it will be useful,
1014c0a534Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1114c0a534Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1214c0a534Smrg# PARTICULAR PURPOSE.
1314c0a534Smrg
1424047306Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15bf2eeab3Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16bf2eeab3Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
177015785aSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
187015785aSmrg[m4_warning([this file was generated for autoconf 2.72.
19bf2eeab3SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20bf2eeab3SmrgIf you have problems, you may need to regenerate the build system entirely.
2124047306SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2214c0a534Smrg
237015785aSmrg# Copyright (C) 2002-2024 Free Software Foundation, Inc.
2414c0a534Smrg#
25bf2eeab3Smrg# This file is free software; the Free Software Foundation
26bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
27bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
2814c0a534Smrg
29bf2eeab3Smrg# AM_AUTOMAKE_VERSION(VERSION)
30bf2eeab3Smrg# ----------------------------
31bf2eeab3Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32bf2eeab3Smrg# generated from the m4 files accompanying Automake X.Y.
33bf2eeab3Smrg# (This private macro should not be called outside this file.)
34bf2eeab3SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
357015785aSmrg[am__api_version='1.17'
36bf2eeab3Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37bf2eeab3Smrgdnl require some minimum version.  Point them to the right macro.
387015785aSmrgm4_if([$1], [1.17], [],
39bf2eeab3Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40bf2eeab3Smrg])
4114c0a534Smrg
42bf2eeab3Smrg# _AM_AUTOCONF_VERSION(VERSION)
4314c0a534Smrg# -----------------------------
44bf2eeab3Smrg# aclocal traces this macro to find the Autoconf version.
45bf2eeab3Smrg# This is a private macro too.  Using m4_define simplifies
46bf2eeab3Smrg# the logic in aclocal, which can simply ignore this definition.
47bf2eeab3Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48bf2eeab3Smrg
49bf2eeab3Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50bf2eeab3Smrg# -------------------------------
51bf2eeab3Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52bf2eeab3Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53bf2eeab3SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
547015785aSmrg[AM_AUTOMAKE_VERSION([1.17])dnl
55bf2eeab3Smrgm4_ifndef([AC_AUTOCONF_VERSION],
56bf2eeab3Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57bf2eeab3Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5814c0a534Smrg
59bf2eeab3Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
6014c0a534Smrg
617015785aSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
62bf2eeab3Smrg#
63bf2eeab3Smrg# This file is free software; the Free Software Foundation
64bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
65bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
66bf2eeab3Smrg
67bf2eeab3Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6824047306Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6924047306Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7014c0a534Smrg#
71bf2eeab3Smrg# Of course, Automake must honor this variable whenever it calls a
72bf2eeab3Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73bf2eeab3Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74bf2eeab3Smrg# depending on how configure is run.  This is pretty annoying, since
75bf2eeab3Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76bf2eeab3Smrg# source directory, any form will work fine, but in subdirectories a
77bf2eeab3Smrg# relative path needs to be adjusted first.
7814c0a534Smrg#
79bf2eeab3Smrg# $ac_aux_dir/missing
80bf2eeab3Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81bf2eeab3Smrg# $top_srcdir/$ac_aux_dir/missing
82bf2eeab3Smrg#    fails if $ac_aux_dir is absolute,
83bf2eeab3Smrg#    fails when called from a subdirectory in a VPATH build with
84bf2eeab3Smrg#          a relative $ac_aux_dir
8514c0a534Smrg#
86bf2eeab3Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87bf2eeab3Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
8824047306Smrg# harmless because $srcdir is '.', but things will broke when you
89bf2eeab3Smrg# start a VPATH build or use an absolute $srcdir.
9014c0a534Smrg#
91bf2eeab3Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92bf2eeab3Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93bf2eeab3Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94bf2eeab3Smrg# and then we would define $MISSING as
95bf2eeab3Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96bf2eeab3Smrg# This will work as long as MISSING is not called from configure, because
97bf2eeab3Smrg# unfortunately $(top_srcdir) has no meaning in configure.
98bf2eeab3Smrg# However there are other variables, like CC, which are often used in
99bf2eeab3Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100bf2eeab3Smrg#
101bf2eeab3Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
102bf2eeab3Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
103bf2eeab3Smrg# configured tree to be moved without reconfiguration.
10414c0a534Smrg
105bf2eeab3SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10624047306Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10724047306Smrg# Expand $ac_aux_dir to an absolute path.
10824047306Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109bf2eeab3Smrg])
11014c0a534Smrg
111bf2eeab3Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11214c0a534Smrg
1137015785aSmrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
114bf2eeab3Smrg#
115bf2eeab3Smrg# This file is free software; the Free Software Foundation
116bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
117bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
11814c0a534Smrg
119bf2eeab3Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120bf2eeab3Smrg# -------------------------------------
121bf2eeab3Smrg# Define a conditional.
122bf2eeab3SmrgAC_DEFUN([AM_CONDITIONAL],
12324047306Smrg[AC_PREREQ([2.52])dnl
12424047306Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12524047306Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126bf2eeab3SmrgAC_SUBST([$1_TRUE])dnl
127bf2eeab3SmrgAC_SUBST([$1_FALSE])dnl
128bf2eeab3Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129bf2eeab3Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130bf2eeab3Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131bf2eeab3Smrgif $2; then
132bf2eeab3Smrg  $1_TRUE=
133bf2eeab3Smrg  $1_FALSE='#'
134bf2eeab3Smrgelse
135bf2eeab3Smrg  $1_TRUE='#'
136bf2eeab3Smrg  $1_FALSE=
137bf2eeab3Smrgfi
138bf2eeab3SmrgAC_CONFIG_COMMANDS_PRE(
139bf2eeab3Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140bf2eeab3Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141bf2eeab3SmrgUsually this means the macro was only invoked conditionally.]])
142bf2eeab3Smrgfi])])
14314c0a534Smrg
1447015785aSmrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
145bf2eeab3Smrg#
146bf2eeab3Smrg# This file is free software; the Free Software Foundation
147bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
148bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
14914c0a534Smrg
15014c0a534Smrg
15124047306Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
152bf2eeab3Smrg# written in clear, in which case automake, when reading aclocal.m4,
153bf2eeab3Smrg# will think it sees a *use*, and therefore will trigger all it's
154bf2eeab3Smrg# C support machinery.  Also note that it means that autoscan, seeing
155bf2eeab3Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
15614c0a534Smrg
15714c0a534Smrg
158bf2eeab3Smrg# _AM_DEPENDENCIES(NAME)
159bf2eeab3Smrg# ----------------------
160bf2eeab3Smrg# See how the compiler implements dependency checking.
16124047306Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
162bf2eeab3Smrg# We try a few techniques and use that to set a single cache variable.
163bf2eeab3Smrg#
164bf2eeab3Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
165bf2eeab3Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
166bf2eeab3Smrg# dependency, and given that the user is not expected to run this macro,
167bf2eeab3Smrg# just rely on AC_PROG_CC.
168bf2eeab3SmrgAC_DEFUN([_AM_DEPENDENCIES],
169bf2eeab3Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
170bf2eeab3SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
171bf2eeab3SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
172bf2eeab3SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
17314c0a534Smrg
17424047306Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17524047306Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17624047306Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17724047306Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17824047306Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
17924047306Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18024047306Smrg                    [depcc="$$1"   am_compiler_list=])
18114c0a534Smrg
182bf2eeab3SmrgAC_CACHE_CHECK([dependency style of $depcc],
183bf2eeab3Smrg               [am_cv_$1_dependencies_compiler_type],
184bf2eeab3Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
185bf2eeab3Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
186bf2eeab3Smrg  # making bogus files that we don't know about and never remove.  For
187bf2eeab3Smrg  # instance it was reported that on HP-UX the gcc test will end up
18824047306Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
18924047306Smrg  # in D".
19024047306Smrg  rm -rf conftest.dir
191bf2eeab3Smrg  mkdir conftest.dir
192bf2eeab3Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
193bf2eeab3Smrg  # using a relative directory.
194bf2eeab3Smrg  cp "$am_depcomp" conftest.dir
195bf2eeab3Smrg  cd conftest.dir
196bf2eeab3Smrg  # We will build objects and dependencies in a subdirectory because
197bf2eeab3Smrg  # it helps to detect inapplicable dependency modes.  For instance
198bf2eeab3Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
199bf2eeab3Smrg  # side effect of compilation, but ICC will put the dependencies in
200bf2eeab3Smrg  # the current directory while Tru64 will put them in the object
201bf2eeab3Smrg  # directory.
202bf2eeab3Smrg  mkdir sub
20314c0a534Smrg
204bf2eeab3Smrg  am_cv_$1_dependencies_compiler_type=none
205bf2eeab3Smrg  if test "$am_compiler_list" = ""; then
206bf2eeab3Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
207bf2eeab3Smrg  fi
208bf2eeab3Smrg  am__universal=false
209bf2eeab3Smrg  m4_case([$1], [CC],
210bf2eeab3Smrg    [case " $depcc " in #(
211bf2eeab3Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212bf2eeab3Smrg     esac],
213bf2eeab3Smrg    [CXX],
214bf2eeab3Smrg    [case " $depcc " in #(
215bf2eeab3Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216bf2eeab3Smrg     esac])
21714c0a534Smrg
218bf2eeab3Smrg  for depmode in $am_compiler_list; do
219bf2eeab3Smrg    # Setup a source with many dependencies, because some compilers
220bf2eeab3Smrg    # like to wrap large dependency lists on column 80 (with \), and
221bf2eeab3Smrg    # we should not choose a depcomp mode which is confused by this.
222bf2eeab3Smrg    #
223bf2eeab3Smrg    # We need to recreate these files for each test, as the compiler may
224bf2eeab3Smrg    # overwrite some of them when testing with obscure command lines.
225bf2eeab3Smrg    # This happens at least with the AIX C compiler.
226bf2eeab3Smrg    : > sub/conftest.c
227bf2eeab3Smrg    for i in 1 2 3 4 5 6; do
228bf2eeab3Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
22924047306Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23024047306Smrg      # Solaris 10 /bin/sh.
23124047306Smrg      echo '/* dummy */' > sub/conftst$i.h
232bf2eeab3Smrg    done
233bf2eeab3Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234bf2eeab3Smrg
23524047306Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236bf2eeab3Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23724047306Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23824047306Smrg    # versions had trouble with output in subdirs.
239bf2eeab3Smrg    am__obj=sub/conftest.${OBJEXT-o}
240bf2eeab3Smrg    am__minus_obj="-o $am__obj"
241bf2eeab3Smrg    case $depmode in
242bf2eeab3Smrg    gcc)
243bf2eeab3Smrg      # This depmode causes a compiler race in universal mode.
244bf2eeab3Smrg      test "$am__universal" = false || continue
245bf2eeab3Smrg      ;;
246bf2eeab3Smrg    nosideeffect)
24724047306Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24824047306Smrg      # only be used when explicitly requested.
249bf2eeab3Smrg      if test "x$enable_dependency_tracking" = xyes; then
250bf2eeab3Smrg	continue
251bf2eeab3Smrg      else
252bf2eeab3Smrg	break
253bf2eeab3Smrg      fi
254bf2eeab3Smrg      ;;
25524047306Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25624047306Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
257bf2eeab3Smrg      # not run yet.  These depmodes are late enough in the game, and
258bf2eeab3Smrg      # so weak that their functioning should not be impacted.
259bf2eeab3Smrg      am__obj=conftest.${OBJEXT-o}
260bf2eeab3Smrg      am__minus_obj=
261bf2eeab3Smrg      ;;
262bf2eeab3Smrg    none) break ;;
263bf2eeab3Smrg    esac
264bf2eeab3Smrg    if depmode=$depmode \
265bf2eeab3Smrg       source=sub/conftest.c object=$am__obj \
266bf2eeab3Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267bf2eeab3Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
268bf2eeab3Smrg         >/dev/null 2>conftest.err &&
269bf2eeab3Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
270bf2eeab3Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271bf2eeab3Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
272bf2eeab3Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
273bf2eeab3Smrg      # icc doesn't choke on unknown options, it will just issue warnings
274bf2eeab3Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
275bf2eeab3Smrg      # that says an option was ignored or not supported.
2767015785aSmrg      # When given -MP, icc 7.0 and 7.1 complain thus:
277bf2eeab3Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
278bf2eeab3Smrg      # The diagnosis changed in icc 8.0:
279bf2eeab3Smrg      #   icc: Command line remark: option '-MP' not supported
280bf2eeab3Smrg      if (grep 'ignoring option' conftest.err ||
281bf2eeab3Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
282bf2eeab3Smrg        am_cv_$1_dependencies_compiler_type=$depmode
283bf2eeab3Smrg        break
284bf2eeab3Smrg      fi
285bf2eeab3Smrg    fi
286bf2eeab3Smrg  done
287bf2eeab3Smrg
288bf2eeab3Smrg  cd ..
289bf2eeab3Smrg  rm -rf conftest.dir
29014c0a534Smrgelse
291bf2eeab3Smrg  am_cv_$1_dependencies_compiler_type=none
29214c0a534Smrgfi
293bf2eeab3Smrg])
294bf2eeab3SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
295bf2eeab3SmrgAM_CONDITIONAL([am__fastdep$1], [
296bf2eeab3Smrg  test "x$enable_dependency_tracking" != xno \
297bf2eeab3Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298bf2eeab3Smrg])
29914c0a534Smrg
30014c0a534Smrg
301bf2eeab3Smrg# AM_SET_DEPDIR
302bf2eeab3Smrg# -------------
303bf2eeab3Smrg# Choose a directory name for dependency files.
30424047306Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
305bf2eeab3SmrgAC_DEFUN([AM_SET_DEPDIR],
306bf2eeab3Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
307bf2eeab3SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
308bf2eeab3Smrg])
30914c0a534Smrg
31014c0a534Smrg
311bf2eeab3Smrg# AM_DEP_TRACK
312bf2eeab3Smrg# ------------
313bf2eeab3SmrgAC_DEFUN([AM_DEP_TRACK],
31424047306Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31524047306SmrgAS_HELP_STRING(
31624047306Smrg  [--enable-dependency-tracking],
31724047306Smrg  [do not reject slow dependency extractors])
31824047306SmrgAS_HELP_STRING(
31924047306Smrg  [--disable-dependency-tracking],
32024047306Smrg  [speeds up one-time build])])
321bf2eeab3Smrgif test "x$enable_dependency_tracking" != xno; then
322bf2eeab3Smrg  am_depcomp="$ac_aux_dir/depcomp"
323bf2eeab3Smrg  AMDEPBACKSLASH='\'
32424047306Smrg  am__nodep='_no'
32514c0a534Smrgfi
326bf2eeab3SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
327bf2eeab3SmrgAC_SUBST([AMDEPBACKSLASH])dnl
328bf2eeab3Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32924047306SmrgAC_SUBST([am__nodep])dnl
33024047306Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
331bf2eeab3Smrg])
33214c0a534Smrg
333bf2eeab3Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334bf2eeab3Smrg
3357015785aSmrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
336bf2eeab3Smrg#
337bf2eeab3Smrg# This file is free software; the Free Software Foundation
338bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
339bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
340bf2eeab3Smrg
341bf2eeab3Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
342bf2eeab3Smrg# ------------------------------
343bf2eeab3SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
344bf2eeab3Smrg[{
34524047306Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
346bf2eeab3Smrg  # are listed without --file.  Let's play safe and only enable the eval
347bf2eeab3Smrg  # if we detect the quoting.
348bdc460c5Smrg  # TODO: see whether this extra hack can be removed once we start
349bdc460c5Smrg  # requiring Autoconf 2.70 or later.
350bdc460c5Smrg  AS_CASE([$CONFIG_FILES],
351bdc460c5Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
352bdc460c5Smrg          [*], [set x $CONFIG_FILES])
353bf2eeab3Smrg  shift
354bdc460c5Smrg  # Used to flag and report bootstrapping failures.
355bdc460c5Smrg  am_rc=0
356bdc460c5Smrg  for am_mf
357bf2eeab3Smrg  do
358bf2eeab3Smrg    # Strip MF so we end up with the name of the file.
359bdc460c5Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
360bdc460c5Smrg    # Check whether this is an Automake generated Makefile which includes
361bdc460c5Smrg    # dependency-tracking related rules and includes.
362bdc460c5Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
363bf2eeab3Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
364bdc460c5Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
365bdc460c5Smrg      || continue
366bdc460c5Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
367bdc460c5Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
368bdc460c5Smrg    AM_RUN_LOG([cd "$am_dirpart" \
369bdc460c5Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
370bdc460c5Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
371bf2eeab3Smrg  done
372bdc460c5Smrg  if test $am_rc -ne 0; then
373bdc460c5Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
374bdc460c5Smrg    for automatic dependency tracking.  If GNU make was not used, consider
375bdc460c5Smrg    re-running the configure script with MAKE="gmake" (or whatever is
376bdc460c5Smrg    necessary).  You can also try re-running configure with the
377bdc460c5Smrg    '--disable-dependency-tracking' option to at least be able to build
378bdc460c5Smrg    the package (albeit without support for automatic dependency tracking).])
379bdc460c5Smrg  fi
380bdc460c5Smrg  AS_UNSET([am_dirpart])
381bdc460c5Smrg  AS_UNSET([am_filepart])
382bdc460c5Smrg  AS_UNSET([am_mf])
383bdc460c5Smrg  AS_UNSET([am_rc])
384bdc460c5Smrg  rm -f conftest-deps.mk
385bf2eeab3Smrg}
386bf2eeab3Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387bf2eeab3Smrg
388bf2eeab3Smrg
389bf2eeab3Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
390bf2eeab3Smrg# -----------------------------
391bf2eeab3Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
392bf2eeab3Smrg#
393bdc460c5Smrg# This code is only required when automatic dependency tracking is enabled.
394bdc460c5Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
395bdc460c5Smrg# order to bootstrap the dependency handling code.
396bf2eeab3SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
397bf2eeab3Smrg[AC_CONFIG_COMMANDS([depfiles],
398bf2eeab3Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
399bdc460c5Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400bf2eeab3Smrg
401bf2eeab3Smrg# Do all the work for Automake.                             -*- Autoconf -*-
402bf2eeab3Smrg
4037015785aSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
404bf2eeab3Smrg#
405bf2eeab3Smrg# This file is free software; the Free Software Foundation
406bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
407bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
408bf2eeab3Smrg
409bf2eeab3Smrg# This macro actually does too much.  Some checks are only needed if
410bf2eeab3Smrg# your package does certain things.  But this isn't really a big deal.
411bf2eeab3Smrg
41224047306Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
41324047306Smrgm4_define([AC_PROG_CC],
41424047306Smrgm4_defn([AC_PROG_CC])
41524047306Smrg[_AM_PROG_CC_C_O
41624047306Smrg])
41724047306Smrg
418bf2eeab3Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
419bf2eeab3Smrg# AM_INIT_AUTOMAKE([OPTIONS])
420bf2eeab3Smrg# -----------------------------------------------
421bf2eeab3Smrg# The call with PACKAGE and VERSION arguments is the old style
422bf2eeab3Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
423bf2eeab3Smrg# and VERSION should now be passed to AC_INIT and removed from
424bf2eeab3Smrg# the call to AM_INIT_AUTOMAKE.
425bf2eeab3Smrg# We support both call styles for the transition.  After
426bf2eeab3Smrg# the next Automake release, Autoconf can make the AC_INIT
427bf2eeab3Smrg# arguments mandatory, and then we can depend on a new Autoconf
428bf2eeab3Smrg# release and drop the old call support.
429bf2eeab3SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43024047306Smrg[AC_PREREQ([2.65])dnl
431bdc460c5Smrgm4_ifdef([_$0_ALREADY_INIT],
432bdc460c5Smrg  [m4_fatal([$0 expanded multiple times
433bdc460c5Smrg]m4_defn([_$0_ALREADY_INIT]))],
434bdc460c5Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
435bf2eeab3Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
436bf2eeab3Smrgdnl the ones we care about.
437bf2eeab3Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
438bf2eeab3SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
439bf2eeab3SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
440bf2eeab3Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
441bf2eeab3Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
442bf2eeab3Smrg  # is not polluted with repeated "-I."
443bf2eeab3Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
444bf2eeab3Smrg  # test to see if srcdir already configured
445bf2eeab3Smrg  if test -f $srcdir/config.status; then
446bf2eeab3Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
447bf2eeab3Smrg  fi
44814c0a534Smrgfi
44914c0a534Smrg
450bf2eeab3Smrg# test whether we have cygpath
451bf2eeab3Smrgif test -z "$CYGPATH_W"; then
452bf2eeab3Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
453bf2eeab3Smrg    CYGPATH_W='cygpath -w'
454bf2eeab3Smrg  else
455bf2eeab3Smrg    CYGPATH_W=echo
456bf2eeab3Smrg  fi
45714c0a534Smrgfi
458bf2eeab3SmrgAC_SUBST([CYGPATH_W])
459bf2eeab3Smrg
460bf2eeab3Smrg# Define the identity of the package.
461bf2eeab3Smrgdnl Distinguish between old-style and new-style calls.
462bf2eeab3Smrgm4_ifval([$2],
46324047306Smrg[AC_DIAGNOSE([obsolete],
46424047306Smrg             [$0: two- and three-arguments forms are deprecated.])
46524047306Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
466bf2eeab3Smrg AC_SUBST([PACKAGE], [$1])dnl
467bf2eeab3Smrg AC_SUBST([VERSION], [$2])],
468bf2eeab3Smrg[_AM_SET_OPTIONS([$1])dnl
469bf2eeab3Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47024047306Smrgm4_if(
471bdc460c5Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
47224047306Smrg  [ok:ok],,
473bf2eeab3Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
474bf2eeab3Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
475bf2eeab3Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476bf2eeab3Smrg
477bf2eeab3Smrg_AM_IF_OPTION([no-define],,
47824047306Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
47924047306Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480bf2eeab3Smrg
481bf2eeab3Smrg# Some tools Automake needs.
482bf2eeab3SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
483bf2eeab3SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48424047306SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
48524047306SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
48624047306SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
48724047306SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
48824047306SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
489bf2eeab3SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
490bf2eeab3SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49124047306SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49224047306Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
49324047306Smrg# dies out for good.  For more background, see:
494bdc460c5Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
495bdc460c5Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
49624047306SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
49724047306Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
49824047306Smrg# system "awk" is bad on some platforms.
499bf2eeab3SmrgAC_REQUIRE([AC_PROG_AWK])dnl
500bf2eeab3SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
501bf2eeab3SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
502bf2eeab3Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
503bf2eeab3Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
504bf2eeab3Smrg			     [_AM_PROG_TAR([v7])])])
505bf2eeab3Smrg_AM_IF_OPTION([no-dependencies],,
506bf2eeab3Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
50724047306Smrg		  [_AM_DEPENDENCIES([CC])],
50824047306Smrg		  [m4_define([AC_PROG_CC],
50924047306Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
510bf2eeab3SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51124047306Smrg		  [_AM_DEPENDENCIES([CXX])],
51224047306Smrg		  [m4_define([AC_PROG_CXX],
51324047306Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
514bf2eeab3SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51524047306Smrg		  [_AM_DEPENDENCIES([OBJC])],
51624047306Smrg		  [m4_define([AC_PROG_OBJC],
51724047306Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
51824047306SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
51924047306Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
52024047306Smrg		  [m4_define([AC_PROG_OBJCXX],
52124047306Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
522bf2eeab3Smrg])
523bdc460c5Smrg# Variables for tags utilities; see am/tags.am
524bdc460c5Smrgif test -z "$CTAGS"; then
525bdc460c5Smrg  CTAGS=ctags
526bdc460c5Smrgfi
527bdc460c5SmrgAC_SUBST([CTAGS])
528bdc460c5Smrgif test -z "$ETAGS"; then
529bdc460c5Smrg  ETAGS=etags
530bdc460c5Smrgfi
531bdc460c5SmrgAC_SUBST([ETAGS])
532bdc460c5Smrgif test -z "$CSCOPE"; then
533bdc460c5Smrg  CSCOPE=cscope
534bdc460c5Smrgfi
535bdc460c5SmrgAC_SUBST([CSCOPE])
536bdc460c5Smrg
5377015785aSmrgAC_REQUIRE([_AM_SILENT_RULES])dnl
53824047306Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
53924047306Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
54024047306Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
541bf2eeab3SmrgAC_CONFIG_COMMANDS_PRE(dnl
542bf2eeab3Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
543bf2eeab3Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
54424047306Smrg
5457015785aSmrgAC_REQUIRE([_AM_PROG_RM_F])
5467015785aSmrgAC_REQUIRE([_AM_PROG_XARGS_N])
54724047306Smrg
54824047306Smrgdnl The trailing newline in this macro's definition is deliberate, for
54924047306Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
55024047306Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
551bf2eeab3Smrg])
552bf2eeab3Smrg
55324047306Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
554bf2eeab3Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
555bf2eeab3Smrgdnl mangled by Autoconf and run in a shell conditional statement.
556bf2eeab3Smrgm4_define([_AC_COMPILER_EXEEXT],
557bf2eeab3Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
558bf2eeab3Smrg
559bf2eeab3Smrg# When config.status generates a header, we must update the stamp-h file.
560bf2eeab3Smrg# This file resides in the same directory as the config header
561bf2eeab3Smrg# that is generated.  The stamp files are numbered to have different names.
562bf2eeab3Smrg
563bf2eeab3Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
564bf2eeab3Smrg# loop where config.status creates the headers, so we can generate
565bf2eeab3Smrg# our stamp files there.
566bf2eeab3SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
567bf2eeab3Smrg[# Compute $1's index in $config_headers.
568bf2eeab3Smrg_am_arg=$1
569bf2eeab3Smrg_am_stamp_count=1
570bf2eeab3Smrgfor _am_header in $config_headers :; do
571bf2eeab3Smrg  case $_am_header in
572bf2eeab3Smrg    $_am_arg | $_am_arg:* )
573bf2eeab3Smrg      break ;;
574bf2eeab3Smrg    * )
575bf2eeab3Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
576bf2eeab3Smrg  esac
577bf2eeab3Smrgdone
578bf2eeab3Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
579bf2eeab3Smrg
5807015785aSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
581bf2eeab3Smrg#
582bf2eeab3Smrg# This file is free software; the Free Software Foundation
583bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
584bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
585bf2eeab3Smrg
586bf2eeab3Smrg# AM_PROG_INSTALL_SH
587bf2eeab3Smrg# ------------------
588bf2eeab3Smrg# Define $install_sh.
589bf2eeab3SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
590bf2eeab3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
59124047306Smrgif test x"${install_sh+set}" != xset; then
592bf2eeab3Smrg  case $am_aux_dir in
593bf2eeab3Smrg  *\ * | *\	*)
594bf2eeab3Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
595bf2eeab3Smrg  *)
596bf2eeab3Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
597bf2eeab3Smrg  esac
59814c0a534Smrgfi
59924047306SmrgAC_SUBST([install_sh])])
60014c0a534Smrg
6017015785aSmrg# Copyright (C) 2003-2024 Free Software Foundation, Inc.
602bf2eeab3Smrg#
603bf2eeab3Smrg# This file is free software; the Free Software Foundation
604bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
605bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
606bf2eeab3Smrg
607bf2eeab3Smrg# Check whether the underlying file-system supports filenames
608bf2eeab3Smrg# with a leading dot.  For instance MS-DOS doesn't.
609bf2eeab3SmrgAC_DEFUN([AM_SET_LEADING_DOT],
610bf2eeab3Smrg[rm -rf .tst 2>/dev/null
611bf2eeab3Smrgmkdir .tst 2>/dev/null
612bf2eeab3Smrgif test -d .tst; then
613bf2eeab3Smrg  am__leading_dot=.
614bf2eeab3Smrgelse
615bf2eeab3Smrg  am__leading_dot=_
61614c0a534Smrgfi
617bf2eeab3Smrgrmdir .tst 2>/dev/null
618bf2eeab3SmrgAC_SUBST([am__leading_dot])])
619bf2eeab3Smrg
620bf2eeab3Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
621bf2eeab3Smrg
6227015785aSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
623bf2eeab3Smrg#
624bf2eeab3Smrg# This file is free software; the Free Software Foundation
625bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
626bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
627bf2eeab3Smrg
628bf2eeab3Smrg# AM_MAKE_INCLUDE()
629bf2eeab3Smrg# -----------------
630bdc460c5Smrg# Check whether make has an 'include' directive that can support all
631bdc460c5Smrg# the idioms we need for our automatic dependency tracking code.
632bf2eeab3SmrgAC_DEFUN([AM_MAKE_INCLUDE],
633bdc460c5Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
634bdc460c5Smrgcat > confinc.mk << 'END'
635bf2eeab3Smrgam__doit:
636bdc460c5Smrg	@echo this is the am__doit target >confinc.out
637bf2eeab3Smrg.PHONY: am__doit
638bf2eeab3SmrgEND
639bf2eeab3Smrgam__include="#"
640bf2eeab3Smrgam__quote=
641bdc460c5Smrg# BSD make does it like this.
642bdc460c5Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
643bdc460c5Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
644bdc460c5Smrgecho 'include confinc.mk # ignored' > confmf.GNU
645bdc460c5Smrg_am_result=no
646bdc460c5Smrgfor s in GNU BSD; do
647bdc460c5Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
648bdc460c5Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
649bdc460c5Smrg      ['0:this is the am__doit target'],
650bdc460c5Smrg      [AS_CASE([$s],
651bdc460c5Smrg          [BSD], [am__include='.include' am__quote='"'],
652bdc460c5Smrg          [am__include='include' am__quote=''])])
653bdc460c5Smrg  if test "$am__include" != "#"; then
654bdc460c5Smrg    _am_result="yes ($s style)"
655bdc460c5Smrg    break
656bdc460c5Smrg  fi
657bdc460c5Smrgdone
658bdc460c5Smrgrm -f confinc.* confmf.*
659bdc460c5SmrgAC_MSG_RESULT([${_am_result}])
660bdc460c5SmrgAC_SUBST([am__include])])
661bdc460c5SmrgAC_SUBST([am__quote])])
66214c0a534Smrg
663bf2eeab3Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
664bf2eeab3Smrg
6657015785aSmrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
666bf2eeab3Smrg#
667bf2eeab3Smrg# This file is free software; the Free Software Foundation
668bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
669bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
670bf2eeab3Smrg
671bf2eeab3Smrg# AM_MISSING_PROG(NAME, PROGRAM)
672bf2eeab3Smrg# ------------------------------
673bf2eeab3SmrgAC_DEFUN([AM_MISSING_PROG],
674bf2eeab3Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
675bf2eeab3Smrg$1=${$1-"${am_missing_run}$2"}
676bf2eeab3SmrgAC_SUBST($1)])
677bf2eeab3Smrg
678bf2eeab3Smrg# AM_MISSING_HAS_RUN
679bf2eeab3Smrg# ------------------
68024047306Smrg# Define MISSING if not defined so far and test if it is modern enough.
68124047306Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
682bf2eeab3SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
683bf2eeab3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
684bf2eeab3SmrgAC_REQUIRE_AUX_FILE([missing])dnl
685bf2eeab3Smrgif test x"${MISSING+set}" != xset; then
686bdc460c5Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
68714c0a534Smrgfi
688bf2eeab3Smrg# Use eval to expand $SHELL
68924047306Smrgif eval "$MISSING --is-lightweight"; then
69024047306Smrg  am_missing_run="$MISSING "
691bf2eeab3Smrgelse
692bf2eeab3Smrg  am_missing_run=
69324047306Smrg  AC_MSG_WARN(['missing' script is too old or missing])
69414c0a534Smrgfi
695bf2eeab3Smrg])
69614c0a534Smrg
697bf2eeab3Smrg# Helper functions for option handling.                     -*- Autoconf -*-
698bf2eeab3Smrg
6997015785aSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
700bf2eeab3Smrg#
701bf2eeab3Smrg# This file is free software; the Free Software Foundation
702bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
703bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
704bf2eeab3Smrg
705bf2eeab3Smrg# _AM_MANGLE_OPTION(NAME)
706bf2eeab3Smrg# -----------------------
707bf2eeab3SmrgAC_DEFUN([_AM_MANGLE_OPTION],
708bf2eeab3Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
709bf2eeab3Smrg
710bf2eeab3Smrg# _AM_SET_OPTION(NAME)
71124047306Smrg# --------------------
712bf2eeab3Smrg# Set option NAME.  Presently that only means defining a flag for this option.
713bf2eeab3SmrgAC_DEFUN([_AM_SET_OPTION],
71424047306Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
715bf2eeab3Smrg
716bf2eeab3Smrg# _AM_SET_OPTIONS(OPTIONS)
71724047306Smrg# ------------------------
718bf2eeab3Smrg# OPTIONS is a space-separated list of Automake options.
719bf2eeab3SmrgAC_DEFUN([_AM_SET_OPTIONS],
720bf2eeab3Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
72114c0a534Smrg
722bf2eeab3Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
723bf2eeab3Smrg# -------------------------------------------
724bf2eeab3Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
725bf2eeab3SmrgAC_DEFUN([_AM_IF_OPTION],
726bf2eeab3Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
72714c0a534Smrg
7287015785aSmrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
72924047306Smrg#
73024047306Smrg# This file is free software; the Free Software Foundation
73124047306Smrg# gives unlimited permission to copy and/or distribute it,
73224047306Smrg# with or without modifications, as long as this notice is preserved.
73324047306Smrg
73424047306Smrg# _AM_PROG_CC_C_O
73524047306Smrg# ---------------
73624047306Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
73724047306Smrg# to automatically call this.
73824047306SmrgAC_DEFUN([_AM_PROG_CC_C_O],
73924047306Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
74024047306SmrgAC_REQUIRE_AUX_FILE([compile])dnl
74124047306SmrgAC_LANG_PUSH([C])dnl
74224047306SmrgAC_CACHE_CHECK(
74324047306Smrg  [whether $CC understands -c and -o together],
74424047306Smrg  [am_cv_prog_cc_c_o],
74524047306Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
74624047306Smrg  # Make sure it works both with $CC and with simple cc.
74724047306Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
74824047306Smrg  # compilers refuse to overwrite an existing .o file with -o,
74924047306Smrg  # though they will create one.
75024047306Smrg  am_cv_prog_cc_c_o=yes
75124047306Smrg  for am_i in 1 2; do
75224047306Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
75324047306Smrg         && test -f conftest2.$ac_objext; then
75424047306Smrg      : OK
75524047306Smrg    else
75624047306Smrg      am_cv_prog_cc_c_o=no
75724047306Smrg      break
75824047306Smrg    fi
75924047306Smrg  done
76024047306Smrg  rm -f core conftest*
76124047306Smrg  unset am_i])
76224047306Smrgif test "$am_cv_prog_cc_c_o" != yes; then
76324047306Smrg   # Losing compiler, so override with the script.
76424047306Smrg   # FIXME: It is wrong to rewrite CC.
76524047306Smrg   # But if we don't then we get into trouble of one sort or another.
76624047306Smrg   # A longer-term fix would be to have automake use am__CC in this case,
76724047306Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
76824047306Smrg   CC="$am_aux_dir/compile $CC"
76924047306Smrgfi
77024047306SmrgAC_LANG_POP([C])])
77114c0a534Smrg
77224047306Smrg# For backward compatibility.
77324047306SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
77424047306Smrg
7757015785aSmrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
7767015785aSmrg#
7777015785aSmrg# This file is free software; the Free Software Foundation
7787015785aSmrg# gives unlimited permission to copy and/or distribute it,
7797015785aSmrg# with or without modifications, as long as this notice is preserved.
7807015785aSmrg
7817015785aSmrg# _AM_PROG_RM_F
7827015785aSmrg# ---------------
7837015785aSmrg# Check whether 'rm -f' without any arguments works.
7847015785aSmrg# https://bugs.gnu.org/10828
7857015785aSmrgAC_DEFUN([_AM_PROG_RM_F],
7867015785aSmrg[am__rm_f_notfound=
7877015785aSmrgAS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""'])
7887015785aSmrgAC_SUBST(am__rm_f_notfound)
7897015785aSmrg])
7907015785aSmrg
7917015785aSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
792bf2eeab3Smrg#
793bf2eeab3Smrg# This file is free software; the Free Software Foundation
794bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
795bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
79614c0a534Smrg
79724047306Smrg# AM_RUN_LOG(COMMAND)
79824047306Smrg# -------------------
79924047306Smrg# Run COMMAND, save the exit status in ac_status, and log it.
80024047306Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
80124047306SmrgAC_DEFUN([AM_RUN_LOG],
80224047306Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
80324047306Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
80424047306Smrg   ac_status=$?
80524047306Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
80624047306Smrg   (exit $ac_status); }])
80724047306Smrg
80824047306Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
80924047306Smrg
8107015785aSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
81124047306Smrg#
81224047306Smrg# This file is free software; the Free Software Foundation
81324047306Smrg# gives unlimited permission to copy and/or distribute it,
81424047306Smrg# with or without modifications, as long as this notice is preserved.
81514c0a534Smrg
8167015785aSmrg# _AM_SLEEP_FRACTIONAL_SECONDS
8177015785aSmrg# ----------------------------
8187015785aSmrgAC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl
8197015785aSmrgAC_CACHE_CHECK([whether sleep supports fractional seconds],
8207015785aSmrg               am_cv_sleep_fractional_seconds, [dnl
8217015785aSmrgAS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes],
8227015785aSmrg                                 [am_cv_sleep_fractional_seconds=no])
8237015785aSmrg])])
8247015785aSmrg
8257015785aSmrg# _AM_FILESYSTEM_TIMESTAMP_RESOLUTION
8267015785aSmrg# -----------------------------------
8277015785aSmrg# Determine the filesystem's resolution for file modification
8287015785aSmrg# timestamps.  The coarsest we know of is FAT, with a resolution
8297015785aSmrg# of only two seconds, even with the most recent "exFAT" extensions.
8307015785aSmrg# The finest (e.g. ext4 with large inodes, XFS, ZFS) is one
8317015785aSmrg# nanosecond, matching clock_gettime.  However, it is probably not
8327015785aSmrg# possible to delay execution of a shell script for less than one
8337015785aSmrg# millisecond, due to process creation overhead and scheduling
8347015785aSmrg# granularity, so we don't check for anything finer than that. (See below.)
8357015785aSmrgAC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl
8367015785aSmrgAC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS])
8377015785aSmrgAC_CACHE_CHECK([filesystem timestamp resolution],
8387015785aSmrg               am_cv_filesystem_timestamp_resolution, [dnl
8397015785aSmrg# Default to the worst case.
8407015785aSmrgam_cv_filesystem_timestamp_resolution=2
8417015785aSmrg
8427015785aSmrg# Only try to go finer than 1 sec if sleep can do it.
8437015785aSmrg# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work,
8447015785aSmrg# - 1 sec is not much of a win compared to 2 sec, and
8457015785aSmrg# - it takes 2 seconds to perform the test whether 1 sec works.
8467015785aSmrg# 
8477015785aSmrg# Instead, just use the default 2s on platforms that have 1s resolution,
8487015785aSmrg# accept the extra 1s delay when using $sleep in the Automake tests, in
8497015785aSmrg# exchange for not incurring the 2s delay for running the test for all
8507015785aSmrg# packages.
8517015785aSmrg#
8527015785aSmrgam_try_resolutions=
8537015785aSmrgif test "$am_cv_sleep_fractional_seconds" = yes; then
8547015785aSmrg  # Even a millisecond often causes a bunch of false positives,
8557015785aSmrg  # so just try a hundredth of a second. The time saved between .001 and
8567015785aSmrg  # .01 is not terribly consequential.
8577015785aSmrg  am_try_resolutions="0.01 0.1 $am_try_resolutions"
8587015785aSmrgfi
8597015785aSmrg
8607015785aSmrg# In order to catch current-generation FAT out, we must *modify* files
8617015785aSmrg# that already exist; the *creation* timestamp is finer.  Use names
8627015785aSmrg# that make ls -t sort them differently when they have equal
8637015785aSmrg# timestamps than when they have distinct timestamps, keeping
8647015785aSmrg# in mind that ls -t prints the *newest* file first.
8657015785aSmrgrm -f conftest.ts?
8667015785aSmrg: > conftest.ts1
8677015785aSmrg: > conftest.ts2
8687015785aSmrg: > conftest.ts3
8697015785aSmrg
8707015785aSmrg# Make sure ls -t actually works.  Do 'set' in a subshell so we don't
8717015785aSmrg# clobber the current shell's arguments. (Outer-level square brackets
8727015785aSmrg# are removed by m4; they're present so that m4 does not expand
8737015785aSmrg# <dollar><star>; be careful, easy to get confused.)
8747015785aSmrgif (
8757015785aSmrg     set X `[ls -t conftest.ts[12]]` &&
8767015785aSmrg     {
8777015785aSmrg       test "$[]*" != "X conftest.ts1 conftest.ts2" ||
8787015785aSmrg       test "$[]*" != "X conftest.ts2 conftest.ts1";
8797015785aSmrg     }
8807015785aSmrg); then :; else
8817015785aSmrg  # If neither matched, then we have a broken ls.  This can happen
8827015785aSmrg  # if, for instance, CONFIG_SHELL is bash and it inherits a
8837015785aSmrg  # broken ls alias from the environment.  This has actually
8847015785aSmrg  # happened.  Such a system could not be considered "sane".
8857015785aSmrg  _AS_ECHO_UNQUOTED(
8867015785aSmrg    ["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""],
8877015785aSmrg    [AS_MESSAGE_LOG_FD])
8887015785aSmrg  AC_MSG_FAILURE([ls -t produces unexpected output.
8897015785aSmrgMake sure there is not a broken ls alias in your environment.])
8907015785aSmrgfi
8917015785aSmrg
8927015785aSmrgfor am_try_res in $am_try_resolutions; do
8937015785aSmrg  # Any one fine-grained sleep might happen to cross the boundary
8947015785aSmrg  # between two values of a coarser actual resolution, but if we do
8957015785aSmrg  # two fine-grained sleeps in a row, at least one of them will fall
8967015785aSmrg  # entirely within a coarse interval.
8977015785aSmrg  echo alpha > conftest.ts1
8987015785aSmrg  sleep $am_try_res
8997015785aSmrg  echo beta > conftest.ts2
9007015785aSmrg  sleep $am_try_res
9017015785aSmrg  echo gamma > conftest.ts3
9027015785aSmrg
9037015785aSmrg  # We assume that 'ls -t' will make use of high-resolution
9047015785aSmrg  # timestamps if the operating system supports them at all.
9057015785aSmrg  if (set X `ls -t conftest.ts?` &&
9067015785aSmrg      test "$[]2" = conftest.ts3 &&
9077015785aSmrg      test "$[]3" = conftest.ts2 &&
9087015785aSmrg      test "$[]4" = conftest.ts1); then
9097015785aSmrg    #
9107015785aSmrg    # Ok, ls -t worked. If we're at a resolution of 1 second, we're done,
9117015785aSmrg    # because we don't need to test make.
9127015785aSmrg    make_ok=true
9137015785aSmrg    if test $am_try_res != 1; then
9147015785aSmrg      # But if we've succeeded so far with a subsecond resolution, we
9157015785aSmrg      # have one more thing to check: make. It can happen that
9167015785aSmrg      # everything else supports the subsecond mtimes, but make doesn't;
9177015785aSmrg      # notably on macOS, which ships make 3.81 from 2006 (the last one
9187015785aSmrg      # released under GPLv2). https://bugs.gnu.org/68808
9197015785aSmrg      # 
9207015785aSmrg      # We test $MAKE if it is defined in the environment, else "make".
9217015785aSmrg      # It might get overridden later, but our hope is that in practice
9227015785aSmrg      # it does not matter: it is the system "make" which is (by far)
9237015785aSmrg      # the most likely to be broken, whereas if the user overrides it,
9247015785aSmrg      # probably they did so with a better, or at least not worse, make.
9257015785aSmrg      # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html
9267015785aSmrg      #
9277015785aSmrg      # Create a Makefile (real tab character here):
9287015785aSmrg      rm -f conftest.mk
9297015785aSmrg      echo 'conftest.ts1: conftest.ts2' >conftest.mk
9307015785aSmrg      echo '	touch conftest.ts2' >>conftest.mk
9317015785aSmrg      #
9327015785aSmrg      # Now, running
9337015785aSmrg      #   touch conftest.ts1; touch conftest.ts2; make
9347015785aSmrg      # should touch ts1 because ts2 is newer. This could happen by luck,
9357015785aSmrg      # but most often, it will fail if make's support is insufficient. So
9367015785aSmrg      # test for several consecutive successes.
9377015785aSmrg      #
9387015785aSmrg      # (We reuse conftest.ts[12] because we still want to modify existing
9397015785aSmrg      # files, not create new ones, per above.)
9407015785aSmrg      n=0
9417015785aSmrg      make=${MAKE-make}
9427015785aSmrg      until test $n -eq 3; do
9437015785aSmrg        echo one > conftest.ts1
9447015785aSmrg        sleep $am_try_res
9457015785aSmrg        echo two > conftest.ts2 # ts2 should now be newer than ts1
9467015785aSmrg        if $make -f conftest.mk | grep 'up to date' >/dev/null; then
9477015785aSmrg          make_ok=false
9487015785aSmrg          break # out of $n loop
9497015785aSmrg        fi
9507015785aSmrg        n=`expr $n + 1`
9517015785aSmrg      done
9527015785aSmrg    fi
9537015785aSmrg    #
9547015785aSmrg    if $make_ok; then
9557015785aSmrg      # Everything we know to check worked out, so call this resolution good.
9567015785aSmrg      am_cv_filesystem_timestamp_resolution=$am_try_res
9577015785aSmrg      break # out of $am_try_res loop
9587015785aSmrg    fi
9597015785aSmrg    # Otherwise, we'll go on to check the next resolution.
9607015785aSmrg  fi
9617015785aSmrgdone
9627015785aSmrgrm -f conftest.ts?
9637015785aSmrg# (end _am_filesystem_timestamp_resolution)
9647015785aSmrg])])
9657015785aSmrg
966bf2eeab3Smrg# AM_SANITY_CHECK
967bf2eeab3Smrg# ---------------
968bf2eeab3SmrgAC_DEFUN([AM_SANITY_CHECK],
9697015785aSmrg[AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION])
9707015785aSmrg# This check should not be cached, as it may vary across builds of
9717015785aSmrg# different projects.
9727015785aSmrgAC_MSG_CHECKING([whether build environment is sane])
973bf2eeab3Smrg# Reject unsafe characters in $srcdir or the absolute working directory
974bf2eeab3Smrg# name.  Accept space and tab only in the latter.
975bf2eeab3Smrgam_lf='
976bf2eeab3Smrg'
977bf2eeab3Smrgcase `pwd` in
978bf2eeab3Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
979bf2eeab3Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
980bf2eeab3Smrgesac
981bf2eeab3Smrgcase $srcdir in
982bf2eeab3Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
98324047306Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
984bf2eeab3Smrgesac
98514c0a534Smrg
98624047306Smrg# Do 'set' in a subshell so we don't clobber the current shell's
987bf2eeab3Smrg# arguments.  Must try -L first in case configure is actually a
988bf2eeab3Smrg# symlink; some systems play weird games with the mod time of symlinks
989bf2eeab3Smrg# (eg FreeBSD returns the mod time of the symlink's containing
990bf2eeab3Smrg# directory).
9917015785aSmrgam_build_env_is_sane=no
9927015785aSmrgam_has_slept=no
9937015785aSmrgrm -f conftest.file
9947015785aSmrgfor am_try in 1 2; do
9957015785aSmrg  echo "timestamp, slept: $am_has_slept" > conftest.file
9967015785aSmrg  if (
9977015785aSmrg    set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
9987015785aSmrg    if test "$[]*" = "X"; then
9997015785aSmrg      # -L didn't work.
10007015785aSmrg      set X `ls -t "$srcdir/configure" conftest.file`
10017015785aSmrg    fi
10027015785aSmrg    test "$[]2" = conftest.file
10037015785aSmrg  ); then
10047015785aSmrg    am_build_env_is_sane=yes
10057015785aSmrg    break
10067015785aSmrg  fi
10077015785aSmrg  # Just in case.
10087015785aSmrg  sleep "$am_cv_filesystem_timestamp_resolution"
10097015785aSmrg  am_has_slept=yes
10107015785aSmrgdone
10117015785aSmrg
10127015785aSmrgAC_MSG_RESULT([$am_build_env_is_sane])
10137015785aSmrgif test "$am_build_env_is_sane" = no; then
10147015785aSmrg  AC_MSG_ERROR([newly created file is older than distributed files!
1015bf2eeab3SmrgCheck your system clock])
101614c0a534Smrgfi
10177015785aSmrg
101824047306Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
101924047306Smrg# generated files are strictly newer.
102024047306Smrgam_sleep_pid=
10217015785aSmrgAS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl
10227015785aSmrg  ( sleep "$am_cv_filesystem_timestamp_resolution" ) &
102324047306Smrg  am_sleep_pid=$!
10247015785aSmrg])
102524047306SmrgAC_CONFIG_COMMANDS_PRE(
102624047306Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
102724047306Smrg   if test -n "$am_sleep_pid"; then
102824047306Smrg     # Hide warnings about reused PIDs.
102924047306Smrg     wait $am_sleep_pid 2>/dev/null
103024047306Smrg   fi
103124047306Smrg   AC_MSG_RESULT([done])])
103224047306Smrgrm -f conftest.file
103324047306Smrg])
103414c0a534Smrg
10357015785aSmrg# Copyright (C) 2009-2024 Free Software Foundation, Inc.
1036bf2eeab3Smrg#
1037bf2eeab3Smrg# This file is free software; the Free Software Foundation
1038bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
1039bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
104014c0a534Smrg
10417015785aSmrg# _AM_SILENT_RULES
10427015785aSmrg# ----------------
10437015785aSmrg# Enable less verbose build rules support.
10447015785aSmrgAC_DEFUN([_AM_SILENT_RULES],
10457015785aSmrg[AM_DEFAULT_VERBOSITY=1
10467015785aSmrgAC_ARG_ENABLE([silent-rules], [dnl
104724047306SmrgAS_HELP_STRING(
104824047306Smrg  [--enable-silent-rules],
104924047306Smrg  [less verbose build output (undo: "make V=1")])
105024047306SmrgAS_HELP_STRING(
105124047306Smrg  [--disable-silent-rules],
105224047306Smrg  [verbose build output (undo: "make V=0")])dnl
105324047306Smrg])
105424047306Smrgdnl
105524047306Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
105624047306Smrgdnl do not support nested variable expansions.
105724047306Smrgdnl See automake bug#9928 and bug#10237.
105824047306Smrgam_make=${MAKE-make}
105924047306SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
106024047306Smrg   [am_cv_make_support_nested_variables],
106124047306Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
106224047306SmrgBAR0=false
106324047306SmrgBAR1=true
106424047306SmrgV=1
106524047306Smrgam__doit:
106624047306Smrg	@$(TRUE)
106724047306Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
106824047306Smrg  am_cv_make_support_nested_variables=yes
106924047306Smrgelse
107024047306Smrg  am_cv_make_support_nested_variables=no
107124047306Smrgfi])
107224047306SmrgAC_SUBST([AM_V])dnl
107324047306SmrgAM_SUBST_NOTMAKE([AM_V])dnl
107424047306SmrgAC_SUBST([AM_DEFAULT_V])dnl
107524047306SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
1076bf2eeab3SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
1077bf2eeab3SmrgAM_BACKSLASH='\'
1078bf2eeab3SmrgAC_SUBST([AM_BACKSLASH])dnl
1079bf2eeab3Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
10807015785aSmrgdnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls
10817015785aSmrgdnl to AM_SILENT_RULES to change the default value.
10827015785aSmrgAC_CONFIG_COMMANDS_PRE([dnl
10837015785aSmrgcase $enable_silent_rules in @%:@ (((
10847015785aSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
10857015785aSmrg   no) AM_DEFAULT_VERBOSITY=1;;
10867015785aSmrgesac
10877015785aSmrgif test $am_cv_make_support_nested_variables = yes; then
10887015785aSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
10897015785aSmrg  AM_V='$(V)'
10907015785aSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
10917015785aSmrgelse
10927015785aSmrg  AM_V=$AM_DEFAULT_VERBOSITY
10937015785aSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
10947015785aSmrgfi
10957015785aSmrg])dnl
1096bf2eeab3Smrg])
109714c0a534Smrg
10987015785aSmrg# AM_SILENT_RULES([DEFAULT])
10997015785aSmrg# --------------------------
11007015785aSmrg# Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or
11017015785aSmrg# empty being verbose).
11027015785aSmrgAC_DEFUN([AM_SILENT_RULES],
11037015785aSmrg[AC_REQUIRE([_AM_SILENT_RULES])
11047015785aSmrgAM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])])
11057015785aSmrg
11067015785aSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
1107bf2eeab3Smrg#
1108bf2eeab3Smrg# This file is free software; the Free Software Foundation
1109bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
1110bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
111114c0a534Smrg
1112bf2eeab3Smrg# AM_PROG_INSTALL_STRIP
1113bf2eeab3Smrg# ---------------------
111424047306Smrg# One issue with vendor 'install' (even GNU) is that you can't
1115bf2eeab3Smrg# specify the program used to strip binaries.  This is especially
1116bf2eeab3Smrg# annoying in cross-compiling environments, where the build's strip
1117bf2eeab3Smrg# is unlikely to handle the host's binaries.
1118bf2eeab3Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
111924047306Smrg# always use install-sh in "make install-strip", and initialize
1120bf2eeab3Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
1121bf2eeab3SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
1122bf2eeab3Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
112324047306Smrg# Installed binaries are usually stripped using 'strip' when the user
112424047306Smrg# run "make install-strip".  However 'strip' might not be the right
1125bf2eeab3Smrg# tool to use in cross-compilation environments, therefore Automake
112624047306Smrg# will honor the 'STRIP' environment variable to overrule this program.
112724047306Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
1128bf2eeab3Smrgif test "$cross_compiling" != no; then
1129bf2eeab3Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
113014c0a534Smrgfi
1131bf2eeab3SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
1132bf2eeab3SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
113314c0a534Smrg
11347015785aSmrg# Copyright (C) 2006-2024 Free Software Foundation, Inc.
1135bf2eeab3Smrg#
1136bf2eeab3Smrg# This file is free software; the Free Software Foundation
1137bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
1138bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
113914c0a534Smrg
1140bf2eeab3Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
1141bf2eeab3Smrg# ---------------------------
1142bf2eeab3Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1143bf2eeab3Smrg# This macro is traced by Automake.
1144bf2eeab3SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
114514c0a534Smrg
1146bf2eeab3Smrg# AM_SUBST_NOTMAKE(VARIABLE)
114724047306Smrg# --------------------------
1148bf2eeab3Smrg# Public sister of _AM_SUBST_NOTMAKE.
1149bf2eeab3SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
115014c0a534Smrg
1151bf2eeab3Smrg# Check how to create a tarball.                            -*- Autoconf -*-
1152bf2eeab3Smrg
11537015785aSmrg# Copyright (C) 2004-2024 Free Software Foundation, Inc.
115414c0a534Smrg#
115514c0a534Smrg# This file is free software; the Free Software Foundation
115614c0a534Smrg# gives unlimited permission to copy and/or distribute it,
115714c0a534Smrg# with or without modifications, as long as this notice is preserved.
115814c0a534Smrg
1159bf2eeab3Smrg# _AM_PROG_TAR(FORMAT)
1160bf2eeab3Smrg# --------------------
1161bf2eeab3Smrg# Check how to create a tarball in format FORMAT.
116224047306Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1163bf2eeab3Smrg#
1164bf2eeab3Smrg# Substitute a variable $(am__tar) that is a command
1165bf2eeab3Smrg# writing to stdout a FORMAT-tarball containing the directory
1166bf2eeab3Smrg# $tardir.
1167bf2eeab3Smrg#     tardir=directory && $(am__tar) > result.tar
1168bf2eeab3Smrg#
1169bf2eeab3Smrg# Substitute a variable $(am__untar) that extract such
1170bf2eeab3Smrg# a tarball read from stdin.
1171bf2eeab3Smrg#     $(am__untar) < result.tar
117224047306Smrg#
1173bf2eeab3SmrgAC_DEFUN([_AM_PROG_TAR],
117424047306Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
117524047306Smrg# in the wild :-(  We should find a proper way to deprecate it ...
117624047306SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
117724047306Smrg
117824047306Smrg# We'll loop over all known methods to create a tar archive until one works.
1179bf2eeab3Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1180bf2eeab3Smrg
118124047306Smrgm4_if([$1], [v7],
118224047306Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
118324047306Smrg
118424047306Smrg  [m4_case([$1],
118524047306Smrg    [ustar],
118624047306Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
118724047306Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
118824047306Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
118924047306Smrg      # and bug#13588).
119024047306Smrg      am_max_uid=2097151 # 2^21 - 1
119124047306Smrg      am_max_gid=$am_max_uid
119224047306Smrg      # The $UID and $GID variables are not portable, so we need to resort
119324047306Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
119424047306Smrg      # below are definitely unexpected, so allow the users to see them
119524047306Smrg      # (that is, avoid stderr redirection).
119624047306Smrg      am_uid=`id -u || echo unknown`
119724047306Smrg      am_gid=`id -g || echo unknown`
119824047306Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
11997015785aSmrg      if test x$am_uid = xunknown; then
12007015785aSmrg        AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work])
12017015785aSmrg      elif test $am_uid -le $am_max_uid; then
12027015785aSmrg        AC_MSG_RESULT([yes])
120324047306Smrg      else
12047015785aSmrg        AC_MSG_RESULT([no])
12057015785aSmrg        _am_tools=none
120624047306Smrg      fi
120724047306Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
12087015785aSmrg      if test x$gm_gid = xunknown; then
12097015785aSmrg        AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work])
12107015785aSmrg      elif test $am_gid -le $am_max_gid; then
12117015785aSmrg        AC_MSG_RESULT([yes])
121224047306Smrg      else
121324047306Smrg        AC_MSG_RESULT([no])
121424047306Smrg        _am_tools=none
121524047306Smrg      fi],
121624047306Smrg
121724047306Smrg  [pax],
121824047306Smrg    [],
121924047306Smrg
122024047306Smrg  [m4_fatal([Unknown tar format])])
122124047306Smrg
122224047306Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
122324047306Smrg
122424047306Smrg  # Go ahead even if we have the value already cached.  We do so because we
122524047306Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
122624047306Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
122724047306Smrg
122824047306Smrg  for _am_tool in $_am_tools; do
122924047306Smrg    case $_am_tool in
123024047306Smrg    gnutar)
123124047306Smrg      for _am_tar in tar gnutar gtar; do
123224047306Smrg        AM_RUN_LOG([$_am_tar --version]) && break
123324047306Smrg      done
123424047306Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
123524047306Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
123624047306Smrg      am__untar="$_am_tar -xf -"
123724047306Smrg      ;;
123824047306Smrg    plaintar)
123924047306Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
124024047306Smrg      # ustar tarball either.
124124047306Smrg      (tar --version) >/dev/null 2>&1 && continue
124224047306Smrg      am__tar='tar chf - "$$tardir"'
124324047306Smrg      am__tar_='tar chf - "$tardir"'
124424047306Smrg      am__untar='tar xf -'
124524047306Smrg      ;;
124624047306Smrg    pax)
124724047306Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
124824047306Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
124924047306Smrg      am__untar='pax -r'
125024047306Smrg      ;;
125124047306Smrg    cpio)
125224047306Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
125324047306Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
125424047306Smrg      am__untar='cpio -i -H $1 -d'
125524047306Smrg      ;;
125624047306Smrg    none)
125724047306Smrg      am__tar=false
125824047306Smrg      am__tar_=false
125924047306Smrg      am__untar=false
126024047306Smrg      ;;
126124047306Smrg    esac
126214c0a534Smrg
126324047306Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
126424047306Smrg    # and am__untar set.
126524047306Smrg    test -n "${am_cv_prog_tar_$1}" && break
126624047306Smrg
126724047306Smrg    # tar/untar a dummy directory, and stop if the command works.
126824047306Smrg    rm -rf conftest.dir
126924047306Smrg    mkdir conftest.dir
127024047306Smrg    echo GrepMe > conftest.dir/file
127124047306Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
127224047306Smrg    rm -rf conftest.dir
127324047306Smrg    if test -s conftest.tar; then
127424047306Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
127524047306Smrg      AM_RUN_LOG([cat conftest.dir/file])
127624047306Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
127724047306Smrg    fi
127824047306Smrg  done
1279bf2eeab3Smrg  rm -rf conftest.dir
128014c0a534Smrg
128124047306Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
128224047306Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
128324047306Smrg
1284bf2eeab3SmrgAC_SUBST([am__tar])
1285bf2eeab3SmrgAC_SUBST([am__untar])
1286bf2eeab3Smrg]) # _AM_PROG_TAR
128714c0a534Smrg
12887015785aSmrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
12897015785aSmrg#
12907015785aSmrg# This file is free software; the Free Software Foundation
12917015785aSmrg# gives unlimited permission to copy and/or distribute it,
12927015785aSmrg# with or without modifications, as long as this notice is preserved.
12937015785aSmrg
12947015785aSmrg# _AM_PROG_XARGS_N
12957015785aSmrg# ----------------
12967015785aSmrg# Check whether 'xargs -n' works.  It should work everywhere, so the fallback
12977015785aSmrg# is not optimized at all as we never expect to use it.
12987015785aSmrgAC_DEFUN([_AM_PROG_XARGS_N],
12997015785aSmrg[AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl
13007015785aSmrgAS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2
13017015785aSmrg3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])])
13027015785aSmrgAS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl
13037015785aSmrg  am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }'
13047015785aSmrg])dnl
13057015785aSmrgAC_SUBST(am__xargs_n)
13067015785aSmrg])
13077015785aSmrg
1308bdc460c5Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1309bdc460c5Smrgdnl serial 11 (pkg-config-0.29)
1310bdc460c5Smrgdnl
1311bdc460c5Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1312bdc460c5Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1313bdc460c5Smrgdnl
1314bdc460c5Smrgdnl This program is free software; you can redistribute it and/or modify
1315bdc460c5Smrgdnl it under the terms of the GNU General Public License as published by
1316bdc460c5Smrgdnl the Free Software Foundation; either version 2 of the License, or
1317bdc460c5Smrgdnl (at your option) any later version.
1318bdc460c5Smrgdnl
1319bdc460c5Smrgdnl This program is distributed in the hope that it will be useful, but
1320bdc460c5Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1321bdc460c5Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1322bdc460c5Smrgdnl General Public License for more details.
1323bdc460c5Smrgdnl
1324bdc460c5Smrgdnl You should have received a copy of the GNU General Public License
1325bdc460c5Smrgdnl along with this program; if not, write to the Free Software
1326bdc460c5Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1327bdc460c5Smrgdnl 02111-1307, USA.
1328bdc460c5Smrgdnl
1329bdc460c5Smrgdnl As a special exception to the GNU General Public License, if you
1330bdc460c5Smrgdnl distribute this file as part of a program that contains a
1331bdc460c5Smrgdnl configuration script generated by Autoconf, you may include it under
1332bdc460c5Smrgdnl the same distribution terms that you use for the rest of that
1333bdc460c5Smrgdnl program.
1334bdc460c5Smrg
1335bdc460c5Smrgdnl PKG_PREREQ(MIN-VERSION)
1336bdc460c5Smrgdnl -----------------------
1337bdc460c5Smrgdnl Since: 0.29
1338bdc460c5Smrgdnl
1339bdc460c5Smrgdnl Verify that the version of the pkg-config macros are at least
1340bdc460c5Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1341bdc460c5Smrgdnl installed version of pkg-config, this checks the developer's version
1342bdc460c5Smrgdnl of pkg.m4 when generating configure.
1343bdc460c5Smrgdnl
1344bdc460c5Smrgdnl To ensure that this macro is defined, also add:
1345bdc460c5Smrgdnl m4_ifndef([PKG_PREREQ],
1346bdc460c5Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1347bdc460c5Smrgdnl
1348bdc460c5Smrgdnl See the "Since" comment for each macro you use to see what version
1349bdc460c5Smrgdnl of the macros you require.
1350bdc460c5Smrgm4_defun([PKG_PREREQ],
1351bdc460c5Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
1352bdc460c5Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1353bdc460c5Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1354bdc460c5Smrg])dnl PKG_PREREQ
1355bdc460c5Smrg
1356bdc460c5Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1357bdc460c5Smrgdnl ----------------------------------
1358bdc460c5Smrgdnl Since: 0.16
1359bdc460c5Smrgdnl
1360bdc460c5Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1361bdc460c5Smrgdnl first found in the path. Checks that the version of pkg-config found
1362bdc460c5Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1363bdc460c5Smrgdnl used since that's the first version where most current features of
1364bdc460c5Smrgdnl pkg-config existed.
136524047306SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
136624047306Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1367bdc460c5Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1368bdc460c5Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1369bdc460c5SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1370bdc460c5SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1371bdc460c5SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1372bdc460c5Smrg
137324047306Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
137424047306Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
137524047306Smrgfi
137624047306Smrgif test -n "$PKG_CONFIG"; then
137724047306Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
137824047306Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
137924047306Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
138024047306Smrg		AC_MSG_RESULT([yes])
138124047306Smrg	else
138224047306Smrg		AC_MSG_RESULT([no])
138324047306Smrg		PKG_CONFIG=""
138424047306Smrg	fi
138524047306Smrgfi[]dnl
1386bdc460c5Smrg])dnl PKG_PROG_PKG_CONFIG
138724047306Smrg
1388bdc460c5Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1389bdc460c5Smrgdnl -------------------------------------------------------------------
1390bdc460c5Smrgdnl Since: 0.18
1391bdc460c5Smrgdnl
1392bdc460c5Smrgdnl Check to see whether a particular set of modules exists. Similar to
1393bdc460c5Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1394bdc460c5Smrgdnl
1395bdc460c5Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1396bdc460c5Smrgdnl only at the first occurence in configure.ac, so if the first place
1397bdc460c5Smrgdnl it's called might be skipped (such as if it is within an "if", you
1398bdc460c5Smrgdnl have to call PKG_CHECK_EXISTS manually
139924047306SmrgAC_DEFUN([PKG_CHECK_EXISTS],
140024047306Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
140124047306Smrgif test -n "$PKG_CONFIG" && \
140224047306Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1403bdc460c5Smrg  m4_default([$2], [:])
140424047306Smrgm4_ifvaln([$3], [else
140524047306Smrg  $3])dnl
140624047306Smrgfi])
140724047306Smrg
1408bdc460c5Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1409bdc460c5Smrgdnl ---------------------------------------------
1410bdc460c5Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1411bdc460c5Smrgdnl pkg_failed based on the result.
141224047306Smrgm4_define([_PKG_CONFIG],
141324047306Smrg[if test -n "$$1"; then
141424047306Smrg    pkg_cv_[]$1="$$1"
141524047306Smrg elif test -n "$PKG_CONFIG"; then
141624047306Smrg    PKG_CHECK_EXISTS([$3],
1417bdc460c5Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1418bdc460c5Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
141924047306Smrg		     [pkg_failed=yes])
142024047306Smrg else
142124047306Smrg    pkg_failed=untried
142224047306Smrgfi[]dnl
1423bdc460c5Smrg])dnl _PKG_CONFIG
142424047306Smrg
1425bdc460c5Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1426bdc460c5Smrgdnl ---------------------------
1427bdc460c5Smrgdnl Internal check to see if pkg-config supports short errors.
142824047306SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
142924047306Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
143024047306Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
143124047306Smrg        _pkg_short_errors_supported=yes
143224047306Smrgelse
143324047306Smrg        _pkg_short_errors_supported=no
143424047306Smrgfi[]dnl
1435bdc460c5Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
143624047306Smrg
143724047306Smrg
1438bdc460c5Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1439bdc460c5Smrgdnl   [ACTION-IF-NOT-FOUND])
1440bdc460c5Smrgdnl --------------------------------------------------------------
1441bdc460c5Smrgdnl Since: 0.4.0
1442bdc460c5Smrgdnl
1443bdc460c5Smrgdnl Note that if there is a possibility the first call to
1444bdc460c5Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1445bdc460c5Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
144624047306SmrgAC_DEFUN([PKG_CHECK_MODULES],
144724047306Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
144824047306SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
144924047306SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
145024047306Smrg
145124047306Smrgpkg_failed=no
145224047306SmrgAC_MSG_CHECKING([for $1])
145324047306Smrg
145424047306Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
145524047306Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
145624047306Smrg
145724047306Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
145824047306Smrgand $1[]_LIBS to avoid the need to call pkg-config.
145924047306SmrgSee the pkg-config man page for more details.])
146024047306Smrg
146124047306Smrgif test $pkg_failed = yes; then
1462bdc460c5Smrg   	AC_MSG_RESULT([no])
146324047306Smrg        _PKG_SHORT_ERRORS_SUPPORTED
146424047306Smrg        if test $_pkg_short_errors_supported = yes; then
1465bdc460c5Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
146624047306Smrg        else 
1467bdc460c5Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
146824047306Smrg        fi
146924047306Smrg	# Put the nasty error message in config.log where it belongs
147024047306Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
147124047306Smrg
1472bdc460c5Smrg	m4_default([$4], [AC_MSG_ERROR(
147324047306Smrg[Package requirements ($2) were not met:
147424047306Smrg
147524047306Smrg$$1_PKG_ERRORS
147624047306Smrg
147724047306SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
147824047306Smrginstalled software in a non-standard prefix.
147924047306Smrg
1480bdc460c5Smrg_PKG_TEXT])[]dnl
1481bdc460c5Smrg        ])
148224047306Smrgelif test $pkg_failed = untried; then
1483bdc460c5Smrg     	AC_MSG_RESULT([no])
1484bdc460c5Smrg	m4_default([$4], [AC_MSG_FAILURE(
148524047306Smrg[The pkg-config script could not be found or is too old.  Make sure it
148624047306Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
148724047306Smrgpath to pkg-config.
148824047306Smrg
148924047306Smrg_PKG_TEXT
149024047306Smrg
1491bdc460c5SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1492bdc460c5Smrg        ])
149324047306Smrgelse
149424047306Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
149524047306Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
149624047306Smrg        AC_MSG_RESULT([yes])
1497bdc460c5Smrg	$3
149824047306Smrgfi[]dnl
1499bdc460c5Smrg])dnl PKG_CHECK_MODULES
1500bdc460c5Smrg
1501bdc460c5Smrg
1502bdc460c5Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1503bdc460c5Smrgdnl   [ACTION-IF-NOT-FOUND])
1504bdc460c5Smrgdnl ---------------------------------------------------------------------
1505bdc460c5Smrgdnl Since: 0.29
1506bdc460c5Smrgdnl
1507bdc460c5Smrgdnl Checks for existence of MODULES and gathers its build flags with
1508bdc460c5Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1509bdc460c5Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1510bdc460c5Smrgdnl
1511bdc460c5Smrgdnl Note that if there is a possibility the first call to
1512bdc460c5Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1513bdc460c5Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1514bdc460c5Smrgdnl configure.ac.
1515bdc460c5SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1516bdc460c5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1517bdc460c5Smrg_save_PKG_CONFIG=$PKG_CONFIG
1518bdc460c5SmrgPKG_CONFIG="$PKG_CONFIG --static"
1519bdc460c5SmrgPKG_CHECK_MODULES($@)
1520bdc460c5SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1521bdc460c5Smrg])dnl PKG_CHECK_MODULES_STATIC
1522bdc460c5Smrg
1523bdc460c5Smrg
1524bdc460c5Smrgdnl PKG_INSTALLDIR([DIRECTORY])
1525bdc460c5Smrgdnl -------------------------
1526bdc460c5Smrgdnl Since: 0.27
1527bdc460c5Smrgdnl
1528bdc460c5Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
1529bdc460c5Smrgdnl should install pkg-config .pc files. By default the directory is
1530bdc460c5Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
1531bdc460c5Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1532bdc460c5Smrgdnl parameter.
1533bdc460c5SmrgAC_DEFUN([PKG_INSTALLDIR],
1534bdc460c5Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1535bdc460c5Smrgm4_pushdef([pkg_description],
1536bdc460c5Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1537bdc460c5SmrgAC_ARG_WITH([pkgconfigdir],
1538bdc460c5Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1539bdc460c5Smrg    [with_pkgconfigdir=]pkg_default)
1540bdc460c5SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1541bdc460c5Smrgm4_popdef([pkg_default])
1542bdc460c5Smrgm4_popdef([pkg_description])
1543bdc460c5Smrg])dnl PKG_INSTALLDIR
1544bdc460c5Smrg
1545bdc460c5Smrg
1546bdc460c5Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1547bdc460c5Smrgdnl --------------------------------
1548bdc460c5Smrgdnl Since: 0.27
1549bdc460c5Smrgdnl
1550bdc460c5Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1551bdc460c5Smrgdnl module should install arch-independent pkg-config .pc files. By
1552bdc460c5Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
1553bdc460c5Smrgdnl changed by passing DIRECTORY. The user can override through the
1554bdc460c5Smrgdnl --with-noarch-pkgconfigdir parameter.
1555bdc460c5SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1556bdc460c5Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1557bdc460c5Smrgm4_pushdef([pkg_description],
1558bdc460c5Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1559bdc460c5SmrgAC_ARG_WITH([noarch-pkgconfigdir],
1560bdc460c5Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1561bdc460c5Smrg    [with_noarch_pkgconfigdir=]pkg_default)
1562bdc460c5SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1563bdc460c5Smrgm4_popdef([pkg_default])
1564bdc460c5Smrgm4_popdef([pkg_description])
1565bdc460c5Smrg])dnl PKG_NOARCH_INSTALLDIR
1566bdc460c5Smrg
1567bdc460c5Smrg
1568bdc460c5Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1569bdc460c5Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1570bdc460c5Smrgdnl -------------------------------------------
1571bdc460c5Smrgdnl Since: 0.28
1572bdc460c5Smrgdnl
1573bdc460c5Smrgdnl Retrieves the value of the pkg-config variable for the given module.
1574bdc460c5SmrgAC_DEFUN([PKG_CHECK_VAR],
1575bdc460c5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1576bdc460c5SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1577bdc460c5Smrg
1578bdc460c5Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1579bdc460c5SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1580bdc460c5Smrg
1581bdc460c5SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1582bdc460c5Smrg])dnl PKG_CHECK_VAR
158324047306Smrg
1584bf2eeab3Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1585bf2eeab3Smrgdnl
15867015785aSmrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
158724047306Smrgdnl
1588bf2eeab3Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1589576bae58Smrgdnl copy of this software and associated documentation files (the "Software"),
1590576bae58Smrgdnl to deal in the Software without restriction, including without limitation
1591576bae58Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1592576bae58Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1593576bae58Smrgdnl Software is furnished to do so, subject to the following conditions:
1594bf2eeab3Smrgdnl
1595576bae58Smrgdnl The above copyright notice and this permission notice (including the next
1596576bae58Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1597576bae58Smrgdnl Software.
1598bf2eeab3Smrgdnl
1599576bae58Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1600576bae58Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1601576bae58Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1602576bae58Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1603576bae58Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1604576bae58Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1605576bae58Smrgdnl DEALINGS IN THE SOFTWARE.
160614c0a534Smrg
1607bf2eeab3Smrg# XORG_MACROS_VERSION(required-version)
1608bf2eeab3Smrg# -------------------------------------
1609bf2eeab3Smrg# Minimum version: 1.1.0
161014c0a534Smrg#
1611bf2eeab3Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1612bf2eeab3Smrg# your configure.ac with the minimum required version, such as:
1613bf2eeab3Smrg# XORG_MACROS_VERSION(1.1)
161414c0a534Smrg#
1615bf2eeab3Smrg# To ensure that this macro is defined, also add:
1616bf2eeab3Smrg# m4_ifndef([XORG_MACROS_VERSION],
1617bf2eeab3Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
161814c0a534Smrg#
161914c0a534Smrg#
162024047306Smrg# See the "minimum version" comment for each macro you use to see what
1621bf2eeab3Smrg# version you require.
1622bf2eeab3Smrgm4_defun([XORG_MACROS_VERSION],[
16237015785aSmrgm4_define([vers_have], [1.20.2])
1624bf2eeab3Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1625bf2eeab3Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1626bf2eeab3Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1627bf2eeab3Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1628bf2eeab3Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1629bf2eeab3Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1630bf2eeab3Smrgm4_undefine([vers_have])
1631bf2eeab3Smrgm4_undefine([maj_have])
1632bf2eeab3Smrgm4_undefine([maj_needed])
1633bf2eeab3Smrg]) # XORG_MACROS_VERSION
163414c0a534Smrg
1635bf2eeab3Smrg# XORG_PROG_RAWCPP()
1636bf2eeab3Smrg# ------------------
1637bf2eeab3Smrg# Minimum version: 1.0.0
163814c0a534Smrg#
1639bf2eeab3Smrg# Find cpp program and necessary flags for use in pre-processing text files
1640bf2eeab3Smrg# such as man pages and config files
1641bf2eeab3SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1642bf2eeab3SmrgAC_REQUIRE([AC_PROG_CPP])
1643bdc460c5SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1644bf2eeab3Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
164514c0a534Smrg
1646bf2eeab3Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1647bf2eeab3Smrg# which is not the best choice for supporting other OS'es, but covers most
1648bf2eeab3Smrg# of the ones we need for now.
1649bf2eeab3SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
16501a054510SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1651bf2eeab3Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1652bf2eeab3Smrg	AC_MSG_RESULT([no])
165314c0a534Smrgelse
1654bf2eeab3Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1655bf2eeab3Smrg		RAWCPPFLAGS=-undef
1656bf2eeab3Smrg		AC_MSG_RESULT([yes])
1657bf2eeab3Smrg	# under Cygwin unix is still defined even with -undef
1658bf2eeab3Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1659bf2eeab3Smrg		RAWCPPFLAGS="-undef -ansi"
1660bf2eeab3Smrg		AC_MSG_RESULT([yes, with -ansi])
1661bf2eeab3Smrg	else
1662bf2eeab3Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1663bf2eeab3Smrg	fi
166414c0a534Smrgfi
1665bf2eeab3Smrgrm -f conftest.$ac_ext
166614c0a534Smrg
1667bf2eeab3SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
16681a054510SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
16697015785aSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1670bf2eeab3Smrg	AC_MSG_RESULT([no])
1671bf2eeab3Smrgelse
16727015785aSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
167324047306Smrg		TRADITIONALCPPFLAGS="-traditional"
1674bf2eeab3Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1675bf2eeab3Smrg		AC_MSG_RESULT([yes])
1676bf2eeab3Smrg	else
1677bf2eeab3Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1678bf2eeab3Smrg	fi
1679bf2eeab3Smrgfi
1680bf2eeab3Smrgrm -f conftest.$ac_ext
1681bf2eeab3SmrgAC_SUBST(RAWCPPFLAGS)
168224047306SmrgAC_SUBST(TRADITIONALCPPFLAGS)
1683bf2eeab3Smrg]) # XORG_PROG_RAWCPP
168414c0a534Smrg
1685bf2eeab3Smrg# XORG_MANPAGE_SECTIONS()
1686bf2eeab3Smrg# -----------------------
1687bf2eeab3Smrg# Minimum version: 1.0.0
168814c0a534Smrg#
1689bf2eeab3Smrg# Determine which sections man pages go in for the different man page types
1690bf2eeab3Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1691bf2eeab3Smrg# Not sure if there's any better way than just hardcoding by OS name.
1692bf2eeab3Smrg# Override default settings by setting environment variables
1693576bae58Smrg# Added MAN_SUBSTS in version 1.8
1694576bae58Smrg# Added AC_PROG_SED in version 1.8
169514c0a534Smrg
1696bf2eeab3SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1697bf2eeab3SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1698576bae58SmrgAC_REQUIRE([AC_PROG_SED])
169914c0a534Smrg
1700bdc460c5Smrgcase $host_os in
1701bdc460c5Smrg    solaris*)
1702bdc460c5Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1703bdc460c5Smrg        # check for a man page file found in later versions that use
1704bdc460c5Smrg        # traditional section numbers instead
1705bdc460c5Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1706bdc460c5Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1707bdc460c5Smrg        ;;
1708bdc460c5Smrg    *) SYSV_MAN_SECTIONS=false ;;
1709bdc460c5Smrgesac
1710bdc460c5Smrg
1711bf2eeab3Smrgif test x$APP_MAN_SUFFIX = x    ; then
1712bf2eeab3Smrg    APP_MAN_SUFFIX=1
1713bf2eeab3Smrgfi
1714bf2eeab3Smrgif test x$APP_MAN_DIR = x    ; then
1715bf2eeab3Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1716bf2eeab3Smrgfi
171714c0a534Smrg
1718bf2eeab3Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1719bf2eeab3Smrg    LIB_MAN_SUFFIX=3
1720bf2eeab3Smrgfi
1721bf2eeab3Smrgif test x$LIB_MAN_DIR = x    ; then
1722bf2eeab3Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
172314c0a534Smrgfi
172414c0a534Smrg
1725bf2eeab3Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1726bdc460c5Smrg    case $SYSV_MAN_SECTIONS in
1727bdc460c5Smrg	true)				FILE_MAN_SUFFIX=4  ;;
1728bdc460c5Smrg	*)				FILE_MAN_SUFFIX=5  ;;
1729bf2eeab3Smrg    esac
1730bf2eeab3Smrgfi
1731bf2eeab3Smrgif test x$FILE_MAN_DIR = x    ; then
1732bf2eeab3Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1733bf2eeab3Smrgfi
173414c0a534Smrg
1735bf2eeab3Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1736bdc460c5Smrg    case $SYSV_MAN_SECTIONS in
1737bdc460c5Smrg	true)				MISC_MAN_SUFFIX=5  ;;
1738bdc460c5Smrg	*)				MISC_MAN_SUFFIX=7  ;;
1739bf2eeab3Smrg    esac
1740bf2eeab3Smrgfi
1741bf2eeab3Smrgif test x$MISC_MAN_DIR = x    ; then
1742bf2eeab3Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1743bf2eeab3Smrgfi
174414c0a534Smrg
1745bf2eeab3Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1746bdc460c5Smrg    case $SYSV_MAN_SECTIONS in
1747bdc460c5Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1748bdc460c5Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1749bf2eeab3Smrg    esac
1750bf2eeab3Smrgfi
1751bf2eeab3Smrgif test x$DRIVER_MAN_DIR = x    ; then
1752bf2eeab3Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1753bf2eeab3Smrgfi
175414c0a534Smrg
1755bf2eeab3Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1756bdc460c5Smrg    case $SYSV_MAN_SECTIONS in
1757bdc460c5Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1758bdc460c5Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
1759bf2eeab3Smrg    esac
1760bf2eeab3Smrgfi
1761bf2eeab3Smrgif test x$ADMIN_MAN_DIR = x    ; then
1762bf2eeab3Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
176314c0a534Smrgfi
176414c0a534Smrg
176514c0a534Smrg
1766bf2eeab3SmrgAC_SUBST([APP_MAN_SUFFIX])
1767bf2eeab3SmrgAC_SUBST([LIB_MAN_SUFFIX])
1768bf2eeab3SmrgAC_SUBST([FILE_MAN_SUFFIX])
1769bf2eeab3SmrgAC_SUBST([MISC_MAN_SUFFIX])
1770bf2eeab3SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1771bf2eeab3SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1772bf2eeab3SmrgAC_SUBST([APP_MAN_DIR])
1773bf2eeab3SmrgAC_SUBST([LIB_MAN_DIR])
1774bf2eeab3SmrgAC_SUBST([FILE_MAN_DIR])
1775bf2eeab3SmrgAC_SUBST([MISC_MAN_DIR])
1776bf2eeab3SmrgAC_SUBST([DRIVER_MAN_DIR])
1777bf2eeab3SmrgAC_SUBST([ADMIN_MAN_DIR])
1778576bae58Smrg
1779576bae58SmrgXORG_MAN_PAGE="X Version 11"
1780576bae58SmrgAC_SUBST([XORG_MAN_PAGE])
1781576bae58SmrgMAN_SUBSTS="\
1782576bae58Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1783576bae58Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1784576bae58Smrg	-e 's|__xservername__|Xorg|g' \
1785576bae58Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1786576bae58Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1787576bae58Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1788576bae58Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1789576bae58Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1790576bae58Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1791576bae58Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1792576bae58Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1793576bae58Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1794576bae58SmrgAC_SUBST([MAN_SUBSTS])
1795576bae58Smrg
1796bf2eeab3Smrg]) # XORG_MANPAGE_SECTIONS
1797bf2eeab3Smrg
1798576bae58Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1799576bae58Smrg# ------------------------
1800576bae58Smrg# Minimum version: 1.7.0
1801576bae58Smrg#
1802576bae58Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1803576bae58Smrg# provided by xorg-sgml-doctools, if installed.
1804576bae58SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1805576bae58SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1806576bae58SmrgXORG_SGML_PATH=
1807576bae58SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1808576bae58Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1809576bae58Smrg    [m4_ifval([$1],[:],
1810576bae58Smrg        [if test x"$cross_compiling" != x"yes" ; then
1811576bae58Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1812576bae58Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1813576bae58Smrg         fi])
1814576bae58Smrg    ])
1815576bae58Smrg
1816576bae58Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1817576bae58Smrg# the path and the name of the doc stylesheet
1818576bae58Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1819576bae58Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1820576bae58Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1821576bae58Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1822576bae58Smrgelse
1823576bae58Smrg   AC_MSG_RESULT([no])
1824576bae58Smrgfi
1825576bae58Smrg
1826576bae58SmrgAC_SUBST(XORG_SGML_PATH)
1827576bae58SmrgAC_SUBST(STYLESHEET_SRCDIR)
1828576bae58SmrgAC_SUBST(XSL_STYLESHEET)
1829576bae58SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1830576bae58Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1831576bae58Smrg
1832bf2eeab3Smrg# XORG_CHECK_LINUXDOC
1833bf2eeab3Smrg# -------------------
1834bf2eeab3Smrg# Minimum version: 1.0.0
183514c0a534Smrg#
1836bf2eeab3Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1837bf2eeab3Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1838bf2eeab3Smrg# Whether or not the necessary tools and files are found can be checked
1839bf2eeab3Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1840bf2eeab3SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1841576bae58SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1842576bae58SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
184314c0a534Smrg
1844bf2eeab3SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
184514c0a534Smrg
1846576bae58SmrgAC_MSG_CHECKING([whether to build documentation])
184714c0a534Smrg
1848576bae58Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1849bf2eeab3Smrg   BUILDDOC=yes
1850bf2eeab3Smrgelse
1851bf2eeab3Smrg   BUILDDOC=no
1852bf2eeab3Smrgfi
185314c0a534Smrg
1854bf2eeab3SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
185514c0a534Smrg
1856bf2eeab3SmrgAC_MSG_RESULT([$BUILDDOC])
185714c0a534Smrg
1858576bae58SmrgAC_MSG_CHECKING([whether to build pdf documentation])
185914c0a534Smrg
1860576bae58Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1861bf2eeab3Smrg   BUILDPDFDOC=yes
1862bf2eeab3Smrgelse
1863bf2eeab3Smrg   BUILDPDFDOC=no
1864bf2eeab3Smrgfi
186514c0a534Smrg
1866bf2eeab3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
186714c0a534Smrg
1868bf2eeab3SmrgAC_MSG_RESULT([$BUILDPDFDOC])
186914c0a534Smrg
1870576bae58SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1871bf2eeab3SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1872bf2eeab3SmrgMAKE_PDF="$PS2PDF"
1873bf2eeab3SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
187414c0a534Smrg
1875bf2eeab3SmrgAC_SUBST(MAKE_TEXT)
1876bf2eeab3SmrgAC_SUBST(MAKE_PS)
1877bf2eeab3SmrgAC_SUBST(MAKE_PDF)
1878bf2eeab3SmrgAC_SUBST(MAKE_HTML)
1879bf2eeab3Smrg]) # XORG_CHECK_LINUXDOC
1880bf2eeab3Smrg
1881bf2eeab3Smrg# XORG_CHECK_DOCBOOK
1882bf2eeab3Smrg# -------------------
1883bf2eeab3Smrg# Minimum version: 1.0.0
1884bf2eeab3Smrg#
1885bf2eeab3Smrg# Checks for the ability to build output formats from SGML DocBook source.
1886bf2eeab3Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1887bf2eeab3Smrg# indicates whether the necessary tools and files are found and, if set,
1888bf2eeab3Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1889bf2eeab3SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1890576bae58SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1891576bae58Smrg
1892bf2eeab3SmrgBUILDTXTDOC=no
1893bf2eeab3SmrgBUILDPDFDOC=no
1894bf2eeab3SmrgBUILDPSDOC=no
1895bf2eeab3SmrgBUILDHTMLDOC=no
1896bf2eeab3Smrg
1897bf2eeab3SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1898bf2eeab3SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1899bf2eeab3SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1900bf2eeab3SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1901bf2eeab3Smrg
1902576bae58SmrgAC_MSG_CHECKING([whether to build text documentation])
1903576bae58Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1904bf2eeab3Smrg   test x$BUILD_TXTDOC != xno; then
1905bf2eeab3Smrg	BUILDTXTDOC=yes
1906bf2eeab3Smrgfi
1907bf2eeab3SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1908bf2eeab3SmrgAC_MSG_RESULT([$BUILDTXTDOC])
190914c0a534Smrg
1910576bae58SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1911576bae58Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1912bf2eeab3Smrg   test x$BUILD_PDFDOC != xno; then
1913bf2eeab3Smrg	BUILDPDFDOC=yes
191414c0a534Smrgfi
1915bf2eeab3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1916bf2eeab3SmrgAC_MSG_RESULT([$BUILDPDFDOC])
191714c0a534Smrg
1918576bae58SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1919576bae58Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1920bf2eeab3Smrg   test x$BUILD_PSDOC != xno; then
1921bf2eeab3Smrg	BUILDPSDOC=yes
1922bf2eeab3Smrgfi
1923bf2eeab3SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1924bf2eeab3SmrgAC_MSG_RESULT([$BUILDPSDOC])
192514c0a534Smrg
1926576bae58SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1927576bae58Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1928bf2eeab3Smrg   test x$BUILD_HTMLDOC != xno; then
1929bf2eeab3Smrg	BUILDHTMLDOC=yes
1930bf2eeab3Smrgfi
1931bf2eeab3SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1932bf2eeab3SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
193314c0a534Smrg
1934bf2eeab3SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1935bf2eeab3SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1936bf2eeab3SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1937bf2eeab3SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
193814c0a534Smrg
1939bf2eeab3SmrgAC_SUBST(MAKE_TEXT)
1940bf2eeab3SmrgAC_SUBST(MAKE_PS)
1941bf2eeab3SmrgAC_SUBST(MAKE_PDF)
1942bf2eeab3SmrgAC_SUBST(MAKE_HTML)
1943bf2eeab3Smrg]) # XORG_CHECK_DOCBOOK
194414c0a534Smrg
19451a054510Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1946576bae58Smrg# ----------------
1947576bae58Smrg# Minimum version: 1.5.0
19481a054510Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1949576bae58Smrg#
1950576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
1951576bae58Smrg# not at the appropriate level. This macro enables a module to test for the
1952576bae58Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
19537015785aSmrg# the --with-xmlto option, it allows maximum flexibility in making decisions
19541a054510Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
19551a054510Smrg# --with-xmlto assumes 'auto'.
1956576bae58Smrg#
1957576bae58Smrg# Interface to module:
1958576bae58Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1959576bae58Smrg# XMLTO:	returns the path of the xmlto program found
1960576bae58Smrg#		returns the path set by the user in the environment
1961576bae58Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1962576bae58Smrg#		'no' user instructs the module not to use xmlto
1963576bae58Smrg#
1964576bae58Smrg# Added in version 1.10.0
1965576bae58Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1966576bae58Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1967576bae58Smrg#
1968576bae58Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1969576bae58Smrg#
1970576bae58SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1971576bae58SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
19721a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
1973576bae58SmrgAC_ARG_WITH(xmlto,
1974576bae58Smrg	AS_HELP_STRING([--with-xmlto],
19751a054510Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
19761a054510Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
19771a054510Smrgm4_undefine([_defopt])
1978576bae58Smrg
1979576bae58Smrgif test "x$use_xmlto" = x"auto"; then
1980576bae58Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1981576bae58Smrg   if test "x$XMLTO" = "x"; then
1982576bae58Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1983576bae58Smrg	have_xmlto=no
1984576bae58Smrg   else
1985576bae58Smrg        have_xmlto=yes
1986576bae58Smrg   fi
1987576bae58Smrgelif test "x$use_xmlto" = x"yes" ; then
1988576bae58Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1989576bae58Smrg   if test "x$XMLTO" = "x"; then
1990576bae58Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1991576bae58Smrg   fi
1992576bae58Smrg   have_xmlto=yes
1993576bae58Smrgelif test "x$use_xmlto" = x"no" ; then
1994576bae58Smrg   if test "x$XMLTO" != "x"; then
1995576bae58Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1996576bae58Smrg   fi
1997576bae58Smrg   have_xmlto=no
1998576bae58Smrgelse
1999576bae58Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
2000576bae58Smrgfi
2001576bae58Smrg
2002576bae58Smrg# Test for a minimum version of xmlto, if provided.
2003576bae58Smrgm4_ifval([$1],
2004576bae58Smrg[if test "$have_xmlto" = yes; then
2005576bae58Smrg    # scrape the xmlto version
2006576bae58Smrg    AC_MSG_CHECKING([the xmlto version])
2007576bae58Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
2008576bae58Smrg    AC_MSG_RESULT([$xmlto_version])
2009576bae58Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
2010576bae58Smrg        [if test "x$use_xmlto" = xauto; then
2011576bae58Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
2012576bae58Smrg            have_xmlto=no
2013576bae58Smrg        else
2014576bae58Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
2015576bae58Smrg        fi])
2016576bae58Smrgfi])
2017576bae58Smrg
2018576bae58Smrg# Test for the ability of xmlto to generate a text target
2019bdc460c5Smrg#
2020bdc460c5Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
2021bdc460c5Smrg# following test for empty XML docbook files.
2022bdc460c5Smrg# For compatibility reasons use the following empty XML docbook file and if
2023bdc460c5Smrg# it fails try it again with a non-empty XML file.
2024576bae58Smrghave_xmlto_text=no
2025576bae58Smrgcat > conftest.xml << "EOF"
2026576bae58SmrgEOF
2027576bae58SmrgAS_IF([test "$have_xmlto" = yes],
2028576bae58Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2029576bae58Smrg             [have_xmlto_text=yes],
2030bdc460c5Smrg             [# Try it again with a non-empty XML file.
2031bdc460c5Smrg              cat > conftest.xml << "EOF"
2032bdc460c5Smrg<x></x>
2033bdc460c5SmrgEOF
2034bdc460c5Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2035bdc460c5Smrg                    [have_xmlto_text=yes],
2036bdc460c5Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
2037576bae58Smrgrm -f conftest.xml
2038576bae58SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
2039576bae58SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
2040576bae58Smrg]) # XORG_WITH_XMLTO
2041576bae58Smrg
20421a054510Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
20431a054510Smrg# --------------------------------------------
20441a054510Smrg# Minimum version: 1.12.0
20451a054510Smrg# Minimum version for optional DEFAULT argument: 1.12.0
20461a054510Smrg#
20471a054510Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
20481a054510Smrg# XML-based language used for the transformation of XML documents.
20491a054510Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
20501a054510Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
20511a054510Smrg# The XSLT processor is often used as a standalone tool for transformations.
20521a054510Smrg# It should not be assumed that this tool is used only to work with documnetation.
20531a054510Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
20541a054510Smrg#
20551a054510Smrg# Interface to module:
20561a054510Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
20571a054510Smrg# XSLTPROC:	 returns the path of the xsltproc program found
20581a054510Smrg#		 returns the path set by the user in the environment
20591a054510Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
20601a054510Smrg#		  'no' user instructs the module not to use xsltproc
20611a054510Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
20621a054510Smrg#
20631a054510Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
20641a054510Smrg#
20651a054510SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
20661a054510SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
20671a054510Smrg# Preserves the interface, should it be implemented later
20681a054510Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
20691a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
20701a054510SmrgAC_ARG_WITH(xsltproc,
20711a054510Smrg	AS_HELP_STRING([--with-xsltproc],
20721a054510Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
20731a054510Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
20741a054510Smrgm4_undefine([_defopt])
20751a054510Smrg
20761a054510Smrgif test "x$use_xsltproc" = x"auto"; then
20771a054510Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
20781a054510Smrg   if test "x$XSLTPROC" = "x"; then
20791a054510Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
20801a054510Smrg	have_xsltproc=no
20811a054510Smrg   else
20821a054510Smrg        have_xsltproc=yes
20831a054510Smrg   fi
20841a054510Smrgelif test "x$use_xsltproc" = x"yes" ; then
20851a054510Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
20861a054510Smrg   if test "x$XSLTPROC" = "x"; then
20871a054510Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
20881a054510Smrg   fi
20891a054510Smrg   have_xsltproc=yes
20901a054510Smrgelif test "x$use_xsltproc" = x"no" ; then
20911a054510Smrg   if test "x$XSLTPROC" != "x"; then
20921a054510Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
20931a054510Smrg   fi
20941a054510Smrg   have_xsltproc=no
20951a054510Smrgelse
20961a054510Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
20971a054510Smrgfi
20981a054510Smrg
20991a054510SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
21001a054510Smrg]) # XORG_WITH_XSLTPROC
21011a054510Smrg
21021a054510Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
21031a054510Smrg# ----------------------------------------
21041a054510Smrg# Minimum version: 1.15.0
21051a054510Smrg#
21061a054510Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
21071a054510Smrg# scanning arbitrary text files, extracting information from those text files,
21081a054510Smrg# and printing reports based on that information.
21091a054510Smrg#
21101a054510Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
21111a054510Smrg#
21121a054510Smrg# Interface to module:
21131a054510Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
21141a054510Smrg# PERL:	     returns the path of the perl program found
21151a054510Smrg#	     returns the path set by the user in the environment
21161a054510Smrg# --with-perl: 'yes' user instructs the module to use perl
21171a054510Smrg#	       'no' user instructs the module not to use perl
21181a054510Smrg# have_perl: returns yes if perl found in PATH or no
21191a054510Smrg#
21201a054510Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
21211a054510Smrg#
21221a054510SmrgAC_DEFUN([XORG_WITH_PERL],[
21231a054510SmrgAC_ARG_VAR([PERL], [Path to perl command])
21241a054510Smrg# Preserves the interface, should it be implemented later
21251a054510Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
21261a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
21271a054510SmrgAC_ARG_WITH(perl,
21281a054510Smrg	AS_HELP_STRING([--with-perl],
21291a054510Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
21301a054510Smrg	   [use_perl=$withval], [use_perl=]_defopt)
21311a054510Smrgm4_undefine([_defopt])
21321a054510Smrg
21331a054510Smrgif test "x$use_perl" = x"auto"; then
21341a054510Smrg   AC_PATH_PROG([PERL], [perl])
21351a054510Smrg   if test "x$PERL" = "x"; then
21361a054510Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
21371a054510Smrg	have_perl=no
21381a054510Smrg   else
21391a054510Smrg        have_perl=yes
21401a054510Smrg   fi
21411a054510Smrgelif test "x$use_perl" = x"yes" ; then
21421a054510Smrg   AC_PATH_PROG([PERL], [perl])
21431a054510Smrg   if test "x$PERL" = "x"; then
21441a054510Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
21451a054510Smrg   fi
21461a054510Smrg   have_perl=yes
21471a054510Smrgelif test "x$use_perl" = x"no" ; then
21481a054510Smrg   if test "x$PERL" != "x"; then
21491a054510Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
21501a054510Smrg   fi
21511a054510Smrg   have_perl=no
21521a054510Smrgelse
21531a054510Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
21541a054510Smrgfi
21551a054510Smrg
21561a054510SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
21571a054510Smrg]) # XORG_WITH_PERL
21581a054510Smrg
21591a054510Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2160576bae58Smrg# ----------------
2161576bae58Smrg# Minimum version: 1.5.0
21621a054510Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2163576bae58Smrg#
2164576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
2165576bae58Smrg# not at the appropriate level. This macro enables a module to test for the
2166576bae58Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
21677015785aSmrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
21681a054510Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
21691a054510Smrg# --with-asciidoc assumes 'auto'.
2170576bae58Smrg#
2171576bae58Smrg# Interface to module:
2172576bae58Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2173576bae58Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
2174576bae58Smrg#		 returns the path set by the user in the environment
2175576bae58Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2176576bae58Smrg#		  'no' user instructs the module not to use asciidoc
2177576bae58Smrg#
2178576bae58Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2179576bae58Smrg#
2180576bae58SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2181576bae58SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
21821a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
2183576bae58SmrgAC_ARG_WITH(asciidoc,
2184576bae58Smrg	AS_HELP_STRING([--with-asciidoc],
21851a054510Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
21861a054510Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
21871a054510Smrgm4_undefine([_defopt])
2188576bae58Smrg
2189576bae58Smrgif test "x$use_asciidoc" = x"auto"; then
2190576bae58Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2191576bae58Smrg   if test "x$ASCIIDOC" = "x"; then
2192576bae58Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2193576bae58Smrg	have_asciidoc=no
2194576bae58Smrg   else
2195576bae58Smrg        have_asciidoc=yes
2196576bae58Smrg   fi
2197576bae58Smrgelif test "x$use_asciidoc" = x"yes" ; then
2198576bae58Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2199576bae58Smrg   if test "x$ASCIIDOC" = "x"; then
2200576bae58Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2201576bae58Smrg   fi
2202576bae58Smrg   have_asciidoc=yes
2203576bae58Smrgelif test "x$use_asciidoc" = x"no" ; then
2204576bae58Smrg   if test "x$ASCIIDOC" != "x"; then
2205576bae58Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2206576bae58Smrg   fi
2207576bae58Smrg   have_asciidoc=no
2208576bae58Smrgelse
2209576bae58Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2210576bae58Smrgfi
2211576bae58Smrgm4_ifval([$1],
2212576bae58Smrg[if test "$have_asciidoc" = yes; then
2213576bae58Smrg    # scrape the asciidoc version
2214576bae58Smrg    AC_MSG_CHECKING([the asciidoc version])
2215576bae58Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2216576bae58Smrg    AC_MSG_RESULT([$asciidoc_version])
2217576bae58Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2218576bae58Smrg        [if test "x$use_asciidoc" = xauto; then
2219576bae58Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2220576bae58Smrg            have_asciidoc=no
2221576bae58Smrg        else
2222576bae58Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2223576bae58Smrg        fi])
2224576bae58Smrgfi])
2225576bae58SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2226576bae58Smrg]) # XORG_WITH_ASCIIDOC
2227576bae58Smrg
22281a054510Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
222924047306Smrg# -------------------------------------------
2230576bae58Smrg# Minimum version: 1.5.0
22311a054510Smrg# Minimum version for optional DEFAULT argument: 1.11.0
223224047306Smrg# Minimum version for optional DOT checking: 1.18.0
2233576bae58Smrg#
2234576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
2235576bae58Smrg# not at the appropriate level. This macro enables a module to test for the
2236576bae58Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
22377015785aSmrg# the --with-doxygen option, it allows maximum flexibility in making decisions
22381a054510Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
22391a054510Smrg# --with-doxygen assumes 'auto'.
2240576bae58Smrg#
2241576bae58Smrg# Interface to module:
2242576bae58Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2243576bae58Smrg# DOXYGEN:	 returns the path of the doxygen program found
2244576bae58Smrg#		 returns the path set by the user in the environment
2245576bae58Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2246576bae58Smrg#		  'no' user instructs the module not to use doxygen
2247576bae58Smrg#
2248576bae58Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2249576bae58Smrg#
2250576bae58SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2251576bae58SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
225224047306SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
22531a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
2254576bae58SmrgAC_ARG_WITH(doxygen,
2255576bae58Smrg	AS_HELP_STRING([--with-doxygen],
22561a054510Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
22571a054510Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
22581a054510Smrgm4_undefine([_defopt])
2259576bae58Smrg
2260576bae58Smrgif test "x$use_doxygen" = x"auto"; then
2261576bae58Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2262576bae58Smrg   if test "x$DOXYGEN" = "x"; then
2263576bae58Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2264576bae58Smrg	have_doxygen=no
2265576bae58Smrg   else
2266576bae58Smrg        have_doxygen=yes
2267576bae58Smrg   fi
2268576bae58Smrgelif test "x$use_doxygen" = x"yes" ; then
2269576bae58Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2270576bae58Smrg   if test "x$DOXYGEN" = "x"; then
2271576bae58Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2272576bae58Smrg   fi
2273576bae58Smrg   have_doxygen=yes
2274576bae58Smrgelif test "x$use_doxygen" = x"no" ; then
2275576bae58Smrg   if test "x$DOXYGEN" != "x"; then
2276576bae58Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2277576bae58Smrg   fi
2278576bae58Smrg   have_doxygen=no
2279576bae58Smrgelse
2280576bae58Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2281576bae58Smrgfi
2282576bae58Smrgm4_ifval([$1],
2283576bae58Smrg[if test "$have_doxygen" = yes; then
2284576bae58Smrg    # scrape the doxygen version
2285576bae58Smrg    AC_MSG_CHECKING([the doxygen version])
2286576bae58Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2287576bae58Smrg    AC_MSG_RESULT([$doxygen_version])
2288576bae58Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2289576bae58Smrg        [if test "x$use_doxygen" = xauto; then
2290576bae58Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2291576bae58Smrg            have_doxygen=no
2292576bae58Smrg        else
2293576bae58Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2294576bae58Smrg        fi])
2295576bae58Smrgfi])
229624047306Smrg
229724047306Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
229824047306Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
229924047306Smrgdnl 	HAVE_DOT = @HAVE_DOT@
230024047306SmrgHAVE_DOT=no
230124047306Smrgif test "x$have_doxygen" = "xyes"; then
230224047306Smrg  AC_PATH_PROG([DOT], [dot])
230324047306Smrg    if test "x$DOT" != "x"; then
230424047306Smrg      HAVE_DOT=yes
230524047306Smrg    fi
230624047306Smrgfi
230724047306Smrg
230824047306SmrgAC_SUBST([HAVE_DOT])
230924047306SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2310576bae58SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2311576bae58Smrg]) # XORG_WITH_DOXYGEN
2312576bae58Smrg
23131a054510Smrg# XORG_WITH_GROFF([DEFAULT])
2314576bae58Smrg# ----------------
2315576bae58Smrg# Minimum version: 1.6.0
23161a054510Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2317576bae58Smrg#
2318576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
2319576bae58Smrg# not at the appropriate level. This macro enables a module to test for the
2320576bae58Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
23217015785aSmrg# the --with-groff option, it allows maximum flexibility in making decisions
23221a054510Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
23231a054510Smrg# --with-groff assumes 'auto'.
2324576bae58Smrg#
2325576bae58Smrg# Interface to module:
2326576bae58Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2327576bae58Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2328576bae58Smrg# HAVE_GROFF_MS: the -ms macros package
2329576bae58Smrg# GROFF:	 returns the path of the groff program found
2330576bae58Smrg#		 returns the path set by the user in the environment
2331576bae58Smrg# --with-groff:	 'yes' user instructs the module to use groff
2332576bae58Smrg#		 'no' user instructs the module not to use groff
2333576bae58Smrg#
2334576bae58Smrg# Added in version 1.9.0:
2335576bae58Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2336576bae58Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2337576bae58Smrg#		   psselect from the psutils package.
2338576bae58Smrg#		   the ghostcript package. Refer to the grohtml man pages
2339576bae58Smrg#
2340576bae58Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2341576bae58Smrg#
2342576bae58Smrg# OS and distros often splits groff in a basic and full package, the former
2343576bae58Smrg# having the groff program and the later having devices, fonts and macros
2344576bae58Smrg# Checking for the groff executable is not enough.
2345576bae58Smrg#
2346576bae58Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
2347576bae58Smrg# unset HAVE_GROFF or GROFF env variables.
2348576bae58Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2349576bae58Smrg#
2350576bae58SmrgAC_DEFUN([XORG_WITH_GROFF],[
2351576bae58SmrgAC_ARG_VAR([GROFF], [Path to groff command])
23521a054510Smrgm4_define([_defopt], m4_default([$1], [auto]))
2353576bae58SmrgAC_ARG_WITH(groff,
2354576bae58Smrg	AS_HELP_STRING([--with-groff],
23551a054510Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
23561a054510Smrg	   [use_groff=$withval], [use_groff=]_defopt)
23571a054510Smrgm4_undefine([_defopt])
2358576bae58Smrg
2359576bae58Smrgif test "x$use_groff" = x"auto"; then
2360576bae58Smrg   AC_PATH_PROG([GROFF], [groff])
2361576bae58Smrg   if test "x$GROFF" = "x"; then
2362576bae58Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2363576bae58Smrg	have_groff=no
2364576bae58Smrg   else
2365576bae58Smrg        have_groff=yes
2366576bae58Smrg   fi
2367576bae58Smrgelif test "x$use_groff" = x"yes" ; then
2368576bae58Smrg   AC_PATH_PROG([GROFF], [groff])
2369576bae58Smrg   if test "x$GROFF" = "x"; then
2370576bae58Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2371576bae58Smrg   fi
2372576bae58Smrg   have_groff=yes
2373576bae58Smrgelif test "x$use_groff" = x"no" ; then
2374576bae58Smrg   if test "x$GROFF" != "x"; then
2375576bae58Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2376576bae58Smrg   fi
2377576bae58Smrg   have_groff=no
2378576bae58Smrgelse
2379576bae58Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2380576bae58Smrgfi
2381576bae58Smrg
2382576bae58Smrg# We have groff, test for the presence of the macro packages
2383576bae58Smrgif test "x$have_groff" = x"yes"; then
2384576bae58Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2385576bae58Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2386576bae58Smrg        groff_ms_works=yes
2387576bae58Smrg    else
2388576bae58Smrg        groff_ms_works=no
2389576bae58Smrg    fi
2390576bae58Smrg    AC_MSG_RESULT([$groff_ms_works])
2391576bae58Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2392576bae58Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2393576bae58Smrg        groff_mm_works=yes
2394576bae58Smrg    else
2395576bae58Smrg        groff_mm_works=no
2396576bae58Smrg    fi
2397576bae58Smrg    AC_MSG_RESULT([$groff_mm_works])
2398576bae58Smrgfi
2399576bae58Smrg
2400576bae58Smrg# We have groff, test for HTML dependencies, one command per package
2401576bae58Smrgif test "x$have_groff" = x"yes"; then
2402576bae58Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2403576bae58Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2404576bae58Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2405576bae58Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2406576bae58Smrg      have_groff_html=yes
2407576bae58Smrg   else
2408576bae58Smrg      have_groff_html=no
2409576bae58Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2410576bae58Smrg   fi
2411576bae58Smrgfi
2412576bae58Smrg
2413576bae58Smrg# Set Automake conditionals for Makefiles
2414576bae58SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2415576bae58SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2416576bae58SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2417576bae58SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2418576bae58Smrg]) # XORG_WITH_GROFF
2419576bae58Smrg
24201a054510Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
24211a054510Smrg# ---------------------------------------
2422576bae58Smrg# Minimum version: 1.6.0
24231a054510Smrg# Minimum version for optional DEFAULT argument: 1.11.0
24241a054510Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2425576bae58Smrg#
2426576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
2427576bae58Smrg# not at the appropriate level. This macro enables a module to test for the
2428576bae58Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
24297015785aSmrg# the --with-fop option, it allows maximum flexibility in making decisions
24301a054510Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
24311a054510Smrg# --with-fop assumes 'auto'.
2432576bae58Smrg#
2433576bae58Smrg# Interface to module:
2434576bae58Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2435576bae58Smrg# FOP:	 	returns the path of the fop program found
2436576bae58Smrg#		returns the path set by the user in the environment
2437576bae58Smrg# --with-fop: 	'yes' user instructs the module to use fop
2438576bae58Smrg#		'no' user instructs the module not to use fop
2439576bae58Smrg#
2440576bae58Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2441576bae58Smrg#
2442576bae58SmrgAC_DEFUN([XORG_WITH_FOP],[
2443576bae58SmrgAC_ARG_VAR([FOP], [Path to fop command])
24441a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
2445576bae58SmrgAC_ARG_WITH(fop,
2446576bae58Smrg	AS_HELP_STRING([--with-fop],
24471a054510Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
24481a054510Smrg	   [use_fop=$withval], [use_fop=]_defopt)
24491a054510Smrgm4_undefine([_defopt])
2450576bae58Smrg
2451576bae58Smrgif test "x$use_fop" = x"auto"; then
2452576bae58Smrg   AC_PATH_PROG([FOP], [fop])
2453576bae58Smrg   if test "x$FOP" = "x"; then
2454576bae58Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2455576bae58Smrg	have_fop=no
2456576bae58Smrg   else
2457576bae58Smrg        have_fop=yes
2458576bae58Smrg   fi
2459576bae58Smrgelif test "x$use_fop" = x"yes" ; then
2460576bae58Smrg   AC_PATH_PROG([FOP], [fop])
2461576bae58Smrg   if test "x$FOP" = "x"; then
2462576bae58Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2463576bae58Smrg   fi
2464576bae58Smrg   have_fop=yes
2465576bae58Smrgelif test "x$use_fop" = x"no" ; then
2466576bae58Smrg   if test "x$FOP" != "x"; then
2467576bae58Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2468576bae58Smrg   fi
2469576bae58Smrg   have_fop=no
2470576bae58Smrgelse
2471576bae58Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2472576bae58Smrgfi
24731a054510Smrg
24741a054510Smrg# Test for a minimum version of fop, if provided.
24751a054510Smrgm4_ifval([$1],
24761a054510Smrg[if test "$have_fop" = yes; then
24771a054510Smrg    # scrape the fop version
24781a054510Smrg    AC_MSG_CHECKING([for fop minimum version])
24791a054510Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
24801a054510Smrg    AC_MSG_RESULT([$fop_version])
24811a054510Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
24821a054510Smrg        [if test "x$use_fop" = xauto; then
24831a054510Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
24841a054510Smrg            have_fop=no
24851a054510Smrg        else
24861a054510Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
24871a054510Smrg        fi])
24881a054510Smrgfi])
2489576bae58SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2490576bae58Smrg]) # XORG_WITH_FOP
2491576bae58Smrg
249224047306Smrg# XORG_WITH_M4([MIN-VERSION])
249324047306Smrg# ---------------------------
249424047306Smrg# Minimum version: 1.19.0
249524047306Smrg#
249624047306Smrg# This macro attempts to locate an m4 macro processor which supports
249724047306Smrg# -I option and is only useful for modules relying on M4 in order to
249824047306Smrg# expand macros in source code files.
249924047306Smrg#
250024047306Smrg# Interface to module:
250124047306Smrg# M4:	 	returns the path of the m4 program found
250224047306Smrg#		returns the path set by the user in the environment
250324047306Smrg#
250424047306SmrgAC_DEFUN([XORG_WITH_M4], [
250524047306SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
250624047306Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
250724047306Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
250824047306Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
250924047306Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
251024047306Smrg   [$PATH:/usr/gnu/bin])])
251124047306Smrg
251224047306SmrgAC_SUBST([M4], [$ac_cv_path_M4])
251324047306Smrg]) # XORG_WITH_M4
251424047306Smrg
25151a054510Smrg# XORG_WITH_PS2PDF([DEFAULT])
2516576bae58Smrg# ----------------
2517576bae58Smrg# Minimum version: 1.6.0
25181a054510Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2519576bae58Smrg#
2520576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
2521576bae58Smrg# not at the appropriate level. This macro enables a module to test for the
2522576bae58Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
25237015785aSmrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
25241a054510Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
25251a054510Smrg# --with-ps2pdf assumes 'auto'.
2526576bae58Smrg#
2527576bae58Smrg# Interface to module:
2528576bae58Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2529576bae58Smrg# PS2PDF:	returns the path of the ps2pdf program found
2530576bae58Smrg#		returns the path set by the user in the environment
2531576bae58Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2532576bae58Smrg#		 'no' user instructs the module not to use ps2pdf
2533576bae58Smrg#
2534576bae58Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2535576bae58Smrg#
2536576bae58SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2537576bae58SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
25381a054510Smrgm4_define([_defopt], m4_default([$1], [auto]))
2539576bae58SmrgAC_ARG_WITH(ps2pdf,
2540576bae58Smrg	AS_HELP_STRING([--with-ps2pdf],
25411a054510Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
25421a054510Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
25431a054510Smrgm4_undefine([_defopt])
2544576bae58Smrg
2545576bae58Smrgif test "x$use_ps2pdf" = x"auto"; then
2546576bae58Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2547576bae58Smrg   if test "x$PS2PDF" = "x"; then
2548576bae58Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2549576bae58Smrg	have_ps2pdf=no
2550576bae58Smrg   else
2551576bae58Smrg        have_ps2pdf=yes
2552576bae58Smrg   fi
2553576bae58Smrgelif test "x$use_ps2pdf" = x"yes" ; then
2554576bae58Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2555576bae58Smrg   if test "x$PS2PDF" = "x"; then
2556576bae58Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2557576bae58Smrg   fi
2558576bae58Smrg   have_ps2pdf=yes
2559576bae58Smrgelif test "x$use_ps2pdf" = x"no" ; then
2560576bae58Smrg   if test "x$PS2PDF" != "x"; then
2561576bae58Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2562576bae58Smrg   fi
2563576bae58Smrg   have_ps2pdf=no
2564576bae58Smrgelse
2565576bae58Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2566576bae58Smrgfi
2567576bae58SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2568576bae58Smrg]) # XORG_WITH_PS2PDF
2569576bae58Smrg
2570576bae58Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
2571576bae58Smrg# ----------------
2572576bae58Smrg# Minimum version: 1.6.0
2573576bae58Smrg#
2574576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
2575576bae58Smrg# not at the appropriate level. This macro enables a builder to skip all
2576576bae58Smrg# documentation targets except traditional man pages.
2577576bae58Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
25787015785aSmrg# maximum flexibility in controlling documentation building.
2579576bae58Smrg# Refer to:
2580576bae58Smrg# XORG_WITH_XMLTO         --with-xmlto
2581576bae58Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2582576bae58Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2583576bae58Smrg# XORG_WITH_FOP           --with-fop
2584576bae58Smrg# XORG_WITH_GROFF         --with-groff
2585576bae58Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2586576bae58Smrg#
2587576bae58Smrg# Interface to module:
2588576bae58Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2589576bae58Smrg# --enable-docs: 'yes' user instructs the module to generate docs
2590576bae58Smrg#		 'no' user instructs the module not to generate docs
2591576bae58Smrg# parm1:	specify the default value, yes or no.
2592576bae58Smrg#
2593576bae58SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
25941a054510Smrgm4_define([docs_default], m4_default([$1], [yes]))
2595576bae58SmrgAC_ARG_ENABLE(docs,
2596576bae58Smrg	AS_HELP_STRING([--enable-docs],
25971a054510Smrg	   [Enable building the documentation (default: ]docs_default[)]),
25981a054510Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
25991a054510Smrgm4_undefine([docs_default])
2600576bae58SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2601576bae58SmrgAC_MSG_CHECKING([whether to build documentation])
2602576bae58SmrgAC_MSG_RESULT([$build_docs])
2603576bae58Smrg]) # XORG_ENABLE_DOCS
2604576bae58Smrg
2605576bae58Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2606576bae58Smrg# ----------------
2607576bae58Smrg# Minimum version: 1.6.0
2608576bae58Smrg#
2609576bae58Smrg# This macro enables a builder to skip all developer documentation.
2610576bae58Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
26117015785aSmrg# maximum flexibility in controlling documentation building.
2612576bae58Smrg# Refer to:
2613576bae58Smrg# XORG_WITH_XMLTO         --with-xmlto
2614576bae58Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2615576bae58Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2616576bae58Smrg# XORG_WITH_FOP           --with-fop
2617576bae58Smrg# XORG_WITH_GROFF         --with-groff
2618576bae58Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2619576bae58Smrg#
2620576bae58Smrg# Interface to module:
2621576bae58Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2622576bae58Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2623576bae58Smrg#			'no' user instructs the module not to generate developer docs
2624576bae58Smrg# parm1:		specify the default value, yes or no.
2625576bae58Smrg#
2626576bae58SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
26271a054510Smrgm4_define([devel_default], m4_default([$1], [yes]))
2628576bae58SmrgAC_ARG_ENABLE(devel-docs,
2629576bae58Smrg	AS_HELP_STRING([--enable-devel-docs],
26301a054510Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
26311a054510Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
26321a054510Smrgm4_undefine([devel_default])
2633576bae58SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2634576bae58SmrgAC_MSG_CHECKING([whether to build developer documentation])
2635576bae58SmrgAC_MSG_RESULT([$build_devel_docs])
2636576bae58Smrg]) # XORG_ENABLE_DEVEL_DOCS
2637576bae58Smrg
2638576bae58Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2639576bae58Smrg# ----------------
2640576bae58Smrg# Minimum version: 1.6.0
2641576bae58Smrg#
2642576bae58Smrg# This macro enables a builder to skip all functional specification targets.
2643576bae58Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
26447015785aSmrg# maximum flexibility in controlling documentation building.
2645576bae58Smrg# Refer to:
2646576bae58Smrg# XORG_WITH_XMLTO         --with-xmlto
2647576bae58Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2648576bae58Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2649576bae58Smrg# XORG_WITH_FOP           --with-fop
2650576bae58Smrg# XORG_WITH_GROFF         --with-groff
2651576bae58Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2652576bae58Smrg#
2653576bae58Smrg# Interface to module:
2654576bae58Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2655576bae58Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2656576bae58Smrg#			'no' user instructs the module not to generate specs
2657576bae58Smrg# parm1:		specify the default value, yes or no.
2658576bae58Smrg#
2659576bae58SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
26601a054510Smrgm4_define([spec_default], m4_default([$1], [yes]))
2661576bae58SmrgAC_ARG_ENABLE(specs,
2662576bae58Smrg	AS_HELP_STRING([--enable-specs],
26631a054510Smrg	   [Enable building the specs (default: ]spec_default[)]),
26641a054510Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
26651a054510Smrgm4_undefine([spec_default])
2666576bae58SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2667576bae58SmrgAC_MSG_CHECKING([whether to build functional specifications])
2668576bae58SmrgAC_MSG_RESULT([$build_specs])
2669576bae58Smrg]) # XORG_ENABLE_SPECS
2670576bae58Smrg
26711a054510Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
26721a054510Smrg# ----------------------------------------------
26731a054510Smrg# Minimum version: 1.13.0
26741a054510Smrg#
26751a054510Smrg# This macro enables a builder to enable/disable unit testing
26761a054510Smrg# It makes no assumption about the test cases implementation
26771a054510Smrg# Test cases may or may not use Automake "Support for test suites"
26781a054510Smrg# They may or may not use the software utility library GLib
26791a054510Smrg#
26801a054510Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
26811a054510Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
26821a054510Smrg# The variable enable_unit_tests is used by other macros in this file.
26831a054510Smrg#
26841a054510Smrg# Interface to module:
26851a054510Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
26861a054510Smrg# enable_unit_tests:    used in configure.ac for additional configuration
26871a054510Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
26881a054510Smrg#			'no' user instructs the module not to build tests
26891a054510Smrg# parm1:		specify the default value, yes or no.
26901a054510Smrg#
26911a054510SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
26921a054510SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
26931a054510SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
269424047306SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
26951a054510Smrgm4_define([_defopt], m4_default([$1], [auto]))
26961a054510SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
26971a054510Smrg	[Enable building unit test cases (default: ]_defopt[)]),
26981a054510Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
26991a054510Smrgm4_undefine([_defopt])
27001a054510SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
27011a054510SmrgAC_MSG_CHECKING([whether to build unit test cases])
27021a054510SmrgAC_MSG_RESULT([$enable_unit_tests])
27031a054510Smrg]) # XORG_ENABLE_UNIT_TESTS
27041a054510Smrg
270524047306Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
270624047306Smrg# ------------------------------------------------------
270724047306Smrg# Minimum version: 1.17.0
270824047306Smrg#
270924047306Smrg# This macro enables a builder to enable/disable integration testing
271024047306Smrg# It makes no assumption about the test cases' implementation
271124047306Smrg# Test cases may or may not use Automake "Support for test suites"
271224047306Smrg#
271324047306Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
271424047306Smrg# usually requires less dependencies and may be built and run under less
271524047306Smrg# stringent environments than integration tests.
271624047306Smrg#
271724047306Smrg# Interface to module:
271824047306Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
271924047306Smrg# enable_integration_tests:   used in configure.ac for additional configuration
272024047306Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
272124047306Smrg#                             'no' user instructs the module not to build tests
272224047306Smrg# parm1:                      specify the default value, yes or no.
272324047306Smrg#
272424047306SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
272524047306SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
272624047306Smrgm4_define([_defopt], m4_default([$1], [auto]))
272724047306SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
272824047306Smrg	[Enable building integration test cases (default: ]_defopt[)]),
272924047306Smrg	[enable_integration_tests=$enableval],
273024047306Smrg	[enable_integration_tests=]_defopt)
273124047306Smrgm4_undefine([_defopt])
273224047306SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
273324047306Smrg	[test "x$enable_integration_tests" != xno])
273424047306SmrgAC_MSG_CHECKING([whether to build unit test cases])
273524047306SmrgAC_MSG_RESULT([$enable_integration_tests])
273624047306Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
273724047306Smrg
27381a054510Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
27391a054510Smrg# ----------------------------------------
27401a054510Smrg# Minimum version: 1.13.0
27411a054510Smrg#
27421a054510Smrg# GLib is a library which provides advanced data structures and functions.
27431a054510Smrg# This macro enables a module to test for the presence of Glib.
27441a054510Smrg#
27451a054510Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
27461a054510Smrg# Otherwise the value of $enable_unit_tests is blank.
27471a054510Smrg#
274824047306Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
274924047306Smrg# test support usually requires less dependencies and may be built and run under
275024047306Smrg# less stringent environments than integration tests.
275124047306Smrg#
27521a054510Smrg# Interface to module:
27531a054510Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
27541a054510Smrg# with_glib: used in configure.ac to know if GLib has been found
27551a054510Smrg# --with-glib:	'yes' user instructs the module to use glib
27561a054510Smrg#		'no' user instructs the module not to use glib
27571a054510Smrg#
27581a054510SmrgAC_DEFUN([XORG_WITH_GLIB],[
27591a054510SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
27601a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
27611a054510SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
27621a054510Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
27631a054510Smrg	[with_glib=$withval], [with_glib=]_defopt)
27641a054510Smrgm4_undefine([_defopt])
27651a054510Smrg
27661a054510Smrghave_glib=no
27671a054510Smrg# Do not probe GLib if user explicitly disabled unit testing
27681a054510Smrgif test "x$enable_unit_tests" != x"no"; then
27691a054510Smrg  # Do not probe GLib if user explicitly disabled it
27701a054510Smrg  if test "x$with_glib" != x"no"; then
27711a054510Smrg    m4_ifval(
27721a054510Smrg      [$1],
27731a054510Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
27741a054510Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
27751a054510Smrg    )
27761a054510Smrg  fi
27771a054510Smrgfi
27781a054510Smrg
27791a054510Smrg# Not having GLib when unit testing has been explicitly requested is an error
27801a054510Smrgif test "x$enable_unit_tests" = x"yes"; then
27811a054510Smrg  if test "x$have_glib" = x"no"; then
27821a054510Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
27831a054510Smrg  fi
27841a054510Smrgfi
27851a054510Smrg
27861a054510Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
27871a054510Smrgif test "x$enable_unit_tests" = x"no"; then
27881a054510Smrg  if test "x$with_glib" = x"yes"; then
27891a054510Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
27901a054510Smrg  fi
27911a054510Smrgfi
27921a054510Smrg
27931a054510Smrg# Not having GLib when it has been explicitly requested is an error
27941a054510Smrgif test "x$with_glib" = x"yes"; then
27951a054510Smrg  if test "x$have_glib" = x"no"; then
27961a054510Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
27971a054510Smrg  fi
27981a054510Smrgfi
27991a054510Smrg
28001a054510SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
28011a054510Smrg]) # XORG_WITH_GLIB
28021a054510Smrg
280324047306Smrg# XORG_LD_WRAP([required|optional])
280424047306Smrg# ---------------------------------
28051a054510Smrg# Minimum version: 1.13.0
28061a054510Smrg#
28071a054510Smrg# Check if linker supports -wrap, passed via compiler flags
28081a054510Smrg#
28091a054510Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
28101a054510Smrg# Otherwise the value of $enable_unit_tests is blank.
28111a054510Smrg#
281224047306Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
281324047306Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
281424047306Smrg# available, an argument of "optional" allows use when some unit tests require
281524047306Smrg# ld -wrap and others do not.
281624047306Smrg#
28171a054510SmrgAC_DEFUN([XORG_LD_WRAP],[
281824047306SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
281924047306Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
282024047306Smrg                      void __wrap_exit(int status) { return; }],
282124047306Smrg                     [exit(0);])])
28221a054510Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
282324047306Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
28241a054510Smrg  if test "x$have_ld_wrap" = x"no"; then
28251a054510Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
28261a054510Smrg  fi
28271a054510Smrgfi
28281a054510SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
28291a054510Smrg#
28301a054510Smrg]) # XORG_LD_WRAP
28311a054510Smrg
28321a054510Smrg# XORG_CHECK_LINKER_FLAGS
28331a054510Smrg# -----------------------
28341a054510Smrg# SYNOPSIS
28351a054510Smrg#
283624047306Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
28371a054510Smrg#
28381a054510Smrg# DESCRIPTION
28391a054510Smrg#
28401a054510Smrg#   Check whether the given linker FLAGS work with the current language's
28411a054510Smrg#   linker, or whether they give an error.
28421a054510Smrg#
28431a054510Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
28441a054510Smrg#   success/failure.
28451a054510Smrg#
284624047306Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
284724047306Smrg#
28481a054510Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
28491a054510Smrg#
28501a054510Smrg# LICENSE
28511a054510Smrg#
28521a054510Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
28531a054510Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
28541a054510Smrg#   Copyright (c) 2009 Matteo Frigo
28551a054510Smrg#
28561a054510Smrg#   This program is free software: you can redistribute it and/or modify it
28571a054510Smrg#   under the terms of the GNU General Public License as published by the
28581a054510Smrg#   Free Software Foundation, either version 3 of the License, or (at your
28591a054510Smrg#   option) any later version.
28601a054510Smrg#
28611a054510Smrg#   This program is distributed in the hope that it will be useful, but
28621a054510Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
28631a054510Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
28641a054510Smrg#   Public License for more details.
28651a054510Smrg#
28661a054510Smrg#   You should have received a copy of the GNU General Public License along
28671a054510Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
28681a054510Smrg#
28691a054510Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
28701a054510Smrg#   gives unlimited permission to copy, distribute and modify the configure
28711a054510Smrg#   scripts that are the output of Autoconf when processing the Macro. You
28721a054510Smrg#   need not follow the terms of the GNU General Public License when using
28731a054510Smrg#   or distributing such scripts, even though portions of the text of the
28741a054510Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
28751a054510Smrg#   all other use of the material that constitutes the Autoconf Macro.
28761a054510Smrg#
28771a054510Smrg#   This special exception to the GPL applies to versions of the Autoconf
28781a054510Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
28791a054510Smrg#   modified version of the Autoconf Macro, you may extend this special
28801a054510Smrg#   exception to the GPL to apply to your modified version as well.#
28811a054510SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
28821a054510Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
28831a054510Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
28841a054510SmrgAS_LITERAL_IF([$1],
28851a054510Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
28861a054510Smrg      ax_save_FLAGS=$LDFLAGS
28871a054510Smrg      LDFLAGS="$1"
288824047306Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
28891a054510Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
28901a054510Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
28911a054510Smrg      LDFLAGS=$ax_save_FLAGS])],
28921a054510Smrg  [ax_save_FLAGS=$LDFLAGS
28931a054510Smrg   LDFLAGS="$1"
28941a054510Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
28951a054510Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
28961a054510Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
28971a054510Smrg   LDFLAGS=$ax_save_FLAGS])
28981a054510Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
28991a054510SmrgAC_MSG_RESULT($xorg_check_linker_flags)
29001a054510Smrgif test "x$xorg_check_linker_flags" = xyes; then
29011a054510Smrg	m4_default([$2], :)
29021a054510Smrgelse
29031a054510Smrg	m4_default([$3], :)
29041a054510Smrgfi
29051a054510Smrg]) # XORG_CHECK_LINKER_FLAGS
29061a054510Smrg
290724047306Smrg# XORG_MEMORY_CHECK_FLAGS
290824047306Smrg# -----------------------
290924047306Smrg# Minimum version: 1.16.0
291024047306Smrg#
291124047306Smrg# This macro attempts to find appropriate memory checking functionality
291224047306Smrg# for various platforms which unit testing code may use to catch various
291324047306Smrg# forms of memory allocation and access errors in testing.
291424047306Smrg#
291524047306Smrg# Interface to module:
291624047306Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
291724047306Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
291824047306Smrg#
291924047306Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
292024047306Smrg#
292124047306SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
292224047306Smrg
292324047306SmrgAC_REQUIRE([AC_CANONICAL_HOST])
292424047306SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
292524047306Smrg           [Environment variables to enable memory checking in tests])
292624047306Smrg
292724047306Smrg# Check for different types of support on different platforms
292824047306Smrgcase $host_os in
292924047306Smrg    solaris*)
293024047306Smrg        AC_CHECK_LIB([umem], [umem_alloc],
293124047306Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
293224047306Smrg        ;;
293324047306Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
293424047306Smrg        # both directly and inverted, so should not be 0 or 255.
293524047306Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
293624047306Smrg        ;;
293724047306Smrg    darwin*)
293824047306Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
293924047306Smrg        ;;
294024047306Smrg    *bsd*)
294124047306Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
294224047306Smrg        ;;
294324047306Smrgesac
294424047306Smrg
294524047306Smrg# User supplied flags override default flags
294624047306Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
294724047306Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
294824047306Smrgfi
294924047306Smrg
295024047306SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
295124047306Smrg]) # XORG_WITH_LINT
295224047306Smrg
2953bf2eeab3Smrg# XORG_CHECK_MALLOC_ZERO
2954bf2eeab3Smrg# ----------------------
2955bf2eeab3Smrg# Minimum version: 1.0.0
2956bf2eeab3Smrg#
2957bf2eeab3Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2958bf2eeab3Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2959bf2eeab3Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
29607015785aSmrg#
29617015785aSmrg# No longer actually tests since there is no guarantee applications will
29627015785aSmrg# run with the same malloc implementation we tested against, and the cost
29637015785aSmrg# of always ensuring the size passed to malloc is non-zero is minimal now.
29647015785aSmrg# Still allows builders to override when they have complete control over
29657015785aSmrg# which malloc implementation will be used.
2966bf2eeab3SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2967bf2eeab3SmrgAC_ARG_ENABLE(malloc0returnsnull,
2968bf2eeab3Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
29697015785aSmrg		       [assume malloc(0) can return NULL (default: yes)]),
2970bf2eeab3Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
29717015785aSmrg	[MALLOC_ZERO_RETURNS_NULL=yes])
29727015785aSmrg
29737015785aSmrgAC_MSG_CHECKING([whether to act as if malloc(0) can return NULL])
2974bf2eeab3SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
297514c0a534Smrg
2976bf2eeab3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2977bf2eeab3Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2978bf2eeab3Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2979bf2eeab3Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2980bf2eeab3Smrgelse
2981bf2eeab3Smrg	MALLOC_ZERO_CFLAGS=""
2982bf2eeab3Smrg	XMALLOC_ZERO_CFLAGS=""
2983bf2eeab3Smrg	XTMALLOC_ZERO_CFLAGS=""
2984bf2eeab3Smrgfi
298514c0a534Smrg
2986bf2eeab3SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2987bf2eeab3SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2988bf2eeab3SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2989bf2eeab3Smrg]) # XORG_CHECK_MALLOC_ZERO
299014c0a534Smrg
2991bf2eeab3Smrg# XORG_WITH_LINT()
2992bf2eeab3Smrg# ----------------
2993bf2eeab3Smrg# Minimum version: 1.1.0
299414c0a534Smrg#
2995576bae58Smrg# This macro enables the use of a tool that flags some suspicious and
2996576bae58Smrg# non-portable constructs (likely to be bugs) in C language source code.
2997576bae58Smrg# It will attempt to locate the tool and use appropriate options.
2998576bae58Smrg# There are various lint type tools on different platforms.
2999576bae58Smrg#
3000576bae58Smrg# Interface to module:
3001576bae58Smrg# LINT:		returns the path to the tool found on the platform
3002576bae58Smrg#		or the value set to LINT on the configure cmd line
3003576bae58Smrg#		also an Automake conditional
3004576bae58Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
3005576bae58Smrg#
3006576bae58Smrg# --with-lint:	'yes' user instructs the module to use lint
3007576bae58Smrg#		'no' user instructs the module not to use lint (default)
3008576bae58Smrg#
3009576bae58Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
3010576bae58Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
3011bf2eeab3Smrg#
3012bf2eeab3SmrgAC_DEFUN([XORG_WITH_LINT],[
3013bf2eeab3Smrg
3014576bae58SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
3015576bae58SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
3016bf2eeab3SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
3017bf2eeab3Smrg		[Use a lint-style source code checker (default: disabled)])],
3018bf2eeab3Smrg		[use_lint=$withval], [use_lint=no])
3019576bae58Smrg
3020576bae58Smrg# Obtain platform specific info like program name and options
3021576bae58Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
3022576bae58Smrgcase $host_os in
3023576bae58Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
3024576bae58Smrg	lint_name=splint
3025576bae58Smrg	lint_options="-badflag"
3026576bae58Smrg	;;
3027576bae58Smrg  *freebsd* | *netbsd*)
3028576bae58Smrg	lint_name=lint
3029576bae58Smrg	lint_options="-u -b"
3030576bae58Smrg	;;
3031576bae58Smrg  *solaris*)
3032576bae58Smrg	lint_name=lint
3033576bae58Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
3034576bae58Smrg	;;
3035576bae58Smrgesac
3036576bae58Smrg
3037576bae58Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
3038576bae58Smrgif test "x$use_lint" = x"yes" ; then
3039576bae58Smrg   AC_PATH_PROG([LINT], [$lint_name])
3040576bae58Smrg   if test "x$LINT" = "x"; then
3041576bae58Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
3042576bae58Smrg   fi
3043576bae58Smrgelif test "x$use_lint" = x"no" ; then
3044576bae58Smrg   if test "x$LINT" != "x"; then
3045576bae58Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
3046576bae58Smrg   fi
304714c0a534Smrgelse
3048576bae58Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
3049bf2eeab3Smrgfi
3050576bae58Smrg
3051576bae58Smrg# User supplied flags override default flags
3052576bae58Smrgif test "x$LINT_FLAGS" != "x"; then
3053576bae58Smrg   lint_options=$LINT_FLAGS
305414c0a534Smrgfi
305514c0a534Smrg
3056576bae58SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
3057576bae58SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
305814c0a534Smrg
3059bf2eeab3Smrg]) # XORG_WITH_LINT
306014c0a534Smrg
3061bf2eeab3Smrg# XORG_LINT_LIBRARY(LIBNAME)
3062bf2eeab3Smrg# --------------------------
3063bf2eeab3Smrg# Minimum version: 1.1.0
3064bf2eeab3Smrg#
3065bf2eeab3Smrg# Sets up flags for building lint libraries for checking programs that call
3066bf2eeab3Smrg# functions in the library.
3067bf2eeab3Smrg#
3068576bae58Smrg# Interface to module:
3069576bae58Smrg# LINTLIB		- Automake variable with the name of lint library file to make
3070576bae58Smrg# MAKE_LINT_LIB		- Automake conditional
3071576bae58Smrg#
3072576bae58Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
3073576bae58Smrg#			  - 'no' user instructs the module not to create a lint library (default)
307414c0a534Smrg
3075bf2eeab3SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
3076bf2eeab3SmrgAC_REQUIRE([XORG_WITH_LINT])
3077bf2eeab3SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
3078bf2eeab3Smrg	[Create lint library (default: disabled)])],
3079bf2eeab3Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
3080576bae58Smrg
3081576bae58Smrgif test "x$make_lint_lib" = x"yes" ; then
3082576bae58Smrg   LINTLIB=llib-l$1.ln
3083576bae58Smrg   if test "x$LINT" = "x"; then
3084576bae58Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
3085576bae58Smrg   fi
3086576bae58Smrgelif test "x$make_lint_lib" != x"no" ; then
3087576bae58Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
3088bf2eeab3Smrgfi
3089576bae58Smrg
3090bf2eeab3SmrgAC_SUBST(LINTLIB)
3091bf2eeab3SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
309214c0a534Smrg
3093bf2eeab3Smrg]) # XORG_LINT_LIBRARY
309414c0a534Smrg
30951a054510Smrg# XORG_COMPILER_BRAND
30961a054510Smrg# -------------------
30971a054510Smrg# Minimum version: 1.14.0
30981a054510Smrg#
30991a054510Smrg# Checks for various brands of compilers and sets flags as appropriate:
31001a054510Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
310124047306Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
31021a054510Smrg#   clang compiler - sets CLANGCC to "yes"
31031a054510Smrg#   Intel compiler - sets INTELCC to "yes"
31041a054510Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
31051a054510Smrg#
31061a054510SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
310724047306SmrgAC_LANG_CASE(
310824047306Smrg	[C], [
31097015785aSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
31107015785aSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
31117015785aSmrg		m4_version_prereq([2.70],
31127015785aSmrg			[AC_REQUIRE([AC_PROG_CC])],
31137015785aSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
311424047306Smrg	],
311524047306Smrg	[C++], [
311624047306Smrg		AC_REQUIRE([AC_PROG_CXX])
311724047306Smrg	]
311824047306Smrg)
31191a054510SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
31201a054510SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
31211a054510SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
31221a054510Smrg]) # XORG_COMPILER_BRAND
31231a054510Smrg
312424047306Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
312524047306Smrg# ---------------
312624047306Smrg# Minimum version: 1.16.0
312724047306Smrg#
312824047306Smrg# Test if the compiler works when passed the given flag as a command line argument.
31297015785aSmrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
313024047306Smrg# next flag in the list until there are no more options.
313124047306Smrg#
313224047306Smrg# Note that this does not guarantee that the compiler supports the flag as some
313324047306Smrg# compilers will simply ignore arguments that they do not understand, but we do
313424047306Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
313524047306Smrg# -Werror=unused-command-line-argument
313624047306Smrg#
313724047306SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
313824047306Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
313924047306Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
314024047306Smrg
314124047306SmrgAC_LANG_COMPILER_REQUIRE
314224047306Smrg
314324047306SmrgAC_LANG_CASE(
314424047306Smrg	[C], [
31457015785aSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
31467015785aSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
31477015785aSmrg		m4_version_prereq([2.70],
31487015785aSmrg			[AC_REQUIRE([AC_PROG_CC])],
31497015785aSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
315024047306Smrg		define([PREFIX], [C])
315124047306Smrg		define([CACHE_PREFIX], [cc])
315224047306Smrg		define([COMPILER], [$CC])
315324047306Smrg	],
315424047306Smrg	[C++], [
315524047306Smrg		define([PREFIX], [CXX])
315624047306Smrg		define([CACHE_PREFIX], [cxx])
315724047306Smrg		define([COMPILER], [$CXX])
315824047306Smrg	]
315924047306Smrg)
316024047306Smrg
316124047306Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
316224047306Smrg
316324047306Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
316424047306Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
316524047306Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
316624047306Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
316724047306Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
316824047306Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
316924047306Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
317024047306Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
317124047306Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
317224047306Smrgfi
317324047306Smrg
317424047306Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
317524047306Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
317624047306Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
317724047306Smrg	fi
317824047306Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
317924047306Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
318024047306Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
318124047306Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
318224047306Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
318324047306Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
318424047306Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
318524047306Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
318624047306Smrgfi
318724047306Smrg
318824047306Smrgfound="no"
318924047306Smrgm4_foreach([flag], m4_cdr($@), [
319024047306Smrg	if test $found = "no" ; then
319124047306Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
319224047306Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
319324047306Smrg		fi
319424047306Smrg
319524047306Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
319624047306Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
319724047306Smrg		fi
319824047306Smrg
319924047306Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
320024047306Smrg
320124047306Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
320224047306Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
320324047306Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
320424047306Smrg		AC_CACHE_VAL($cacheid,
320524047306Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
320624047306Smrg					     [eval $cacheid=yes],
320724047306Smrg					     [eval $cacheid=no])])
320824047306Smrg
320924047306Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
321024047306Smrg
321124047306Smrg		eval supported=\$$cacheid
321224047306Smrg		AC_MSG_RESULT([$supported])
321324047306Smrg		if test "$supported" = "yes" ; then
321424047306Smrg			$1="$$1 ]flag["
321524047306Smrg			found="yes"
321624047306Smrg		fi
321724047306Smrg	fi
321824047306Smrg])
321924047306Smrg]) # XORG_TESTSET_CFLAG
322024047306Smrg
322124047306Smrg# XORG_COMPILER_FLAGS
322224047306Smrg# ---------------
322324047306Smrg# Minimum version: 1.16.0
322424047306Smrg#
322524047306Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
322624047306Smrg# arguments supported by the selected compiler which do NOT alter the generated
322724047306Smrg# code.  These arguments will cause the compiler to print various warnings
322824047306Smrg# during compilation AND turn a conservative set of warnings into errors.
322924047306Smrg#
323024047306Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
323124047306Smrg# future versions of util-macros as options are added to new compilers.
323224047306Smrg#
323324047306SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
323424047306SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
323524047306Smrg
323624047306SmrgAC_ARG_ENABLE(selective-werror,
323724047306Smrg              AS_HELP_STRING([--disable-selective-werror],
323824047306Smrg                             [Turn off selective compiler errors. (default: enabled)]),
323924047306Smrg              [SELECTIVE_WERROR=$enableval],
324024047306Smrg              [SELECTIVE_WERROR=yes])
324124047306Smrg
324224047306SmrgAC_LANG_CASE(
324324047306Smrg        [C], [
324424047306Smrg                define([PREFIX], [C])
324524047306Smrg        ],
324624047306Smrg        [C++], [
324724047306Smrg                define([PREFIX], [CXX])
324824047306Smrg        ]
324924047306Smrg)
325024047306Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
325124047306Smrgif test "x$SUNCC" = "xyes"; then
325224047306Smrg    [BASE_]PREFIX[FLAGS]="-v"
325324047306Smrgelse
325424047306Smrg    [BASE_]PREFIX[FLAGS]=""
325524047306Smrgfi
325624047306Smrg
325724047306Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
325824047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
325924047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
326024047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
326124047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
326224047306Smrg
326324047306SmrgAC_LANG_CASE(
326424047306Smrg	[C], [
326524047306Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
326624047306Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
326724047306Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
326824047306Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
326924047306Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
327024047306Smrg	]
327124047306Smrg)
327224047306Smrg
327324047306Smrg# This chunk adds additional warnings that could catch undesired effects.
327424047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
327524047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
327624047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
327724047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
327824047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
327924047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
328024047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
328124047306Smrg
328224047306Smrg# These are currently disabled because they are noisy.  They will be enabled
328324047306Smrg# in the future once the codebase is sufficiently modernized to silence
328424047306Smrg# them.  For now, I don't want them to drown out the other warnings.
328524047306Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
328624047306Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
328724047306Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
328824047306Smrg
32897015785aSmrg# Turn some warnings into errors, so we don't accidentally get successful builds
329024047306Smrg# when there are problems that should be fixed.
329124047306Smrg
329224047306Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
329324047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
329424047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
329524047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
329624047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
329724047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
329824047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
329924047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
330024047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
330124047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
330224047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
330324047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
330424047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
330524047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
330624047306Smrgelse
330724047306SmrgAC_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])
330824047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
330924047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
331024047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
331124047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
331224047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
331324047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
331424047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
331524047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
331624047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
331724047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
331824047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
331924047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
332024047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
332124047306Smrgfi
332224047306Smrg
332324047306SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
332424047306Smrg]) # XORG_COMPILER_FLAGS
332524047306Smrg
3326bf2eeab3Smrg# XORG_CWARNFLAGS
3327bf2eeab3Smrg# ---------------
3328bf2eeab3Smrg# Minimum version: 1.2.0
332924047306Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3330bf2eeab3Smrg#
3331bf2eeab3Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3332bf2eeab3Smrg#
333324047306Smrg# This function is deprecated because it defines -fno-strict-aliasing
333424047306Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
333524047306Smrg# is needed, then it should be added explicitly in the module when
333624047306Smrg# it is updated to use BASE_CFLAGS.
333724047306Smrg#
3338bf2eeab3SmrgAC_DEFUN([XORG_CWARNFLAGS], [
333924047306SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
33401a054510SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
334124047306SmrgAC_LANG_CASE(
334224047306Smrg	[C], [
334324047306Smrg		CWARNFLAGS="$BASE_CFLAGS"
334424047306Smrg		if  test "x$GCC" = xyes ; then
334524047306Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
334624047306Smrg		fi
334724047306Smrg		AC_SUBST(CWARNFLAGS)
334824047306Smrg	]
334924047306Smrg)
3350bf2eeab3Smrg]) # XORG_CWARNFLAGS
335114c0a534Smrg
3352bf2eeab3Smrg# XORG_STRICT_OPTION
3353bf2eeab3Smrg# -----------------------
3354bf2eeab3Smrg# Minimum version: 1.3.0
335514c0a534Smrg#
33561a054510Smrg# Add configure option to enable strict compilation flags, such as treating
33571a054510Smrg# warnings as fatal errors.
33581a054510Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
335924047306Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
33601a054510Smrg#
33611a054510Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
33621a054510Smrg# when strict compilation is unconditionally desired.
3363bf2eeab3SmrgAC_DEFUN([XORG_STRICT_OPTION], [
3364bf2eeab3SmrgAC_REQUIRE([XORG_CWARNFLAGS])
336524047306SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3366bf2eeab3Smrg
3367bf2eeab3SmrgAC_ARG_ENABLE(strict-compilation,
3368bf2eeab3Smrg			  AS_HELP_STRING([--enable-strict-compilation],
3369bf2eeab3Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3370bf2eeab3Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
337124047306Smrg
337224047306SmrgAC_LANG_CASE(
337324047306Smrg        [C], [
337424047306Smrg                define([PREFIX], [C])
337524047306Smrg        ],
337624047306Smrg        [C++], [
337724047306Smrg                define([PREFIX], [CXX])
337824047306Smrg        ]
337924047306Smrg)
338024047306Smrg
338124047306Smrg[STRICT_]PREFIX[FLAGS]=""
338224047306SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
338324047306SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
338424047306Smrg
338524047306Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
338624047306Smrg# activate it with -Werror, so we add it here explicitly.
338724047306SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
338824047306Smrg
3389bf2eeab3Smrgif test "x$STRICT_COMPILE" = "xyes"; then
339024047306Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
339124047306Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3392bf2eeab3Smrgfi
339324047306SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
339424047306SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
339524047306SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3396bf2eeab3Smrg]) # XORG_STRICT_OPTION
339714c0a534Smrg
33987015785aSmrg# XORG_DEFAULT_NOCODE_OPTIONS
33997015785aSmrg# ---------------------------
34007015785aSmrg# Minimum version: 1.20.0
34017015785aSmrg#
34027015785aSmrg# Defines default options for X.Org modules which don't compile code,
34037015785aSmrg# such as fonts, bitmaps, cursors, and docs.
34047015785aSmrg#
34057015785aSmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
34067015785aSmrgAC_REQUIRE([AC_PROG_INSTALL])
34077015785aSmrgXORG_RELEASE_VERSION
34087015785aSmrgXORG_CHANGELOG
34097015785aSmrgXORG_INSTALL
34107015785aSmrgXORG_MANPAGE_SECTIONS
34117015785aSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
34127015785aSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
34137015785aSmrg]) # XORG_DEFAULT_NOCODE_OPTIONS
34147015785aSmrg
3415bf2eeab3Smrg# XORG_DEFAULT_OPTIONS
3416bf2eeab3Smrg# --------------------
3417bf2eeab3Smrg# Minimum version: 1.3.0
3418bf2eeab3Smrg#
34197015785aSmrg# Defines default options for X.Org modules which compile code.
3420bf2eeab3Smrg#
3421bf2eeab3SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3422576bae58SmrgAC_REQUIRE([AC_PROG_INSTALL])
342324047306SmrgXORG_COMPILER_FLAGS
3424bf2eeab3SmrgXORG_CWARNFLAGS
3425bf2eeab3SmrgXORG_STRICT_OPTION
34267015785aSmrgXORG_DEFAULT_NOCODE_OPTIONS
3427bf2eeab3Smrg]) # XORG_DEFAULT_OPTIONS
3428576bae58Smrg
3429576bae58Smrg# XORG_INSTALL()
3430576bae58Smrg# ----------------
3431576bae58Smrg# Minimum version: 1.4.0
3432576bae58Smrg#
3433576bae58Smrg# Defines the variable INSTALL_CMD as the command to copy
3434576bae58Smrg# INSTALL from $prefix/share/util-macros.
3435576bae58Smrg#
3436576bae58SmrgAC_DEFUN([XORG_INSTALL], [
3437576bae58SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3438576bae58Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3439576bae58SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3440576bae58Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3441bdc460c5Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3442bdc460c5Smrgtouch \$(top_srcdir)/INSTALL; \
3443bdc460c5Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3444576bae58SmrgAC_SUBST([INSTALL_CMD])
3445576bae58Smrg]) # XORG_INSTALL
3446bf2eeab3Smrgdnl Copyright 2005 Red Hat, Inc
3447bf2eeab3Smrgdnl
3448bf2eeab3Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3449bf2eeab3Smrgdnl documentation for any purpose is hereby granted without fee, provided that
3450bf2eeab3Smrgdnl the above copyright notice appear in all copies and that both that
3451bf2eeab3Smrgdnl copyright notice and this permission notice appear in supporting
3452bf2eeab3Smrgdnl documentation.
3453bf2eeab3Smrgdnl
3454bf2eeab3Smrgdnl The above copyright notice and this permission notice shall be included
3455bf2eeab3Smrgdnl in all copies or substantial portions of the Software.
3456bf2eeab3Smrgdnl
3457bf2eeab3Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3458bf2eeab3Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3459bf2eeab3Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3460bf2eeab3Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3461bf2eeab3Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3462bf2eeab3Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3463bf2eeab3Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3464bf2eeab3Smrgdnl
3465bf2eeab3Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3466bf2eeab3Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3467bf2eeab3Smrgdnl other dealings in this Software without prior written authorization
3468bf2eeab3Smrgdnl from the copyright holders.
3469bf2eeab3Smrgdnl
347014c0a534Smrg
3471bf2eeab3Smrg# XORG_RELEASE_VERSION
3472bf2eeab3Smrg# --------------------
3473576bae58Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
347424047306Smrg
3475bf2eeab3SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3476bf2eeab3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3477bf2eeab3Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3478bf2eeab3Smrg		[Major version of this package])
3479bf2eeab3Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3480bf2eeab3Smrg	if test "x$PVM" = "x"; then
3481bf2eeab3Smrg		PVM="0"
3482bf2eeab3Smrg	fi
3483bf2eeab3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3484bf2eeab3Smrg		[$PVM],
3485bf2eeab3Smrg		[Minor version of this package])
3486bf2eeab3Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3487bf2eeab3Smrg	if test "x$PVP" = "x"; then
3488bf2eeab3Smrg		PVP="0"
3489bf2eeab3Smrg	fi
3490bf2eeab3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3491bf2eeab3Smrg		[$PVP],
3492bf2eeab3Smrg		[Patch version of this package])
349314c0a534Smrg])
349414c0a534Smrg
3495bf2eeab3Smrg# XORG_CHANGELOG()
3496bf2eeab3Smrg# ----------------
3497bf2eeab3Smrg# Minimum version: 1.2.0
3498bf2eeab3Smrg#
3499bf2eeab3Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3500bf2eeab3Smrg# ChangeLog from git.
3501bf2eeab3Smrg#
3502bf2eeab3Smrg#
3503bf2eeab3SmrgAC_DEFUN([XORG_CHANGELOG], [
3504bdc460c5SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3505576bae58Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3506bdc460c5Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3507bdc460c5Smrgtouch \$(top_srcdir)/ChangeLog; \
3508bdc460c5Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3509bf2eeab3SmrgAC_SUBST([CHANGELOG_CMD])
3510bf2eeab3Smrg]) # XORG_CHANGELOG
351114c0a534Smrg
3512