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