1dfac8f13Smrg# generated automatically by aclocal 1.17 -*- Autoconf -*-
2533545b5Smrg
3dfac8f13Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
4264fa531Smrg
5264fa531Smrg# This file is free software; the Free Software Foundation
6264fa531Smrg# gives unlimited permission to copy and/or distribute it,
7264fa531Smrg# with or without modifications, as long as this notice is preserved.
8264fa531Smrg
9264fa531Smrg# This program is distributed in the hope that it will be useful,
10264fa531Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11264fa531Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12264fa531Smrg# PARTICULAR PURPOSE.
13264fa531Smrg
14533545b5Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15c37a63b8Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16c37a63b8Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17dfac8f13Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
18dfac8f13Smrg[m4_warning([this file was generated for autoconf 2.72.
19c37a63b8SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20c37a63b8SmrgIf you have problems, you may need to regenerate the build system entirely.
21533545b5SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22264fa531Smrg
23dfac8f13Smrg# Copyright (C) 2002-2024 Free Software Foundation, Inc.
24c9e4df9bSmrg#
25c9e4df9bSmrg# This file is free software; the Free Software Foundation
26c9e4df9bSmrg# gives unlimited permission to copy and/or distribute it,
27c9e4df9bSmrg# with or without modifications, as long as this notice is preserved.
2865c1f7cfSmrg
29c9e4df9bSmrg# AM_AUTOMAKE_VERSION(VERSION)
30c9e4df9bSmrg# ----------------------------
31c9e4df9bSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32c9e4df9bSmrg# generated from the m4 files accompanying Automake X.Y.
33c9e4df9bSmrg# (This private macro should not be called outside this file.)
34c9e4df9bSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35dfac8f13Smrg[am__api_version='1.17'
36c9e4df9bSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37c9e4df9bSmrgdnl require some minimum version.  Point them to the right macro.
38dfac8f13Smrgm4_if([$1], [1.17], [],
39c9e4df9bSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40c9e4df9bSmrg])
4165c1f7cfSmrg
42c9e4df9bSmrg# _AM_AUTOCONF_VERSION(VERSION)
43c9e4df9bSmrg# -----------------------------
44c9e4df9bSmrg# aclocal traces this macro to find the Autoconf version.
45c9e4df9bSmrg# This is a private macro too.  Using m4_define simplifies
46c9e4df9bSmrg# the logic in aclocal, which can simply ignore this definition.
47c9e4df9bSmrgm4_define([_AM_AUTOCONF_VERSION], [])
48264fa531Smrg
49c9e4df9bSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50c9e4df9bSmrg# -------------------------------
51c9e4df9bSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52c9e4df9bSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53c9e4df9bSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54dfac8f13Smrg[AM_AUTOMAKE_VERSION([1.17])dnl
55c9e4df9bSmrgm4_ifndef([AC_AUTOCONF_VERSION],
56c9e4df9bSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57c9e4df9bSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58c37a63b8Smrg
59c9e4df9bSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60264fa531Smrg
61dfac8f13Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
62c9e4df9bSmrg#
63c9e4df9bSmrg# This file is free software; the Free Software Foundation
64c9e4df9bSmrg# gives unlimited permission to copy and/or distribute it,
65c9e4df9bSmrg# with or without modifications, as long as this notice is preserved.
66264fa531Smrg
67c9e4df9bSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68c9e4df9bSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69c9e4df9bSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70c9e4df9bSmrg#
71c9e4df9bSmrg# Of course, Automake must honor this variable whenever it calls a
72c9e4df9bSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73c9e4df9bSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74c9e4df9bSmrg# depending on how configure is run.  This is pretty annoying, since
75c9e4df9bSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76c9e4df9bSmrg# source directory, any form will work fine, but in subdirectories a
77c9e4df9bSmrg# relative path needs to be adjusted first.
78c9e4df9bSmrg#
79c9e4df9bSmrg# $ac_aux_dir/missing
80c9e4df9bSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81c9e4df9bSmrg# $top_srcdir/$ac_aux_dir/missing
82c9e4df9bSmrg#    fails if $ac_aux_dir is absolute,
83c9e4df9bSmrg#    fails when called from a subdirectory in a VPATH build with
84c9e4df9bSmrg#          a relative $ac_aux_dir
85c9e4df9bSmrg#
86c9e4df9bSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87c9e4df9bSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
88c9e4df9bSmrg# harmless because $srcdir is '.', but things will broke when you
89c9e4df9bSmrg# start a VPATH build or use an absolute $srcdir.
90c9e4df9bSmrg#
91c9e4df9bSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92c9e4df9bSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93c9e4df9bSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94c9e4df9bSmrg# and then we would define $MISSING as
95c9e4df9bSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96c9e4df9bSmrg# This will work as long as MISSING is not called from configure, because
97c9e4df9bSmrg# unfortunately $(top_srcdir) has no meaning in configure.
98c9e4df9bSmrg# However there are other variables, like CC, which are often used in
99c9e4df9bSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100c9e4df9bSmrg#
101c9e4df9bSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
102c9e4df9bSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
103c9e4df9bSmrg# configured tree to be moved without reconfiguration.
104264fa531Smrg
105c9e4df9bSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106c9e4df9bSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107c9e4df9bSmrg# Expand $ac_aux_dir to an absolute path.
108c9e4df9bSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109c9e4df9bSmrg])
110264fa531Smrg
111c9e4df9bSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112264fa531Smrg
113dfac8f13Smrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
114c9e4df9bSmrg#
115c9e4df9bSmrg# This file is free software; the Free Software Foundation
116c9e4df9bSmrg# gives unlimited permission to copy and/or distribute it,
117c9e4df9bSmrg# with or without modifications, as long as this notice is preserved.
118264fa531Smrg
119c9e4df9bSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120c9e4df9bSmrg# -------------------------------------
121c9e4df9bSmrg# Define a conditional.
122c9e4df9bSmrgAC_DEFUN([AM_CONDITIONAL],
123c9e4df9bSmrg[AC_PREREQ([2.52])dnl
124c9e4df9bSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
125c9e4df9bSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126c9e4df9bSmrgAC_SUBST([$1_TRUE])dnl
127c9e4df9bSmrgAC_SUBST([$1_FALSE])dnl
128c9e4df9bSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129c9e4df9bSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130c9e4df9bSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131c9e4df9bSmrgif $2; then
132c9e4df9bSmrg  $1_TRUE=
133c9e4df9bSmrg  $1_FALSE='#'
134c9e4df9bSmrgelse
135c9e4df9bSmrg  $1_TRUE='#'
136c9e4df9bSmrg  $1_FALSE=
137c9e4df9bSmrgfi
138c9e4df9bSmrgAC_CONFIG_COMMANDS_PRE(
139c9e4df9bSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140c9e4df9bSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141c9e4df9bSmrgUsually this means the macro was only invoked conditionally.]])
142c9e4df9bSmrgfi])])
143264fa531Smrg
144dfac8f13Smrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
145c9e4df9bSmrg#
146c9e4df9bSmrg# This file is free software; the Free Software Foundation
147c9e4df9bSmrg# gives unlimited permission to copy and/or distribute it,
148c9e4df9bSmrg# with or without modifications, as long as this notice is preserved.
149264fa531Smrg
150264fa531Smrg
151c9e4df9bSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
152c9e4df9bSmrg# written in clear, in which case automake, when reading aclocal.m4,
153c9e4df9bSmrg# will think it sees a *use*, and therefore will trigger all it's
154c9e4df9bSmrg# C support machinery.  Also note that it means that autoscan, seeing
155c9e4df9bSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156264fa531Smrg
157264fa531Smrg
158c9e4df9bSmrg# _AM_DEPENDENCIES(NAME)
159c9e4df9bSmrg# ----------------------
160c9e4df9bSmrg# See how the compiler implements dependency checking.
161c9e4df9bSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
162c9e4df9bSmrg# We try a few techniques and use that to set a single cache variable.
163c9e4df9bSmrg#
164c9e4df9bSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
165c9e4df9bSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
166c9e4df9bSmrg# dependency, and given that the user is not expected to run this macro,
167c9e4df9bSmrg# just rely on AC_PROG_CC.
168c9e4df9bSmrgAC_DEFUN([_AM_DEPENDENCIES],
169c9e4df9bSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
170c9e4df9bSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
171c9e4df9bSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
172c9e4df9bSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173264fa531Smrg
174c9e4df9bSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
175c9e4df9bSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
176c9e4df9bSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
177c9e4df9bSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
178c9e4df9bSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
179c9e4df9bSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
180c9e4df9bSmrg                    [depcc="$$1"   am_compiler_list=])
181264fa531Smrg
182c9e4df9bSmrgAC_CACHE_CHECK([dependency style of $depcc],
183c9e4df9bSmrg               [am_cv_$1_dependencies_compiler_type],
184c9e4df9bSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
185c9e4df9bSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
186c9e4df9bSmrg  # making bogus files that we don't know about and never remove.  For
187c9e4df9bSmrg  # instance it was reported that on HP-UX the gcc test will end up
188c9e4df9bSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
189c9e4df9bSmrg  # in D".
190c9e4df9bSmrg  rm -rf conftest.dir
191c9e4df9bSmrg  mkdir conftest.dir
192c9e4df9bSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
193c9e4df9bSmrg  # using a relative directory.
194c9e4df9bSmrg  cp "$am_depcomp" conftest.dir
195c9e4df9bSmrg  cd conftest.dir
196c9e4df9bSmrg  # We will build objects and dependencies in a subdirectory because
197c9e4df9bSmrg  # it helps to detect inapplicable dependency modes.  For instance
198c9e4df9bSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
199c9e4df9bSmrg  # side effect of compilation, but ICC will put the dependencies in
200c9e4df9bSmrg  # the current directory while Tru64 will put them in the object
201c9e4df9bSmrg  # directory.
202c9e4df9bSmrg  mkdir sub
203264fa531Smrg
204c9e4df9bSmrg  am_cv_$1_dependencies_compiler_type=none
205c9e4df9bSmrg  if test "$am_compiler_list" = ""; then
206c9e4df9bSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
207c9e4df9bSmrg  fi
208c9e4df9bSmrg  am__universal=false
209c9e4df9bSmrg  m4_case([$1], [CC],
210c9e4df9bSmrg    [case " $depcc " in #(
211c9e4df9bSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212c9e4df9bSmrg     esac],
213c9e4df9bSmrg    [CXX],
214c9e4df9bSmrg    [case " $depcc " in #(
215c9e4df9bSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216c9e4df9bSmrg     esac])
217264fa531Smrg
218c9e4df9bSmrg  for depmode in $am_compiler_list; do
219c9e4df9bSmrg    # Setup a source with many dependencies, because some compilers
220c9e4df9bSmrg    # like to wrap large dependency lists on column 80 (with \), and
221c9e4df9bSmrg    # we should not choose a depcomp mode which is confused by this.
222c9e4df9bSmrg    #
223c9e4df9bSmrg    # We need to recreate these files for each test, as the compiler may
224c9e4df9bSmrg    # overwrite some of them when testing with obscure command lines.
225c9e4df9bSmrg    # This happens at least with the AIX C compiler.
226c9e4df9bSmrg    : > sub/conftest.c
227c9e4df9bSmrg    for i in 1 2 3 4 5 6; do
228c9e4df9bSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
229c9e4df9bSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
230c9e4df9bSmrg      # Solaris 10 /bin/sh.
231c9e4df9bSmrg      echo '/* dummy */' > sub/conftst$i.h
232c9e4df9bSmrg    done
233c9e4df9bSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234264fa531Smrg
235c9e4df9bSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236c9e4df9bSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
237c9e4df9bSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
238c9e4df9bSmrg    # versions had trouble with output in subdirs.
239c9e4df9bSmrg    am__obj=sub/conftest.${OBJEXT-o}
240c9e4df9bSmrg    am__minus_obj="-o $am__obj"
241c9e4df9bSmrg    case $depmode in
242c9e4df9bSmrg    gcc)
243c9e4df9bSmrg      # This depmode causes a compiler race in universal mode.
244c9e4df9bSmrg      test "$am__universal" = false || continue
245c9e4df9bSmrg      ;;
246c9e4df9bSmrg    nosideeffect)
247c9e4df9bSmrg      # After this tag, mechanisms are not by side-effect, so they'll
248c9e4df9bSmrg      # only be used when explicitly requested.
249c9e4df9bSmrg      if test "x$enable_dependency_tracking" = xyes; then
250c9e4df9bSmrg	continue
251c9e4df9bSmrg      else
252c9e4df9bSmrg	break
253c9e4df9bSmrg      fi
254c9e4df9bSmrg      ;;
255c9e4df9bSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
256c9e4df9bSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
257c9e4df9bSmrg      # not run yet.  These depmodes are late enough in the game, and
258c9e4df9bSmrg      # so weak that their functioning should not be impacted.
259c9e4df9bSmrg      am__obj=conftest.${OBJEXT-o}
260c9e4df9bSmrg      am__minus_obj=
261c9e4df9bSmrg      ;;
262c9e4df9bSmrg    none) break ;;
263c9e4df9bSmrg    esac
264c9e4df9bSmrg    if depmode=$depmode \
265c9e4df9bSmrg       source=sub/conftest.c object=$am__obj \
266c9e4df9bSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267c9e4df9bSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
268c9e4df9bSmrg         >/dev/null 2>conftest.err &&
269c9e4df9bSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
270c9e4df9bSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271c9e4df9bSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
272c9e4df9bSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
273c9e4df9bSmrg      # icc doesn't choke on unknown options, it will just issue warnings
274c9e4df9bSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
275c9e4df9bSmrg      # that says an option was ignored or not supported.
276dfac8f13Smrg      # When given -MP, icc 7.0 and 7.1 complain thus:
277c9e4df9bSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
278c9e4df9bSmrg      # The diagnosis changed in icc 8.0:
279c9e4df9bSmrg      #   icc: Command line remark: option '-MP' not supported
280c9e4df9bSmrg      if (grep 'ignoring option' conftest.err ||
281c9e4df9bSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
282c9e4df9bSmrg        am_cv_$1_dependencies_compiler_type=$depmode
283c9e4df9bSmrg        break
284c9e4df9bSmrg      fi
285c9e4df9bSmrg    fi
286c9e4df9bSmrg  done
287c37a63b8Smrg
288c9e4df9bSmrg  cd ..
289c9e4df9bSmrg  rm -rf conftest.dir
290c9e4df9bSmrgelse
291c9e4df9bSmrg  am_cv_$1_dependencies_compiler_type=none
292c9e4df9bSmrgfi
293c9e4df9bSmrg])
294c9e4df9bSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
295c9e4df9bSmrgAM_CONDITIONAL([am__fastdep$1], [
296c9e4df9bSmrg  test "x$enable_dependency_tracking" != xno \
297c9e4df9bSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298c9e4df9bSmrg])
299264fa531Smrg
30065c1f7cfSmrg
301c9e4df9bSmrg# AM_SET_DEPDIR
302c9e4df9bSmrg# -------------
303c9e4df9bSmrg# Choose a directory name for dependency files.
304c9e4df9bSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
305c9e4df9bSmrgAC_DEFUN([AM_SET_DEPDIR],
306c9e4df9bSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
307c9e4df9bSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
308c9e4df9bSmrg])
30965c1f7cfSmrg
31065c1f7cfSmrg
311c9e4df9bSmrg# AM_DEP_TRACK
312c9e4df9bSmrg# ------------
313c9e4df9bSmrgAC_DEFUN([AM_DEP_TRACK],
314c9e4df9bSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
315c9e4df9bSmrgAS_HELP_STRING(
316c9e4df9bSmrg  [--enable-dependency-tracking],
317c9e4df9bSmrg  [do not reject slow dependency extractors])
318c9e4df9bSmrgAS_HELP_STRING(
319c9e4df9bSmrg  [--disable-dependency-tracking],
320c9e4df9bSmrg  [speeds up one-time build])])
321c9e4df9bSmrgif test "x$enable_dependency_tracking" != xno; then
322c9e4df9bSmrg  am_depcomp="$ac_aux_dir/depcomp"
323c9e4df9bSmrg  AMDEPBACKSLASH='\'
324c9e4df9bSmrg  am__nodep='_no'
325c9e4df9bSmrgfi
326c9e4df9bSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
327c9e4df9bSmrgAC_SUBST([AMDEPBACKSLASH])dnl
328c9e4df9bSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
329c9e4df9bSmrgAC_SUBST([am__nodep])dnl
330c9e4df9bSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
331c9e4df9bSmrg])
33265c1f7cfSmrg
333c9e4df9bSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
33465c1f7cfSmrg
335dfac8f13Smrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
33665c1f7cfSmrg#
337c9e4df9bSmrg# This file is free software; the Free Software Foundation
338c9e4df9bSmrg# gives unlimited permission to copy and/or distribute it,
339c9e4df9bSmrg# with or without modifications, as long as this notice is preserved.
34065c1f7cfSmrg
341c9e4df9bSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
342c9e4df9bSmrg# ------------------------------
343c9e4df9bSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
344c9e4df9bSmrg[{
345c9e4df9bSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
346c9e4df9bSmrg  # are listed without --file.  Let's play safe and only enable the eval
347c9e4df9bSmrg  # if we detect the quoting.
348c9e4df9bSmrg  # TODO: see whether this extra hack can be removed once we start
349c9e4df9bSmrg  # requiring Autoconf 2.70 or later.
350c9e4df9bSmrg  AS_CASE([$CONFIG_FILES],
351c9e4df9bSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
352c9e4df9bSmrg          [*], [set x $CONFIG_FILES])
353c9e4df9bSmrg  shift
354c9e4df9bSmrg  # Used to flag and report bootstrapping failures.
355c9e4df9bSmrg  am_rc=0
356c9e4df9bSmrg  for am_mf
357c9e4df9bSmrg  do
358c9e4df9bSmrg    # Strip MF so we end up with the name of the file.
359c9e4df9bSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
360c9e4df9bSmrg    # Check whether this is an Automake generated Makefile which includes
361c9e4df9bSmrg    # dependency-tracking related rules and includes.
362c9e4df9bSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
363c9e4df9bSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
364c9e4df9bSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
365c9e4df9bSmrg      || continue
366c9e4df9bSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
367c9e4df9bSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
368c9e4df9bSmrg    AM_RUN_LOG([cd "$am_dirpart" \
369c9e4df9bSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
370c9e4df9bSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
371c9e4df9bSmrg  done
372c9e4df9bSmrg  if test $am_rc -ne 0; then
373c9e4df9bSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
374c9e4df9bSmrg    for automatic dependency tracking.  If GNU make was not used, consider
375c9e4df9bSmrg    re-running the configure script with MAKE="gmake" (or whatever is
376c9e4df9bSmrg    necessary).  You can also try re-running configure with the
377c9e4df9bSmrg    '--disable-dependency-tracking' option to at least be able to build
378c9e4df9bSmrg    the package (albeit without support for automatic dependency tracking).])
379c9e4df9bSmrg  fi
380c9e4df9bSmrg  AS_UNSET([am_dirpart])
381c9e4df9bSmrg  AS_UNSET([am_filepart])
382c9e4df9bSmrg  AS_UNSET([am_mf])
383c9e4df9bSmrg  AS_UNSET([am_rc])
384c9e4df9bSmrg  rm -f conftest-deps.mk
385c9e4df9bSmrg}
386c9e4df9bSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387264fa531Smrg
388264fa531Smrg
389c9e4df9bSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
390c9e4df9bSmrg# -----------------------------
391c9e4df9bSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
39265c1f7cfSmrg#
393c9e4df9bSmrg# This code is only required when automatic dependency tracking is enabled.
394c9e4df9bSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
395c9e4df9bSmrg# order to bootstrap the dependency handling code.
396c9e4df9bSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
397c9e4df9bSmrg[AC_CONFIG_COMMANDS([depfiles],
398c9e4df9bSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
399c9e4df9bSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400264fa531Smrg
401c9e4df9bSmrg# Do all the work for Automake.                             -*- Autoconf -*-
402264fa531Smrg
403dfac8f13Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
404c9e4df9bSmrg#
405c9e4df9bSmrg# This file is free software; the Free Software Foundation
406c9e4df9bSmrg# gives unlimited permission to copy and/or distribute it,
407c9e4df9bSmrg# with or without modifications, as long as this notice is preserved.
408264fa531Smrg
409c9e4df9bSmrg# This macro actually does too much.  Some checks are only needed if
410c9e4df9bSmrg# your package does certain things.  But this isn't really a big deal.
411264fa531Smrg
412c9e4df9bSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
413c9e4df9bSmrgm4_define([AC_PROG_CC],
414c9e4df9bSmrgm4_defn([AC_PROG_CC])
415c9e4df9bSmrg[_AM_PROG_CC_C_O
416c9e4df9bSmrg])
417264fa531Smrg
418c9e4df9bSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
419c9e4df9bSmrg# AM_INIT_AUTOMAKE([OPTIONS])
420c9e4df9bSmrg# -----------------------------------------------
421c9e4df9bSmrg# The call with PACKAGE and VERSION arguments is the old style
422c9e4df9bSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
423c9e4df9bSmrg# and VERSION should now be passed to AC_INIT and removed from
424c9e4df9bSmrg# the call to AM_INIT_AUTOMAKE.
425c9e4df9bSmrg# We support both call styles for the transition.  After
426c9e4df9bSmrg# the next Automake release, Autoconf can make the AC_INIT
427c9e4df9bSmrg# arguments mandatory, and then we can depend on a new Autoconf
428c9e4df9bSmrg# release and drop the old call support.
429c9e4df9bSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
430c9e4df9bSmrg[AC_PREREQ([2.65])dnl
431c9e4df9bSmrgm4_ifdef([_$0_ALREADY_INIT],
432c9e4df9bSmrg  [m4_fatal([$0 expanded multiple times
433c9e4df9bSmrg]m4_defn([_$0_ALREADY_INIT]))],
434c9e4df9bSmrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
435c9e4df9bSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
436c9e4df9bSmrgdnl the ones we care about.
437c9e4df9bSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
438c9e4df9bSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
439c9e4df9bSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
440c9e4df9bSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
441c9e4df9bSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
442c9e4df9bSmrg  # is not polluted with repeated "-I."
443c9e4df9bSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
444c9e4df9bSmrg  # test to see if srcdir already configured
445c9e4df9bSmrg  if test -f $srcdir/config.status; then
446c9e4df9bSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
447c9e4df9bSmrg  fi
44865c1f7cfSmrgfi
449264fa531Smrg
450c9e4df9bSmrg# test whether we have cygpath
451c9e4df9bSmrgif test -z "$CYGPATH_W"; then
452c9e4df9bSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
453c9e4df9bSmrg    CYGPATH_W='cygpath -w'
454c9e4df9bSmrg  else
455c9e4df9bSmrg    CYGPATH_W=echo
456c9e4df9bSmrg  fi
45765c1f7cfSmrgfi
458c9e4df9bSmrgAC_SUBST([CYGPATH_W])
45965c1f7cfSmrg
460c9e4df9bSmrg# Define the identity of the package.
461c9e4df9bSmrgdnl Distinguish between old-style and new-style calls.
462c9e4df9bSmrgm4_ifval([$2],
463c9e4df9bSmrg[AC_DIAGNOSE([obsolete],
464c9e4df9bSmrg             [$0: two- and three-arguments forms are deprecated.])
465c9e4df9bSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
466c9e4df9bSmrg AC_SUBST([PACKAGE], [$1])dnl
467c9e4df9bSmrg AC_SUBST([VERSION], [$2])],
468c9e4df9bSmrg[_AM_SET_OPTIONS([$1])dnl
469c9e4df9bSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
470c9e4df9bSmrgm4_if(
471c9e4df9bSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
472c9e4df9bSmrg  [ok:ok],,
473c9e4df9bSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
474c9e4df9bSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
475c9e4df9bSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476264fa531Smrg
477c9e4df9bSmrg_AM_IF_OPTION([no-define],,
478c9e4df9bSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
479c9e4df9bSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480264fa531Smrg
481c9e4df9bSmrg# Some tools Automake needs.
482c9e4df9bSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
483c9e4df9bSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
484c9e4df9bSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
485c9e4df9bSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
486c9e4df9bSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
487c9e4df9bSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
488c9e4df9bSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
489c9e4df9bSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
490c9e4df9bSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
491c9e4df9bSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
492c9e4df9bSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
493c9e4df9bSmrg# dies out for good.  For more background, see:
494c9e4df9bSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
495c9e4df9bSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
496c9e4df9bSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
497c9e4df9bSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
498c9e4df9bSmrg# system "awk" is bad on some platforms.
499c9e4df9bSmrgAC_REQUIRE([AC_PROG_AWK])dnl
500c9e4df9bSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
501c9e4df9bSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
502c9e4df9bSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
503c9e4df9bSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
504c9e4df9bSmrg			     [_AM_PROG_TAR([v7])])])
505c9e4df9bSmrg_AM_IF_OPTION([no-dependencies],,
506c9e4df9bSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
507c9e4df9bSmrg		  [_AM_DEPENDENCIES([CC])],
508c9e4df9bSmrg		  [m4_define([AC_PROG_CC],
509c9e4df9bSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
510c9e4df9bSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
511c9e4df9bSmrg		  [_AM_DEPENDENCIES([CXX])],
512c9e4df9bSmrg		  [m4_define([AC_PROG_CXX],
513c9e4df9bSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
514c9e4df9bSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
515c9e4df9bSmrg		  [_AM_DEPENDENCIES([OBJC])],
516c9e4df9bSmrg		  [m4_define([AC_PROG_OBJC],
517c9e4df9bSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
518c9e4df9bSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
519c9e4df9bSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
520c9e4df9bSmrg		  [m4_define([AC_PROG_OBJCXX],
521c9e4df9bSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
522c9e4df9bSmrg])
523c9e4df9bSmrg# Variables for tags utilities; see am/tags.am
524c9e4df9bSmrgif test -z "$CTAGS"; then
525c9e4df9bSmrg  CTAGS=ctags
526c9e4df9bSmrgfi
527c9e4df9bSmrgAC_SUBST([CTAGS])
528c9e4df9bSmrgif test -z "$ETAGS"; then
529c9e4df9bSmrg  ETAGS=etags
530c9e4df9bSmrgfi
531c9e4df9bSmrgAC_SUBST([ETAGS])
532c9e4df9bSmrgif test -z "$CSCOPE"; then
533c9e4df9bSmrg  CSCOPE=cscope
534c9e4df9bSmrgfi
535c9e4df9bSmrgAC_SUBST([CSCOPE])
53665c1f7cfSmrg
537dfac8f13SmrgAC_REQUIRE([_AM_SILENT_RULES])dnl
538c9e4df9bSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
539c9e4df9bSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
540c9e4df9bSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
541c9e4df9bSmrgAC_CONFIG_COMMANDS_PRE(dnl
542c9e4df9bSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
543c9e4df9bSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
54465c1f7cfSmrg
545dfac8f13SmrgAC_REQUIRE([_AM_PROG_RM_F])
546dfac8f13SmrgAC_REQUIRE([_AM_PROG_XARGS_N])
54765c1f7cfSmrg
548c9e4df9bSmrgdnl The trailing newline in this macro's definition is deliberate, for
549c9e4df9bSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
550c9e4df9bSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
551c9e4df9bSmrg])
552c37a63b8Smrg
553c9e4df9bSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
554c9e4df9bSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
555c9e4df9bSmrgdnl mangled by Autoconf and run in a shell conditional statement.
556c9e4df9bSmrgm4_define([_AC_COMPILER_EXEEXT],
557c9e4df9bSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
55865c1f7cfSmrg
559c9e4df9bSmrg# When config.status generates a header, we must update the stamp-h file.
560c9e4df9bSmrg# This file resides in the same directory as the config header
561c9e4df9bSmrg# that is generated.  The stamp files are numbered to have different names.
56265c1f7cfSmrg
563c9e4df9bSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
564c9e4df9bSmrg# loop where config.status creates the headers, so we can generate
565c9e4df9bSmrg# our stamp files there.
566c9e4df9bSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
567c9e4df9bSmrg[# Compute $1's index in $config_headers.
568c9e4df9bSmrg_am_arg=$1
569c9e4df9bSmrg_am_stamp_count=1
570c9e4df9bSmrgfor _am_header in $config_headers :; do
571c9e4df9bSmrg  case $_am_header in
572c9e4df9bSmrg    $_am_arg | $_am_arg:* )
573c9e4df9bSmrg      break ;;
574c9e4df9bSmrg    * )
575c9e4df9bSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
576c9e4df9bSmrg  esac
577c9e4df9bSmrgdone
578c9e4df9bSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
57965c1f7cfSmrg
580dfac8f13Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
581c9e4df9bSmrg#
582c9e4df9bSmrg# This file is free software; the Free Software Foundation
583c9e4df9bSmrg# gives unlimited permission to copy and/or distribute it,
584c9e4df9bSmrg# with or without modifications, as long as this notice is preserved.
585c9e4df9bSmrg
586c9e4df9bSmrg# AM_PROG_INSTALL_SH
587c9e4df9bSmrg# ------------------
588c9e4df9bSmrg# Define $install_sh.
589c9e4df9bSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
590c9e4df9bSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
591c9e4df9bSmrgif test x"${install_sh+set}" != xset; then
592c9e4df9bSmrg  case $am_aux_dir in
593c9e4df9bSmrg  *\ * | *\	*)
594c9e4df9bSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
595c9e4df9bSmrg  *)
596c9e4df9bSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
597c9e4df9bSmrg  esac
598c9e4df9bSmrgfi
599c9e4df9bSmrgAC_SUBST([install_sh])])
600c9e4df9bSmrg
601dfac8f13Smrg# Copyright (C) 2003-2024 Free Software Foundation, Inc.
602c9e4df9bSmrg#
603c9e4df9bSmrg# This file is free software; the Free Software Foundation
604c9e4df9bSmrg# gives unlimited permission to copy and/or distribute it,
605c9e4df9bSmrg# with or without modifications, as long as this notice is preserved.
606c9e4df9bSmrg
607c9e4df9bSmrg# Check whether the underlying file-system supports filenames
608c9e4df9bSmrg# with a leading dot.  For instance MS-DOS doesn't.
609c9e4df9bSmrgAC_DEFUN([AM_SET_LEADING_DOT],
610c9e4df9bSmrg[rm -rf .tst 2>/dev/null
611c9e4df9bSmrgmkdir .tst 2>/dev/null
612c9e4df9bSmrgif test -d .tst; then
613c9e4df9bSmrg  am__leading_dot=.
61465c1f7cfSmrgelse
615c9e4df9bSmrg  am__leading_dot=_
616264fa531Smrgfi
617c9e4df9bSmrgrmdir .tst 2>/dev/null
618c9e4df9bSmrgAC_SUBST([am__leading_dot])])
619264fa531Smrg
620c9e4df9bSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
621264fa531Smrg
622dfac8f13Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
623c9e4df9bSmrg#
624c9e4df9bSmrg# This file is free software; the Free Software Foundation
625c9e4df9bSmrg# gives unlimited permission to copy and/or distribute it,
626c9e4df9bSmrg# with or without modifications, as long as this notice is preserved.
627264fa531Smrg
628c9e4df9bSmrg# AM_MAKE_INCLUDE()
629c9e4df9bSmrg# -----------------
630c9e4df9bSmrg# Check whether make has an 'include' directive that can support all
631c9e4df9bSmrg# the idioms we need for our automatic dependency tracking code.
632c9e4df9bSmrgAC_DEFUN([AM_MAKE_INCLUDE],
633c9e4df9bSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
634c9e4df9bSmrgcat > confinc.mk << 'END'
635c9e4df9bSmrgam__doit:
636c9e4df9bSmrg	@echo this is the am__doit target >confinc.out
637c9e4df9bSmrg.PHONY: am__doit
638c9e4df9bSmrgEND
639c9e4df9bSmrgam__include="#"
640c9e4df9bSmrgam__quote=
641c9e4df9bSmrg# BSD make does it like this.
642c9e4df9bSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
643c9e4df9bSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
644c9e4df9bSmrgecho 'include confinc.mk # ignored' > confmf.GNU
645c9e4df9bSmrg_am_result=no
646c9e4df9bSmrgfor s in GNU BSD; do
647c9e4df9bSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
648c9e4df9bSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
649c9e4df9bSmrg      ['0:this is the am__doit target'],
650c9e4df9bSmrg      [AS_CASE([$s],
651c9e4df9bSmrg          [BSD], [am__include='.include' am__quote='"'],
652c9e4df9bSmrg          [am__include='include' am__quote=''])])
653c9e4df9bSmrg  if test "$am__include" != "#"; then
654c9e4df9bSmrg    _am_result="yes ($s style)"
655c9e4df9bSmrg    break
656c9e4df9bSmrg  fi
657c9e4df9bSmrgdone
658c9e4df9bSmrgrm -f confinc.* confmf.*
659c9e4df9bSmrgAC_MSG_RESULT([${_am_result}])
660c9e4df9bSmrgAC_SUBST([am__include])])
661c9e4df9bSmrgAC_SUBST([am__quote])])
662533545b5Smrg
663c9e4df9bSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
664533545b5Smrg
665dfac8f13Smrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
66665c1f7cfSmrg#
667c9e4df9bSmrg# This file is free software; the Free Software Foundation
668c9e4df9bSmrg# gives unlimited permission to copy and/or distribute it,
669c9e4df9bSmrg# with or without modifications, as long as this notice is preserved.
670533545b5Smrg
671c9e4df9bSmrg# AM_MISSING_PROG(NAME, PROGRAM)
672c9e4df9bSmrg# ------------------------------
673c9e4df9bSmrgAC_DEFUN([AM_MISSING_PROG],
674c9e4df9bSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
675c9e4df9bSmrg$1=${$1-"${am_missing_run}$2"}
676c9e4df9bSmrgAC_SUBST($1)])
677533545b5Smrg
678c9e4df9bSmrg# AM_MISSING_HAS_RUN
679c9e4df9bSmrg# ------------------
680c9e4df9bSmrg# Define MISSING if not defined so far and test if it is modern enough.
681c9e4df9bSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
682c9e4df9bSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
683c9e4df9bSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
684c9e4df9bSmrgAC_REQUIRE_AUX_FILE([missing])dnl
685c9e4df9bSmrgif test x"${MISSING+set}" != xset; then
686c9e4df9bSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
68765c1f7cfSmrgfi
688c9e4df9bSmrg# Use eval to expand $SHELL
689c9e4df9bSmrgif eval "$MISSING --is-lightweight"; then
690c9e4df9bSmrg  am_missing_run="$MISSING "
691c9e4df9bSmrgelse
692c9e4df9bSmrg  am_missing_run=
693c9e4df9bSmrg  AC_MSG_WARN(['missing' script is too old or missing])
69465c1f7cfSmrgfi
695c9e4df9bSmrg])
696533545b5Smrg
697c9e4df9bSmrg# Helper functions for option handling.                     -*- Autoconf -*-
698264fa531Smrg
699dfac8f13Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
700c9e4df9bSmrg#
701c9e4df9bSmrg# This file is free software; the Free Software Foundation
702c9e4df9bSmrg# gives unlimited permission to copy and/or distribute it,
703c9e4df9bSmrg# with or without modifications, as long as this notice is preserved.
704264fa531Smrg
705c9e4df9bSmrg# _AM_MANGLE_OPTION(NAME)
706c9e4df9bSmrg# -----------------------
707c9e4df9bSmrgAC_DEFUN([_AM_MANGLE_OPTION],
708c9e4df9bSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
709c37a63b8Smrg
710c9e4df9bSmrg# _AM_SET_OPTION(NAME)
711c9e4df9bSmrg# --------------------
712c9e4df9bSmrg# Set option NAME.  Presently that only means defining a flag for this option.
713c9e4df9bSmrgAC_DEFUN([_AM_SET_OPTION],
714c9e4df9bSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
715264fa531Smrg
716c9e4df9bSmrg# _AM_SET_OPTIONS(OPTIONS)
717c9e4df9bSmrg# ------------------------
718c9e4df9bSmrg# OPTIONS is a space-separated list of Automake options.
719c9e4df9bSmrgAC_DEFUN([_AM_SET_OPTIONS],
720c9e4df9bSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
721c9e4df9bSmrg
722c9e4df9bSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
723c9e4df9bSmrg# -------------------------------------------
724c9e4df9bSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
725c9e4df9bSmrgAC_DEFUN([_AM_IF_OPTION],
726c9e4df9bSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
727c9e4df9bSmrg
728dfac8f13Smrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
72965c1f7cfSmrg#
730c9e4df9bSmrg# This file is free software; the Free Software Foundation
731c9e4df9bSmrg# gives unlimited permission to copy and/or distribute it,
732c9e4df9bSmrg# with or without modifications, as long as this notice is preserved.
733264fa531Smrg
734c9e4df9bSmrg# _AM_PROG_CC_C_O
735c9e4df9bSmrg# ---------------
736c9e4df9bSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
737c9e4df9bSmrg# to automatically call this.
738c9e4df9bSmrgAC_DEFUN([_AM_PROG_CC_C_O],
739c9e4df9bSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
740c9e4df9bSmrgAC_REQUIRE_AUX_FILE([compile])dnl
741c9e4df9bSmrgAC_LANG_PUSH([C])dnl
742c9e4df9bSmrgAC_CACHE_CHECK(
743c9e4df9bSmrg  [whether $CC understands -c and -o together],
744c9e4df9bSmrg  [am_cv_prog_cc_c_o],
745c9e4df9bSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
746c9e4df9bSmrg  # Make sure it works both with $CC and with simple cc.
747c9e4df9bSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
748c9e4df9bSmrg  # compilers refuse to overwrite an existing .o file with -o,
749c9e4df9bSmrg  # though they will create one.
750c9e4df9bSmrg  am_cv_prog_cc_c_o=yes
751c9e4df9bSmrg  for am_i in 1 2; do
752c9e4df9bSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
753c9e4df9bSmrg         && test -f conftest2.$ac_objext; then
754c9e4df9bSmrg      : OK
755c9e4df9bSmrg    else
756c9e4df9bSmrg      am_cv_prog_cc_c_o=no
757c9e4df9bSmrg      break
758c9e4df9bSmrg    fi
759c9e4df9bSmrg  done
760c9e4df9bSmrg  rm -f core conftest*
761c9e4df9bSmrg  unset am_i])
762c9e4df9bSmrgif test "$am_cv_prog_cc_c_o" != yes; then
763c9e4df9bSmrg   # Losing compiler, so override with the script.
764c9e4df9bSmrg   # FIXME: It is wrong to rewrite CC.
765c9e4df9bSmrg   # But if we don't then we get into trouble of one sort or another.
766c9e4df9bSmrg   # A longer-term fix would be to have automake use am__CC in this case,
767c9e4df9bSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
768c9e4df9bSmrg   CC="$am_aux_dir/compile $CC"
769c37a63b8Smrgfi
770c9e4df9bSmrgAC_LANG_POP([C])])
771264fa531Smrg
772c9e4df9bSmrg# For backward compatibility.
773c9e4df9bSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
774264fa531Smrg
775dfac8f13Smrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
776dfac8f13Smrg#
777dfac8f13Smrg# This file is free software; the Free Software Foundation
778dfac8f13Smrg# gives unlimited permission to copy and/or distribute it,
779dfac8f13Smrg# with or without modifications, as long as this notice is preserved.
780dfac8f13Smrg
781dfac8f13Smrg# _AM_PROG_RM_F
782dfac8f13Smrg# ---------------
783dfac8f13Smrg# Check whether 'rm -f' without any arguments works.
784dfac8f13Smrg# https://bugs.gnu.org/10828
785dfac8f13SmrgAC_DEFUN([_AM_PROG_RM_F],
786dfac8f13Smrg[am__rm_f_notfound=
787dfac8f13SmrgAS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""'])
788dfac8f13SmrgAC_SUBST(am__rm_f_notfound)
789dfac8f13Smrg])
790dfac8f13Smrg
791dfac8f13Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
792c37a63b8Smrg#
793c9e4df9bSmrg# This file is free software; the Free Software Foundation
794c9e4df9bSmrg# gives unlimited permission to copy and/or distribute it,
795c9e4df9bSmrg# with or without modifications, as long as this notice is preserved.
796264fa531Smrg
797c9e4df9bSmrg# AM_RUN_LOG(COMMAND)
798c9e4df9bSmrg# -------------------
799c9e4df9bSmrg# Run COMMAND, save the exit status in ac_status, and log it.
800c9e4df9bSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
801c9e4df9bSmrgAC_DEFUN([AM_RUN_LOG],
802c9e4df9bSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
803c9e4df9bSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
804c9e4df9bSmrg   ac_status=$?
805c9e4df9bSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
806c9e4df9bSmrg   (exit $ac_status); }])
807c9e4df9bSmrg
808c9e4df9bSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
809c9e4df9bSmrg
810dfac8f13Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
81165c1f7cfSmrg#
812c9e4df9bSmrg# This file is free software; the Free Software Foundation
813c9e4df9bSmrg# gives unlimited permission to copy and/or distribute it,
814c9e4df9bSmrg# with or without modifications, as long as this notice is preserved.
815264fa531Smrg
816dfac8f13Smrg# _AM_SLEEP_FRACTIONAL_SECONDS
817dfac8f13Smrg# ----------------------------
818dfac8f13SmrgAC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl
819dfac8f13SmrgAC_CACHE_CHECK([whether sleep supports fractional seconds],
820dfac8f13Smrg               am_cv_sleep_fractional_seconds, [dnl
821dfac8f13SmrgAS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes],
822dfac8f13Smrg                                 [am_cv_sleep_fractional_seconds=no])
823dfac8f13Smrg])])
824dfac8f13Smrg
825dfac8f13Smrg# _AM_FILESYSTEM_TIMESTAMP_RESOLUTION
826dfac8f13Smrg# -----------------------------------
827dfac8f13Smrg# Determine the filesystem's resolution for file modification
828dfac8f13Smrg# timestamps.  The coarsest we know of is FAT, with a resolution
829dfac8f13Smrg# of only two seconds, even with the most recent "exFAT" extensions.
830dfac8f13Smrg# The finest (e.g. ext4 with large inodes, XFS, ZFS) is one
831dfac8f13Smrg# nanosecond, matching clock_gettime.  However, it is probably not
832dfac8f13Smrg# possible to delay execution of a shell script for less than one
833dfac8f13Smrg# millisecond, due to process creation overhead and scheduling
834dfac8f13Smrg# granularity, so we don't check for anything finer than that. (See below.)
835dfac8f13SmrgAC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl
836dfac8f13SmrgAC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS])
837dfac8f13SmrgAC_CACHE_CHECK([filesystem timestamp resolution],
838dfac8f13Smrg               am_cv_filesystem_timestamp_resolution, [dnl
839dfac8f13Smrg# Default to the worst case.
840dfac8f13Smrgam_cv_filesystem_timestamp_resolution=2
841dfac8f13Smrg
842dfac8f13Smrg# Only try to go finer than 1 sec if sleep can do it.
843dfac8f13Smrg# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work,
844dfac8f13Smrg# - 1 sec is not much of a win compared to 2 sec, and
845dfac8f13Smrg# - it takes 2 seconds to perform the test whether 1 sec works.
846dfac8f13Smrg# 
847dfac8f13Smrg# Instead, just use the default 2s on platforms that have 1s resolution,
848dfac8f13Smrg# accept the extra 1s delay when using $sleep in the Automake tests, in
849dfac8f13Smrg# exchange for not incurring the 2s delay for running the test for all
850dfac8f13Smrg# packages.
851dfac8f13Smrg#
852dfac8f13Smrgam_try_resolutions=
853dfac8f13Smrgif test "$am_cv_sleep_fractional_seconds" = yes; then
854dfac8f13Smrg  # Even a millisecond often causes a bunch of false positives,
855dfac8f13Smrg  # so just try a hundredth of a second. The time saved between .001 and
856dfac8f13Smrg  # .01 is not terribly consequential.
857dfac8f13Smrg  am_try_resolutions="0.01 0.1 $am_try_resolutions"
858dfac8f13Smrgfi
859dfac8f13Smrg
860dfac8f13Smrg# In order to catch current-generation FAT out, we must *modify* files
861dfac8f13Smrg# that already exist; the *creation* timestamp is finer.  Use names
862dfac8f13Smrg# that make ls -t sort them differently when they have equal
863dfac8f13Smrg# timestamps than when they have distinct timestamps, keeping
864dfac8f13Smrg# in mind that ls -t prints the *newest* file first.
865dfac8f13Smrgrm -f conftest.ts?
866dfac8f13Smrg: > conftest.ts1
867dfac8f13Smrg: > conftest.ts2
868dfac8f13Smrg: > conftest.ts3
869dfac8f13Smrg
870dfac8f13Smrg# Make sure ls -t actually works.  Do 'set' in a subshell so we don't
871dfac8f13Smrg# clobber the current shell's arguments. (Outer-level square brackets
872dfac8f13Smrg# are removed by m4; they're present so that m4 does not expand
873dfac8f13Smrg# <dollar><star>; be careful, easy to get confused.)
874dfac8f13Smrgif (
875dfac8f13Smrg     set X `[ls -t conftest.ts[12]]` &&
876dfac8f13Smrg     {
877dfac8f13Smrg       test "$[]*" != "X conftest.ts1 conftest.ts2" ||
878dfac8f13Smrg       test "$[]*" != "X conftest.ts2 conftest.ts1";
879dfac8f13Smrg     }
880dfac8f13Smrg); then :; else
881dfac8f13Smrg  # If neither matched, then we have a broken ls.  This can happen
882dfac8f13Smrg  # if, for instance, CONFIG_SHELL is bash and it inherits a
883dfac8f13Smrg  # broken ls alias from the environment.  This has actually
884dfac8f13Smrg  # happened.  Such a system could not be considered "sane".
885dfac8f13Smrg  _AS_ECHO_UNQUOTED(
886dfac8f13Smrg    ["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""],
887dfac8f13Smrg    [AS_MESSAGE_LOG_FD])
888dfac8f13Smrg  AC_MSG_FAILURE([ls -t produces unexpected output.
889dfac8f13SmrgMake sure there is not a broken ls alias in your environment.])
890dfac8f13Smrgfi
891dfac8f13Smrg
892dfac8f13Smrgfor am_try_res in $am_try_resolutions; do
893dfac8f13Smrg  # Any one fine-grained sleep might happen to cross the boundary
894dfac8f13Smrg  # between two values of a coarser actual resolution, but if we do
895dfac8f13Smrg  # two fine-grained sleeps in a row, at least one of them will fall
896dfac8f13Smrg  # entirely within a coarse interval.
897dfac8f13Smrg  echo alpha > conftest.ts1
898dfac8f13Smrg  sleep $am_try_res
899dfac8f13Smrg  echo beta > conftest.ts2
900dfac8f13Smrg  sleep $am_try_res
901dfac8f13Smrg  echo gamma > conftest.ts3
902dfac8f13Smrg
903dfac8f13Smrg  # We assume that 'ls -t' will make use of high-resolution
904dfac8f13Smrg  # timestamps if the operating system supports them at all.
905dfac8f13Smrg  if (set X `ls -t conftest.ts?` &&
906dfac8f13Smrg      test "$[]2" = conftest.ts3 &&
907dfac8f13Smrg      test "$[]3" = conftest.ts2 &&
908dfac8f13Smrg      test "$[]4" = conftest.ts1); then
909dfac8f13Smrg    #
910dfac8f13Smrg    # Ok, ls -t worked. If we're at a resolution of 1 second, we're done,
911dfac8f13Smrg    # because we don't need to test make.
912dfac8f13Smrg    make_ok=true
913dfac8f13Smrg    if test $am_try_res != 1; then
914dfac8f13Smrg      # But if we've succeeded so far with a subsecond resolution, we
915dfac8f13Smrg      # have one more thing to check: make. It can happen that
916dfac8f13Smrg      # everything else supports the subsecond mtimes, but make doesn't;
917dfac8f13Smrg      # notably on macOS, which ships make 3.81 from 2006 (the last one
918dfac8f13Smrg      # released under GPLv2). https://bugs.gnu.org/68808
919dfac8f13Smrg      # 
920dfac8f13Smrg      # We test $MAKE if it is defined in the environment, else "make".
921dfac8f13Smrg      # It might get overridden later, but our hope is that in practice
922dfac8f13Smrg      # it does not matter: it is the system "make" which is (by far)
923dfac8f13Smrg      # the most likely to be broken, whereas if the user overrides it,
924dfac8f13Smrg      # probably they did so with a better, or at least not worse, make.
925dfac8f13Smrg      # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html
926dfac8f13Smrg      #
927dfac8f13Smrg      # Create a Makefile (real tab character here):
928dfac8f13Smrg      rm -f conftest.mk
929dfac8f13Smrg      echo 'conftest.ts1: conftest.ts2' >conftest.mk
930dfac8f13Smrg      echo '	touch conftest.ts2' >>conftest.mk
931dfac8f13Smrg      #
932dfac8f13Smrg      # Now, running
933dfac8f13Smrg      #   touch conftest.ts1; touch conftest.ts2; make
934dfac8f13Smrg      # should touch ts1 because ts2 is newer. This could happen by luck,
935dfac8f13Smrg      # but most often, it will fail if make's support is insufficient. So
936dfac8f13Smrg      # test for several consecutive successes.
937dfac8f13Smrg      #
938dfac8f13Smrg      # (We reuse conftest.ts[12] because we still want to modify existing
939dfac8f13Smrg      # files, not create new ones, per above.)
940dfac8f13Smrg      n=0
941dfac8f13Smrg      make=${MAKE-make}
942dfac8f13Smrg      until test $n -eq 3; do
943dfac8f13Smrg        echo one > conftest.ts1
944dfac8f13Smrg        sleep $am_try_res
945dfac8f13Smrg        echo two > conftest.ts2 # ts2 should now be newer than ts1
946dfac8f13Smrg        if $make -f conftest.mk | grep 'up to date' >/dev/null; then
947dfac8f13Smrg          make_ok=false
948dfac8f13Smrg          break # out of $n loop
949dfac8f13Smrg        fi
950dfac8f13Smrg        n=`expr $n + 1`
951dfac8f13Smrg      done
952dfac8f13Smrg    fi
953dfac8f13Smrg    #
954dfac8f13Smrg    if $make_ok; then
955dfac8f13Smrg      # Everything we know to check worked out, so call this resolution good.
956dfac8f13Smrg      am_cv_filesystem_timestamp_resolution=$am_try_res
957dfac8f13Smrg      break # out of $am_try_res loop
958dfac8f13Smrg    fi
959dfac8f13Smrg    # Otherwise, we'll go on to check the next resolution.
960dfac8f13Smrg  fi
961dfac8f13Smrgdone
962dfac8f13Smrgrm -f conftest.ts?
963dfac8f13Smrg# (end _am_filesystem_timestamp_resolution)
964dfac8f13Smrg])])
965dfac8f13Smrg
966c9e4df9bSmrg# AM_SANITY_CHECK
967c9e4df9bSmrg# ---------------
968c9e4df9bSmrgAC_DEFUN([AM_SANITY_CHECK],
969dfac8f13Smrg[AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION])
970dfac8f13Smrg# This check should not be cached, as it may vary across builds of
971dfac8f13Smrg# different projects.
972dfac8f13SmrgAC_MSG_CHECKING([whether build environment is sane])
973c9e4df9bSmrg# Reject unsafe characters in $srcdir or the absolute working directory
974c9e4df9bSmrg# name.  Accept space and tab only in the latter.
975c9e4df9bSmrgam_lf='
976c9e4df9bSmrg'
977c9e4df9bSmrgcase `pwd` in
978c9e4df9bSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
979c9e4df9bSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
980c9e4df9bSmrgesac
981c9e4df9bSmrgcase $srcdir in
982c9e4df9bSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
983c9e4df9bSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
984c9e4df9bSmrgesac
985c9e4df9bSmrg
986c9e4df9bSmrg# Do 'set' in a subshell so we don't clobber the current shell's
987c9e4df9bSmrg# arguments.  Must try -L first in case configure is actually a
988c9e4df9bSmrg# symlink; some systems play weird games with the mod time of symlinks
989c9e4df9bSmrg# (eg FreeBSD returns the mod time of the symlink's containing
990c9e4df9bSmrg# directory).
991dfac8f13Smrgam_build_env_is_sane=no
992dfac8f13Smrgam_has_slept=no
993dfac8f13Smrgrm -f conftest.file
994dfac8f13Smrgfor am_try in 1 2; do
995dfac8f13Smrg  echo "timestamp, slept: $am_has_slept" > conftest.file
996dfac8f13Smrg  if (
997dfac8f13Smrg    set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
998dfac8f13Smrg    if test "$[]*" = "X"; then
999dfac8f13Smrg      # -L didn't work.
1000dfac8f13Smrg      set X `ls -t "$srcdir/configure" conftest.file`
1001dfac8f13Smrg    fi
1002dfac8f13Smrg    test "$[]2" = conftest.file
1003dfac8f13Smrg  ); then
1004dfac8f13Smrg    am_build_env_is_sane=yes
1005dfac8f13Smrg    break
1006dfac8f13Smrg  fi
1007dfac8f13Smrg  # Just in case.
1008dfac8f13Smrg  sleep "$am_cv_filesystem_timestamp_resolution"
1009dfac8f13Smrg  am_has_slept=yes
1010dfac8f13Smrgdone
1011dfac8f13Smrg
1012dfac8f13SmrgAC_MSG_RESULT([$am_build_env_is_sane])
1013dfac8f13Smrgif test "$am_build_env_is_sane" = no; then
1014dfac8f13Smrg  AC_MSG_ERROR([newly created file is older than distributed files!
1015c9e4df9bSmrgCheck your system clock])
1016c37a63b8Smrgfi
1017dfac8f13Smrg
1018c9e4df9bSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
1019c9e4df9bSmrg# generated files are strictly newer.
1020c9e4df9bSmrgam_sleep_pid=
1021dfac8f13SmrgAS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl
1022dfac8f13Smrg  ( sleep "$am_cv_filesystem_timestamp_resolution" ) &
1023c9e4df9bSmrg  am_sleep_pid=$!
1024dfac8f13Smrg])
1025c9e4df9bSmrgAC_CONFIG_COMMANDS_PRE(
1026c9e4df9bSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
1027c9e4df9bSmrg   if test -n "$am_sleep_pid"; then
1028c9e4df9bSmrg     # Hide warnings about reused PIDs.
1029c9e4df9bSmrg     wait $am_sleep_pid 2>/dev/null
1030c9e4df9bSmrg   fi
1031c9e4df9bSmrg   AC_MSG_RESULT([done])])
1032c9e4df9bSmrgrm -f conftest.file
1033c9e4df9bSmrg])
1034264fa531Smrg
1035dfac8f13Smrg# Copyright (C) 2009-2024 Free Software Foundation, Inc.
103665c1f7cfSmrg#
1037c9e4df9bSmrg# This file is free software; the Free Software Foundation
1038c9e4df9bSmrg# gives unlimited permission to copy and/or distribute it,
1039c9e4df9bSmrg# with or without modifications, as long as this notice is preserved.
1040c37a63b8Smrg
1041dfac8f13Smrg# _AM_SILENT_RULES
1042dfac8f13Smrg# ----------------
1043dfac8f13Smrg# Enable less verbose build rules support.
1044dfac8f13SmrgAC_DEFUN([_AM_SILENT_RULES],
1045dfac8f13Smrg[AM_DEFAULT_VERBOSITY=1
1046dfac8f13SmrgAC_ARG_ENABLE([silent-rules], [dnl
1047c9e4df9bSmrgAS_HELP_STRING(
1048c9e4df9bSmrg  [--enable-silent-rules],
1049c9e4df9bSmrg  [less verbose build output (undo: "make V=1")])
1050c9e4df9bSmrgAS_HELP_STRING(
1051c9e4df9bSmrg  [--disable-silent-rules],
1052c9e4df9bSmrg  [verbose build output (undo: "make V=0")])dnl
1053c9e4df9bSmrg])
1054c9e4df9bSmrgdnl
1055c9e4df9bSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
1056c9e4df9bSmrgdnl do not support nested variable expansions.
1057c9e4df9bSmrgdnl See automake bug#9928 and bug#10237.
1058c9e4df9bSmrgam_make=${MAKE-make}
1059c9e4df9bSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
1060c9e4df9bSmrg   [am_cv_make_support_nested_variables],
1061c9e4df9bSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
1062c9e4df9bSmrgBAR0=false
1063c9e4df9bSmrgBAR1=true
1064c9e4df9bSmrgV=1
1065c9e4df9bSmrgam__doit:
1066c9e4df9bSmrg	@$(TRUE)
1067c9e4df9bSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
1068c9e4df9bSmrg  am_cv_make_support_nested_variables=yes
106965c1f7cfSmrgelse
1070c9e4df9bSmrg  am_cv_make_support_nested_variables=no
1071c9e4df9bSmrgfi])
1072c9e4df9bSmrgAC_SUBST([AM_V])dnl
1073c9e4df9bSmrgAM_SUBST_NOTMAKE([AM_V])dnl
1074c9e4df9bSmrgAC_SUBST([AM_DEFAULT_V])dnl
1075c9e4df9bSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
1076c9e4df9bSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
1077c9e4df9bSmrgAM_BACKSLASH='\'
1078c9e4df9bSmrgAC_SUBST([AM_BACKSLASH])dnl
1079c9e4df9bSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
1080dfac8f13Smrgdnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls
1081dfac8f13Smrgdnl to AM_SILENT_RULES to change the default value.
1082dfac8f13SmrgAC_CONFIG_COMMANDS_PRE([dnl
1083dfac8f13Smrgcase $enable_silent_rules in @%:@ (((
1084dfac8f13Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
1085dfac8f13Smrg   no) AM_DEFAULT_VERBOSITY=1;;
1086dfac8f13Smrgesac
1087dfac8f13Smrgif test $am_cv_make_support_nested_variables = yes; then
1088dfac8f13Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
1089dfac8f13Smrg  AM_V='$(V)'
1090dfac8f13Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
1091dfac8f13Smrgelse
1092dfac8f13Smrg  AM_V=$AM_DEFAULT_VERBOSITY
1093dfac8f13Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
1094dfac8f13Smrgfi
1095dfac8f13Smrg])dnl
1096c9e4df9bSmrg])
1097c37a63b8Smrg
1098dfac8f13Smrg# AM_SILENT_RULES([DEFAULT])
1099dfac8f13Smrg# --------------------------
1100dfac8f13Smrg# Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or
1101dfac8f13Smrg# empty being verbose).
1102dfac8f13SmrgAC_DEFUN([AM_SILENT_RULES],
1103dfac8f13Smrg[AC_REQUIRE([_AM_SILENT_RULES])
1104dfac8f13SmrgAM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])])
1105dfac8f13Smrg
1106dfac8f13Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
110765c1f7cfSmrg#
1108c9e4df9bSmrg# This file is free software; the Free Software Foundation
1109c9e4df9bSmrg# gives unlimited permission to copy and/or distribute it,
1110c9e4df9bSmrg# with or without modifications, as long as this notice is preserved.
1111533545b5Smrg
1112c9e4df9bSmrg# AM_PROG_INSTALL_STRIP
1113c9e4df9bSmrg# ---------------------
1114c9e4df9bSmrg# One issue with vendor 'install' (even GNU) is that you can't
1115c9e4df9bSmrg# specify the program used to strip binaries.  This is especially
1116c9e4df9bSmrg# annoying in cross-compiling environments, where the build's strip
1117c9e4df9bSmrg# is unlikely to handle the host's binaries.
1118c9e4df9bSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
1119c9e4df9bSmrg# always use install-sh in "make install-strip", and initialize
1120c9e4df9bSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
1121c9e4df9bSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
1122c9e4df9bSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
1123c9e4df9bSmrg# Installed binaries are usually stripped using 'strip' when the user
1124c9e4df9bSmrg# run "make install-strip".  However 'strip' might not be the right
1125c9e4df9bSmrg# tool to use in cross-compilation environments, therefore Automake
1126c9e4df9bSmrg# will honor the 'STRIP' environment variable to overrule this program.
1127c9e4df9bSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
1128c9e4df9bSmrgif test "$cross_compiling" != no; then
1129c9e4df9bSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
1130533545b5Smrgfi
1131c9e4df9bSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
1132c9e4df9bSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1133533545b5Smrg
1134dfac8f13Smrg# Copyright (C) 2006-2024 Free Software Foundation, Inc.
113565c1f7cfSmrg#
1136c9e4df9bSmrg# This file is free software; the Free Software Foundation
1137c9e4df9bSmrg# gives unlimited permission to copy and/or distribute it,
1138c9e4df9bSmrg# with or without modifications, as long as this notice is preserved.
1139533545b5Smrg
1140c9e4df9bSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
1141c9e4df9bSmrg# ---------------------------
1142c9e4df9bSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1143c9e4df9bSmrg# This macro is traced by Automake.
1144c9e4df9bSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
114565c1f7cfSmrg
1146c9e4df9bSmrg# AM_SUBST_NOTMAKE(VARIABLE)
1147c9e4df9bSmrg# --------------------------
1148c9e4df9bSmrg# Public sister of _AM_SUBST_NOTMAKE.
1149c9e4df9bSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1150264fa531Smrg
1151c9e4df9bSmrg# Check how to create a tarball.                            -*- Autoconf -*-
1152c37a63b8Smrg
1153dfac8f13Smrg# Copyright (C) 2004-2024 Free Software Foundation, Inc.
115465c1f7cfSmrg#
1155c9e4df9bSmrg# This file is free software; the Free Software Foundation
1156c9e4df9bSmrg# gives unlimited permission to copy and/or distribute it,
1157c9e4df9bSmrg# with or without modifications, as long as this notice is preserved.
1158c9e4df9bSmrg
1159c9e4df9bSmrg# _AM_PROG_TAR(FORMAT)
1160c9e4df9bSmrg# --------------------
1161c9e4df9bSmrg# Check how to create a tarball in format FORMAT.
1162c9e4df9bSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
116365c1f7cfSmrg#
1164c9e4df9bSmrg# Substitute a variable $(am__tar) that is a command
1165c9e4df9bSmrg# writing to stdout a FORMAT-tarball containing the directory
1166c9e4df9bSmrg# $tardir.
1167c9e4df9bSmrg#     tardir=directory && $(am__tar) > result.tar
116865c1f7cfSmrg#
1169c9e4df9bSmrg# Substitute a variable $(am__untar) that extract such
1170c9e4df9bSmrg# a tarball read from stdin.
1171c9e4df9bSmrg#     $(am__untar) < result.tar
117265c1f7cfSmrg#
1173c9e4df9bSmrgAC_DEFUN([_AM_PROG_TAR],
1174c9e4df9bSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1175c9e4df9bSmrg# in the wild :-(  We should find a proper way to deprecate it ...
1176c9e4df9bSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1177c37a63b8Smrg
1178c9e4df9bSmrg# We'll loop over all known methods to create a tar archive until one works.
1179c9e4df9bSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1180c37a63b8Smrg
1181c9e4df9bSmrgm4_if([$1], [v7],
1182c9e4df9bSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1183264fa531Smrg
1184c9e4df9bSmrg  [m4_case([$1],
1185c9e4df9bSmrg    [ustar],
1186c9e4df9bSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1187c9e4df9bSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1188c9e4df9bSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1189c9e4df9bSmrg      # and bug#13588).
1190c9e4df9bSmrg      am_max_uid=2097151 # 2^21 - 1
1191c9e4df9bSmrg      am_max_gid=$am_max_uid
1192c9e4df9bSmrg      # The $UID and $GID variables are not portable, so we need to resort
1193c9e4df9bSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1194c9e4df9bSmrg      # below are definitely unexpected, so allow the users to see them
1195c9e4df9bSmrg      # (that is, avoid stderr redirection).
1196c9e4df9bSmrg      am_uid=`id -u || echo unknown`
1197c9e4df9bSmrg      am_gid=`id -g || echo unknown`
1198c9e4df9bSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1199dfac8f13Smrg      if test x$am_uid = xunknown; then
1200dfac8f13Smrg        AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work])
1201dfac8f13Smrg      elif test $am_uid -le $am_max_uid; then
1202dfac8f13Smrg        AC_MSG_RESULT([yes])
1203c9e4df9bSmrg      else
1204dfac8f13Smrg        AC_MSG_RESULT([no])
1205dfac8f13Smrg        _am_tools=none
1206c9e4df9bSmrg      fi
1207c9e4df9bSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1208dfac8f13Smrg      if test x$gm_gid = xunknown; then
1209dfac8f13Smrg        AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work])
1210dfac8f13Smrg      elif test $am_gid -le $am_max_gid; then
1211dfac8f13Smrg        AC_MSG_RESULT([yes])
1212c9e4df9bSmrg      else
1213c9e4df9bSmrg        AC_MSG_RESULT([no])
1214c9e4df9bSmrg        _am_tools=none
1215c9e4df9bSmrg      fi],
1216533545b5Smrg
1217c9e4df9bSmrg  [pax],
1218c9e4df9bSmrg    [],
1219533545b5Smrg
1220c9e4df9bSmrg  [m4_fatal([Unknown tar format])])
1221533545b5Smrg
1222c9e4df9bSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1223533545b5Smrg
1224c9e4df9bSmrg  # Go ahead even if we have the value already cached.  We do so because we
1225c9e4df9bSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1226c9e4df9bSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1227533545b5Smrg
1228c9e4df9bSmrg  for _am_tool in $_am_tools; do
1229c9e4df9bSmrg    case $_am_tool in
1230c9e4df9bSmrg    gnutar)
1231c9e4df9bSmrg      for _am_tar in tar gnutar gtar; do
1232c9e4df9bSmrg        AM_RUN_LOG([$_am_tar --version]) && break
1233c9e4df9bSmrg      done
1234c9e4df9bSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1235c9e4df9bSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1236c9e4df9bSmrg      am__untar="$_am_tar -xf -"
1237c9e4df9bSmrg      ;;
1238c9e4df9bSmrg    plaintar)
1239c9e4df9bSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1240c9e4df9bSmrg      # ustar tarball either.
1241c9e4df9bSmrg      (tar --version) >/dev/null 2>&1 && continue
1242c9e4df9bSmrg      am__tar='tar chf - "$$tardir"'
1243c9e4df9bSmrg      am__tar_='tar chf - "$tardir"'
1244c9e4df9bSmrg      am__untar='tar xf -'
1245c9e4df9bSmrg      ;;
1246c9e4df9bSmrg    pax)
1247c9e4df9bSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
1248c9e4df9bSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
1249c9e4df9bSmrg      am__untar='pax -r'
1250c9e4df9bSmrg      ;;
1251c9e4df9bSmrg    cpio)
1252c9e4df9bSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1253c9e4df9bSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1254c9e4df9bSmrg      am__untar='cpio -i -H $1 -d'
1255c9e4df9bSmrg      ;;
1256c9e4df9bSmrg    none)
1257c9e4df9bSmrg      am__tar=false
1258c9e4df9bSmrg      am__tar_=false
1259c9e4df9bSmrg      am__untar=false
1260c9e4df9bSmrg      ;;
1261c9e4df9bSmrg    esac
1262533545b5Smrg
1263c9e4df9bSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
1264c9e4df9bSmrg    # and am__untar set.
1265c9e4df9bSmrg    test -n "${am_cv_prog_tar_$1}" && break
1266533545b5Smrg
1267c9e4df9bSmrg    # tar/untar a dummy directory, and stop if the command works.
1268c9e4df9bSmrg    rm -rf conftest.dir
1269c9e4df9bSmrg    mkdir conftest.dir
1270c9e4df9bSmrg    echo GrepMe > conftest.dir/file
1271c9e4df9bSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1272c9e4df9bSmrg    rm -rf conftest.dir
1273c9e4df9bSmrg    if test -s conftest.tar; then
1274c9e4df9bSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
1275c9e4df9bSmrg      AM_RUN_LOG([cat conftest.dir/file])
1276c9e4df9bSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1277c9e4df9bSmrg    fi
1278c9e4df9bSmrg  done
1279c9e4df9bSmrg  rm -rf conftest.dir
1280533545b5Smrg
1281c9e4df9bSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1282c9e4df9bSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1283533545b5Smrg
1284c9e4df9bSmrgAC_SUBST([am__tar])
1285c9e4df9bSmrgAC_SUBST([am__untar])
1286c9e4df9bSmrg]) # _AM_PROG_TAR
1287533545b5Smrg
1288dfac8f13Smrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
1289dfac8f13Smrg#
1290dfac8f13Smrg# This file is free software; the Free Software Foundation
1291dfac8f13Smrg# gives unlimited permission to copy and/or distribute it,
1292dfac8f13Smrg# with or without modifications, as long as this notice is preserved.
1293dfac8f13Smrg
1294dfac8f13Smrg# _AM_PROG_XARGS_N
1295dfac8f13Smrg# ----------------
1296dfac8f13Smrg# Check whether 'xargs -n' works.  It should work everywhere, so the fallback
1297dfac8f13Smrg# is not optimized at all as we never expect to use it.
1298dfac8f13SmrgAC_DEFUN([_AM_PROG_XARGS_N],
1299dfac8f13Smrg[AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl
1300dfac8f13SmrgAS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2
1301dfac8f13Smrg3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])])
1302dfac8f13SmrgAS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl
1303dfac8f13Smrg  am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }'
1304dfac8f13Smrg])dnl
1305dfac8f13SmrgAC_SUBST(am__xargs_n)
1306dfac8f13Smrg])
1307dfac8f13Smrg
1308c9e4df9bSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1309c9e4df9bSmrgdnl serial 11 (pkg-config-0.29)
1310c9e4df9bSmrgdnl
1311c9e4df9bSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1312c9e4df9bSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1313c9e4df9bSmrgdnl
1314c9e4df9bSmrgdnl This program is free software; you can redistribute it and/or modify
1315c9e4df9bSmrgdnl it under the terms of the GNU General Public License as published by
1316c9e4df9bSmrgdnl the Free Software Foundation; either version 2 of the License, or
1317c9e4df9bSmrgdnl (at your option) any later version.
1318c9e4df9bSmrgdnl
1319c9e4df9bSmrgdnl This program is distributed in the hope that it will be useful, but
1320c9e4df9bSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1321c9e4df9bSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1322c9e4df9bSmrgdnl General Public License for more details.
1323c9e4df9bSmrgdnl
1324c9e4df9bSmrgdnl You should have received a copy of the GNU General Public License
1325c9e4df9bSmrgdnl along with this program; if not, write to the Free Software
1326c9e4df9bSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1327c9e4df9bSmrgdnl 02111-1307, USA.
1328c9e4df9bSmrgdnl
1329c9e4df9bSmrgdnl As a special exception to the GNU General Public License, if you
1330c9e4df9bSmrgdnl distribute this file as part of a program that contains a
1331c9e4df9bSmrgdnl configuration script generated by Autoconf, you may include it under
1332c9e4df9bSmrgdnl the same distribution terms that you use for the rest of that
1333c9e4df9bSmrgdnl program.
1334533545b5Smrg
1335c9e4df9bSmrgdnl PKG_PREREQ(MIN-VERSION)
1336c9e4df9bSmrgdnl -----------------------
1337c9e4df9bSmrgdnl Since: 0.29
1338c9e4df9bSmrgdnl
1339c9e4df9bSmrgdnl Verify that the version of the pkg-config macros are at least
1340c9e4df9bSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1341c9e4df9bSmrgdnl installed version of pkg-config, this checks the developer's version
1342c9e4df9bSmrgdnl of pkg.m4 when generating configure.
1343c9e4df9bSmrgdnl
1344c9e4df9bSmrgdnl To ensure that this macro is defined, also add:
1345c9e4df9bSmrgdnl m4_ifndef([PKG_PREREQ],
1346c9e4df9bSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1347c9e4df9bSmrgdnl
1348c9e4df9bSmrgdnl See the "Since" comment for each macro you use to see what version
1349c9e4df9bSmrgdnl of the macros you require.
1350c9e4df9bSmrgm4_defun([PKG_PREREQ],
1351c9e4df9bSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
1352c9e4df9bSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1353c9e4df9bSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1354c9e4df9bSmrg])dnl PKG_PREREQ
1355533545b5Smrg
1356c9e4df9bSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1357c9e4df9bSmrgdnl ----------------------------------
1358c9e4df9bSmrgdnl Since: 0.16
1359c9e4df9bSmrgdnl
1360c9e4df9bSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1361c9e4df9bSmrgdnl first found in the path. Checks that the version of pkg-config found
1362c9e4df9bSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1363c9e4df9bSmrgdnl used since that's the first version where most current features of
1364c9e4df9bSmrgdnl pkg-config existed.
1365c9e4df9bSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1366c9e4df9bSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1367c9e4df9bSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1368c9e4df9bSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1369c9e4df9bSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1370c9e4df9bSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1371c9e4df9bSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1372c37a63b8Smrg
1373c9e4df9bSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1374c9e4df9bSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1375264fa531Smrgfi
1376c9e4df9bSmrgif test -n "$PKG_CONFIG"; then
1377c9e4df9bSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
1378c9e4df9bSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1379c9e4df9bSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1380c9e4df9bSmrg		AC_MSG_RESULT([yes])
1381c9e4df9bSmrg	else
1382c9e4df9bSmrg		AC_MSG_RESULT([no])
1383c9e4df9bSmrg		PKG_CONFIG=""
1384c9e4df9bSmrg	fi
1385c9e4df9bSmrgfi[]dnl
1386c9e4df9bSmrg])dnl PKG_PROG_PKG_CONFIG
1387264fa531Smrg
1388c9e4df9bSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1389c9e4df9bSmrgdnl -------------------------------------------------------------------
1390c9e4df9bSmrgdnl Since: 0.18
1391c9e4df9bSmrgdnl
1392c9e4df9bSmrgdnl Check to see whether a particular set of modules exists. Similar to
1393c9e4df9bSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1394c9e4df9bSmrgdnl
1395c9e4df9bSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1396c9e4df9bSmrgdnl only at the first occurence in configure.ac, so if the first place
1397c9e4df9bSmrgdnl it's called might be skipped (such as if it is within an "if", you
1398c9e4df9bSmrgdnl have to call PKG_CHECK_EXISTS manually
1399c9e4df9bSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1400c9e4df9bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1401c9e4df9bSmrgif test -n "$PKG_CONFIG" && \
1402c9e4df9bSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1403c9e4df9bSmrg  m4_default([$2], [:])
1404c9e4df9bSmrgm4_ifvaln([$3], [else
1405c9e4df9bSmrg  $3])dnl
1406c9e4df9bSmrgfi])
1407c9e4df9bSmrg
1408c9e4df9bSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1409c9e4df9bSmrgdnl ---------------------------------------------
1410c9e4df9bSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1411c9e4df9bSmrgdnl pkg_failed based on the result.
1412c9e4df9bSmrgm4_define([_PKG_CONFIG],
1413c9e4df9bSmrg[if test -n "$$1"; then
1414c9e4df9bSmrg    pkg_cv_[]$1="$$1"
1415c9e4df9bSmrg elif test -n "$PKG_CONFIG"; then
1416c9e4df9bSmrg    PKG_CHECK_EXISTS([$3],
1417c9e4df9bSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1418c9e4df9bSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
1419c9e4df9bSmrg		     [pkg_failed=yes])
1420c9e4df9bSmrg else
1421c9e4df9bSmrg    pkg_failed=untried
1422c9e4df9bSmrgfi[]dnl
1423c9e4df9bSmrg])dnl _PKG_CONFIG
1424c9e4df9bSmrg
1425c9e4df9bSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1426c9e4df9bSmrgdnl ---------------------------
1427c9e4df9bSmrgdnl Internal check to see if pkg-config supports short errors.
1428c9e4df9bSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1429c9e4df9bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1430c9e4df9bSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1431c9e4df9bSmrg        _pkg_short_errors_supported=yes
1432264fa531Smrgelse
1433c9e4df9bSmrg        _pkg_short_errors_supported=no
1434c9e4df9bSmrgfi[]dnl
1435c9e4df9bSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1436264fa531Smrg
1437264fa531Smrg
1438c9e4df9bSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1439c9e4df9bSmrgdnl   [ACTION-IF-NOT-FOUND])
1440c9e4df9bSmrgdnl --------------------------------------------------------------
1441c9e4df9bSmrgdnl Since: 0.4.0
1442c9e4df9bSmrgdnl
1443c9e4df9bSmrgdnl Note that if there is a possibility the first call to
1444c9e4df9bSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1445c9e4df9bSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1446c9e4df9bSmrgAC_DEFUN([PKG_CHECK_MODULES],
1447c9e4df9bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1448c9e4df9bSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1449c9e4df9bSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1450264fa531Smrg
1451c9e4df9bSmrgpkg_failed=no
1452c9e4df9bSmrgAC_MSG_CHECKING([for $1])
1453264fa531Smrg
1454c9e4df9bSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1455c9e4df9bSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1456264fa531Smrg
1457c9e4df9bSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1458c9e4df9bSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1459c9e4df9bSmrgSee the pkg-config man page for more details.])
1460264fa531Smrg
1461c9e4df9bSmrgif test $pkg_failed = yes; then
1462c9e4df9bSmrg   	AC_MSG_RESULT([no])
1463c9e4df9bSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1464c9e4df9bSmrg        if test $_pkg_short_errors_supported = yes; then
1465c9e4df9bSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1466c9e4df9bSmrg        else 
1467c9e4df9bSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1468c9e4df9bSmrg        fi
1469c9e4df9bSmrg	# Put the nasty error message in config.log where it belongs
1470c9e4df9bSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1471264fa531Smrg
1472c9e4df9bSmrg	m4_default([$4], [AC_MSG_ERROR(
1473c9e4df9bSmrg[Package requirements ($2) were not met:
1474264fa531Smrg
1475c9e4df9bSmrg$$1_PKG_ERRORS
1476c9e4df9bSmrg
1477c9e4df9bSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1478c9e4df9bSmrginstalled software in a non-standard prefix.
1479c9e4df9bSmrg
1480c9e4df9bSmrg_PKG_TEXT])[]dnl
1481c9e4df9bSmrg        ])
1482c9e4df9bSmrgelif test $pkg_failed = untried; then
1483c9e4df9bSmrg     	AC_MSG_RESULT([no])
1484c9e4df9bSmrg	m4_default([$4], [AC_MSG_FAILURE(
1485c9e4df9bSmrg[The pkg-config script could not be found or is too old.  Make sure it
1486c9e4df9bSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
1487c9e4df9bSmrgpath to pkg-config.
1488c9e4df9bSmrg
1489c9e4df9bSmrg_PKG_TEXT
1490c9e4df9bSmrg
1491c9e4df9bSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1492c9e4df9bSmrg        ])
1493736a7e2cSmrgelse
1494c9e4df9bSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1495c9e4df9bSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1496c9e4df9bSmrg        AC_MSG_RESULT([yes])
1497c9e4df9bSmrg	$3
1498c9e4df9bSmrgfi[]dnl
1499c9e4df9bSmrg])dnl PKG_CHECK_MODULES
1500736a7e2cSmrg
1501736a7e2cSmrg
1502c9e4df9bSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1503c9e4df9bSmrgdnl   [ACTION-IF-NOT-FOUND])
1504c9e4df9bSmrgdnl ---------------------------------------------------------------------
1505c9e4df9bSmrgdnl Since: 0.29
1506c9e4df9bSmrgdnl
1507c9e4df9bSmrgdnl Checks for existence of MODULES and gathers its build flags with
1508c9e4df9bSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1509c9e4df9bSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1510c9e4df9bSmrgdnl
1511c9e4df9bSmrgdnl Note that if there is a possibility the first call to
1512c9e4df9bSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1513c9e4df9bSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1514c9e4df9bSmrgdnl configure.ac.
1515c9e4df9bSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1516c9e4df9bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1517c9e4df9bSmrg_save_PKG_CONFIG=$PKG_CONFIG
1518c9e4df9bSmrgPKG_CONFIG="$PKG_CONFIG --static"
1519c9e4df9bSmrgPKG_CHECK_MODULES($@)
1520c9e4df9bSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1521c9e4df9bSmrg])dnl PKG_CHECK_MODULES_STATIC
1522264fa531Smrg
1523264fa531Smrg
1524c9e4df9bSmrgdnl PKG_INSTALLDIR([DIRECTORY])
1525c9e4df9bSmrgdnl -------------------------
1526c9e4df9bSmrgdnl Since: 0.27
1527c9e4df9bSmrgdnl
1528c9e4df9bSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
1529c9e4df9bSmrgdnl should install pkg-config .pc files. By default the directory is
1530c9e4df9bSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
1531c9e4df9bSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1532c9e4df9bSmrgdnl parameter.
1533c9e4df9bSmrgAC_DEFUN([PKG_INSTALLDIR],
1534c9e4df9bSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1535c9e4df9bSmrgm4_pushdef([pkg_description],
1536c9e4df9bSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1537c9e4df9bSmrgAC_ARG_WITH([pkgconfigdir],
1538c9e4df9bSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1539c9e4df9bSmrg    [with_pkgconfigdir=]pkg_default)
1540c9e4df9bSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1541c9e4df9bSmrgm4_popdef([pkg_default])
1542c9e4df9bSmrgm4_popdef([pkg_description])
1543c9e4df9bSmrg])dnl PKG_INSTALLDIR
1544c9e4df9bSmrg
1545c9e4df9bSmrg
1546c9e4df9bSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1547c9e4df9bSmrgdnl --------------------------------
1548c9e4df9bSmrgdnl Since: 0.27
1549c9e4df9bSmrgdnl
1550c9e4df9bSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1551c9e4df9bSmrgdnl module should install arch-independent pkg-config .pc files. By
1552c9e4df9bSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
1553c9e4df9bSmrgdnl changed by passing DIRECTORY. The user can override through the
1554c9e4df9bSmrgdnl --with-noarch-pkgconfigdir parameter.
1555c9e4df9bSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1556c9e4df9bSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1557c9e4df9bSmrgm4_pushdef([pkg_description],
1558c9e4df9bSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1559c9e4df9bSmrgAC_ARG_WITH([noarch-pkgconfigdir],
1560c9e4df9bSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1561c9e4df9bSmrg    [with_noarch_pkgconfigdir=]pkg_default)
1562c9e4df9bSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1563c9e4df9bSmrgm4_popdef([pkg_default])
1564c9e4df9bSmrgm4_popdef([pkg_description])
1565c9e4df9bSmrg])dnl PKG_NOARCH_INSTALLDIR
1566c9e4df9bSmrg
1567264fa531Smrg
1568c9e4df9bSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1569c9e4df9bSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1570c9e4df9bSmrgdnl -------------------------------------------
1571c9e4df9bSmrgdnl Since: 0.28
1572c9e4df9bSmrgdnl
1573c9e4df9bSmrgdnl Retrieves the value of the pkg-config variable for the given module.
1574c9e4df9bSmrgAC_DEFUN([PKG_CHECK_VAR],
1575c9e4df9bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1576c9e4df9bSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1577264fa531Smrg
1578c9e4df9bSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1579c9e4df9bSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1580264fa531Smrg
1581c9e4df9bSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1582c9e4df9bSmrg])dnl PKG_CHECK_VAR
1583264fa531Smrg
1584c9e4df9bSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1585c9e4df9bSmrgdnl
1586dfac8f13Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
1587c9e4df9bSmrgdnl
1588c9e4df9bSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1589c9e4df9bSmrgdnl copy of this software and associated documentation files (the "Software"),
1590c9e4df9bSmrgdnl to deal in the Software without restriction, including without limitation
1591c9e4df9bSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1592c9e4df9bSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1593c9e4df9bSmrgdnl Software is furnished to do so, subject to the following conditions:
1594c9e4df9bSmrgdnl
1595c9e4df9bSmrgdnl The above copyright notice and this permission notice (including the next
1596c9e4df9bSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1597c9e4df9bSmrgdnl Software.
1598c9e4df9bSmrgdnl
1599c9e4df9bSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1600c9e4df9bSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1601c9e4df9bSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1602c9e4df9bSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1603c9e4df9bSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1604c9e4df9bSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1605c9e4df9bSmrgdnl DEALINGS IN THE SOFTWARE.
1606264fa531Smrg
1607c9e4df9bSmrg# XORG_MACROS_VERSION(required-version)
1608c9e4df9bSmrg# -------------------------------------
160965c1f7cfSmrg# Minimum version: 1.1.0
1610c37a63b8Smrg#
1611c9e4df9bSmrg# If you're using a macro added in Version 1.1 or newer, include this in
1612c9e4df9bSmrg# your configure.ac with the minimum required version, such as:
1613c9e4df9bSmrg# XORG_MACROS_VERSION(1.1)
161465c1f7cfSmrg#
1615c9e4df9bSmrg# To ensure that this macro is defined, also add:
1616c9e4df9bSmrg# m4_ifndef([XORG_MACROS_VERSION],
1617c9e4df9bSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
161865c1f7cfSmrg#
1619c9e4df9bSmrg#
1620c9e4df9bSmrg# See the "minimum version" comment for each macro you use to see what
1621c9e4df9bSmrg# version you require.
1622c9e4df9bSmrgm4_defun([XORG_MACROS_VERSION],[
1623dfac8f13Smrgm4_define([vers_have], [1.20.1])
1624c9e4df9bSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1625c9e4df9bSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1626c9e4df9bSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1627c9e4df9bSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1628c9e4df9bSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1629c9e4df9bSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1630c9e4df9bSmrgm4_undefine([vers_have])
1631c9e4df9bSmrgm4_undefine([maj_have])
1632c9e4df9bSmrgm4_undefine([maj_needed])
1633c9e4df9bSmrg]) # XORG_MACROS_VERSION
1634c37a63b8Smrg
1635c9e4df9bSmrg# XORG_PROG_RAWCPP()
1636c9e4df9bSmrg# ------------------
1637c9e4df9bSmrg# Minimum version: 1.0.0
1638c9e4df9bSmrg#
1639c9e4df9bSmrg# Find cpp program and necessary flags for use in pre-processing text files
1640c9e4df9bSmrg# such as man pages and config files
1641c9e4df9bSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1642c9e4df9bSmrgAC_REQUIRE([AC_PROG_CPP])
1643c9e4df9bSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1644c9e4df9bSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1645c37a63b8Smrg
1646c9e4df9bSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1647c9e4df9bSmrg# which is not the best choice for supporting other OS'es, but covers most
1648c9e4df9bSmrg# of the ones we need for now.
1649c9e4df9bSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1650c9e4df9bSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1651c9e4df9bSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1652c9e4df9bSmrg	AC_MSG_RESULT([no])
1653c9e4df9bSmrgelse
1654c9e4df9bSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1655c9e4df9bSmrg		RAWCPPFLAGS=-undef
1656c9e4df9bSmrg		AC_MSG_RESULT([yes])
1657c9e4df9bSmrg	# under Cygwin unix is still defined even with -undef
1658c9e4df9bSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1659c9e4df9bSmrg		RAWCPPFLAGS="-undef -ansi"
1660c9e4df9bSmrg		AC_MSG_RESULT([yes, with -ansi])
1661c9e4df9bSmrg	else
1662c9e4df9bSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1663c9e4df9bSmrg	fi
1664c37a63b8Smrgfi
1665c9e4df9bSmrgrm -f conftest.$ac_ext
1666c37a63b8Smrg
1667c9e4df9bSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1668c9e4df9bSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1669dfac8f13Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1670c9e4df9bSmrg	AC_MSG_RESULT([no])
1671c9e4df9bSmrgelse
1672dfac8f13Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1673c9e4df9bSmrg		TRADITIONALCPPFLAGS="-traditional"
1674c9e4df9bSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1675c9e4df9bSmrg		AC_MSG_RESULT([yes])
1676c9e4df9bSmrg	else
1677c9e4df9bSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1678c9e4df9bSmrg	fi
1679c9e4df9bSmrgfi
1680c9e4df9bSmrgrm -f conftest.$ac_ext
1681c9e4df9bSmrgAC_SUBST(RAWCPPFLAGS)
1682c9e4df9bSmrgAC_SUBST(TRADITIONALCPPFLAGS)
1683c9e4df9bSmrg]) # XORG_PROG_RAWCPP
1684c37a63b8Smrg
1685c9e4df9bSmrg# XORG_MANPAGE_SECTIONS()
1686c9e4df9bSmrg# -----------------------
1687c9e4df9bSmrg# Minimum version: 1.0.0
1688736a7e2cSmrg#
1689c9e4df9bSmrg# Determine which sections man pages go in for the different man page types
1690c9e4df9bSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1691c9e4df9bSmrg# Not sure if there's any better way than just hardcoding by OS name.
1692c9e4df9bSmrg# Override default settings by setting environment variables
1693c9e4df9bSmrg# Added MAN_SUBSTS in version 1.8
1694c9e4df9bSmrg# Added AC_PROG_SED in version 1.8
169565c1f7cfSmrg
1696c9e4df9bSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1697c9e4df9bSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1698c9e4df9bSmrgAC_REQUIRE([AC_PROG_SED])
1699736a7e2cSmrg
1700c9e4df9bSmrgcase $host_os in
1701c9e4df9bSmrg    solaris*)
1702c9e4df9bSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1703c9e4df9bSmrg        # check for a man page file found in later versions that use
1704c9e4df9bSmrg        # traditional section numbers instead
1705c9e4df9bSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1706c9e4df9bSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1707c9e4df9bSmrg        ;;
1708c9e4df9bSmrg    *) SYSV_MAN_SECTIONS=false ;;
1709c9e4df9bSmrgesac
171065c1f7cfSmrg
1711c9e4df9bSmrgif test x$APP_MAN_SUFFIX = x    ; then
1712c9e4df9bSmrg    APP_MAN_SUFFIX=1
1713c9e4df9bSmrgfi
1714c9e4df9bSmrgif test x$APP_MAN_DIR = x    ; then
1715c9e4df9bSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1716c9e4df9bSmrgfi
171765c1f7cfSmrg
1718c9e4df9bSmrgif test x$LIB_MAN_SUFFIX = x    ; then
1719c9e4df9bSmrg    LIB_MAN_SUFFIX=3
1720c9e4df9bSmrgfi
1721c9e4df9bSmrgif test x$LIB_MAN_DIR = x    ; then
1722c9e4df9bSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1723c9e4df9bSmrgfi
172465c1f7cfSmrg
1725c9e4df9bSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1726c9e4df9bSmrg    case $SYSV_MAN_SECTIONS in
1727c9e4df9bSmrg	true)				FILE_MAN_SUFFIX=4  ;;
1728c9e4df9bSmrg	*)				FILE_MAN_SUFFIX=5  ;;
1729c9e4df9bSmrg    esac
1730c9e4df9bSmrgfi
1731c9e4df9bSmrgif test x$FILE_MAN_DIR = x    ; then
1732c9e4df9bSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1733736a7e2cSmrgfi
1734736a7e2cSmrg
1735c9e4df9bSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1736c9e4df9bSmrg    case $SYSV_MAN_SECTIONS in
1737c9e4df9bSmrg	true)				MISC_MAN_SUFFIX=5  ;;
1738c9e4df9bSmrg	*)				MISC_MAN_SUFFIX=7  ;;
1739c9e4df9bSmrg    esac
1740c9e4df9bSmrgfi
1741c9e4df9bSmrgif test x$MISC_MAN_DIR = x    ; then
1742c9e4df9bSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
174365c1f7cfSmrgfi
1744736a7e2cSmrg
1745c9e4df9bSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1746c9e4df9bSmrg    case $SYSV_MAN_SECTIONS in
1747c9e4df9bSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1748c9e4df9bSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1749c9e4df9bSmrg    esac
1750c9e4df9bSmrgfi
1751c9e4df9bSmrgif test x$DRIVER_MAN_DIR = x    ; then
1752c9e4df9bSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1753c9e4df9bSmrgfi
1754736a7e2cSmrg
1755c9e4df9bSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1756c9e4df9bSmrg    case $SYSV_MAN_SECTIONS in
1757c9e4df9bSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1758c9e4df9bSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
1759c9e4df9bSmrg    esac
1760c9e4df9bSmrgfi
1761c9e4df9bSmrgif test x$ADMIN_MAN_DIR = x    ; then
1762c9e4df9bSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1763c9e4df9bSmrgfi
176465c1f7cfSmrg
176565c1f7cfSmrg
1766c9e4df9bSmrgAC_SUBST([APP_MAN_SUFFIX])
1767c9e4df9bSmrgAC_SUBST([LIB_MAN_SUFFIX])
1768c9e4df9bSmrgAC_SUBST([FILE_MAN_SUFFIX])
1769c9e4df9bSmrgAC_SUBST([MISC_MAN_SUFFIX])
1770c9e4df9bSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1771c9e4df9bSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1772c9e4df9bSmrgAC_SUBST([APP_MAN_DIR])
1773c9e4df9bSmrgAC_SUBST([LIB_MAN_DIR])
1774c9e4df9bSmrgAC_SUBST([FILE_MAN_DIR])
1775c9e4df9bSmrgAC_SUBST([MISC_MAN_DIR])
1776c9e4df9bSmrgAC_SUBST([DRIVER_MAN_DIR])
1777c9e4df9bSmrgAC_SUBST([ADMIN_MAN_DIR])
177865c1f7cfSmrg
1779c9e4df9bSmrgXORG_MAN_PAGE="X Version 11"
1780c9e4df9bSmrgAC_SUBST([XORG_MAN_PAGE])
1781c9e4df9bSmrgMAN_SUBSTS="\
1782c9e4df9bSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1783c9e4df9bSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1784c9e4df9bSmrg	-e 's|__xservername__|Xorg|g' \
1785c9e4df9bSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
1786c9e4df9bSmrg	-e 's|__projectroot__|\$(prefix)|g' \
1787c9e4df9bSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1788c9e4df9bSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1789c9e4df9bSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1790c9e4df9bSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1791c9e4df9bSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1792c9e4df9bSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1793c9e4df9bSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1794c9e4df9bSmrgAC_SUBST([MAN_SUBSTS])
179565c1f7cfSmrg
1796c9e4df9bSmrg]) # XORG_MANPAGE_SECTIONS
179765c1f7cfSmrg
1798c9e4df9bSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1799c9e4df9bSmrg# ------------------------
1800c9e4df9bSmrg# Minimum version: 1.7.0
1801e4ee1255Smrg#
1802c9e4df9bSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1803c9e4df9bSmrg# provided by xorg-sgml-doctools, if installed.
1804c9e4df9bSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1805c9e4df9bSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1806c9e4df9bSmrgXORG_SGML_PATH=
1807c9e4df9bSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1808c9e4df9bSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1809c9e4df9bSmrg    [m4_ifval([$1],[:],
1810c9e4df9bSmrg        [if test x"$cross_compiling" != x"yes" ; then
1811c9e4df9bSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1812c9e4df9bSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1813c9e4df9bSmrg         fi])
1814c9e4df9bSmrg    ])
1815c9e4df9bSmrg
1816c9e4df9bSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1817c9e4df9bSmrg# the path and the name of the doc stylesheet
1818c9e4df9bSmrgif test "x$XORG_SGML_PATH" != "x" ; then
1819c9e4df9bSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1820c9e4df9bSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1821c9e4df9bSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1822c9e4df9bSmrgelse
1823c9e4df9bSmrg   AC_MSG_RESULT([no])
1824c9e4df9bSmrgfi
1825c9e4df9bSmrg
1826c9e4df9bSmrgAC_SUBST(XORG_SGML_PATH)
1827c9e4df9bSmrgAC_SUBST(STYLESHEET_SRCDIR)
1828c9e4df9bSmrgAC_SUBST(XSL_STYLESHEET)
1829c9e4df9bSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1830c9e4df9bSmrg]) # XORG_CHECK_SGML_DOCTOOLS
1831c9e4df9bSmrg
1832c9e4df9bSmrg# XORG_CHECK_LINUXDOC
1833c9e4df9bSmrg# -------------------
1834c9e4df9bSmrg# Minimum version: 1.0.0
1835e4ee1255Smrg#
1836c9e4df9bSmrg# Defines the variable MAKE_TEXT if the necessary tools and
1837c9e4df9bSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1838c9e4df9bSmrg# Whether or not the necessary tools and files are found can be checked
1839c9e4df9bSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1840c9e4df9bSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1841c9e4df9bSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1842c9e4df9bSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1843e4ee1255Smrg
1844c9e4df9bSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
184565c1f7cfSmrg
1846c9e4df9bSmrgAC_MSG_CHECKING([whether to build documentation])
1847c9e4df9bSmrg
1848c9e4df9bSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1849c9e4df9bSmrg   BUILDDOC=yes
1850e4ee1255Smrgelse
1851c9e4df9bSmrg   BUILDDOC=no
1852e4ee1255Smrgfi
1853e4ee1255Smrg
1854c9e4df9bSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1855e4ee1255Smrg
1856c9e4df9bSmrgAC_MSG_RESULT([$BUILDDOC])
185765c1f7cfSmrg
1858c9e4df9bSmrgAC_MSG_CHECKING([whether to build pdf documentation])
1859c9e4df9bSmrg
1860c9e4df9bSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1861c9e4df9bSmrg   BUILDPDFDOC=yes
1862c9e4df9bSmrgelse
1863c9e4df9bSmrg   BUILDPDFDOC=no
1864c9e4df9bSmrgfi
1865c9e4df9bSmrg
1866c9e4df9bSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1867c9e4df9bSmrg
1868c9e4df9bSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1869c9e4df9bSmrg
1870c9e4df9bSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1871c9e4df9bSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1872c9e4df9bSmrgMAKE_PDF="$PS2PDF"
1873c9e4df9bSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1874c9e4df9bSmrg
1875c9e4df9bSmrgAC_SUBST(MAKE_TEXT)
1876c9e4df9bSmrgAC_SUBST(MAKE_PS)
1877c9e4df9bSmrgAC_SUBST(MAKE_PDF)
1878c9e4df9bSmrgAC_SUBST(MAKE_HTML)
1879c9e4df9bSmrg]) # XORG_CHECK_LINUXDOC
1880c9e4df9bSmrg
1881c9e4df9bSmrg# XORG_CHECK_DOCBOOK
1882c9e4df9bSmrg# -------------------
1883c9e4df9bSmrg# Minimum version: 1.0.0
1884c9e4df9bSmrg#
1885c9e4df9bSmrg# Checks for the ability to build output formats from SGML DocBook source.
1886c9e4df9bSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1887c9e4df9bSmrg# indicates whether the necessary tools and files are found and, if set,
1888c9e4df9bSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1889c9e4df9bSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1890c9e4df9bSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1891c9e4df9bSmrg
1892c9e4df9bSmrgBUILDTXTDOC=no
1893c9e4df9bSmrgBUILDPDFDOC=no
1894c9e4df9bSmrgBUILDPSDOC=no
1895c9e4df9bSmrgBUILDHTMLDOC=no
1896c9e4df9bSmrg
1897c9e4df9bSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1898c9e4df9bSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1899c9e4df9bSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1900c9e4df9bSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
190165c1f7cfSmrg
1902c9e4df9bSmrgAC_MSG_CHECKING([whether to build text documentation])
1903c9e4df9bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1904c9e4df9bSmrg   test x$BUILD_TXTDOC != xno; then
1905c9e4df9bSmrg	BUILDTXTDOC=yes
1906c9e4df9bSmrgfi
1907c9e4df9bSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1908c9e4df9bSmrgAC_MSG_RESULT([$BUILDTXTDOC])
190965c1f7cfSmrg
1910c9e4df9bSmrgAC_MSG_CHECKING([whether to build PDF documentation])
1911c9e4df9bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1912c9e4df9bSmrg   test x$BUILD_PDFDOC != xno; then
1913c9e4df9bSmrg	BUILDPDFDOC=yes
1914c9e4df9bSmrgfi
1915c9e4df9bSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1916c9e4df9bSmrgAC_MSG_RESULT([$BUILDPDFDOC])
191765c1f7cfSmrg
1918c9e4df9bSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1919c9e4df9bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1920c9e4df9bSmrg   test x$BUILD_PSDOC != xno; then
1921c9e4df9bSmrg	BUILDPSDOC=yes
192265c1f7cfSmrgfi
1923c9e4df9bSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1924c9e4df9bSmrgAC_MSG_RESULT([$BUILDPSDOC])
192565c1f7cfSmrg
1926c9e4df9bSmrgAC_MSG_CHECKING([whether to build HTML documentation])
1927c9e4df9bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1928c9e4df9bSmrg   test x$BUILD_HTMLDOC != xno; then
1929c9e4df9bSmrg	BUILDHTMLDOC=yes
1930c9e4df9bSmrgfi
1931c9e4df9bSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1932c9e4df9bSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
193365c1f7cfSmrg
1934c9e4df9bSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1935c9e4df9bSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1936c9e4df9bSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1937c9e4df9bSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1938c9e4df9bSmrg
1939c9e4df9bSmrgAC_SUBST(MAKE_TEXT)
1940c9e4df9bSmrgAC_SUBST(MAKE_PS)
1941c9e4df9bSmrgAC_SUBST(MAKE_PDF)
1942c9e4df9bSmrgAC_SUBST(MAKE_HTML)
1943c9e4df9bSmrg]) # XORG_CHECK_DOCBOOK
1944c9e4df9bSmrg
1945c9e4df9bSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1946c9e4df9bSmrg# ----------------
1947c9e4df9bSmrg# Minimum version: 1.5.0
1948c9e4df9bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1949e4ee1255Smrg#
1950c9e4df9bSmrg# Documentation tools are not always available on all platforms and sometimes
1951c9e4df9bSmrg# not at the appropriate level. This macro enables a module to test for the
1952c9e4df9bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1953dfac8f13Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
1954c9e4df9bSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1955c9e4df9bSmrg# --with-xmlto assumes 'auto'.
1956e4ee1255Smrg#
1957c9e4df9bSmrg# Interface to module:
1958c9e4df9bSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1959c9e4df9bSmrg# XMLTO:	returns the path of the xmlto program found
1960c9e4df9bSmrg#		returns the path set by the user in the environment
1961c9e4df9bSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1962c9e4df9bSmrg#		'no' user instructs the module not to use xmlto
1963e4ee1255Smrg#
1964c9e4df9bSmrg# Added in version 1.10.0
1965c9e4df9bSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1966c9e4df9bSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1967e4ee1255Smrg#
1968c9e4df9bSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1969e4ee1255Smrg#
1970c9e4df9bSmrgAC_DEFUN([XORG_WITH_XMLTO],[
1971c9e4df9bSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1972c9e4df9bSmrgm4_define([_defopt], m4_default([$2], [auto]))
1973c9e4df9bSmrgAC_ARG_WITH(xmlto,
1974c9e4df9bSmrg	AS_HELP_STRING([--with-xmlto],
1975c9e4df9bSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1976c9e4df9bSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1977c9e4df9bSmrgm4_undefine([_defopt])
1978e4ee1255Smrg
1979c9e4df9bSmrgif test "x$use_xmlto" = x"auto"; then
1980c9e4df9bSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1981c9e4df9bSmrg   if test "x$XMLTO" = "x"; then
1982c9e4df9bSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1983c9e4df9bSmrg	have_xmlto=no
1984c9e4df9bSmrg   else
1985c9e4df9bSmrg        have_xmlto=yes
1986c9e4df9bSmrg   fi
1987c9e4df9bSmrgelif test "x$use_xmlto" = x"yes" ; then
1988c9e4df9bSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1989c9e4df9bSmrg   if test "x$XMLTO" = "x"; then
1990c9e4df9bSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1991c9e4df9bSmrg   fi
1992c9e4df9bSmrg   have_xmlto=yes
1993c9e4df9bSmrgelif test "x$use_xmlto" = x"no" ; then
1994c9e4df9bSmrg   if test "x$XMLTO" != "x"; then
1995c9e4df9bSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1996c9e4df9bSmrg   fi
1997c9e4df9bSmrg   have_xmlto=no
1998c9e4df9bSmrgelse
1999c9e4df9bSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
2000c9e4df9bSmrgfi
2001e4ee1255Smrg
2002c9e4df9bSmrg# Test for a minimum version of xmlto, if provided.
2003c9e4df9bSmrgm4_ifval([$1],
2004c9e4df9bSmrg[if test "$have_xmlto" = yes; then
2005c9e4df9bSmrg    # scrape the xmlto version
2006c9e4df9bSmrg    AC_MSG_CHECKING([the xmlto version])
2007c9e4df9bSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
2008c9e4df9bSmrg    AC_MSG_RESULT([$xmlto_version])
2009c9e4df9bSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
2010c9e4df9bSmrg        [if test "x$use_xmlto" = xauto; then
2011c9e4df9bSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
2012c9e4df9bSmrg            have_xmlto=no
2013c9e4df9bSmrg        else
2014c9e4df9bSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
2015c9e4df9bSmrg        fi])
2016c9e4df9bSmrgfi])
2017e4ee1255Smrg
2018c9e4df9bSmrg# Test for the ability of xmlto to generate a text target
2019c9e4df9bSmrg#
2020c9e4df9bSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
2021c9e4df9bSmrg# following test for empty XML docbook files.
2022c9e4df9bSmrg# For compatibility reasons use the following empty XML docbook file and if
2023c9e4df9bSmrg# it fails try it again with a non-empty XML file.
2024c9e4df9bSmrghave_xmlto_text=no
2025c9e4df9bSmrgcat > conftest.xml << "EOF"
2026c9e4df9bSmrgEOF
2027c9e4df9bSmrgAS_IF([test "$have_xmlto" = yes],
2028c9e4df9bSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2029c9e4df9bSmrg             [have_xmlto_text=yes],
2030c9e4df9bSmrg             [# Try it again with a non-empty XML file.
2031c9e4df9bSmrg              cat > conftest.xml << "EOF"
2032c9e4df9bSmrg<x></x>
2033c9e4df9bSmrgEOF
2034c9e4df9bSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2035c9e4df9bSmrg                    [have_xmlto_text=yes],
2036c9e4df9bSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
2037c9e4df9bSmrgrm -f conftest.xml
2038c9e4df9bSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
2039c9e4df9bSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
2040c9e4df9bSmrg]) # XORG_WITH_XMLTO
204165c1f7cfSmrg
2042c9e4df9bSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
2043c9e4df9bSmrg# --------------------------------------------
2044c9e4df9bSmrg# Minimum version: 1.12.0
2045c9e4df9bSmrg# Minimum version for optional DEFAULT argument: 1.12.0
2046c9e4df9bSmrg#
2047c9e4df9bSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
2048c9e4df9bSmrg# XML-based language used for the transformation of XML documents.
2049c9e4df9bSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
2050c9e4df9bSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
2051c9e4df9bSmrg# The XSLT processor is often used as a standalone tool for transformations.
2052c9e4df9bSmrg# It should not be assumed that this tool is used only to work with documnetation.
2053c9e4df9bSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
2054c9e4df9bSmrg#
2055c9e4df9bSmrg# Interface to module:
2056c9e4df9bSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
2057c9e4df9bSmrg# XSLTPROC:	 returns the path of the xsltproc program found
2058c9e4df9bSmrg#		 returns the path set by the user in the environment
2059c9e4df9bSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
2060c9e4df9bSmrg#		  'no' user instructs the module not to use xsltproc
2061c9e4df9bSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
2062c9e4df9bSmrg#
2063c9e4df9bSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
2064c9e4df9bSmrg#
2065c9e4df9bSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
2066c9e4df9bSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
2067c9e4df9bSmrg# Preserves the interface, should it be implemented later
2068c9e4df9bSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
2069c9e4df9bSmrgm4_define([_defopt], m4_default([$2], [auto]))
2070c9e4df9bSmrgAC_ARG_WITH(xsltproc,
2071c9e4df9bSmrg	AS_HELP_STRING([--with-xsltproc],
2072c9e4df9bSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
2073c9e4df9bSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
2074c9e4df9bSmrgm4_undefine([_defopt])
207565c1f7cfSmrg
2076c9e4df9bSmrgif test "x$use_xsltproc" = x"auto"; then
2077c9e4df9bSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
2078c9e4df9bSmrg   if test "x$XSLTPROC" = "x"; then
2079c9e4df9bSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
2080c9e4df9bSmrg	have_xsltproc=no
2081c9e4df9bSmrg   else
2082c9e4df9bSmrg        have_xsltproc=yes
2083c9e4df9bSmrg   fi
2084c9e4df9bSmrgelif test "x$use_xsltproc" = x"yes" ; then
2085c9e4df9bSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
2086c9e4df9bSmrg   if test "x$XSLTPROC" = "x"; then
2087c9e4df9bSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
2088c9e4df9bSmrg   fi
2089c9e4df9bSmrg   have_xsltproc=yes
2090c9e4df9bSmrgelif test "x$use_xsltproc" = x"no" ; then
2091c9e4df9bSmrg   if test "x$XSLTPROC" != "x"; then
2092c9e4df9bSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
2093c9e4df9bSmrg   fi
2094c9e4df9bSmrg   have_xsltproc=no
2095c9e4df9bSmrgelse
2096c9e4df9bSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
209765c1f7cfSmrgfi
209865c1f7cfSmrg
2099c9e4df9bSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
2100c9e4df9bSmrg]) # XORG_WITH_XSLTPROC
2101c9e4df9bSmrg
2102c9e4df9bSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
2103c9e4df9bSmrg# ----------------------------------------
2104c9e4df9bSmrg# Minimum version: 1.15.0
2105736a7e2cSmrg#
2106c9e4df9bSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
2107c9e4df9bSmrg# scanning arbitrary text files, extracting information from those text files,
2108c9e4df9bSmrg# and printing reports based on that information.
2109736a7e2cSmrg#
2110c9e4df9bSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
2111736a7e2cSmrg#
2112c9e4df9bSmrg# Interface to module:
2113c9e4df9bSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
2114c9e4df9bSmrg# PERL:	     returns the path of the perl program found
2115c9e4df9bSmrg#	     returns the path set by the user in the environment
2116c9e4df9bSmrg# --with-perl: 'yes' user instructs the module to use perl
2117c9e4df9bSmrg#	       'no' user instructs the module not to use perl
2118c9e4df9bSmrg# have_perl: returns yes if perl found in PATH or no
2119736a7e2cSmrg#
2120c9e4df9bSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
2121c9e4df9bSmrg#
2122c9e4df9bSmrgAC_DEFUN([XORG_WITH_PERL],[
2123c9e4df9bSmrgAC_ARG_VAR([PERL], [Path to perl command])
2124c9e4df9bSmrg# Preserves the interface, should it be implemented later
2125c9e4df9bSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
2126c9e4df9bSmrgm4_define([_defopt], m4_default([$2], [auto]))
2127c9e4df9bSmrgAC_ARG_WITH(perl,
2128c9e4df9bSmrg	AS_HELP_STRING([--with-perl],
2129c9e4df9bSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
2130c9e4df9bSmrg	   [use_perl=$withval], [use_perl=]_defopt)
2131c9e4df9bSmrgm4_undefine([_defopt])
2132736a7e2cSmrg
2133c9e4df9bSmrgif test "x$use_perl" = x"auto"; then
2134c9e4df9bSmrg   AC_PATH_PROG([PERL], [perl])
2135c9e4df9bSmrg   if test "x$PERL" = "x"; then
2136c9e4df9bSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
2137c9e4df9bSmrg	have_perl=no
2138c9e4df9bSmrg   else
2139c9e4df9bSmrg        have_perl=yes
2140c9e4df9bSmrg   fi
2141c9e4df9bSmrgelif test "x$use_perl" = x"yes" ; then
2142c9e4df9bSmrg   AC_PATH_PROG([PERL], [perl])
2143c9e4df9bSmrg   if test "x$PERL" = "x"; then
2144c9e4df9bSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
2145c9e4df9bSmrg   fi
2146c9e4df9bSmrg   have_perl=yes
2147c9e4df9bSmrgelif test "x$use_perl" = x"no" ; then
2148c9e4df9bSmrg   if test "x$PERL" != "x"; then
2149c9e4df9bSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
2150c9e4df9bSmrg   fi
2151c9e4df9bSmrg   have_perl=no
2152c9e4df9bSmrgelse
2153c9e4df9bSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
2154c9e4df9bSmrgfi
215565c1f7cfSmrg
2156c9e4df9bSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2157c9e4df9bSmrg]) # XORG_WITH_PERL
215865c1f7cfSmrg
2159c9e4df9bSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
216065c1f7cfSmrg# ----------------
2161c9e4df9bSmrg# Minimum version: 1.5.0
2162c9e4df9bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2163736a7e2cSmrg#
2164c9e4df9bSmrg# Documentation tools are not always available on all platforms and sometimes
2165c9e4df9bSmrg# not at the appropriate level. This macro enables a module to test for the
2166c9e4df9bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2167dfac8f13Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
2168c9e4df9bSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2169c9e4df9bSmrg# --with-asciidoc assumes 'auto'.
2170736a7e2cSmrg#
2171c9e4df9bSmrg# Interface to module:
2172c9e4df9bSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2173c9e4df9bSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
2174c9e4df9bSmrg#		 returns the path set by the user in the environment
2175c9e4df9bSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2176c9e4df9bSmrg#		  'no' user instructs the module not to use asciidoc
2177736a7e2cSmrg#
2178c9e4df9bSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2179736a7e2cSmrg#
2180c9e4df9bSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2181c9e4df9bSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2182c9e4df9bSmrgm4_define([_defopt], m4_default([$2], [auto]))
2183c9e4df9bSmrgAC_ARG_WITH(asciidoc,
2184c9e4df9bSmrg	AS_HELP_STRING([--with-asciidoc],
2185c9e4df9bSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2186c9e4df9bSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2187c9e4df9bSmrgm4_undefine([_defopt])
218865c1f7cfSmrg
2189c9e4df9bSmrgif test "x$use_asciidoc" = x"auto"; then
2190c9e4df9bSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2191c9e4df9bSmrg   if test "x$ASCIIDOC" = "x"; then
2192c9e4df9bSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2193c9e4df9bSmrg	have_asciidoc=no
2194c9e4df9bSmrg   else
2195c9e4df9bSmrg        have_asciidoc=yes
2196c9e4df9bSmrg   fi
2197c9e4df9bSmrgelif test "x$use_asciidoc" = x"yes" ; then
2198c9e4df9bSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2199c9e4df9bSmrg   if test "x$ASCIIDOC" = "x"; then
2200c9e4df9bSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2201c9e4df9bSmrg   fi
2202c9e4df9bSmrg   have_asciidoc=yes
2203c9e4df9bSmrgelif test "x$use_asciidoc" = x"no" ; then
2204c9e4df9bSmrg   if test "x$ASCIIDOC" != "x"; then
2205c9e4df9bSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2206c9e4df9bSmrg   fi
2207c9e4df9bSmrg   have_asciidoc=no
2208c9e4df9bSmrgelse
2209c9e4df9bSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2210c9e4df9bSmrgfi
2211c9e4df9bSmrgm4_ifval([$1],
2212c9e4df9bSmrg[if test "$have_asciidoc" = yes; then
2213c9e4df9bSmrg    # scrape the asciidoc version
2214c9e4df9bSmrg    AC_MSG_CHECKING([the asciidoc version])
2215c9e4df9bSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2216c9e4df9bSmrg    AC_MSG_RESULT([$asciidoc_version])
2217c9e4df9bSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2218c9e4df9bSmrg        [if test "x$use_asciidoc" = xauto; then
2219c9e4df9bSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2220c9e4df9bSmrg            have_asciidoc=no
2221c9e4df9bSmrg        else
2222c9e4df9bSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2223c9e4df9bSmrg        fi])
2224c9e4df9bSmrgfi])
2225c9e4df9bSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2226c9e4df9bSmrg]) # XORG_WITH_ASCIIDOC
222765c1f7cfSmrg
2228c9e4df9bSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
2229c9e4df9bSmrg# -------------------------------------------
2230c9e4df9bSmrg# Minimum version: 1.5.0
2231c9e4df9bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2232c9e4df9bSmrg# Minimum version for optional DOT checking: 1.18.0
2233736a7e2cSmrg#
2234c9e4df9bSmrg# Documentation tools are not always available on all platforms and sometimes
2235c9e4df9bSmrg# not at the appropriate level. This macro enables a module to test for the
2236c9e4df9bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2237dfac8f13Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
2238c9e4df9bSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2239c9e4df9bSmrg# --with-doxygen assumes 'auto'.
2240736a7e2cSmrg#
2241c9e4df9bSmrg# Interface to module:
2242c9e4df9bSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2243c9e4df9bSmrg# DOXYGEN:	 returns the path of the doxygen program found
2244c9e4df9bSmrg#		 returns the path set by the user in the environment
2245c9e4df9bSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2246c9e4df9bSmrg#		  'no' user instructs the module not to use doxygen
2247736a7e2cSmrg#
2248c9e4df9bSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
224965c1f7cfSmrg#
2250c9e4df9bSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2251c9e4df9bSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2252c9e4df9bSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
2253c9e4df9bSmrgm4_define([_defopt], m4_default([$2], [auto]))
2254c9e4df9bSmrgAC_ARG_WITH(doxygen,
2255c9e4df9bSmrg	AS_HELP_STRING([--with-doxygen],
2256c9e4df9bSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2257c9e4df9bSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2258c9e4df9bSmrgm4_undefine([_defopt])
225965c1f7cfSmrg
2260c9e4df9bSmrgif test "x$use_doxygen" = x"auto"; then
2261c9e4df9bSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2262c9e4df9bSmrg   if test "x$DOXYGEN" = "x"; then
2263c9e4df9bSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2264c9e4df9bSmrg	have_doxygen=no
2265c9e4df9bSmrg   else
2266c9e4df9bSmrg        have_doxygen=yes
2267c9e4df9bSmrg   fi
2268c9e4df9bSmrgelif test "x$use_doxygen" = x"yes" ; then
2269c9e4df9bSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2270c9e4df9bSmrg   if test "x$DOXYGEN" = "x"; then
2271c9e4df9bSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2272c9e4df9bSmrg   fi
2273c9e4df9bSmrg   have_doxygen=yes
2274c9e4df9bSmrgelif test "x$use_doxygen" = x"no" ; then
2275c9e4df9bSmrg   if test "x$DOXYGEN" != "x"; then
2276c9e4df9bSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2277c9e4df9bSmrg   fi
2278c9e4df9bSmrg   have_doxygen=no
2279736a7e2cSmrgelse
2280c9e4df9bSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2281736a7e2cSmrgfi
2282c9e4df9bSmrgm4_ifval([$1],
2283c9e4df9bSmrg[if test "$have_doxygen" = yes; then
2284c9e4df9bSmrg    # scrape the doxygen version
2285c9e4df9bSmrg    AC_MSG_CHECKING([the doxygen version])
2286c9e4df9bSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2287c9e4df9bSmrg    AC_MSG_RESULT([$doxygen_version])
2288c9e4df9bSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2289c9e4df9bSmrg        [if test "x$use_doxygen" = xauto; then
2290c9e4df9bSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2291c9e4df9bSmrg            have_doxygen=no
2292c9e4df9bSmrg        else
2293c9e4df9bSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2294c9e4df9bSmrg        fi])
2295c9e4df9bSmrgfi])
2296736a7e2cSmrg
2297c9e4df9bSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2298c9e4df9bSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2299c9e4df9bSmrgdnl 	HAVE_DOT = @HAVE_DOT@
2300c9e4df9bSmrgHAVE_DOT=no
2301c9e4df9bSmrgif test "x$have_doxygen" = "xyes"; then
2302c9e4df9bSmrg  AC_PATH_PROG([DOT], [dot])
2303c9e4df9bSmrg    if test "x$DOT" != "x"; then
2304c9e4df9bSmrg      HAVE_DOT=yes
2305c9e4df9bSmrg    fi
2306c9e4df9bSmrgfi
2307736a7e2cSmrg
2308c9e4df9bSmrgAC_SUBST([HAVE_DOT])
2309c9e4df9bSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2310c9e4df9bSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2311c9e4df9bSmrg]) # XORG_WITH_DOXYGEN
231265c1f7cfSmrg
2313c9e4df9bSmrg# XORG_WITH_GROFF([DEFAULT])
2314c9e4df9bSmrg# ----------------
2315c9e4df9bSmrg# Minimum version: 1.6.0
2316c9e4df9bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2317736a7e2cSmrg#
2318c9e4df9bSmrg# Documentation tools are not always available on all platforms and sometimes
2319c9e4df9bSmrg# not at the appropriate level. This macro enables a module to test for the
2320c9e4df9bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2321dfac8f13Smrg# the --with-groff option, it allows maximum flexibility in making decisions
2322c9e4df9bSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
2323c9e4df9bSmrg# --with-groff assumes 'auto'.
2324c9e4df9bSmrg#
2325c9e4df9bSmrg# Interface to module:
2326c9e4df9bSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2327c9e4df9bSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2328c9e4df9bSmrg# HAVE_GROFF_MS: the -ms macros package
2329c9e4df9bSmrg# GROFF:	 returns the path of the groff program found
2330c9e4df9bSmrg#		 returns the path set by the user in the environment
2331c9e4df9bSmrg# --with-groff:	 'yes' user instructs the module to use groff
2332c9e4df9bSmrg#		 'no' user instructs the module not to use groff
2333c9e4df9bSmrg#
2334c9e4df9bSmrg# Added in version 1.9.0:
2335c9e4df9bSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2336c9e4df9bSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2337c9e4df9bSmrg#		   psselect from the psutils package.
2338c9e4df9bSmrg#		   the ghostcript package. Refer to the grohtml man pages
2339c9e4df9bSmrg#
2340c9e4df9bSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2341c9e4df9bSmrg#
2342c9e4df9bSmrg# OS and distros often splits groff in a basic and full package, the former
2343c9e4df9bSmrg# having the groff program and the later having devices, fonts and macros
2344c9e4df9bSmrg# Checking for the groff executable is not enough.
2345c9e4df9bSmrg#
2346c9e4df9bSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
2347c9e4df9bSmrg# unset HAVE_GROFF or GROFF env variables.
2348c9e4df9bSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2349c9e4df9bSmrg#
2350c9e4df9bSmrgAC_DEFUN([XORG_WITH_GROFF],[
2351c9e4df9bSmrgAC_ARG_VAR([GROFF], [Path to groff command])
2352c9e4df9bSmrgm4_define([_defopt], m4_default([$1], [auto]))
2353c9e4df9bSmrgAC_ARG_WITH(groff,
2354c9e4df9bSmrg	AS_HELP_STRING([--with-groff],
2355c9e4df9bSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2356c9e4df9bSmrg	   [use_groff=$withval], [use_groff=]_defopt)
2357c9e4df9bSmrgm4_undefine([_defopt])
2358533545b5Smrg
2359c9e4df9bSmrgif test "x$use_groff" = x"auto"; then
2360c9e4df9bSmrg   AC_PATH_PROG([GROFF], [groff])
2361c9e4df9bSmrg   if test "x$GROFF" = "x"; then
2362c9e4df9bSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2363c9e4df9bSmrg	have_groff=no
2364c9e4df9bSmrg   else
2365c9e4df9bSmrg        have_groff=yes
2366c9e4df9bSmrg   fi
2367c9e4df9bSmrgelif test "x$use_groff" = x"yes" ; then
2368c9e4df9bSmrg   AC_PATH_PROG([GROFF], [groff])
2369c9e4df9bSmrg   if test "x$GROFF" = "x"; then
2370c9e4df9bSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2371c9e4df9bSmrg   fi
2372c9e4df9bSmrg   have_groff=yes
2373c9e4df9bSmrgelif test "x$use_groff" = x"no" ; then
2374c9e4df9bSmrg   if test "x$GROFF" != "x"; then
2375c9e4df9bSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2376c9e4df9bSmrg   fi
2377c9e4df9bSmrg   have_groff=no
2378c9e4df9bSmrgelse
2379c9e4df9bSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2380c9e4df9bSmrgfi
2381533545b5Smrg
2382c9e4df9bSmrg# We have groff, test for the presence of the macro packages
2383c9e4df9bSmrgif test "x$have_groff" = x"yes"; then
2384c9e4df9bSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2385c9e4df9bSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2386c9e4df9bSmrg        groff_ms_works=yes
2387c9e4df9bSmrg    else
2388c9e4df9bSmrg        groff_ms_works=no
238965c1f7cfSmrg    fi
2390c9e4df9bSmrg    AC_MSG_RESULT([$groff_ms_works])
2391c9e4df9bSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2392c9e4df9bSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2393c9e4df9bSmrg        groff_mm_works=yes
2394c9e4df9bSmrg    else
2395c9e4df9bSmrg        groff_mm_works=no
2396c9e4df9bSmrg    fi
2397c9e4df9bSmrg    AC_MSG_RESULT([$groff_mm_works])
2398c9e4df9bSmrgfi
2399736a7e2cSmrg
2400c9e4df9bSmrg# We have groff, test for HTML dependencies, one command per package
2401c9e4df9bSmrgif test "x$have_groff" = x"yes"; then
2402c9e4df9bSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2403c9e4df9bSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2404c9e4df9bSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2405c9e4df9bSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2406c9e4df9bSmrg      have_groff_html=yes
2407c9e4df9bSmrg   else
2408c9e4df9bSmrg      have_groff_html=no
2409c9e4df9bSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2410c9e4df9bSmrg   fi
2411c9e4df9bSmrgfi
2412c9e4df9bSmrg
2413c9e4df9bSmrg# Set Automake conditionals for Makefiles
2414c9e4df9bSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2415c9e4df9bSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2416c9e4df9bSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2417c9e4df9bSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2418c9e4df9bSmrg]) # XORG_WITH_GROFF
2419c9e4df9bSmrg
2420c9e4df9bSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2421c9e4df9bSmrg# ---------------------------------------
2422c9e4df9bSmrg# Minimum version: 1.6.0
2423c9e4df9bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2424c9e4df9bSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2425c9e4df9bSmrg#
2426c9e4df9bSmrg# Documentation tools are not always available on all platforms and sometimes
2427c9e4df9bSmrg# not at the appropriate level. This macro enables a module to test for the
2428c9e4df9bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2429dfac8f13Smrg# the --with-fop option, it allows maximum flexibility in making decisions
2430c9e4df9bSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
2431c9e4df9bSmrg# --with-fop assumes 'auto'.
2432c9e4df9bSmrg#
2433c9e4df9bSmrg# Interface to module:
2434c9e4df9bSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2435c9e4df9bSmrg# FOP:	 	returns the path of the fop program found
2436c9e4df9bSmrg#		returns the path set by the user in the environment
2437c9e4df9bSmrg# --with-fop: 	'yes' user instructs the module to use fop
2438c9e4df9bSmrg#		'no' user instructs the module not to use fop
2439c9e4df9bSmrg#
2440c9e4df9bSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2441c9e4df9bSmrg#
2442c9e4df9bSmrgAC_DEFUN([XORG_WITH_FOP],[
2443c9e4df9bSmrgAC_ARG_VAR([FOP], [Path to fop command])
2444c9e4df9bSmrgm4_define([_defopt], m4_default([$2], [auto]))
2445c9e4df9bSmrgAC_ARG_WITH(fop,
2446c9e4df9bSmrg	AS_HELP_STRING([--with-fop],
2447c9e4df9bSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2448c9e4df9bSmrg	   [use_fop=$withval], [use_fop=]_defopt)
2449c9e4df9bSmrgm4_undefine([_defopt])
2450c9e4df9bSmrg
2451c9e4df9bSmrgif test "x$use_fop" = x"auto"; then
2452c9e4df9bSmrg   AC_PATH_PROG([FOP], [fop])
2453c9e4df9bSmrg   if test "x$FOP" = "x"; then
2454c9e4df9bSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2455c9e4df9bSmrg	have_fop=no
2456c9e4df9bSmrg   else
2457c9e4df9bSmrg        have_fop=yes
2458c9e4df9bSmrg   fi
2459c9e4df9bSmrgelif test "x$use_fop" = x"yes" ; then
2460c9e4df9bSmrg   AC_PATH_PROG([FOP], [fop])
2461c9e4df9bSmrg   if test "x$FOP" = "x"; then
2462c9e4df9bSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2463c9e4df9bSmrg   fi
2464c9e4df9bSmrg   have_fop=yes
2465c9e4df9bSmrgelif test "x$use_fop" = x"no" ; then
2466c9e4df9bSmrg   if test "x$FOP" != "x"; then
2467c9e4df9bSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2468c9e4df9bSmrg   fi
2469c9e4df9bSmrg   have_fop=no
2470736a7e2cSmrgelse
2471c9e4df9bSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2472736a7e2cSmrgfi
2473736a7e2cSmrg
2474c9e4df9bSmrg# Test for a minimum version of fop, if provided.
2475c9e4df9bSmrgm4_ifval([$1],
2476c9e4df9bSmrg[if test "$have_fop" = yes; then
2477c9e4df9bSmrg    # scrape the fop version
2478c9e4df9bSmrg    AC_MSG_CHECKING([for fop minimum version])
2479c9e4df9bSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2480c9e4df9bSmrg    AC_MSG_RESULT([$fop_version])
2481c9e4df9bSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
2482c9e4df9bSmrg        [if test "x$use_fop" = xauto; then
2483c9e4df9bSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2484c9e4df9bSmrg            have_fop=no
2485c9e4df9bSmrg        else
2486c9e4df9bSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2487c9e4df9bSmrg        fi])
2488c9e4df9bSmrgfi])
2489c9e4df9bSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2490c9e4df9bSmrg]) # XORG_WITH_FOP
2491c9e4df9bSmrg
2492c9e4df9bSmrg# XORG_WITH_M4([MIN-VERSION])
2493c9e4df9bSmrg# ---------------------------
2494c9e4df9bSmrg# Minimum version: 1.19.0
2495c9e4df9bSmrg#
2496c9e4df9bSmrg# This macro attempts to locate an m4 macro processor which supports
2497c9e4df9bSmrg# -I option and is only useful for modules relying on M4 in order to
2498c9e4df9bSmrg# expand macros in source code files.
2499c9e4df9bSmrg#
2500c9e4df9bSmrg# Interface to module:
2501c9e4df9bSmrg# M4:	 	returns the path of the m4 program found
2502c9e4df9bSmrg#		returns the path set by the user in the environment
2503c9e4df9bSmrg#
2504c9e4df9bSmrgAC_DEFUN([XORG_WITH_M4], [
2505c9e4df9bSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2506c9e4df9bSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2507c9e4df9bSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2508c9e4df9bSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2509c9e4df9bSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2510c9e4df9bSmrg   [$PATH:/usr/gnu/bin])])
2511736a7e2cSmrg
2512c9e4df9bSmrgAC_SUBST([M4], [$ac_cv_path_M4])
2513c9e4df9bSmrg]) # XORG_WITH_M4
251465c1f7cfSmrg
2515c9e4df9bSmrg# XORG_WITH_PS2PDF([DEFAULT])
2516c9e4df9bSmrg# ----------------
2517c9e4df9bSmrg# Minimum version: 1.6.0
2518c9e4df9bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2519c9e4df9bSmrg#
2520c9e4df9bSmrg# Documentation tools are not always available on all platforms and sometimes
2521c9e4df9bSmrg# not at the appropriate level. This macro enables a module to test for the
2522c9e4df9bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2523dfac8f13Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
2524c9e4df9bSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2525c9e4df9bSmrg# --with-ps2pdf assumes 'auto'.
2526c9e4df9bSmrg#
2527c9e4df9bSmrg# Interface to module:
2528c9e4df9bSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2529c9e4df9bSmrg# PS2PDF:	returns the path of the ps2pdf program found
2530c9e4df9bSmrg#		returns the path set by the user in the environment
2531c9e4df9bSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2532c9e4df9bSmrg#		 'no' user instructs the module not to use ps2pdf
2533c9e4df9bSmrg#
2534c9e4df9bSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2535c9e4df9bSmrg#
2536c9e4df9bSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2537c9e4df9bSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2538c9e4df9bSmrgm4_define([_defopt], m4_default([$1], [auto]))
2539c9e4df9bSmrgAC_ARG_WITH(ps2pdf,
2540c9e4df9bSmrg	AS_HELP_STRING([--with-ps2pdf],
2541c9e4df9bSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2542c9e4df9bSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2543c9e4df9bSmrgm4_undefine([_defopt])
254465c1f7cfSmrg
2545c9e4df9bSmrgif test "x$use_ps2pdf" = x"auto"; then
2546c9e4df9bSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2547c9e4df9bSmrg   if test "x$PS2PDF" = "x"; then
2548c9e4df9bSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2549c9e4df9bSmrg	have_ps2pdf=no
2550c9e4df9bSmrg   else
2551c9e4df9bSmrg        have_ps2pdf=yes
2552c9e4df9bSmrg   fi
2553c9e4df9bSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2554c9e4df9bSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2555c9e4df9bSmrg   if test "x$PS2PDF" = "x"; then
2556c9e4df9bSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2557c9e4df9bSmrg   fi
2558c9e4df9bSmrg   have_ps2pdf=yes
2559c9e4df9bSmrgelif test "x$use_ps2pdf" = x"no" ; then
2560c9e4df9bSmrg   if test "x$PS2PDF" != "x"; then
2561c9e4df9bSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2562c9e4df9bSmrg   fi
2563c9e4df9bSmrg   have_ps2pdf=no
2564c9e4df9bSmrgelse
2565c9e4df9bSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
256665c1f7cfSmrgfi
2567c9e4df9bSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2568c9e4df9bSmrg]) # XORG_WITH_PS2PDF
2569736a7e2cSmrg
2570c9e4df9bSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2571c9e4df9bSmrg# ----------------
2572c9e4df9bSmrg# Minimum version: 1.6.0
2573e4ee1255Smrg#
2574c9e4df9bSmrg# Documentation tools are not always available on all platforms and sometimes
2575c9e4df9bSmrg# not at the appropriate level. This macro enables a builder to skip all
2576c9e4df9bSmrg# documentation targets except traditional man pages.
2577c9e4df9bSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2578dfac8f13Smrg# maximum flexibility in controlling documentation building.
2579c9e4df9bSmrg# Refer to:
2580c9e4df9bSmrg# XORG_WITH_XMLTO         --with-xmlto
2581c9e4df9bSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2582c9e4df9bSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2583c9e4df9bSmrg# XORG_WITH_FOP           --with-fop
2584c9e4df9bSmrg# XORG_WITH_GROFF         --with-groff
2585c9e4df9bSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2586c9e4df9bSmrg#
2587c9e4df9bSmrg# Interface to module:
2588c9e4df9bSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2589c9e4df9bSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2590c9e4df9bSmrg#		 'no' user instructs the module not to generate docs
2591c9e4df9bSmrg# parm1:	specify the default value, yes or no.
2592c9e4df9bSmrg#
2593c9e4df9bSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2594c9e4df9bSmrgm4_define([docs_default], m4_default([$1], [yes]))
2595c9e4df9bSmrgAC_ARG_ENABLE(docs,
2596c9e4df9bSmrg	AS_HELP_STRING([--enable-docs],
2597c9e4df9bSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2598c9e4df9bSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2599c9e4df9bSmrgm4_undefine([docs_default])
2600c9e4df9bSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2601c9e4df9bSmrgAC_MSG_CHECKING([whether to build documentation])
2602c9e4df9bSmrgAC_MSG_RESULT([$build_docs])
2603c9e4df9bSmrg]) # XORG_ENABLE_DOCS
2604533545b5Smrg
2605c9e4df9bSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2606c9e4df9bSmrg# ----------------
2607c9e4df9bSmrg# Minimum version: 1.6.0
2608c9e4df9bSmrg#
2609c9e4df9bSmrg# This macro enables a builder to skip all developer documentation.
2610c9e4df9bSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2611dfac8f13Smrg# maximum flexibility in controlling documentation building.
2612c9e4df9bSmrg# Refer to:
2613c9e4df9bSmrg# XORG_WITH_XMLTO         --with-xmlto
2614c9e4df9bSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2615c9e4df9bSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2616c9e4df9bSmrg# XORG_WITH_FOP           --with-fop
2617c9e4df9bSmrg# XORG_WITH_GROFF         --with-groff
2618c9e4df9bSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2619c9e4df9bSmrg#
2620c9e4df9bSmrg# Interface to module:
2621c9e4df9bSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2622c9e4df9bSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2623c9e4df9bSmrg#			'no' user instructs the module not to generate developer docs
2624c9e4df9bSmrg# parm1:		specify the default value, yes or no.
2625c9e4df9bSmrg#
2626c9e4df9bSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2627c9e4df9bSmrgm4_define([devel_default], m4_default([$1], [yes]))
2628c9e4df9bSmrgAC_ARG_ENABLE(devel-docs,
2629c9e4df9bSmrg	AS_HELP_STRING([--enable-devel-docs],
2630c9e4df9bSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2631c9e4df9bSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2632c9e4df9bSmrgm4_undefine([devel_default])
2633c9e4df9bSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2634c9e4df9bSmrgAC_MSG_CHECKING([whether to build developer documentation])
2635c9e4df9bSmrgAC_MSG_RESULT([$build_devel_docs])
2636c9e4df9bSmrg]) # XORG_ENABLE_DEVEL_DOCS
263765c1f7cfSmrg
2638c9e4df9bSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
2639c9e4df9bSmrg# ----------------
2640c9e4df9bSmrg# Minimum version: 1.6.0
2641c9e4df9bSmrg#
2642c9e4df9bSmrg# This macro enables a builder to skip all functional specification targets.
2643c9e4df9bSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2644dfac8f13Smrg# maximum flexibility in controlling documentation building.
2645c9e4df9bSmrg# Refer to:
2646c9e4df9bSmrg# XORG_WITH_XMLTO         --with-xmlto
2647c9e4df9bSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2648c9e4df9bSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2649c9e4df9bSmrg# XORG_WITH_FOP           --with-fop
2650c9e4df9bSmrg# XORG_WITH_GROFF         --with-groff
2651c9e4df9bSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2652c9e4df9bSmrg#
2653c9e4df9bSmrg# Interface to module:
2654c9e4df9bSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2655c9e4df9bSmrg# --enable-specs:	'yes' user instructs the module to generate specs
2656c9e4df9bSmrg#			'no' user instructs the module not to generate specs
2657c9e4df9bSmrg# parm1:		specify the default value, yes or no.
2658c9e4df9bSmrg#
2659c9e4df9bSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2660c9e4df9bSmrgm4_define([spec_default], m4_default([$1], [yes]))
2661c9e4df9bSmrgAC_ARG_ENABLE(specs,
2662c9e4df9bSmrg	AS_HELP_STRING([--enable-specs],
2663c9e4df9bSmrg	   [Enable building the specs (default: ]spec_default[)]),
2664c9e4df9bSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
2665c9e4df9bSmrgm4_undefine([spec_default])
2666c9e4df9bSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2667c9e4df9bSmrgAC_MSG_CHECKING([whether to build functional specifications])
2668c9e4df9bSmrgAC_MSG_RESULT([$build_specs])
2669c9e4df9bSmrg]) # XORG_ENABLE_SPECS
267065c1f7cfSmrg
2671c9e4df9bSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2672c9e4df9bSmrg# ----------------------------------------------
2673c9e4df9bSmrg# Minimum version: 1.13.0
2674533545b5Smrg#
2675c9e4df9bSmrg# This macro enables a builder to enable/disable unit testing
2676c9e4df9bSmrg# It makes no assumption about the test cases implementation
2677c9e4df9bSmrg# Test cases may or may not use Automake "Support for test suites"
2678c9e4df9bSmrg# They may or may not use the software utility library GLib
2679c9e4df9bSmrg#
2680c9e4df9bSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2681c9e4df9bSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2682c9e4df9bSmrg# The variable enable_unit_tests is used by other macros in this file.
2683c9e4df9bSmrg#
2684c9e4df9bSmrg# Interface to module:
2685c9e4df9bSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2686c9e4df9bSmrg# enable_unit_tests:    used in configure.ac for additional configuration
2687c9e4df9bSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2688c9e4df9bSmrg#			'no' user instructs the module not to build tests
2689c9e4df9bSmrg# parm1:		specify the default value, yes or no.
2690c9e4df9bSmrg#
2691c9e4df9bSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2692c9e4df9bSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2693c9e4df9bSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2694c9e4df9bSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2695c9e4df9bSmrgm4_define([_defopt], m4_default([$1], [auto]))
2696c9e4df9bSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2697c9e4df9bSmrg	[Enable building unit test cases (default: ]_defopt[)]),
2698c9e4df9bSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2699c9e4df9bSmrgm4_undefine([_defopt])
2700c9e4df9bSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2701c9e4df9bSmrgAC_MSG_CHECKING([whether to build unit test cases])
2702c9e4df9bSmrgAC_MSG_RESULT([$enable_unit_tests])
2703c9e4df9bSmrg]) # XORG_ENABLE_UNIT_TESTS
270465c1f7cfSmrg
2705c9e4df9bSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2706c9e4df9bSmrg# ------------------------------------------------------
2707c9e4df9bSmrg# Minimum version: 1.17.0
2708c9e4df9bSmrg#
2709c9e4df9bSmrg# This macro enables a builder to enable/disable integration testing
2710c9e4df9bSmrg# It makes no assumption about the test cases' implementation
2711c9e4df9bSmrg# Test cases may or may not use Automake "Support for test suites"
2712c9e4df9bSmrg#
2713c9e4df9bSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2714c9e4df9bSmrg# usually requires less dependencies and may be built and run under less
2715c9e4df9bSmrg# stringent environments than integration tests.
2716c9e4df9bSmrg#
2717c9e4df9bSmrg# Interface to module:
2718c9e4df9bSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2719c9e4df9bSmrg# enable_integration_tests:   used in configure.ac for additional configuration
2720c9e4df9bSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2721c9e4df9bSmrg#                             'no' user instructs the module not to build tests
2722c9e4df9bSmrg# parm1:                      specify the default value, yes or no.
2723c9e4df9bSmrg#
2724c9e4df9bSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2725c9e4df9bSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2726c9e4df9bSmrgm4_define([_defopt], m4_default([$1], [auto]))
2727c9e4df9bSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2728c9e4df9bSmrg	[Enable building integration test cases (default: ]_defopt[)]),
2729c9e4df9bSmrg	[enable_integration_tests=$enableval],
2730c9e4df9bSmrg	[enable_integration_tests=]_defopt)
2731c9e4df9bSmrgm4_undefine([_defopt])
2732c9e4df9bSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2733c9e4df9bSmrg	[test "x$enable_integration_tests" != xno])
2734c9e4df9bSmrgAC_MSG_CHECKING([whether to build unit test cases])
2735c9e4df9bSmrgAC_MSG_RESULT([$enable_integration_tests])
2736c9e4df9bSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
273765c1f7cfSmrg
2738c9e4df9bSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2739c9e4df9bSmrg# ----------------------------------------
2740c9e4df9bSmrg# Minimum version: 1.13.0
2741c9e4df9bSmrg#
2742c9e4df9bSmrg# GLib is a library which provides advanced data structures and functions.
2743c9e4df9bSmrg# This macro enables a module to test for the presence of Glib.
2744c9e4df9bSmrg#
2745c9e4df9bSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2746c9e4df9bSmrg# Otherwise the value of $enable_unit_tests is blank.
2747c9e4df9bSmrg#
2748c9e4df9bSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2749c9e4df9bSmrg# test support usually requires less dependencies and may be built and run under
2750c9e4df9bSmrg# less stringent environments than integration tests.
2751e4ee1255Smrg#
2752c9e4df9bSmrg# Interface to module:
2753c9e4df9bSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
2754c9e4df9bSmrg# with_glib: used in configure.ac to know if GLib has been found
2755c9e4df9bSmrg# --with-glib:	'yes' user instructs the module to use glib
2756c9e4df9bSmrg#		'no' user instructs the module not to use glib
2757c9e4df9bSmrg#
2758c9e4df9bSmrgAC_DEFUN([XORG_WITH_GLIB],[
2759c9e4df9bSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2760c9e4df9bSmrgm4_define([_defopt], m4_default([$2], [auto]))
2761c9e4df9bSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2762c9e4df9bSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2763c9e4df9bSmrg	[with_glib=$withval], [with_glib=]_defopt)
2764c9e4df9bSmrgm4_undefine([_defopt])
2765e4ee1255Smrg
2766c9e4df9bSmrghave_glib=no
2767c9e4df9bSmrg# Do not probe GLib if user explicitly disabled unit testing
2768c9e4df9bSmrgif test "x$enable_unit_tests" != x"no"; then
2769c9e4df9bSmrg  # Do not probe GLib if user explicitly disabled it
2770c9e4df9bSmrg  if test "x$with_glib" != x"no"; then
2771c9e4df9bSmrg    m4_ifval(
2772c9e4df9bSmrg      [$1],
2773c9e4df9bSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2774c9e4df9bSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2775c9e4df9bSmrg    )
2776e4ee1255Smrg  fi
2777e4ee1255Smrgfi
2778e4ee1255Smrg
2779c9e4df9bSmrg# Not having GLib when unit testing has been explicitly requested is an error
2780c9e4df9bSmrgif test "x$enable_unit_tests" = x"yes"; then
2781c9e4df9bSmrg  if test "x$have_glib" = x"no"; then
2782c9e4df9bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2783e4ee1255Smrg  fi
2784e4ee1255Smrgfi
2785e4ee1255Smrg
2786c9e4df9bSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
2787c9e4df9bSmrgif test "x$enable_unit_tests" = x"no"; then
2788c9e4df9bSmrg  if test "x$with_glib" = x"yes"; then
2789c9e4df9bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2790c9e4df9bSmrg  fi
2791c9e4df9bSmrgfi
2792e4ee1255Smrg
2793c9e4df9bSmrg# Not having GLib when it has been explicitly requested is an error
2794c9e4df9bSmrgif test "x$with_glib" = x"yes"; then
2795c9e4df9bSmrg  if test "x$have_glib" = x"no"; then
2796c9e4df9bSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2797c9e4df9bSmrg  fi
2798c9e4df9bSmrgfi
2799e4ee1255Smrg
2800c9e4df9bSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2801c9e4df9bSmrg]) # XORG_WITH_GLIB
2802533545b5Smrg
2803c9e4df9bSmrg# XORG_LD_WRAP([required|optional])
2804c9e4df9bSmrg# ---------------------------------
2805c9e4df9bSmrg# Minimum version: 1.13.0
2806c9e4df9bSmrg#
2807c9e4df9bSmrg# Check if linker supports -wrap, passed via compiler flags
2808c9e4df9bSmrg#
2809c9e4df9bSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2810c9e4df9bSmrg# Otherwise the value of $enable_unit_tests is blank.
2811c9e4df9bSmrg#
2812c9e4df9bSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2813c9e4df9bSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2814c9e4df9bSmrg# available, an argument of "optional" allows use when some unit tests require
2815c9e4df9bSmrg# ld -wrap and others do not.
2816c9e4df9bSmrg#
2817c9e4df9bSmrgAC_DEFUN([XORG_LD_WRAP],[
2818c9e4df9bSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2819c9e4df9bSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2820c9e4df9bSmrg                      void __wrap_exit(int status) { return; }],
2821c9e4df9bSmrg                     [exit(0);])])
2822c9e4df9bSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
2823c9e4df9bSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2824c9e4df9bSmrg  if test "x$have_ld_wrap" = x"no"; then
2825c9e4df9bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2826c9e4df9bSmrg  fi
2827c9e4df9bSmrgfi
2828c9e4df9bSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2829c9e4df9bSmrg#
2830c9e4df9bSmrg]) # XORG_LD_WRAP
2831533545b5Smrg
2832c9e4df9bSmrg# XORG_CHECK_LINKER_FLAGS
2833c9e4df9bSmrg# -----------------------
2834c9e4df9bSmrg# SYNOPSIS
2835c9e4df9bSmrg#
2836c9e4df9bSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2837c9e4df9bSmrg#
2838c9e4df9bSmrg# DESCRIPTION
2839c9e4df9bSmrg#
2840c9e4df9bSmrg#   Check whether the given linker FLAGS work with the current language's
2841c9e4df9bSmrg#   linker, or whether they give an error.
2842c9e4df9bSmrg#
2843c9e4df9bSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2844c9e4df9bSmrg#   success/failure.
2845c9e4df9bSmrg#
2846c9e4df9bSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
2847c9e4df9bSmrg#
2848c9e4df9bSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2849c9e4df9bSmrg#
2850c9e4df9bSmrg# LICENSE
2851c9e4df9bSmrg#
2852c9e4df9bSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2853c9e4df9bSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2854c9e4df9bSmrg#   Copyright (c) 2009 Matteo Frigo
2855c9e4df9bSmrg#
2856c9e4df9bSmrg#   This program is free software: you can redistribute it and/or modify it
2857c9e4df9bSmrg#   under the terms of the GNU General Public License as published by the
2858c9e4df9bSmrg#   Free Software Foundation, either version 3 of the License, or (at your
2859c9e4df9bSmrg#   option) any later version.
2860c9e4df9bSmrg#
2861c9e4df9bSmrg#   This program is distributed in the hope that it will be useful, but
2862c9e4df9bSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2863c9e4df9bSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2864c9e4df9bSmrg#   Public License for more details.
2865c9e4df9bSmrg#
2866c9e4df9bSmrg#   You should have received a copy of the GNU General Public License along
2867c9e4df9bSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2868c9e4df9bSmrg#
2869c9e4df9bSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
2870c9e4df9bSmrg#   gives unlimited permission to copy, distribute and modify the configure
2871c9e4df9bSmrg#   scripts that are the output of Autoconf when processing the Macro. You
2872c9e4df9bSmrg#   need not follow the terms of the GNU General Public License when using
2873c9e4df9bSmrg#   or distributing such scripts, even though portions of the text of the
2874c9e4df9bSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2875c9e4df9bSmrg#   all other use of the material that constitutes the Autoconf Macro.
2876c9e4df9bSmrg#
2877c9e4df9bSmrg#   This special exception to the GPL applies to versions of the Autoconf
2878c9e4df9bSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
2879c9e4df9bSmrg#   modified version of the Autoconf Macro, you may extend this special
2880c9e4df9bSmrg#   exception to the GPL to apply to your modified version as well.#
2881c9e4df9bSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2882c9e4df9bSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
2883c9e4df9bSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2884c9e4df9bSmrgAS_LITERAL_IF([$1],
2885c9e4df9bSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2886c9e4df9bSmrg      ax_save_FLAGS=$LDFLAGS
2887c9e4df9bSmrg      LDFLAGS="$1"
2888c9e4df9bSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2889c9e4df9bSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2890c9e4df9bSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2891c9e4df9bSmrg      LDFLAGS=$ax_save_FLAGS])],
2892c9e4df9bSmrg  [ax_save_FLAGS=$LDFLAGS
2893c9e4df9bSmrg   LDFLAGS="$1"
2894c9e4df9bSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2895c9e4df9bSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2896c9e4df9bSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2897c9e4df9bSmrg   LDFLAGS=$ax_save_FLAGS])
2898c9e4df9bSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2899c9e4df9bSmrgAC_MSG_RESULT($xorg_check_linker_flags)
2900c9e4df9bSmrgif test "x$xorg_check_linker_flags" = xyes; then
2901c9e4df9bSmrg	m4_default([$2], :)
2902c9e4df9bSmrgelse
2903c9e4df9bSmrg	m4_default([$3], :)
2904c9e4df9bSmrgfi
2905c9e4df9bSmrg]) # XORG_CHECK_LINKER_FLAGS
2906533545b5Smrg
2907c9e4df9bSmrg# XORG_MEMORY_CHECK_FLAGS
2908c9e4df9bSmrg# -----------------------
2909c9e4df9bSmrg# Minimum version: 1.16.0
2910c9e4df9bSmrg#
2911c9e4df9bSmrg# This macro attempts to find appropriate memory checking functionality
2912c9e4df9bSmrg# for various platforms which unit testing code may use to catch various
2913c9e4df9bSmrg# forms of memory allocation and access errors in testing.
2914c9e4df9bSmrg#
2915c9e4df9bSmrg# Interface to module:
2916c9e4df9bSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2917c9e4df9bSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2918c9e4df9bSmrg#
2919c9e4df9bSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2920c9e4df9bSmrg#
2921c9e4df9bSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2922533545b5Smrg
2923c9e4df9bSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2924c9e4df9bSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2925c9e4df9bSmrg           [Environment variables to enable memory checking in tests])
2926533545b5Smrg
2927c9e4df9bSmrg# Check for different types of support on different platforms
2928c9e4df9bSmrgcase $host_os in
2929c9e4df9bSmrg    solaris*)
2930c9e4df9bSmrg        AC_CHECK_LIB([umem], [umem_alloc],
2931c9e4df9bSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2932c9e4df9bSmrg        ;;
2933c9e4df9bSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2934c9e4df9bSmrg        # both directly and inverted, so should not be 0 or 255.
2935c9e4df9bSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
2936c9e4df9bSmrg        ;;
2937c9e4df9bSmrg    darwin*)
2938c9e4df9bSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2939c9e4df9bSmrg        ;;
2940c9e4df9bSmrg    *bsd*)
2941c9e4df9bSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2942c9e4df9bSmrg        ;;
2943c9e4df9bSmrgesac
2944264fa531Smrg
2945c9e4df9bSmrg# User supplied flags override default flags
2946c9e4df9bSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2947c9e4df9bSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2948264fa531Smrgfi
2949264fa531Smrg
2950c9e4df9bSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2951c9e4df9bSmrg]) # XORG_WITH_LINT
295265c1f7cfSmrg
2953c9e4df9bSmrg# XORG_CHECK_MALLOC_ZERO
2954c9e4df9bSmrg# ----------------------
2955c9e4df9bSmrg# Minimum version: 1.0.0
2956c37a63b8Smrg#
2957c9e4df9bSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2958c9e4df9bSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2959c9e4df9bSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2960c9e4df9bSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2961c9e4df9bSmrgAC_ARG_ENABLE(malloc0returnsnull,
2962c9e4df9bSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2963c9e4df9bSmrg		       [malloc(0) returns NULL (default: auto)]),
2964c9e4df9bSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2965c9e4df9bSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2966c37a63b8Smrg
2967c9e4df9bSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2968c9e4df9bSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2969c9e4df9bSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
2970c9e4df9bSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2971c9e4df9bSmrg#include <stdlib.h>
2972c9e4df9bSmrg],[
2973c9e4df9bSmrg    char *m0, *r0, *c0, *p;
2974c9e4df9bSmrg    m0 = malloc(0);
2975c9e4df9bSmrg    p = malloc(10);
2976c9e4df9bSmrg    r0 = realloc(p,0);
2977c9e4df9bSmrg    c0 = calloc(0,10);
2978c9e4df9bSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2979c9e4df9bSmrg])],
2980c9e4df9bSmrg		[xorg_cv_malloc0_returns_null=yes],
2981c9e4df9bSmrg		[xorg_cv_malloc0_returns_null=no])])
2982c9e4df9bSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
298365c1f7cfSmrgfi
2984c9e4df9bSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2985736a7e2cSmrg
2986c9e4df9bSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2987c9e4df9bSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2988c9e4df9bSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2989c9e4df9bSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2990c37a63b8Smrgelse
2991c9e4df9bSmrg	MALLOC_ZERO_CFLAGS=""
2992c9e4df9bSmrg	XMALLOC_ZERO_CFLAGS=""
2993c9e4df9bSmrg	XTMALLOC_ZERO_CFLAGS=""
2994c37a63b8Smrgfi
2995c37a63b8Smrg
2996c9e4df9bSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2997c9e4df9bSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2998c9e4df9bSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2999c9e4df9bSmrg]) # XORG_CHECK_MALLOC_ZERO
3000c37a63b8Smrg
3001c9e4df9bSmrg# XORG_WITH_LINT()
3002c9e4df9bSmrg# ----------------
3003c9e4df9bSmrg# Minimum version: 1.1.0
3004736a7e2cSmrg#
3005c9e4df9bSmrg# This macro enables the use of a tool that flags some suspicious and
3006c9e4df9bSmrg# non-portable constructs (likely to be bugs) in C language source code.
3007c9e4df9bSmrg# It will attempt to locate the tool and use appropriate options.
3008c9e4df9bSmrg# There are various lint type tools on different platforms.
3009533545b5Smrg#
3010c9e4df9bSmrg# Interface to module:
3011c9e4df9bSmrg# LINT:		returns the path to the tool found on the platform
3012c9e4df9bSmrg#		or the value set to LINT on the configure cmd line
3013c9e4df9bSmrg#		also an Automake conditional
3014c9e4df9bSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
3015c9e4df9bSmrg#
3016c9e4df9bSmrg# --with-lint:	'yes' user instructs the module to use lint
3017c9e4df9bSmrg#		'no' user instructs the module not to use lint (default)
3018c9e4df9bSmrg#
3019c9e4df9bSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
3020c9e4df9bSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
3021c9e4df9bSmrg#
3022c9e4df9bSmrgAC_DEFUN([XORG_WITH_LINT],[
3023533545b5Smrg
3024c9e4df9bSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
3025c9e4df9bSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
3026c9e4df9bSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
3027c9e4df9bSmrg		[Use a lint-style source code checker (default: disabled)])],
3028c9e4df9bSmrg		[use_lint=$withval], [use_lint=no])
3029533545b5Smrg
3030c9e4df9bSmrg# Obtain platform specific info like program name and options
3031c9e4df9bSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
3032c9e4df9bSmrgcase $host_os in
3033c9e4df9bSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
3034c9e4df9bSmrg	lint_name=splint
3035c9e4df9bSmrg	lint_options="-badflag"
3036c9e4df9bSmrg	;;
3037c9e4df9bSmrg  *freebsd* | *netbsd*)
3038c9e4df9bSmrg	lint_name=lint
3039c9e4df9bSmrg	lint_options="-u -b"
3040c9e4df9bSmrg	;;
3041c9e4df9bSmrg  *solaris*)
3042c9e4df9bSmrg	lint_name=lint
3043c9e4df9bSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
3044c9e4df9bSmrg	;;
3045c9e4df9bSmrgesac
3046c9e4df9bSmrg
3047c9e4df9bSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
3048c9e4df9bSmrgif test "x$use_lint" = x"yes" ; then
3049c9e4df9bSmrg   AC_PATH_PROG([LINT], [$lint_name])
3050c9e4df9bSmrg   if test "x$LINT" = "x"; then
3051c9e4df9bSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
3052c9e4df9bSmrg   fi
3053c9e4df9bSmrgelif test "x$use_lint" = x"no" ; then
3054c9e4df9bSmrg   if test "x$LINT" != "x"; then
3055c9e4df9bSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
3056c9e4df9bSmrg   fi
305765c1f7cfSmrgelse
3058c9e4df9bSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
3059533545b5Smrgfi
3060533545b5Smrg
3061c9e4df9bSmrg# User supplied flags override default flags
3062c9e4df9bSmrgif test "x$LINT_FLAGS" != "x"; then
3063c9e4df9bSmrg   lint_options=$LINT_FLAGS
3064c9e4df9bSmrgfi
3065533545b5Smrg
3066c9e4df9bSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
3067c9e4df9bSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
3068533545b5Smrg
3069c9e4df9bSmrg]) # XORG_WITH_LINT
3070533545b5Smrg
3071c9e4df9bSmrg# XORG_LINT_LIBRARY(LIBNAME)
3072c9e4df9bSmrg# --------------------------
3073c9e4df9bSmrg# Minimum version: 1.1.0
3074533545b5Smrg#
3075c9e4df9bSmrg# Sets up flags for building lint libraries for checking programs that call
3076c9e4df9bSmrg# functions in the library.
3077c9e4df9bSmrg#
3078c9e4df9bSmrg# Interface to module:
3079c9e4df9bSmrg# LINTLIB		- Automake variable with the name of lint library file to make
3080c9e4df9bSmrg# MAKE_LINT_LIB		- Automake conditional
3081c9e4df9bSmrg#
3082c9e4df9bSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
3083c9e4df9bSmrg#			  - 'no' user instructs the module not to create a lint library (default)
3084533545b5Smrg
3085c9e4df9bSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
3086c9e4df9bSmrgAC_REQUIRE([XORG_WITH_LINT])
3087c9e4df9bSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
3088c9e4df9bSmrg	[Create lint library (default: disabled)])],
3089c9e4df9bSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
3090c9e4df9bSmrg
3091c9e4df9bSmrgif test "x$make_lint_lib" = x"yes" ; then
3092c9e4df9bSmrg   LINTLIB=llib-l$1.ln
3093c9e4df9bSmrg   if test "x$LINT" = "x"; then
3094c9e4df9bSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
3095c9e4df9bSmrg   fi
3096c9e4df9bSmrgelif test "x$make_lint_lib" != x"no" ; then
3097c9e4df9bSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
3098533545b5Smrgfi
3099533545b5Smrg
3100c9e4df9bSmrgAC_SUBST(LINTLIB)
3101c9e4df9bSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
310265c1f7cfSmrg
3103c9e4df9bSmrg]) # XORG_LINT_LIBRARY
310465c1f7cfSmrg
3105c9e4df9bSmrg# XORG_COMPILER_BRAND
310665c1f7cfSmrg# -------------------
3107c9e4df9bSmrg# Minimum version: 1.14.0
310865c1f7cfSmrg#
3109c9e4df9bSmrg# Checks for various brands of compilers and sets flags as appropriate:
3110c9e4df9bSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
3111c9e4df9bSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
3112c9e4df9bSmrg#   clang compiler - sets CLANGCC to "yes"
3113c9e4df9bSmrg#   Intel compiler - sets INTELCC to "yes"
3114c9e4df9bSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
3115c9e4df9bSmrg#
3116c9e4df9bSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
3117c9e4df9bSmrgAC_LANG_CASE(
3118c9e4df9bSmrg	[C], [
3119dfac8f13Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
3120dfac8f13Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3121dfac8f13Smrg		m4_version_prereq([2.70],
3122dfac8f13Smrg			[AC_REQUIRE([AC_PROG_CC])],
3123dfac8f13Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3124c9e4df9bSmrg	],
3125c9e4df9bSmrg	[C++], [
3126c9e4df9bSmrg		AC_REQUIRE([AC_PROG_CXX])
3127c9e4df9bSmrg	]
3128c9e4df9bSmrg)
3129c9e4df9bSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
3130c9e4df9bSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
3131c9e4df9bSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
3132c9e4df9bSmrg]) # XORG_COMPILER_BRAND
3133533545b5Smrg
3134c9e4df9bSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
313565c1f7cfSmrg# ---------------
3136c9e4df9bSmrg# Minimum version: 1.16.0
3137c9e4df9bSmrg#
3138c9e4df9bSmrg# Test if the compiler works when passed the given flag as a command line argument.
3139dfac8f13Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
3140c9e4df9bSmrg# next flag in the list until there are no more options.
3141c9e4df9bSmrg#
3142c9e4df9bSmrg# Note that this does not guarantee that the compiler supports the flag as some
3143c9e4df9bSmrg# compilers will simply ignore arguments that they do not understand, but we do
3144c9e4df9bSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
3145c9e4df9bSmrg# -Werror=unused-command-line-argument
3146c9e4df9bSmrg#
3147c9e4df9bSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
3148c9e4df9bSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3149c9e4df9bSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3150533545b5Smrg
3151c9e4df9bSmrgAC_LANG_COMPILER_REQUIRE
3152533545b5Smrg
3153c9e4df9bSmrgAC_LANG_CASE(
3154c9e4df9bSmrg	[C], [
3155dfac8f13Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
3156dfac8f13Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3157dfac8f13Smrg		m4_version_prereq([2.70],
3158dfac8f13Smrg			[AC_REQUIRE([AC_PROG_CC])],
3159dfac8f13Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3160c9e4df9bSmrg		define([PREFIX], [C])
3161c9e4df9bSmrg		define([CACHE_PREFIX], [cc])
3162c9e4df9bSmrg		define([COMPILER], [$CC])
3163c9e4df9bSmrg	],
3164c9e4df9bSmrg	[C++], [
3165c9e4df9bSmrg		define([PREFIX], [CXX])
3166c9e4df9bSmrg		define([CACHE_PREFIX], [cxx])
3167c9e4df9bSmrg		define([COMPILER], [$CXX])
3168c9e4df9bSmrg	]
3169c9e4df9bSmrg)
3170c9e4df9bSmrg
3171c9e4df9bSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
3172c9e4df9bSmrg
3173c9e4df9bSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
3174c9e4df9bSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3175c9e4df9bSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
3176c9e4df9bSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3177c9e4df9bSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3178c9e4df9bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
3179c9e4df9bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
3180c9e4df9bSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
3181c9e4df9bSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
318265c1f7cfSmrgfi
3183c9e4df9bSmrg
3184c9e4df9bSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
3185c9e4df9bSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
3186c9e4df9bSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3187c9e4df9bSmrg	fi
3188c9e4df9bSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3189c9e4df9bSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
3190c9e4df9bSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3191c9e4df9bSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3192c9e4df9bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
3193c9e4df9bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
3194c9e4df9bSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
3195c9e4df9bSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3196c9e4df9bSmrgfi
3197c9e4df9bSmrg
3198c9e4df9bSmrgfound="no"
3199c9e4df9bSmrgm4_foreach([flag], m4_cdr($@), [
3200c9e4df9bSmrg	if test $found = "no" ; then
3201c9e4df9bSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
3202c9e4df9bSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3203c9e4df9bSmrg		fi
3204c9e4df9bSmrg
3205c9e4df9bSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
3206c9e4df9bSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3207c9e4df9bSmrg		fi
3208c9e4df9bSmrg
3209c9e4df9bSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
3210c9e4df9bSmrg
3211c9e4df9bSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
3212c9e4df9bSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
3213c9e4df9bSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
3214c9e4df9bSmrg		AC_CACHE_VAL($cacheid,
3215c9e4df9bSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3216c9e4df9bSmrg					     [eval $cacheid=yes],
3217c9e4df9bSmrg					     [eval $cacheid=no])])
3218c9e4df9bSmrg
3219c9e4df9bSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3220c9e4df9bSmrg
3221c9e4df9bSmrg		eval supported=\$$cacheid
3222c9e4df9bSmrg		AC_MSG_RESULT([$supported])
3223c9e4df9bSmrg		if test "$supported" = "yes" ; then
3224c9e4df9bSmrg			$1="$$1 ]flag["
3225c9e4df9bSmrg			found="yes"
3226c9e4df9bSmrg		fi
3227c9e4df9bSmrg	fi
322865c1f7cfSmrg])
3229c9e4df9bSmrg]) # XORG_TESTSET_CFLAG
3230533545b5Smrg
3231c9e4df9bSmrg# XORG_COMPILER_FLAGS
3232c9e4df9bSmrg# ---------------
3233c9e4df9bSmrg# Minimum version: 1.16.0
3234533545b5Smrg#
3235c9e4df9bSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
3236c9e4df9bSmrg# arguments supported by the selected compiler which do NOT alter the generated
3237c9e4df9bSmrg# code.  These arguments will cause the compiler to print various warnings
3238c9e4df9bSmrg# during compilation AND turn a conservative set of warnings into errors.
3239c9e4df9bSmrg#
3240c9e4df9bSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
3241c9e4df9bSmrg# future versions of util-macros as options are added to new compilers.
3242c9e4df9bSmrg#
3243c9e4df9bSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
3244c9e4df9bSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3245c37a63b8Smrg
3246c9e4df9bSmrgAC_ARG_ENABLE(selective-werror,
3247c9e4df9bSmrg              AS_HELP_STRING([--disable-selective-werror],
3248c9e4df9bSmrg                             [Turn off selective compiler errors. (default: enabled)]),
3249c9e4df9bSmrg              [SELECTIVE_WERROR=$enableval],
3250c9e4df9bSmrg              [SELECTIVE_WERROR=yes])
3251c9e4df9bSmrg
3252c9e4df9bSmrgAC_LANG_CASE(
3253c9e4df9bSmrg        [C], [
3254c9e4df9bSmrg                define([PREFIX], [C])
3255c9e4df9bSmrg        ],
3256c9e4df9bSmrg        [C++], [
3257c9e4df9bSmrg                define([PREFIX], [CXX])
3258c9e4df9bSmrg        ]
3259c9e4df9bSmrg)
3260c9e4df9bSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
3261c9e4df9bSmrgif test "x$SUNCC" = "xyes"; then
3262c9e4df9bSmrg    [BASE_]PREFIX[FLAGS]="-v"
326365c1f7cfSmrgelse
3264c9e4df9bSmrg    [BASE_]PREFIX[FLAGS]=""
326565c1f7cfSmrgfi
326665c1f7cfSmrg
3267c9e4df9bSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3268c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
3269c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
3270c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
3271c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
327265c1f7cfSmrg
3273c9e4df9bSmrgAC_LANG_CASE(
3274c9e4df9bSmrg	[C], [
3275c9e4df9bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
3276c9e4df9bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
3277c9e4df9bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
3278c9e4df9bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
3279c9e4df9bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
3280c9e4df9bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
3281c9e4df9bSmrg	]
3282c9e4df9bSmrg)
3283c37a63b8Smrg
3284c9e4df9bSmrg# This chunk adds additional warnings that could catch undesired effects.
3285c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
3286c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
3287c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
3288c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
3289c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
3290c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
3291c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3292533545b5Smrg
3293c9e4df9bSmrg# These are currently disabled because they are noisy.  They will be enabled
3294c9e4df9bSmrg# in the future once the codebase is sufficiently modernized to silence
3295c9e4df9bSmrg# them.  For now, I don't want them to drown out the other warnings.
3296c9e4df9bSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3297c9e4df9bSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3298c9e4df9bSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3299533545b5Smrg
3300dfac8f13Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
3301c9e4df9bSmrg# when there are problems that should be fixed.
3302533545b5Smrg
3303c9e4df9bSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3304c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3305c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3306c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3307c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3308c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3309c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3310c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3311c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3312c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3313c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3314c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3315c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3316c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3317c9e4df9bSmrgelse
3318c9e4df9bSmrgAC_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])
3319c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3320c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3321c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3322c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3323c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3324c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3325c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3326c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3327c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3328c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3329c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3330c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3331c9e4df9bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3332c9e4df9bSmrgfi
3333533545b5Smrg
3334c9e4df9bSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3335c9e4df9bSmrg]) # XORG_COMPILER_FLAGS
3336c37a63b8Smrg
3337c9e4df9bSmrg# XORG_CWARNFLAGS
3338c9e4df9bSmrg# ---------------
3339c9e4df9bSmrg# Minimum version: 1.2.0
3340c9e4df9bSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3341c37a63b8Smrg#
3342c9e4df9bSmrg# Defines CWARNFLAGS to enable C compiler warnings.
3343736a7e2cSmrg#
3344c9e4df9bSmrg# This function is deprecated because it defines -fno-strict-aliasing
3345c9e4df9bSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3346c9e4df9bSmrg# is needed, then it should be added explicitly in the module when
3347c9e4df9bSmrg# it is updated to use BASE_CFLAGS.
3348736a7e2cSmrg#
3349c9e4df9bSmrgAC_DEFUN([XORG_CWARNFLAGS], [
3350c9e4df9bSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3351c9e4df9bSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3352c9e4df9bSmrgAC_LANG_CASE(
3353c9e4df9bSmrg	[C], [
3354c9e4df9bSmrg		CWARNFLAGS="$BASE_CFLAGS"
3355c9e4df9bSmrg		if  test "x$GCC" = xyes ; then
3356c9e4df9bSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3357c9e4df9bSmrg		fi
3358c9e4df9bSmrg		AC_SUBST(CWARNFLAGS)
3359c9e4df9bSmrg	]
3360c9e4df9bSmrg)
3361c9e4df9bSmrg]) # XORG_CWARNFLAGS
3362533545b5Smrg
3363c9e4df9bSmrg# XORG_STRICT_OPTION
3364c9e4df9bSmrg# -----------------------
3365c9e4df9bSmrg# Minimum version: 1.3.0
3366c9e4df9bSmrg#
3367c9e4df9bSmrg# Add configure option to enable strict compilation flags, such as treating
3368c9e4df9bSmrg# warnings as fatal errors.
3369c9e4df9bSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3370c9e4df9bSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3371c9e4df9bSmrg#
3372c9e4df9bSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3373c9e4df9bSmrg# when strict compilation is unconditionally desired.
3374c9e4df9bSmrgAC_DEFUN([XORG_STRICT_OPTION], [
3375c9e4df9bSmrgAC_REQUIRE([XORG_CWARNFLAGS])
3376c9e4df9bSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3377264fa531Smrg
3378c9e4df9bSmrgAC_ARG_ENABLE(strict-compilation,
3379c9e4df9bSmrg			  AS_HELP_STRING([--enable-strict-compilation],
3380c9e4df9bSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3381c9e4df9bSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
338265c1f7cfSmrg
3383c9e4df9bSmrgAC_LANG_CASE(
3384c9e4df9bSmrg        [C], [
3385c9e4df9bSmrg                define([PREFIX], [C])
3386c9e4df9bSmrg        ],
3387c9e4df9bSmrg        [C++], [
3388c9e4df9bSmrg                define([PREFIX], [CXX])
3389c9e4df9bSmrg        ]
3390c9e4df9bSmrg)
339165c1f7cfSmrg
3392c9e4df9bSmrg[STRICT_]PREFIX[FLAGS]=""
3393c9e4df9bSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3394c9e4df9bSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
339565c1f7cfSmrg
3396c9e4df9bSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3397c9e4df9bSmrg# activate it with -Werror, so we add it here explicitly.
3398c9e4df9bSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
339965c1f7cfSmrg
3400c9e4df9bSmrgif test "x$STRICT_COMPILE" = "xyes"; then
3401c9e4df9bSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3402c9e4df9bSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3403c9e4df9bSmrgfi
3404c9e4df9bSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3405c9e4df9bSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3406c9e4df9bSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3407c9e4df9bSmrg]) # XORG_STRICT_OPTION
340865c1f7cfSmrg
3409dfac8f13Smrg# XORG_DEFAULT_NOCODE_OPTIONS
3410dfac8f13Smrg# ---------------------------
3411dfac8f13Smrg# Minimum version: 1.20.0
3412dfac8f13Smrg#
3413dfac8f13Smrg# Defines default options for X.Org modules which don't compile code,
3414dfac8f13Smrg# such as fonts, bitmaps, cursors, and docs.
3415dfac8f13Smrg#
3416dfac8f13SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
3417dfac8f13SmrgAC_REQUIRE([AC_PROG_INSTALL])
3418dfac8f13SmrgXORG_RELEASE_VERSION
3419dfac8f13SmrgXORG_CHANGELOG
3420dfac8f13SmrgXORG_INSTALL
3421dfac8f13SmrgXORG_MANPAGE_SECTIONS
3422dfac8f13Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3423dfac8f13Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3424dfac8f13Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
3425dfac8f13Smrg
3426c9e4df9bSmrg# XORG_DEFAULT_OPTIONS
3427c9e4df9bSmrg# --------------------
3428c9e4df9bSmrg# Minimum version: 1.3.0
3429c9e4df9bSmrg#
3430dfac8f13Smrg# Defines default options for X.Org modules which compile code.
3431c9e4df9bSmrg#
3432c9e4df9bSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3433c9e4df9bSmrgAC_REQUIRE([AC_PROG_INSTALL])
3434c9e4df9bSmrgXORG_COMPILER_FLAGS
3435c9e4df9bSmrgXORG_CWARNFLAGS
3436c9e4df9bSmrgXORG_STRICT_OPTION
3437dfac8f13SmrgXORG_DEFAULT_NOCODE_OPTIONS
3438c9e4df9bSmrg]) # XORG_DEFAULT_OPTIONS
343965c1f7cfSmrg
3440c9e4df9bSmrg# XORG_INSTALL()
3441c9e4df9bSmrg# ----------------
3442c9e4df9bSmrg# Minimum version: 1.4.0
3443c9e4df9bSmrg#
3444c9e4df9bSmrg# Defines the variable INSTALL_CMD as the command to copy
3445c9e4df9bSmrg# INSTALL from $prefix/share/util-macros.
3446c9e4df9bSmrg#
3447c9e4df9bSmrgAC_DEFUN([XORG_INSTALL], [
3448c9e4df9bSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3449c9e4df9bSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3450c9e4df9bSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3451c9e4df9bSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3452c9e4df9bSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3453c9e4df9bSmrgtouch \$(top_srcdir)/INSTALL; \
3454c9e4df9bSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3455c9e4df9bSmrgAC_SUBST([INSTALL_CMD])
3456c9e4df9bSmrg]) # XORG_INSTALL
3457c9e4df9bSmrgdnl Copyright 2005 Red Hat, Inc
3458c9e4df9bSmrgdnl
3459c9e4df9bSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3460c9e4df9bSmrgdnl documentation for any purpose is hereby granted without fee, provided that
3461c9e4df9bSmrgdnl the above copyright notice appear in all copies and that both that
3462c9e4df9bSmrgdnl copyright notice and this permission notice appear in supporting
3463c9e4df9bSmrgdnl documentation.
3464c9e4df9bSmrgdnl
3465c9e4df9bSmrgdnl The above copyright notice and this permission notice shall be included
3466c9e4df9bSmrgdnl in all copies or substantial portions of the Software.
3467c9e4df9bSmrgdnl
3468c9e4df9bSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3469c9e4df9bSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3470c9e4df9bSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3471c9e4df9bSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3472c9e4df9bSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3473c9e4df9bSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3474c9e4df9bSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
3475c9e4df9bSmrgdnl
3476c9e4df9bSmrgdnl Except as contained in this notice, the name of the copyright holders shall
3477c9e4df9bSmrgdnl not be used in advertising or otherwise to promote the sale, use or
3478c9e4df9bSmrgdnl other dealings in this Software without prior written authorization
3479c9e4df9bSmrgdnl from the copyright holders.
3480c9e4df9bSmrgdnl
348165c1f7cfSmrg
3482c9e4df9bSmrg# XORG_RELEASE_VERSION
3483c9e4df9bSmrg# --------------------
3484c9e4df9bSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
348565c1f7cfSmrg
3486c9e4df9bSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3487c9e4df9bSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3488c9e4df9bSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3489c9e4df9bSmrg		[Major version of this package])
3490c9e4df9bSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3491c9e4df9bSmrg	if test "x$PVM" = "x"; then
3492c9e4df9bSmrg		PVM="0"
3493c9e4df9bSmrg	fi
3494c9e4df9bSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3495c9e4df9bSmrg		[$PVM],
3496c9e4df9bSmrg		[Minor version of this package])
3497c9e4df9bSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3498c9e4df9bSmrg	if test "x$PVP" = "x"; then
3499c9e4df9bSmrg		PVP="0"
3500c9e4df9bSmrg	fi
3501c9e4df9bSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3502c9e4df9bSmrg		[$PVP],
3503c9e4df9bSmrg		[Patch version of this package])
3504c9e4df9bSmrg])
350565c1f7cfSmrg
3506c9e4df9bSmrg# XORG_CHANGELOG()
3507c9e4df9bSmrg# ----------------
3508c9e4df9bSmrg# Minimum version: 1.2.0
3509c9e4df9bSmrg#
3510c9e4df9bSmrg# Defines the variable CHANGELOG_CMD as the command to generate
3511c9e4df9bSmrg# ChangeLog from git.
3512c9e4df9bSmrg#
3513c9e4df9bSmrg#
3514c9e4df9bSmrgAC_DEFUN([XORG_CHANGELOG], [
3515c9e4df9bSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3516c9e4df9bSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3517c9e4df9bSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3518c9e4df9bSmrgtouch \$(top_srcdir)/ChangeLog; \
3519c9e4df9bSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3520c9e4df9bSmrgAC_SUBST([CHANGELOG_CMD])
3521c9e4df9bSmrg]) # XORG_CHANGELOG
3522c37a63b8Smrg
3523