147a4502cSmrg# generated automatically by aclocal 1.17 -*- Autoconf -*-
275ebec6dSmrg
347a4502cSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
473143b9aSmrg
573143b9aSmrg# This file is free software; the Free Software Foundation
673143b9aSmrg# gives unlimited permission to copy and/or distribute it,
773143b9aSmrg# with or without modifications, as long as this notice is preserved.
873143b9aSmrg
973143b9aSmrg# This program is distributed in the hope that it will be useful,
1073143b9aSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1173143b9aSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1273143b9aSmrg# PARTICULAR PURPOSE.
1373143b9aSmrg
1475ebec6dSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15b53e5eeaSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16b53e5eeaSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1747a4502cSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
1847a4502cSmrg[m4_warning([this file was generated for autoconf 2.72.
19b53e5eeaSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20b53e5eeaSmrgIf you have problems, you may need to regenerate the build system entirely.
2175ebec6dSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2273143b9aSmrg
2347a4502cSmrg# Copyright (C) 2002-2024 Free Software Foundation, Inc.
24e45ace2bSmrg#
25e45ace2bSmrg# This file is free software; the Free Software Foundation
26e45ace2bSmrg# gives unlimited permission to copy and/or distribute it,
27e45ace2bSmrg# with or without modifications, as long as this notice is preserved.
283d2ed3e3Smrg
29e45ace2bSmrg# AM_AUTOMAKE_VERSION(VERSION)
30e45ace2bSmrg# ----------------------------
31e45ace2bSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32e45ace2bSmrg# generated from the m4 files accompanying Automake X.Y.
33e45ace2bSmrg# (This private macro should not be called outside this file.)
34e45ace2bSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3547a4502cSmrg[am__api_version='1.17'
36e45ace2bSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37e45ace2bSmrgdnl require some minimum version.  Point them to the right macro.
3847a4502cSmrgm4_if([$1], [1.17], [],
39e45ace2bSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40e45ace2bSmrg])
413d2ed3e3Smrg
42e45ace2bSmrg# _AM_AUTOCONF_VERSION(VERSION)
43e45ace2bSmrg# -----------------------------
44e45ace2bSmrg# aclocal traces this macro to find the Autoconf version.
45e45ace2bSmrg# This is a private macro too.  Using m4_define simplifies
46e45ace2bSmrg# the logic in aclocal, which can simply ignore this definition.
47e45ace2bSmrgm4_define([_AM_AUTOCONF_VERSION], [])
488d4c0f7bSmrg
49e45ace2bSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50e45ace2bSmrg# -------------------------------
51e45ace2bSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52e45ace2bSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53e45ace2bSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5447a4502cSmrg[AM_AUTOMAKE_VERSION([1.17])dnl
55e45ace2bSmrgm4_ifndef([AC_AUTOCONF_VERSION],
56e45ace2bSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57e45ace2bSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
588a0d9095Smrg
59e45ace2bSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
608a0d9095Smrg
6147a4502cSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
62e45ace2bSmrg#
63e45ace2bSmrg# This file is free software; the Free Software Foundation
64e45ace2bSmrg# gives unlimited permission to copy and/or distribute it,
65e45ace2bSmrg# with or without modifications, as long as this notice is preserved.
668a0d9095Smrg
67e45ace2bSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68e45ace2bSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69e45ace2bSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70e45ace2bSmrg#
71e45ace2bSmrg# Of course, Automake must honor this variable whenever it calls a
72e45ace2bSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73e45ace2bSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74e45ace2bSmrg# depending on how configure is run.  This is pretty annoying, since
75e45ace2bSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76e45ace2bSmrg# source directory, any form will work fine, but in subdirectories a
77e45ace2bSmrg# relative path needs to be adjusted first.
78e45ace2bSmrg#
79e45ace2bSmrg# $ac_aux_dir/missing
80e45ace2bSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81e45ace2bSmrg# $top_srcdir/$ac_aux_dir/missing
82e45ace2bSmrg#    fails if $ac_aux_dir is absolute,
83e45ace2bSmrg#    fails when called from a subdirectory in a VPATH build with
84e45ace2bSmrg#          a relative $ac_aux_dir
85e45ace2bSmrg#
86e45ace2bSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87e45ace2bSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
88e45ace2bSmrg# harmless because $srcdir is '.', but things will broke when you
89e45ace2bSmrg# start a VPATH build or use an absolute $srcdir.
90e45ace2bSmrg#
91e45ace2bSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92e45ace2bSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93e45ace2bSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94e45ace2bSmrg# and then we would define $MISSING as
95e45ace2bSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96e45ace2bSmrg# This will work as long as MISSING is not called from configure, because
97e45ace2bSmrg# unfortunately $(top_srcdir) has no meaning in configure.
98e45ace2bSmrg# However there are other variables, like CC, which are often used in
99e45ace2bSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100e45ace2bSmrg#
101e45ace2bSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
102e45ace2bSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
103e45ace2bSmrg# configured tree to be moved without reconfiguration.
1048a0d9095Smrg
105e45ace2bSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106e45ace2bSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107e45ace2bSmrg# Expand $ac_aux_dir to an absolute path.
108e45ace2bSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109e45ace2bSmrg])
1108a0d9095Smrg
111e45ace2bSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1128d4c0f7bSmrg
11347a4502cSmrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
114e45ace2bSmrg#
115e45ace2bSmrg# This file is free software; the Free Software Foundation
116e45ace2bSmrg# gives unlimited permission to copy and/or distribute it,
117e45ace2bSmrg# with or without modifications, as long as this notice is preserved.
1188d4c0f7bSmrg
119e45ace2bSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120e45ace2bSmrg# -------------------------------------
121e45ace2bSmrg# Define a conditional.
122e45ace2bSmrgAC_DEFUN([AM_CONDITIONAL],
123e45ace2bSmrg[AC_PREREQ([2.52])dnl
124e45ace2bSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
125e45ace2bSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126e45ace2bSmrgAC_SUBST([$1_TRUE])dnl
127e45ace2bSmrgAC_SUBST([$1_FALSE])dnl
128e45ace2bSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129e45ace2bSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130e45ace2bSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131e45ace2bSmrgif $2; then
132e45ace2bSmrg  $1_TRUE=
133e45ace2bSmrg  $1_FALSE='#'
134e45ace2bSmrgelse
135e45ace2bSmrg  $1_TRUE='#'
136e45ace2bSmrg  $1_FALSE=
137e45ace2bSmrgfi
138e45ace2bSmrgAC_CONFIG_COMMANDS_PRE(
139e45ace2bSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140e45ace2bSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141e45ace2bSmrgUsually this means the macro was only invoked conditionally.]])
142e45ace2bSmrgfi])])
1438d4c0f7bSmrg
14447a4502cSmrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
145e45ace2bSmrg#
146e45ace2bSmrg# This file is free software; the Free Software Foundation
147e45ace2bSmrg# gives unlimited permission to copy and/or distribute it,
148e45ace2bSmrg# with or without modifications, as long as this notice is preserved.
1498d4c0f7bSmrg
1508d4c0f7bSmrg
151e45ace2bSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
152e45ace2bSmrg# written in clear, in which case automake, when reading aclocal.m4,
153e45ace2bSmrg# will think it sees a *use*, and therefore will trigger all it's
154e45ace2bSmrg# C support machinery.  Also note that it means that autoscan, seeing
155e45ace2bSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1568d4c0f7bSmrg
1578d4c0f7bSmrg
158e45ace2bSmrg# _AM_DEPENDENCIES(NAME)
159e45ace2bSmrg# ----------------------
160e45ace2bSmrg# See how the compiler implements dependency checking.
161e45ace2bSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
162e45ace2bSmrg# We try a few techniques and use that to set a single cache variable.
163e45ace2bSmrg#
164e45ace2bSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
165e45ace2bSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
166e45ace2bSmrg# dependency, and given that the user is not expected to run this macro,
167e45ace2bSmrg# just rely on AC_PROG_CC.
168e45ace2bSmrgAC_DEFUN([_AM_DEPENDENCIES],
169e45ace2bSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
170e45ace2bSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
171e45ace2bSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
172e45ace2bSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1738d4c0f7bSmrg
174e45ace2bSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
175e45ace2bSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
176e45ace2bSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
177e45ace2bSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
178e45ace2bSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
179e45ace2bSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
180e45ace2bSmrg                    [depcc="$$1"   am_compiler_list=])
1818d4c0f7bSmrg
182e45ace2bSmrgAC_CACHE_CHECK([dependency style of $depcc],
183e45ace2bSmrg               [am_cv_$1_dependencies_compiler_type],
184e45ace2bSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
185e45ace2bSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
186e45ace2bSmrg  # making bogus files that we don't know about and never remove.  For
187e45ace2bSmrg  # instance it was reported that on HP-UX the gcc test will end up
188e45ace2bSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
189e45ace2bSmrg  # in D".
190e45ace2bSmrg  rm -rf conftest.dir
191e45ace2bSmrg  mkdir conftest.dir
192e45ace2bSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
193e45ace2bSmrg  # using a relative directory.
194e45ace2bSmrg  cp "$am_depcomp" conftest.dir
195e45ace2bSmrg  cd conftest.dir
196e45ace2bSmrg  # We will build objects and dependencies in a subdirectory because
197e45ace2bSmrg  # it helps to detect inapplicable dependency modes.  For instance
198e45ace2bSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
199e45ace2bSmrg  # side effect of compilation, but ICC will put the dependencies in
200e45ace2bSmrg  # the current directory while Tru64 will put them in the object
201e45ace2bSmrg  # directory.
202e45ace2bSmrg  mkdir sub
2038d4c0f7bSmrg
204e45ace2bSmrg  am_cv_$1_dependencies_compiler_type=none
205e45ace2bSmrg  if test "$am_compiler_list" = ""; then
206e45ace2bSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
207e45ace2bSmrg  fi
208e45ace2bSmrg  am__universal=false
209e45ace2bSmrg  m4_case([$1], [CC],
210e45ace2bSmrg    [case " $depcc " in #(
211e45ace2bSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212e45ace2bSmrg     esac],
213e45ace2bSmrg    [CXX],
214e45ace2bSmrg    [case " $depcc " in #(
215e45ace2bSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216e45ace2bSmrg     esac])
2178d4c0f7bSmrg
218e45ace2bSmrg  for depmode in $am_compiler_list; do
219e45ace2bSmrg    # Setup a source with many dependencies, because some compilers
220e45ace2bSmrg    # like to wrap large dependency lists on column 80 (with \), and
221e45ace2bSmrg    # we should not choose a depcomp mode which is confused by this.
222e45ace2bSmrg    #
223e45ace2bSmrg    # We need to recreate these files for each test, as the compiler may
224e45ace2bSmrg    # overwrite some of them when testing with obscure command lines.
225e45ace2bSmrg    # This happens at least with the AIX C compiler.
226e45ace2bSmrg    : > sub/conftest.c
227e45ace2bSmrg    for i in 1 2 3 4 5 6; do
228e45ace2bSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
229e45ace2bSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
230e45ace2bSmrg      # Solaris 10 /bin/sh.
231e45ace2bSmrg      echo '/* dummy */' > sub/conftst$i.h
232e45ace2bSmrg    done
233e45ace2bSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234af928962Smrg
235e45ace2bSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236e45ace2bSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
237e45ace2bSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
238e45ace2bSmrg    # versions had trouble with output in subdirs.
239e45ace2bSmrg    am__obj=sub/conftest.${OBJEXT-o}
240e45ace2bSmrg    am__minus_obj="-o $am__obj"
241e45ace2bSmrg    case $depmode in
242e45ace2bSmrg    gcc)
243e45ace2bSmrg      # This depmode causes a compiler race in universal mode.
244e45ace2bSmrg      test "$am__universal" = false || continue
245e45ace2bSmrg      ;;
246e45ace2bSmrg    nosideeffect)
247e45ace2bSmrg      # After this tag, mechanisms are not by side-effect, so they'll
248e45ace2bSmrg      # only be used when explicitly requested.
249e45ace2bSmrg      if test "x$enable_dependency_tracking" = xyes; then
250e45ace2bSmrg	continue
251e45ace2bSmrg      else
252e45ace2bSmrg	break
253e45ace2bSmrg      fi
254e45ace2bSmrg      ;;
255e45ace2bSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
256e45ace2bSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
257e45ace2bSmrg      # not run yet.  These depmodes are late enough in the game, and
258e45ace2bSmrg      # so weak that their functioning should not be impacted.
259e45ace2bSmrg      am__obj=conftest.${OBJEXT-o}
260e45ace2bSmrg      am__minus_obj=
261e45ace2bSmrg      ;;
262e45ace2bSmrg    none) break ;;
263e45ace2bSmrg    esac
264e45ace2bSmrg    if depmode=$depmode \
265e45ace2bSmrg       source=sub/conftest.c object=$am__obj \
266e45ace2bSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267e45ace2bSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
268e45ace2bSmrg         >/dev/null 2>conftest.err &&
269e45ace2bSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
270e45ace2bSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271e45ace2bSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
272e45ace2bSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
273e45ace2bSmrg      # icc doesn't choke on unknown options, it will just issue warnings
274e45ace2bSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
275e45ace2bSmrg      # that says an option was ignored or not supported.
27647a4502cSmrg      # When given -MP, icc 7.0 and 7.1 complain thus:
277e45ace2bSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
278e45ace2bSmrg      # The diagnosis changed in icc 8.0:
279e45ace2bSmrg      #   icc: Command line remark: option '-MP' not supported
280e45ace2bSmrg      if (grep 'ignoring option' conftest.err ||
281e45ace2bSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
282e45ace2bSmrg        am_cv_$1_dependencies_compiler_type=$depmode
283e45ace2bSmrg        break
284e45ace2bSmrg      fi
285e45ace2bSmrg    fi
286e45ace2bSmrg  done
287af928962Smrg
288e45ace2bSmrg  cd ..
289e45ace2bSmrg  rm -rf conftest.dir
290e45ace2bSmrgelse
291e45ace2bSmrg  am_cv_$1_dependencies_compiler_type=none
292e45ace2bSmrgfi
293e45ace2bSmrg])
294e45ace2bSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
295e45ace2bSmrgAM_CONDITIONAL([am__fastdep$1], [
296e45ace2bSmrg  test "x$enable_dependency_tracking" != xno \
297e45ace2bSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298e45ace2bSmrg])
2998d4c0f7bSmrg
3003d2ed3e3Smrg
301e45ace2bSmrg# AM_SET_DEPDIR
302e45ace2bSmrg# -------------
303e45ace2bSmrg# Choose a directory name for dependency files.
304e45ace2bSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
305e45ace2bSmrgAC_DEFUN([AM_SET_DEPDIR],
306e45ace2bSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
307e45ace2bSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
308e45ace2bSmrg])
3093d2ed3e3Smrg
3103d2ed3e3Smrg
311e45ace2bSmrg# AM_DEP_TRACK
312e45ace2bSmrg# ------------
313e45ace2bSmrgAC_DEFUN([AM_DEP_TRACK],
314e45ace2bSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
315e45ace2bSmrgAS_HELP_STRING(
316e45ace2bSmrg  [--enable-dependency-tracking],
317e45ace2bSmrg  [do not reject slow dependency extractors])
318e45ace2bSmrgAS_HELP_STRING(
319e45ace2bSmrg  [--disable-dependency-tracking],
320e45ace2bSmrg  [speeds up one-time build])])
321e45ace2bSmrgif test "x$enable_dependency_tracking" != xno; then
322e45ace2bSmrg  am_depcomp="$ac_aux_dir/depcomp"
323e45ace2bSmrg  AMDEPBACKSLASH='\'
324e45ace2bSmrg  am__nodep='_no'
325e45ace2bSmrgfi
326e45ace2bSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
327e45ace2bSmrgAC_SUBST([AMDEPBACKSLASH])dnl
328e45ace2bSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
329e45ace2bSmrgAC_SUBST([am__nodep])dnl
330e45ace2bSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
331e45ace2bSmrg])
3323d2ed3e3Smrg
333e45ace2bSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334af928962Smrg
33547a4502cSmrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
336e45ace2bSmrg#
337e45ace2bSmrg# This file is free software; the Free Software Foundation
338e45ace2bSmrg# gives unlimited permission to copy and/or distribute it,
339e45ace2bSmrg# with or without modifications, as long as this notice is preserved.
340af928962Smrg
341e45ace2bSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
342e45ace2bSmrg# ------------------------------
343e45ace2bSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
344e45ace2bSmrg[{
345e45ace2bSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
346e45ace2bSmrg  # are listed without --file.  Let's play safe and only enable the eval
347e45ace2bSmrg  # if we detect the quoting.
348e45ace2bSmrg  # TODO: see whether this extra hack can be removed once we start
349e45ace2bSmrg  # requiring Autoconf 2.70 or later.
350e45ace2bSmrg  AS_CASE([$CONFIG_FILES],
351e45ace2bSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
352e45ace2bSmrg          [*], [set x $CONFIG_FILES])
353e45ace2bSmrg  shift
354e45ace2bSmrg  # Used to flag and report bootstrapping failures.
355e45ace2bSmrg  am_rc=0
356e45ace2bSmrg  for am_mf
357e45ace2bSmrg  do
358e45ace2bSmrg    # Strip MF so we end up with the name of the file.
359e45ace2bSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
360e45ace2bSmrg    # Check whether this is an Automake generated Makefile which includes
361e45ace2bSmrg    # dependency-tracking related rules and includes.
362e45ace2bSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
363e45ace2bSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
364e45ace2bSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
365e45ace2bSmrg      || continue
366e45ace2bSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
367e45ace2bSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
368e45ace2bSmrg    AM_RUN_LOG([cd "$am_dirpart" \
369e45ace2bSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
370e45ace2bSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
371e45ace2bSmrg  done
372e45ace2bSmrg  if test $am_rc -ne 0; then
373e45ace2bSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
374e45ace2bSmrg    for automatic dependency tracking.  If GNU make was not used, consider
375e45ace2bSmrg    re-running the configure script with MAKE="gmake" (or whatever is
376e45ace2bSmrg    necessary).  You can also try re-running configure with the
377e45ace2bSmrg    '--disable-dependency-tracking' option to at least be able to build
378e45ace2bSmrg    the package (albeit without support for automatic dependency tracking).])
379e45ace2bSmrg  fi
380e45ace2bSmrg  AS_UNSET([am_dirpart])
381e45ace2bSmrg  AS_UNSET([am_filepart])
382e45ace2bSmrg  AS_UNSET([am_mf])
383e45ace2bSmrg  AS_UNSET([am_rc])
384e45ace2bSmrg  rm -f conftest-deps.mk
385e45ace2bSmrg}
386e45ace2bSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3878d4c0f7bSmrg
3883d2ed3e3Smrg
389e45ace2bSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
390e45ace2bSmrg# -----------------------------
391e45ace2bSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
3923d2ed3e3Smrg#
393e45ace2bSmrg# This code is only required when automatic dependency tracking is enabled.
394e45ace2bSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
395e45ace2bSmrg# order to bootstrap the dependency handling code.
396e45ace2bSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
397e45ace2bSmrg[AC_CONFIG_COMMANDS([depfiles],
398e45ace2bSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
399e45ace2bSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
4008d4c0f7bSmrg
401e45ace2bSmrg# Do all the work for Automake.                             -*- Autoconf -*-
402e45ace2bSmrg
40347a4502cSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
4043d2ed3e3Smrg#
405e45ace2bSmrg# This file is free software; the Free Software Foundation
406e45ace2bSmrg# gives unlimited permission to copy and/or distribute it,
407e45ace2bSmrg# with or without modifications, as long as this notice is preserved.
4088d4c0f7bSmrg
409e45ace2bSmrg# This macro actually does too much.  Some checks are only needed if
410e45ace2bSmrg# your package does certain things.  But this isn't really a big deal.
411e45ace2bSmrg
412e45ace2bSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
413e45ace2bSmrgm4_define([AC_PROG_CC],
414e45ace2bSmrgm4_defn([AC_PROG_CC])
415e45ace2bSmrg[_AM_PROG_CC_C_O
416e45ace2bSmrg])
417e45ace2bSmrg
418e45ace2bSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
419e45ace2bSmrg# AM_INIT_AUTOMAKE([OPTIONS])
420e45ace2bSmrg# -----------------------------------------------
421e45ace2bSmrg# The call with PACKAGE and VERSION arguments is the old style
422e45ace2bSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
423e45ace2bSmrg# and VERSION should now be passed to AC_INIT and removed from
424e45ace2bSmrg# the call to AM_INIT_AUTOMAKE.
425e45ace2bSmrg# We support both call styles for the transition.  After
426e45ace2bSmrg# the next Automake release, Autoconf can make the AC_INIT
427e45ace2bSmrg# arguments mandatory, and then we can depend on a new Autoconf
428e45ace2bSmrg# release and drop the old call support.
429e45ace2bSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
430e45ace2bSmrg[AC_PREREQ([2.65])dnl
431e45ace2bSmrgm4_ifdef([_$0_ALREADY_INIT],
432e45ace2bSmrg  [m4_fatal([$0 expanded multiple times
433e45ace2bSmrg]m4_defn([_$0_ALREADY_INIT]))],
434e45ace2bSmrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
435e45ace2bSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
436e45ace2bSmrgdnl the ones we care about.
437e45ace2bSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
438e45ace2bSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
439e45ace2bSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
440e45ace2bSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
441e45ace2bSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
442e45ace2bSmrg  # is not polluted with repeated "-I."
443e45ace2bSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
444e45ace2bSmrg  # test to see if srcdir already configured
445e45ace2bSmrg  if test -f $srcdir/config.status; then
446e45ace2bSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
447e45ace2bSmrg  fi
4488d4c0f7bSmrgfi
4498d4c0f7bSmrg
450e45ace2bSmrg# test whether we have cygpath
451e45ace2bSmrgif test -z "$CYGPATH_W"; then
452e45ace2bSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
453e45ace2bSmrg    CYGPATH_W='cygpath -w'
454e45ace2bSmrg  else
455e45ace2bSmrg    CYGPATH_W=echo
456e45ace2bSmrg  fi
4573d2ed3e3Smrgfi
458e45ace2bSmrgAC_SUBST([CYGPATH_W])
4598d4c0f7bSmrg
460e45ace2bSmrg# Define the identity of the package.
461e45ace2bSmrgdnl Distinguish between old-style and new-style calls.
462e45ace2bSmrgm4_ifval([$2],
463e45ace2bSmrg[AC_DIAGNOSE([obsolete],
464e45ace2bSmrg             [$0: two- and three-arguments forms are deprecated.])
465e45ace2bSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
466e45ace2bSmrg AC_SUBST([PACKAGE], [$1])dnl
467e45ace2bSmrg AC_SUBST([VERSION], [$2])],
468e45ace2bSmrg[_AM_SET_OPTIONS([$1])dnl
469e45ace2bSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
470e45ace2bSmrgm4_if(
471e45ace2bSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
472e45ace2bSmrg  [ok:ok],,
473e45ace2bSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
474e45ace2bSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
475e45ace2bSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4768d4c0f7bSmrg
477e45ace2bSmrg_AM_IF_OPTION([no-define],,
478e45ace2bSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
479e45ace2bSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4808d4c0f7bSmrg
481e45ace2bSmrg# Some tools Automake needs.
482e45ace2bSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
483e45ace2bSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
484e45ace2bSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
485e45ace2bSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
486e45ace2bSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
487e45ace2bSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
488e45ace2bSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
489e45ace2bSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
490e45ace2bSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
491e45ace2bSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
492e45ace2bSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
493e45ace2bSmrg# dies out for good.  For more background, see:
494e45ace2bSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
495e45ace2bSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
496e45ace2bSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
497e45ace2bSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
498e45ace2bSmrg# system "awk" is bad on some platforms.
499e45ace2bSmrgAC_REQUIRE([AC_PROG_AWK])dnl
500e45ace2bSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
501e45ace2bSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
502e45ace2bSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
503e45ace2bSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
504e45ace2bSmrg			     [_AM_PROG_TAR([v7])])])
505e45ace2bSmrg_AM_IF_OPTION([no-dependencies],,
506e45ace2bSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
507e45ace2bSmrg		  [_AM_DEPENDENCIES([CC])],
508e45ace2bSmrg		  [m4_define([AC_PROG_CC],
509e45ace2bSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
510e45ace2bSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
511e45ace2bSmrg		  [_AM_DEPENDENCIES([CXX])],
512e45ace2bSmrg		  [m4_define([AC_PROG_CXX],
513e45ace2bSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
514e45ace2bSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
515e45ace2bSmrg		  [_AM_DEPENDENCIES([OBJC])],
516e45ace2bSmrg		  [m4_define([AC_PROG_OBJC],
517e45ace2bSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
518e45ace2bSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
519e45ace2bSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
520e45ace2bSmrg		  [m4_define([AC_PROG_OBJCXX],
521e45ace2bSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
522e45ace2bSmrg])
523e45ace2bSmrg# Variables for tags utilities; see am/tags.am
524e45ace2bSmrgif test -z "$CTAGS"; then
525e45ace2bSmrg  CTAGS=ctags
5263d2ed3e3Smrgfi
527e45ace2bSmrgAC_SUBST([CTAGS])
528e45ace2bSmrgif test -z "$ETAGS"; then
529e45ace2bSmrg  ETAGS=etags
5303d2ed3e3Smrgfi
531e45ace2bSmrgAC_SUBST([ETAGS])
532e45ace2bSmrgif test -z "$CSCOPE"; then
533e45ace2bSmrg  CSCOPE=cscope
5343d2ed3e3Smrgfi
535e45ace2bSmrgAC_SUBST([CSCOPE])
5368d4c0f7bSmrg
53747a4502cSmrgAC_REQUIRE([_AM_SILENT_RULES])dnl
538e45ace2bSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
539e45ace2bSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
540e45ace2bSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
541e45ace2bSmrgAC_CONFIG_COMMANDS_PRE(dnl
542e45ace2bSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
543e45ace2bSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5443d2ed3e3Smrg
54547a4502cSmrgAC_REQUIRE([_AM_PROG_RM_F])
54647a4502cSmrgAC_REQUIRE([_AM_PROG_XARGS_N])
5473d2ed3e3Smrg
548e45ace2bSmrgdnl The trailing newline in this macro's definition is deliberate, for
549e45ace2bSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
550e45ace2bSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
551e45ace2bSmrg])
5523d2ed3e3Smrg
553e45ace2bSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
554e45ace2bSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
555e45ace2bSmrgdnl mangled by Autoconf and run in a shell conditional statement.
556e45ace2bSmrgm4_define([_AC_COMPILER_EXEEXT],
557e45ace2bSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5588d4c0f7bSmrg
559e45ace2bSmrg# When config.status generates a header, we must update the stamp-h file.
560e45ace2bSmrg# This file resides in the same directory as the config header
561e45ace2bSmrg# that is generated.  The stamp files are numbered to have different names.
562af928962Smrg
563e45ace2bSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
564e45ace2bSmrg# loop where config.status creates the headers, so we can generate
565e45ace2bSmrg# our stamp files there.
566e45ace2bSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
567e45ace2bSmrg[# Compute $1's index in $config_headers.
568e45ace2bSmrg_am_arg=$1
569e45ace2bSmrg_am_stamp_count=1
570e45ace2bSmrgfor _am_header in $config_headers :; do
571e45ace2bSmrg  case $_am_header in
572e45ace2bSmrg    $_am_arg | $_am_arg:* )
573e45ace2bSmrg      break ;;
574e45ace2bSmrg    * )
575e45ace2bSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
576e45ace2bSmrg  esac
577e45ace2bSmrgdone
578e45ace2bSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
5798d4c0f7bSmrg
58047a4502cSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
581e45ace2bSmrg#
582e45ace2bSmrg# This file is free software; the Free Software Foundation
583e45ace2bSmrg# gives unlimited permission to copy and/or distribute it,
584e45ace2bSmrg# with or without modifications, as long as this notice is preserved.
5858d4c0f7bSmrg
586e45ace2bSmrg# AM_PROG_INSTALL_SH
587e45ace2bSmrg# ------------------
588e45ace2bSmrg# Define $install_sh.
589e45ace2bSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
590e45ace2bSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
591e45ace2bSmrgif test x"${install_sh+set}" != xset; then
592e45ace2bSmrg  case $am_aux_dir in
593e45ace2bSmrg  *\ * | *\	*)
594e45ace2bSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
595e45ace2bSmrg  *)
596e45ace2bSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
597e45ace2bSmrg  esac
5988d4c0f7bSmrgfi
599e45ace2bSmrgAC_SUBST([install_sh])])
6008d4c0f7bSmrg
60147a4502cSmrg# Copyright (C) 2003-2024 Free Software Foundation, Inc.
602e45ace2bSmrg#
603e45ace2bSmrg# This file is free software; the Free Software Foundation
604e45ace2bSmrg# gives unlimited permission to copy and/or distribute it,
605e45ace2bSmrg# with or without modifications, as long as this notice is preserved.
6063d2ed3e3Smrg
607e45ace2bSmrg# Check whether the underlying file-system supports filenames
608e45ace2bSmrg# with a leading dot.  For instance MS-DOS doesn't.
609e45ace2bSmrgAC_DEFUN([AM_SET_LEADING_DOT],
610e45ace2bSmrg[rm -rf .tst 2>/dev/null
611e45ace2bSmrgmkdir .tst 2>/dev/null
612e45ace2bSmrgif test -d .tst; then
613e45ace2bSmrg  am__leading_dot=.
6143d2ed3e3Smrgelse
615e45ace2bSmrg  am__leading_dot=_
6168d4c0f7bSmrgfi
617e45ace2bSmrgrmdir .tst 2>/dev/null
618e45ace2bSmrgAC_SUBST([am__leading_dot])])
6198d4c0f7bSmrg
620e45ace2bSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6218d4c0f7bSmrg
62247a4502cSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
623e45ace2bSmrg#
624e45ace2bSmrg# This file is free software; the Free Software Foundation
625e45ace2bSmrg# gives unlimited permission to copy and/or distribute it,
626e45ace2bSmrg# with or without modifications, as long as this notice is preserved.
6278d4c0f7bSmrg
628e45ace2bSmrg# AM_MAKE_INCLUDE()
629e45ace2bSmrg# -----------------
630e45ace2bSmrg# Check whether make has an 'include' directive that can support all
631e45ace2bSmrg# the idioms we need for our automatic dependency tracking code.
632e45ace2bSmrgAC_DEFUN([AM_MAKE_INCLUDE],
633e45ace2bSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
634e45ace2bSmrgcat > confinc.mk << 'END'
635e45ace2bSmrgam__doit:
636e45ace2bSmrg	@echo this is the am__doit target >confinc.out
637e45ace2bSmrg.PHONY: am__doit
638e45ace2bSmrgEND
639e45ace2bSmrgam__include="#"
640e45ace2bSmrgam__quote=
641e45ace2bSmrg# BSD make does it like this.
642e45ace2bSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
643e45ace2bSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
644e45ace2bSmrgecho 'include confinc.mk # ignored' > confmf.GNU
645e45ace2bSmrg_am_result=no
646e45ace2bSmrgfor s in GNU BSD; do
647e45ace2bSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
648e45ace2bSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
649e45ace2bSmrg      ['0:this is the am__doit target'],
650e45ace2bSmrg      [AS_CASE([$s],
651e45ace2bSmrg          [BSD], [am__include='.include' am__quote='"'],
652e45ace2bSmrg          [am__include='include' am__quote=''])])
653e45ace2bSmrg  if test "$am__include" != "#"; then
654e45ace2bSmrg    _am_result="yes ($s style)"
655e45ace2bSmrg    break
656e45ace2bSmrg  fi
657e45ace2bSmrgdone
658e45ace2bSmrgrm -f confinc.* confmf.*
659e45ace2bSmrgAC_MSG_RESULT([${_am_result}])
660e45ace2bSmrgAC_SUBST([am__include])])
661e45ace2bSmrgAC_SUBST([am__quote])])
6628d4c0f7bSmrg
663e45ace2bSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
6648a0d9095Smrg
66547a4502cSmrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
6663d2ed3e3Smrg#
667e45ace2bSmrg# This file is free software; the Free Software Foundation
668e45ace2bSmrg# gives unlimited permission to copy and/or distribute it,
669e45ace2bSmrg# with or without modifications, as long as this notice is preserved.
6708a0d9095Smrg
671e45ace2bSmrg# AM_MISSING_PROG(NAME, PROGRAM)
672e45ace2bSmrg# ------------------------------
673e45ace2bSmrgAC_DEFUN([AM_MISSING_PROG],
674e45ace2bSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
675e45ace2bSmrg$1=${$1-"${am_missing_run}$2"}
676e45ace2bSmrgAC_SUBST($1)])
677af928962Smrg
678e45ace2bSmrg# AM_MISSING_HAS_RUN
679e45ace2bSmrg# ------------------
680e45ace2bSmrg# Define MISSING if not defined so far and test if it is modern enough.
681e45ace2bSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
682e45ace2bSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
683e45ace2bSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
684e45ace2bSmrgAC_REQUIRE_AUX_FILE([missing])dnl
685e45ace2bSmrgif test x"${MISSING+set}" != xset; then
686e45ace2bSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
6873d2ed3e3Smrgfi
688e45ace2bSmrg# Use eval to expand $SHELL
689e45ace2bSmrgif eval "$MISSING --is-lightweight"; then
690e45ace2bSmrg  am_missing_run="$MISSING "
691e45ace2bSmrgelse
692e45ace2bSmrg  am_missing_run=
693e45ace2bSmrg  AC_MSG_WARN(['missing' script is too old or missing])
6943d2ed3e3Smrgfi
695e45ace2bSmrg])
6968a0d9095Smrg
697e45ace2bSmrg# Helper functions for option handling.                     -*- Autoconf -*-
698af928962Smrg
69947a4502cSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
700e45ace2bSmrg#
701e45ace2bSmrg# This file is free software; the Free Software Foundation
702e45ace2bSmrg# gives unlimited permission to copy and/or distribute it,
703e45ace2bSmrg# with or without modifications, as long as this notice is preserved.
704af928962Smrg
705e45ace2bSmrg# _AM_MANGLE_OPTION(NAME)
706e45ace2bSmrg# -----------------------
707e45ace2bSmrgAC_DEFUN([_AM_MANGLE_OPTION],
708e45ace2bSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7098a0d9095Smrg
710e45ace2bSmrg# _AM_SET_OPTION(NAME)
711e45ace2bSmrg# --------------------
712e45ace2bSmrg# Set option NAME.  Presently that only means defining a flag for this option.
713e45ace2bSmrgAC_DEFUN([_AM_SET_OPTION],
714e45ace2bSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7158a0d9095Smrg
716e45ace2bSmrg# _AM_SET_OPTIONS(OPTIONS)
717e45ace2bSmrg# ------------------------
718e45ace2bSmrg# OPTIONS is a space-separated list of Automake options.
719e45ace2bSmrgAC_DEFUN([_AM_SET_OPTIONS],
720e45ace2bSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
721e45ace2bSmrg
722e45ace2bSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
723e45ace2bSmrg# -------------------------------------------
724e45ace2bSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
725e45ace2bSmrgAC_DEFUN([_AM_IF_OPTION],
726e45ace2bSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
727e45ace2bSmrg
72847a4502cSmrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
7293d2ed3e3Smrg#
730e45ace2bSmrg# This file is free software; the Free Software Foundation
731e45ace2bSmrg# gives unlimited permission to copy and/or distribute it,
732e45ace2bSmrg# with or without modifications, as long as this notice is preserved.
733fe567363Smrg
734e45ace2bSmrg# _AM_PROG_CC_C_O
735e45ace2bSmrg# ---------------
736e45ace2bSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
737e45ace2bSmrg# to automatically call this.
738e45ace2bSmrgAC_DEFUN([_AM_PROG_CC_C_O],
739e45ace2bSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
740e45ace2bSmrgAC_REQUIRE_AUX_FILE([compile])dnl
741e45ace2bSmrgAC_LANG_PUSH([C])dnl
742e45ace2bSmrgAC_CACHE_CHECK(
743e45ace2bSmrg  [whether $CC understands -c and -o together],
744e45ace2bSmrg  [am_cv_prog_cc_c_o],
745e45ace2bSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
746e45ace2bSmrg  # Make sure it works both with $CC and with simple cc.
747e45ace2bSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
748e45ace2bSmrg  # compilers refuse to overwrite an existing .o file with -o,
749e45ace2bSmrg  # though they will create one.
750e45ace2bSmrg  am_cv_prog_cc_c_o=yes
751e45ace2bSmrg  for am_i in 1 2; do
752e45ace2bSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
753e45ace2bSmrg         && test -f conftest2.$ac_objext; then
754e45ace2bSmrg      : OK
755e45ace2bSmrg    else
756e45ace2bSmrg      am_cv_prog_cc_c_o=no
757e45ace2bSmrg      break
758e45ace2bSmrg    fi
759e45ace2bSmrg  done
760e45ace2bSmrg  rm -f core conftest*
761e45ace2bSmrg  unset am_i])
762e45ace2bSmrgif test "$am_cv_prog_cc_c_o" != yes; then
763e45ace2bSmrg   # Losing compiler, so override with the script.
764e45ace2bSmrg   # FIXME: It is wrong to rewrite CC.
765e45ace2bSmrg   # But if we don't then we get into trouble of one sort or another.
766e45ace2bSmrg   # A longer-term fix would be to have automake use am__CC in this case,
767e45ace2bSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
768e45ace2bSmrg   CC="$am_aux_dir/compile $CC"
769fe567363Smrgfi
770e45ace2bSmrgAC_LANG_POP([C])])
771fe567363Smrg
772e45ace2bSmrg# For backward compatibility.
773e45ace2bSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
774fe567363Smrg
77547a4502cSmrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
77647a4502cSmrg#
77747a4502cSmrg# This file is free software; the Free Software Foundation
77847a4502cSmrg# gives unlimited permission to copy and/or distribute it,
77947a4502cSmrg# with or without modifications, as long as this notice is preserved.
78047a4502cSmrg
78147a4502cSmrg# _AM_PROG_RM_F
78247a4502cSmrg# ---------------
78347a4502cSmrg# Check whether 'rm -f' without any arguments works.
78447a4502cSmrg# https://bugs.gnu.org/10828
78547a4502cSmrgAC_DEFUN([_AM_PROG_RM_F],
78647a4502cSmrg[am__rm_f_notfound=
78747a4502cSmrgAS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""'])
78847a4502cSmrgAC_SUBST(am__rm_f_notfound)
78947a4502cSmrg])
79047a4502cSmrg
79147a4502cSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
792af928962Smrg#
793e45ace2bSmrg# This file is free software; the Free Software Foundation
794e45ace2bSmrg# gives unlimited permission to copy and/or distribute it,
795e45ace2bSmrg# with or without modifications, as long as this notice is preserved.
7968a0d9095Smrg
797e45ace2bSmrg# AM_RUN_LOG(COMMAND)
798e45ace2bSmrg# -------------------
799e45ace2bSmrg# Run COMMAND, save the exit status in ac_status, and log it.
800e45ace2bSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
801e45ace2bSmrgAC_DEFUN([AM_RUN_LOG],
802e45ace2bSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
803e45ace2bSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
804e45ace2bSmrg   ac_status=$?
805e45ace2bSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
806e45ace2bSmrg   (exit $ac_status); }])
807e45ace2bSmrg
808e45ace2bSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
809e45ace2bSmrg
81047a4502cSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
8113d2ed3e3Smrg#
812e45ace2bSmrg# This file is free software; the Free Software Foundation
813e45ace2bSmrg# gives unlimited permission to copy and/or distribute it,
814e45ace2bSmrg# with or without modifications, as long as this notice is preserved.
8158a0d9095Smrg
81647a4502cSmrg# _AM_SLEEP_FRACTIONAL_SECONDS
81747a4502cSmrg# ----------------------------
81847a4502cSmrgAC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl
81947a4502cSmrgAC_CACHE_CHECK([whether sleep supports fractional seconds],
82047a4502cSmrg               am_cv_sleep_fractional_seconds, [dnl
82147a4502cSmrgAS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes],
82247a4502cSmrg                                 [am_cv_sleep_fractional_seconds=no])
82347a4502cSmrg])])
82447a4502cSmrg
82547a4502cSmrg# _AM_FILESYSTEM_TIMESTAMP_RESOLUTION
82647a4502cSmrg# -----------------------------------
82747a4502cSmrg# Determine the filesystem's resolution for file modification
82847a4502cSmrg# timestamps.  The coarsest we know of is FAT, with a resolution
82947a4502cSmrg# of only two seconds, even with the most recent "exFAT" extensions.
83047a4502cSmrg# The finest (e.g. ext4 with large inodes, XFS, ZFS) is one
83147a4502cSmrg# nanosecond, matching clock_gettime.  However, it is probably not
83247a4502cSmrg# possible to delay execution of a shell script for less than one
83347a4502cSmrg# millisecond, due to process creation overhead and scheduling
83447a4502cSmrg# granularity, so we don't check for anything finer than that. (See below.)
83547a4502cSmrgAC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl
83647a4502cSmrgAC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS])
83747a4502cSmrgAC_CACHE_CHECK([filesystem timestamp resolution],
83847a4502cSmrg               am_cv_filesystem_timestamp_resolution, [dnl
83947a4502cSmrg# Default to the worst case.
84047a4502cSmrgam_cv_filesystem_timestamp_resolution=2
84147a4502cSmrg
84247a4502cSmrg# Only try to go finer than 1 sec if sleep can do it.
84347a4502cSmrg# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work,
84447a4502cSmrg# - 1 sec is not much of a win compared to 2 sec, and
84547a4502cSmrg# - it takes 2 seconds to perform the test whether 1 sec works.
84647a4502cSmrg# 
84747a4502cSmrg# Instead, just use the default 2s on platforms that have 1s resolution,
84847a4502cSmrg# accept the extra 1s delay when using $sleep in the Automake tests, in
84947a4502cSmrg# exchange for not incurring the 2s delay for running the test for all
85047a4502cSmrg# packages.
85147a4502cSmrg#
85247a4502cSmrgam_try_resolutions=
85347a4502cSmrgif test "$am_cv_sleep_fractional_seconds" = yes; then
85447a4502cSmrg  # Even a millisecond often causes a bunch of false positives,
85547a4502cSmrg  # so just try a hundredth of a second. The time saved between .001 and
85647a4502cSmrg  # .01 is not terribly consequential.
85747a4502cSmrg  am_try_resolutions="0.01 0.1 $am_try_resolutions"
85847a4502cSmrgfi
85947a4502cSmrg
86047a4502cSmrg# In order to catch current-generation FAT out, we must *modify* files
86147a4502cSmrg# that already exist; the *creation* timestamp is finer.  Use names
86247a4502cSmrg# that make ls -t sort them differently when they have equal
86347a4502cSmrg# timestamps than when they have distinct timestamps, keeping
86447a4502cSmrg# in mind that ls -t prints the *newest* file first.
86547a4502cSmrgrm -f conftest.ts?
86647a4502cSmrg: > conftest.ts1
86747a4502cSmrg: > conftest.ts2
86847a4502cSmrg: > conftest.ts3
86947a4502cSmrg
87047a4502cSmrg# Make sure ls -t actually works.  Do 'set' in a subshell so we don't
87147a4502cSmrg# clobber the current shell's arguments. (Outer-level square brackets
87247a4502cSmrg# are removed by m4; they're present so that m4 does not expand
87347a4502cSmrg# <dollar><star>; be careful, easy to get confused.)
87447a4502cSmrgif (
87547a4502cSmrg     set X `[ls -t conftest.ts[12]]` &&
87647a4502cSmrg     {
87747a4502cSmrg       test "$[]*" != "X conftest.ts1 conftest.ts2" ||
87847a4502cSmrg       test "$[]*" != "X conftest.ts2 conftest.ts1";
87947a4502cSmrg     }
88047a4502cSmrg); then :; else
88147a4502cSmrg  # If neither matched, then we have a broken ls.  This can happen
88247a4502cSmrg  # if, for instance, CONFIG_SHELL is bash and it inherits a
88347a4502cSmrg  # broken ls alias from the environment.  This has actually
88447a4502cSmrg  # happened.  Such a system could not be considered "sane".
88547a4502cSmrg  _AS_ECHO_UNQUOTED(
88647a4502cSmrg    ["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""],
88747a4502cSmrg    [AS_MESSAGE_LOG_FD])
88847a4502cSmrg  AC_MSG_FAILURE([ls -t produces unexpected output.
88947a4502cSmrgMake sure there is not a broken ls alias in your environment.])
89047a4502cSmrgfi
89147a4502cSmrg
89247a4502cSmrgfor am_try_res in $am_try_resolutions; do
89347a4502cSmrg  # Any one fine-grained sleep might happen to cross the boundary
89447a4502cSmrg  # between two values of a coarser actual resolution, but if we do
89547a4502cSmrg  # two fine-grained sleeps in a row, at least one of them will fall
89647a4502cSmrg  # entirely within a coarse interval.
89747a4502cSmrg  echo alpha > conftest.ts1
89847a4502cSmrg  sleep $am_try_res
89947a4502cSmrg  echo beta > conftest.ts2
90047a4502cSmrg  sleep $am_try_res
90147a4502cSmrg  echo gamma > conftest.ts3
90247a4502cSmrg
90347a4502cSmrg  # We assume that 'ls -t' will make use of high-resolution
90447a4502cSmrg  # timestamps if the operating system supports them at all.
90547a4502cSmrg  if (set X `ls -t conftest.ts?` &&
90647a4502cSmrg      test "$[]2" = conftest.ts3 &&
90747a4502cSmrg      test "$[]3" = conftest.ts2 &&
90847a4502cSmrg      test "$[]4" = conftest.ts1); then
90947a4502cSmrg    #
91047a4502cSmrg    # Ok, ls -t worked. If we're at a resolution of 1 second, we're done,
91147a4502cSmrg    # because we don't need to test make.
91247a4502cSmrg    make_ok=true
91347a4502cSmrg    if test $am_try_res != 1; then
91447a4502cSmrg      # But if we've succeeded so far with a subsecond resolution, we
91547a4502cSmrg      # have one more thing to check: make. It can happen that
91647a4502cSmrg      # everything else supports the subsecond mtimes, but make doesn't;
91747a4502cSmrg      # notably on macOS, which ships make 3.81 from 2006 (the last one
91847a4502cSmrg      # released under GPLv2). https://bugs.gnu.org/68808
91947a4502cSmrg      # 
92047a4502cSmrg      # We test $MAKE if it is defined in the environment, else "make".
92147a4502cSmrg      # It might get overridden later, but our hope is that in practice
92247a4502cSmrg      # it does not matter: it is the system "make" which is (by far)
92347a4502cSmrg      # the most likely to be broken, whereas if the user overrides it,
92447a4502cSmrg      # probably they did so with a better, or at least not worse, make.
92547a4502cSmrg      # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html
92647a4502cSmrg      #
92747a4502cSmrg      # Create a Makefile (real tab character here):
92847a4502cSmrg      rm -f conftest.mk
92947a4502cSmrg      echo 'conftest.ts1: conftest.ts2' >conftest.mk
93047a4502cSmrg      echo '	touch conftest.ts2' >>conftest.mk
93147a4502cSmrg      #
93247a4502cSmrg      # Now, running
93347a4502cSmrg      #   touch conftest.ts1; touch conftest.ts2; make
93447a4502cSmrg      # should touch ts1 because ts2 is newer. This could happen by luck,
93547a4502cSmrg      # but most often, it will fail if make's support is insufficient. So
93647a4502cSmrg      # test for several consecutive successes.
93747a4502cSmrg      #
93847a4502cSmrg      # (We reuse conftest.ts[12] because we still want to modify existing
93947a4502cSmrg      # files, not create new ones, per above.)
94047a4502cSmrg      n=0
94147a4502cSmrg      make=${MAKE-make}
94247a4502cSmrg      until test $n -eq 3; do
94347a4502cSmrg        echo one > conftest.ts1
94447a4502cSmrg        sleep $am_try_res
94547a4502cSmrg        echo two > conftest.ts2 # ts2 should now be newer than ts1
94647a4502cSmrg        if $make -f conftest.mk | grep 'up to date' >/dev/null; then
94747a4502cSmrg          make_ok=false
94847a4502cSmrg          break # out of $n loop
94947a4502cSmrg        fi
95047a4502cSmrg        n=`expr $n + 1`
95147a4502cSmrg      done
95247a4502cSmrg    fi
95347a4502cSmrg    #
95447a4502cSmrg    if $make_ok; then
95547a4502cSmrg      # Everything we know to check worked out, so call this resolution good.
95647a4502cSmrg      am_cv_filesystem_timestamp_resolution=$am_try_res
95747a4502cSmrg      break # out of $am_try_res loop
95847a4502cSmrg    fi
95947a4502cSmrg    # Otherwise, we'll go on to check the next resolution.
96047a4502cSmrg  fi
96147a4502cSmrgdone
96247a4502cSmrgrm -f conftest.ts?
96347a4502cSmrg# (end _am_filesystem_timestamp_resolution)
96447a4502cSmrg])])
96547a4502cSmrg
966e45ace2bSmrg# AM_SANITY_CHECK
967e45ace2bSmrg# ---------------
968e45ace2bSmrgAC_DEFUN([AM_SANITY_CHECK],
96947a4502cSmrg[AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION])
97047a4502cSmrg# This check should not be cached, as it may vary across builds of
97147a4502cSmrg# different projects.
97247a4502cSmrgAC_MSG_CHECKING([whether build environment is sane])
973e45ace2bSmrg# Reject unsafe characters in $srcdir or the absolute working directory
974e45ace2bSmrg# name.  Accept space and tab only in the latter.
975e45ace2bSmrgam_lf='
976e45ace2bSmrg'
977e45ace2bSmrgcase `pwd` in
978e45ace2bSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
979e45ace2bSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
980e45ace2bSmrgesac
981e45ace2bSmrgcase $srcdir in
982e45ace2bSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
983e45ace2bSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
984e45ace2bSmrgesac
985e45ace2bSmrg
986e45ace2bSmrg# Do 'set' in a subshell so we don't clobber the current shell's
987e45ace2bSmrg# arguments.  Must try -L first in case configure is actually a
988e45ace2bSmrg# symlink; some systems play weird games with the mod time of symlinks
989e45ace2bSmrg# (eg FreeBSD returns the mod time of the symlink's containing
990e45ace2bSmrg# directory).
99147a4502cSmrgam_build_env_is_sane=no
99247a4502cSmrgam_has_slept=no
99347a4502cSmrgrm -f conftest.file
99447a4502cSmrgfor am_try in 1 2; do
99547a4502cSmrg  echo "timestamp, slept: $am_has_slept" > conftest.file
99647a4502cSmrg  if (
99747a4502cSmrg    set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
99847a4502cSmrg    if test "$[]*" = "X"; then
99947a4502cSmrg      # -L didn't work.
100047a4502cSmrg      set X `ls -t "$srcdir/configure" conftest.file`
100147a4502cSmrg    fi
100247a4502cSmrg    test "$[]2" = conftest.file
100347a4502cSmrg  ); then
100447a4502cSmrg    am_build_env_is_sane=yes
100547a4502cSmrg    break
100647a4502cSmrg  fi
100747a4502cSmrg  # Just in case.
100847a4502cSmrg  sleep "$am_cv_filesystem_timestamp_resolution"
100947a4502cSmrg  am_has_slept=yes
101047a4502cSmrgdone
101147a4502cSmrg
101247a4502cSmrgAC_MSG_RESULT([$am_build_env_is_sane])
101347a4502cSmrgif test "$am_build_env_is_sane" = no; then
101447a4502cSmrg  AC_MSG_ERROR([newly created file is older than distributed files!
1015e45ace2bSmrgCheck your system clock])
1016e45ace2bSmrgfi
101747a4502cSmrg
1018e45ace2bSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
1019e45ace2bSmrg# generated files are strictly newer.
1020e45ace2bSmrgam_sleep_pid=
102147a4502cSmrgAS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl
102247a4502cSmrg  ( sleep "$am_cv_filesystem_timestamp_resolution" ) &
1023e45ace2bSmrg  am_sleep_pid=$!
102447a4502cSmrg])
1025e45ace2bSmrgAC_CONFIG_COMMANDS_PRE(
1026e45ace2bSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
1027e45ace2bSmrg   if test -n "$am_sleep_pid"; then
1028e45ace2bSmrg     # Hide warnings about reused PIDs.
1029e45ace2bSmrg     wait $am_sleep_pid 2>/dev/null
10303d2ed3e3Smrg   fi
1031e45ace2bSmrg   AC_MSG_RESULT([done])])
1032e45ace2bSmrgrm -f conftest.file
1033e45ace2bSmrg])
1034e45ace2bSmrg
103547a4502cSmrg# Copyright (C) 2009-2024 Free Software Foundation, Inc.
1036e45ace2bSmrg#
1037e45ace2bSmrg# This file is free software; the Free Software Foundation
1038e45ace2bSmrg# gives unlimited permission to copy and/or distribute it,
1039e45ace2bSmrg# with or without modifications, as long as this notice is preserved.
1040e45ace2bSmrg
104147a4502cSmrg# _AM_SILENT_RULES
104247a4502cSmrg# ----------------
104347a4502cSmrg# Enable less verbose build rules support.
104447a4502cSmrgAC_DEFUN([_AM_SILENT_RULES],
104547a4502cSmrg[AM_DEFAULT_VERBOSITY=1
104647a4502cSmrgAC_ARG_ENABLE([silent-rules], [dnl
1047e45ace2bSmrgAS_HELP_STRING(
1048e45ace2bSmrg  [--enable-silent-rules],
1049e45ace2bSmrg  [less verbose build output (undo: "make V=1")])
1050e45ace2bSmrgAS_HELP_STRING(
1051e45ace2bSmrg  [--disable-silent-rules],
1052e45ace2bSmrg  [verbose build output (undo: "make V=0")])dnl
1053e45ace2bSmrg])
1054e45ace2bSmrgdnl
1055e45ace2bSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
1056e45ace2bSmrgdnl do not support nested variable expansions.
1057e45ace2bSmrgdnl See automake bug#9928 and bug#10237.
1058e45ace2bSmrgam_make=${MAKE-make}
1059e45ace2bSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
1060e45ace2bSmrg   [am_cv_make_support_nested_variables],
1061e45ace2bSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
1062e45ace2bSmrgBAR0=false
1063e45ace2bSmrgBAR1=true
1064e45ace2bSmrgV=1
1065e45ace2bSmrgam__doit:
1066e45ace2bSmrg	@$(TRUE)
1067e45ace2bSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
1068e45ace2bSmrg  am_cv_make_support_nested_variables=yes
106975ebec6dSmrgelse
1070e45ace2bSmrg  am_cv_make_support_nested_variables=no
1071e45ace2bSmrgfi])
1072e45ace2bSmrgAC_SUBST([AM_V])dnl
1073e45ace2bSmrgAM_SUBST_NOTMAKE([AM_V])dnl
1074e45ace2bSmrgAC_SUBST([AM_DEFAULT_V])dnl
1075e45ace2bSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
1076e45ace2bSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
1077e45ace2bSmrgAM_BACKSLASH='\'
1078e45ace2bSmrgAC_SUBST([AM_BACKSLASH])dnl
1079e45ace2bSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
108047a4502cSmrgdnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls
108147a4502cSmrgdnl to AM_SILENT_RULES to change the default value.
108247a4502cSmrgAC_CONFIG_COMMANDS_PRE([dnl
108347a4502cSmrgcase $enable_silent_rules in @%:@ (((
108447a4502cSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
108547a4502cSmrg   no) AM_DEFAULT_VERBOSITY=1;;
108647a4502cSmrgesac
108747a4502cSmrgif test $am_cv_make_support_nested_variables = yes; then
108847a4502cSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
108947a4502cSmrg  AM_V='$(V)'
109047a4502cSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
109147a4502cSmrgelse
109247a4502cSmrg  AM_V=$AM_DEFAULT_VERBOSITY
109347a4502cSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
109447a4502cSmrgfi
109547a4502cSmrg])dnl
1096e45ace2bSmrg])
109775ebec6dSmrg
109847a4502cSmrg# AM_SILENT_RULES([DEFAULT])
109947a4502cSmrg# --------------------------
110047a4502cSmrg# Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or
110147a4502cSmrg# empty being verbose).
110247a4502cSmrgAC_DEFUN([AM_SILENT_RULES],
110347a4502cSmrg[AC_REQUIRE([_AM_SILENT_RULES])
110447a4502cSmrgAM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])])
110547a4502cSmrg
110647a4502cSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
1107e45ace2bSmrg#
1108e45ace2bSmrg# This file is free software; the Free Software Foundation
1109e45ace2bSmrg# gives unlimited permission to copy and/or distribute it,
1110e45ace2bSmrg# with or without modifications, as long as this notice is preserved.
11118a0d9095Smrg
1112e45ace2bSmrg# AM_PROG_INSTALL_STRIP
1113e45ace2bSmrg# ---------------------
1114e45ace2bSmrg# One issue with vendor 'install' (even GNU) is that you can't
1115e45ace2bSmrg# specify the program used to strip binaries.  This is especially
1116e45ace2bSmrg# annoying in cross-compiling environments, where the build's strip
1117e45ace2bSmrg# is unlikely to handle the host's binaries.
1118e45ace2bSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
1119e45ace2bSmrg# always use install-sh in "make install-strip", and initialize
1120e45ace2bSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
1121e45ace2bSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
1122e45ace2bSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
1123e45ace2bSmrg# Installed binaries are usually stripped using 'strip' when the user
1124e45ace2bSmrg# run "make install-strip".  However 'strip' might not be the right
1125e45ace2bSmrg# tool to use in cross-compilation environments, therefore Automake
1126e45ace2bSmrg# will honor the 'STRIP' environment variable to overrule this program.
1127e45ace2bSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
1128e45ace2bSmrgif test "$cross_compiling" != no; then
1129e45ace2bSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
1130e45ace2bSmrgfi
1131e45ace2bSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
1132e45ace2bSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1133e45ace2bSmrg
113447a4502cSmrg# Copyright (C) 2006-2024 Free Software Foundation, Inc.
113575ebec6dSmrg#
1136e45ace2bSmrg# This file is free software; the Free Software Foundation
1137e45ace2bSmrg# gives unlimited permission to copy and/or distribute it,
1138e45ace2bSmrg# with or without modifications, as long as this notice is preserved.
1139e45ace2bSmrg
1140e45ace2bSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
1141e45ace2bSmrg# ---------------------------
1142e45ace2bSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1143e45ace2bSmrg# This macro is traced by Automake.
1144e45ace2bSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1145e45ace2bSmrg
1146e45ace2bSmrg# AM_SUBST_NOTMAKE(VARIABLE)
1147e45ace2bSmrg# --------------------------
1148e45ace2bSmrg# Public sister of _AM_SUBST_NOTMAKE.
1149e45ace2bSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1150e45ace2bSmrg
1151e45ace2bSmrg# Check how to create a tarball.                            -*- Autoconf -*-
1152e45ace2bSmrg
115347a4502cSmrg# Copyright (C) 2004-2024 Free Software Foundation, Inc.
11543d2ed3e3Smrg#
1155e45ace2bSmrg# This file is free software; the Free Software Foundation
1156e45ace2bSmrg# gives unlimited permission to copy and/or distribute it,
1157e45ace2bSmrg# with or without modifications, as long as this notice is preserved.
1158e45ace2bSmrg
1159e45ace2bSmrg# _AM_PROG_TAR(FORMAT)
1160e45ace2bSmrg# --------------------
1161e45ace2bSmrg# Check how to create a tarball in format FORMAT.
1162e45ace2bSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
11633d2ed3e3Smrg#
1164e45ace2bSmrg# Substitute a variable $(am__tar) that is a command
1165e45ace2bSmrg# writing to stdout a FORMAT-tarball containing the directory
1166e45ace2bSmrg# $tardir.
1167e45ace2bSmrg#     tardir=directory && $(am__tar) > result.tar
11683d2ed3e3Smrg#
1169e45ace2bSmrg# Substitute a variable $(am__untar) that extract such
1170e45ace2bSmrg# a tarball read from stdin.
1171e45ace2bSmrg#     $(am__untar) < result.tar
11723d2ed3e3Smrg#
1173e45ace2bSmrgAC_DEFUN([_AM_PROG_TAR],
1174e45ace2bSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1175e45ace2bSmrg# in the wild :-(  We should find a proper way to deprecate it ...
1176e45ace2bSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
11778a0d9095Smrg
1178e45ace2bSmrg# We'll loop over all known methods to create a tar archive until one works.
1179e45ace2bSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
11808a0d9095Smrg
1181e45ace2bSmrgm4_if([$1], [v7],
1182e45ace2bSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
11838a0d9095Smrg
1184e45ace2bSmrg  [m4_case([$1],
1185e45ace2bSmrg    [ustar],
1186e45ace2bSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1187e45ace2bSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1188e45ace2bSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1189e45ace2bSmrg      # and bug#13588).
1190e45ace2bSmrg      am_max_uid=2097151 # 2^21 - 1
1191e45ace2bSmrg      am_max_gid=$am_max_uid
1192e45ace2bSmrg      # The $UID and $GID variables are not portable, so we need to resort
1193e45ace2bSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1194e45ace2bSmrg      # below are definitely unexpected, so allow the users to see them
1195e45ace2bSmrg      # (that is, avoid stderr redirection).
1196e45ace2bSmrg      am_uid=`id -u || echo unknown`
1197e45ace2bSmrg      am_gid=`id -g || echo unknown`
1198e45ace2bSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
119947a4502cSmrg      if test x$am_uid = xunknown; then
120047a4502cSmrg        AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work])
120147a4502cSmrg      elif test $am_uid -le $am_max_uid; then
120247a4502cSmrg        AC_MSG_RESULT([yes])
1203e45ace2bSmrg      else
120447a4502cSmrg        AC_MSG_RESULT([no])
120547a4502cSmrg        _am_tools=none
1206e45ace2bSmrg      fi
1207e45ace2bSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
120847a4502cSmrg      if test x$gm_gid = xunknown; then
120947a4502cSmrg        AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work])
121047a4502cSmrg      elif test $am_gid -le $am_max_gid; then
121147a4502cSmrg        AC_MSG_RESULT([yes])
1212e45ace2bSmrg      else
1213e45ace2bSmrg        AC_MSG_RESULT([no])
1214e45ace2bSmrg        _am_tools=none
1215e45ace2bSmrg      fi],
12168a0d9095Smrg
1217e45ace2bSmrg  [pax],
1218e45ace2bSmrg    [],
12193d2ed3e3Smrg
1220e45ace2bSmrg  [m4_fatal([Unknown tar format])])
122175ebec6dSmrg
1222e45ace2bSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
122375ebec6dSmrg
1224e45ace2bSmrg  # Go ahead even if we have the value already cached.  We do so because we
1225e45ace2bSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1226e45ace2bSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
122775ebec6dSmrg
1228e45ace2bSmrg  for _am_tool in $_am_tools; do
1229e45ace2bSmrg    case $_am_tool in
1230e45ace2bSmrg    gnutar)
1231e45ace2bSmrg      for _am_tar in tar gnutar gtar; do
1232e45ace2bSmrg        AM_RUN_LOG([$_am_tar --version]) && break
1233e45ace2bSmrg      done
1234e45ace2bSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1235e45ace2bSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1236e45ace2bSmrg      am__untar="$_am_tar -xf -"
1237e45ace2bSmrg      ;;
1238e45ace2bSmrg    plaintar)
1239e45ace2bSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1240e45ace2bSmrg      # ustar tarball either.
1241e45ace2bSmrg      (tar --version) >/dev/null 2>&1 && continue
1242e45ace2bSmrg      am__tar='tar chf - "$$tardir"'
1243e45ace2bSmrg      am__tar_='tar chf - "$tardir"'
1244e45ace2bSmrg      am__untar='tar xf -'
1245e45ace2bSmrg      ;;
1246e45ace2bSmrg    pax)
1247e45ace2bSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
1248e45ace2bSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
1249e45ace2bSmrg      am__untar='pax -r'
1250e45ace2bSmrg      ;;
1251e45ace2bSmrg    cpio)
1252e45ace2bSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1253e45ace2bSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1254e45ace2bSmrg      am__untar='cpio -i -H $1 -d'
1255e45ace2bSmrg      ;;
1256e45ace2bSmrg    none)
1257e45ace2bSmrg      am__tar=false
1258e45ace2bSmrg      am__tar_=false
1259e45ace2bSmrg      am__untar=false
1260e45ace2bSmrg      ;;
1261e45ace2bSmrg    esac
1262af928962Smrg
1263e45ace2bSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
1264e45ace2bSmrg    # and am__untar set.
1265e45ace2bSmrg    test -n "${am_cv_prog_tar_$1}" && break
126675ebec6dSmrg
1267e45ace2bSmrg    # tar/untar a dummy directory, and stop if the command works.
1268e45ace2bSmrg    rm -rf conftest.dir
1269e45ace2bSmrg    mkdir conftest.dir
1270e45ace2bSmrg    echo GrepMe > conftest.dir/file
1271e45ace2bSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1272e45ace2bSmrg    rm -rf conftest.dir
1273e45ace2bSmrg    if test -s conftest.tar; then
1274e45ace2bSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
1275e45ace2bSmrg      AM_RUN_LOG([cat conftest.dir/file])
1276e45ace2bSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1277e45ace2bSmrg    fi
1278e45ace2bSmrg  done
1279e45ace2bSmrg  rm -rf conftest.dir
128075ebec6dSmrg
1281e45ace2bSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1282e45ace2bSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1283af928962Smrg
1284e45ace2bSmrgAC_SUBST([am__tar])
1285e45ace2bSmrgAC_SUBST([am__untar])
1286e45ace2bSmrg]) # _AM_PROG_TAR
128775ebec6dSmrg
128847a4502cSmrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
128947a4502cSmrg#
129047a4502cSmrg# This file is free software; the Free Software Foundation
129147a4502cSmrg# gives unlimited permission to copy and/or distribute it,
129247a4502cSmrg# with or without modifications, as long as this notice is preserved.
129347a4502cSmrg
129447a4502cSmrg# _AM_PROG_XARGS_N
129547a4502cSmrg# ----------------
129647a4502cSmrg# Check whether 'xargs -n' works.  It should work everywhere, so the fallback
129747a4502cSmrg# is not optimized at all as we never expect to use it.
129847a4502cSmrgAC_DEFUN([_AM_PROG_XARGS_N],
129947a4502cSmrg[AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl
130047a4502cSmrgAS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2
130147a4502cSmrg3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])])
130247a4502cSmrgAS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl
130347a4502cSmrg  am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }'
130447a4502cSmrg])dnl
130547a4502cSmrgAC_SUBST(am__xargs_n)
130647a4502cSmrg])
130747a4502cSmrg
1308e45ace2bSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1309e45ace2bSmrgdnl serial 11 (pkg-config-0.29)
1310e45ace2bSmrgdnl
1311e45ace2bSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1312e45ace2bSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1313e45ace2bSmrgdnl
1314e45ace2bSmrgdnl This program is free software; you can redistribute it and/or modify
1315e45ace2bSmrgdnl it under the terms of the GNU General Public License as published by
1316e45ace2bSmrgdnl the Free Software Foundation; either version 2 of the License, or
1317e45ace2bSmrgdnl (at your option) any later version.
1318e45ace2bSmrgdnl
1319e45ace2bSmrgdnl This program is distributed in the hope that it will be useful, but
1320e45ace2bSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1321e45ace2bSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1322e45ace2bSmrgdnl General Public License for more details.
1323e45ace2bSmrgdnl
1324e45ace2bSmrgdnl You should have received a copy of the GNU General Public License
1325e45ace2bSmrgdnl along with this program; if not, write to the Free Software
1326e45ace2bSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1327e45ace2bSmrgdnl 02111-1307, USA.
1328e45ace2bSmrgdnl
1329e45ace2bSmrgdnl As a special exception to the GNU General Public License, if you
1330e45ace2bSmrgdnl distribute this file as part of a program that contains a
1331e45ace2bSmrgdnl configuration script generated by Autoconf, you may include it under
1332e45ace2bSmrgdnl the same distribution terms that you use for the rest of that
1333e45ace2bSmrgdnl program.
1334af928962Smrg
1335e45ace2bSmrgdnl PKG_PREREQ(MIN-VERSION)
1336e45ace2bSmrgdnl -----------------------
1337e45ace2bSmrgdnl Since: 0.29
1338e45ace2bSmrgdnl
1339e45ace2bSmrgdnl Verify that the version of the pkg-config macros are at least
1340e45ace2bSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1341e45ace2bSmrgdnl installed version of pkg-config, this checks the developer's version
1342e45ace2bSmrgdnl of pkg.m4 when generating configure.
1343e45ace2bSmrgdnl
1344e45ace2bSmrgdnl To ensure that this macro is defined, also add:
1345e45ace2bSmrgdnl m4_ifndef([PKG_PREREQ],
1346e45ace2bSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1347e45ace2bSmrgdnl
1348e45ace2bSmrgdnl See the "Since" comment for each macro you use to see what version
1349e45ace2bSmrgdnl of the macros you require.
1350e45ace2bSmrgm4_defun([PKG_PREREQ],
1351e45ace2bSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
1352e45ace2bSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1353e45ace2bSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1354e45ace2bSmrg])dnl PKG_PREREQ
135575ebec6dSmrg
1356e45ace2bSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1357e45ace2bSmrgdnl ----------------------------------
1358e45ace2bSmrgdnl Since: 0.16
1359e45ace2bSmrgdnl
1360e45ace2bSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1361e45ace2bSmrgdnl first found in the path. Checks that the version of pkg-config found
1362e45ace2bSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1363e45ace2bSmrgdnl used since that's the first version where most current features of
1364e45ace2bSmrgdnl pkg-config existed.
1365e45ace2bSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1366e45ace2bSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1367e45ace2bSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1368e45ace2bSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1369e45ace2bSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1370e45ace2bSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1371e45ace2bSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
13723d2ed3e3Smrg
1373e45ace2bSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1374e45ace2bSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1375e45ace2bSmrgfi
1376e45ace2bSmrgif test -n "$PKG_CONFIG"; then
1377e45ace2bSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
1378e45ace2bSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1379e45ace2bSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1380e45ace2bSmrg		AC_MSG_RESULT([yes])
1381e45ace2bSmrg	else
1382e45ace2bSmrg		AC_MSG_RESULT([no])
1383e45ace2bSmrg		PKG_CONFIG=""
1384e45ace2bSmrg	fi
1385e45ace2bSmrgfi[]dnl
1386e45ace2bSmrg])dnl PKG_PROG_PKG_CONFIG
1387e45ace2bSmrg
1388e45ace2bSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1389e45ace2bSmrgdnl -------------------------------------------------------------------
1390e45ace2bSmrgdnl Since: 0.18
1391e45ace2bSmrgdnl
1392e45ace2bSmrgdnl Check to see whether a particular set of modules exists. Similar to
1393e45ace2bSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1394e45ace2bSmrgdnl
1395e45ace2bSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1396e45ace2bSmrgdnl only at the first occurence in configure.ac, so if the first place
1397e45ace2bSmrgdnl it's called might be skipped (such as if it is within an "if", you
1398e45ace2bSmrgdnl have to call PKG_CHECK_EXISTS manually
1399e45ace2bSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1400e45ace2bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1401e45ace2bSmrgif test -n "$PKG_CONFIG" && \
1402e45ace2bSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1403e45ace2bSmrg  m4_default([$2], [:])
1404e45ace2bSmrgm4_ifvaln([$3], [else
1405e45ace2bSmrg  $3])dnl
1406e45ace2bSmrgfi])
1407e45ace2bSmrg
1408e45ace2bSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1409e45ace2bSmrgdnl ---------------------------------------------
1410e45ace2bSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1411e45ace2bSmrgdnl pkg_failed based on the result.
1412e45ace2bSmrgm4_define([_PKG_CONFIG],
1413e45ace2bSmrg[if test -n "$$1"; then
1414e45ace2bSmrg    pkg_cv_[]$1="$$1"
1415e45ace2bSmrg elif test -n "$PKG_CONFIG"; then
1416e45ace2bSmrg    PKG_CHECK_EXISTS([$3],
1417e45ace2bSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1418e45ace2bSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
1419e45ace2bSmrg		     [pkg_failed=yes])
1420e45ace2bSmrg else
1421e45ace2bSmrg    pkg_failed=untried
1422e45ace2bSmrgfi[]dnl
1423e45ace2bSmrg])dnl _PKG_CONFIG
1424e45ace2bSmrg
1425e45ace2bSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1426e45ace2bSmrgdnl ---------------------------
1427e45ace2bSmrgdnl Internal check to see if pkg-config supports short errors.
1428e45ace2bSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1429e45ace2bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1430e45ace2bSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1431e45ace2bSmrg        _pkg_short_errors_supported=yes
14323d2ed3e3Smrgelse
1433e45ace2bSmrg        _pkg_short_errors_supported=no
1434e45ace2bSmrgfi[]dnl
1435e45ace2bSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
143675ebec6dSmrg
143775ebec6dSmrg
1438e45ace2bSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1439e45ace2bSmrgdnl   [ACTION-IF-NOT-FOUND])
1440e45ace2bSmrgdnl --------------------------------------------------------------
1441e45ace2bSmrgdnl Since: 0.4.0
1442e45ace2bSmrgdnl
1443e45ace2bSmrgdnl Note that if there is a possibility the first call to
1444e45ace2bSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1445e45ace2bSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1446e45ace2bSmrgAC_DEFUN([PKG_CHECK_MODULES],
1447e45ace2bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1448e45ace2bSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1449e45ace2bSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
14508a0d9095Smrg
1451e45ace2bSmrgpkg_failed=no
1452e45ace2bSmrgAC_MSG_CHECKING([for $1])
14538a0d9095Smrg
1454e45ace2bSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1455e45ace2bSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
14568a0d9095Smrg
1457e45ace2bSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1458e45ace2bSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1459e45ace2bSmrgSee the pkg-config man page for more details.])
14608a0d9095Smrg
1461e45ace2bSmrgif test $pkg_failed = yes; then
1462e45ace2bSmrg   	AC_MSG_RESULT([no])
1463e45ace2bSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1464e45ace2bSmrg        if test $_pkg_short_errors_supported = yes; then
1465e45ace2bSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1466e45ace2bSmrg        else 
1467e45ace2bSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1468e45ace2bSmrg        fi
1469e45ace2bSmrg	# Put the nasty error message in config.log where it belongs
1470e45ace2bSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
147175ebec6dSmrg
1472e45ace2bSmrg	m4_default([$4], [AC_MSG_ERROR(
1473e45ace2bSmrg[Package requirements ($2) were not met:
1474af928962Smrg
1475e45ace2bSmrg$$1_PKG_ERRORS
1476e45ace2bSmrg
1477e45ace2bSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1478e45ace2bSmrginstalled software in a non-standard prefix.
1479e45ace2bSmrg
1480e45ace2bSmrg_PKG_TEXT])[]dnl
1481e45ace2bSmrg        ])
1482e45ace2bSmrgelif test $pkg_failed = untried; then
1483e45ace2bSmrg     	AC_MSG_RESULT([no])
1484e45ace2bSmrg	m4_default([$4], [AC_MSG_FAILURE(
1485e45ace2bSmrg[The pkg-config script could not be found or is too old.  Make sure it
1486e45ace2bSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
1487e45ace2bSmrgpath to pkg-config.
1488e45ace2bSmrg
1489e45ace2bSmrg_PKG_TEXT
1490e45ace2bSmrg
1491e45ace2bSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1492e45ace2bSmrg        ])
149375ebec6dSmrgelse
1494e45ace2bSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1495e45ace2bSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1496e45ace2bSmrg        AC_MSG_RESULT([yes])
1497e45ace2bSmrg	$3
1498e45ace2bSmrgfi[]dnl
1499e45ace2bSmrg])dnl PKG_CHECK_MODULES
150075ebec6dSmrg
150175ebec6dSmrg
1502e45ace2bSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1503e45ace2bSmrgdnl   [ACTION-IF-NOT-FOUND])
1504e45ace2bSmrgdnl ---------------------------------------------------------------------
1505e45ace2bSmrgdnl Since: 0.29
1506e45ace2bSmrgdnl
1507e45ace2bSmrgdnl Checks for existence of MODULES and gathers its build flags with
1508e45ace2bSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1509e45ace2bSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1510e45ace2bSmrgdnl
1511e45ace2bSmrgdnl Note that if there is a possibility the first call to
1512e45ace2bSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1513e45ace2bSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1514e45ace2bSmrgdnl configure.ac.
1515e45ace2bSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1516e45ace2bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1517e45ace2bSmrg_save_PKG_CONFIG=$PKG_CONFIG
1518e45ace2bSmrgPKG_CONFIG="$PKG_CONFIG --static"
1519e45ace2bSmrgPKG_CHECK_MODULES($@)
1520e45ace2bSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1521e45ace2bSmrg])dnl PKG_CHECK_MODULES_STATIC
1522e45ace2bSmrg
1523e45ace2bSmrg
1524e45ace2bSmrgdnl PKG_INSTALLDIR([DIRECTORY])
1525e45ace2bSmrgdnl -------------------------
1526e45ace2bSmrgdnl Since: 0.27
1527e45ace2bSmrgdnl
1528e45ace2bSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
1529e45ace2bSmrgdnl should install pkg-config .pc files. By default the directory is
1530e45ace2bSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
1531e45ace2bSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1532e45ace2bSmrgdnl parameter.
1533e45ace2bSmrgAC_DEFUN([PKG_INSTALLDIR],
1534e45ace2bSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1535e45ace2bSmrgm4_pushdef([pkg_description],
1536e45ace2bSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1537e45ace2bSmrgAC_ARG_WITH([pkgconfigdir],
1538e45ace2bSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1539e45ace2bSmrg    [with_pkgconfigdir=]pkg_default)
1540e45ace2bSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1541e45ace2bSmrgm4_popdef([pkg_default])
1542e45ace2bSmrgm4_popdef([pkg_description])
1543e45ace2bSmrg])dnl PKG_INSTALLDIR
154475ebec6dSmrg
154575ebec6dSmrg
1546e45ace2bSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1547e45ace2bSmrgdnl --------------------------------
1548e45ace2bSmrgdnl Since: 0.27
1549e45ace2bSmrgdnl
1550e45ace2bSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1551e45ace2bSmrgdnl module should install arch-independent pkg-config .pc files. By
1552e45ace2bSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
1553e45ace2bSmrgdnl changed by passing DIRECTORY. The user can override through the
1554e45ace2bSmrgdnl --with-noarch-pkgconfigdir parameter.
1555e45ace2bSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1556e45ace2bSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1557e45ace2bSmrgm4_pushdef([pkg_description],
1558e45ace2bSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1559e45ace2bSmrgAC_ARG_WITH([noarch-pkgconfigdir],
1560e45ace2bSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1561e45ace2bSmrg    [with_noarch_pkgconfigdir=]pkg_default)
1562e45ace2bSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1563e45ace2bSmrgm4_popdef([pkg_default])
1564e45ace2bSmrgm4_popdef([pkg_description])
1565e45ace2bSmrg])dnl PKG_NOARCH_INSTALLDIR
15663d2ed3e3Smrg
1567fe567363Smrg
1568e45ace2bSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1569e45ace2bSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1570e45ace2bSmrgdnl -------------------------------------------
1571e45ace2bSmrgdnl Since: 0.28
1572e45ace2bSmrgdnl
1573e45ace2bSmrgdnl Retrieves the value of the pkg-config variable for the given module.
1574e45ace2bSmrgAC_DEFUN([PKG_CHECK_VAR],
1575e45ace2bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1576e45ace2bSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
157775ebec6dSmrg
1578e45ace2bSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1579e45ace2bSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
158075ebec6dSmrg
1581e45ace2bSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1582e45ace2bSmrg])dnl PKG_CHECK_VAR
158375ebec6dSmrg
1584e45ace2bSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1585e45ace2bSmrgdnl
1586e45ace2bSmrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
1587e45ace2bSmrgdnl
1588e45ace2bSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1589e45ace2bSmrgdnl copy of this software and associated documentation files (the "Software"),
1590e45ace2bSmrgdnl to deal in the Software without restriction, including without limitation
1591e45ace2bSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1592e45ace2bSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1593e45ace2bSmrgdnl Software is furnished to do so, subject to the following conditions:
1594e45ace2bSmrgdnl
1595e45ace2bSmrgdnl The above copyright notice and this permission notice (including the next
1596e45ace2bSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1597e45ace2bSmrgdnl Software.
1598e45ace2bSmrgdnl
1599e45ace2bSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1600e45ace2bSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1601e45ace2bSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1602e45ace2bSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1603e45ace2bSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1604e45ace2bSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1605e45ace2bSmrgdnl DEALINGS IN THE SOFTWARE.
1606e45ace2bSmrg
1607e45ace2bSmrg# XORG_MACROS_VERSION(required-version)
1608e45ace2bSmrg# -------------------------------------
16093d2ed3e3Smrg# Minimum version: 1.1.0
1610fe567363Smrg#
1611e45ace2bSmrg# If you're using a macro added in Version 1.1 or newer, include this in
1612e45ace2bSmrg# your configure.ac with the minimum required version, such as:
1613e45ace2bSmrg# XORG_MACROS_VERSION(1.1)
16143d2ed3e3Smrg#
1615e45ace2bSmrg# To ensure that this macro is defined, also add:
1616e45ace2bSmrg# m4_ifndef([XORG_MACROS_VERSION],
1617e45ace2bSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
16183d2ed3e3Smrg#
1619e45ace2bSmrg#
1620e45ace2bSmrg# See the "minimum version" comment for each macro you use to see what
1621e45ace2bSmrg# version you require.
1622e45ace2bSmrgm4_defun([XORG_MACROS_VERSION],[
1623a1910677Smrgm4_define([vers_have], [1.20.2])
1624e45ace2bSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1625e45ace2bSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1626e45ace2bSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1627e45ace2bSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1628e45ace2bSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1629e45ace2bSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1630e45ace2bSmrgm4_undefine([vers_have])
1631e45ace2bSmrgm4_undefine([maj_have])
1632e45ace2bSmrgm4_undefine([maj_needed])
1633e45ace2bSmrg]) # XORG_MACROS_VERSION
163475ebec6dSmrg
1635e45ace2bSmrg# XORG_PROG_RAWCPP()
1636e45ace2bSmrg# ------------------
1637e45ace2bSmrg# Minimum version: 1.0.0
1638e45ace2bSmrg#
1639e45ace2bSmrg# Find cpp program and necessary flags for use in pre-processing text files
1640e45ace2bSmrg# such as man pages and config files
1641e45ace2bSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1642e45ace2bSmrgAC_REQUIRE([AC_PROG_CPP])
1643e45ace2bSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1644e45ace2bSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
164575ebec6dSmrg
1646e45ace2bSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1647e45ace2bSmrg# which is not the best choice for supporting other OS'es, but covers most
1648e45ace2bSmrg# of the ones we need for now.
1649e45ace2bSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1650e45ace2bSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1651e45ace2bSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1652e45ace2bSmrg	AC_MSG_RESULT([no])
1653e45ace2bSmrgelse
1654e45ace2bSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1655e45ace2bSmrg		RAWCPPFLAGS=-undef
1656e45ace2bSmrg		AC_MSG_RESULT([yes])
1657e45ace2bSmrg	# under Cygwin unix is still defined even with -undef
1658e45ace2bSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1659e45ace2bSmrg		RAWCPPFLAGS="-undef -ansi"
1660e45ace2bSmrg		AC_MSG_RESULT([yes, with -ansi])
1661e45ace2bSmrg	else
1662e45ace2bSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1663e45ace2bSmrg	fi
16648a0d9095Smrgfi
1665e45ace2bSmrgrm -f conftest.$ac_ext
166675ebec6dSmrg
1667e45ace2bSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1668e45ace2bSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
166947a4502cSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1670e45ace2bSmrg	AC_MSG_RESULT([no])
1671e45ace2bSmrgelse
167247a4502cSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1673e45ace2bSmrg		TRADITIONALCPPFLAGS="-traditional"
1674e45ace2bSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1675e45ace2bSmrg		AC_MSG_RESULT([yes])
1676e45ace2bSmrg	else
1677e45ace2bSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1678e45ace2bSmrg	fi
1679e45ace2bSmrgfi
1680e45ace2bSmrgrm -f conftest.$ac_ext
1681e45ace2bSmrgAC_SUBST(RAWCPPFLAGS)
1682e45ace2bSmrgAC_SUBST(TRADITIONALCPPFLAGS)
1683e45ace2bSmrg]) # XORG_PROG_RAWCPP
16843d2ed3e3Smrg
1685e45ace2bSmrg# XORG_MANPAGE_SECTIONS()
1686e45ace2bSmrg# -----------------------
1687e45ace2bSmrg# Minimum version: 1.0.0
16888a0d9095Smrg#
1689e45ace2bSmrg# Determine which sections man pages go in for the different man page types
1690e45ace2bSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1691e45ace2bSmrg# Not sure if there's any better way than just hardcoding by OS name.
1692e45ace2bSmrg# Override default settings by setting environment variables
1693e45ace2bSmrg# Added MAN_SUBSTS in version 1.8
1694e45ace2bSmrg# Added AC_PROG_SED in version 1.8
16953d2ed3e3Smrg
1696e45ace2bSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1697e45ace2bSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1698e45ace2bSmrgAC_REQUIRE([AC_PROG_SED])
16993d2ed3e3Smrg
1700e45ace2bSmrgcase $host_os in
1701e45ace2bSmrg    solaris*)
1702e45ace2bSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1703e45ace2bSmrg        # check for a man page file found in later versions that use
1704e45ace2bSmrg        # traditional section numbers instead
1705e45ace2bSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1706e45ace2bSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1707e45ace2bSmrg        ;;
1708e45ace2bSmrg    *) SYSV_MAN_SECTIONS=false ;;
1709e45ace2bSmrgesac
17103d2ed3e3Smrg
1711e45ace2bSmrgif test x$APP_MAN_SUFFIX = x    ; then
1712e45ace2bSmrg    APP_MAN_SUFFIX=1
1713e45ace2bSmrgfi
1714e45ace2bSmrgif test x$APP_MAN_DIR = x    ; then
1715e45ace2bSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
17168a0d9095Smrgfi
171775ebec6dSmrg
1718e45ace2bSmrgif test x$LIB_MAN_SUFFIX = x    ; then
1719e45ace2bSmrg    LIB_MAN_SUFFIX=3
1720e45ace2bSmrgfi
1721e45ace2bSmrgif test x$LIB_MAN_DIR = x    ; then
1722e45ace2bSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
17233d2ed3e3Smrgfi
172475ebec6dSmrg
1725e45ace2bSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1726e45ace2bSmrg    case $SYSV_MAN_SECTIONS in
1727e45ace2bSmrg	true)				FILE_MAN_SUFFIX=4  ;;
1728e45ace2bSmrg	*)				FILE_MAN_SUFFIX=5  ;;
1729e45ace2bSmrg    esac
1730e45ace2bSmrgfi
1731e45ace2bSmrgif test x$FILE_MAN_DIR = x    ; then
1732e45ace2bSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1733e45ace2bSmrgfi
173475ebec6dSmrg
1735e45ace2bSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1736e45ace2bSmrg    case $SYSV_MAN_SECTIONS in
1737e45ace2bSmrg	true)				MISC_MAN_SUFFIX=5  ;;
1738e45ace2bSmrg	*)				MISC_MAN_SUFFIX=7  ;;
1739e45ace2bSmrg    esac
1740e45ace2bSmrgfi
1741e45ace2bSmrgif test x$MISC_MAN_DIR = x    ; then
1742e45ace2bSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1743e45ace2bSmrgfi
17443d2ed3e3Smrg
1745e45ace2bSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1746e45ace2bSmrg    case $SYSV_MAN_SECTIONS in
1747e45ace2bSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1748e45ace2bSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1749e45ace2bSmrg    esac
1750e45ace2bSmrgfi
1751e45ace2bSmrgif test x$DRIVER_MAN_DIR = x    ; then
1752e45ace2bSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1753e45ace2bSmrgfi
17543d2ed3e3Smrg
1755e45ace2bSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1756e45ace2bSmrg    case $SYSV_MAN_SECTIONS in
1757e45ace2bSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1758e45ace2bSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
1759e45ace2bSmrg    esac
1760e45ace2bSmrgfi
1761e45ace2bSmrgif test x$ADMIN_MAN_DIR = x    ; then
1762e45ace2bSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1763e45ace2bSmrgfi
17643d2ed3e3Smrg
17653d2ed3e3Smrg
1766e45ace2bSmrgAC_SUBST([APP_MAN_SUFFIX])
1767e45ace2bSmrgAC_SUBST([LIB_MAN_SUFFIX])
1768e45ace2bSmrgAC_SUBST([FILE_MAN_SUFFIX])
1769e45ace2bSmrgAC_SUBST([MISC_MAN_SUFFIX])
1770e45ace2bSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1771e45ace2bSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1772e45ace2bSmrgAC_SUBST([APP_MAN_DIR])
1773e45ace2bSmrgAC_SUBST([LIB_MAN_DIR])
1774e45ace2bSmrgAC_SUBST([FILE_MAN_DIR])
1775e45ace2bSmrgAC_SUBST([MISC_MAN_DIR])
1776e45ace2bSmrgAC_SUBST([DRIVER_MAN_DIR])
1777e45ace2bSmrgAC_SUBST([ADMIN_MAN_DIR])
17783d2ed3e3Smrg
1779e45ace2bSmrgXORG_MAN_PAGE="X Version 11"
1780e45ace2bSmrgAC_SUBST([XORG_MAN_PAGE])
1781e45ace2bSmrgMAN_SUBSTS="\
1782e45ace2bSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1783e45ace2bSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1784e45ace2bSmrg	-e 's|__xservername__|Xorg|g' \
1785e45ace2bSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
1786e45ace2bSmrg	-e 's|__projectroot__|\$(prefix)|g' \
1787e45ace2bSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1788e45ace2bSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1789e45ace2bSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1790e45ace2bSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1791e45ace2bSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1792e45ace2bSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1793e45ace2bSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1794e45ace2bSmrgAC_SUBST([MAN_SUBSTS])
1795fe567363Smrg
1796e45ace2bSmrg]) # XORG_MANPAGE_SECTIONS
17973d2ed3e3Smrg
1798e45ace2bSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1799e45ace2bSmrg# ------------------------
1800e45ace2bSmrg# Minimum version: 1.7.0
1801e45ace2bSmrg#
1802e45ace2bSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1803e45ace2bSmrg# provided by xorg-sgml-doctools, if installed.
1804e45ace2bSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1805e45ace2bSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1806e45ace2bSmrgXORG_SGML_PATH=
1807e45ace2bSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1808e45ace2bSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1809e45ace2bSmrg    [m4_ifval([$1],[:],
1810e45ace2bSmrg        [if test x"$cross_compiling" != x"yes" ; then
1811e45ace2bSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1812e45ace2bSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1813e45ace2bSmrg         fi])
1814e45ace2bSmrg    ])
1815e45ace2bSmrg
1816e45ace2bSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1817e45ace2bSmrg# the path and the name of the doc stylesheet
1818e45ace2bSmrgif test "x$XORG_SGML_PATH" != "x" ; then
1819e45ace2bSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1820e45ace2bSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1821e45ace2bSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
182275ebec6dSmrgelse
1823e45ace2bSmrg   AC_MSG_RESULT([no])
1824fe567363Smrgfi
1825fe567363Smrg
1826e45ace2bSmrgAC_SUBST(XORG_SGML_PATH)
1827e45ace2bSmrgAC_SUBST(STYLESHEET_SRCDIR)
1828e45ace2bSmrgAC_SUBST(XSL_STYLESHEET)
1829e45ace2bSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1830e45ace2bSmrg]) # XORG_CHECK_SGML_DOCTOOLS
18313d2ed3e3Smrg
1832e45ace2bSmrg# XORG_CHECK_LINUXDOC
1833e45ace2bSmrg# -------------------
1834e45ace2bSmrg# Minimum version: 1.0.0
1835e45ace2bSmrg#
1836e45ace2bSmrg# Defines the variable MAKE_TEXT if the necessary tools and
1837e45ace2bSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1838e45ace2bSmrg# Whether or not the necessary tools and files are found can be checked
1839e45ace2bSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1840e45ace2bSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1841e45ace2bSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1842e45ace2bSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
18433d2ed3e3Smrg
1844e45ace2bSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
18453d2ed3e3Smrg
1846e45ace2bSmrgAC_MSG_CHECKING([whether to build documentation])
18473d2ed3e3Smrg
1848e45ace2bSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1849e45ace2bSmrg   BUILDDOC=yes
1850e45ace2bSmrgelse
1851e45ace2bSmrg   BUILDDOC=no
18523d2ed3e3Smrgfi
18533d2ed3e3Smrg
1854e45ace2bSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
18553d2ed3e3Smrg
1856e45ace2bSmrgAC_MSG_RESULT([$BUILDDOC])
18573d2ed3e3Smrg
1858e45ace2bSmrgAC_MSG_CHECKING([whether to build pdf documentation])
1859e45ace2bSmrg
1860e45ace2bSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1861e45ace2bSmrg   BUILDPDFDOC=yes
1862e45ace2bSmrgelse
1863e45ace2bSmrg   BUILDPDFDOC=no
1864e45ace2bSmrgfi
1865e45ace2bSmrg
1866e45ace2bSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1867e45ace2bSmrg
1868e45ace2bSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1869e45ace2bSmrg
1870e45ace2bSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1871e45ace2bSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1872e45ace2bSmrgMAKE_PDF="$PS2PDF"
1873e45ace2bSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1874e45ace2bSmrg
1875e45ace2bSmrgAC_SUBST(MAKE_TEXT)
1876e45ace2bSmrgAC_SUBST(MAKE_PS)
1877e45ace2bSmrgAC_SUBST(MAKE_PDF)
1878e45ace2bSmrgAC_SUBST(MAKE_HTML)
1879e45ace2bSmrg]) # XORG_CHECK_LINUXDOC
1880e45ace2bSmrg
1881e45ace2bSmrg# XORG_CHECK_DOCBOOK
1882e45ace2bSmrg# -------------------
1883e45ace2bSmrg# Minimum version: 1.0.0
18848a0d9095Smrg#
1885e45ace2bSmrg# Checks for the ability to build output formats from SGML DocBook source.
1886e45ace2bSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1887e45ace2bSmrg# indicates whether the necessary tools and files are found and, if set,
1888e45ace2bSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1889e45ace2bSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1890e45ace2bSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
189175ebec6dSmrg
1892e45ace2bSmrgBUILDTXTDOC=no
1893e45ace2bSmrgBUILDPDFDOC=no
1894e45ace2bSmrgBUILDPSDOC=no
1895e45ace2bSmrgBUILDHTMLDOC=no
1896fe567363Smrg
1897e45ace2bSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1898e45ace2bSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1899e45ace2bSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1900e45ace2bSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1901fe567363Smrg
1902e45ace2bSmrgAC_MSG_CHECKING([whether to build text documentation])
1903e45ace2bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1904e45ace2bSmrg   test x$BUILD_TXTDOC != xno; then
1905e45ace2bSmrg	BUILDTXTDOC=yes
1906e45ace2bSmrgfi
1907e45ace2bSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1908e45ace2bSmrgAC_MSG_RESULT([$BUILDTXTDOC])
19093d2ed3e3Smrg
1910e45ace2bSmrgAC_MSG_CHECKING([whether to build PDF documentation])
1911e45ace2bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1912e45ace2bSmrg   test x$BUILD_PDFDOC != xno; then
1913e45ace2bSmrg	BUILDPDFDOC=yes
1914e45ace2bSmrgfi
1915e45ace2bSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1916e45ace2bSmrgAC_MSG_RESULT([$BUILDPDFDOC])
19173d2ed3e3Smrg
1918e45ace2bSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1919e45ace2bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1920e45ace2bSmrg   test x$BUILD_PSDOC != xno; then
1921e45ace2bSmrg	BUILDPSDOC=yes
19223d2ed3e3Smrgfi
1923e45ace2bSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1924e45ace2bSmrgAC_MSG_RESULT([$BUILDPSDOC])
19253d2ed3e3Smrg
1926e45ace2bSmrgAC_MSG_CHECKING([whether to build HTML documentation])
1927e45ace2bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1928e45ace2bSmrg   test x$BUILD_HTMLDOC != xno; then
1929e45ace2bSmrg	BUILDHTMLDOC=yes
1930e45ace2bSmrgfi
1931e45ace2bSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1932e45ace2bSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
19333d2ed3e3Smrg
1934e45ace2bSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1935e45ace2bSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1936e45ace2bSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1937e45ace2bSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1938e45ace2bSmrg
1939e45ace2bSmrgAC_SUBST(MAKE_TEXT)
1940e45ace2bSmrgAC_SUBST(MAKE_PS)
1941e45ace2bSmrgAC_SUBST(MAKE_PDF)
1942e45ace2bSmrgAC_SUBST(MAKE_HTML)
1943e45ace2bSmrg]) # XORG_CHECK_DOCBOOK
1944e45ace2bSmrg
1945e45ace2bSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
19463d2ed3e3Smrg# ----------------
1947e45ace2bSmrg# Minimum version: 1.5.0
1948e45ace2bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1949fe567363Smrg#
1950e45ace2bSmrg# Documentation tools are not always available on all platforms and sometimes
1951e45ace2bSmrg# not at the appropriate level. This macro enables a module to test for the
1952e45ace2bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1953e45ace2bSmrg# the --with-xmlto option, it allows maximum flexibility in making decisions
1954e45ace2bSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1955e45ace2bSmrg# --with-xmlto assumes 'auto'.
1956fe567363Smrg#
1957e45ace2bSmrg# Interface to module:
1958e45ace2bSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1959e45ace2bSmrg# XMLTO:	returns the path of the xmlto program found
1960e45ace2bSmrg#		returns the path set by the user in the environment
1961e45ace2bSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1962e45ace2bSmrg#		'no' user instructs the module not to use xmlto
1963e45ace2bSmrg#
1964e45ace2bSmrg# Added in version 1.10.0
1965e45ace2bSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1966e45ace2bSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1967e45ace2bSmrg#
1968e45ace2bSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1969e45ace2bSmrg#
1970e45ace2bSmrgAC_DEFUN([XORG_WITH_XMLTO],[
1971e45ace2bSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1972e45ace2bSmrgm4_define([_defopt], m4_default([$2], [auto]))
1973e45ace2bSmrgAC_ARG_WITH(xmlto,
1974e45ace2bSmrg	AS_HELP_STRING([--with-xmlto],
1975e45ace2bSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1976e45ace2bSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1977e45ace2bSmrgm4_undefine([_defopt])
197875ebec6dSmrg
1979e45ace2bSmrgif test "x$use_xmlto" = x"auto"; then
1980e45ace2bSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1981e45ace2bSmrg   if test "x$XMLTO" = "x"; then
1982e45ace2bSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1983e45ace2bSmrg	have_xmlto=no
1984e45ace2bSmrg   else
1985e45ace2bSmrg        have_xmlto=yes
1986e45ace2bSmrg   fi
1987e45ace2bSmrgelif test "x$use_xmlto" = x"yes" ; then
1988e45ace2bSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1989e45ace2bSmrg   if test "x$XMLTO" = "x"; then
1990e45ace2bSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1991e45ace2bSmrg   fi
1992e45ace2bSmrg   have_xmlto=yes
1993e45ace2bSmrgelif test "x$use_xmlto" = x"no" ; then
1994e45ace2bSmrg   if test "x$XMLTO" != "x"; then
1995e45ace2bSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1996e45ace2bSmrg   fi
1997e45ace2bSmrg   have_xmlto=no
1998e45ace2bSmrgelse
1999e45ace2bSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
2000e45ace2bSmrgfi
2001e45ace2bSmrg
2002e45ace2bSmrg# Test for a minimum version of xmlto, if provided.
2003e45ace2bSmrgm4_ifval([$1],
2004e45ace2bSmrg[if test "$have_xmlto" = yes; then
2005e45ace2bSmrg    # scrape the xmlto version
2006e45ace2bSmrg    AC_MSG_CHECKING([the xmlto version])
2007e45ace2bSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
2008e45ace2bSmrg    AC_MSG_RESULT([$xmlto_version])
2009e45ace2bSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
2010e45ace2bSmrg        [if test "x$use_xmlto" = xauto; then
2011e45ace2bSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
2012e45ace2bSmrg            have_xmlto=no
2013e45ace2bSmrg        else
2014e45ace2bSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
2015e45ace2bSmrg        fi])
2016e45ace2bSmrgfi])
2017fe567363Smrg
2018e45ace2bSmrg# Test for the ability of xmlto to generate a text target
2019e45ace2bSmrg#
2020e45ace2bSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
2021e45ace2bSmrg# following test for empty XML docbook files.
2022e45ace2bSmrg# For compatibility reasons use the following empty XML docbook file and if
2023e45ace2bSmrg# it fails try it again with a non-empty XML file.
2024e45ace2bSmrghave_xmlto_text=no
2025e45ace2bSmrgcat > conftest.xml << "EOF"
2026e45ace2bSmrgEOF
2027e45ace2bSmrgAS_IF([test "$have_xmlto" = yes],
2028e45ace2bSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2029e45ace2bSmrg             [have_xmlto_text=yes],
2030e45ace2bSmrg             [# Try it again with a non-empty XML file.
2031e45ace2bSmrg              cat > conftest.xml << "EOF"
2032e45ace2bSmrg<x></x>
2033e45ace2bSmrgEOF
2034e45ace2bSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2035e45ace2bSmrg                    [have_xmlto_text=yes],
2036e45ace2bSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
2037e45ace2bSmrgrm -f conftest.xml
2038e45ace2bSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
2039e45ace2bSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
2040e45ace2bSmrg]) # XORG_WITH_XMLTO
20413d2ed3e3Smrg
2042e45ace2bSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
2043e45ace2bSmrg# --------------------------------------------
2044e45ace2bSmrg# Minimum version: 1.12.0
2045e45ace2bSmrg# Minimum version for optional DEFAULT argument: 1.12.0
2046fe567363Smrg#
2047e45ace2bSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
2048e45ace2bSmrg# XML-based language used for the transformation of XML documents.
2049e45ace2bSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
2050e45ace2bSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
2051e45ace2bSmrg# The XSLT processor is often used as a standalone tool for transformations.
2052e45ace2bSmrg# It should not be assumed that this tool is used only to work with documnetation.
2053e45ace2bSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
2054fe567363Smrg#
2055e45ace2bSmrg# Interface to module:
2056e45ace2bSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
2057e45ace2bSmrg# XSLTPROC:	 returns the path of the xsltproc program found
2058e45ace2bSmrg#		 returns the path set by the user in the environment
2059e45ace2bSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
2060e45ace2bSmrg#		  'no' user instructs the module not to use xsltproc
2061e45ace2bSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
2062fe567363Smrg#
2063e45ace2bSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
2064fe567363Smrg#
2065e45ace2bSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
2066e45ace2bSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
2067e45ace2bSmrg# Preserves the interface, should it be implemented later
2068e45ace2bSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
2069e45ace2bSmrgm4_define([_defopt], m4_default([$2], [auto]))
2070e45ace2bSmrgAC_ARG_WITH(xsltproc,
2071e45ace2bSmrg	AS_HELP_STRING([--with-xsltproc],
2072e45ace2bSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
2073e45ace2bSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
2074e45ace2bSmrgm4_undefine([_defopt])
20758a0d9095Smrg
2076e45ace2bSmrgif test "x$use_xsltproc" = x"auto"; then
2077e45ace2bSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
2078e45ace2bSmrg   if test "x$XSLTPROC" = "x"; then
2079e45ace2bSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
2080e45ace2bSmrg	have_xsltproc=no
2081e45ace2bSmrg   else
2082e45ace2bSmrg        have_xsltproc=yes
2083e45ace2bSmrg   fi
2084e45ace2bSmrgelif test "x$use_xsltproc" = x"yes" ; then
2085e45ace2bSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
2086e45ace2bSmrg   if test "x$XSLTPROC" = "x"; then
2087e45ace2bSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
2088e45ace2bSmrg   fi
2089e45ace2bSmrg   have_xsltproc=yes
2090e45ace2bSmrgelif test "x$use_xsltproc" = x"no" ; then
2091e45ace2bSmrg   if test "x$XSLTPROC" != "x"; then
2092e45ace2bSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
2093e45ace2bSmrg   fi
2094e45ace2bSmrg   have_xsltproc=no
2095e45ace2bSmrgelse
2096e45ace2bSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
2097e45ace2bSmrgfi
20983d2ed3e3Smrg
2099e45ace2bSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
2100e45ace2bSmrg]) # XORG_WITH_XSLTPROC
21013d2ed3e3Smrg
2102e45ace2bSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
2103e45ace2bSmrg# ----------------------------------------
2104e45ace2bSmrg# Minimum version: 1.15.0
210575ebec6dSmrg#
2106e45ace2bSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
2107e45ace2bSmrg# scanning arbitrary text files, extracting information from those text files,
2108e45ace2bSmrg# and printing reports based on that information.
210975ebec6dSmrg#
2110e45ace2bSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
211175ebec6dSmrg#
2112e45ace2bSmrg# Interface to module:
2113e45ace2bSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
2114e45ace2bSmrg# PERL:	     returns the path of the perl program found
2115e45ace2bSmrg#	     returns the path set by the user in the environment
2116e45ace2bSmrg# --with-perl: 'yes' user instructs the module to use perl
2117e45ace2bSmrg#	       'no' user instructs the module not to use perl
2118e45ace2bSmrg# have_perl: returns yes if perl found in PATH or no
21198a0d9095Smrg#
2120e45ace2bSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
21218a0d9095Smrg#
2122e45ace2bSmrgAC_DEFUN([XORG_WITH_PERL],[
2123e45ace2bSmrgAC_ARG_VAR([PERL], [Path to perl command])
2124e45ace2bSmrg# Preserves the interface, should it be implemented later
2125e45ace2bSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
2126e45ace2bSmrgm4_define([_defopt], m4_default([$2], [auto]))
2127e45ace2bSmrgAC_ARG_WITH(perl,
2128e45ace2bSmrg	AS_HELP_STRING([--with-perl],
2129e45ace2bSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
2130e45ace2bSmrg	   [use_perl=$withval], [use_perl=]_defopt)
2131e45ace2bSmrgm4_undefine([_defopt])
21323d2ed3e3Smrg
2133e45ace2bSmrgif test "x$use_perl" = x"auto"; then
2134e45ace2bSmrg   AC_PATH_PROG([PERL], [perl])
2135e45ace2bSmrg   if test "x$PERL" = "x"; then
2136e45ace2bSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
2137e45ace2bSmrg	have_perl=no
2138e45ace2bSmrg   else
2139e45ace2bSmrg        have_perl=yes
2140e45ace2bSmrg   fi
2141e45ace2bSmrgelif test "x$use_perl" = x"yes" ; then
2142e45ace2bSmrg   AC_PATH_PROG([PERL], [perl])
2143e45ace2bSmrg   if test "x$PERL" = "x"; then
2144e45ace2bSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
2145e45ace2bSmrg   fi
2146e45ace2bSmrg   have_perl=yes
2147e45ace2bSmrgelif test "x$use_perl" = x"no" ; then
2148e45ace2bSmrg   if test "x$PERL" != "x"; then
2149e45ace2bSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
2150e45ace2bSmrg   fi
2151e45ace2bSmrg   have_perl=no
2152e45ace2bSmrgelse
2153e45ace2bSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
2154e45ace2bSmrgfi
21553d2ed3e3Smrg
2156e45ace2bSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2157e45ace2bSmrg]) # XORG_WITH_PERL
21583d2ed3e3Smrg
2159e45ace2bSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2160e45ace2bSmrg# ----------------
2161e45ace2bSmrg# Minimum version: 1.5.0
2162e45ace2bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2163e45ace2bSmrg#
2164e45ace2bSmrg# Documentation tools are not always available on all platforms and sometimes
2165e45ace2bSmrg# not at the appropriate level. This macro enables a module to test for the
2166e45ace2bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2167e45ace2bSmrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
2168e45ace2bSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2169e45ace2bSmrg# --with-asciidoc assumes 'auto'.
2170e45ace2bSmrg#
2171e45ace2bSmrg# Interface to module:
2172e45ace2bSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2173e45ace2bSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
2174e45ace2bSmrg#		 returns the path set by the user in the environment
2175e45ace2bSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2176e45ace2bSmrg#		  'no' user instructs the module not to use asciidoc
21778a0d9095Smrg#
2178e45ace2bSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2179e45ace2bSmrg#
2180e45ace2bSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2181e45ace2bSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2182e45ace2bSmrgm4_define([_defopt], m4_default([$2], [auto]))
2183e45ace2bSmrgAC_ARG_WITH(asciidoc,
2184e45ace2bSmrg	AS_HELP_STRING([--with-asciidoc],
2185e45ace2bSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2186e45ace2bSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2187e45ace2bSmrgm4_undefine([_defopt])
2188fe567363Smrg
2189e45ace2bSmrgif test "x$use_asciidoc" = x"auto"; then
2190e45ace2bSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2191e45ace2bSmrg   if test "x$ASCIIDOC" = "x"; then
2192e45ace2bSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2193e45ace2bSmrg	have_asciidoc=no
2194e45ace2bSmrg   else
2195e45ace2bSmrg        have_asciidoc=yes
2196e45ace2bSmrg   fi
2197e45ace2bSmrgelif test "x$use_asciidoc" = x"yes" ; then
2198e45ace2bSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2199e45ace2bSmrg   if test "x$ASCIIDOC" = "x"; then
2200e45ace2bSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2201e45ace2bSmrg   fi
2202e45ace2bSmrg   have_asciidoc=yes
2203e45ace2bSmrgelif test "x$use_asciidoc" = x"no" ; then
2204e45ace2bSmrg   if test "x$ASCIIDOC" != "x"; then
2205e45ace2bSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2206e45ace2bSmrg   fi
2207e45ace2bSmrg   have_asciidoc=no
22088a0d9095Smrgelse
2209e45ace2bSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
22108a0d9095Smrgfi
2211e45ace2bSmrgm4_ifval([$1],
2212e45ace2bSmrg[if test "$have_asciidoc" = yes; then
2213e45ace2bSmrg    # scrape the asciidoc version
2214e45ace2bSmrg    AC_MSG_CHECKING([the asciidoc version])
2215e45ace2bSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2216e45ace2bSmrg    AC_MSG_RESULT([$asciidoc_version])
2217e45ace2bSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2218e45ace2bSmrg        [if test "x$use_asciidoc" = xauto; then
2219e45ace2bSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2220e45ace2bSmrg            have_asciidoc=no
2221e45ace2bSmrg        else
2222e45ace2bSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2223e45ace2bSmrg        fi])
2224e45ace2bSmrgfi])
2225e45ace2bSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2226e45ace2bSmrg]) # XORG_WITH_ASCIIDOC
22278d4c0f7bSmrg
2228e45ace2bSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
2229e45ace2bSmrg# -------------------------------------------
2230e45ace2bSmrg# Minimum version: 1.5.0
2231e45ace2bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2232e45ace2bSmrg# Minimum version for optional DOT checking: 1.18.0
22333d2ed3e3Smrg#
2234e45ace2bSmrg# Documentation tools are not always available on all platforms and sometimes
2235e45ace2bSmrg# not at the appropriate level. This macro enables a module to test for the
2236e45ace2bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2237e45ace2bSmrg# the --with-doxygen option, it allows maximum flexibility in making decisions
2238e45ace2bSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2239e45ace2bSmrg# --with-doxygen assumes 'auto'.
224075ebec6dSmrg#
2241e45ace2bSmrg# Interface to module:
2242e45ace2bSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2243e45ace2bSmrg# DOXYGEN:	 returns the path of the doxygen program found
2244e45ace2bSmrg#		 returns the path set by the user in the environment
2245e45ace2bSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2246e45ace2bSmrg#		  'no' user instructs the module not to use doxygen
2247e45ace2bSmrg#
2248e45ace2bSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2249e45ace2bSmrg#
2250e45ace2bSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2251e45ace2bSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2252e45ace2bSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
2253e45ace2bSmrgm4_define([_defopt], m4_default([$2], [auto]))
2254e45ace2bSmrgAC_ARG_WITH(doxygen,
2255e45ace2bSmrg	AS_HELP_STRING([--with-doxygen],
2256e45ace2bSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2257e45ace2bSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2258e45ace2bSmrgm4_undefine([_defopt])
22598d4c0f7bSmrg
2260e45ace2bSmrgif test "x$use_doxygen" = x"auto"; then
2261e45ace2bSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2262e45ace2bSmrg   if test "x$DOXYGEN" = "x"; then
2263e45ace2bSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2264e45ace2bSmrg	have_doxygen=no
2265e45ace2bSmrg   else
2266e45ace2bSmrg        have_doxygen=yes
2267e45ace2bSmrg   fi
2268e45ace2bSmrgelif test "x$use_doxygen" = x"yes" ; then
2269e45ace2bSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2270e45ace2bSmrg   if test "x$DOXYGEN" = "x"; then
2271e45ace2bSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2272e45ace2bSmrg   fi
2273e45ace2bSmrg   have_doxygen=yes
2274e45ace2bSmrgelif test "x$use_doxygen" = x"no" ; then
2275e45ace2bSmrg   if test "x$DOXYGEN" != "x"; then
2276e45ace2bSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2277e45ace2bSmrg   fi
2278e45ace2bSmrg   have_doxygen=no
2279e45ace2bSmrgelse
2280e45ace2bSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2281e45ace2bSmrgfi
2282e45ace2bSmrgm4_ifval([$1],
2283e45ace2bSmrg[if test "$have_doxygen" = yes; then
2284e45ace2bSmrg    # scrape the doxygen version
2285e45ace2bSmrg    AC_MSG_CHECKING([the doxygen version])
2286e45ace2bSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2287e45ace2bSmrg    AC_MSG_RESULT([$doxygen_version])
2288e45ace2bSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2289e45ace2bSmrg        [if test "x$use_doxygen" = xauto; then
2290e45ace2bSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2291e45ace2bSmrg            have_doxygen=no
2292e45ace2bSmrg        else
2293e45ace2bSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2294e45ace2bSmrg        fi])
2295e45ace2bSmrgfi])
2296e45ace2bSmrg
2297e45ace2bSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2298e45ace2bSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2299e45ace2bSmrgdnl 	HAVE_DOT = @HAVE_DOT@
2300e45ace2bSmrgHAVE_DOT=no
2301e45ace2bSmrgif test "x$have_doxygen" = "xyes"; then
2302e45ace2bSmrg  AC_PATH_PROG([DOT], [dot])
2303e45ace2bSmrg    if test "x$DOT" != "x"; then
2304e45ace2bSmrg      HAVE_DOT=yes
23053d2ed3e3Smrg    fi
2306e45ace2bSmrgfi
23078d4c0f7bSmrg
2308e45ace2bSmrgAC_SUBST([HAVE_DOT])
2309e45ace2bSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2310e45ace2bSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2311e45ace2bSmrg]) # XORG_WITH_DOXYGEN
2312e45ace2bSmrg
2313e45ace2bSmrg# XORG_WITH_GROFF([DEFAULT])
2314e45ace2bSmrg# ----------------
2315e45ace2bSmrg# Minimum version: 1.6.0
2316e45ace2bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2317e45ace2bSmrg#
2318e45ace2bSmrg# Documentation tools are not always available on all platforms and sometimes
2319e45ace2bSmrg# not at the appropriate level. This macro enables a module to test for the
2320e45ace2bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2321e45ace2bSmrg# the --with-groff option, it allows maximum flexibility in making decisions
2322e45ace2bSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
2323e45ace2bSmrg# --with-groff assumes 'auto'.
2324e45ace2bSmrg#
2325e45ace2bSmrg# Interface to module:
2326e45ace2bSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2327e45ace2bSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2328e45ace2bSmrg# HAVE_GROFF_MS: the -ms macros package
2329e45ace2bSmrg# GROFF:	 returns the path of the groff program found
2330e45ace2bSmrg#		 returns the path set by the user in the environment
2331e45ace2bSmrg# --with-groff:	 'yes' user instructs the module to use groff
2332e45ace2bSmrg#		 'no' user instructs the module not to use groff
2333e45ace2bSmrg#
2334e45ace2bSmrg# Added in version 1.9.0:
2335e45ace2bSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2336e45ace2bSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2337e45ace2bSmrg#		   psselect from the psutils package.
2338e45ace2bSmrg#		   the ghostcript package. Refer to the grohtml man pages
2339e45ace2bSmrg#
2340e45ace2bSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2341e45ace2bSmrg#
2342e45ace2bSmrg# OS and distros often splits groff in a basic and full package, the former
2343e45ace2bSmrg# having the groff program and the later having devices, fonts and macros
2344e45ace2bSmrg# Checking for the groff executable is not enough.
2345e45ace2bSmrg#
2346e45ace2bSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
2347e45ace2bSmrg# unset HAVE_GROFF or GROFF env variables.
2348e45ace2bSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2349e45ace2bSmrg#
2350e45ace2bSmrgAC_DEFUN([XORG_WITH_GROFF],[
2351e45ace2bSmrgAC_ARG_VAR([GROFF], [Path to groff command])
2352e45ace2bSmrgm4_define([_defopt], m4_default([$1], [auto]))
2353e45ace2bSmrgAC_ARG_WITH(groff,
2354e45ace2bSmrg	AS_HELP_STRING([--with-groff],
2355e45ace2bSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2356e45ace2bSmrg	   [use_groff=$withval], [use_groff=]_defopt)
2357e45ace2bSmrgm4_undefine([_defopt])
2358e45ace2bSmrg
2359e45ace2bSmrgif test "x$use_groff" = x"auto"; then
2360e45ace2bSmrg   AC_PATH_PROG([GROFF], [groff])
2361e45ace2bSmrg   if test "x$GROFF" = "x"; then
2362e45ace2bSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2363e45ace2bSmrg	have_groff=no
2364e45ace2bSmrg   else
2365e45ace2bSmrg        have_groff=yes
2366e45ace2bSmrg   fi
2367e45ace2bSmrgelif test "x$use_groff" = x"yes" ; then
2368e45ace2bSmrg   AC_PATH_PROG([GROFF], [groff])
2369e45ace2bSmrg   if test "x$GROFF" = "x"; then
2370e45ace2bSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2371e45ace2bSmrg   fi
2372e45ace2bSmrg   have_groff=yes
2373e45ace2bSmrgelif test "x$use_groff" = x"no" ; then
2374e45ace2bSmrg   if test "x$GROFF" != "x"; then
2375e45ace2bSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2376e45ace2bSmrg   fi
2377e45ace2bSmrg   have_groff=no
23788a0d9095Smrgelse
2379e45ace2bSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
23808a0d9095Smrgfi
238175ebec6dSmrg
2382e45ace2bSmrg# We have groff, test for the presence of the macro packages
2383e45ace2bSmrgif test "x$have_groff" = x"yes"; then
2384e45ace2bSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2385e45ace2bSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2386e45ace2bSmrg        groff_ms_works=yes
2387e45ace2bSmrg    else
2388e45ace2bSmrg        groff_ms_works=no
2389e45ace2bSmrg    fi
2390e45ace2bSmrg    AC_MSG_RESULT([$groff_ms_works])
2391e45ace2bSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2392e45ace2bSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2393e45ace2bSmrg        groff_mm_works=yes
2394e45ace2bSmrg    else
2395e45ace2bSmrg        groff_mm_works=no
2396e45ace2bSmrg    fi
2397e45ace2bSmrg    AC_MSG_RESULT([$groff_mm_works])
2398e45ace2bSmrgfi
2399af928962Smrg
2400e45ace2bSmrg# We have groff, test for HTML dependencies, one command per package
2401e45ace2bSmrgif test "x$have_groff" = x"yes"; then
2402e45ace2bSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2403e45ace2bSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2404e45ace2bSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2405e45ace2bSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2406e45ace2bSmrg      have_groff_html=yes
2407e45ace2bSmrg   else
2408e45ace2bSmrg      have_groff_html=no
2409e45ace2bSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2410e45ace2bSmrg   fi
2411e45ace2bSmrgfi
24123d2ed3e3Smrg
2413e45ace2bSmrg# Set Automake conditionals for Makefiles
2414e45ace2bSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2415e45ace2bSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2416e45ace2bSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2417e45ace2bSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2418e45ace2bSmrg]) # XORG_WITH_GROFF
24193d2ed3e3Smrg
2420e45ace2bSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2421e45ace2bSmrg# ---------------------------------------
2422e45ace2bSmrg# Minimum version: 1.6.0
2423e45ace2bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2424e45ace2bSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2425e45ace2bSmrg#
2426e45ace2bSmrg# Documentation tools are not always available on all platforms and sometimes
2427e45ace2bSmrg# not at the appropriate level. This macro enables a module to test for the
2428e45ace2bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2429e45ace2bSmrg# the --with-fop option, it allows maximum flexibility in making decisions
2430e45ace2bSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
2431e45ace2bSmrg# --with-fop assumes 'auto'.
2432e45ace2bSmrg#
2433e45ace2bSmrg# Interface to module:
2434e45ace2bSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2435e45ace2bSmrg# FOP:	 	returns the path of the fop program found
2436e45ace2bSmrg#		returns the path set by the user in the environment
2437e45ace2bSmrg# --with-fop: 	'yes' user instructs the module to use fop
2438e45ace2bSmrg#		'no' user instructs the module not to use fop
2439e45ace2bSmrg#
2440e45ace2bSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2441e45ace2bSmrg#
2442e45ace2bSmrgAC_DEFUN([XORG_WITH_FOP],[
2443e45ace2bSmrgAC_ARG_VAR([FOP], [Path to fop command])
2444e45ace2bSmrgm4_define([_defopt], m4_default([$2], [auto]))
2445e45ace2bSmrgAC_ARG_WITH(fop,
2446e45ace2bSmrg	AS_HELP_STRING([--with-fop],
2447e45ace2bSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2448e45ace2bSmrg	   [use_fop=$withval], [use_fop=]_defopt)
2449e45ace2bSmrgm4_undefine([_defopt])
2450e45ace2bSmrg
2451e45ace2bSmrgif test "x$use_fop" = x"auto"; then
2452e45ace2bSmrg   AC_PATH_PROG([FOP], [fop])
2453e45ace2bSmrg   if test "x$FOP" = "x"; then
2454e45ace2bSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2455e45ace2bSmrg	have_fop=no
2456e45ace2bSmrg   else
2457e45ace2bSmrg        have_fop=yes
2458e45ace2bSmrg   fi
2459e45ace2bSmrgelif test "x$use_fop" = x"yes" ; then
2460e45ace2bSmrg   AC_PATH_PROG([FOP], [fop])
2461e45ace2bSmrg   if test "x$FOP" = "x"; then
2462e45ace2bSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2463e45ace2bSmrg   fi
2464e45ace2bSmrg   have_fop=yes
2465e45ace2bSmrgelif test "x$use_fop" = x"no" ; then
2466e45ace2bSmrg   if test "x$FOP" != "x"; then
2467e45ace2bSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2468e45ace2bSmrg   fi
2469e45ace2bSmrg   have_fop=no
2470e45ace2bSmrgelse
2471e45ace2bSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
24723d2ed3e3Smrgfi
24733d2ed3e3Smrg
2474e45ace2bSmrg# Test for a minimum version of fop, if provided.
2475e45ace2bSmrgm4_ifval([$1],
2476e45ace2bSmrg[if test "$have_fop" = yes; then
2477e45ace2bSmrg    # scrape the fop version
2478e45ace2bSmrg    AC_MSG_CHECKING([for fop minimum version])
2479e45ace2bSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2480e45ace2bSmrg    AC_MSG_RESULT([$fop_version])
2481e45ace2bSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
2482e45ace2bSmrg        [if test "x$use_fop" = xauto; then
2483e45ace2bSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2484e45ace2bSmrg            have_fop=no
2485e45ace2bSmrg        else
2486e45ace2bSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2487e45ace2bSmrg        fi])
2488e45ace2bSmrgfi])
2489e45ace2bSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2490e45ace2bSmrg]) # XORG_WITH_FOP
2491e45ace2bSmrg
2492e45ace2bSmrg# XORG_WITH_M4([MIN-VERSION])
2493e45ace2bSmrg# ---------------------------
2494e45ace2bSmrg# Minimum version: 1.19.0
2495e45ace2bSmrg#
2496e45ace2bSmrg# This macro attempts to locate an m4 macro processor which supports
2497e45ace2bSmrg# -I option and is only useful for modules relying on M4 in order to
2498e45ace2bSmrg# expand macros in source code files.
2499e45ace2bSmrg#
2500e45ace2bSmrg# Interface to module:
2501e45ace2bSmrg# M4:	 	returns the path of the m4 program found
2502e45ace2bSmrg#		returns the path set by the user in the environment
2503e45ace2bSmrg#
2504e45ace2bSmrgAC_DEFUN([XORG_WITH_M4], [
2505e45ace2bSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2506e45ace2bSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2507e45ace2bSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2508e45ace2bSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2509e45ace2bSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2510e45ace2bSmrg   [$PATH:/usr/gnu/bin])])
2511e45ace2bSmrg
2512e45ace2bSmrgAC_SUBST([M4], [$ac_cv_path_M4])
2513e45ace2bSmrg]) # XORG_WITH_M4
251475ebec6dSmrg
2515e45ace2bSmrg# XORG_WITH_PS2PDF([DEFAULT])
2516e45ace2bSmrg# ----------------
2517e45ace2bSmrg# Minimum version: 1.6.0
2518e45ace2bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
25198a0d9095Smrg#
2520e45ace2bSmrg# Documentation tools are not always available on all platforms and sometimes
2521e45ace2bSmrg# not at the appropriate level. This macro enables a module to test for the
2522e45ace2bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2523e45ace2bSmrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
2524e45ace2bSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2525e45ace2bSmrg# --with-ps2pdf assumes 'auto'.
2526e45ace2bSmrg#
2527e45ace2bSmrg# Interface to module:
2528e45ace2bSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2529e45ace2bSmrg# PS2PDF:	returns the path of the ps2pdf program found
2530e45ace2bSmrg#		returns the path set by the user in the environment
2531e45ace2bSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2532e45ace2bSmrg#		 'no' user instructs the module not to use ps2pdf
2533e45ace2bSmrg#
2534e45ace2bSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2535e45ace2bSmrg#
2536e45ace2bSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2537e45ace2bSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2538e45ace2bSmrgm4_define([_defopt], m4_default([$1], [auto]))
2539e45ace2bSmrgAC_ARG_WITH(ps2pdf,
2540e45ace2bSmrg	AS_HELP_STRING([--with-ps2pdf],
2541e45ace2bSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2542e45ace2bSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2543e45ace2bSmrgm4_undefine([_defopt])
254475ebec6dSmrg
2545e45ace2bSmrgif test "x$use_ps2pdf" = x"auto"; then
2546e45ace2bSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2547e45ace2bSmrg   if test "x$PS2PDF" = "x"; then
2548e45ace2bSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2549e45ace2bSmrg	have_ps2pdf=no
2550e45ace2bSmrg   else
2551e45ace2bSmrg        have_ps2pdf=yes
2552e45ace2bSmrg   fi
2553e45ace2bSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2554e45ace2bSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2555e45ace2bSmrg   if test "x$PS2PDF" = "x"; then
2556e45ace2bSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2557e45ace2bSmrg   fi
2558e45ace2bSmrg   have_ps2pdf=yes
2559e45ace2bSmrgelif test "x$use_ps2pdf" = x"no" ; then
2560e45ace2bSmrg   if test "x$PS2PDF" != "x"; then
2561e45ace2bSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2562e45ace2bSmrg   fi
2563e45ace2bSmrg   have_ps2pdf=no
2564e45ace2bSmrgelse
2565e45ace2bSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2566e45ace2bSmrgfi
2567e45ace2bSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2568e45ace2bSmrg]) # XORG_WITH_PS2PDF
256975ebec6dSmrg
2570e45ace2bSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2571e45ace2bSmrg# ----------------
2572e45ace2bSmrg# Minimum version: 1.6.0
2573e45ace2bSmrg#
2574e45ace2bSmrg# Documentation tools are not always available on all platforms and sometimes
2575e45ace2bSmrg# not at the appropriate level. This macro enables a builder to skip all
2576e45ace2bSmrg# documentation targets except traditional man pages.
2577e45ace2bSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2578e45ace2bSmrg# maximum flexibility in controlling documentation building.
2579e45ace2bSmrg# Refer to:
2580e45ace2bSmrg# XORG_WITH_XMLTO         --with-xmlto
2581e45ace2bSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2582e45ace2bSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2583e45ace2bSmrg# XORG_WITH_FOP           --with-fop
2584e45ace2bSmrg# XORG_WITH_GROFF         --with-groff
2585e45ace2bSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2586e45ace2bSmrg#
2587e45ace2bSmrg# Interface to module:
2588e45ace2bSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2589e45ace2bSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2590e45ace2bSmrg#		 'no' user instructs the module not to generate docs
2591e45ace2bSmrg# parm1:	specify the default value, yes or no.
2592e45ace2bSmrg#
2593e45ace2bSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2594e45ace2bSmrgm4_define([docs_default], m4_default([$1], [yes]))
2595e45ace2bSmrgAC_ARG_ENABLE(docs,
2596e45ace2bSmrg	AS_HELP_STRING([--enable-docs],
2597e45ace2bSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2598e45ace2bSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2599e45ace2bSmrgm4_undefine([docs_default])
2600e45ace2bSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2601e45ace2bSmrgAC_MSG_CHECKING([whether to build documentation])
2602e45ace2bSmrgAC_MSG_RESULT([$build_docs])
2603e45ace2bSmrg]) # XORG_ENABLE_DOCS
2604e45ace2bSmrg
2605e45ace2bSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2606e45ace2bSmrg# ----------------
2607e45ace2bSmrg# Minimum version: 1.6.0
2608e45ace2bSmrg#
2609e45ace2bSmrg# This macro enables a builder to skip all developer documentation.
2610e45ace2bSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2611e45ace2bSmrg# maximum flexibility in controlling documentation building.
2612e45ace2bSmrg# Refer to:
2613e45ace2bSmrg# XORG_WITH_XMLTO         --with-xmlto
2614e45ace2bSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2615e45ace2bSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2616e45ace2bSmrg# XORG_WITH_FOP           --with-fop
2617e45ace2bSmrg# XORG_WITH_GROFF         --with-groff
2618e45ace2bSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2619e45ace2bSmrg#
2620e45ace2bSmrg# Interface to module:
2621e45ace2bSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2622e45ace2bSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2623e45ace2bSmrg#			'no' user instructs the module not to generate developer docs
2624e45ace2bSmrg# parm1:		specify the default value, yes or no.
2625e45ace2bSmrg#
2626e45ace2bSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2627e45ace2bSmrgm4_define([devel_default], m4_default([$1], [yes]))
2628e45ace2bSmrgAC_ARG_ENABLE(devel-docs,
2629e45ace2bSmrg	AS_HELP_STRING([--enable-devel-docs],
2630e45ace2bSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2631e45ace2bSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2632e45ace2bSmrgm4_undefine([devel_default])
2633e45ace2bSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2634e45ace2bSmrgAC_MSG_CHECKING([whether to build developer documentation])
2635e45ace2bSmrgAC_MSG_RESULT([$build_devel_docs])
2636e45ace2bSmrg]) # XORG_ENABLE_DEVEL_DOCS
2637fe567363Smrg
2638e45ace2bSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
2639e45ace2bSmrg# ----------------
2640e45ace2bSmrg# Minimum version: 1.6.0
2641e45ace2bSmrg#
2642e45ace2bSmrg# This macro enables a builder to skip all functional specification targets.
2643e45ace2bSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2644e45ace2bSmrg# maximum flexibility in controlling documentation building.
2645e45ace2bSmrg# Refer to:
2646e45ace2bSmrg# XORG_WITH_XMLTO         --with-xmlto
2647e45ace2bSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2648e45ace2bSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2649e45ace2bSmrg# XORG_WITH_FOP           --with-fop
2650e45ace2bSmrg# XORG_WITH_GROFF         --with-groff
2651e45ace2bSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2652e45ace2bSmrg#
2653e45ace2bSmrg# Interface to module:
2654e45ace2bSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2655e45ace2bSmrg# --enable-specs:	'yes' user instructs the module to generate specs
2656e45ace2bSmrg#			'no' user instructs the module not to generate specs
2657e45ace2bSmrg# parm1:		specify the default value, yes or no.
2658e45ace2bSmrg#
2659e45ace2bSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2660e45ace2bSmrgm4_define([spec_default], m4_default([$1], [yes]))
2661e45ace2bSmrgAC_ARG_ENABLE(specs,
2662e45ace2bSmrg	AS_HELP_STRING([--enable-specs],
2663e45ace2bSmrg	   [Enable building the specs (default: ]spec_default[)]),
2664e45ace2bSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
2665e45ace2bSmrgm4_undefine([spec_default])
2666e45ace2bSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2667e45ace2bSmrgAC_MSG_CHECKING([whether to build functional specifications])
2668e45ace2bSmrgAC_MSG_RESULT([$build_specs])
2669e45ace2bSmrg]) # XORG_ENABLE_SPECS
26703d2ed3e3Smrg
2671e45ace2bSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2672e45ace2bSmrg# ----------------------------------------------
2673e45ace2bSmrg# Minimum version: 1.13.0
26748a0d9095Smrg#
2675e45ace2bSmrg# This macro enables a builder to enable/disable unit testing
2676e45ace2bSmrg# It makes no assumption about the test cases implementation
2677e45ace2bSmrg# Test cases may or may not use Automake "Support for test suites"
2678e45ace2bSmrg# They may or may not use the software utility library GLib
2679e45ace2bSmrg#
2680e45ace2bSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2681e45ace2bSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2682e45ace2bSmrg# The variable enable_unit_tests is used by other macros in this file.
2683e45ace2bSmrg#
2684e45ace2bSmrg# Interface to module:
2685e45ace2bSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2686e45ace2bSmrg# enable_unit_tests:    used in configure.ac for additional configuration
2687e45ace2bSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2688e45ace2bSmrg#			'no' user instructs the module not to build tests
2689e45ace2bSmrg# parm1:		specify the default value, yes or no.
2690e45ace2bSmrg#
2691e45ace2bSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2692e45ace2bSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2693e45ace2bSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2694e45ace2bSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2695e45ace2bSmrgm4_define([_defopt], m4_default([$1], [auto]))
2696e45ace2bSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2697e45ace2bSmrg	[Enable building unit test cases (default: ]_defopt[)]),
2698e45ace2bSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2699e45ace2bSmrgm4_undefine([_defopt])
2700e45ace2bSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2701e45ace2bSmrgAC_MSG_CHECKING([whether to build unit test cases])
2702e45ace2bSmrgAC_MSG_RESULT([$enable_unit_tests])
2703e45ace2bSmrg]) # XORG_ENABLE_UNIT_TESTS
2704fe567363Smrg
2705e45ace2bSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2706e45ace2bSmrg# ------------------------------------------------------
2707e45ace2bSmrg# Minimum version: 1.17.0
2708e45ace2bSmrg#
2709e45ace2bSmrg# This macro enables a builder to enable/disable integration testing
2710e45ace2bSmrg# It makes no assumption about the test cases' implementation
2711e45ace2bSmrg# Test cases may or may not use Automake "Support for test suites"
2712e45ace2bSmrg#
2713e45ace2bSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2714e45ace2bSmrg# usually requires less dependencies and may be built and run under less
2715e45ace2bSmrg# stringent environments than integration tests.
2716e45ace2bSmrg#
2717e45ace2bSmrg# Interface to module:
2718e45ace2bSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2719e45ace2bSmrg# enable_integration_tests:   used in configure.ac for additional configuration
2720e45ace2bSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2721e45ace2bSmrg#                             'no' user instructs the module not to build tests
2722e45ace2bSmrg# parm1:                      specify the default value, yes or no.
2723e45ace2bSmrg#
2724e45ace2bSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2725e45ace2bSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2726e45ace2bSmrgm4_define([_defopt], m4_default([$1], [auto]))
2727e45ace2bSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2728e45ace2bSmrg	[Enable building integration test cases (default: ]_defopt[)]),
2729e45ace2bSmrg	[enable_integration_tests=$enableval],
2730e45ace2bSmrg	[enable_integration_tests=]_defopt)
2731e45ace2bSmrgm4_undefine([_defopt])
2732e45ace2bSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2733e45ace2bSmrg	[test "x$enable_integration_tests" != xno])
2734e45ace2bSmrgAC_MSG_CHECKING([whether to build unit test cases])
2735e45ace2bSmrgAC_MSG_RESULT([$enable_integration_tests])
2736e45ace2bSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
2737fe567363Smrg
2738e45ace2bSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2739e45ace2bSmrg# ----------------------------------------
2740e45ace2bSmrg# Minimum version: 1.13.0
2741e45ace2bSmrg#
2742e45ace2bSmrg# GLib is a library which provides advanced data structures and functions.
2743e45ace2bSmrg# This macro enables a module to test for the presence of Glib.
2744e45ace2bSmrg#
2745e45ace2bSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2746e45ace2bSmrg# Otherwise the value of $enable_unit_tests is blank.
2747e45ace2bSmrg#
2748e45ace2bSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2749e45ace2bSmrg# test support usually requires less dependencies and may be built and run under
2750e45ace2bSmrg# less stringent environments than integration tests.
27513d2ed3e3Smrg#
2752e45ace2bSmrg# Interface to module:
2753e45ace2bSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
2754e45ace2bSmrg# with_glib: used in configure.ac to know if GLib has been found
2755e45ace2bSmrg# --with-glib:	'yes' user instructs the module to use glib
2756e45ace2bSmrg#		'no' user instructs the module not to use glib
2757e45ace2bSmrg#
2758e45ace2bSmrgAC_DEFUN([XORG_WITH_GLIB],[
2759e45ace2bSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2760e45ace2bSmrgm4_define([_defopt], m4_default([$2], [auto]))
2761e45ace2bSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2762e45ace2bSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2763e45ace2bSmrg	[with_glib=$withval], [with_glib=]_defopt)
2764e45ace2bSmrgm4_undefine([_defopt])
2765fe567363Smrg
2766e45ace2bSmrghave_glib=no
2767e45ace2bSmrg# Do not probe GLib if user explicitly disabled unit testing
2768e45ace2bSmrgif test "x$enable_unit_tests" != x"no"; then
2769e45ace2bSmrg  # Do not probe GLib if user explicitly disabled it
2770e45ace2bSmrg  if test "x$with_glib" != x"no"; then
2771e45ace2bSmrg    m4_ifval(
2772e45ace2bSmrg      [$1],
2773e45ace2bSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2774e45ace2bSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2775e45ace2bSmrg    )
27768a0d9095Smrg  fi
27778a0d9095Smrgfi
2778fe567363Smrg
2779e45ace2bSmrg# Not having GLib when unit testing has been explicitly requested is an error
2780e45ace2bSmrgif test "x$enable_unit_tests" = x"yes"; then
2781e45ace2bSmrg  if test "x$have_glib" = x"no"; then
2782e45ace2bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
27838a0d9095Smrg  fi
27848a0d9095Smrgfi
2785fe567363Smrg
2786e45ace2bSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
2787e45ace2bSmrgif test "x$enable_unit_tests" = x"no"; then
2788e45ace2bSmrg  if test "x$with_glib" = x"yes"; then
2789e45ace2bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2790e45ace2bSmrg  fi
2791e45ace2bSmrgfi
2792fe567363Smrg
2793e45ace2bSmrg# Not having GLib when it has been explicitly requested is an error
2794e45ace2bSmrgif test "x$with_glib" = x"yes"; then
2795e45ace2bSmrg  if test "x$have_glib" = x"no"; then
2796e45ace2bSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2797e45ace2bSmrg  fi
2798e45ace2bSmrgfi
279975ebec6dSmrg
2800e45ace2bSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2801e45ace2bSmrg]) # XORG_WITH_GLIB
280275ebec6dSmrg
2803e45ace2bSmrg# XORG_LD_WRAP([required|optional])
2804e45ace2bSmrg# ---------------------------------
2805e45ace2bSmrg# Minimum version: 1.13.0
2806e45ace2bSmrg#
2807e45ace2bSmrg# Check if linker supports -wrap, passed via compiler flags
2808e45ace2bSmrg#
2809e45ace2bSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2810e45ace2bSmrg# Otherwise the value of $enable_unit_tests is blank.
2811e45ace2bSmrg#
2812e45ace2bSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2813e45ace2bSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2814e45ace2bSmrg# available, an argument of "optional" allows use when some unit tests require
2815e45ace2bSmrg# ld -wrap and others do not.
2816e45ace2bSmrg#
2817e45ace2bSmrgAC_DEFUN([XORG_LD_WRAP],[
2818e45ace2bSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2819e45ace2bSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2820e45ace2bSmrg                      void __wrap_exit(int status) { return; }],
2821e45ace2bSmrg                     [exit(0);])])
2822e45ace2bSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
2823e45ace2bSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2824e45ace2bSmrg  if test "x$have_ld_wrap" = x"no"; then
2825e45ace2bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2826e45ace2bSmrg  fi
2827e45ace2bSmrgfi
2828e45ace2bSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2829e45ace2bSmrg#
2830e45ace2bSmrg]) # XORG_LD_WRAP
283175ebec6dSmrg
2832e45ace2bSmrg# XORG_CHECK_LINKER_FLAGS
2833e45ace2bSmrg# -----------------------
2834e45ace2bSmrg# SYNOPSIS
2835e45ace2bSmrg#
2836e45ace2bSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2837e45ace2bSmrg#
2838e45ace2bSmrg# DESCRIPTION
2839e45ace2bSmrg#
2840e45ace2bSmrg#   Check whether the given linker FLAGS work with the current language's
2841e45ace2bSmrg#   linker, or whether they give an error.
2842e45ace2bSmrg#
2843e45ace2bSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2844e45ace2bSmrg#   success/failure.
2845e45ace2bSmrg#
2846e45ace2bSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
2847e45ace2bSmrg#
2848e45ace2bSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2849e45ace2bSmrg#
2850e45ace2bSmrg# LICENSE
2851e45ace2bSmrg#
2852e45ace2bSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2853e45ace2bSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2854e45ace2bSmrg#   Copyright (c) 2009 Matteo Frigo
2855e45ace2bSmrg#
2856e45ace2bSmrg#   This program is free software: you can redistribute it and/or modify it
2857e45ace2bSmrg#   under the terms of the GNU General Public License as published by the
2858e45ace2bSmrg#   Free Software Foundation, either version 3 of the License, or (at your
2859e45ace2bSmrg#   option) any later version.
2860e45ace2bSmrg#
2861e45ace2bSmrg#   This program is distributed in the hope that it will be useful, but
2862e45ace2bSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2863e45ace2bSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2864e45ace2bSmrg#   Public License for more details.
2865e45ace2bSmrg#
2866e45ace2bSmrg#   You should have received a copy of the GNU General Public License along
2867e45ace2bSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2868e45ace2bSmrg#
2869e45ace2bSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
2870e45ace2bSmrg#   gives unlimited permission to copy, distribute and modify the configure
2871e45ace2bSmrg#   scripts that are the output of Autoconf when processing the Macro. You
2872e45ace2bSmrg#   need not follow the terms of the GNU General Public License when using
2873e45ace2bSmrg#   or distributing such scripts, even though portions of the text of the
2874e45ace2bSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2875e45ace2bSmrg#   all other use of the material that constitutes the Autoconf Macro.
2876e45ace2bSmrg#
2877e45ace2bSmrg#   This special exception to the GPL applies to versions of the Autoconf
2878e45ace2bSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
2879e45ace2bSmrg#   modified version of the Autoconf Macro, you may extend this special
2880e45ace2bSmrg#   exception to the GPL to apply to your modified version as well.#
2881e45ace2bSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2882e45ace2bSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
2883e45ace2bSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2884e45ace2bSmrgAS_LITERAL_IF([$1],
2885e45ace2bSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2886e45ace2bSmrg      ax_save_FLAGS=$LDFLAGS
2887e45ace2bSmrg      LDFLAGS="$1"
2888e45ace2bSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2889e45ace2bSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2890e45ace2bSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2891e45ace2bSmrg      LDFLAGS=$ax_save_FLAGS])],
2892e45ace2bSmrg  [ax_save_FLAGS=$LDFLAGS
2893e45ace2bSmrg   LDFLAGS="$1"
2894e45ace2bSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2895e45ace2bSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2896e45ace2bSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2897e45ace2bSmrg   LDFLAGS=$ax_save_FLAGS])
2898e45ace2bSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2899e45ace2bSmrgAC_MSG_RESULT($xorg_check_linker_flags)
2900e45ace2bSmrgif test "x$xorg_check_linker_flags" = xyes; then
2901e45ace2bSmrg	m4_default([$2], :)
2902e45ace2bSmrgelse
2903e45ace2bSmrg	m4_default([$3], :)
2904e45ace2bSmrgfi
2905e45ace2bSmrg]) # XORG_CHECK_LINKER_FLAGS
2906fe567363Smrg
2907e45ace2bSmrg# XORG_MEMORY_CHECK_FLAGS
2908e45ace2bSmrg# -----------------------
2909e45ace2bSmrg# Minimum version: 1.16.0
2910e45ace2bSmrg#
2911e45ace2bSmrg# This macro attempts to find appropriate memory checking functionality
2912e45ace2bSmrg# for various platforms which unit testing code may use to catch various
2913e45ace2bSmrg# forms of memory allocation and access errors in testing.
2914e45ace2bSmrg#
2915e45ace2bSmrg# Interface to module:
2916e45ace2bSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2917e45ace2bSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2918e45ace2bSmrg#
2919e45ace2bSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2920e45ace2bSmrg#
2921e45ace2bSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2922fe567363Smrg
2923e45ace2bSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2924e45ace2bSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2925e45ace2bSmrg           [Environment variables to enable memory checking in tests])
2926fe567363Smrg
2927e45ace2bSmrg# Check for different types of support on different platforms
2928e45ace2bSmrgcase $host_os in
2929e45ace2bSmrg    solaris*)
2930e45ace2bSmrg        AC_CHECK_LIB([umem], [umem_alloc],
2931e45ace2bSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2932e45ace2bSmrg        ;;
2933e45ace2bSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2934e45ace2bSmrg        # both directly and inverted, so should not be 0 or 255.
2935e45ace2bSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
2936e45ace2bSmrg        ;;
2937e45ace2bSmrg    darwin*)
2938e45ace2bSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2939e45ace2bSmrg        ;;
2940e45ace2bSmrg    *bsd*)
2941e45ace2bSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2942e45ace2bSmrg        ;;
2943e45ace2bSmrgesac
29443d2ed3e3Smrg
2945e45ace2bSmrg# User supplied flags override default flags
2946e45ace2bSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2947e45ace2bSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2948fe567363Smrgfi
2949fe567363Smrg
2950e45ace2bSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2951e45ace2bSmrg]) # XORG_WITH_LINT
295275ebec6dSmrg
2953e45ace2bSmrg# XORG_CHECK_MALLOC_ZERO
2954e45ace2bSmrg# ----------------------
2955e45ace2bSmrg# Minimum version: 1.0.0
29563d2ed3e3Smrg#
2957e45ace2bSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2958e45ace2bSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2959e45ace2bSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
296047a4502cSmrg#
296147a4502cSmrg# No longer actually tests since there is no guarantee applications will
296247a4502cSmrg# run with the same malloc implementation we tested against, and the cost
296347a4502cSmrg# of always ensuring the size passed to malloc is non-zero is minimal now.
296447a4502cSmrg# Still allows builders to override when they have complete control over
296547a4502cSmrg# which malloc implementation will be used.
2966e45ace2bSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2967e45ace2bSmrgAC_ARG_ENABLE(malloc0returnsnull,
2968e45ace2bSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
296947a4502cSmrg		       [assume malloc(0) can return NULL (default: yes)]),
2970e45ace2bSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
297147a4502cSmrg	[MALLOC_ZERO_RETURNS_NULL=yes])
297247a4502cSmrg
297347a4502cSmrgAC_MSG_CHECKING([whether to act as if malloc(0) can return NULL])
2974e45ace2bSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2975fe567363Smrg
2976e45ace2bSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2977e45ace2bSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2978e45ace2bSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2979e45ace2bSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
29803d2ed3e3Smrgelse
2981e45ace2bSmrg	MALLOC_ZERO_CFLAGS=""
2982e45ace2bSmrg	XMALLOC_ZERO_CFLAGS=""
2983e45ace2bSmrg	XTMALLOC_ZERO_CFLAGS=""
29843d2ed3e3Smrgfi
2985b53e5eeaSmrg
2986e45ace2bSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2987e45ace2bSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2988e45ace2bSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2989e45ace2bSmrg]) # XORG_CHECK_MALLOC_ZERO
299075ebec6dSmrg
2991e45ace2bSmrg# XORG_WITH_LINT()
2992e45ace2bSmrg# ----------------
2993e45ace2bSmrg# Minimum version: 1.1.0
29948a0d9095Smrg#
2995e45ace2bSmrg# This macro enables the use of a tool that flags some suspicious and
2996e45ace2bSmrg# non-portable constructs (likely to be bugs) in C language source code.
2997e45ace2bSmrg# It will attempt to locate the tool and use appropriate options.
2998e45ace2bSmrg# There are various lint type tools on different platforms.
29998a0d9095Smrg#
3000e45ace2bSmrg# Interface to module:
3001e45ace2bSmrg# LINT:		returns the path to the tool found on the platform
3002e45ace2bSmrg#		or the value set to LINT on the configure cmd line
3003e45ace2bSmrg#		also an Automake conditional
3004e45ace2bSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
3005e45ace2bSmrg#
3006e45ace2bSmrg# --with-lint:	'yes' user instructs the module to use lint
3007e45ace2bSmrg#		'no' user instructs the module not to use lint (default)
3008e45ace2bSmrg#
3009e45ace2bSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
3010e45ace2bSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
3011e45ace2bSmrg#
3012e45ace2bSmrgAC_DEFUN([XORG_WITH_LINT],[
30138a0d9095Smrg
3014e45ace2bSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
3015e45ace2bSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
3016e45ace2bSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
3017e45ace2bSmrg		[Use a lint-style source code checker (default: disabled)])],
3018e45ace2bSmrg		[use_lint=$withval], [use_lint=no])
30198a0d9095Smrg
3020e45ace2bSmrg# Obtain platform specific info like program name and options
3021e45ace2bSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
3022e45ace2bSmrgcase $host_os in
3023e45ace2bSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
3024e45ace2bSmrg	lint_name=splint
3025e45ace2bSmrg	lint_options="-badflag"
3026e45ace2bSmrg	;;
3027e45ace2bSmrg  *freebsd* | *netbsd*)
3028e45ace2bSmrg	lint_name=lint
3029e45ace2bSmrg	lint_options="-u -b"
3030e45ace2bSmrg	;;
3031e45ace2bSmrg  *solaris*)
3032e45ace2bSmrg	lint_name=lint
3033e45ace2bSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
3034e45ace2bSmrg	;;
3035e45ace2bSmrgesac
3036e45ace2bSmrg
3037e45ace2bSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
3038e45ace2bSmrgif test "x$use_lint" = x"yes" ; then
3039e45ace2bSmrg   AC_PATH_PROG([LINT], [$lint_name])
3040e45ace2bSmrg   if test "x$LINT" = "x"; then
3041e45ace2bSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
3042e45ace2bSmrg   fi
3043e45ace2bSmrgelif test "x$use_lint" = x"no" ; then
3044e45ace2bSmrg   if test "x$LINT" != "x"; then
3045e45ace2bSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
3046e45ace2bSmrg   fi
30473d2ed3e3Smrgelse
3048e45ace2bSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
30498a0d9095Smrgfi
30508a0d9095Smrg
3051e45ace2bSmrg# User supplied flags override default flags
3052e45ace2bSmrgif test "x$LINT_FLAGS" != "x"; then
3053e45ace2bSmrg   lint_options=$LINT_FLAGS
3054e45ace2bSmrgfi
30558a0d9095Smrg
3056e45ace2bSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
3057e45ace2bSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
30588a0d9095Smrg
3059e45ace2bSmrg]) # XORG_WITH_LINT
3060b53e5eeaSmrg
3061e45ace2bSmrg# XORG_LINT_LIBRARY(LIBNAME)
3062e45ace2bSmrg# --------------------------
3063e45ace2bSmrg# Minimum version: 1.1.0
30648a0d9095Smrg#
3065e45ace2bSmrg# Sets up flags for building lint libraries for checking programs that call
3066e45ace2bSmrg# functions in the library.
3067e45ace2bSmrg#
3068e45ace2bSmrg# Interface to module:
3069e45ace2bSmrg# LINTLIB		- Automake variable with the name of lint library file to make
3070e45ace2bSmrg# MAKE_LINT_LIB		- Automake conditional
3071e45ace2bSmrg#
3072e45ace2bSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
3073e45ace2bSmrg#			  - 'no' user instructs the module not to create a lint library (default)
30748a0d9095Smrg
3075e45ace2bSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
3076e45ace2bSmrgAC_REQUIRE([XORG_WITH_LINT])
3077e45ace2bSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
3078e45ace2bSmrg	[Create lint library (default: disabled)])],
3079e45ace2bSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
3080e45ace2bSmrg
3081e45ace2bSmrgif test "x$make_lint_lib" = x"yes" ; then
3082e45ace2bSmrg   LINTLIB=llib-l$1.ln
3083e45ace2bSmrg   if test "x$LINT" = "x"; then
3084e45ace2bSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
3085e45ace2bSmrg   fi
3086e45ace2bSmrgelif test "x$make_lint_lib" != x"no" ; then
3087e45ace2bSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
308875ebec6dSmrgfi
308975ebec6dSmrg
3090e45ace2bSmrgAC_SUBST(LINTLIB)
3091e45ace2bSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
30923d2ed3e3Smrg
3093e45ace2bSmrg]) # XORG_LINT_LIBRARY
30943d2ed3e3Smrg
3095e45ace2bSmrg# XORG_COMPILER_BRAND
30963d2ed3e3Smrg# -------------------
3097e45ace2bSmrg# Minimum version: 1.14.0
30983d2ed3e3Smrg#
3099e45ace2bSmrg# Checks for various brands of compilers and sets flags as appropriate:
3100e45ace2bSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
3101e45ace2bSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
3102e45ace2bSmrg#   clang compiler - sets CLANGCC to "yes"
3103e45ace2bSmrg#   Intel compiler - sets INTELCC to "yes"
3104e45ace2bSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
3105e45ace2bSmrg#
3106e45ace2bSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
3107e45ace2bSmrgAC_LANG_CASE(
3108e45ace2bSmrg	[C], [
3109e45ace2bSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
3110e45ace2bSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3111e45ace2bSmrg		m4_version_prereq([2.70],
3112e45ace2bSmrg			[AC_REQUIRE([AC_PROG_CC])],
3113e45ace2bSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3114e45ace2bSmrg	],
3115e45ace2bSmrg	[C++], [
3116e45ace2bSmrg		AC_REQUIRE([AC_PROG_CXX])
3117e45ace2bSmrg	]
3118e45ace2bSmrg)
3119e45ace2bSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
3120e45ace2bSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
3121e45ace2bSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
3122e45ace2bSmrg]) # XORG_COMPILER_BRAND
312375ebec6dSmrg
3124e45ace2bSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
31253d2ed3e3Smrg# ---------------
3126e45ace2bSmrg# Minimum version: 1.16.0
3127e45ace2bSmrg#
3128e45ace2bSmrg# Test if the compiler works when passed the given flag as a command line argument.
3129e45ace2bSmrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
3130e45ace2bSmrg# next flag in the list until there are no more options.
3131e45ace2bSmrg#
3132e45ace2bSmrg# Note that this does not guarantee that the compiler supports the flag as some
3133e45ace2bSmrg# compilers will simply ignore arguments that they do not understand, but we do
3134e45ace2bSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
3135e45ace2bSmrg# -Werror=unused-command-line-argument
3136e45ace2bSmrg#
3137e45ace2bSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
3138e45ace2bSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3139e45ace2bSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
314075ebec6dSmrg
3141e45ace2bSmrgAC_LANG_COMPILER_REQUIRE
314275ebec6dSmrg
3143e45ace2bSmrgAC_LANG_CASE(
3144e45ace2bSmrg	[C], [
3145e45ace2bSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
3146e45ace2bSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3147e45ace2bSmrg		m4_version_prereq([2.70],
3148e45ace2bSmrg			[AC_REQUIRE([AC_PROG_CC])],
3149e45ace2bSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3150e45ace2bSmrg		define([PREFIX], [C])
3151e45ace2bSmrg		define([CACHE_PREFIX], [cc])
3152e45ace2bSmrg		define([COMPILER], [$CC])
3153e45ace2bSmrg	],
3154e45ace2bSmrg	[C++], [
3155e45ace2bSmrg		define([PREFIX], [CXX])
3156e45ace2bSmrg		define([CACHE_PREFIX], [cxx])
3157e45ace2bSmrg		define([COMPILER], [$CXX])
3158e45ace2bSmrg	]
3159e45ace2bSmrg)
3160e45ace2bSmrg
3161e45ace2bSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
3162e45ace2bSmrg
3163e45ace2bSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
3164e45ace2bSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3165e45ace2bSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
3166e45ace2bSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3167e45ace2bSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3168e45ace2bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
3169e45ace2bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
3170e45ace2bSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
3171e45ace2bSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
31723d2ed3e3Smrgfi
3173e45ace2bSmrg
3174e45ace2bSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
3175e45ace2bSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
3176e45ace2bSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3177e45ace2bSmrg	fi
3178e45ace2bSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3179e45ace2bSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
3180e45ace2bSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3181e45ace2bSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3182e45ace2bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
3183e45ace2bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
3184e45ace2bSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
3185e45ace2bSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3186e45ace2bSmrgfi
3187e45ace2bSmrg
3188e45ace2bSmrgfound="no"
3189e45ace2bSmrgm4_foreach([flag], m4_cdr($@), [
3190e45ace2bSmrg	if test $found = "no" ; then
3191e45ace2bSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
3192e45ace2bSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3193e45ace2bSmrg		fi
3194e45ace2bSmrg
3195e45ace2bSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
3196e45ace2bSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3197e45ace2bSmrg		fi
3198e45ace2bSmrg
3199e45ace2bSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
3200e45ace2bSmrg
3201e45ace2bSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
3202e45ace2bSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
3203e45ace2bSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
3204e45ace2bSmrg		AC_CACHE_VAL($cacheid,
3205e45ace2bSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3206e45ace2bSmrg					     [eval $cacheid=yes],
3207e45ace2bSmrg					     [eval $cacheid=no])])
3208e45ace2bSmrg
3209e45ace2bSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3210e45ace2bSmrg
3211e45ace2bSmrg		eval supported=\$$cacheid
3212e45ace2bSmrg		AC_MSG_RESULT([$supported])
3213e45ace2bSmrg		if test "$supported" = "yes" ; then
3214e45ace2bSmrg			$1="$$1 ]flag["
3215e45ace2bSmrg			found="yes"
3216e45ace2bSmrg		fi
3217e45ace2bSmrg	fi
32183d2ed3e3Smrg])
3219e45ace2bSmrg]) # XORG_TESTSET_CFLAG
322075ebec6dSmrg
3221e45ace2bSmrg# XORG_COMPILER_FLAGS
3222e45ace2bSmrg# ---------------
3223e45ace2bSmrg# Minimum version: 1.16.0
32248d4c0f7bSmrg#
3225e45ace2bSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
3226e45ace2bSmrg# arguments supported by the selected compiler which do NOT alter the generated
3227e45ace2bSmrg# code.  These arguments will cause the compiler to print various warnings
3228e45ace2bSmrg# during compilation AND turn a conservative set of warnings into errors.
3229e45ace2bSmrg#
3230e45ace2bSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
3231e45ace2bSmrg# future versions of util-macros as options are added to new compilers.
3232e45ace2bSmrg#
3233e45ace2bSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
3234e45ace2bSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
323575ebec6dSmrg
3236e45ace2bSmrgAC_ARG_ENABLE(selective-werror,
3237e45ace2bSmrg              AS_HELP_STRING([--disable-selective-werror],
3238e45ace2bSmrg                             [Turn off selective compiler errors. (default: enabled)]),
3239e45ace2bSmrg              [SELECTIVE_WERROR=$enableval],
3240e45ace2bSmrg              [SELECTIVE_WERROR=yes])
3241e45ace2bSmrg
3242e45ace2bSmrgAC_LANG_CASE(
3243e45ace2bSmrg        [C], [
3244e45ace2bSmrg                define([PREFIX], [C])
3245e45ace2bSmrg        ],
3246e45ace2bSmrg        [C++], [
3247e45ace2bSmrg                define([PREFIX], [CXX])
3248e45ace2bSmrg        ]
3249e45ace2bSmrg)
3250e45ace2bSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
3251e45ace2bSmrgif test "x$SUNCC" = "xyes"; then
3252e45ace2bSmrg    [BASE_]PREFIX[FLAGS]="-v"
32533d2ed3e3Smrgelse
3254e45ace2bSmrg    [BASE_]PREFIX[FLAGS]=""
32553d2ed3e3Smrgfi
32563d2ed3e3Smrg
3257e45ace2bSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3258e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
3259e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
3260e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
3261e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
32623d2ed3e3Smrg
3263e45ace2bSmrgAC_LANG_CASE(
3264e45ace2bSmrg	[C], [
3265e45ace2bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
3266e45ace2bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
3267e45ace2bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
3268e45ace2bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
3269e45ace2bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
3270e45ace2bSmrg	]
3271e45ace2bSmrg)
327275ebec6dSmrg
3273e45ace2bSmrg# This chunk adds additional warnings that could catch undesired effects.
3274e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
3275e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
3276e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
3277e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
3278e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
3279e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
3280e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
328175ebec6dSmrg
3282e45ace2bSmrg# These are currently disabled because they are noisy.  They will be enabled
3283e45ace2bSmrg# in the future once the codebase is sufficiently modernized to silence
3284e45ace2bSmrg# them.  For now, I don't want them to drown out the other warnings.
3285e45ace2bSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3286e45ace2bSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3287e45ace2bSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
328875ebec6dSmrg
3289e45ace2bSmrg# Turn some warnings into errors, so we don't accidentally get successful builds
3290e45ace2bSmrg# when there are problems that should be fixed.
329175ebec6dSmrg
3292e45ace2bSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3293e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3294e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3295e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3296e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3297e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3298e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3299e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3300e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3301e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3302e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3303e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3304e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3305e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3306e45ace2bSmrgelse
3307e45ace2bSmrgAC_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])
3308e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3309e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3310e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3311e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3312e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3313e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3314e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3315e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3316e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3317e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3318e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3319e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3320e45ace2bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3321e45ace2bSmrgfi
332275ebec6dSmrg
3323e45ace2bSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3324e45ace2bSmrg]) # XORG_COMPILER_FLAGS
332575ebec6dSmrg
3326e45ace2bSmrg# XORG_CWARNFLAGS
3327e45ace2bSmrg# ---------------
3328e45ace2bSmrg# Minimum version: 1.2.0
3329e45ace2bSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
33308a0d9095Smrg#
3331e45ace2bSmrg# Defines CWARNFLAGS to enable C compiler warnings.
33328a0d9095Smrg#
3333e45ace2bSmrg# This function is deprecated because it defines -fno-strict-aliasing
3334e45ace2bSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3335e45ace2bSmrg# is needed, then it should be added explicitly in the module when
3336e45ace2bSmrg# it is updated to use BASE_CFLAGS.
33378a0d9095Smrg#
3338e45ace2bSmrgAC_DEFUN([XORG_CWARNFLAGS], [
3339e45ace2bSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3340e45ace2bSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3341e45ace2bSmrgAC_LANG_CASE(
3342e45ace2bSmrg	[C], [
3343e45ace2bSmrg		CWARNFLAGS="$BASE_CFLAGS"
3344e45ace2bSmrg		if  test "x$GCC" = xyes ; then
3345e45ace2bSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3346e45ace2bSmrg		fi
3347e45ace2bSmrg		AC_SUBST(CWARNFLAGS)
3348e45ace2bSmrg	]
3349e45ace2bSmrg)
3350e45ace2bSmrg]) # XORG_CWARNFLAGS
335175ebec6dSmrg
3352e45ace2bSmrg# XORG_STRICT_OPTION
3353e45ace2bSmrg# -----------------------
3354e45ace2bSmrg# Minimum version: 1.3.0
3355e45ace2bSmrg#
3356e45ace2bSmrg# Add configure option to enable strict compilation flags, such as treating
3357e45ace2bSmrg# warnings as fatal errors.
3358e45ace2bSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3359e45ace2bSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3360e45ace2bSmrg#
3361e45ace2bSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3362e45ace2bSmrg# when strict compilation is unconditionally desired.
3363e45ace2bSmrgAC_DEFUN([XORG_STRICT_OPTION], [
3364e45ace2bSmrgAC_REQUIRE([XORG_CWARNFLAGS])
3365e45ace2bSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
336675ebec6dSmrg
3367e45ace2bSmrgAC_ARG_ENABLE(strict-compilation,
3368e45ace2bSmrg			  AS_HELP_STRING([--enable-strict-compilation],
3369e45ace2bSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3370e45ace2bSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
337175ebec6dSmrg
3372e45ace2bSmrgAC_LANG_CASE(
3373e45ace2bSmrg        [C], [
3374e45ace2bSmrg                define([PREFIX], [C])
3375e45ace2bSmrg        ],
3376e45ace2bSmrg        [C++], [
3377e45ace2bSmrg                define([PREFIX], [CXX])
3378e45ace2bSmrg        ]
3379e45ace2bSmrg)
33803d2ed3e3Smrg
3381e45ace2bSmrg[STRICT_]PREFIX[FLAGS]=""
3382e45ace2bSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3383e45ace2bSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
33843d2ed3e3Smrg
3385e45ace2bSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3386e45ace2bSmrg# activate it with -Werror, so we add it here explicitly.
3387e45ace2bSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
33883d2ed3e3Smrg
3389e45ace2bSmrgif test "x$STRICT_COMPILE" = "xyes"; then
3390e45ace2bSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3391e45ace2bSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3392e45ace2bSmrgfi
3393e45ace2bSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3394e45ace2bSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3395e45ace2bSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3396e45ace2bSmrg]) # XORG_STRICT_OPTION
33973d2ed3e3Smrg
3398e45ace2bSmrg# XORG_DEFAULT_NOCODE_OPTIONS
3399e45ace2bSmrg# ---------------------------
3400e45ace2bSmrg# Minimum version: 1.20.0
3401e45ace2bSmrg#
3402e45ace2bSmrg# Defines default options for X.Org modules which don't compile code,
3403e45ace2bSmrg# such as fonts, bitmaps, cursors, and docs.
3404e45ace2bSmrg#
3405e45ace2bSmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
3406e45ace2bSmrgAC_REQUIRE([AC_PROG_INSTALL])
3407e45ace2bSmrgXORG_RELEASE_VERSION
3408e45ace2bSmrgXORG_CHANGELOG
3409e45ace2bSmrgXORG_INSTALL
3410e45ace2bSmrgXORG_MANPAGE_SECTIONS
3411e45ace2bSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3412e45ace2bSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3413e45ace2bSmrg]) # XORG_DEFAULT_NOCODE_OPTIONS
34143d2ed3e3Smrg
3415e45ace2bSmrg# XORG_DEFAULT_OPTIONS
3416e45ace2bSmrg# --------------------
3417e45ace2bSmrg# Minimum version: 1.3.0
3418e45ace2bSmrg#
3419e45ace2bSmrg# Defines default options for X.Org modules which compile code.
3420e45ace2bSmrg#
3421e45ace2bSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3422e45ace2bSmrgAC_REQUIRE([AC_PROG_INSTALL])
3423e45ace2bSmrgXORG_COMPILER_FLAGS
3424e45ace2bSmrgXORG_CWARNFLAGS
3425e45ace2bSmrgXORG_STRICT_OPTION
3426e45ace2bSmrgXORG_DEFAULT_NOCODE_OPTIONS
3427e45ace2bSmrg]) # XORG_DEFAULT_OPTIONS
34283d2ed3e3Smrg
3429e45ace2bSmrg# XORG_INSTALL()
3430e45ace2bSmrg# ----------------
3431e45ace2bSmrg# Minimum version: 1.4.0
3432e45ace2bSmrg#
3433e45ace2bSmrg# Defines the variable INSTALL_CMD as the command to copy
3434e45ace2bSmrg# INSTALL from $prefix/share/util-macros.
3435e45ace2bSmrg#
3436e45ace2bSmrgAC_DEFUN([XORG_INSTALL], [
3437e45ace2bSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3438e45ace2bSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3439e45ace2bSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3440e45ace2bSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3441e45ace2bSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3442e45ace2bSmrgtouch \$(top_srcdir)/INSTALL; \
3443e45ace2bSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3444e45ace2bSmrgAC_SUBST([INSTALL_CMD])
3445e45ace2bSmrg]) # XORG_INSTALL
3446e45ace2bSmrgdnl Copyright 2005 Red Hat, Inc
3447e45ace2bSmrgdnl
3448e45ace2bSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3449e45ace2bSmrgdnl documentation for any purpose is hereby granted without fee, provided that
3450e45ace2bSmrgdnl the above copyright notice appear in all copies and that both that
3451e45ace2bSmrgdnl copyright notice and this permission notice appear in supporting
3452e45ace2bSmrgdnl documentation.
3453e45ace2bSmrgdnl
3454e45ace2bSmrgdnl The above copyright notice and this permission notice shall be included
3455e45ace2bSmrgdnl in all copies or substantial portions of the Software.
3456e45ace2bSmrgdnl
3457e45ace2bSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3458e45ace2bSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3459e45ace2bSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3460e45ace2bSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3461e45ace2bSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3462e45ace2bSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3463e45ace2bSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
3464e45ace2bSmrgdnl
3465e45ace2bSmrgdnl Except as contained in this notice, the name of the copyright holders shall
3466e45ace2bSmrgdnl not be used in advertising or otherwise to promote the sale, use or
3467e45ace2bSmrgdnl other dealings in this Software without prior written authorization
3468e45ace2bSmrgdnl from the copyright holders.
3469e45ace2bSmrgdnl
34703d2ed3e3Smrg
3471e45ace2bSmrg# XORG_RELEASE_VERSION
3472e45ace2bSmrg# --------------------
3473e45ace2bSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
34743d2ed3e3Smrg
3475e45ace2bSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3476e45ace2bSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3477e45ace2bSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3478e45ace2bSmrg		[Major version of this package])
3479e45ace2bSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3480e45ace2bSmrg	if test "x$PVM" = "x"; then
3481e45ace2bSmrg		PVM="0"
3482e45ace2bSmrg	fi
3483e45ace2bSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3484e45ace2bSmrg		[$PVM],
3485e45ace2bSmrg		[Minor version of this package])
3486e45ace2bSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3487e45ace2bSmrg	if test "x$PVP" = "x"; then
3488e45ace2bSmrg		PVP="0"
3489e45ace2bSmrg	fi
3490e45ace2bSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3491e45ace2bSmrg		[$PVP],
3492e45ace2bSmrg		[Patch version of this package])
3493e45ace2bSmrg])
34943d2ed3e3Smrg
3495e45ace2bSmrg# XORG_CHANGELOG()
3496e45ace2bSmrg# ----------------
3497e45ace2bSmrg# Minimum version: 1.2.0
3498e45ace2bSmrg#
3499e45ace2bSmrg# Defines the variable CHANGELOG_CMD as the command to generate
3500e45ace2bSmrg# ChangeLog from git.
3501e45ace2bSmrg#
3502e45ace2bSmrg#
3503e45ace2bSmrgAC_DEFUN([XORG_CHANGELOG], [
3504e45ace2bSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3505e45ace2bSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3506e45ace2bSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3507e45ace2bSmrgtouch \$(top_srcdir)/ChangeLog; \
3508e45ace2bSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3509e45ace2bSmrgAC_SUBST([CHANGELOG_CMD])
3510e45ace2bSmrg]) # XORG_CHANGELOG
35118d4c0f7bSmrg
3512