aclocal.m4 revision f6d57fde
1f6d57fdeSmrg# generated automatically by aclocal 1.17 -*- Autoconf -*-
28abc0ccfSmrg
3f6d57fdeSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
47a0395d0Smrg
57a0395d0Smrg# This file is free software; the Free Software Foundation
67a0395d0Smrg# gives unlimited permission to copy and/or distribute it,
77a0395d0Smrg# with or without modifications, as long as this notice is preserved.
87a0395d0Smrg
97a0395d0Smrg# This program is distributed in the hope that it will be useful,
107a0395d0Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
117a0395d0Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
127a0395d0Smrg# PARTICULAR PURPOSE.
137a0395d0Smrg
149a011757Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
157a0395d0Smrgm4_ifndef([AC_AUTOCONF_VERSION],
167a0395d0Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17273c00b8Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
18273c00b8Smrg[m4_warning([this file was generated for autoconf 2.72.
197a0395d0SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
207a0395d0SmrgIf you have problems, you may need to regenerate the build system entirely.
218abc0ccfSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
227a0395d0Smrg
23f6d57fdeSmrg# Copyright (C) 2002-2024 Free Software Foundation, Inc.
24273c00b8Smrg#
25273c00b8Smrg# This file is free software; the Free Software Foundation
26273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
27273c00b8Smrg# with or without modifications, as long as this notice is preserved.
28765b7306Smrg
29273c00b8Smrg# AM_AUTOMAKE_VERSION(VERSION)
30273c00b8Smrg# ----------------------------
31273c00b8Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32273c00b8Smrg# generated from the m4 files accompanying Automake X.Y.
33273c00b8Smrg# (This private macro should not be called outside this file.)
34273c00b8SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35f6d57fdeSmrg[am__api_version='1.17'
36273c00b8Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37273c00b8Smrgdnl require some minimum version.  Point them to the right macro.
38f6d57fdeSmrgm4_if([$1], [1.17], [],
39273c00b8Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40273c00b8Smrg])
416c3c2bceSmrg
42273c00b8Smrg# _AM_AUTOCONF_VERSION(VERSION)
43273c00b8Smrg# -----------------------------
44273c00b8Smrg# aclocal traces this macro to find the Autoconf version.
45273c00b8Smrg# This is a private macro too.  Using m4_define simplifies
46273c00b8Smrg# the logic in aclocal, which can simply ignore this definition.
47273c00b8Smrgm4_define([_AM_AUTOCONF_VERSION], [])
486c3c2bceSmrg
49273c00b8Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50273c00b8Smrg# -------------------------------
51273c00b8Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52273c00b8Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53273c00b8SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54f6d57fdeSmrg[AM_AUTOMAKE_VERSION([1.17])dnl
55273c00b8Smrgm4_ifndef([AC_AUTOCONF_VERSION],
56273c00b8Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57273c00b8Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
587a0395d0Smrg
59273c00b8Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
607a0395d0Smrg
61f6d57fdeSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
62273c00b8Smrg#
63273c00b8Smrg# This file is free software; the Free Software Foundation
64273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
65273c00b8Smrg# with or without modifications, as long as this notice is preserved.
667a0395d0Smrg
67273c00b8Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68273c00b8Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69273c00b8Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70273c00b8Smrg#
71273c00b8Smrg# Of course, Automake must honor this variable whenever it calls a
72273c00b8Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73273c00b8Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74273c00b8Smrg# depending on how configure is run.  This is pretty annoying, since
75273c00b8Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76273c00b8Smrg# source directory, any form will work fine, but in subdirectories a
77273c00b8Smrg# relative path needs to be adjusted first.
78273c00b8Smrg#
79273c00b8Smrg# $ac_aux_dir/missing
80273c00b8Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81273c00b8Smrg# $top_srcdir/$ac_aux_dir/missing
82273c00b8Smrg#    fails if $ac_aux_dir is absolute,
83273c00b8Smrg#    fails when called from a subdirectory in a VPATH build with
84273c00b8Smrg#          a relative $ac_aux_dir
85273c00b8Smrg#
86273c00b8Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87273c00b8Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
88273c00b8Smrg# harmless because $srcdir is '.', but things will broke when you
89273c00b8Smrg# start a VPATH build or use an absolute $srcdir.
90273c00b8Smrg#
91273c00b8Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92273c00b8Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93273c00b8Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94273c00b8Smrg# and then we would define $MISSING as
95273c00b8Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96273c00b8Smrg# This will work as long as MISSING is not called from configure, because
97273c00b8Smrg# unfortunately $(top_srcdir) has no meaning in configure.
98273c00b8Smrg# However there are other variables, like CC, which are often used in
99273c00b8Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100273c00b8Smrg#
101273c00b8Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
102273c00b8Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
103273c00b8Smrg# configured tree to be moved without reconfiguration.
1047a0395d0Smrg
105273c00b8SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106273c00b8Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107273c00b8Smrg# Expand $ac_aux_dir to an absolute path.
108273c00b8Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109273c00b8Smrg])
1107a0395d0Smrg
111273c00b8Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1128abc0ccfSmrg
113f6d57fdeSmrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
114273c00b8Smrg#
115273c00b8Smrg# This file is free software; the Free Software Foundation
116273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
117273c00b8Smrg# with or without modifications, as long as this notice is preserved.
1187a0395d0Smrg
119273c00b8Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120273c00b8Smrg# -------------------------------------
121273c00b8Smrg# Define a conditional.
122273c00b8SmrgAC_DEFUN([AM_CONDITIONAL],
123273c00b8Smrg[AC_PREREQ([2.52])dnl
124273c00b8Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
125273c00b8Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126273c00b8SmrgAC_SUBST([$1_TRUE])dnl
127273c00b8SmrgAC_SUBST([$1_FALSE])dnl
128273c00b8Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129273c00b8Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130273c00b8Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131273c00b8Smrgif $2; then
132273c00b8Smrg  $1_TRUE=
133273c00b8Smrg  $1_FALSE='#'
134273c00b8Smrgelse
135273c00b8Smrg  $1_TRUE='#'
136273c00b8Smrg  $1_FALSE=
137273c00b8Smrgfi
138273c00b8SmrgAC_CONFIG_COMMANDS_PRE(
139273c00b8Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140273c00b8Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141273c00b8SmrgUsually this means the macro was only invoked conditionally.]])
142273c00b8Smrgfi])])
1437a0395d0Smrg
144f6d57fdeSmrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
145273c00b8Smrg#
146273c00b8Smrg# This file is free software; the Free Software Foundation
147273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
148273c00b8Smrg# with or without modifications, as long as this notice is preserved.
1497a0395d0Smrg
1507a0395d0Smrg
151273c00b8Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
152273c00b8Smrg# written in clear, in which case automake, when reading aclocal.m4,
153273c00b8Smrg# will think it sees a *use*, and therefore will trigger all it's
154273c00b8Smrg# C support machinery.  Also note that it means that autoscan, seeing
155273c00b8Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1567a0395d0Smrg
1577a0395d0Smrg
158273c00b8Smrg# _AM_DEPENDENCIES(NAME)
159273c00b8Smrg# ----------------------
160273c00b8Smrg# See how the compiler implements dependency checking.
161273c00b8Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
162273c00b8Smrg# We try a few techniques and use that to set a single cache variable.
163273c00b8Smrg#
164273c00b8Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
165273c00b8Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
166273c00b8Smrg# dependency, and given that the user is not expected to run this macro,
167273c00b8Smrg# just rely on AC_PROG_CC.
168273c00b8SmrgAC_DEFUN([_AM_DEPENDENCIES],
169273c00b8Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
170273c00b8SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
171273c00b8SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
172273c00b8SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1737a0395d0Smrg
174273c00b8Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
175273c00b8Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
176273c00b8Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
177273c00b8Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
178273c00b8Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
179273c00b8Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
180273c00b8Smrg                    [depcc="$$1"   am_compiler_list=])
1817a0395d0Smrg
182273c00b8SmrgAC_CACHE_CHECK([dependency style of $depcc],
183273c00b8Smrg               [am_cv_$1_dependencies_compiler_type],
184273c00b8Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
185273c00b8Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
186273c00b8Smrg  # making bogus files that we don't know about and never remove.  For
187273c00b8Smrg  # instance it was reported that on HP-UX the gcc test will end up
188273c00b8Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
189273c00b8Smrg  # in D".
190273c00b8Smrg  rm -rf conftest.dir
191273c00b8Smrg  mkdir conftest.dir
192273c00b8Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
193273c00b8Smrg  # using a relative directory.
194273c00b8Smrg  cp "$am_depcomp" conftest.dir
195273c00b8Smrg  cd conftest.dir
196273c00b8Smrg  # We will build objects and dependencies in a subdirectory because
197273c00b8Smrg  # it helps to detect inapplicable dependency modes.  For instance
198273c00b8Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
199273c00b8Smrg  # side effect of compilation, but ICC will put the dependencies in
200273c00b8Smrg  # the current directory while Tru64 will put them in the object
201273c00b8Smrg  # directory.
202273c00b8Smrg  mkdir sub
2037a0395d0Smrg
204273c00b8Smrg  am_cv_$1_dependencies_compiler_type=none
205273c00b8Smrg  if test "$am_compiler_list" = ""; then
206273c00b8Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
207273c00b8Smrg  fi
208273c00b8Smrg  am__universal=false
209273c00b8Smrg  m4_case([$1], [CC],
210273c00b8Smrg    [case " $depcc " in #(
211273c00b8Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212273c00b8Smrg     esac],
213273c00b8Smrg    [CXX],
214273c00b8Smrg    [case " $depcc " in #(
215273c00b8Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216273c00b8Smrg     esac])
2177a0395d0Smrg
218273c00b8Smrg  for depmode in $am_compiler_list; do
219273c00b8Smrg    # Setup a source with many dependencies, because some compilers
220273c00b8Smrg    # like to wrap large dependency lists on column 80 (with \), and
221273c00b8Smrg    # we should not choose a depcomp mode which is confused by this.
222273c00b8Smrg    #
223273c00b8Smrg    # We need to recreate these files for each test, as the compiler may
224273c00b8Smrg    # overwrite some of them when testing with obscure command lines.
225273c00b8Smrg    # This happens at least with the AIX C compiler.
226273c00b8Smrg    : > sub/conftest.c
227273c00b8Smrg    for i in 1 2 3 4 5 6; do
228273c00b8Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
229273c00b8Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
230273c00b8Smrg      # Solaris 10 /bin/sh.
231273c00b8Smrg      echo '/* dummy */' > sub/conftst$i.h
232273c00b8Smrg    done
233273c00b8Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234273c00b8Smrg
235273c00b8Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236273c00b8Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
237273c00b8Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
238273c00b8Smrg    # versions had trouble with output in subdirs.
239273c00b8Smrg    am__obj=sub/conftest.${OBJEXT-o}
240273c00b8Smrg    am__minus_obj="-o $am__obj"
241273c00b8Smrg    case $depmode in
242273c00b8Smrg    gcc)
243273c00b8Smrg      # This depmode causes a compiler race in universal mode.
244273c00b8Smrg      test "$am__universal" = false || continue
245273c00b8Smrg      ;;
246273c00b8Smrg    nosideeffect)
247273c00b8Smrg      # After this tag, mechanisms are not by side-effect, so they'll
248273c00b8Smrg      # only be used when explicitly requested.
249273c00b8Smrg      if test "x$enable_dependency_tracking" = xyes; then
250273c00b8Smrg	continue
251273c00b8Smrg      else
252273c00b8Smrg	break
253273c00b8Smrg      fi
254273c00b8Smrg      ;;
255273c00b8Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
256273c00b8Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
257273c00b8Smrg      # not run yet.  These depmodes are late enough in the game, and
258273c00b8Smrg      # so weak that their functioning should not be impacted.
259273c00b8Smrg      am__obj=conftest.${OBJEXT-o}
260273c00b8Smrg      am__minus_obj=
261273c00b8Smrg      ;;
262273c00b8Smrg    none) break ;;
263273c00b8Smrg    esac
264273c00b8Smrg    if depmode=$depmode \
265273c00b8Smrg       source=sub/conftest.c object=$am__obj \
266273c00b8Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267273c00b8Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
268273c00b8Smrg         >/dev/null 2>conftest.err &&
269273c00b8Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
270273c00b8Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271273c00b8Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
272273c00b8Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
273273c00b8Smrg      # icc doesn't choke on unknown options, it will just issue warnings
274273c00b8Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
275273c00b8Smrg      # that says an option was ignored or not supported.
276f6d57fdeSmrg      # When given -MP, icc 7.0 and 7.1 complain thus:
277273c00b8Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
278273c00b8Smrg      # The diagnosis changed in icc 8.0:
279273c00b8Smrg      #   icc: Command line remark: option '-MP' not supported
280273c00b8Smrg      if (grep 'ignoring option' conftest.err ||
281273c00b8Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
282273c00b8Smrg        am_cv_$1_dependencies_compiler_type=$depmode
283273c00b8Smrg        break
284273c00b8Smrg      fi
285273c00b8Smrg    fi
286273c00b8Smrg  done
287273c00b8Smrg
288273c00b8Smrg  cd ..
289273c00b8Smrg  rm -rf conftest.dir
2908abc0ccfSmrgelse
291273c00b8Smrg  am_cv_$1_dependencies_compiler_type=none
292273c00b8Smrgfi
293273c00b8Smrg])
294273c00b8SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
295273c00b8SmrgAM_CONDITIONAL([am__fastdep$1], [
296273c00b8Smrg  test "x$enable_dependency_tracking" != xno \
297273c00b8Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298273c00b8Smrg])
2997a0395d0Smrg
3007a0395d0Smrg
301273c00b8Smrg# AM_SET_DEPDIR
302273c00b8Smrg# -------------
303273c00b8Smrg# Choose a directory name for dependency files.
304273c00b8Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
305273c00b8SmrgAC_DEFUN([AM_SET_DEPDIR],
306273c00b8Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
307273c00b8SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
308273c00b8Smrg])
3096c3c2bceSmrg
3106c3c2bceSmrg
311273c00b8Smrg# AM_DEP_TRACK
312273c00b8Smrg# ------------
313273c00b8SmrgAC_DEFUN([AM_DEP_TRACK],
314273c00b8Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
315273c00b8SmrgAS_HELP_STRING(
316273c00b8Smrg  [--enable-dependency-tracking],
317273c00b8Smrg  [do not reject slow dependency extractors])
318273c00b8SmrgAS_HELP_STRING(
319273c00b8Smrg  [--disable-dependency-tracking],
320273c00b8Smrg  [speeds up one-time build])])
321273c00b8Smrgif test "x$enable_dependency_tracking" != xno; then
322273c00b8Smrg  am_depcomp="$ac_aux_dir/depcomp"
323273c00b8Smrg  AMDEPBACKSLASH='\'
324273c00b8Smrg  am__nodep='_no'
325273c00b8Smrgfi
326273c00b8SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
327273c00b8SmrgAC_SUBST([AMDEPBACKSLASH])dnl
328273c00b8Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
329273c00b8SmrgAC_SUBST([am__nodep])dnl
330273c00b8Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
331273c00b8Smrg])
3328abc0ccfSmrg
333273c00b8Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3348abc0ccfSmrg
335f6d57fdeSmrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
336273c00b8Smrg#
337273c00b8Smrg# This file is free software; the Free Software Foundation
338273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
339273c00b8Smrg# with or without modifications, as long as this notice is preserved.
3409a011757Smrg
341273c00b8Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
342273c00b8Smrg# ------------------------------
343273c00b8SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
344273c00b8Smrg[{
345273c00b8Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
346273c00b8Smrg  # are listed without --file.  Let's play safe and only enable the eval
347273c00b8Smrg  # if we detect the quoting.
348273c00b8Smrg  # TODO: see whether this extra hack can be removed once we start
349273c00b8Smrg  # requiring Autoconf 2.70 or later.
350273c00b8Smrg  AS_CASE([$CONFIG_FILES],
351273c00b8Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
352273c00b8Smrg          [*], [set x $CONFIG_FILES])
353273c00b8Smrg  shift
354273c00b8Smrg  # Used to flag and report bootstrapping failures.
355273c00b8Smrg  am_rc=0
356273c00b8Smrg  for am_mf
357273c00b8Smrg  do
358273c00b8Smrg    # Strip MF so we end up with the name of the file.
359273c00b8Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
360273c00b8Smrg    # Check whether this is an Automake generated Makefile which includes
361273c00b8Smrg    # dependency-tracking related rules and includes.
362273c00b8Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
363273c00b8Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
364273c00b8Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
365273c00b8Smrg      || continue
366273c00b8Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
367273c00b8Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
368273c00b8Smrg    AM_RUN_LOG([cd "$am_dirpart" \
369273c00b8Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
370273c00b8Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
371273c00b8Smrg  done
372273c00b8Smrg  if test $am_rc -ne 0; then
373273c00b8Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
374273c00b8Smrg    for automatic dependency tracking.  If GNU make was not used, consider
375273c00b8Smrg    re-running the configure script with MAKE="gmake" (or whatever is
376273c00b8Smrg    necessary).  You can also try re-running configure with the
377273c00b8Smrg    '--disable-dependency-tracking' option to at least be able to build
378273c00b8Smrg    the package (albeit without support for automatic dependency tracking).])
379273c00b8Smrg  fi
380273c00b8Smrg  AS_UNSET([am_dirpart])
381273c00b8Smrg  AS_UNSET([am_filepart])
382273c00b8Smrg  AS_UNSET([am_mf])
383273c00b8Smrg  AS_UNSET([am_rc])
384273c00b8Smrg  rm -f conftest-deps.mk
385273c00b8Smrg}
386273c00b8Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3876c3c2bceSmrg
388765b7306Smrg
389273c00b8Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
390273c00b8Smrg# -----------------------------
391273c00b8Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
392273c00b8Smrg#
393273c00b8Smrg# This code is only required when automatic dependency tracking is enabled.
394273c00b8Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
395273c00b8Smrg# order to bootstrap the dependency handling code.
396273c00b8SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
397273c00b8Smrg[AC_CONFIG_COMMANDS([depfiles],
398273c00b8Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
399273c00b8Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400765b7306Smrg
401273c00b8Smrg# Do all the work for Automake.                             -*- Autoconf -*-
4027a0395d0Smrg
403f6d57fdeSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
4048abc0ccfSmrg#
405273c00b8Smrg# This file is free software; the Free Software Foundation
406273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
407273c00b8Smrg# with or without modifications, as long as this notice is preserved.
4087a0395d0Smrg
409273c00b8Smrg# This macro actually does too much.  Some checks are only needed if
410273c00b8Smrg# your package does certain things.  But this isn't really a big deal.
4117a0395d0Smrg
412273c00b8Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
413273c00b8Smrgm4_define([AC_PROG_CC],
414273c00b8Smrgm4_defn([AC_PROG_CC])
415273c00b8Smrg[_AM_PROG_CC_C_O
416273c00b8Smrg])
417273c00b8Smrg
418273c00b8Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
419273c00b8Smrg# AM_INIT_AUTOMAKE([OPTIONS])
420273c00b8Smrg# -----------------------------------------------
421273c00b8Smrg# The call with PACKAGE and VERSION arguments is the old style
422273c00b8Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
423273c00b8Smrg# and VERSION should now be passed to AC_INIT and removed from
424273c00b8Smrg# the call to AM_INIT_AUTOMAKE.
425273c00b8Smrg# We support both call styles for the transition.  After
426273c00b8Smrg# the next Automake release, Autoconf can make the AC_INIT
427273c00b8Smrg# arguments mandatory, and then we can depend on a new Autoconf
428273c00b8Smrg# release and drop the old call support.
429273c00b8SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
430273c00b8Smrg[AC_PREREQ([2.65])dnl
431273c00b8Smrgm4_ifdef([_$0_ALREADY_INIT],
432273c00b8Smrg  [m4_fatal([$0 expanded multiple times
433273c00b8Smrg]m4_defn([_$0_ALREADY_INIT]))],
434273c00b8Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
435273c00b8Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
436273c00b8Smrgdnl the ones we care about.
437273c00b8Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
438273c00b8SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
439273c00b8SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
440273c00b8Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
441273c00b8Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
442273c00b8Smrg  # is not polluted with repeated "-I."
443273c00b8Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
444273c00b8Smrg  # test to see if srcdir already configured
445273c00b8Smrg  if test -f $srcdir/config.status; then
446273c00b8Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
447273c00b8Smrg  fi
4487a0395d0Smrgfi
4497a0395d0Smrg
450273c00b8Smrg# test whether we have cygpath
451273c00b8Smrgif test -z "$CYGPATH_W"; then
452273c00b8Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
453273c00b8Smrg    CYGPATH_W='cygpath -w'
454273c00b8Smrg  else
455273c00b8Smrg    CYGPATH_W=echo
456273c00b8Smrg  fi
4578abc0ccfSmrgfi
458273c00b8SmrgAC_SUBST([CYGPATH_W])
4597a0395d0Smrg
460273c00b8Smrg# Define the identity of the package.
461273c00b8Smrgdnl Distinguish between old-style and new-style calls.
462273c00b8Smrgm4_ifval([$2],
463273c00b8Smrg[AC_DIAGNOSE([obsolete],
464273c00b8Smrg             [$0: two- and three-arguments forms are deprecated.])
465273c00b8Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
466273c00b8Smrg AC_SUBST([PACKAGE], [$1])dnl
467273c00b8Smrg AC_SUBST([VERSION], [$2])],
468273c00b8Smrg[_AM_SET_OPTIONS([$1])dnl
469273c00b8Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
470273c00b8Smrgm4_if(
471273c00b8Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
472273c00b8Smrg  [ok:ok],,
473273c00b8Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
474273c00b8Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
475273c00b8Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4767a0395d0Smrg
477273c00b8Smrg_AM_IF_OPTION([no-define],,
478273c00b8Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
479273c00b8Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4807a0395d0Smrg
481273c00b8Smrg# Some tools Automake needs.
482273c00b8SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
483273c00b8SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
484273c00b8SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
485273c00b8SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
486273c00b8SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
487273c00b8SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
488273c00b8SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
489273c00b8SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
490273c00b8SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
491273c00b8SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
492273c00b8Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
493273c00b8Smrg# dies out for good.  For more background, see:
494273c00b8Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
495273c00b8Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
496273c00b8SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
497273c00b8Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
498273c00b8Smrg# system "awk" is bad on some platforms.
499273c00b8SmrgAC_REQUIRE([AC_PROG_AWK])dnl
500273c00b8SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
501273c00b8SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
502273c00b8Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
503273c00b8Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
504273c00b8Smrg			     [_AM_PROG_TAR([v7])])])
505273c00b8Smrg_AM_IF_OPTION([no-dependencies],,
506273c00b8Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
507273c00b8Smrg		  [_AM_DEPENDENCIES([CC])],
508273c00b8Smrg		  [m4_define([AC_PROG_CC],
509273c00b8Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
510273c00b8SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
511273c00b8Smrg		  [_AM_DEPENDENCIES([CXX])],
512273c00b8Smrg		  [m4_define([AC_PROG_CXX],
513273c00b8Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
514273c00b8SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
515273c00b8Smrg		  [_AM_DEPENDENCIES([OBJC])],
516273c00b8Smrg		  [m4_define([AC_PROG_OBJC],
517273c00b8Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
518273c00b8SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
519273c00b8Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
520273c00b8Smrg		  [m4_define([AC_PROG_OBJCXX],
521273c00b8Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
522273c00b8Smrg])
523273c00b8Smrg# Variables for tags utilities; see am/tags.am
524273c00b8Smrgif test -z "$CTAGS"; then
525273c00b8Smrg  CTAGS=ctags
5267a0395d0Smrgfi
527273c00b8SmrgAC_SUBST([CTAGS])
528273c00b8Smrgif test -z "$ETAGS"; then
529273c00b8Smrg  ETAGS=etags
5308abc0ccfSmrgfi
531273c00b8SmrgAC_SUBST([ETAGS])
532273c00b8Smrgif test -z "$CSCOPE"; then
533273c00b8Smrg  CSCOPE=cscope
5348abc0ccfSmrgfi
535273c00b8SmrgAC_SUBST([CSCOPE])
5367a0395d0Smrg
537f6d57fdeSmrgAC_REQUIRE([_AM_SILENT_RULES])dnl
538273c00b8Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
539273c00b8Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
540273c00b8Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
541273c00b8SmrgAC_CONFIG_COMMANDS_PRE(dnl
542273c00b8Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
543273c00b8Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5447a0395d0Smrg
545f6d57fdeSmrgAC_REQUIRE([_AM_PROG_RM_F])
546f6d57fdeSmrgAC_REQUIRE([_AM_PROG_XARGS_N])
5477366012aSmrg
548273c00b8Smrgdnl The trailing newline in this macro's definition is deliberate, for
549273c00b8Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
550273c00b8Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
551273c00b8Smrg])
5528abc0ccfSmrg
553273c00b8Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
554273c00b8Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
555273c00b8Smrgdnl mangled by Autoconf and run in a shell conditional statement.
556273c00b8Smrgm4_define([_AC_COMPILER_EXEEXT],
557273c00b8Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5587a0395d0Smrg
559273c00b8Smrg# When config.status generates a header, we must update the stamp-h file.
560273c00b8Smrg# This file resides in the same directory as the config header
561273c00b8Smrg# that is generated.  The stamp files are numbered to have different names.
5628abc0ccfSmrg
563273c00b8Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
564273c00b8Smrg# loop where config.status creates the headers, so we can generate
565273c00b8Smrg# our stamp files there.
566273c00b8SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
567273c00b8Smrg[# Compute $1's index in $config_headers.
568273c00b8Smrg_am_arg=$1
569273c00b8Smrg_am_stamp_count=1
570273c00b8Smrgfor _am_header in $config_headers :; do
571273c00b8Smrg  case $_am_header in
572273c00b8Smrg    $_am_arg | $_am_arg:* )
573273c00b8Smrg      break ;;
574273c00b8Smrg    * )
575273c00b8Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
576273c00b8Smrg  esac
577273c00b8Smrgdone
578273c00b8Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
5797a0395d0Smrg
580f6d57fdeSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
5817366012aSmrg#
582273c00b8Smrg# This file is free software; the Free Software Foundation
583273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
584273c00b8Smrg# with or without modifications, as long as this notice is preserved.
5857a0395d0Smrg
586273c00b8Smrg# AM_PROG_INSTALL_SH
587273c00b8Smrg# ------------------
588273c00b8Smrg# Define $install_sh.
589273c00b8SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
590273c00b8Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
591273c00b8Smrgif test x"${install_sh+set}" != xset; then
592273c00b8Smrg  case $am_aux_dir in
593273c00b8Smrg  *\ * | *\	*)
594273c00b8Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
595273c00b8Smrg  *)
596273c00b8Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
597273c00b8Smrg  esac
598273c00b8Smrgfi
599273c00b8SmrgAC_SUBST([install_sh])])
6007a0395d0Smrg
601f6d57fdeSmrg# Copyright (C) 2003-2024 Free Software Foundation, Inc.
602273c00b8Smrg#
603273c00b8Smrg# This file is free software; the Free Software Foundation
604273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
605273c00b8Smrg# with or without modifications, as long as this notice is preserved.
606273c00b8Smrg
607273c00b8Smrg# Check whether the underlying file-system supports filenames
608273c00b8Smrg# with a leading dot.  For instance MS-DOS doesn't.
609273c00b8SmrgAC_DEFUN([AM_SET_LEADING_DOT],
610273c00b8Smrg[rm -rf .tst 2>/dev/null
611273c00b8Smrgmkdir .tst 2>/dev/null
612273c00b8Smrgif test -d .tst; then
613273c00b8Smrg  am__leading_dot=.
6148abc0ccfSmrgelse
615273c00b8Smrg  am__leading_dot=_
6167a0395d0Smrgfi
617273c00b8Smrgrmdir .tst 2>/dev/null
618273c00b8SmrgAC_SUBST([am__leading_dot])])
6197a0395d0Smrg
620273c00b8Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6217a0395d0Smrg
622f6d57fdeSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
623273c00b8Smrg#
624273c00b8Smrg# This file is free software; the Free Software Foundation
625273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
626273c00b8Smrg# with or without modifications, as long as this notice is preserved.
6277a0395d0Smrg
628273c00b8Smrg# AM_MAKE_INCLUDE()
629273c00b8Smrg# -----------------
630273c00b8Smrg# Check whether make has an 'include' directive that can support all
631273c00b8Smrg# the idioms we need for our automatic dependency tracking code.
632273c00b8SmrgAC_DEFUN([AM_MAKE_INCLUDE],
633273c00b8Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
634273c00b8Smrgcat > confinc.mk << 'END'
635273c00b8Smrgam__doit:
636273c00b8Smrg	@echo this is the am__doit target >confinc.out
637273c00b8Smrg.PHONY: am__doit
638273c00b8SmrgEND
639273c00b8Smrgam__include="#"
640273c00b8Smrgam__quote=
641273c00b8Smrg# BSD make does it like this.
642273c00b8Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
643273c00b8Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
644273c00b8Smrgecho 'include confinc.mk # ignored' > confmf.GNU
645273c00b8Smrg_am_result=no
646273c00b8Smrgfor s in GNU BSD; do
647273c00b8Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
648273c00b8Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
649273c00b8Smrg      ['0:this is the am__doit target'],
650273c00b8Smrg      [AS_CASE([$s],
651273c00b8Smrg          [BSD], [am__include='.include' am__quote='"'],
652273c00b8Smrg          [am__include='include' am__quote=''])])
653273c00b8Smrg  if test "$am__include" != "#"; then
654273c00b8Smrg    _am_result="yes ($s style)"
655273c00b8Smrg    break
656273c00b8Smrg  fi
657273c00b8Smrgdone
658273c00b8Smrgrm -f confinc.* confmf.*
659273c00b8SmrgAC_MSG_RESULT([${_am_result}])
660273c00b8SmrgAC_SUBST([am__include])])
661273c00b8SmrgAC_SUBST([am__quote])])
6627a0395d0Smrg
663273c00b8Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
6647a0395d0Smrg
665f6d57fdeSmrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
666273c00b8Smrg#
667273c00b8Smrg# This file is free software; the Free Software Foundation
668273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
669273c00b8Smrg# with or without modifications, as long as this notice is preserved.
6707a0395d0Smrg
671273c00b8Smrg# AM_MISSING_PROG(NAME, PROGRAM)
672273c00b8Smrg# ------------------------------
673273c00b8SmrgAC_DEFUN([AM_MISSING_PROG],
674273c00b8Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
675273c00b8Smrg$1=${$1-"${am_missing_run}$2"}
676273c00b8SmrgAC_SUBST($1)])
6777a0395d0Smrg
678273c00b8Smrg# AM_MISSING_HAS_RUN
679273c00b8Smrg# ------------------
680273c00b8Smrg# Define MISSING if not defined so far and test if it is modern enough.
681273c00b8Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
682273c00b8SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
683273c00b8Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
684273c00b8SmrgAC_REQUIRE_AUX_FILE([missing])dnl
685273c00b8Smrgif test x"${MISSING+set}" != xset; then
686273c00b8Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
687273c00b8Smrgfi
688273c00b8Smrg# Use eval to expand $SHELL
689273c00b8Smrgif eval "$MISSING --is-lightweight"; then
690273c00b8Smrg  am_missing_run="$MISSING "
691273c00b8Smrgelse
692273c00b8Smrg  am_missing_run=
693273c00b8Smrg  AC_MSG_WARN(['missing' script is too old or missing])
694273c00b8Smrgfi
695273c00b8Smrg])
6967a0395d0Smrg
697273c00b8Smrg# Helper functions for option handling.                     -*- Autoconf -*-
6987a0395d0Smrg
699f6d57fdeSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
7007366012aSmrg#
701273c00b8Smrg# This file is free software; the Free Software Foundation
702273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
703273c00b8Smrg# with or without modifications, as long as this notice is preserved.
7047a0395d0Smrg
705273c00b8Smrg# _AM_MANGLE_OPTION(NAME)
706273c00b8Smrg# -----------------------
707273c00b8SmrgAC_DEFUN([_AM_MANGLE_OPTION],
708273c00b8Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7097a0395d0Smrg
710273c00b8Smrg# _AM_SET_OPTION(NAME)
711273c00b8Smrg# --------------------
712273c00b8Smrg# Set option NAME.  Presently that only means defining a flag for this option.
713273c00b8SmrgAC_DEFUN([_AM_SET_OPTION],
714273c00b8Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7157a0395d0Smrg
716273c00b8Smrg# _AM_SET_OPTIONS(OPTIONS)
717273c00b8Smrg# ------------------------
718273c00b8Smrg# OPTIONS is a space-separated list of Automake options.
719273c00b8SmrgAC_DEFUN([_AM_SET_OPTIONS],
720273c00b8Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7217366012aSmrg
722273c00b8Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
723273c00b8Smrg# -------------------------------------------
724273c00b8Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
725273c00b8SmrgAC_DEFUN([_AM_IF_OPTION],
726273c00b8Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7277a0395d0Smrg
728f6d57fdeSmrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
729273c00b8Smrg#
730273c00b8Smrg# This file is free software; the Free Software Foundation
731273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
732273c00b8Smrg# with or without modifications, as long as this notice is preserved.
7337a0395d0Smrg
734273c00b8Smrg# _AM_PROG_CC_C_O
735273c00b8Smrg# ---------------
736273c00b8Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
737273c00b8Smrg# to automatically call this.
738273c00b8SmrgAC_DEFUN([_AM_PROG_CC_C_O],
739273c00b8Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
740273c00b8SmrgAC_REQUIRE_AUX_FILE([compile])dnl
741273c00b8SmrgAC_LANG_PUSH([C])dnl
742273c00b8SmrgAC_CACHE_CHECK(
743273c00b8Smrg  [whether $CC understands -c and -o together],
744273c00b8Smrg  [am_cv_prog_cc_c_o],
745273c00b8Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
746273c00b8Smrg  # Make sure it works both with $CC and with simple cc.
747273c00b8Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
748273c00b8Smrg  # compilers refuse to overwrite an existing .o file with -o,
749273c00b8Smrg  # though they will create one.
750273c00b8Smrg  am_cv_prog_cc_c_o=yes
751273c00b8Smrg  for am_i in 1 2; do
752273c00b8Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
753273c00b8Smrg         && test -f conftest2.$ac_objext; then
754273c00b8Smrg      : OK
755273c00b8Smrg    else
756273c00b8Smrg      am_cv_prog_cc_c_o=no
757273c00b8Smrg      break
758273c00b8Smrg    fi
759273c00b8Smrg  done
760273c00b8Smrg  rm -f core conftest*
761273c00b8Smrg  unset am_i])
762273c00b8Smrgif test "$am_cv_prog_cc_c_o" != yes; then
763273c00b8Smrg   # Losing compiler, so override with the script.
764273c00b8Smrg   # FIXME: It is wrong to rewrite CC.
765273c00b8Smrg   # But if we don't then we get into trouble of one sort or another.
766273c00b8Smrg   # A longer-term fix would be to have automake use am__CC in this case,
767273c00b8Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
768273c00b8Smrg   CC="$am_aux_dir/compile $CC"
7698abc0ccfSmrgfi
770273c00b8SmrgAC_LANG_POP([C])])
7717a0395d0Smrg
772273c00b8Smrg# For backward compatibility.
773273c00b8SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
7747366012aSmrg
775f6d57fdeSmrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
776f6d57fdeSmrg#
777f6d57fdeSmrg# This file is free software; the Free Software Foundation
778f6d57fdeSmrg# gives unlimited permission to copy and/or distribute it,
779f6d57fdeSmrg# with or without modifications, as long as this notice is preserved.
780f6d57fdeSmrg
781f6d57fdeSmrg# _AM_PROG_RM_F
782f6d57fdeSmrg# ---------------
783f6d57fdeSmrg# Check whether 'rm -f' without any arguments works.
784f6d57fdeSmrg# https://bugs.gnu.org/10828
785f6d57fdeSmrgAC_DEFUN([_AM_PROG_RM_F],
786f6d57fdeSmrg[am__rm_f_notfound=
787f6d57fdeSmrgAS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""'])
788f6d57fdeSmrgAC_SUBST(am__rm_f_notfound)
789f6d57fdeSmrg])
790f6d57fdeSmrg
791f6d57fdeSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
7927a0395d0Smrg#
793273c00b8Smrg# This file is free software; the Free Software Foundation
794273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
795273c00b8Smrg# with or without modifications, as long as this notice is preserved.
7967366012aSmrg
797273c00b8Smrg# AM_RUN_LOG(COMMAND)
798273c00b8Smrg# -------------------
799273c00b8Smrg# Run COMMAND, save the exit status in ac_status, and log it.
800273c00b8Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
801273c00b8SmrgAC_DEFUN([AM_RUN_LOG],
802273c00b8Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
803273c00b8Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
804273c00b8Smrg   ac_status=$?
805273c00b8Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
806273c00b8Smrg   (exit $ac_status); }])
8077a0395d0Smrg
808273c00b8Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8097a0395d0Smrg
810f6d57fdeSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
81140c5344fSmrg#
812273c00b8Smrg# This file is free software; the Free Software Foundation
813273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
814273c00b8Smrg# with or without modifications, as long as this notice is preserved.
8157a0395d0Smrg
816f6d57fdeSmrg# _AM_SLEEP_FRACTIONAL_SECONDS
817f6d57fdeSmrg# ----------------------------
818f6d57fdeSmrgAC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl
819f6d57fdeSmrgAC_CACHE_CHECK([whether sleep supports fractional seconds],
820f6d57fdeSmrg               am_cv_sleep_fractional_seconds, [dnl
821f6d57fdeSmrgAS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes],
822f6d57fdeSmrg                                 [am_cv_sleep_fractional_seconds=no])
823f6d57fdeSmrg])])
824f6d57fdeSmrg
825f6d57fdeSmrg# _AM_FILESYSTEM_TIMESTAMP_RESOLUTION
826f6d57fdeSmrg# -----------------------------------
827f6d57fdeSmrg# Determine the filesystem's resolution for file modification
828f6d57fdeSmrg# timestamps.  The coarsest we know of is FAT, with a resolution
829f6d57fdeSmrg# of only two seconds, even with the most recent "exFAT" extensions.
830f6d57fdeSmrg# The finest (e.g. ext4 with large inodes, XFS, ZFS) is one
831f6d57fdeSmrg# nanosecond, matching clock_gettime.  However, it is probably not
832f6d57fdeSmrg# possible to delay execution of a shell script for less than one
833f6d57fdeSmrg# millisecond, due to process creation overhead and scheduling
834f6d57fdeSmrg# granularity, so we don't check for anything finer than that. (See below.)
835f6d57fdeSmrgAC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl
836f6d57fdeSmrgAC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS])
837f6d57fdeSmrgAC_CACHE_CHECK([filesystem timestamp resolution],
838f6d57fdeSmrg               am_cv_filesystem_timestamp_resolution, [dnl
839f6d57fdeSmrg# Default to the worst case.
840f6d57fdeSmrgam_cv_filesystem_timestamp_resolution=2
841f6d57fdeSmrg
842f6d57fdeSmrg# Only try to go finer than 1 sec if sleep can do it.
843f6d57fdeSmrg# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work,
844f6d57fdeSmrg# - 1 sec is not much of a win compared to 2 sec, and
845f6d57fdeSmrg# - it takes 2 seconds to perform the test whether 1 sec works.
846f6d57fdeSmrg# 
847f6d57fdeSmrg# Instead, just use the default 2s on platforms that have 1s resolution,
848f6d57fdeSmrg# accept the extra 1s delay when using $sleep in the Automake tests, in
849f6d57fdeSmrg# exchange for not incurring the 2s delay for running the test for all
850f6d57fdeSmrg# packages.
851f6d57fdeSmrg#
852f6d57fdeSmrgam_try_resolutions=
853f6d57fdeSmrgif test "$am_cv_sleep_fractional_seconds" = yes; then
854f6d57fdeSmrg  # Even a millisecond often causes a bunch of false positives,
855f6d57fdeSmrg  # so just try a hundredth of a second. The time saved between .001 and
856f6d57fdeSmrg  # .01 is not terribly consequential.
857f6d57fdeSmrg  am_try_resolutions="0.01 0.1 $am_try_resolutions"
858f6d57fdeSmrgfi
859f6d57fdeSmrg
860f6d57fdeSmrg# In order to catch current-generation FAT out, we must *modify* files
861f6d57fdeSmrg# that already exist; the *creation* timestamp is finer.  Use names
862f6d57fdeSmrg# that make ls -t sort them differently when they have equal
863f6d57fdeSmrg# timestamps than when they have distinct timestamps, keeping
864f6d57fdeSmrg# in mind that ls -t prints the *newest* file first.
865f6d57fdeSmrgrm -f conftest.ts?
866f6d57fdeSmrg: > conftest.ts1
867f6d57fdeSmrg: > conftest.ts2
868f6d57fdeSmrg: > conftest.ts3
869f6d57fdeSmrg
870f6d57fdeSmrg# Make sure ls -t actually works.  Do 'set' in a subshell so we don't
871f6d57fdeSmrg# clobber the current shell's arguments. (Outer-level square brackets
872f6d57fdeSmrg# are removed by m4; they're present so that m4 does not expand
873f6d57fdeSmrg# <dollar><star>; be careful, easy to get confused.)
874f6d57fdeSmrgif (
875f6d57fdeSmrg     set X `[ls -t conftest.ts[12]]` &&
876f6d57fdeSmrg     {
877f6d57fdeSmrg       test "$[]*" != "X conftest.ts1 conftest.ts2" ||
878f6d57fdeSmrg       test "$[]*" != "X conftest.ts2 conftest.ts1";
879f6d57fdeSmrg     }
880f6d57fdeSmrg); then :; else
881f6d57fdeSmrg  # If neither matched, then we have a broken ls.  This can happen
882f6d57fdeSmrg  # if, for instance, CONFIG_SHELL is bash and it inherits a
883f6d57fdeSmrg  # broken ls alias from the environment.  This has actually
884f6d57fdeSmrg  # happened.  Such a system could not be considered "sane".
885f6d57fdeSmrg  _AS_ECHO_UNQUOTED(
886f6d57fdeSmrg    ["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""],
887f6d57fdeSmrg    [AS_MESSAGE_LOG_FD])
888f6d57fdeSmrg  AC_MSG_FAILURE([ls -t produces unexpected output.
889f6d57fdeSmrgMake sure there is not a broken ls alias in your environment.])
890f6d57fdeSmrgfi
891f6d57fdeSmrg
892f6d57fdeSmrgfor am_try_res in $am_try_resolutions; do
893f6d57fdeSmrg  # Any one fine-grained sleep might happen to cross the boundary
894f6d57fdeSmrg  # between two values of a coarser actual resolution, but if we do
895f6d57fdeSmrg  # two fine-grained sleeps in a row, at least one of them will fall
896f6d57fdeSmrg  # entirely within a coarse interval.
897f6d57fdeSmrg  echo alpha > conftest.ts1
898f6d57fdeSmrg  sleep $am_try_res
899f6d57fdeSmrg  echo beta > conftest.ts2
900f6d57fdeSmrg  sleep $am_try_res
901f6d57fdeSmrg  echo gamma > conftest.ts3
902f6d57fdeSmrg
903f6d57fdeSmrg  # We assume that 'ls -t' will make use of high-resolution
904f6d57fdeSmrg  # timestamps if the operating system supports them at all.
905f6d57fdeSmrg  if (set X `ls -t conftest.ts?` &&
906f6d57fdeSmrg      test "$[]2" = conftest.ts3 &&
907f6d57fdeSmrg      test "$[]3" = conftest.ts2 &&
908f6d57fdeSmrg      test "$[]4" = conftest.ts1); then
909f6d57fdeSmrg    #
910f6d57fdeSmrg    # Ok, ls -t worked. If we're at a resolution of 1 second, we're done,
911f6d57fdeSmrg    # because we don't need to test make.
912f6d57fdeSmrg    make_ok=true
913f6d57fdeSmrg    if test $am_try_res != 1; then
914f6d57fdeSmrg      # But if we've succeeded so far with a subsecond resolution, we
915f6d57fdeSmrg      # have one more thing to check: make. It can happen that
916f6d57fdeSmrg      # everything else supports the subsecond mtimes, but make doesn't;
917f6d57fdeSmrg      # notably on macOS, which ships make 3.81 from 2006 (the last one
918f6d57fdeSmrg      # released under GPLv2). https://bugs.gnu.org/68808
919f6d57fdeSmrg      # 
920f6d57fdeSmrg      # We test $MAKE if it is defined in the environment, else "make".
921f6d57fdeSmrg      # It might get overridden later, but our hope is that in practice
922f6d57fdeSmrg      # it does not matter: it is the system "make" which is (by far)
923f6d57fdeSmrg      # the most likely to be broken, whereas if the user overrides it,
924f6d57fdeSmrg      # probably they did so with a better, or at least not worse, make.
925f6d57fdeSmrg      # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html
926f6d57fdeSmrg      #
927f6d57fdeSmrg      # Create a Makefile (real tab character here):
928f6d57fdeSmrg      rm -f conftest.mk
929f6d57fdeSmrg      echo 'conftest.ts1: conftest.ts2' >conftest.mk
930f6d57fdeSmrg      echo '	touch conftest.ts2' >>conftest.mk
931f6d57fdeSmrg      #
932f6d57fdeSmrg      # Now, running
933f6d57fdeSmrg      #   touch conftest.ts1; touch conftest.ts2; make
934f6d57fdeSmrg      # should touch ts1 because ts2 is newer. This could happen by luck,
935f6d57fdeSmrg      # but most often, it will fail if make's support is insufficient. So
936f6d57fdeSmrg      # test for several consecutive successes.
937f6d57fdeSmrg      #
938f6d57fdeSmrg      # (We reuse conftest.ts[12] because we still want to modify existing
939f6d57fdeSmrg      # files, not create new ones, per above.)
940f6d57fdeSmrg      n=0
941f6d57fdeSmrg      make=${MAKE-make}
942f6d57fdeSmrg      until test $n -eq 3; do
943f6d57fdeSmrg        echo one > conftest.ts1
944f6d57fdeSmrg        sleep $am_try_res
945f6d57fdeSmrg        echo two > conftest.ts2 # ts2 should now be newer than ts1
946f6d57fdeSmrg        if $make -f conftest.mk | grep 'up to date' >/dev/null; then
947f6d57fdeSmrg          make_ok=false
948f6d57fdeSmrg          break # out of $n loop
949f6d57fdeSmrg        fi
950f6d57fdeSmrg        n=`expr $n + 1`
951f6d57fdeSmrg      done
952f6d57fdeSmrg    fi
953f6d57fdeSmrg    #
954f6d57fdeSmrg    if $make_ok; then
955f6d57fdeSmrg      # Everything we know to check worked out, so call this resolution good.
956f6d57fdeSmrg      am_cv_filesystem_timestamp_resolution=$am_try_res
957f6d57fdeSmrg      break # out of $am_try_res loop
958f6d57fdeSmrg    fi
959f6d57fdeSmrg    # Otherwise, we'll go on to check the next resolution.
960f6d57fdeSmrg  fi
961f6d57fdeSmrgdone
962f6d57fdeSmrgrm -f conftest.ts?
963f6d57fdeSmrg# (end _am_filesystem_timestamp_resolution)
964f6d57fdeSmrg])])
965f6d57fdeSmrg
966273c00b8Smrg# AM_SANITY_CHECK
967273c00b8Smrg# ---------------
968273c00b8SmrgAC_DEFUN([AM_SANITY_CHECK],
969f6d57fdeSmrg[AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION])
970f6d57fdeSmrg# This check should not be cached, as it may vary across builds of
971f6d57fdeSmrg# different projects.
972f6d57fdeSmrgAC_MSG_CHECKING([whether build environment is sane])
973273c00b8Smrg# Reject unsafe characters in $srcdir or the absolute working directory
974273c00b8Smrg# name.  Accept space and tab only in the latter.
975273c00b8Smrgam_lf='
976273c00b8Smrg'
977273c00b8Smrgcase `pwd` in
978273c00b8Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
979273c00b8Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
980273c00b8Smrgesac
981273c00b8Smrgcase $srcdir in
982273c00b8Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
983273c00b8Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
984273c00b8Smrgesac
9857366012aSmrg
986273c00b8Smrg# Do 'set' in a subshell so we don't clobber the current shell's
987273c00b8Smrg# arguments.  Must try -L first in case configure is actually a
988273c00b8Smrg# symlink; some systems play weird games with the mod time of symlinks
989273c00b8Smrg# (eg FreeBSD returns the mod time of the symlink's containing
990273c00b8Smrg# directory).
991f6d57fdeSmrgam_build_env_is_sane=no
992f6d57fdeSmrgam_has_slept=no
993f6d57fdeSmrgrm -f conftest.file
994f6d57fdeSmrgfor am_try in 1 2; do
995f6d57fdeSmrg  echo "timestamp, slept: $am_has_slept" > conftest.file
996f6d57fdeSmrg  if (
997f6d57fdeSmrg    set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
998f6d57fdeSmrg    if test "$[]*" = "X"; then
999f6d57fdeSmrg      # -L didn't work.
1000f6d57fdeSmrg      set X `ls -t "$srcdir/configure" conftest.file`
1001f6d57fdeSmrg    fi
1002f6d57fdeSmrg    test "$[]2" = conftest.file
1003f6d57fdeSmrg  ); then
1004f6d57fdeSmrg    am_build_env_is_sane=yes
1005f6d57fdeSmrg    break
1006f6d57fdeSmrg  fi
1007f6d57fdeSmrg  # Just in case.
1008f6d57fdeSmrg  sleep "$am_cv_filesystem_timestamp_resolution"
1009f6d57fdeSmrg  am_has_slept=yes
1010f6d57fdeSmrgdone
1011f6d57fdeSmrg
1012f6d57fdeSmrgAC_MSG_RESULT([$am_build_env_is_sane])
1013f6d57fdeSmrgif test "$am_build_env_is_sane" = no; then
1014f6d57fdeSmrg  AC_MSG_ERROR([newly created file is older than distributed files!
1015273c00b8SmrgCheck your system clock])
10167366012aSmrgfi
1017f6d57fdeSmrg
1018273c00b8Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
1019273c00b8Smrg# generated files are strictly newer.
1020273c00b8Smrgam_sleep_pid=
1021f6d57fdeSmrgAS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl
1022f6d57fdeSmrg  ( sleep "$am_cv_filesystem_timestamp_resolution" ) &
1023273c00b8Smrg  am_sleep_pid=$!
1024f6d57fdeSmrg])
1025273c00b8SmrgAC_CONFIG_COMMANDS_PRE(
1026273c00b8Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
1027273c00b8Smrg   if test -n "$am_sleep_pid"; then
1028273c00b8Smrg     # Hide warnings about reused PIDs.
1029273c00b8Smrg     wait $am_sleep_pid 2>/dev/null
1030273c00b8Smrg   fi
1031273c00b8Smrg   AC_MSG_RESULT([done])])
1032273c00b8Smrgrm -f conftest.file
1033273c00b8Smrg])
10347a0395d0Smrg
1035f6d57fdeSmrg# Copyright (C) 2009-2024 Free Software Foundation, Inc.
10368abc0ccfSmrg#
1037273c00b8Smrg# This file is free software; the Free Software Foundation
1038273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
1039273c00b8Smrg# with or without modifications, as long as this notice is preserved.
10407a0395d0Smrg
1041f6d57fdeSmrg# _AM_SILENT_RULES
1042f6d57fdeSmrg# ----------------
1043f6d57fdeSmrg# Enable less verbose build rules support.
1044f6d57fdeSmrgAC_DEFUN([_AM_SILENT_RULES],
1045f6d57fdeSmrg[AM_DEFAULT_VERBOSITY=1
1046f6d57fdeSmrgAC_ARG_ENABLE([silent-rules], [dnl
1047273c00b8SmrgAS_HELP_STRING(
1048273c00b8Smrg  [--enable-silent-rules],
1049273c00b8Smrg  [less verbose build output (undo: "make V=1")])
1050273c00b8SmrgAS_HELP_STRING(
1051273c00b8Smrg  [--disable-silent-rules],
1052273c00b8Smrg  [verbose build output (undo: "make V=0")])dnl
1053273c00b8Smrg])
1054273c00b8Smrgdnl
1055273c00b8Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
1056273c00b8Smrgdnl do not support nested variable expansions.
1057273c00b8Smrgdnl See automake bug#9928 and bug#10237.
1058273c00b8Smrgam_make=${MAKE-make}
1059273c00b8SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
1060273c00b8Smrg   [am_cv_make_support_nested_variables],
1061273c00b8Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
1062273c00b8SmrgBAR0=false
1063273c00b8SmrgBAR1=true
1064273c00b8SmrgV=1
1065273c00b8Smrgam__doit:
1066273c00b8Smrg	@$(TRUE)
1067273c00b8Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
1068273c00b8Smrg  am_cv_make_support_nested_variables=yes
10698abc0ccfSmrgelse
1070273c00b8Smrg  am_cv_make_support_nested_variables=no
1071273c00b8Smrgfi])
1072273c00b8SmrgAC_SUBST([AM_V])dnl
1073273c00b8SmrgAM_SUBST_NOTMAKE([AM_V])dnl
1074273c00b8SmrgAC_SUBST([AM_DEFAULT_V])dnl
1075273c00b8SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
1076273c00b8SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
1077273c00b8SmrgAM_BACKSLASH='\'
1078273c00b8SmrgAC_SUBST([AM_BACKSLASH])dnl
1079273c00b8Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
1080f6d57fdeSmrgdnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls
1081f6d57fdeSmrgdnl to AM_SILENT_RULES to change the default value.
1082f6d57fdeSmrgAC_CONFIG_COMMANDS_PRE([dnl
1083f6d57fdeSmrgcase $enable_silent_rules in @%:@ (((
1084f6d57fdeSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
1085f6d57fdeSmrg   no) AM_DEFAULT_VERBOSITY=1;;
1086f6d57fdeSmrgesac
1087f6d57fdeSmrgif test $am_cv_make_support_nested_variables = yes; then
1088f6d57fdeSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
1089f6d57fdeSmrg  AM_V='$(V)'
1090f6d57fdeSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
1091f6d57fdeSmrgelse
1092f6d57fdeSmrg  AM_V=$AM_DEFAULT_VERBOSITY
1093f6d57fdeSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
1094f6d57fdeSmrgfi
1095f6d57fdeSmrg])dnl
1096273c00b8Smrg])
10977366012aSmrg
1098f6d57fdeSmrg# AM_SILENT_RULES([DEFAULT])
1099f6d57fdeSmrg# --------------------------
1100f6d57fdeSmrg# Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or
1101f6d57fdeSmrg# empty being verbose).
1102f6d57fdeSmrgAC_DEFUN([AM_SILENT_RULES],
1103f6d57fdeSmrg[AC_REQUIRE([_AM_SILENT_RULES])
1104f6d57fdeSmrgAM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])])
1105f6d57fdeSmrg
1106f6d57fdeSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
11078abc0ccfSmrg#
1108273c00b8Smrg# This file is free software; the Free Software Foundation
1109273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
1110273c00b8Smrg# with or without modifications, as long as this notice is preserved.
11117366012aSmrg
1112273c00b8Smrg# AM_PROG_INSTALL_STRIP
1113273c00b8Smrg# ---------------------
1114273c00b8Smrg# One issue with vendor 'install' (even GNU) is that you can't
1115273c00b8Smrg# specify the program used to strip binaries.  This is especially
1116273c00b8Smrg# annoying in cross-compiling environments, where the build's strip
1117273c00b8Smrg# is unlikely to handle the host's binaries.
1118273c00b8Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
1119273c00b8Smrg# always use install-sh in "make install-strip", and initialize
1120273c00b8Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
1121273c00b8SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
1122273c00b8Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
1123273c00b8Smrg# Installed binaries are usually stripped using 'strip' when the user
1124273c00b8Smrg# run "make install-strip".  However 'strip' might not be the right
1125273c00b8Smrg# tool to use in cross-compilation environments, therefore Automake
1126273c00b8Smrg# will honor the 'STRIP' environment variable to overrule this program.
1127273c00b8Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
1128273c00b8Smrgif test "$cross_compiling" != no; then
1129273c00b8Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
11308abc0ccfSmrgfi
1131273c00b8SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
1132273c00b8SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
11337366012aSmrg
1134f6d57fdeSmrg# Copyright (C) 2006-2024 Free Software Foundation, Inc.
11352852888eSmrg#
1136273c00b8Smrg# This file is free software; the Free Software Foundation
1137273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
1138273c00b8Smrg# with or without modifications, as long as this notice is preserved.
11392852888eSmrg
1140273c00b8Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
1141273c00b8Smrg# ---------------------------
1142273c00b8Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1143273c00b8Smrg# This macro is traced by Automake.
1144273c00b8SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
114540c5344fSmrg
1146273c00b8Smrg# AM_SUBST_NOTMAKE(VARIABLE)
1147273c00b8Smrg# --------------------------
1148273c00b8Smrg# Public sister of _AM_SUBST_NOTMAKE.
1149273c00b8SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
115040c5344fSmrg
1151273c00b8Smrg# Check how to create a tarball.                            -*- Autoconf -*-
11522852888eSmrg
1153f6d57fdeSmrg# Copyright (C) 2004-2024 Free Software Foundation, Inc.
11542852888eSmrg#
1155273c00b8Smrg# This file is free software; the Free Software Foundation
1156273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
1157273c00b8Smrg# with or without modifications, as long as this notice is preserved.
1158273c00b8Smrg
1159273c00b8Smrg# _AM_PROG_TAR(FORMAT)
1160273c00b8Smrg# --------------------
1161273c00b8Smrg# Check how to create a tarball in format FORMAT.
1162273c00b8Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
11632852888eSmrg#
1164273c00b8Smrg# Substitute a variable $(am__tar) that is a command
1165273c00b8Smrg# writing to stdout a FORMAT-tarball containing the directory
1166273c00b8Smrg# $tardir.
1167273c00b8Smrg#     tardir=directory && $(am__tar) > result.tar
11682852888eSmrg#
1169273c00b8Smrg# Substitute a variable $(am__untar) that extract such
1170273c00b8Smrg# a tarball read from stdin.
1171273c00b8Smrg#     $(am__untar) < result.tar
11722852888eSmrg#
1173273c00b8SmrgAC_DEFUN([_AM_PROG_TAR],
1174273c00b8Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1175273c00b8Smrg# in the wild :-(  We should find a proper way to deprecate it ...
1176273c00b8SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
11772852888eSmrg
1178273c00b8Smrg# We'll loop over all known methods to create a tar archive until one works.
1179273c00b8Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
11802852888eSmrg
1181273c00b8Smrgm4_if([$1], [v7],
1182273c00b8Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
11837366012aSmrg
1184273c00b8Smrg  [m4_case([$1],
1185273c00b8Smrg    [ustar],
1186273c00b8Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1187273c00b8Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1188273c00b8Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1189273c00b8Smrg      # and bug#13588).
1190273c00b8Smrg      am_max_uid=2097151 # 2^21 - 1
1191273c00b8Smrg      am_max_gid=$am_max_uid
1192273c00b8Smrg      # The $UID and $GID variables are not portable, so we need to resort
1193273c00b8Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1194273c00b8Smrg      # below are definitely unexpected, so allow the users to see them
1195273c00b8Smrg      # (that is, avoid stderr redirection).
1196273c00b8Smrg      am_uid=`id -u || echo unknown`
1197273c00b8Smrg      am_gid=`id -g || echo unknown`
1198273c00b8Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1199f6d57fdeSmrg      if test x$am_uid = xunknown; then
1200f6d57fdeSmrg        AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work])
1201f6d57fdeSmrg      elif test $am_uid -le $am_max_uid; then
1202f6d57fdeSmrg        AC_MSG_RESULT([yes])
1203273c00b8Smrg      else
1204f6d57fdeSmrg        AC_MSG_RESULT([no])
1205f6d57fdeSmrg        _am_tools=none
1206273c00b8Smrg      fi
1207273c00b8Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1208f6d57fdeSmrg      if test x$gm_gid = xunknown; then
1209f6d57fdeSmrg        AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work])
1210f6d57fdeSmrg      elif test $am_gid -le $am_max_gid; then
1211f6d57fdeSmrg        AC_MSG_RESULT([yes])
1212273c00b8Smrg      else
1213273c00b8Smrg        AC_MSG_RESULT([no])
1214273c00b8Smrg        _am_tools=none
1215273c00b8Smrg      fi],
12167a0395d0Smrg
1217273c00b8Smrg  [pax],
1218273c00b8Smrg    [],
12197a0395d0Smrg
1220273c00b8Smrg  [m4_fatal([Unknown tar format])])
12217a0395d0Smrg
1222273c00b8Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
122340c5344fSmrg
1224273c00b8Smrg  # Go ahead even if we have the value already cached.  We do so because we
1225273c00b8Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1226273c00b8Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
122740c5344fSmrg
1228273c00b8Smrg  for _am_tool in $_am_tools; do
1229273c00b8Smrg    case $_am_tool in
1230273c00b8Smrg    gnutar)
1231273c00b8Smrg      for _am_tar in tar gnutar gtar; do
1232273c00b8Smrg        AM_RUN_LOG([$_am_tar --version]) && break
1233273c00b8Smrg      done
1234273c00b8Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1235273c00b8Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1236273c00b8Smrg      am__untar="$_am_tar -xf -"
1237273c00b8Smrg      ;;
1238273c00b8Smrg    plaintar)
1239273c00b8Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1240273c00b8Smrg      # ustar tarball either.
1241273c00b8Smrg      (tar --version) >/dev/null 2>&1 && continue
1242273c00b8Smrg      am__tar='tar chf - "$$tardir"'
1243273c00b8Smrg      am__tar_='tar chf - "$tardir"'
1244273c00b8Smrg      am__untar='tar xf -'
1245273c00b8Smrg      ;;
1246273c00b8Smrg    pax)
1247273c00b8Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
1248273c00b8Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
1249273c00b8Smrg      am__untar='pax -r'
1250273c00b8Smrg      ;;
1251273c00b8Smrg    cpio)
1252273c00b8Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1253273c00b8Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1254273c00b8Smrg      am__untar='cpio -i -H $1 -d'
1255273c00b8Smrg      ;;
1256273c00b8Smrg    none)
1257273c00b8Smrg      am__tar=false
1258273c00b8Smrg      am__tar_=false
1259273c00b8Smrg      am__untar=false
1260273c00b8Smrg      ;;
1261273c00b8Smrg    esac
12622adc0320Smrg
1263273c00b8Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
1264273c00b8Smrg    # and am__untar set.
1265273c00b8Smrg    test -n "${am_cv_prog_tar_$1}" && break
12668abc0ccfSmrg
1267273c00b8Smrg    # tar/untar a dummy directory, and stop if the command works.
1268273c00b8Smrg    rm -rf conftest.dir
1269273c00b8Smrg    mkdir conftest.dir
1270273c00b8Smrg    echo GrepMe > conftest.dir/file
1271273c00b8Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1272273c00b8Smrg    rm -rf conftest.dir
1273273c00b8Smrg    if test -s conftest.tar; then
1274273c00b8Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
1275273c00b8Smrg      AM_RUN_LOG([cat conftest.dir/file])
1276273c00b8Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1277273c00b8Smrg    fi
1278273c00b8Smrg  done
1279273c00b8Smrg  rm -rf conftest.dir
12808abc0ccfSmrg
1281273c00b8Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1282273c00b8Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
12838abc0ccfSmrg
1284273c00b8SmrgAC_SUBST([am__tar])
1285273c00b8SmrgAC_SUBST([am__untar])
1286273c00b8Smrg]) # _AM_PROG_TAR
12878abc0ccfSmrg
1288f6d57fdeSmrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
1289f6d57fdeSmrg#
1290f6d57fdeSmrg# This file is free software; the Free Software Foundation
1291f6d57fdeSmrg# gives unlimited permission to copy and/or distribute it,
1292f6d57fdeSmrg# with or without modifications, as long as this notice is preserved.
1293f6d57fdeSmrg
1294f6d57fdeSmrg# _AM_PROG_XARGS_N
1295f6d57fdeSmrg# ----------------
1296f6d57fdeSmrg# Check whether 'xargs -n' works.  It should work everywhere, so the fallback
1297f6d57fdeSmrg# is not optimized at all as we never expect to use it.
1298f6d57fdeSmrgAC_DEFUN([_AM_PROG_XARGS_N],
1299f6d57fdeSmrg[AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl
1300f6d57fdeSmrgAS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2
1301f6d57fdeSmrg3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])])
1302f6d57fdeSmrgAS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl
1303f6d57fdeSmrg  am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }'
1304f6d57fdeSmrg])dnl
1305f6d57fdeSmrgAC_SUBST(am__xargs_n)
1306f6d57fdeSmrg])
1307f6d57fdeSmrg
1308273c00b8Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1309273c00b8Smrgdnl serial 11 (pkg-config-0.29)
1310273c00b8Smrgdnl
1311273c00b8Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1312273c00b8Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1313273c00b8Smrgdnl
1314273c00b8Smrgdnl This program is free software; you can redistribute it and/or modify
1315273c00b8Smrgdnl it under the terms of the GNU General Public License as published by
1316273c00b8Smrgdnl the Free Software Foundation; either version 2 of the License, or
1317273c00b8Smrgdnl (at your option) any later version.
1318273c00b8Smrgdnl
1319273c00b8Smrgdnl This program is distributed in the hope that it will be useful, but
1320273c00b8Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1321273c00b8Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1322273c00b8Smrgdnl General Public License for more details.
1323273c00b8Smrgdnl
1324273c00b8Smrgdnl You should have received a copy of the GNU General Public License
1325273c00b8Smrgdnl along with this program; if not, write to the Free Software
1326273c00b8Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1327273c00b8Smrgdnl 02111-1307, USA.
1328273c00b8Smrgdnl
1329273c00b8Smrgdnl As a special exception to the GNU General Public License, if you
1330273c00b8Smrgdnl distribute this file as part of a program that contains a
1331273c00b8Smrgdnl configuration script generated by Autoconf, you may include it under
1332273c00b8Smrgdnl the same distribution terms that you use for the rest of that
1333273c00b8Smrgdnl program.
13348abc0ccfSmrg
1335273c00b8Smrgdnl PKG_PREREQ(MIN-VERSION)
1336273c00b8Smrgdnl -----------------------
1337273c00b8Smrgdnl Since: 0.29
1338273c00b8Smrgdnl
1339273c00b8Smrgdnl Verify that the version of the pkg-config macros are at least
1340273c00b8Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1341273c00b8Smrgdnl installed version of pkg-config, this checks the developer's version
1342273c00b8Smrgdnl of pkg.m4 when generating configure.
1343273c00b8Smrgdnl
1344273c00b8Smrgdnl To ensure that this macro is defined, also add:
1345273c00b8Smrgdnl m4_ifndef([PKG_PREREQ],
1346273c00b8Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1347273c00b8Smrgdnl
1348273c00b8Smrgdnl See the "Since" comment for each macro you use to see what version
1349273c00b8Smrgdnl of the macros you require.
1350273c00b8Smrgm4_defun([PKG_PREREQ],
1351273c00b8Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
1352273c00b8Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1353273c00b8Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1354273c00b8Smrg])dnl PKG_PREREQ
13558abc0ccfSmrg
1356273c00b8Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1357273c00b8Smrgdnl ----------------------------------
1358273c00b8Smrgdnl Since: 0.16
1359273c00b8Smrgdnl
1360273c00b8Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1361273c00b8Smrgdnl first found in the path. Checks that the version of pkg-config found
1362273c00b8Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1363273c00b8Smrgdnl used since that's the first version where most current features of
1364273c00b8Smrgdnl pkg-config existed.
1365273c00b8SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1366273c00b8Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1367273c00b8Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1368273c00b8Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1369273c00b8SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1370273c00b8SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1371273c00b8SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1372273c00b8Smrg
1373273c00b8Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1374273c00b8Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
13758abc0ccfSmrgfi
1376273c00b8Smrgif test -n "$PKG_CONFIG"; then
1377273c00b8Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
1378273c00b8Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1379273c00b8Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1380273c00b8Smrg		AC_MSG_RESULT([yes])
1381273c00b8Smrg	else
1382273c00b8Smrg		AC_MSG_RESULT([no])
1383273c00b8Smrg		PKG_CONFIG=""
1384273c00b8Smrg	fi
1385273c00b8Smrgfi[]dnl
1386273c00b8Smrg])dnl PKG_PROG_PKG_CONFIG
13878abc0ccfSmrg
1388273c00b8Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1389273c00b8Smrgdnl -------------------------------------------------------------------
1390273c00b8Smrgdnl Since: 0.18
1391273c00b8Smrgdnl
1392273c00b8Smrgdnl Check to see whether a particular set of modules exists. Similar to
1393273c00b8Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1394273c00b8Smrgdnl
1395273c00b8Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1396273c00b8Smrgdnl only at the first occurence in configure.ac, so if the first place
1397273c00b8Smrgdnl it's called might be skipped (such as if it is within an "if", you
1398273c00b8Smrgdnl have to call PKG_CHECK_EXISTS manually
1399273c00b8SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1400273c00b8Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1401273c00b8Smrgif test -n "$PKG_CONFIG" && \
1402273c00b8Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1403273c00b8Smrg  m4_default([$2], [:])
1404273c00b8Smrgm4_ifvaln([$3], [else
1405273c00b8Smrg  $3])dnl
1406273c00b8Smrgfi])
1407273c00b8Smrg
1408273c00b8Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1409273c00b8Smrgdnl ---------------------------------------------
1410273c00b8Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1411273c00b8Smrgdnl pkg_failed based on the result.
1412273c00b8Smrgm4_define([_PKG_CONFIG],
1413273c00b8Smrg[if test -n "$$1"; then
1414273c00b8Smrg    pkg_cv_[]$1="$$1"
1415273c00b8Smrg elif test -n "$PKG_CONFIG"; then
1416273c00b8Smrg    PKG_CHECK_EXISTS([$3],
1417273c00b8Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1418273c00b8Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
1419273c00b8Smrg		     [pkg_failed=yes])
1420273c00b8Smrg else
1421273c00b8Smrg    pkg_failed=untried
1422273c00b8Smrgfi[]dnl
1423273c00b8Smrg])dnl _PKG_CONFIG
1424273c00b8Smrg
1425273c00b8Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1426273c00b8Smrgdnl ---------------------------
1427273c00b8Smrgdnl Internal check to see if pkg-config supports short errors.
1428273c00b8SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1429273c00b8Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1430273c00b8Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1431273c00b8Smrg        _pkg_short_errors_supported=yes
14328abc0ccfSmrgelse
1433273c00b8Smrg        _pkg_short_errors_supported=no
1434273c00b8Smrgfi[]dnl
1435273c00b8Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
14368abc0ccfSmrg
14378abc0ccfSmrg
1438273c00b8Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1439273c00b8Smrgdnl   [ACTION-IF-NOT-FOUND])
1440273c00b8Smrgdnl --------------------------------------------------------------
1441273c00b8Smrgdnl Since: 0.4.0
1442273c00b8Smrgdnl
1443273c00b8Smrgdnl Note that if there is a possibility the first call to
1444273c00b8Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1445273c00b8Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1446273c00b8SmrgAC_DEFUN([PKG_CHECK_MODULES],
1447273c00b8Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1448273c00b8SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1449273c00b8SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1450273c00b8Smrg
1451273c00b8Smrgpkg_failed=no
1452273c00b8SmrgAC_MSG_CHECKING([for $1])
1453273c00b8Smrg
1454273c00b8Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1455273c00b8Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1456273c00b8Smrg
1457273c00b8Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1458273c00b8Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1459273c00b8SmrgSee the pkg-config man page for more details.])
1460273c00b8Smrg
1461273c00b8Smrgif test $pkg_failed = yes; then
1462273c00b8Smrg   	AC_MSG_RESULT([no])
1463273c00b8Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1464273c00b8Smrg        if test $_pkg_short_errors_supported = yes; then
1465273c00b8Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1466273c00b8Smrg        else 
1467273c00b8Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1468273c00b8Smrg        fi
1469273c00b8Smrg	# Put the nasty error message in config.log where it belongs
1470273c00b8Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
14718abc0ccfSmrg
1472273c00b8Smrg	m4_default([$4], [AC_MSG_ERROR(
1473273c00b8Smrg[Package requirements ($2) were not met:
14748abc0ccfSmrg
1475273c00b8Smrg$$1_PKG_ERRORS
14768abc0ccfSmrg
1477273c00b8SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1478273c00b8Smrginstalled software in a non-standard prefix.
1479273c00b8Smrg
1480273c00b8Smrg_PKG_TEXT])[]dnl
1481273c00b8Smrg        ])
1482273c00b8Smrgelif test $pkg_failed = untried; then
1483273c00b8Smrg     	AC_MSG_RESULT([no])
1484273c00b8Smrg	m4_default([$4], [AC_MSG_FAILURE(
1485273c00b8Smrg[The pkg-config script could not be found or is too old.  Make sure it
1486273c00b8Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1487273c00b8Smrgpath to pkg-config.
1488273c00b8Smrg
1489273c00b8Smrg_PKG_TEXT
1490273c00b8Smrg
1491273c00b8SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1492273c00b8Smrg        ])
14938abc0ccfSmrgelse
1494273c00b8Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1495273c00b8Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1496273c00b8Smrg        AC_MSG_RESULT([yes])
1497273c00b8Smrg	$3
1498273c00b8Smrgfi[]dnl
1499273c00b8Smrg])dnl PKG_CHECK_MODULES
15008abc0ccfSmrg
15018abc0ccfSmrg
1502273c00b8Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1503273c00b8Smrgdnl   [ACTION-IF-NOT-FOUND])
1504273c00b8Smrgdnl ---------------------------------------------------------------------
1505273c00b8Smrgdnl Since: 0.29
1506273c00b8Smrgdnl
1507273c00b8Smrgdnl Checks for existence of MODULES and gathers its build flags with
1508273c00b8Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1509273c00b8Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1510273c00b8Smrgdnl
1511273c00b8Smrgdnl Note that if there is a possibility the first call to
1512273c00b8Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1513273c00b8Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1514273c00b8Smrgdnl configure.ac.
1515273c00b8SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1516273c00b8Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1517273c00b8Smrg_save_PKG_CONFIG=$PKG_CONFIG
1518273c00b8SmrgPKG_CONFIG="$PKG_CONFIG --static"
1519273c00b8SmrgPKG_CHECK_MODULES($@)
1520273c00b8SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1521273c00b8Smrg])dnl PKG_CHECK_MODULES_STATIC
15228abc0ccfSmrg
15238abc0ccfSmrg
1524273c00b8Smrgdnl PKG_INSTALLDIR([DIRECTORY])
1525273c00b8Smrgdnl -------------------------
1526273c00b8Smrgdnl Since: 0.27
1527273c00b8Smrgdnl
1528273c00b8Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
1529273c00b8Smrgdnl should install pkg-config .pc files. By default the directory is
1530273c00b8Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
1531273c00b8Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1532273c00b8Smrgdnl parameter.
1533273c00b8SmrgAC_DEFUN([PKG_INSTALLDIR],
1534273c00b8Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1535273c00b8Smrgm4_pushdef([pkg_description],
1536273c00b8Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1537273c00b8SmrgAC_ARG_WITH([pkgconfigdir],
1538273c00b8Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1539273c00b8Smrg    [with_pkgconfigdir=]pkg_default)
1540273c00b8SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1541273c00b8Smrgm4_popdef([pkg_default])
1542273c00b8Smrgm4_popdef([pkg_description])
1543273c00b8Smrg])dnl PKG_INSTALLDIR
15448abc0ccfSmrg
15458abc0ccfSmrg
1546273c00b8Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1547273c00b8Smrgdnl --------------------------------
1548273c00b8Smrgdnl Since: 0.27
1549273c00b8Smrgdnl
1550273c00b8Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1551273c00b8Smrgdnl module should install arch-independent pkg-config .pc files. By
1552273c00b8Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
1553273c00b8Smrgdnl changed by passing DIRECTORY. The user can override through the
1554273c00b8Smrgdnl --with-noarch-pkgconfigdir parameter.
1555273c00b8SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1556273c00b8Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1557273c00b8Smrgm4_pushdef([pkg_description],
1558273c00b8Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1559273c00b8SmrgAC_ARG_WITH([noarch-pkgconfigdir],
1560273c00b8Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1561273c00b8Smrg    [with_noarch_pkgconfigdir=]pkg_default)
1562273c00b8SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1563273c00b8Smrgm4_popdef([pkg_default])
1564273c00b8Smrgm4_popdef([pkg_description])
1565273c00b8Smrg])dnl PKG_NOARCH_INSTALLDIR
15668abc0ccfSmrg
15678abc0ccfSmrg
1568273c00b8Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1569273c00b8Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1570273c00b8Smrgdnl -------------------------------------------
1571273c00b8Smrgdnl Since: 0.28
1572273c00b8Smrgdnl
1573273c00b8Smrgdnl Retrieves the value of the pkg-config variable for the given module.
1574273c00b8SmrgAC_DEFUN([PKG_CHECK_VAR],
1575273c00b8Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1576273c00b8SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
15778abc0ccfSmrg
1578273c00b8Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1579273c00b8SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
15808abc0ccfSmrg
1581273c00b8SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1582273c00b8Smrg])dnl PKG_CHECK_VAR
1583273c00b8Smrg
1584273c00b8Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1585273c00b8Smrgdnl
1586273c00b8Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
1587273c00b8Smrgdnl
1588273c00b8Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1589273c00b8Smrgdnl copy of this software and associated documentation files (the "Software"),
1590273c00b8Smrgdnl to deal in the Software without restriction, including without limitation
1591273c00b8Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1592273c00b8Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1593273c00b8Smrgdnl Software is furnished to do so, subject to the following conditions:
1594273c00b8Smrgdnl
1595273c00b8Smrgdnl The above copyright notice and this permission notice (including the next
1596273c00b8Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1597273c00b8Smrgdnl Software.
1598273c00b8Smrgdnl
1599273c00b8Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1600273c00b8Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1601273c00b8Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1602273c00b8Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1603273c00b8Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1604273c00b8Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1605273c00b8Smrgdnl DEALINGS IN THE SOFTWARE.
1606273c00b8Smrg
1607273c00b8Smrg# XORG_MACROS_VERSION(required-version)
1608273c00b8Smrg# -------------------------------------
1609273c00b8Smrg# Minimum version: 1.1.0
16108abc0ccfSmrg#
1611273c00b8Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1612273c00b8Smrg# your configure.ac with the minimum required version, such as:
1613273c00b8Smrg# XORG_MACROS_VERSION(1.1)
16148abc0ccfSmrg#
1615273c00b8Smrg# To ensure that this macro is defined, also add:
1616273c00b8Smrg# m4_ifndef([XORG_MACROS_VERSION],
1617273c00b8Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
16188abc0ccfSmrg#
1619273c00b8Smrg#
1620273c00b8Smrg# See the "minimum version" comment for each macro you use to see what
1621273c00b8Smrg# version you require.
1622273c00b8Smrgm4_defun([XORG_MACROS_VERSION],[
1623f6d57fdeSmrgm4_define([vers_have], [1.20.2])
1624273c00b8Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1625273c00b8Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1626273c00b8Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1627273c00b8Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1628273c00b8Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1629273c00b8Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1630273c00b8Smrgm4_undefine([vers_have])
1631273c00b8Smrgm4_undefine([maj_have])
1632273c00b8Smrgm4_undefine([maj_needed])
1633273c00b8Smrg]) # XORG_MACROS_VERSION
16348abc0ccfSmrg
1635273c00b8Smrg# XORG_PROG_RAWCPP()
1636273c00b8Smrg# ------------------
1637273c00b8Smrg# Minimum version: 1.0.0
1638273c00b8Smrg#
1639273c00b8Smrg# Find cpp program and necessary flags for use in pre-processing text files
1640273c00b8Smrg# such as man pages and config files
1641273c00b8SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1642273c00b8SmrgAC_REQUIRE([AC_PROG_CPP])
1643273c00b8SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1644273c00b8Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
16458abc0ccfSmrg
1646273c00b8Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1647273c00b8Smrg# which is not the best choice for supporting other OS'es, but covers most
1648273c00b8Smrg# of the ones we need for now.
1649273c00b8SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1650273c00b8SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1651273c00b8Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1652273c00b8Smrg	AC_MSG_RESULT([no])
1653273c00b8Smrgelse
1654273c00b8Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1655273c00b8Smrg		RAWCPPFLAGS=-undef
1656273c00b8Smrg		AC_MSG_RESULT([yes])
1657273c00b8Smrg	# under Cygwin unix is still defined even with -undef
1658273c00b8Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1659273c00b8Smrg		RAWCPPFLAGS="-undef -ansi"
1660273c00b8Smrg		AC_MSG_RESULT([yes, with -ansi])
1661273c00b8Smrg	else
1662273c00b8Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1663273c00b8Smrg	fi
16648abc0ccfSmrgfi
1665273c00b8Smrgrm -f conftest.$ac_ext
16668abc0ccfSmrg
1667273c00b8SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1668273c00b8SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1669273c00b8Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1670273c00b8Smrg	AC_MSG_RESULT([no])
1671273c00b8Smrgelse
1672273c00b8Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1673273c00b8Smrg		TRADITIONALCPPFLAGS="-traditional"
1674273c00b8Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1675273c00b8Smrg		AC_MSG_RESULT([yes])
1676273c00b8Smrg	else
1677273c00b8Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
16788abc0ccfSmrg	fi
16798abc0ccfSmrgfi
1680273c00b8Smrgrm -f conftest.$ac_ext
1681273c00b8SmrgAC_SUBST(RAWCPPFLAGS)
1682273c00b8SmrgAC_SUBST(TRADITIONALCPPFLAGS)
1683273c00b8Smrg]) # XORG_PROG_RAWCPP
16848abc0ccfSmrg
1685273c00b8Smrg# XORG_MANPAGE_SECTIONS()
1686273c00b8Smrg# -----------------------
1687273c00b8Smrg# Minimum version: 1.0.0
1688273c00b8Smrg#
1689273c00b8Smrg# Determine which sections man pages go in for the different man page types
1690273c00b8Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1691273c00b8Smrg# Not sure if there's any better way than just hardcoding by OS name.
1692273c00b8Smrg# Override default settings by setting environment variables
1693273c00b8Smrg# Added MAN_SUBSTS in version 1.8
1694273c00b8Smrg# Added AC_PROG_SED in version 1.8
16958abc0ccfSmrg
1696273c00b8SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1697273c00b8SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1698273c00b8SmrgAC_REQUIRE([AC_PROG_SED])
16998abc0ccfSmrg
1700273c00b8Smrgcase $host_os in
1701273c00b8Smrg    solaris*)
1702273c00b8Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1703273c00b8Smrg        # check for a man page file found in later versions that use
1704273c00b8Smrg        # traditional section numbers instead
1705273c00b8Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1706273c00b8Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1707273c00b8Smrg        ;;
1708273c00b8Smrg    *) SYSV_MAN_SECTIONS=false ;;
1709273c00b8Smrgesac
17108abc0ccfSmrg
1711273c00b8Smrgif test x$APP_MAN_SUFFIX = x    ; then
1712273c00b8Smrg    APP_MAN_SUFFIX=1
1713273c00b8Smrgfi
1714273c00b8Smrgif test x$APP_MAN_DIR = x    ; then
1715273c00b8Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1716273c00b8Smrgfi
17178abc0ccfSmrg
1718273c00b8Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1719273c00b8Smrg    LIB_MAN_SUFFIX=3
1720273c00b8Smrgfi
1721273c00b8Smrgif test x$LIB_MAN_DIR = x    ; then
1722273c00b8Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1723273c00b8Smrgfi
17248abc0ccfSmrg
1725273c00b8Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1726273c00b8Smrg    case $SYSV_MAN_SECTIONS in
1727273c00b8Smrg	true)				FILE_MAN_SUFFIX=4  ;;
1728273c00b8Smrg	*)				FILE_MAN_SUFFIX=5  ;;
1729273c00b8Smrg    esac
1730273c00b8Smrgfi
1731273c00b8Smrgif test x$FILE_MAN_DIR = x    ; then
1732273c00b8Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1733273c00b8Smrgfi
17348abc0ccfSmrg
1735273c00b8Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1736273c00b8Smrg    case $SYSV_MAN_SECTIONS in
1737273c00b8Smrg	true)				MISC_MAN_SUFFIX=5  ;;
1738273c00b8Smrg	*)				MISC_MAN_SUFFIX=7  ;;
1739273c00b8Smrg    esac
1740273c00b8Smrgfi
1741273c00b8Smrgif test x$MISC_MAN_DIR = x    ; then
1742273c00b8Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1743273c00b8Smrgfi
17448abc0ccfSmrg
1745273c00b8Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1746273c00b8Smrg    case $SYSV_MAN_SECTIONS in
1747273c00b8Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1748273c00b8Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1749273c00b8Smrg    esac
1750273c00b8Smrgfi
1751273c00b8Smrgif test x$DRIVER_MAN_DIR = x    ; then
1752273c00b8Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1753273c00b8Smrgfi
17548abc0ccfSmrg
1755273c00b8Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1756273c00b8Smrg    case $SYSV_MAN_SECTIONS in
1757273c00b8Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1758273c00b8Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
1759273c00b8Smrg    esac
1760273c00b8Smrgfi
1761273c00b8Smrgif test x$ADMIN_MAN_DIR = x    ; then
1762273c00b8Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
17638abc0ccfSmrgfi
17648abc0ccfSmrg
17658abc0ccfSmrg
1766273c00b8SmrgAC_SUBST([APP_MAN_SUFFIX])
1767273c00b8SmrgAC_SUBST([LIB_MAN_SUFFIX])
1768273c00b8SmrgAC_SUBST([FILE_MAN_SUFFIX])
1769273c00b8SmrgAC_SUBST([MISC_MAN_SUFFIX])
1770273c00b8SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1771273c00b8SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1772273c00b8SmrgAC_SUBST([APP_MAN_DIR])
1773273c00b8SmrgAC_SUBST([LIB_MAN_DIR])
1774273c00b8SmrgAC_SUBST([FILE_MAN_DIR])
1775273c00b8SmrgAC_SUBST([MISC_MAN_DIR])
1776273c00b8SmrgAC_SUBST([DRIVER_MAN_DIR])
1777273c00b8SmrgAC_SUBST([ADMIN_MAN_DIR])
17788abc0ccfSmrg
1779273c00b8SmrgXORG_MAN_PAGE="X Version 11"
1780273c00b8SmrgAC_SUBST([XORG_MAN_PAGE])
1781273c00b8SmrgMAN_SUBSTS="\
1782273c00b8Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1783273c00b8Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1784273c00b8Smrg	-e 's|__xservername__|Xorg|g' \
1785273c00b8Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1786273c00b8Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1787273c00b8Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1788273c00b8Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1789273c00b8Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1790273c00b8Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1791273c00b8Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1792273c00b8Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1793273c00b8Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1794273c00b8SmrgAC_SUBST([MAN_SUBSTS])
17958abc0ccfSmrg
1796273c00b8Smrg]) # XORG_MANPAGE_SECTIONS
17978abc0ccfSmrg
1798273c00b8Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1799273c00b8Smrg# ------------------------
1800273c00b8Smrg# Minimum version: 1.7.0
1801273c00b8Smrg#
1802273c00b8Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1803273c00b8Smrg# provided by xorg-sgml-doctools, if installed.
1804273c00b8SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1805273c00b8SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1806273c00b8SmrgXORG_SGML_PATH=
1807273c00b8SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1808273c00b8Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1809273c00b8Smrg    [m4_ifval([$1],[:],
1810273c00b8Smrg        [if test x"$cross_compiling" != x"yes" ; then
1811273c00b8Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1812273c00b8Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1813273c00b8Smrg         fi])
1814273c00b8Smrg    ])
18158abc0ccfSmrg
1816273c00b8Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1817273c00b8Smrg# the path and the name of the doc stylesheet
1818273c00b8Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1819273c00b8Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1820273c00b8Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1821273c00b8Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
18228abc0ccfSmrgelse
1823273c00b8Smrg   AC_MSG_RESULT([no])
18248abc0ccfSmrgfi
18258abc0ccfSmrg
1826273c00b8SmrgAC_SUBST(XORG_SGML_PATH)
1827273c00b8SmrgAC_SUBST(STYLESHEET_SRCDIR)
1828273c00b8SmrgAC_SUBST(XSL_STYLESHEET)
1829273c00b8SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1830273c00b8Smrg]) # XORG_CHECK_SGML_DOCTOOLS
18318abc0ccfSmrg
1832273c00b8Smrg# XORG_CHECK_LINUXDOC
1833273c00b8Smrg# -------------------
1834273c00b8Smrg# Minimum version: 1.0.0
18358abc0ccfSmrg#
1836273c00b8Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1837273c00b8Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1838273c00b8Smrg# Whether or not the necessary tools and files are found can be checked
1839273c00b8Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1840273c00b8SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1841273c00b8SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1842273c00b8SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
18438abc0ccfSmrg
1844273c00b8SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
18458abc0ccfSmrg
1846273c00b8SmrgAC_MSG_CHECKING([whether to build documentation])
18478abc0ccfSmrg
1848273c00b8Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1849273c00b8Smrg   BUILDDOC=yes
1850273c00b8Smrgelse
1851273c00b8Smrg   BUILDDOC=no
1852273c00b8Smrgfi
18538abc0ccfSmrg
1854273c00b8SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
18558abc0ccfSmrg
1856273c00b8SmrgAC_MSG_RESULT([$BUILDDOC])
18578abc0ccfSmrg
1858273c00b8SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1859273c00b8Smrg
1860273c00b8Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1861273c00b8Smrg   BUILDPDFDOC=yes
1862273c00b8Smrgelse
1863273c00b8Smrg   BUILDPDFDOC=no
18648abc0ccfSmrgfi
18658abc0ccfSmrg
1866273c00b8SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
18678abc0ccfSmrg
1868273c00b8SmrgAC_MSG_RESULT([$BUILDPDFDOC])
18698abc0ccfSmrg
1870273c00b8SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1871273c00b8SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1872273c00b8SmrgMAKE_PDF="$PS2PDF"
1873273c00b8SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
187440c5344fSmrg
1875273c00b8SmrgAC_SUBST(MAKE_TEXT)
1876273c00b8SmrgAC_SUBST(MAKE_PS)
1877273c00b8SmrgAC_SUBST(MAKE_PDF)
1878273c00b8SmrgAC_SUBST(MAKE_HTML)
1879273c00b8Smrg]) # XORG_CHECK_LINUXDOC
18808abc0ccfSmrg
1881273c00b8Smrg# XORG_CHECK_DOCBOOK
1882273c00b8Smrg# -------------------
1883273c00b8Smrg# Minimum version: 1.0.0
18848abc0ccfSmrg#
1885273c00b8Smrg# Checks for the ability to build output formats from SGML DocBook source.
1886273c00b8Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1887273c00b8Smrg# indicates whether the necessary tools and files are found and, if set,
1888273c00b8Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1889273c00b8SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1890273c00b8SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
18918abc0ccfSmrg
1892273c00b8SmrgBUILDTXTDOC=no
1893273c00b8SmrgBUILDPDFDOC=no
1894273c00b8SmrgBUILDPSDOC=no
1895273c00b8SmrgBUILDHTMLDOC=no
18968abc0ccfSmrg
1897273c00b8SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1898273c00b8SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1899273c00b8SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1900273c00b8SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
19018abc0ccfSmrg
1902273c00b8SmrgAC_MSG_CHECKING([whether to build text documentation])
1903273c00b8Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1904273c00b8Smrg   test x$BUILD_TXTDOC != xno; then
1905273c00b8Smrg	BUILDTXTDOC=yes
1906273c00b8Smrgfi
1907273c00b8SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1908273c00b8SmrgAC_MSG_RESULT([$BUILDTXTDOC])
19098abc0ccfSmrg
1910273c00b8SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1911273c00b8Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1912273c00b8Smrg   test x$BUILD_PDFDOC != xno; then
1913273c00b8Smrg	BUILDPDFDOC=yes
1914273c00b8Smrgfi
1915273c00b8SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1916273c00b8SmrgAC_MSG_RESULT([$BUILDPDFDOC])
19178abc0ccfSmrg
1918273c00b8SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1919273c00b8Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1920273c00b8Smrg   test x$BUILD_PSDOC != xno; then
1921273c00b8Smrg	BUILDPSDOC=yes
1922273c00b8Smrgfi
1923273c00b8SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1924273c00b8SmrgAC_MSG_RESULT([$BUILDPSDOC])
19258abc0ccfSmrg
1926273c00b8SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1927273c00b8Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1928273c00b8Smrg   test x$BUILD_HTMLDOC != xno; then
1929273c00b8Smrg	BUILDHTMLDOC=yes
1930273c00b8Smrgfi
1931273c00b8SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1932273c00b8SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
19339a011757Smrg
1934273c00b8SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1935273c00b8SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1936273c00b8SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1937273c00b8SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
19389a011757Smrg
1939273c00b8SmrgAC_SUBST(MAKE_TEXT)
1940273c00b8SmrgAC_SUBST(MAKE_PS)
1941273c00b8SmrgAC_SUBST(MAKE_PDF)
1942273c00b8SmrgAC_SUBST(MAKE_HTML)
1943273c00b8Smrg]) # XORG_CHECK_DOCBOOK
19448abc0ccfSmrg
1945273c00b8Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1946273c00b8Smrg# ----------------
1947273c00b8Smrg# Minimum version: 1.5.0
1948273c00b8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1949273c00b8Smrg#
1950273c00b8Smrg# Documentation tools are not always available on all platforms and sometimes
1951273c00b8Smrg# not at the appropriate level. This macro enables a module to test for the
1952273c00b8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1953273c00b8Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
1954273c00b8Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1955273c00b8Smrg# --with-xmlto assumes 'auto'.
1956273c00b8Smrg#
1957273c00b8Smrg# Interface to module:
1958273c00b8Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1959273c00b8Smrg# XMLTO:	returns the path of the xmlto program found
1960273c00b8Smrg#		returns the path set by the user in the environment
1961273c00b8Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1962273c00b8Smrg#		'no' user instructs the module not to use xmlto
1963273c00b8Smrg#
1964273c00b8Smrg# Added in version 1.10.0
1965273c00b8Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1966273c00b8Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1967273c00b8Smrg#
1968273c00b8Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1969273c00b8Smrg#
1970273c00b8SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1971273c00b8SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1972273c00b8Smrgm4_define([_defopt], m4_default([$2], [auto]))
1973273c00b8SmrgAC_ARG_WITH(xmlto,
1974273c00b8Smrg	AS_HELP_STRING([--with-xmlto],
1975273c00b8Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1976273c00b8Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1977273c00b8Smrgm4_undefine([_defopt])
1978273c00b8Smrg
1979273c00b8Smrgif test "x$use_xmlto" = x"auto"; then
1980273c00b8Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1981273c00b8Smrg   if test "x$XMLTO" = "x"; then
1982273c00b8Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1983273c00b8Smrg	have_xmlto=no
1984273c00b8Smrg   else
1985273c00b8Smrg        have_xmlto=yes
1986273c00b8Smrg   fi
1987273c00b8Smrgelif test "x$use_xmlto" = x"yes" ; then
1988273c00b8Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1989273c00b8Smrg   if test "x$XMLTO" = "x"; then
1990273c00b8Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1991273c00b8Smrg   fi
1992273c00b8Smrg   have_xmlto=yes
1993273c00b8Smrgelif test "x$use_xmlto" = x"no" ; then
1994273c00b8Smrg   if test "x$XMLTO" != "x"; then
1995273c00b8Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1996273c00b8Smrg   fi
1997273c00b8Smrg   have_xmlto=no
1998273c00b8Smrgelse
1999273c00b8Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
2000273c00b8Smrgfi
2001273c00b8Smrg
2002273c00b8Smrg# Test for a minimum version of xmlto, if provided.
2003273c00b8Smrgm4_ifval([$1],
2004273c00b8Smrg[if test "$have_xmlto" = yes; then
2005273c00b8Smrg    # scrape the xmlto version
2006273c00b8Smrg    AC_MSG_CHECKING([the xmlto version])
2007273c00b8Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
2008273c00b8Smrg    AC_MSG_RESULT([$xmlto_version])
2009273c00b8Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
2010273c00b8Smrg        [if test "x$use_xmlto" = xauto; then
2011273c00b8Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
2012273c00b8Smrg            have_xmlto=no
2013273c00b8Smrg        else
2014273c00b8Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
2015273c00b8Smrg        fi])
2016273c00b8Smrgfi])
2017273c00b8Smrg
2018273c00b8Smrg# Test for the ability of xmlto to generate a text target
2019273c00b8Smrg#
2020273c00b8Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
2021273c00b8Smrg# following test for empty XML docbook files.
2022273c00b8Smrg# For compatibility reasons use the following empty XML docbook file and if
2023273c00b8Smrg# it fails try it again with a non-empty XML file.
2024273c00b8Smrghave_xmlto_text=no
2025273c00b8Smrgcat > conftest.xml << "EOF"
2026273c00b8SmrgEOF
2027273c00b8SmrgAS_IF([test "$have_xmlto" = yes],
2028273c00b8Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2029273c00b8Smrg             [have_xmlto_text=yes],
2030273c00b8Smrg             [# Try it again with a non-empty XML file.
2031273c00b8Smrg              cat > conftest.xml << "EOF"
2032273c00b8Smrg<x></x>
2033273c00b8SmrgEOF
2034273c00b8Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2035273c00b8Smrg                    [have_xmlto_text=yes],
2036273c00b8Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
2037273c00b8Smrgrm -f conftest.xml
2038273c00b8SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
2039273c00b8SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
2040273c00b8Smrg]) # XORG_WITH_XMLTO
20418abc0ccfSmrg
2042273c00b8Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
2043273c00b8Smrg# --------------------------------------------
2044273c00b8Smrg# Minimum version: 1.12.0
2045273c00b8Smrg# Minimum version for optional DEFAULT argument: 1.12.0
2046273c00b8Smrg#
2047273c00b8Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
2048273c00b8Smrg# XML-based language used for the transformation of XML documents.
2049273c00b8Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
2050273c00b8Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
2051273c00b8Smrg# The XSLT processor is often used as a standalone tool for transformations.
2052273c00b8Smrg# It should not be assumed that this tool is used only to work with documnetation.
2053273c00b8Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
2054273c00b8Smrg#
2055273c00b8Smrg# Interface to module:
2056273c00b8Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
2057273c00b8Smrg# XSLTPROC:	 returns the path of the xsltproc program found
2058273c00b8Smrg#		 returns the path set by the user in the environment
2059273c00b8Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
2060273c00b8Smrg#		  'no' user instructs the module not to use xsltproc
2061273c00b8Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
2062273c00b8Smrg#
2063273c00b8Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
2064273c00b8Smrg#
2065273c00b8SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
2066273c00b8SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
2067273c00b8Smrg# Preserves the interface, should it be implemented later
2068273c00b8Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
2069273c00b8Smrgm4_define([_defopt], m4_default([$2], [auto]))
2070273c00b8SmrgAC_ARG_WITH(xsltproc,
2071273c00b8Smrg	AS_HELP_STRING([--with-xsltproc],
2072273c00b8Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
2073273c00b8Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
2074273c00b8Smrgm4_undefine([_defopt])
20750d22642bSmrg
2076273c00b8Smrgif test "x$use_xsltproc" = x"auto"; then
2077273c00b8Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
2078273c00b8Smrg   if test "x$XSLTPROC" = "x"; then
2079273c00b8Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
2080273c00b8Smrg	have_xsltproc=no
2081273c00b8Smrg   else
2082273c00b8Smrg        have_xsltproc=yes
2083273c00b8Smrg   fi
2084273c00b8Smrgelif test "x$use_xsltproc" = x"yes" ; then
2085273c00b8Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
2086273c00b8Smrg   if test "x$XSLTPROC" = "x"; then
2087273c00b8Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
2088273c00b8Smrg   fi
2089273c00b8Smrg   have_xsltproc=yes
2090273c00b8Smrgelif test "x$use_xsltproc" = x"no" ; then
2091273c00b8Smrg   if test "x$XSLTPROC" != "x"; then
2092273c00b8Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
2093273c00b8Smrg   fi
2094273c00b8Smrg   have_xsltproc=no
2095273c00b8Smrgelse
2096273c00b8Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
2097273c00b8Smrgfi
20988abc0ccfSmrg
2099273c00b8SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
2100273c00b8Smrg]) # XORG_WITH_XSLTPROC
21018abc0ccfSmrg
2102273c00b8Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
2103273c00b8Smrg# ----------------------------------------
2104273c00b8Smrg# Minimum version: 1.15.0
2105273c00b8Smrg#
2106273c00b8Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
2107273c00b8Smrg# scanning arbitrary text files, extracting information from those text files,
2108273c00b8Smrg# and printing reports based on that information.
2109273c00b8Smrg#
2110273c00b8Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
2111273c00b8Smrg#
2112273c00b8Smrg# Interface to module:
2113273c00b8Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
2114273c00b8Smrg# PERL:	     returns the path of the perl program found
2115273c00b8Smrg#	     returns the path set by the user in the environment
2116273c00b8Smrg# --with-perl: 'yes' user instructs the module to use perl
2117273c00b8Smrg#	       'no' user instructs the module not to use perl
2118273c00b8Smrg# have_perl: returns yes if perl found in PATH or no
2119273c00b8Smrg#
2120273c00b8Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
2121273c00b8Smrg#
2122273c00b8SmrgAC_DEFUN([XORG_WITH_PERL],[
2123273c00b8SmrgAC_ARG_VAR([PERL], [Path to perl command])
2124273c00b8Smrg# Preserves the interface, should it be implemented later
2125273c00b8Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
2126273c00b8Smrgm4_define([_defopt], m4_default([$2], [auto]))
2127273c00b8SmrgAC_ARG_WITH(perl,
2128273c00b8Smrg	AS_HELP_STRING([--with-perl],
2129273c00b8Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
2130273c00b8Smrg	   [use_perl=$withval], [use_perl=]_defopt)
2131273c00b8Smrgm4_undefine([_defopt])
21328abc0ccfSmrg
2133273c00b8Smrgif test "x$use_perl" = x"auto"; then
2134273c00b8Smrg   AC_PATH_PROG([PERL], [perl])
2135273c00b8Smrg   if test "x$PERL" = "x"; then
2136273c00b8Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
2137273c00b8Smrg	have_perl=no
2138273c00b8Smrg   else
2139273c00b8Smrg        have_perl=yes
2140273c00b8Smrg   fi
2141273c00b8Smrgelif test "x$use_perl" = x"yes" ; then
2142273c00b8Smrg   AC_PATH_PROG([PERL], [perl])
2143273c00b8Smrg   if test "x$PERL" = "x"; then
2144273c00b8Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
2145273c00b8Smrg   fi
2146273c00b8Smrg   have_perl=yes
2147273c00b8Smrgelif test "x$use_perl" = x"no" ; then
2148273c00b8Smrg   if test "x$PERL" != "x"; then
2149273c00b8Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
2150273c00b8Smrg   fi
2151273c00b8Smrg   have_perl=no
2152273c00b8Smrgelse
2153273c00b8Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
2154273c00b8Smrgfi
21558abc0ccfSmrg
2156273c00b8SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2157273c00b8Smrg]) # XORG_WITH_PERL
21588abc0ccfSmrg
2159273c00b8Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2160273c00b8Smrg# ----------------
2161273c00b8Smrg# Minimum version: 1.5.0
2162273c00b8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
21638abc0ccfSmrg#
2164273c00b8Smrg# Documentation tools are not always available on all platforms and sometimes
2165273c00b8Smrg# not at the appropriate level. This macro enables a module to test for the
2166273c00b8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2167273c00b8Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
2168273c00b8Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2169273c00b8Smrg# --with-asciidoc assumes 'auto'.
2170273c00b8Smrg#
2171273c00b8Smrg# Interface to module:
2172273c00b8Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2173273c00b8Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
2174273c00b8Smrg#		 returns the path set by the user in the environment
2175273c00b8Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2176273c00b8Smrg#		  'no' user instructs the module not to use asciidoc
2177273c00b8Smrg#
2178273c00b8Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2179273c00b8Smrg#
2180273c00b8SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2181273c00b8SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2182273c00b8Smrgm4_define([_defopt], m4_default([$2], [auto]))
2183273c00b8SmrgAC_ARG_WITH(asciidoc,
2184273c00b8Smrg	AS_HELP_STRING([--with-asciidoc],
2185273c00b8Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2186273c00b8Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2187273c00b8Smrgm4_undefine([_defopt])
21888abc0ccfSmrg
2189273c00b8Smrgif test "x$use_asciidoc" = x"auto"; then
2190273c00b8Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2191273c00b8Smrg   if test "x$ASCIIDOC" = "x"; then
2192273c00b8Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2193273c00b8Smrg	have_asciidoc=no
2194273c00b8Smrg   else
2195273c00b8Smrg        have_asciidoc=yes
2196273c00b8Smrg   fi
2197273c00b8Smrgelif test "x$use_asciidoc" = x"yes" ; then
2198273c00b8Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2199273c00b8Smrg   if test "x$ASCIIDOC" = "x"; then
2200273c00b8Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2201273c00b8Smrg   fi
2202273c00b8Smrg   have_asciidoc=yes
2203273c00b8Smrgelif test "x$use_asciidoc" = x"no" ; then
2204273c00b8Smrg   if test "x$ASCIIDOC" != "x"; then
2205273c00b8Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2206273c00b8Smrg   fi
2207273c00b8Smrg   have_asciidoc=no
2208273c00b8Smrgelse
2209273c00b8Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2210273c00b8Smrgfi
2211273c00b8Smrgm4_ifval([$1],
2212273c00b8Smrg[if test "$have_asciidoc" = yes; then
2213273c00b8Smrg    # scrape the asciidoc version
2214273c00b8Smrg    AC_MSG_CHECKING([the asciidoc version])
2215273c00b8Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2216273c00b8Smrg    AC_MSG_RESULT([$asciidoc_version])
2217273c00b8Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2218273c00b8Smrg        [if test "x$use_asciidoc" = xauto; then
2219273c00b8Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2220273c00b8Smrg            have_asciidoc=no
2221273c00b8Smrg        else
2222273c00b8Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2223273c00b8Smrg        fi])
2224273c00b8Smrgfi])
2225273c00b8SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2226273c00b8Smrg]) # XORG_WITH_ASCIIDOC
2227273c00b8Smrg
2228273c00b8Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
2229273c00b8Smrg# -------------------------------------------
2230273c00b8Smrg# Minimum version: 1.5.0
2231273c00b8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2232273c00b8Smrg# Minimum version for optional DOT checking: 1.18.0
2233273c00b8Smrg#
2234273c00b8Smrg# Documentation tools are not always available on all platforms and sometimes
2235273c00b8Smrg# not at the appropriate level. This macro enables a module to test for the
2236273c00b8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2237273c00b8Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
2238273c00b8Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2239273c00b8Smrg# --with-doxygen assumes 'auto'.
2240273c00b8Smrg#
2241273c00b8Smrg# Interface to module:
2242273c00b8Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2243273c00b8Smrg# DOXYGEN:	 returns the path of the doxygen program found
2244273c00b8Smrg#		 returns the path set by the user in the environment
2245273c00b8Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2246273c00b8Smrg#		  'no' user instructs the module not to use doxygen
2247273c00b8Smrg#
2248273c00b8Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2249273c00b8Smrg#
2250273c00b8SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2251273c00b8SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2252273c00b8SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
2253273c00b8Smrgm4_define([_defopt], m4_default([$2], [auto]))
2254273c00b8SmrgAC_ARG_WITH(doxygen,
2255273c00b8Smrg	AS_HELP_STRING([--with-doxygen],
2256273c00b8Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2257273c00b8Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2258273c00b8Smrgm4_undefine([_defopt])
22598abc0ccfSmrg
2260273c00b8Smrgif test "x$use_doxygen" = x"auto"; then
2261273c00b8Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2262273c00b8Smrg   if test "x$DOXYGEN" = "x"; then
2263273c00b8Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2264273c00b8Smrg	have_doxygen=no
2265273c00b8Smrg   else
2266273c00b8Smrg        have_doxygen=yes
2267273c00b8Smrg   fi
2268273c00b8Smrgelif test "x$use_doxygen" = x"yes" ; then
2269273c00b8Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2270273c00b8Smrg   if test "x$DOXYGEN" = "x"; then
2271273c00b8Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2272273c00b8Smrg   fi
2273273c00b8Smrg   have_doxygen=yes
2274273c00b8Smrgelif test "x$use_doxygen" = x"no" ; then
2275273c00b8Smrg   if test "x$DOXYGEN" != "x"; then
2276273c00b8Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2277273c00b8Smrg   fi
2278273c00b8Smrg   have_doxygen=no
2279273c00b8Smrgelse
2280273c00b8Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2281273c00b8Smrgfi
2282273c00b8Smrgm4_ifval([$1],
2283273c00b8Smrg[if test "$have_doxygen" = yes; then
2284273c00b8Smrg    # scrape the doxygen version
2285273c00b8Smrg    AC_MSG_CHECKING([the doxygen version])
2286273c00b8Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2287273c00b8Smrg    AC_MSG_RESULT([$doxygen_version])
2288273c00b8Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2289273c00b8Smrg        [if test "x$use_doxygen" = xauto; then
2290273c00b8Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2291273c00b8Smrg            have_doxygen=no
2292273c00b8Smrg        else
2293273c00b8Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2294273c00b8Smrg        fi])
2295273c00b8Smrgfi])
22968abc0ccfSmrg
2297273c00b8Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2298273c00b8Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2299273c00b8Smrgdnl 	HAVE_DOT = @HAVE_DOT@
2300273c00b8SmrgHAVE_DOT=no
2301273c00b8Smrgif test "x$have_doxygen" = "xyes"; then
2302273c00b8Smrg  AC_PATH_PROG([DOT], [dot])
2303273c00b8Smrg    if test "x$DOT" != "x"; then
2304273c00b8Smrg      HAVE_DOT=yes
2305273c00b8Smrg    fi
2306273c00b8Smrgfi
23078abc0ccfSmrg
2308273c00b8SmrgAC_SUBST([HAVE_DOT])
2309273c00b8SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2310273c00b8SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2311273c00b8Smrg]) # XORG_WITH_DOXYGEN
23128abc0ccfSmrg
2313273c00b8Smrg# XORG_WITH_GROFF([DEFAULT])
2314273c00b8Smrg# ----------------
2315273c00b8Smrg# Minimum version: 1.6.0
2316273c00b8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
231796402570Smrg#
2318273c00b8Smrg# Documentation tools are not always available on all platforms and sometimes
2319273c00b8Smrg# not at the appropriate level. This macro enables a module to test for the
2320273c00b8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2321273c00b8Smrg# the --with-groff option, it allows maximum flexibility in making decisions
2322273c00b8Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
2323273c00b8Smrg# --with-groff assumes 'auto'.
23242852888eSmrg#
2325273c00b8Smrg# Interface to module:
2326273c00b8Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2327273c00b8Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2328273c00b8Smrg# HAVE_GROFF_MS: the -ms macros package
2329273c00b8Smrg# GROFF:	 returns the path of the groff program found
2330273c00b8Smrg#		 returns the path set by the user in the environment
2331273c00b8Smrg# --with-groff:	 'yes' user instructs the module to use groff
2332273c00b8Smrg#		 'no' user instructs the module not to use groff
23332852888eSmrg#
2334273c00b8Smrg# Added in version 1.9.0:
2335273c00b8Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2336273c00b8Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2337273c00b8Smrg#		   psselect from the psutils package.
2338273c00b8Smrg#		   the ghostcript package. Refer to the grohtml man pages
23392852888eSmrg#
2340273c00b8Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
234196402570Smrg#
2342273c00b8Smrg# OS and distros often splits groff in a basic and full package, the former
2343273c00b8Smrg# having the groff program and the later having devices, fonts and macros
2344273c00b8Smrg# Checking for the groff executable is not enough.
23452852888eSmrg#
2346273c00b8Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
2347273c00b8Smrg# unset HAVE_GROFF or GROFF env variables.
2348273c00b8Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
23498abc0ccfSmrg#
2350273c00b8SmrgAC_DEFUN([XORG_WITH_GROFF],[
2351273c00b8SmrgAC_ARG_VAR([GROFF], [Path to groff command])
2352273c00b8Smrgm4_define([_defopt], m4_default([$1], [auto]))
2353273c00b8SmrgAC_ARG_WITH(groff,
2354273c00b8Smrg	AS_HELP_STRING([--with-groff],
2355273c00b8Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2356273c00b8Smrg	   [use_groff=$withval], [use_groff=]_defopt)
2357273c00b8Smrgm4_undefine([_defopt])
23582852888eSmrg
2359273c00b8Smrgif test "x$use_groff" = x"auto"; then
2360273c00b8Smrg   AC_PATH_PROG([GROFF], [groff])
2361273c00b8Smrg   if test "x$GROFF" = "x"; then
2362273c00b8Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2363273c00b8Smrg	have_groff=no
2364273c00b8Smrg   else
2365273c00b8Smrg        have_groff=yes
2366273c00b8Smrg   fi
2367273c00b8Smrgelif test "x$use_groff" = x"yes" ; then
2368273c00b8Smrg   AC_PATH_PROG([GROFF], [groff])
2369273c00b8Smrg   if test "x$GROFF" = "x"; then
2370273c00b8Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2371273c00b8Smrg   fi
2372273c00b8Smrg   have_groff=yes
2373273c00b8Smrgelif test "x$use_groff" = x"no" ; then
2374273c00b8Smrg   if test "x$GROFF" != "x"; then
2375273c00b8Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2376273c00b8Smrg   fi
2377273c00b8Smrg   have_groff=no
23788abc0ccfSmrgelse
2379273c00b8Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
23808abc0ccfSmrgfi
23818abc0ccfSmrg
2382273c00b8Smrg# We have groff, test for the presence of the macro packages
2383273c00b8Smrgif test "x$have_groff" = x"yes"; then
2384273c00b8Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2385273c00b8Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2386273c00b8Smrg        groff_ms_works=yes
2387273c00b8Smrg    else
2388273c00b8Smrg        groff_ms_works=no
2389273c00b8Smrg    fi
2390273c00b8Smrg    AC_MSG_RESULT([$groff_ms_works])
2391273c00b8Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2392273c00b8Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2393273c00b8Smrg        groff_mm_works=yes
2394273c00b8Smrg    else
2395273c00b8Smrg        groff_mm_works=no
2396273c00b8Smrg    fi
2397273c00b8Smrg    AC_MSG_RESULT([$groff_mm_works])
2398273c00b8Smrgfi
23998abc0ccfSmrg
2400273c00b8Smrg# We have groff, test for HTML dependencies, one command per package
2401273c00b8Smrgif test "x$have_groff" = x"yes"; then
2402273c00b8Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2403273c00b8Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2404273c00b8Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2405273c00b8Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2406273c00b8Smrg      have_groff_html=yes
2407273c00b8Smrg   else
2408273c00b8Smrg      have_groff_html=no
2409273c00b8Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2410273c00b8Smrg   fi
2411273c00b8Smrgfi
24128abc0ccfSmrg
2413273c00b8Smrg# Set Automake conditionals for Makefiles
2414273c00b8SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2415273c00b8SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2416273c00b8SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2417273c00b8SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2418273c00b8Smrg]) # XORG_WITH_GROFF
24198abc0ccfSmrg
2420273c00b8Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2421273c00b8Smrg# ---------------------------------------
2422273c00b8Smrg# Minimum version: 1.6.0
2423273c00b8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2424273c00b8Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2425273c00b8Smrg#
2426273c00b8Smrg# Documentation tools are not always available on all platforms and sometimes
2427273c00b8Smrg# not at the appropriate level. This macro enables a module to test for the
2428273c00b8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2429273c00b8Smrg# the --with-fop option, it allows maximum flexibility in making decisions
2430273c00b8Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
2431273c00b8Smrg# --with-fop assumes 'auto'.
2432273c00b8Smrg#
2433273c00b8Smrg# Interface to module:
2434273c00b8Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2435273c00b8Smrg# FOP:	 	returns the path of the fop program found
2436273c00b8Smrg#		returns the path set by the user in the environment
2437273c00b8Smrg# --with-fop: 	'yes' user instructs the module to use fop
2438273c00b8Smrg#		'no' user instructs the module not to use fop
2439273c00b8Smrg#
2440273c00b8Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2441273c00b8Smrg#
2442273c00b8SmrgAC_DEFUN([XORG_WITH_FOP],[
2443273c00b8SmrgAC_ARG_VAR([FOP], [Path to fop command])
2444273c00b8Smrgm4_define([_defopt], m4_default([$2], [auto]))
2445273c00b8SmrgAC_ARG_WITH(fop,
2446273c00b8Smrg	AS_HELP_STRING([--with-fop],
2447273c00b8Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2448273c00b8Smrg	   [use_fop=$withval], [use_fop=]_defopt)
2449273c00b8Smrgm4_undefine([_defopt])
24502852888eSmrg
2451273c00b8Smrgif test "x$use_fop" = x"auto"; then
2452273c00b8Smrg   AC_PATH_PROG([FOP], [fop])
2453273c00b8Smrg   if test "x$FOP" = "x"; then
2454273c00b8Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2455273c00b8Smrg	have_fop=no
2456273c00b8Smrg   else
2457273c00b8Smrg        have_fop=yes
2458273c00b8Smrg   fi
2459273c00b8Smrgelif test "x$use_fop" = x"yes" ; then
2460273c00b8Smrg   AC_PATH_PROG([FOP], [fop])
2461273c00b8Smrg   if test "x$FOP" = "x"; then
2462273c00b8Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2463273c00b8Smrg   fi
2464273c00b8Smrg   have_fop=yes
2465273c00b8Smrgelif test "x$use_fop" = x"no" ; then
2466273c00b8Smrg   if test "x$FOP" != "x"; then
2467273c00b8Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2468273c00b8Smrg   fi
2469273c00b8Smrg   have_fop=no
24702852888eSmrgelse
2471273c00b8Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
24722852888eSmrgfi
24732852888eSmrg
2474273c00b8Smrg# Test for a minimum version of fop, if provided.
2475273c00b8Smrgm4_ifval([$1],
2476273c00b8Smrg[if test "$have_fop" = yes; then
2477273c00b8Smrg    # scrape the fop version
2478273c00b8Smrg    AC_MSG_CHECKING([for fop minimum version])
2479273c00b8Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2480273c00b8Smrg    AC_MSG_RESULT([$fop_version])
2481273c00b8Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2482273c00b8Smrg        [if test "x$use_fop" = xauto; then
2483273c00b8Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2484273c00b8Smrg            have_fop=no
2485273c00b8Smrg        else
2486273c00b8Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2487273c00b8Smrg        fi])
2488273c00b8Smrgfi])
2489273c00b8SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2490273c00b8Smrg]) # XORG_WITH_FOP
249196402570Smrg
2492273c00b8Smrg# XORG_WITH_M4([MIN-VERSION])
2493273c00b8Smrg# ---------------------------
2494273c00b8Smrg# Minimum version: 1.19.0
2495273c00b8Smrg#
2496273c00b8Smrg# This macro attempts to locate an m4 macro processor which supports
2497273c00b8Smrg# -I option and is only useful for modules relying on M4 in order to
2498273c00b8Smrg# expand macros in source code files.
2499273c00b8Smrg#
2500273c00b8Smrg# Interface to module:
2501273c00b8Smrg# M4:	 	returns the path of the m4 program found
2502273c00b8Smrg#		returns the path set by the user in the environment
2503273c00b8Smrg#
2504273c00b8SmrgAC_DEFUN([XORG_WITH_M4], [
2505273c00b8SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2506273c00b8Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2507273c00b8Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2508273c00b8Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2509273c00b8Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2510273c00b8Smrg   [$PATH:/usr/gnu/bin])])
2511273c00b8Smrg
2512273c00b8SmrgAC_SUBST([M4], [$ac_cv_path_M4])
2513273c00b8Smrg]) # XORG_WITH_M4
251496402570Smrg
2515273c00b8Smrg# XORG_WITH_PS2PDF([DEFAULT])
2516273c00b8Smrg# ----------------
2517273c00b8Smrg# Minimum version: 1.6.0
2518273c00b8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2519273c00b8Smrg#
2520273c00b8Smrg# Documentation tools are not always available on all platforms and sometimes
2521273c00b8Smrg# not at the appropriate level. This macro enables a module to test for the
2522273c00b8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2523273c00b8Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
2524273c00b8Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2525273c00b8Smrg# --with-ps2pdf assumes 'auto'.
2526273c00b8Smrg#
2527273c00b8Smrg# Interface to module:
2528273c00b8Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2529273c00b8Smrg# PS2PDF:	returns the path of the ps2pdf program found
2530273c00b8Smrg#		returns the path set by the user in the environment
2531273c00b8Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2532273c00b8Smrg#		 'no' user instructs the module not to use ps2pdf
2533273c00b8Smrg#
2534273c00b8Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2535273c00b8Smrg#
2536273c00b8SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2537273c00b8SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2538273c00b8Smrgm4_define([_defopt], m4_default([$1], [auto]))
2539273c00b8SmrgAC_ARG_WITH(ps2pdf,
2540273c00b8Smrg	AS_HELP_STRING([--with-ps2pdf],
2541273c00b8Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2542273c00b8Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2543273c00b8Smrgm4_undefine([_defopt])
254496402570Smrg
2545273c00b8Smrgif test "x$use_ps2pdf" = x"auto"; then
2546273c00b8Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2547273c00b8Smrg   if test "x$PS2PDF" = "x"; then
2548273c00b8Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2549273c00b8Smrg	have_ps2pdf=no
2550273c00b8Smrg   else
2551273c00b8Smrg        have_ps2pdf=yes
2552273c00b8Smrg   fi
2553273c00b8Smrgelif test "x$use_ps2pdf" = x"yes" ; then
2554273c00b8Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2555273c00b8Smrg   if test "x$PS2PDF" = "x"; then
2556273c00b8Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2557273c00b8Smrg   fi
2558273c00b8Smrg   have_ps2pdf=yes
2559273c00b8Smrgelif test "x$use_ps2pdf" = x"no" ; then
2560273c00b8Smrg   if test "x$PS2PDF" != "x"; then
2561273c00b8Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2562273c00b8Smrg   fi
2563273c00b8Smrg   have_ps2pdf=no
2564273c00b8Smrgelse
2565273c00b8Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
256696402570Smrgfi
2567273c00b8SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2568273c00b8Smrg]) # XORG_WITH_PS2PDF
256996402570Smrg
2570273c00b8Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
2571273c00b8Smrg# ----------------
2572273c00b8Smrg# Minimum version: 1.6.0
2573273c00b8Smrg#
2574273c00b8Smrg# Documentation tools are not always available on all platforms and sometimes
2575273c00b8Smrg# not at the appropriate level. This macro enables a builder to skip all
2576273c00b8Smrg# documentation targets except traditional man pages.
2577273c00b8Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2578273c00b8Smrg# maximum flexibility in controlling documentation building.
2579273c00b8Smrg# Refer to:
2580273c00b8Smrg# XORG_WITH_XMLTO         --with-xmlto
2581273c00b8Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2582273c00b8Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2583273c00b8Smrg# XORG_WITH_FOP           --with-fop
2584273c00b8Smrg# XORG_WITH_GROFF         --with-groff
2585273c00b8Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2586273c00b8Smrg#
2587273c00b8Smrg# Interface to module:
2588273c00b8Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2589273c00b8Smrg# --enable-docs: 'yes' user instructs the module to generate docs
2590273c00b8Smrg#		 'no' user instructs the module not to generate docs
2591273c00b8Smrg# parm1:	specify the default value, yes or no.
2592273c00b8Smrg#
2593273c00b8SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2594273c00b8Smrgm4_define([docs_default], m4_default([$1], [yes]))
2595273c00b8SmrgAC_ARG_ENABLE(docs,
2596273c00b8Smrg	AS_HELP_STRING([--enable-docs],
2597273c00b8Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2598273c00b8Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2599273c00b8Smrgm4_undefine([docs_default])
2600273c00b8SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2601273c00b8SmrgAC_MSG_CHECKING([whether to build documentation])
2602273c00b8SmrgAC_MSG_RESULT([$build_docs])
2603273c00b8Smrg]) # XORG_ENABLE_DOCS
260496402570Smrg
2605273c00b8Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2606273c00b8Smrg# ----------------
2607273c00b8Smrg# Minimum version: 1.6.0
26087a0395d0Smrg#
2609273c00b8Smrg# This macro enables a builder to skip all developer documentation.
2610273c00b8Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2611273c00b8Smrg# maximum flexibility in controlling documentation building.
2612273c00b8Smrg# Refer to:
2613273c00b8Smrg# XORG_WITH_XMLTO         --with-xmlto
2614273c00b8Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2615273c00b8Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2616273c00b8Smrg# XORG_WITH_FOP           --with-fop
2617273c00b8Smrg# XORG_WITH_GROFF         --with-groff
2618273c00b8Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2619273c00b8Smrg#
2620273c00b8Smrg# Interface to module:
2621273c00b8Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2622273c00b8Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2623273c00b8Smrg#			'no' user instructs the module not to generate developer docs
2624273c00b8Smrg# parm1:		specify the default value, yes or no.
2625273c00b8Smrg#
2626273c00b8SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2627273c00b8Smrgm4_define([devel_default], m4_default([$1], [yes]))
2628273c00b8SmrgAC_ARG_ENABLE(devel-docs,
2629273c00b8Smrg	AS_HELP_STRING([--enable-devel-docs],
2630273c00b8Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2631273c00b8Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2632273c00b8Smrgm4_undefine([devel_default])
2633273c00b8SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2634273c00b8SmrgAC_MSG_CHECKING([whether to build developer documentation])
2635273c00b8SmrgAC_MSG_RESULT([$build_devel_docs])
2636273c00b8Smrg]) # XORG_ENABLE_DEVEL_DOCS
26377a0395d0Smrg
2638273c00b8Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2639273c00b8Smrg# ----------------
2640273c00b8Smrg# Minimum version: 1.6.0
2641273c00b8Smrg#
2642273c00b8Smrg# This macro enables a builder to skip all functional specification targets.
2643273c00b8Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2644273c00b8Smrg# maximum flexibility in controlling documentation building.
2645273c00b8Smrg# Refer to:
2646273c00b8Smrg# XORG_WITH_XMLTO         --with-xmlto
2647273c00b8Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2648273c00b8Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2649273c00b8Smrg# XORG_WITH_FOP           --with-fop
2650273c00b8Smrg# XORG_WITH_GROFF         --with-groff
2651273c00b8Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2652273c00b8Smrg#
2653273c00b8Smrg# Interface to module:
2654273c00b8Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2655273c00b8Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2656273c00b8Smrg#			'no' user instructs the module not to generate specs
2657273c00b8Smrg# parm1:		specify the default value, yes or no.
2658273c00b8Smrg#
2659273c00b8SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2660273c00b8Smrgm4_define([spec_default], m4_default([$1], [yes]))
2661273c00b8SmrgAC_ARG_ENABLE(specs,
2662273c00b8Smrg	AS_HELP_STRING([--enable-specs],
2663273c00b8Smrg	   [Enable building the specs (default: ]spec_default[)]),
2664273c00b8Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2665273c00b8Smrgm4_undefine([spec_default])
2666273c00b8SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2667273c00b8SmrgAC_MSG_CHECKING([whether to build functional specifications])
2668273c00b8SmrgAC_MSG_RESULT([$build_specs])
2669273c00b8Smrg]) # XORG_ENABLE_SPECS
26707a0395d0Smrg
2671273c00b8Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2672273c00b8Smrg# ----------------------------------------------
2673273c00b8Smrg# Minimum version: 1.13.0
2674273c00b8Smrg#
2675273c00b8Smrg# This macro enables a builder to enable/disable unit testing
2676273c00b8Smrg# It makes no assumption about the test cases implementation
2677273c00b8Smrg# Test cases may or may not use Automake "Support for test suites"
2678273c00b8Smrg# They may or may not use the software utility library GLib
2679273c00b8Smrg#
2680273c00b8Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2681273c00b8Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2682273c00b8Smrg# The variable enable_unit_tests is used by other macros in this file.
2683273c00b8Smrg#
2684273c00b8Smrg# Interface to module:
2685273c00b8Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2686273c00b8Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2687273c00b8Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2688273c00b8Smrg#			'no' user instructs the module not to build tests
2689273c00b8Smrg# parm1:		specify the default value, yes or no.
2690273c00b8Smrg#
2691273c00b8SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2692273c00b8SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2693273c00b8SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2694273c00b8SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2695273c00b8Smrgm4_define([_defopt], m4_default([$1], [auto]))
2696273c00b8SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2697273c00b8Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2698273c00b8Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2699273c00b8Smrgm4_undefine([_defopt])
2700273c00b8SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2701273c00b8SmrgAC_MSG_CHECKING([whether to build unit test cases])
2702273c00b8SmrgAC_MSG_RESULT([$enable_unit_tests])
2703273c00b8Smrg]) # XORG_ENABLE_UNIT_TESTS
27047a0395d0Smrg
2705273c00b8Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2706273c00b8Smrg# ------------------------------------------------------
2707273c00b8Smrg# Minimum version: 1.17.0
2708273c00b8Smrg#
2709273c00b8Smrg# This macro enables a builder to enable/disable integration testing
2710273c00b8Smrg# It makes no assumption about the test cases' implementation
2711273c00b8Smrg# Test cases may or may not use Automake "Support for test suites"
2712273c00b8Smrg#
2713273c00b8Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2714273c00b8Smrg# usually requires less dependencies and may be built and run under less
2715273c00b8Smrg# stringent environments than integration tests.
2716273c00b8Smrg#
2717273c00b8Smrg# Interface to module:
2718273c00b8Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2719273c00b8Smrg# enable_integration_tests:   used in configure.ac for additional configuration
2720273c00b8Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2721273c00b8Smrg#                             'no' user instructs the module not to build tests
2722273c00b8Smrg# parm1:                      specify the default value, yes or no.
27232adc0320Smrg#
2724273c00b8SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2725273c00b8SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2726273c00b8Smrgm4_define([_defopt], m4_default([$1], [auto]))
2727273c00b8SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2728273c00b8Smrg	[Enable building integration test cases (default: ]_defopt[)]),
2729273c00b8Smrg	[enable_integration_tests=$enableval],
2730273c00b8Smrg	[enable_integration_tests=]_defopt)
2731273c00b8Smrgm4_undefine([_defopt])
2732273c00b8SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2733273c00b8Smrg	[test "x$enable_integration_tests" != xno])
2734273c00b8SmrgAC_MSG_CHECKING([whether to build unit test cases])
2735273c00b8SmrgAC_MSG_RESULT([$enable_integration_tests])
2736273c00b8Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
27378abc0ccfSmrg
2738273c00b8Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2739273c00b8Smrg# ----------------------------------------
2740273c00b8Smrg# Minimum version: 1.13.0
27417366012aSmrg#
2742273c00b8Smrg# GLib is a library which provides advanced data structures and functions.
2743273c00b8Smrg# This macro enables a module to test for the presence of Glib.
2744273c00b8Smrg#
2745273c00b8Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2746273c00b8Smrg# Otherwise the value of $enable_unit_tests is blank.
2747273c00b8Smrg#
2748273c00b8Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2749273c00b8Smrg# test support usually requires less dependencies and may be built and run under
2750273c00b8Smrg# less stringent environments than integration tests.
2751273c00b8Smrg#
2752273c00b8Smrg# Interface to module:
2753273c00b8Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2754273c00b8Smrg# with_glib: used in configure.ac to know if GLib has been found
2755273c00b8Smrg# --with-glib:	'yes' user instructs the module to use glib
2756273c00b8Smrg#		'no' user instructs the module not to use glib
2757273c00b8Smrg#
2758273c00b8SmrgAC_DEFUN([XORG_WITH_GLIB],[
2759273c00b8SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2760273c00b8Smrgm4_define([_defopt], m4_default([$2], [auto]))
2761273c00b8SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2762273c00b8Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2763273c00b8Smrg	[with_glib=$withval], [with_glib=]_defopt)
2764273c00b8Smrgm4_undefine([_defopt])
27652adc0320Smrg
2766273c00b8Smrghave_glib=no
2767273c00b8Smrg# Do not probe GLib if user explicitly disabled unit testing
2768273c00b8Smrgif test "x$enable_unit_tests" != x"no"; then
2769273c00b8Smrg  # Do not probe GLib if user explicitly disabled it
2770273c00b8Smrg  if test "x$with_glib" != x"no"; then
2771273c00b8Smrg    m4_ifval(
2772273c00b8Smrg      [$1],
2773273c00b8Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2774273c00b8Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2775273c00b8Smrg    )
2776273c00b8Smrg  fi
2777273c00b8Smrgfi
277840c5344fSmrg
2779273c00b8Smrg# Not having GLib when unit testing has been explicitly requested is an error
2780273c00b8Smrgif test "x$enable_unit_tests" = x"yes"; then
2781273c00b8Smrg  if test "x$have_glib" = x"no"; then
2782273c00b8Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
27838abc0ccfSmrg  fi
27847366012aSmrgfi
27852adc0320Smrg
2786273c00b8Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2787273c00b8Smrgif test "x$enable_unit_tests" = x"no"; then
2788273c00b8Smrg  if test "x$with_glib" = x"yes"; then
2789273c00b8Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
27908abc0ccfSmrg  fi
27917366012aSmrgfi
27927a0395d0Smrg
2793273c00b8Smrg# Not having GLib when it has been explicitly requested is an error
2794273c00b8Smrgif test "x$with_glib" = x"yes"; then
2795273c00b8Smrg  if test "x$have_glib" = x"no"; then
2796273c00b8Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2797273c00b8Smrg  fi
2798273c00b8Smrgfi
27992adc0320Smrg
2800273c00b8SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2801273c00b8Smrg]) # XORG_WITH_GLIB
28022adc0320Smrg
2803273c00b8Smrg# XORG_LD_WRAP([required|optional])
2804273c00b8Smrg# ---------------------------------
2805273c00b8Smrg# Minimum version: 1.13.0
2806273c00b8Smrg#
2807273c00b8Smrg# Check if linker supports -wrap, passed via compiler flags
2808273c00b8Smrg#
2809273c00b8Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2810273c00b8Smrg# Otherwise the value of $enable_unit_tests is blank.
2811273c00b8Smrg#
2812273c00b8Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2813273c00b8Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2814273c00b8Smrg# available, an argument of "optional" allows use when some unit tests require
2815273c00b8Smrg# ld -wrap and others do not.
2816273c00b8Smrg#
2817273c00b8SmrgAC_DEFUN([XORG_LD_WRAP],[
2818273c00b8SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2819273c00b8Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2820273c00b8Smrg                      void __wrap_exit(int status) { return; }],
2821273c00b8Smrg                     [exit(0);])])
2822273c00b8Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2823273c00b8Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2824273c00b8Smrg  if test "x$have_ld_wrap" = x"no"; then
2825273c00b8Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2826273c00b8Smrg  fi
2827765b7306Smrgfi
2828273c00b8SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2829273c00b8Smrg#
2830273c00b8Smrg]) # XORG_LD_WRAP
2831273c00b8Smrg
2832273c00b8Smrg# XORG_CHECK_LINKER_FLAGS
2833273c00b8Smrg# -----------------------
2834273c00b8Smrg# SYNOPSIS
2835273c00b8Smrg#
2836273c00b8Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2837273c00b8Smrg#
2838273c00b8Smrg# DESCRIPTION
2839273c00b8Smrg#
2840273c00b8Smrg#   Check whether the given linker FLAGS work with the current language's
2841273c00b8Smrg#   linker, or whether they give an error.
2842273c00b8Smrg#
2843273c00b8Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2844273c00b8Smrg#   success/failure.
2845273c00b8Smrg#
2846273c00b8Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2847273c00b8Smrg#
2848273c00b8Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2849273c00b8Smrg#
2850273c00b8Smrg# LICENSE
2851273c00b8Smrg#
2852273c00b8Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2853273c00b8Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2854273c00b8Smrg#   Copyright (c) 2009 Matteo Frigo
2855273c00b8Smrg#
2856273c00b8Smrg#   This program is free software: you can redistribute it and/or modify it
2857273c00b8Smrg#   under the terms of the GNU General Public License as published by the
2858273c00b8Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2859273c00b8Smrg#   option) any later version.
2860273c00b8Smrg#
2861273c00b8Smrg#   This program is distributed in the hope that it will be useful, but
2862273c00b8Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2863273c00b8Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2864273c00b8Smrg#   Public License for more details.
2865273c00b8Smrg#
2866273c00b8Smrg#   You should have received a copy of the GNU General Public License along
2867273c00b8Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2868273c00b8Smrg#
2869273c00b8Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2870273c00b8Smrg#   gives unlimited permission to copy, distribute and modify the configure
2871273c00b8Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2872273c00b8Smrg#   need not follow the terms of the GNU General Public License when using
2873273c00b8Smrg#   or distributing such scripts, even though portions of the text of the
2874273c00b8Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2875273c00b8Smrg#   all other use of the material that constitutes the Autoconf Macro.
2876273c00b8Smrg#
2877273c00b8Smrg#   This special exception to the GPL applies to versions of the Autoconf
2878273c00b8Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2879273c00b8Smrg#   modified version of the Autoconf Macro, you may extend this special
2880273c00b8Smrg#   exception to the GPL to apply to your modified version as well.#
2881273c00b8SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2882273c00b8Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2883273c00b8Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2884273c00b8SmrgAS_LITERAL_IF([$1],
2885273c00b8Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2886273c00b8Smrg      ax_save_FLAGS=$LDFLAGS
2887273c00b8Smrg      LDFLAGS="$1"
2888273c00b8Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2889273c00b8Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2890273c00b8Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2891273c00b8Smrg      LDFLAGS=$ax_save_FLAGS])],
2892273c00b8Smrg  [ax_save_FLAGS=$LDFLAGS
2893273c00b8Smrg   LDFLAGS="$1"
2894273c00b8Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2895273c00b8Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2896273c00b8Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2897273c00b8Smrg   LDFLAGS=$ax_save_FLAGS])
2898273c00b8Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2899273c00b8SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2900273c00b8Smrgif test "x$xorg_check_linker_flags" = xyes; then
2901273c00b8Smrg	m4_default([$2], :)
2902273c00b8Smrgelse
2903273c00b8Smrg	m4_default([$3], :)
2904765b7306Smrgfi
2905273c00b8Smrg]) # XORG_CHECK_LINKER_FLAGS
290640c5344fSmrg
2907273c00b8Smrg# XORG_MEMORY_CHECK_FLAGS
2908273c00b8Smrg# -----------------------
2909273c00b8Smrg# Minimum version: 1.16.0
2910273c00b8Smrg#
2911273c00b8Smrg# This macro attempts to find appropriate memory checking functionality
2912273c00b8Smrg# for various platforms which unit testing code may use to catch various
2913273c00b8Smrg# forms of memory allocation and access errors in testing.
2914273c00b8Smrg#
2915273c00b8Smrg# Interface to module:
2916273c00b8Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2917273c00b8Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2918273c00b8Smrg#
2919273c00b8Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2920273c00b8Smrg#
2921273c00b8SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
292240c5344fSmrg
2923273c00b8SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2924273c00b8SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2925273c00b8Smrg           [Environment variables to enable memory checking in tests])
292640c5344fSmrg
2927273c00b8Smrg# Check for different types of support on different platforms
2928273c00b8Smrgcase $host_os in
2929273c00b8Smrg    solaris*)
2930273c00b8Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2931273c00b8Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2932273c00b8Smrg        ;;
2933273c00b8Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2934273c00b8Smrg        # both directly and inverted, so should not be 0 or 255.
2935273c00b8Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2936273c00b8Smrg        ;;
2937273c00b8Smrg    darwin*)
2938273c00b8Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2939273c00b8Smrg        ;;
2940273c00b8Smrg    *bsd*)
2941273c00b8Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2942273c00b8Smrg        ;;
2943273c00b8Smrgesac
294440c5344fSmrg
2945273c00b8Smrg# User supplied flags override default flags
2946273c00b8Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2947273c00b8Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2948273c00b8Smrgfi
294940c5344fSmrg
2950273c00b8SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2951273c00b8Smrg]) # XORG_WITH_LINT
295240c5344fSmrg
2953273c00b8Smrg# XORG_CHECK_MALLOC_ZERO
2954273c00b8Smrg# ----------------------
2955273c00b8Smrg# Minimum version: 1.0.0
2956273c00b8Smrg#
2957273c00b8Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2958273c00b8Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2959273c00b8Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2960f6d57fdeSmrg#
2961f6d57fdeSmrg# No longer actually tests since there is no guarantee applications will
2962f6d57fdeSmrg# run with the same malloc implementation we tested against, and the cost
2963f6d57fdeSmrg# of always ensuring the size passed to malloc is non-zero is minimal now.
2964f6d57fdeSmrg# Still allows builders to override when they have complete control over
2965f6d57fdeSmrg# which malloc implementation will be used.
2966273c00b8SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2967273c00b8SmrgAC_ARG_ENABLE(malloc0returnsnull,
2968273c00b8Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2969f6d57fdeSmrg		       [assume malloc(0) can return NULL (default: yes)]),
2970273c00b8Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2971f6d57fdeSmrg	[MALLOC_ZERO_RETURNS_NULL=yes])
2972f6d57fdeSmrg
2973f6d57fdeSmrgAC_MSG_CHECKING([whether to act as if malloc(0) can return NULL])
2974273c00b8SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
29757a0395d0Smrg
2976273c00b8Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2977273c00b8Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2978273c00b8Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2979273c00b8Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2980273c00b8Smrgelse
2981273c00b8Smrg	MALLOC_ZERO_CFLAGS=""
2982273c00b8Smrg	XMALLOC_ZERO_CFLAGS=""
2983273c00b8Smrg	XTMALLOC_ZERO_CFLAGS=""
2984273c00b8Smrgfi
298596402570Smrg
2986273c00b8SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2987273c00b8SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2988273c00b8SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2989273c00b8Smrg]) # XORG_CHECK_MALLOC_ZERO
299096402570Smrg
2991273c00b8Smrg# XORG_WITH_LINT()
2992273c00b8Smrg# ----------------
2993273c00b8Smrg# Minimum version: 1.1.0
29948abc0ccfSmrg#
2995273c00b8Smrg# This macro enables the use of a tool that flags some suspicious and
2996273c00b8Smrg# non-portable constructs (likely to be bugs) in C language source code.
2997273c00b8Smrg# It will attempt to locate the tool and use appropriate options.
2998273c00b8Smrg# There are various lint type tools on different platforms.
2999273c00b8Smrg#
3000273c00b8Smrg# Interface to module:
3001273c00b8Smrg# LINT:		returns the path to the tool found on the platform
3002273c00b8Smrg#		or the value set to LINT on the configure cmd line
3003273c00b8Smrg#		also an Automake conditional
3004273c00b8Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
3005273c00b8Smrg#
3006273c00b8Smrg# --with-lint:	'yes' user instructs the module to use lint
3007273c00b8Smrg#		'no' user instructs the module not to use lint (default)
3008273c00b8Smrg#
3009273c00b8Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
3010273c00b8Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
3011273c00b8Smrg#
3012273c00b8SmrgAC_DEFUN([XORG_WITH_LINT],[
301396402570Smrg
3014273c00b8SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
3015273c00b8SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
3016273c00b8SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
3017273c00b8Smrg		[Use a lint-style source code checker (default: disabled)])],
3018273c00b8Smrg		[use_lint=$withval], [use_lint=no])
301996402570Smrg
3020273c00b8Smrg# Obtain platform specific info like program name and options
3021273c00b8Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
3022273c00b8Smrgcase $host_os in
3023273c00b8Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
3024273c00b8Smrg	lint_name=splint
3025273c00b8Smrg	lint_options="-badflag"
3026273c00b8Smrg	;;
3027273c00b8Smrg  *freebsd* | *netbsd*)
3028273c00b8Smrg	lint_name=lint
3029273c00b8Smrg	lint_options="-u -b"
3030273c00b8Smrg	;;
3031273c00b8Smrg  *solaris*)
3032273c00b8Smrg	lint_name=lint
3033273c00b8Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
3034273c00b8Smrg	;;
3035273c00b8Smrgesac
30368abc0ccfSmrg
3037273c00b8Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
3038273c00b8Smrgif test "x$use_lint" = x"yes" ; then
3039273c00b8Smrg   AC_PATH_PROG([LINT], [$lint_name])
3040273c00b8Smrg   if test "x$LINT" = "x"; then
3041273c00b8Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
3042273c00b8Smrg   fi
3043273c00b8Smrgelif test "x$use_lint" = x"no" ; then
3044273c00b8Smrg   if test "x$LINT" != "x"; then
3045273c00b8Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
3046273c00b8Smrg   fi
30478abc0ccfSmrgelse
3048273c00b8Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
304996402570Smrgfi
305096402570Smrg
3051273c00b8Smrg# User supplied flags override default flags
3052273c00b8Smrgif test "x$LINT_FLAGS" != "x"; then
3053273c00b8Smrg   lint_options=$LINT_FLAGS
3054273c00b8Smrgfi
305596402570Smrg
3056273c00b8SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
3057273c00b8SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
305896402570Smrg
3059273c00b8Smrg]) # XORG_WITH_LINT
306096402570Smrg
3061273c00b8Smrg# XORG_LINT_LIBRARY(LIBNAME)
3062273c00b8Smrg# --------------------------
3063273c00b8Smrg# Minimum version: 1.1.0
30648abc0ccfSmrg#
3065273c00b8Smrg# Sets up flags for building lint libraries for checking programs that call
3066273c00b8Smrg# functions in the library.
3067273c00b8Smrg#
3068273c00b8Smrg# Interface to module:
3069273c00b8Smrg# LINTLIB		- Automake variable with the name of lint library file to make
3070273c00b8Smrg# MAKE_LINT_LIB		- Automake conditional
3071273c00b8Smrg#
3072273c00b8Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
3073273c00b8Smrg#			  - 'no' user instructs the module not to create a lint library (default)
307496402570Smrg
3075273c00b8SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
3076273c00b8SmrgAC_REQUIRE([XORG_WITH_LINT])
3077273c00b8SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
3078273c00b8Smrg	[Create lint library (default: disabled)])],
3079273c00b8Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
308096402570Smrg
3081273c00b8Smrgif test "x$make_lint_lib" = x"yes" ; then
3082273c00b8Smrg   LINTLIB=llib-l$1.ln
3083273c00b8Smrg   if test "x$LINT" = "x"; then
3084273c00b8Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
3085273c00b8Smrg   fi
3086273c00b8Smrgelif test "x$make_lint_lib" != x"no" ; then
3087273c00b8Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
308896402570Smrgfi
308996402570Smrg
3090273c00b8SmrgAC_SUBST(LINTLIB)
3091273c00b8SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
309296402570Smrg
3093273c00b8Smrg]) # XORG_LINT_LIBRARY
30947366012aSmrg
3095273c00b8Smrg# XORG_COMPILER_BRAND
3096273c00b8Smrg# -------------------
3097273c00b8Smrg# Minimum version: 1.14.0
3098273c00b8Smrg#
3099273c00b8Smrg# Checks for various brands of compilers and sets flags as appropriate:
3100273c00b8Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
3101273c00b8Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
3102273c00b8Smrg#   clang compiler - sets CLANGCC to "yes"
3103273c00b8Smrg#   Intel compiler - sets INTELCC to "yes"
3104273c00b8Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
3105273c00b8Smrg#
3106273c00b8SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
3107273c00b8SmrgAC_LANG_CASE(
3108273c00b8Smrg	[C], [
3109273c00b8Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
3110273c00b8Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3111273c00b8Smrg		m4_version_prereq([2.70],
3112273c00b8Smrg			[AC_REQUIRE([AC_PROG_CC])],
3113273c00b8Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3114273c00b8Smrg	],
3115273c00b8Smrg	[C++], [
3116273c00b8Smrg		AC_REQUIRE([AC_PROG_CXX])
3117273c00b8Smrg	]
3118273c00b8Smrg)
3119273c00b8SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
3120273c00b8SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
3121273c00b8SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
3122273c00b8Smrg]) # XORG_COMPILER_BRAND
31237366012aSmrg
3124273c00b8Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
3125273c00b8Smrg# ---------------
3126273c00b8Smrg# Minimum version: 1.16.0
3127273c00b8Smrg#
3128273c00b8Smrg# Test if the compiler works when passed the given flag as a command line argument.
3129273c00b8Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
3130273c00b8Smrg# next flag in the list until there are no more options.
3131273c00b8Smrg#
3132273c00b8Smrg# Note that this does not guarantee that the compiler supports the flag as some
3133273c00b8Smrg# compilers will simply ignore arguments that they do not understand, but we do
3134273c00b8Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
3135273c00b8Smrg# -Werror=unused-command-line-argument
3136273c00b8Smrg#
3137273c00b8SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
3138273c00b8Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3139273c00b8Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
314096402570Smrg
3141273c00b8SmrgAC_LANG_COMPILER_REQUIRE
314296402570Smrg
3143273c00b8SmrgAC_LANG_CASE(
3144273c00b8Smrg	[C], [
3145273c00b8Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
3146273c00b8Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3147273c00b8Smrg		m4_version_prereq([2.70],
3148273c00b8Smrg			[AC_REQUIRE([AC_PROG_CC])],
3149273c00b8Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3150273c00b8Smrg		define([PREFIX], [C])
3151273c00b8Smrg		define([CACHE_PREFIX], [cc])
3152273c00b8Smrg		define([COMPILER], [$CC])
3153273c00b8Smrg	],
3154273c00b8Smrg	[C++], [
3155273c00b8Smrg		define([PREFIX], [CXX])
3156273c00b8Smrg		define([CACHE_PREFIX], [cxx])
3157273c00b8Smrg		define([COMPILER], [$CXX])
3158273c00b8Smrg	]
3159273c00b8Smrg)
316096402570Smrg
3161273c00b8Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
316240c5344fSmrg
3163273c00b8Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
3164273c00b8Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3165273c00b8Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
3166273c00b8Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3167273c00b8Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3168273c00b8Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
3169273c00b8Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
3170273c00b8Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
3171273c00b8Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3172273c00b8Smrgfi
3173273c00b8Smrg
3174273c00b8Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
3175273c00b8Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
3176273c00b8Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3177273c00b8Smrg	fi
3178273c00b8Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3179273c00b8Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
3180273c00b8Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3181273c00b8Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3182273c00b8Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
3183273c00b8Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
3184273c00b8Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
3185273c00b8Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
318640c5344fSmrgfi
318740c5344fSmrg
3188273c00b8Smrgfound="no"
3189273c00b8Smrgm4_foreach([flag], m4_cdr($@), [
3190273c00b8Smrg	if test $found = "no" ; then
3191273c00b8Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
3192273c00b8Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3193273c00b8Smrg		fi
319440c5344fSmrg
3195273c00b8Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
3196273c00b8Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3197273c00b8Smrg		fi
319840c5344fSmrg
3199273c00b8Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
320040c5344fSmrg
3201273c00b8Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
3202273c00b8Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
3203273c00b8Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
3204273c00b8Smrg		AC_CACHE_VAL($cacheid,
3205273c00b8Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3206273c00b8Smrg					     [eval $cacheid=yes],
3207273c00b8Smrg					     [eval $cacheid=no])])
320896402570Smrg
3209273c00b8Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
32108abc0ccfSmrg
3211273c00b8Smrg		eval supported=\$$cacheid
3212273c00b8Smrg		AC_MSG_RESULT([$supported])
3213273c00b8Smrg		if test "$supported" = "yes" ; then
3214273c00b8Smrg			$1="$$1 ]flag["
3215273c00b8Smrg			found="yes"
3216273c00b8Smrg		fi
3217273c00b8Smrg	fi
3218273c00b8Smrg])
3219273c00b8Smrg]) # XORG_TESTSET_CFLAG
3220273c00b8Smrg
3221273c00b8Smrg# XORG_COMPILER_FLAGS
32228abc0ccfSmrg# ---------------
3223273c00b8Smrg# Minimum version: 1.16.0
3224273c00b8Smrg#
3225273c00b8Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
3226273c00b8Smrg# arguments supported by the selected compiler which do NOT alter the generated
3227273c00b8Smrg# code.  These arguments will cause the compiler to print various warnings
3228273c00b8Smrg# during compilation AND turn a conservative set of warnings into errors.
3229273c00b8Smrg#
3230273c00b8Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
3231273c00b8Smrg# future versions of util-macros as options are added to new compilers.
3232273c00b8Smrg#
3233273c00b8SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
3234273c00b8SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
32358abc0ccfSmrg
3236273c00b8SmrgAC_ARG_ENABLE(selective-werror,
3237273c00b8Smrg              AS_HELP_STRING([--disable-selective-werror],
3238273c00b8Smrg                             [Turn off selective compiler errors. (default: enabled)]),
3239273c00b8Smrg              [SELECTIVE_WERROR=$enableval],
3240273c00b8Smrg              [SELECTIVE_WERROR=yes])
32418abc0ccfSmrg
3242273c00b8SmrgAC_LANG_CASE(
3243273c00b8Smrg        [C], [
3244273c00b8Smrg                define([PREFIX], [C])
3245273c00b8Smrg        ],
3246273c00b8Smrg        [C++], [
3247273c00b8Smrg                define([PREFIX], [CXX])
3248273c00b8Smrg        ]
3249273c00b8Smrg)
3250273c00b8Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
3251273c00b8Smrgif test "x$SUNCC" = "xyes"; then
3252273c00b8Smrg    [BASE_]PREFIX[FLAGS]="-v"
32538abc0ccfSmrgelse
3254273c00b8Smrg    [BASE_]PREFIX[FLAGS]=""
32557a0395d0Smrgfi
3256273c00b8Smrg
3257273c00b8Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3258273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
3259273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
3260273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
3261273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3262273c00b8Smrg
3263273c00b8SmrgAC_LANG_CASE(
3264273c00b8Smrg	[C], [
3265273c00b8Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
3266273c00b8Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
3267273c00b8Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
3268273c00b8Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
3269273c00b8Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
3270273c00b8Smrg	]
3271273c00b8Smrg)
3272273c00b8Smrg
3273273c00b8Smrg# This chunk adds additional warnings that could catch undesired effects.
3274273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
3275273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
3276273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
3277273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
3278273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
3279273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
3280273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3281273c00b8Smrg
3282273c00b8Smrg# These are currently disabled because they are noisy.  They will be enabled
3283273c00b8Smrg# in the future once the codebase is sufficiently modernized to silence
3284273c00b8Smrg# them.  For now, I don't want them to drown out the other warnings.
3285273c00b8Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3286273c00b8Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3287273c00b8Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3288273c00b8Smrg
3289273c00b8Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
3290273c00b8Smrg# when there are problems that should be fixed.
3291273c00b8Smrg
3292273c00b8Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3293273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3294273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3295273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3296273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3297273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3298273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3299273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3300273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3301273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3302273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3303273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3304273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3305273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3306273c00b8Smrgelse
3307273c00b8SmrgAC_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])
3308273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3309273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3310273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3311273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3312273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3313273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3314273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3315273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3316273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3317273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3318273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3319273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3320273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
33218abc0ccfSmrgfi
33227366012aSmrg
3323273c00b8SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3324273c00b8Smrg]) # XORG_COMPILER_FLAGS
3325273c00b8Smrg
3326273c00b8Smrg# XORG_CWARNFLAGS
3327273c00b8Smrg# ---------------
3328273c00b8Smrg# Minimum version: 1.2.0
3329273c00b8Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3330273c00b8Smrg#
3331273c00b8Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3332273c00b8Smrg#
3333273c00b8Smrg# This function is deprecated because it defines -fno-strict-aliasing
3334273c00b8Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3335273c00b8Smrg# is needed, then it should be added explicitly in the module when
3336273c00b8Smrg# it is updated to use BASE_CFLAGS.
3337273c00b8Smrg#
3338273c00b8SmrgAC_DEFUN([XORG_CWARNFLAGS], [
3339273c00b8SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3340273c00b8SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3341273c00b8SmrgAC_LANG_CASE(
3342273c00b8Smrg	[C], [
3343273c00b8Smrg		CWARNFLAGS="$BASE_CFLAGS"
3344273c00b8Smrg		if  test "x$GCC" = xyes ; then
3345273c00b8Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3346273c00b8Smrg		fi
3347273c00b8Smrg		AC_SUBST(CWARNFLAGS)
3348273c00b8Smrg	]
3349273c00b8Smrg)
3350273c00b8Smrg]) # XORG_CWARNFLAGS
3351273c00b8Smrg
3352273c00b8Smrg# XORG_STRICT_OPTION
3353273c00b8Smrg# -----------------------
3354273c00b8Smrg# Minimum version: 1.3.0
33557366012aSmrg#
3356273c00b8Smrg# Add configure option to enable strict compilation flags, such as treating
3357273c00b8Smrg# warnings as fatal errors.
3358273c00b8Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3359273c00b8Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3360273c00b8Smrg#
3361273c00b8Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3362273c00b8Smrg# when strict compilation is unconditionally desired.
3363273c00b8SmrgAC_DEFUN([XORG_STRICT_OPTION], [
3364273c00b8SmrgAC_REQUIRE([XORG_CWARNFLAGS])
3365273c00b8SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
33662adc0320Smrg
3367273c00b8SmrgAC_ARG_ENABLE(strict-compilation,
3368273c00b8Smrg			  AS_HELP_STRING([--enable-strict-compilation],
3369273c00b8Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3370273c00b8Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3371273c00b8Smrg
3372273c00b8SmrgAC_LANG_CASE(
3373273c00b8Smrg        [C], [
3374273c00b8Smrg                define([PREFIX], [C])
3375273c00b8Smrg        ],
3376273c00b8Smrg        [C++], [
3377273c00b8Smrg                define([PREFIX], [CXX])
3378273c00b8Smrg        ]
3379273c00b8Smrg)
3380273c00b8Smrg
3381273c00b8Smrg[STRICT_]PREFIX[FLAGS]=""
3382273c00b8SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3383273c00b8SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3384273c00b8Smrg
3385273c00b8Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3386273c00b8Smrg# activate it with -Werror, so we add it here explicitly.
3387273c00b8SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3388273c00b8Smrg
3389273c00b8Smrgif test "x$STRICT_COMPILE" = "xyes"; then
3390273c00b8Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3391273c00b8Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
33928abc0ccfSmrgfi
3393273c00b8SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3394273c00b8SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3395273c00b8SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3396273c00b8Smrg]) # XORG_STRICT_OPTION
33977a0395d0Smrg
3398273c00b8Smrg# XORG_DEFAULT_NOCODE_OPTIONS
3399273c00b8Smrg# ---------------------------
3400273c00b8Smrg# Minimum version: 1.20.0
34017366012aSmrg#
3402273c00b8Smrg# Defines default options for X.Org modules which don't compile code,
3403273c00b8Smrg# such as fonts, bitmaps, cursors, and docs.
3404273c00b8Smrg#
3405273c00b8SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
3406273c00b8SmrgAC_REQUIRE([AC_PROG_INSTALL])
3407273c00b8SmrgXORG_RELEASE_VERSION
3408273c00b8SmrgXORG_CHANGELOG
3409273c00b8SmrgXORG_INSTALL
3410273c00b8SmrgXORG_MANPAGE_SECTIONS
3411273c00b8Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3412273c00b8Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3413273c00b8Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
34147a0395d0Smrg
3415273c00b8Smrg# XORG_DEFAULT_OPTIONS
3416273c00b8Smrg# --------------------
3417273c00b8Smrg# Minimum version: 1.3.0
3418273c00b8Smrg#
3419273c00b8Smrg# Defines default options for X.Org modules which compile code.
3420273c00b8Smrg#
3421273c00b8SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3422273c00b8SmrgAC_REQUIRE([AC_PROG_INSTALL])
3423273c00b8SmrgXORG_COMPILER_FLAGS
3424273c00b8SmrgXORG_CWARNFLAGS
3425273c00b8SmrgXORG_STRICT_OPTION
3426273c00b8SmrgXORG_DEFAULT_NOCODE_OPTIONS
3427273c00b8Smrg]) # XORG_DEFAULT_OPTIONS
34287a0395d0Smrg
3429273c00b8Smrg# XORG_INSTALL()
3430273c00b8Smrg# ----------------
3431273c00b8Smrg# Minimum version: 1.4.0
34328abc0ccfSmrg#
3433273c00b8Smrg# Defines the variable INSTALL_CMD as the command to copy
3434273c00b8Smrg# INSTALL from $prefix/share/util-macros.
3435273c00b8Smrg#
3436273c00b8SmrgAC_DEFUN([XORG_INSTALL], [
3437273c00b8SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3438273c00b8Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3439273c00b8SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3440273c00b8Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3441273c00b8Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3442273c00b8Smrgtouch \$(top_srcdir)/INSTALL; \
3443273c00b8Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3444273c00b8SmrgAC_SUBST([INSTALL_CMD])
3445273c00b8Smrg]) # XORG_INSTALL
3446273c00b8Smrgdnl Copyright 2005 Red Hat, Inc
3447273c00b8Smrgdnl
3448273c00b8Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3449273c00b8Smrgdnl documentation for any purpose is hereby granted without fee, provided that
3450273c00b8Smrgdnl the above copyright notice appear in all copies and that both that
3451273c00b8Smrgdnl copyright notice and this permission notice appear in supporting
3452273c00b8Smrgdnl documentation.
3453273c00b8Smrgdnl
3454273c00b8Smrgdnl The above copyright notice and this permission notice shall be included
3455273c00b8Smrgdnl in all copies or substantial portions of the Software.
3456273c00b8Smrgdnl
3457273c00b8Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3458273c00b8Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3459273c00b8Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3460273c00b8Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3461273c00b8Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3462273c00b8Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3463273c00b8Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3464273c00b8Smrgdnl
3465273c00b8Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3466273c00b8Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3467273c00b8Smrgdnl other dealings in this Software without prior written authorization
3468273c00b8Smrgdnl from the copyright holders.
3469273c00b8Smrgdnl
34707a0395d0Smrg
3471273c00b8Smrg# XORG_RELEASE_VERSION
3472273c00b8Smrg# --------------------
3473273c00b8Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
347496402570Smrg
3475273c00b8SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3476273c00b8Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3477273c00b8Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3478273c00b8Smrg		[Major version of this package])
3479273c00b8Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3480273c00b8Smrg	if test "x$PVM" = "x"; then
3481273c00b8Smrg		PVM="0"
3482273c00b8Smrg	fi
3483273c00b8Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3484273c00b8Smrg		[$PVM],
3485273c00b8Smrg		[Minor version of this package])
3486273c00b8Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3487273c00b8Smrg	if test "x$PVP" = "x"; then
3488273c00b8Smrg		PVP="0"
3489273c00b8Smrg	fi
3490273c00b8Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3491273c00b8Smrg		[$PVP],
3492273c00b8Smrg		[Patch version of this package])
3493273c00b8Smrg])
34947a0395d0Smrg
3495273c00b8Smrg# XORG_CHANGELOG()
3496273c00b8Smrg# ----------------
3497273c00b8Smrg# Minimum version: 1.2.0
3498273c00b8Smrg#
3499273c00b8Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3500273c00b8Smrg# ChangeLog from git.
3501273c00b8Smrg#
3502273c00b8Smrg#
3503273c00b8SmrgAC_DEFUN([XORG_CHANGELOG], [
3504273c00b8SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3505273c00b8Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3506273c00b8Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3507273c00b8Smrgtouch \$(top_srcdir)/ChangeLog; \
3508273c00b8Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3509273c00b8SmrgAC_SUBST([CHANGELOG_CMD])
3510273c00b8Smrg]) # XORG_CHANGELOG
3511273c00b8Smrg
3512273c00b8Smrgdnl
3513f6d57fdeSmrgdnl Copyright (c) 2005, 2025, Oracle and/or its affiliates.
3514273c00b8Smrgdnl
3515273c00b8Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
3516273c00b8Smrgdnl copy of this software and associated documentation files (the "Software"),
3517273c00b8Smrgdnl to deal in the Software without restriction, including without limitation
3518273c00b8Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3519273c00b8Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
3520273c00b8Smrgdnl Software is furnished to do so, subject to the following conditions:
3521273c00b8Smrgdnl
3522273c00b8Smrgdnl The above copyright notice and this permission notice (including the next
3523273c00b8Smrgdnl paragraph) shall be included in all copies or substantial portions of the
3524273c00b8Smrgdnl Software.
3525273c00b8Smrgdnl
3526273c00b8Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3527273c00b8Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3528273c00b8Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
3529273c00b8Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3530273c00b8Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3531273c00b8Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3532273c00b8Smrgdnl DEALINGS IN THE SOFTWARE.
3533273c00b8Smrgdnl
353496402570Smrg
3535273c00b8Smrg# XTRANS_TCP_FLAGS()
3536273c00b8Smrg# ------------------
3537273c00b8Smrg# Find needed libraries for TCP sockets, and check for IPv6 support
3538273c00b8SmrgAC_DEFUN([XTRANS_TCP_FLAGS],[
3539273c00b8Smrg # SVR4 hides these in libraries other than libc
3540273c00b8Smrg AC_SEARCH_LIBS(socket, [socket])
3541273c00b8Smrg AC_SEARCH_LIBS(gethostbyname, [nsl])
3542273c00b8Smrg if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then
3543273c00b8Smrg   AC_CHECK_LIB([ws2_32],[main])
3544273c00b8Smrg fi
35457a0395d0Smrg
3546273c00b8Smrg # Needs to come after above checks for libsocket & libnsl for SVR4 systems
3547f6d57fdeSmrg AC_CHECK_FUNCS([getaddrinfo inet_ntop])
3548f6d57fdeSmrg
3549273c00b8Smrg AC_ARG_ENABLE(ipv6,
3550273c00b8Smrg	AS_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),
3551273c00b8Smrg	[IPV6CONN=$enableval],
3552f6d57fdeSmrg	[IPV6CONN=$ac_cv_func_getaddrinfo])
3553273c00b8Smrg AC_MSG_CHECKING([if IPv6 support should be built])
3554273c00b8Smrg if test "$IPV6CONN" = "yes"; then
3555273c00b8Smrg	AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections])
3556273c00b8Smrg fi
3557273c00b8Smrg AC_MSG_RESULT($IPV6CONN)
35589a011757Smrg
3559273c00b8Smrg # 4.3BSD-Reno added a new member to struct sockaddr_in
3560273c00b8Smrg AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
3561273c00b8Smrg	AC_DEFINE([BSD44SOCKETS],1,
3562273c00b8Smrg 	    [Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [
3563273c00b8Smrg#include <sys/types.h>
3564273c00b8Smrg#include <sys/socket.h>
3565273c00b8Smrg#include <netinet/in.h>
3566273c00b8Smrg ])
35677a0395d0Smrg
3568273c00b8Smrg # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc.
3569f6d57fdeSmrg # and added a type defined to be large enough to hold any sockaddr format.
3570f6d57fdeSmrg AC_CHECK_TYPES([socklen_t, struct sockaddr_storage], [], [], [
3571273c00b8SmrgAC_INCLUDES_DEFAULT
3572f6d57fdeSmrg#include <sys/socket.h>
3573f6d57fdeSmrg ])
35749a011757Smrg
3575273c00b8Smrg # XPG4v2/UNIX95 added msg_control - check to see if we need to define
3576273c00b8Smrg # _XOPEN_SOURCE to get it (such as on Solaris)
3577273c00b8Smrg AC_CHECK_MEMBER([struct msghdr.msg_control], [], [],
3578273c00b8Smrg                 [
3579273c00b8SmrgAC_INCLUDES_DEFAULT
3580273c00b8Smrg#include <sys/socket.h>
3581273c00b8Smrg                 ])
3582273c00b8Smrg # First try for Solaris in C99 compliant mode, which requires XPG6/UNIX03
3583273c00b8Smrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
3584273c00b8Smrg     unset ac_cv_member_struct_msghdr_msg_control
3585273c00b8Smrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=600])
3586273c00b8Smrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
3587273c00b8Smrg                     [AC_DEFINE([_XOPEN_SOURCE], [600],
3588273c00b8Smrg                       [Defined if needed to expose struct msghdr.msg_control])
3589273c00b8Smrg                     ], [], [
3590273c00b8Smrg#define _XOPEN_SOURCE 600
3591273c00b8SmrgAC_INCLUDES_DEFAULT
3592273c00b8Smrg#include <sys/socket.h>
3593273c00b8Smrg                     ])
3594273c00b8Smrg fi
3595273c00b8Smrg # If that didn't work, fall back to XPG5/UNIX98 with C89
3596273c00b8Smrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
3597273c00b8Smrg     unset ac_cv_member_struct_msghdr_msg_control
3598273c00b8Smrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=500])
3599273c00b8Smrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
3600273c00b8Smrg                     [AC_DEFINE([_XOPEN_SOURCE], [500],
3601273c00b8Smrg                       [Defined if needed to expose struct msghdr.msg_control])
3602273c00b8Smrg                     ], [], [
3603273c00b8Smrg#define _XOPEN_SOURCE 500
3604273c00b8SmrgAC_INCLUDES_DEFAULT
3605273c00b8Smrg#include <sys/socket.h>
3606273c00b8Smrg                     ])
3607273c00b8Smrg fi
36089a011757Smrg
36099a011757Smrg
3610273c00b8Smrg]) # XTRANS_TCP_FLAGS
36119a011757Smrg
3612273c00b8Smrg# XTRANS_CONNECTION_FLAGS()
3613273c00b8Smrg# -------------------------
3614273c00b8Smrg# Standard checks for which Xtrans transports to use by the Xorg packages
3615273c00b8Smrg# that use Xtrans functions
3616273c00b8SmrgAC_DEFUN([XTRANS_CONNECTION_FLAGS],[
3617273c00b8Smrg AC_REQUIRE([AC_CANONICAL_HOST])
3618273c00b8Smrg [case $host_os in
3619273c00b8Smrg	mingw*)	unixdef="no"   ;;
3620273c00b8Smrg	*)	unixdef="yes"  ;;
3621273c00b8Smrg esac]
3622273c00b8Smrg AC_ARG_ENABLE(unix-transport,
3623273c00b8Smrg	AS_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]),
3624273c00b8Smrg	[UNIXCONN=$enableval], [UNIXCONN=$unixdef])
3625273c00b8Smrg AC_MSG_CHECKING([if Xtrans should support UNIX socket connections])
3626273c00b8Smrg if test "$UNIXCONN" = "yes"; then
3627273c00b8Smrg	AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
3628273c00b8Smrg fi
3629273c00b8Smrg AC_MSG_RESULT($UNIXCONN)
3630273c00b8Smrg AC_ARG_ENABLE(tcp-transport,
3631273c00b8Smrg	AS_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]),
3632273c00b8Smrg	[TCPCONN=$enableval], [TCPCONN=yes])
3633273c00b8Smrg AC_MSG_CHECKING([if Xtrans should support TCP socket connections])
3634273c00b8Smrg AC_MSG_RESULT($TCPCONN)
3635273c00b8Smrg if test "$TCPCONN" = "yes"; then
3636273c00b8Smrg	AC_DEFINE(TCPCONN,1,[Support TCP socket connections])
3637273c00b8Smrg	XTRANS_TCP_FLAGS
3638273c00b8Smrg fi
3639273c00b8Smrg [case $host_os in
3640273c00b8Smrg	solaris*)		localdef="yes" ;;
3641273c00b8Smrg	*)			localdef="no"  ;;
3642273c00b8Smrg esac]
3643273c00b8Smrg AC_ARG_ENABLE(local-transport,
3644273c00b8Smrg	AS_HELP_STRING([--enable-local-transport],[Enable os-specific local transport]),
3645273c00b8Smrg	[LOCALCONN=$enableval], [LOCALCONN=$localdef])
3646273c00b8Smrg AC_MSG_CHECKING([if Xtrans should support os-specific local connections])
3647273c00b8Smrg AC_MSG_RESULT($LOCALCONN)
3648273c00b8Smrg if test "$LOCALCONN" = "yes"; then
3649273c00b8Smrg	AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
3650273c00b8Smrg fi
36519a011757Smrg
3652273c00b8Smrg # Other functions Xtrans may need
3653273c00b8Smrg AC_CHECK_FUNCS([strcasecmp strlcpy])
36549a011757Smrg
3655273c00b8Smrg]) # XTRANS_CONNECTION_FLAGS
36568abc0ccfSmrg
36579a011757Smrg
3658273c00b8Smrg# XTRANS_SECURE_RPC_FLAGS()
3659273c00b8Smrg# -------------------------
3660273c00b8Smrg# Check for Secure RPC functions - must come after XTRANS_TCP_FLAGS
3661273c00b8Smrg# so that any necessary networking libraries are already found
3662273c00b8SmrgAC_DEFUN([XTRANS_SECURE_RPC_FLAGS],
3663273c00b8Smrg[AC_REQUIRE([XTRANS_TCP_FLAGS])
3664273c00b8Smrg AC_ARG_ENABLE(secure-rpc,
3665273c00b8Smrg	AS_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]),
3666273c00b8Smrg        [SECURE_RPC=$enableval], [SECURE_RPC="try"])
36677a0395d0Smrg
3668273c00b8Smrg if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then
3669273c00b8Smrg	FOUND_SECURE_RPC="no"
3670273c00b8Smrg	AC_CHECK_FUNCS([authdes_seccreate authdes_create],
3671273c00b8Smrg			[FOUND_SECURE_RPC="yes"])
3672273c00b8Smrg	if test "x$FOUND_SECURE_RPC" = "xno" ; then
3673273c00b8Smrg		if test "x$SECURE_RPC" = "xyes" ; then
3674273c00b8Smrg	AC_MSG_ERROR([Secure RPC requested, but required functions not found])
3675273c00b8Smrg		fi
3676273c00b8Smrg		SECURE_RPC="no"
3677273c00b8Smrg	else
3678273c00b8Smrg		dnl FreeBSD keeps getsecretkey in librpcsvc
3679273c00b8Smrg		AC_SEARCH_LIBS(getsecretkey, [rpcsvc])
3680273c00b8Smrg		SECURE_RPC="yes"
3681273c00b8Smrg	fi
3682273c00b8Smrg fi
3683273c00b8Smrg AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported])
3684273c00b8Smrg if test "x$SECURE_RPC" = "xyes" ; then
3685273c00b8Smrg	AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients])
3686273c00b8Smrg fi
3687273c00b8Smrg AC_MSG_RESULT($SECURE_RPC)
3688273c00b8Smrg]) # XTRANS_SECURE_RPC_FLAGS
36899a011757Smrg
36907a0395d0Smrg
3691