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