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