18bfe6addSmrg# generated automatically by aclocal 1.17 -*- Autoconf -*-
29ff100acSmrg
38bfe6addSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
476910425Smrg
576910425Smrg# This file is free software; the Free Software Foundation
676910425Smrg# gives unlimited permission to copy and/or distribute it,
776910425Smrg# with or without modifications, as long as this notice is preserved.
876910425Smrg
976910425Smrg# This program is distributed in the hope that it will be useful,
1076910425Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1176910425Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1276910425Smrg# PARTICULAR PURPOSE.
1376910425Smrg
149ff100acSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15db17cd6dSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16db17cd6dSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
178bfe6addSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
188bfe6addSmrg[m4_warning([this file was generated for autoconf 2.72.
19db17cd6dSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20db17cd6dSmrgIf you have problems, you may need to regenerate the build system entirely.
219ff100acSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2276910425Smrg
238bfe6addSmrg# Copyright (C) 2002-2024 Free Software Foundation, Inc.
2476910425Smrg#
25db17cd6dSmrg# This file is free software; the Free Software Foundation
26db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
27db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
2876910425Smrg
29db17cd6dSmrg# AM_AUTOMAKE_VERSION(VERSION)
30db17cd6dSmrg# ----------------------------
31db17cd6dSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32db17cd6dSmrg# generated from the m4 files accompanying Automake X.Y.
33db17cd6dSmrg# (This private macro should not be called outside this file.)
34db17cd6dSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
358bfe6addSmrg[am__api_version='1.17'
36db17cd6dSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37db17cd6dSmrgdnl require some minimum version.  Point them to the right macro.
388bfe6addSmrgm4_if([$1], [1.17], [],
39db17cd6dSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40db17cd6dSmrg])
4176910425Smrg
42db17cd6dSmrg# _AM_AUTOCONF_VERSION(VERSION)
4376910425Smrg# -----------------------------
44db17cd6dSmrg# aclocal traces this macro to find the Autoconf version.
45db17cd6dSmrg# This is a private macro too.  Using m4_define simplifies
46db17cd6dSmrg# the logic in aclocal, which can simply ignore this definition.
47db17cd6dSmrgm4_define([_AM_AUTOCONF_VERSION], [])
48db17cd6dSmrg
49db17cd6dSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50db17cd6dSmrg# -------------------------------
51db17cd6dSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52db17cd6dSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53db17cd6dSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
548bfe6addSmrg[AM_AUTOMAKE_VERSION([1.17])dnl
55db17cd6dSmrgm4_ifndef([AC_AUTOCONF_VERSION],
56db17cd6dSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57db17cd6dSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5876910425Smrg
59db17cd6dSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
6076910425Smrg
618bfe6addSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
62db17cd6dSmrg#
63db17cd6dSmrg# This file is free software; the Free Software Foundation
64db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
65db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
66db17cd6dSmrg
67db17cd6dSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
689ff100acSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
699ff100acSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7076910425Smrg#
71db17cd6dSmrg# Of course, Automake must honor this variable whenever it calls a
72db17cd6dSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73db17cd6dSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74db17cd6dSmrg# depending on how configure is run.  This is pretty annoying, since
75db17cd6dSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76db17cd6dSmrg# source directory, any form will work fine, but in subdirectories a
77db17cd6dSmrg# relative path needs to be adjusted first.
7876910425Smrg#
79db17cd6dSmrg# $ac_aux_dir/missing
80db17cd6dSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81db17cd6dSmrg# $top_srcdir/$ac_aux_dir/missing
82db17cd6dSmrg#    fails if $ac_aux_dir is absolute,
83db17cd6dSmrg#    fails when called from a subdirectory in a VPATH build with
84db17cd6dSmrg#          a relative $ac_aux_dir
8576910425Smrg#
86db17cd6dSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87db17cd6dSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
889ff100acSmrg# harmless because $srcdir is '.', but things will broke when you
89db17cd6dSmrg# start a VPATH build or use an absolute $srcdir.
9076910425Smrg#
91db17cd6dSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92db17cd6dSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93db17cd6dSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94db17cd6dSmrg# and then we would define $MISSING as
95db17cd6dSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96db17cd6dSmrg# This will work as long as MISSING is not called from configure, because
97db17cd6dSmrg# unfortunately $(top_srcdir) has no meaning in configure.
98db17cd6dSmrg# However there are other variables, like CC, which are often used in
99db17cd6dSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100db17cd6dSmrg#
101db17cd6dSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
102db17cd6dSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
103db17cd6dSmrg# configured tree to be moved without reconfiguration.
10476910425Smrg
105db17cd6dSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1069ff100acSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1079ff100acSmrg# Expand $ac_aux_dir to an absolute path.
1089ff100acSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109db17cd6dSmrg])
11076910425Smrg
111db17cd6dSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11276910425Smrg
1138bfe6addSmrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
114db17cd6dSmrg#
115db17cd6dSmrg# This file is free software; the Free Software Foundation
116db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
117db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
11876910425Smrg
119db17cd6dSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120db17cd6dSmrg# -------------------------------------
121db17cd6dSmrg# Define a conditional.
122db17cd6dSmrgAC_DEFUN([AM_CONDITIONAL],
1239ff100acSmrg[AC_PREREQ([2.52])dnl
1249ff100acSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1259ff100acSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126db17cd6dSmrgAC_SUBST([$1_TRUE])dnl
127db17cd6dSmrgAC_SUBST([$1_FALSE])dnl
128db17cd6dSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129db17cd6dSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130db17cd6dSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131db17cd6dSmrgif $2; then
132db17cd6dSmrg  $1_TRUE=
133db17cd6dSmrg  $1_FALSE='#'
134db17cd6dSmrgelse
135db17cd6dSmrg  $1_TRUE='#'
136db17cd6dSmrg  $1_FALSE=
137db17cd6dSmrgfi
138db17cd6dSmrgAC_CONFIG_COMMANDS_PRE(
139db17cd6dSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140db17cd6dSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141db17cd6dSmrgUsually this means the macro was only invoked conditionally.]])
142db17cd6dSmrgfi])])
14376910425Smrg
1448bfe6addSmrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
145db17cd6dSmrg#
146db17cd6dSmrg# This file is free software; the Free Software Foundation
147db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
148db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
14976910425Smrg
15076910425Smrg
1519ff100acSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
152db17cd6dSmrg# written in clear, in which case automake, when reading aclocal.m4,
153db17cd6dSmrg# will think it sees a *use*, and therefore will trigger all it's
154db17cd6dSmrg# C support machinery.  Also note that it means that autoscan, seeing
155db17cd6dSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
15676910425Smrg
15776910425Smrg
158db17cd6dSmrg# _AM_DEPENDENCIES(NAME)
159db17cd6dSmrg# ----------------------
160db17cd6dSmrg# See how the compiler implements dependency checking.
1619ff100acSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
162db17cd6dSmrg# We try a few techniques and use that to set a single cache variable.
163db17cd6dSmrg#
164db17cd6dSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
165db17cd6dSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
166db17cd6dSmrg# dependency, and given that the user is not expected to run this macro,
167db17cd6dSmrg# just rely on AC_PROG_CC.
168db17cd6dSmrgAC_DEFUN([_AM_DEPENDENCIES],
169db17cd6dSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
170db17cd6dSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
171db17cd6dSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
172db17cd6dSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
17376910425Smrg
1749ff100acSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1759ff100acSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1769ff100acSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1779ff100acSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1789ff100acSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1799ff100acSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1809ff100acSmrg                    [depcc="$$1"   am_compiler_list=])
18176910425Smrg
182db17cd6dSmrgAC_CACHE_CHECK([dependency style of $depcc],
183db17cd6dSmrg               [am_cv_$1_dependencies_compiler_type],
184db17cd6dSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
185db17cd6dSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
186db17cd6dSmrg  # making bogus files that we don't know about and never remove.  For
187db17cd6dSmrg  # instance it was reported that on HP-UX the gcc test will end up
1889ff100acSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1899ff100acSmrg  # in D".
1909ff100acSmrg  rm -rf conftest.dir
191db17cd6dSmrg  mkdir conftest.dir
192db17cd6dSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
193db17cd6dSmrg  # using a relative directory.
194db17cd6dSmrg  cp "$am_depcomp" conftest.dir
195db17cd6dSmrg  cd conftest.dir
196db17cd6dSmrg  # We will build objects and dependencies in a subdirectory because
197db17cd6dSmrg  # it helps to detect inapplicable dependency modes.  For instance
198db17cd6dSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
199db17cd6dSmrg  # side effect of compilation, but ICC will put the dependencies in
200db17cd6dSmrg  # the current directory while Tru64 will put them in the object
201db17cd6dSmrg  # directory.
202db17cd6dSmrg  mkdir sub
20376910425Smrg
204db17cd6dSmrg  am_cv_$1_dependencies_compiler_type=none
205db17cd6dSmrg  if test "$am_compiler_list" = ""; then
206db17cd6dSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
207db17cd6dSmrg  fi
208db17cd6dSmrg  am__universal=false
209db17cd6dSmrg  m4_case([$1], [CC],
210db17cd6dSmrg    [case " $depcc " in #(
211db17cd6dSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212db17cd6dSmrg     esac],
213db17cd6dSmrg    [CXX],
214db17cd6dSmrg    [case " $depcc " in #(
215db17cd6dSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216db17cd6dSmrg     esac])
21776910425Smrg
218db17cd6dSmrg  for depmode in $am_compiler_list; do
219db17cd6dSmrg    # Setup a source with many dependencies, because some compilers
220db17cd6dSmrg    # like to wrap large dependency lists on column 80 (with \), and
221db17cd6dSmrg    # we should not choose a depcomp mode which is confused by this.
222db17cd6dSmrg    #
223db17cd6dSmrg    # We need to recreate these files for each test, as the compiler may
224db17cd6dSmrg    # overwrite some of them when testing with obscure command lines.
225db17cd6dSmrg    # This happens at least with the AIX C compiler.
226db17cd6dSmrg    : > sub/conftest.c
227db17cd6dSmrg    for i in 1 2 3 4 5 6; do
228db17cd6dSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2299ff100acSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2309ff100acSmrg      # Solaris 10 /bin/sh.
2319ff100acSmrg      echo '/* dummy */' > sub/conftst$i.h
232db17cd6dSmrg    done
233db17cd6dSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234db17cd6dSmrg
2359ff100acSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236db17cd6dSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2379ff100acSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2389ff100acSmrg    # versions had trouble with output in subdirs.
239db17cd6dSmrg    am__obj=sub/conftest.${OBJEXT-o}
240db17cd6dSmrg    am__minus_obj="-o $am__obj"
241db17cd6dSmrg    case $depmode in
242db17cd6dSmrg    gcc)
243db17cd6dSmrg      # This depmode causes a compiler race in universal mode.
244db17cd6dSmrg      test "$am__universal" = false || continue
245db17cd6dSmrg      ;;
246db17cd6dSmrg    nosideeffect)
2479ff100acSmrg      # After this tag, mechanisms are not by side-effect, so they'll
2489ff100acSmrg      # only be used when explicitly requested.
249db17cd6dSmrg      if test "x$enable_dependency_tracking" = xyes; then
250db17cd6dSmrg	continue
251db17cd6dSmrg      else
252db17cd6dSmrg	break
253db17cd6dSmrg      fi
254db17cd6dSmrg      ;;
2559ff100acSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2569ff100acSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
257db17cd6dSmrg      # not run yet.  These depmodes are late enough in the game, and
258db17cd6dSmrg      # so weak that their functioning should not be impacted.
259db17cd6dSmrg      am__obj=conftest.${OBJEXT-o}
260db17cd6dSmrg      am__minus_obj=
261db17cd6dSmrg      ;;
262db17cd6dSmrg    none) break ;;
263db17cd6dSmrg    esac
264db17cd6dSmrg    if depmode=$depmode \
265db17cd6dSmrg       source=sub/conftest.c object=$am__obj \
266db17cd6dSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267db17cd6dSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
268db17cd6dSmrg         >/dev/null 2>conftest.err &&
269db17cd6dSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
270db17cd6dSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271db17cd6dSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
272db17cd6dSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
273db17cd6dSmrg      # icc doesn't choke on unknown options, it will just issue warnings
274db17cd6dSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
275db17cd6dSmrg      # that says an option was ignored or not supported.
2768bfe6addSmrg      # When given -MP, icc 7.0 and 7.1 complain thus:
277db17cd6dSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
278db17cd6dSmrg      # The diagnosis changed in icc 8.0:
279db17cd6dSmrg      #   icc: Command line remark: option '-MP' not supported
280db17cd6dSmrg      if (grep 'ignoring option' conftest.err ||
281db17cd6dSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
282db17cd6dSmrg        am_cv_$1_dependencies_compiler_type=$depmode
283db17cd6dSmrg        break
284db17cd6dSmrg      fi
285db17cd6dSmrg    fi
286db17cd6dSmrg  done
287db17cd6dSmrg
288db17cd6dSmrg  cd ..
289db17cd6dSmrg  rm -rf conftest.dir
29076910425Smrgelse
291db17cd6dSmrg  am_cv_$1_dependencies_compiler_type=none
29276910425Smrgfi
293db17cd6dSmrg])
294db17cd6dSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
295db17cd6dSmrgAM_CONDITIONAL([am__fastdep$1], [
296db17cd6dSmrg  test "x$enable_dependency_tracking" != xno \
297db17cd6dSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298db17cd6dSmrg])
29976910425Smrg
30076910425Smrg
301db17cd6dSmrg# AM_SET_DEPDIR
302db17cd6dSmrg# -------------
303db17cd6dSmrg# Choose a directory name for dependency files.
3049ff100acSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
305db17cd6dSmrgAC_DEFUN([AM_SET_DEPDIR],
306db17cd6dSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
307db17cd6dSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
308db17cd6dSmrg])
30976910425Smrg
31076910425Smrg
311db17cd6dSmrg# AM_DEP_TRACK
312db17cd6dSmrg# ------------
313db17cd6dSmrgAC_DEFUN([AM_DEP_TRACK],
3149ff100acSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3159ff100acSmrgAS_HELP_STRING(
3169ff100acSmrg  [--enable-dependency-tracking],
3179ff100acSmrg  [do not reject slow dependency extractors])
3189ff100acSmrgAS_HELP_STRING(
3199ff100acSmrg  [--disable-dependency-tracking],
3209ff100acSmrg  [speeds up one-time build])])
321db17cd6dSmrgif test "x$enable_dependency_tracking" != xno; then
322db17cd6dSmrg  am_depcomp="$ac_aux_dir/depcomp"
323db17cd6dSmrg  AMDEPBACKSLASH='\'
3249ff100acSmrg  am__nodep='_no'
32576910425Smrgfi
326db17cd6dSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
327db17cd6dSmrgAC_SUBST([AMDEPBACKSLASH])dnl
328db17cd6dSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3299ff100acSmrgAC_SUBST([am__nodep])dnl
3309ff100acSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
331db17cd6dSmrg])
33276910425Smrg
333db17cd6dSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334db17cd6dSmrg
3358bfe6addSmrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
336db17cd6dSmrg#
337db17cd6dSmrg# This file is free software; the Free Software Foundation
338db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
339db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
340db17cd6dSmrg
341db17cd6dSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
342db17cd6dSmrg# ------------------------------
343db17cd6dSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
344db17cd6dSmrg[{
3459ff100acSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
346db17cd6dSmrg  # are listed without --file.  Let's play safe and only enable the eval
347db17cd6dSmrg  # if we detect the quoting.
348a67f45c3Smrg  # TODO: see whether this extra hack can be removed once we start
349a67f45c3Smrg  # requiring Autoconf 2.70 or later.
350a67f45c3Smrg  AS_CASE([$CONFIG_FILES],
351a67f45c3Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
352a67f45c3Smrg          [*], [set x $CONFIG_FILES])
353db17cd6dSmrg  shift
354a67f45c3Smrg  # Used to flag and report bootstrapping failures.
355a67f45c3Smrg  am_rc=0
356a67f45c3Smrg  for am_mf
357db17cd6dSmrg  do
358db17cd6dSmrg    # Strip MF so we end up with the name of the file.
359a67f45c3Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
360a67f45c3Smrg    # Check whether this is an Automake generated Makefile which includes
361a67f45c3Smrg    # dependency-tracking related rules and includes.
362a67f45c3Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
363db17cd6dSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
364a67f45c3Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
365a67f45c3Smrg      || continue
366a67f45c3Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
367a67f45c3Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
368a67f45c3Smrg    AM_RUN_LOG([cd "$am_dirpart" \
369a67f45c3Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
370a67f45c3Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
371db17cd6dSmrg  done
372a67f45c3Smrg  if test $am_rc -ne 0; then
373a67f45c3Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
374a67f45c3Smrg    for automatic dependency tracking.  If GNU make was not used, consider
375a67f45c3Smrg    re-running the configure script with MAKE="gmake" (or whatever is
376a67f45c3Smrg    necessary).  You can also try re-running configure with the
377a67f45c3Smrg    '--disable-dependency-tracking' option to at least be able to build
378a67f45c3Smrg    the package (albeit without support for automatic dependency tracking).])
379a67f45c3Smrg  fi
380a67f45c3Smrg  AS_UNSET([am_dirpart])
381a67f45c3Smrg  AS_UNSET([am_filepart])
382a67f45c3Smrg  AS_UNSET([am_mf])
383a67f45c3Smrg  AS_UNSET([am_rc])
384a67f45c3Smrg  rm -f conftest-deps.mk
385db17cd6dSmrg}
386db17cd6dSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387db17cd6dSmrg
388db17cd6dSmrg
389db17cd6dSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
390db17cd6dSmrg# -----------------------------
391db17cd6dSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
392db17cd6dSmrg#
393a67f45c3Smrg# This code is only required when automatic dependency tracking is enabled.
394a67f45c3Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
395a67f45c3Smrg# order to bootstrap the dependency handling code.
396db17cd6dSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
397db17cd6dSmrg[AC_CONFIG_COMMANDS([depfiles],
398db17cd6dSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
399a67f45c3Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400db17cd6dSmrg
401db17cd6dSmrg# Do all the work for Automake.                             -*- Autoconf -*-
402db17cd6dSmrg
4038bfe6addSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
404db17cd6dSmrg#
405db17cd6dSmrg# This file is free software; the Free Software Foundation
406db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
407db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
408db17cd6dSmrg
409db17cd6dSmrg# This macro actually does too much.  Some checks are only needed if
410db17cd6dSmrg# your package does certain things.  But this isn't really a big deal.
411db17cd6dSmrg
4129ff100acSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4139ff100acSmrgm4_define([AC_PROG_CC],
4149ff100acSmrgm4_defn([AC_PROG_CC])
4159ff100acSmrg[_AM_PROG_CC_C_O
4169ff100acSmrg])
4179ff100acSmrg
418db17cd6dSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
419db17cd6dSmrg# AM_INIT_AUTOMAKE([OPTIONS])
420db17cd6dSmrg# -----------------------------------------------
421db17cd6dSmrg# The call with PACKAGE and VERSION arguments is the old style
422db17cd6dSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
423db17cd6dSmrg# and VERSION should now be passed to AC_INIT and removed from
424db17cd6dSmrg# the call to AM_INIT_AUTOMAKE.
425db17cd6dSmrg# We support both call styles for the transition.  After
426db17cd6dSmrg# the next Automake release, Autoconf can make the AC_INIT
427db17cd6dSmrg# arguments mandatory, and then we can depend on a new Autoconf
428db17cd6dSmrg# release and drop the old call support.
429db17cd6dSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4309ff100acSmrg[AC_PREREQ([2.65])dnl
431a67f45c3Smrgm4_ifdef([_$0_ALREADY_INIT],
432a67f45c3Smrg  [m4_fatal([$0 expanded multiple times
433a67f45c3Smrg]m4_defn([_$0_ALREADY_INIT]))],
434a67f45c3Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
435db17cd6dSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
436db17cd6dSmrgdnl the ones we care about.
437db17cd6dSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
438db17cd6dSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
439db17cd6dSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
440db17cd6dSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
441db17cd6dSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
442db17cd6dSmrg  # is not polluted with repeated "-I."
443db17cd6dSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
444db17cd6dSmrg  # test to see if srcdir already configured
445db17cd6dSmrg  if test -f $srcdir/config.status; then
446db17cd6dSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
447db17cd6dSmrg  fi
44876910425Smrgfi
44976910425Smrg
450db17cd6dSmrg# test whether we have cygpath
451db17cd6dSmrgif test -z "$CYGPATH_W"; then
452db17cd6dSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
453db17cd6dSmrg    CYGPATH_W='cygpath -w'
454db17cd6dSmrg  else
455db17cd6dSmrg    CYGPATH_W=echo
456db17cd6dSmrg  fi
45776910425Smrgfi
458db17cd6dSmrgAC_SUBST([CYGPATH_W])
459db17cd6dSmrg
460db17cd6dSmrg# Define the identity of the package.
461db17cd6dSmrgdnl Distinguish between old-style and new-style calls.
462db17cd6dSmrgm4_ifval([$2],
4639ff100acSmrg[AC_DIAGNOSE([obsolete],
4649ff100acSmrg             [$0: two- and three-arguments forms are deprecated.])
4659ff100acSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
466db17cd6dSmrg AC_SUBST([PACKAGE], [$1])dnl
467db17cd6dSmrg AC_SUBST([VERSION], [$2])],
468db17cd6dSmrg[_AM_SET_OPTIONS([$1])dnl
469db17cd6dSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4709ff100acSmrgm4_if(
471a67f45c3Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
4729ff100acSmrg  [ok:ok],,
473db17cd6dSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
474db17cd6dSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
475db17cd6dSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476db17cd6dSmrg
477db17cd6dSmrg_AM_IF_OPTION([no-define],,
4789ff100acSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4799ff100acSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480db17cd6dSmrg
481db17cd6dSmrg# Some tools Automake needs.
482db17cd6dSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
483db17cd6dSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4849ff100acSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4859ff100acSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4869ff100acSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4879ff100acSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4889ff100acSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
489db17cd6dSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
490db17cd6dSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4919ff100acSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4929ff100acSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
4939ff100acSmrg# dies out for good.  For more background, see:
494a67f45c3Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
495a67f45c3Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
4969ff100acSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
4979ff100acSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
4989ff100acSmrg# system "awk" is bad on some platforms.
499db17cd6dSmrgAC_REQUIRE([AC_PROG_AWK])dnl
500db17cd6dSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
501db17cd6dSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
502db17cd6dSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
503db17cd6dSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
504db17cd6dSmrg			     [_AM_PROG_TAR([v7])])])
505db17cd6dSmrg_AM_IF_OPTION([no-dependencies],,
506db17cd6dSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5079ff100acSmrg		  [_AM_DEPENDENCIES([CC])],
5089ff100acSmrg		  [m4_define([AC_PROG_CC],
5099ff100acSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
510db17cd6dSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5119ff100acSmrg		  [_AM_DEPENDENCIES([CXX])],
5129ff100acSmrg		  [m4_define([AC_PROG_CXX],
5139ff100acSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
514db17cd6dSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5159ff100acSmrg		  [_AM_DEPENDENCIES([OBJC])],
5169ff100acSmrg		  [m4_define([AC_PROG_OBJC],
5179ff100acSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5189ff100acSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5199ff100acSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
5209ff100acSmrg		  [m4_define([AC_PROG_OBJCXX],
5219ff100acSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
522db17cd6dSmrg])
523a67f45c3Smrg# Variables for tags utilities; see am/tags.am
524a67f45c3Smrgif test -z "$CTAGS"; then
525a67f45c3Smrg  CTAGS=ctags
526a67f45c3Smrgfi
527a67f45c3SmrgAC_SUBST([CTAGS])
528a67f45c3Smrgif test -z "$ETAGS"; then
529a67f45c3Smrg  ETAGS=etags
530a67f45c3Smrgfi
531a67f45c3SmrgAC_SUBST([ETAGS])
532a67f45c3Smrgif test -z "$CSCOPE"; then
533a67f45c3Smrg  CSCOPE=cscope
534a67f45c3Smrgfi
535a67f45c3SmrgAC_SUBST([CSCOPE])
536a67f45c3Smrg
5378bfe6addSmrgAC_REQUIRE([_AM_SILENT_RULES])dnl
5389ff100acSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
5399ff100acSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5409ff100acSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
541db17cd6dSmrgAC_CONFIG_COMMANDS_PRE(dnl
542db17cd6dSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
543db17cd6dSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5449ff100acSmrg
5458bfe6addSmrgAC_REQUIRE([_AM_PROG_RM_F])
5468bfe6addSmrgAC_REQUIRE([_AM_PROG_XARGS_N])
5479ff100acSmrg
5489ff100acSmrgdnl The trailing newline in this macro's definition is deliberate, for
5499ff100acSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
5509ff100acSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
551db17cd6dSmrg])
552db17cd6dSmrg
5539ff100acSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
554db17cd6dSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
555db17cd6dSmrgdnl mangled by Autoconf and run in a shell conditional statement.
556db17cd6dSmrgm4_define([_AC_COMPILER_EXEEXT],
557db17cd6dSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
558db17cd6dSmrg
559db17cd6dSmrg# When config.status generates a header, we must update the stamp-h file.
560db17cd6dSmrg# This file resides in the same directory as the config header
561db17cd6dSmrg# that is generated.  The stamp files are numbered to have different names.
562db17cd6dSmrg
563db17cd6dSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
564db17cd6dSmrg# loop where config.status creates the headers, so we can generate
565db17cd6dSmrg# our stamp files there.
566db17cd6dSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
567db17cd6dSmrg[# Compute $1's index in $config_headers.
568db17cd6dSmrg_am_arg=$1
569db17cd6dSmrg_am_stamp_count=1
570db17cd6dSmrgfor _am_header in $config_headers :; do
571db17cd6dSmrg  case $_am_header in
572db17cd6dSmrg    $_am_arg | $_am_arg:* )
573db17cd6dSmrg      break ;;
574db17cd6dSmrg    * )
575db17cd6dSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
576db17cd6dSmrg  esac
577db17cd6dSmrgdone
578db17cd6dSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
579db17cd6dSmrg
5808bfe6addSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
581db17cd6dSmrg#
582db17cd6dSmrg# This file is free software; the Free Software Foundation
583db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
584db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
585db17cd6dSmrg
586db17cd6dSmrg# AM_PROG_INSTALL_SH
587db17cd6dSmrg# ------------------
588db17cd6dSmrg# Define $install_sh.
589db17cd6dSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
590db17cd6dSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
5919ff100acSmrgif test x"${install_sh+set}" != xset; then
592db17cd6dSmrg  case $am_aux_dir in
593db17cd6dSmrg  *\ * | *\	*)
594db17cd6dSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
595db17cd6dSmrg  *)
596db17cd6dSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
597db17cd6dSmrg  esac
59876910425Smrgfi
5999ff100acSmrgAC_SUBST([install_sh])])
60076910425Smrg
6018bfe6addSmrg# Copyright (C) 2003-2024 Free Software Foundation, Inc.
602db17cd6dSmrg#
603db17cd6dSmrg# This file is free software; the Free Software Foundation
604db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
605db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
606db17cd6dSmrg
607db17cd6dSmrg# Check whether the underlying file-system supports filenames
608db17cd6dSmrg# with a leading dot.  For instance MS-DOS doesn't.
609db17cd6dSmrgAC_DEFUN([AM_SET_LEADING_DOT],
610db17cd6dSmrg[rm -rf .tst 2>/dev/null
611db17cd6dSmrgmkdir .tst 2>/dev/null
612db17cd6dSmrgif test -d .tst; then
613db17cd6dSmrg  am__leading_dot=.
614db17cd6dSmrgelse
615db17cd6dSmrg  am__leading_dot=_
61676910425Smrgfi
617db17cd6dSmrgrmdir .tst 2>/dev/null
618db17cd6dSmrgAC_SUBST([am__leading_dot])])
619db17cd6dSmrg
620db17cd6dSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
621db17cd6dSmrg
6228bfe6addSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
623db17cd6dSmrg#
624db17cd6dSmrg# This file is free software; the Free Software Foundation
625db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
626db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
627db17cd6dSmrg
628db17cd6dSmrg# AM_MAKE_INCLUDE()
629db17cd6dSmrg# -----------------
630a67f45c3Smrg# Check whether make has an 'include' directive that can support all
631a67f45c3Smrg# the idioms we need for our automatic dependency tracking code.
632db17cd6dSmrgAC_DEFUN([AM_MAKE_INCLUDE],
633a67f45c3Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
634a67f45c3Smrgcat > confinc.mk << 'END'
635db17cd6dSmrgam__doit:
636a67f45c3Smrg	@echo this is the am__doit target >confinc.out
637db17cd6dSmrg.PHONY: am__doit
638db17cd6dSmrgEND
639db17cd6dSmrgam__include="#"
640db17cd6dSmrgam__quote=
641a67f45c3Smrg# BSD make does it like this.
642a67f45c3Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
643a67f45c3Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
644a67f45c3Smrgecho 'include confinc.mk # ignored' > confmf.GNU
645a67f45c3Smrg_am_result=no
646a67f45c3Smrgfor s in GNU BSD; do
647a67f45c3Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
648a67f45c3Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
649a67f45c3Smrg      ['0:this is the am__doit target'],
650a67f45c3Smrg      [AS_CASE([$s],
651a67f45c3Smrg          [BSD], [am__include='.include' am__quote='"'],
652a67f45c3Smrg          [am__include='include' am__quote=''])])
653a67f45c3Smrg  if test "$am__include" != "#"; then
654a67f45c3Smrg    _am_result="yes ($s style)"
655a67f45c3Smrg    break
656a67f45c3Smrg  fi
657a67f45c3Smrgdone
658a67f45c3Smrgrm -f confinc.* confmf.*
659a67f45c3SmrgAC_MSG_RESULT([${_am_result}])
660a67f45c3SmrgAC_SUBST([am__include])])
661a67f45c3SmrgAC_SUBST([am__quote])])
66276910425Smrg
663db17cd6dSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
664db17cd6dSmrg
6658bfe6addSmrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
666db17cd6dSmrg#
667db17cd6dSmrg# This file is free software; the Free Software Foundation
668db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
669db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
670db17cd6dSmrg
671db17cd6dSmrg# AM_MISSING_PROG(NAME, PROGRAM)
672db17cd6dSmrg# ------------------------------
673db17cd6dSmrgAC_DEFUN([AM_MISSING_PROG],
674db17cd6dSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
675db17cd6dSmrg$1=${$1-"${am_missing_run}$2"}
676db17cd6dSmrgAC_SUBST($1)])
677db17cd6dSmrg
678db17cd6dSmrg# AM_MISSING_HAS_RUN
679db17cd6dSmrg# ------------------
6809ff100acSmrg# Define MISSING if not defined so far and test if it is modern enough.
6819ff100acSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
682db17cd6dSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
683db17cd6dSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
684db17cd6dSmrgAC_REQUIRE_AUX_FILE([missing])dnl
685db17cd6dSmrgif test x"${MISSING+set}" != xset; then
686a67f45c3Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
68776910425Smrgfi
688db17cd6dSmrg# Use eval to expand $SHELL
6899ff100acSmrgif eval "$MISSING --is-lightweight"; then
6909ff100acSmrg  am_missing_run="$MISSING "
691db17cd6dSmrgelse
692db17cd6dSmrg  am_missing_run=
6939ff100acSmrg  AC_MSG_WARN(['missing' script is too old or missing])
69476910425Smrgfi
695db17cd6dSmrg])
69676910425Smrg
697db17cd6dSmrg# Helper functions for option handling.                     -*- Autoconf -*-
698db17cd6dSmrg
6998bfe6addSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
700db17cd6dSmrg#
701db17cd6dSmrg# This file is free software; the Free Software Foundation
702db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
703db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
704db17cd6dSmrg
705db17cd6dSmrg# _AM_MANGLE_OPTION(NAME)
706db17cd6dSmrg# -----------------------
707db17cd6dSmrgAC_DEFUN([_AM_MANGLE_OPTION],
708db17cd6dSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
709db17cd6dSmrg
710db17cd6dSmrg# _AM_SET_OPTION(NAME)
7119ff100acSmrg# --------------------
712db17cd6dSmrg# Set option NAME.  Presently that only means defining a flag for this option.
713db17cd6dSmrgAC_DEFUN([_AM_SET_OPTION],
7149ff100acSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
715db17cd6dSmrg
716db17cd6dSmrg# _AM_SET_OPTIONS(OPTIONS)
7179ff100acSmrg# ------------------------
718db17cd6dSmrg# OPTIONS is a space-separated list of Automake options.
719db17cd6dSmrgAC_DEFUN([_AM_SET_OPTIONS],
720db17cd6dSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
72176910425Smrg
722db17cd6dSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
723db17cd6dSmrg# -------------------------------------------
724db17cd6dSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
725db17cd6dSmrgAC_DEFUN([_AM_IF_OPTION],
726db17cd6dSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
72776910425Smrg
7288bfe6addSmrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
7299ff100acSmrg#
7309ff100acSmrg# This file is free software; the Free Software Foundation
7319ff100acSmrg# gives unlimited permission to copy and/or distribute it,
7329ff100acSmrg# with or without modifications, as long as this notice is preserved.
7339ff100acSmrg
7349ff100acSmrg# _AM_PROG_CC_C_O
7359ff100acSmrg# ---------------
7369ff100acSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
7379ff100acSmrg# to automatically call this.
7389ff100acSmrgAC_DEFUN([_AM_PROG_CC_C_O],
7399ff100acSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7409ff100acSmrgAC_REQUIRE_AUX_FILE([compile])dnl
7419ff100acSmrgAC_LANG_PUSH([C])dnl
7429ff100acSmrgAC_CACHE_CHECK(
7439ff100acSmrg  [whether $CC understands -c and -o together],
7449ff100acSmrg  [am_cv_prog_cc_c_o],
7459ff100acSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
7469ff100acSmrg  # Make sure it works both with $CC and with simple cc.
7479ff100acSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
7489ff100acSmrg  # compilers refuse to overwrite an existing .o file with -o,
7499ff100acSmrg  # though they will create one.
7509ff100acSmrg  am_cv_prog_cc_c_o=yes
7519ff100acSmrg  for am_i in 1 2; do
7529ff100acSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
7539ff100acSmrg         && test -f conftest2.$ac_objext; then
7549ff100acSmrg      : OK
7559ff100acSmrg    else
7569ff100acSmrg      am_cv_prog_cc_c_o=no
7579ff100acSmrg      break
7589ff100acSmrg    fi
7599ff100acSmrg  done
7609ff100acSmrg  rm -f core conftest*
7619ff100acSmrg  unset am_i])
7629ff100acSmrgif test "$am_cv_prog_cc_c_o" != yes; then
7639ff100acSmrg   # Losing compiler, so override with the script.
7649ff100acSmrg   # FIXME: It is wrong to rewrite CC.
7659ff100acSmrg   # But if we don't then we get into trouble of one sort or another.
7669ff100acSmrg   # A longer-term fix would be to have automake use am__CC in this case,
7679ff100acSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
7689ff100acSmrg   CC="$am_aux_dir/compile $CC"
7699ff100acSmrgfi
7709ff100acSmrgAC_LANG_POP([C])])
7719ff100acSmrg
7729ff100acSmrg# For backward compatibility.
7739ff100acSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
77476910425Smrg
7758bfe6addSmrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
7768bfe6addSmrg#
7778bfe6addSmrg# This file is free software; the Free Software Foundation
7788bfe6addSmrg# gives unlimited permission to copy and/or distribute it,
7798bfe6addSmrg# with or without modifications, as long as this notice is preserved.
7808bfe6addSmrg
7818bfe6addSmrg# _AM_PROG_RM_F
7828bfe6addSmrg# ---------------
7838bfe6addSmrg# Check whether 'rm -f' without any arguments works.
7848bfe6addSmrg# https://bugs.gnu.org/10828
7858bfe6addSmrgAC_DEFUN([_AM_PROG_RM_F],
7868bfe6addSmrg[am__rm_f_notfound=
7878bfe6addSmrgAS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""'])
7888bfe6addSmrgAC_SUBST(am__rm_f_notfound)
7898bfe6addSmrg])
7908bfe6addSmrg
7918bfe6addSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
792db17cd6dSmrg#
793db17cd6dSmrg# This file is free software; the Free Software Foundation
794db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
795db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
79676910425Smrg
7979ff100acSmrg# AM_RUN_LOG(COMMAND)
7989ff100acSmrg# -------------------
7999ff100acSmrg# Run COMMAND, save the exit status in ac_status, and log it.
8009ff100acSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8019ff100acSmrgAC_DEFUN([AM_RUN_LOG],
8029ff100acSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8039ff100acSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8049ff100acSmrg   ac_status=$?
8059ff100acSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8069ff100acSmrg   (exit $ac_status); }])
8079ff100acSmrg
8089ff100acSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8099ff100acSmrg
8108bfe6addSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
8119ff100acSmrg#
8129ff100acSmrg# This file is free software; the Free Software Foundation
8139ff100acSmrg# gives unlimited permission to copy and/or distribute it,
8149ff100acSmrg# with or without modifications, as long as this notice is preserved.
81576910425Smrg
8168bfe6addSmrg# _AM_SLEEP_FRACTIONAL_SECONDS
8178bfe6addSmrg# ----------------------------
8188bfe6addSmrgAC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl
8198bfe6addSmrgAC_CACHE_CHECK([whether sleep supports fractional seconds],
8208bfe6addSmrg               am_cv_sleep_fractional_seconds, [dnl
8218bfe6addSmrgAS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes],
8228bfe6addSmrg                                 [am_cv_sleep_fractional_seconds=no])
8238bfe6addSmrg])])
8248bfe6addSmrg
8258bfe6addSmrg# _AM_FILESYSTEM_TIMESTAMP_RESOLUTION
8268bfe6addSmrg# -----------------------------------
8278bfe6addSmrg# Determine the filesystem's resolution for file modification
8288bfe6addSmrg# timestamps.  The coarsest we know of is FAT, with a resolution
8298bfe6addSmrg# of only two seconds, even with the most recent "exFAT" extensions.
8308bfe6addSmrg# The finest (e.g. ext4 with large inodes, XFS, ZFS) is one
8318bfe6addSmrg# nanosecond, matching clock_gettime.  However, it is probably not
8328bfe6addSmrg# possible to delay execution of a shell script for less than one
8338bfe6addSmrg# millisecond, due to process creation overhead and scheduling
8348bfe6addSmrg# granularity, so we don't check for anything finer than that. (See below.)
8358bfe6addSmrgAC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl
8368bfe6addSmrgAC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS])
8378bfe6addSmrgAC_CACHE_CHECK([filesystem timestamp resolution],
8388bfe6addSmrg               am_cv_filesystem_timestamp_resolution, [dnl
8398bfe6addSmrg# Default to the worst case.
8408bfe6addSmrgam_cv_filesystem_timestamp_resolution=2
8418bfe6addSmrg
8428bfe6addSmrg# Only try to go finer than 1 sec if sleep can do it.
8438bfe6addSmrg# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work,
8448bfe6addSmrg# - 1 sec is not much of a win compared to 2 sec, and
8458bfe6addSmrg# - it takes 2 seconds to perform the test whether 1 sec works.
8468bfe6addSmrg# 
8478bfe6addSmrg# Instead, just use the default 2s on platforms that have 1s resolution,
8488bfe6addSmrg# accept the extra 1s delay when using $sleep in the Automake tests, in
8498bfe6addSmrg# exchange for not incurring the 2s delay for running the test for all
8508bfe6addSmrg# packages.
8518bfe6addSmrg#
8528bfe6addSmrgam_try_resolutions=
8538bfe6addSmrgif test "$am_cv_sleep_fractional_seconds" = yes; then
8548bfe6addSmrg  # Even a millisecond often causes a bunch of false positives,
8558bfe6addSmrg  # so just try a hundredth of a second. The time saved between .001 and
8568bfe6addSmrg  # .01 is not terribly consequential.
8578bfe6addSmrg  am_try_resolutions="0.01 0.1 $am_try_resolutions"
8588bfe6addSmrgfi
8598bfe6addSmrg
8608bfe6addSmrg# In order to catch current-generation FAT out, we must *modify* files
8618bfe6addSmrg# that already exist; the *creation* timestamp is finer.  Use names
8628bfe6addSmrg# that make ls -t sort them differently when they have equal
8638bfe6addSmrg# timestamps than when they have distinct timestamps, keeping
8648bfe6addSmrg# in mind that ls -t prints the *newest* file first.
8658bfe6addSmrgrm -f conftest.ts?
8668bfe6addSmrg: > conftest.ts1
8678bfe6addSmrg: > conftest.ts2
8688bfe6addSmrg: > conftest.ts3
8698bfe6addSmrg
8708bfe6addSmrg# Make sure ls -t actually works.  Do 'set' in a subshell so we don't
8718bfe6addSmrg# clobber the current shell's arguments. (Outer-level square brackets
8728bfe6addSmrg# are removed by m4; they're present so that m4 does not expand
8738bfe6addSmrg# <dollar><star>; be careful, easy to get confused.)
8748bfe6addSmrgif (
8758bfe6addSmrg     set X `[ls -t conftest.ts[12]]` &&
8768bfe6addSmrg     {
8778bfe6addSmrg       test "$[]*" != "X conftest.ts1 conftest.ts2" ||
8788bfe6addSmrg       test "$[]*" != "X conftest.ts2 conftest.ts1";
8798bfe6addSmrg     }
8808bfe6addSmrg); then :; else
8818bfe6addSmrg  # If neither matched, then we have a broken ls.  This can happen
8828bfe6addSmrg  # if, for instance, CONFIG_SHELL is bash and it inherits a
8838bfe6addSmrg  # broken ls alias from the environment.  This has actually
8848bfe6addSmrg  # happened.  Such a system could not be considered "sane".
8858bfe6addSmrg  _AS_ECHO_UNQUOTED(
8868bfe6addSmrg    ["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""],
8878bfe6addSmrg    [AS_MESSAGE_LOG_FD])
8888bfe6addSmrg  AC_MSG_FAILURE([ls -t produces unexpected output.
8898bfe6addSmrgMake sure there is not a broken ls alias in your environment.])
8908bfe6addSmrgfi
8918bfe6addSmrg
8928bfe6addSmrgfor am_try_res in $am_try_resolutions; do
8938bfe6addSmrg  # Any one fine-grained sleep might happen to cross the boundary
8948bfe6addSmrg  # between two values of a coarser actual resolution, but if we do
8958bfe6addSmrg  # two fine-grained sleeps in a row, at least one of them will fall
8968bfe6addSmrg  # entirely within a coarse interval.
8978bfe6addSmrg  echo alpha > conftest.ts1
8988bfe6addSmrg  sleep $am_try_res
8998bfe6addSmrg  echo beta > conftest.ts2
9008bfe6addSmrg  sleep $am_try_res
9018bfe6addSmrg  echo gamma > conftest.ts3
9028bfe6addSmrg
9038bfe6addSmrg  # We assume that 'ls -t' will make use of high-resolution
9048bfe6addSmrg  # timestamps if the operating system supports them at all.
9058bfe6addSmrg  if (set X `ls -t conftest.ts?` &&
9068bfe6addSmrg      test "$[]2" = conftest.ts3 &&
9078bfe6addSmrg      test "$[]3" = conftest.ts2 &&
9088bfe6addSmrg      test "$[]4" = conftest.ts1); then
9098bfe6addSmrg    #
9108bfe6addSmrg    # Ok, ls -t worked. If we're at a resolution of 1 second, we're done,
9118bfe6addSmrg    # because we don't need to test make.
9128bfe6addSmrg    make_ok=true
9138bfe6addSmrg    if test $am_try_res != 1; then
9148bfe6addSmrg      # But if we've succeeded so far with a subsecond resolution, we
9158bfe6addSmrg      # have one more thing to check: make. It can happen that
9168bfe6addSmrg      # everything else supports the subsecond mtimes, but make doesn't;
9178bfe6addSmrg      # notably on macOS, which ships make 3.81 from 2006 (the last one
9188bfe6addSmrg      # released under GPLv2). https://bugs.gnu.org/68808
9198bfe6addSmrg      # 
9208bfe6addSmrg      # We test $MAKE if it is defined in the environment, else "make".
9218bfe6addSmrg      # It might get overridden later, but our hope is that in practice
9228bfe6addSmrg      # it does not matter: it is the system "make" which is (by far)
9238bfe6addSmrg      # the most likely to be broken, whereas if the user overrides it,
9248bfe6addSmrg      # probably they did so with a better, or at least not worse, make.
9258bfe6addSmrg      # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html
9268bfe6addSmrg      #
9278bfe6addSmrg      # Create a Makefile (real tab character here):
9288bfe6addSmrg      rm -f conftest.mk
9298bfe6addSmrg      echo 'conftest.ts1: conftest.ts2' >conftest.mk
9308bfe6addSmrg      echo '	touch conftest.ts2' >>conftest.mk
9318bfe6addSmrg      #
9328bfe6addSmrg      # Now, running
9338bfe6addSmrg      #   touch conftest.ts1; touch conftest.ts2; make
9348bfe6addSmrg      # should touch ts1 because ts2 is newer. This could happen by luck,
9358bfe6addSmrg      # but most often, it will fail if make's support is insufficient. So
9368bfe6addSmrg      # test for several consecutive successes.
9378bfe6addSmrg      #
9388bfe6addSmrg      # (We reuse conftest.ts[12] because we still want to modify existing
9398bfe6addSmrg      # files, not create new ones, per above.)
9408bfe6addSmrg      n=0
9418bfe6addSmrg      make=${MAKE-make}
9428bfe6addSmrg      until test $n -eq 3; do
9438bfe6addSmrg        echo one > conftest.ts1
9448bfe6addSmrg        sleep $am_try_res
9458bfe6addSmrg        echo two > conftest.ts2 # ts2 should now be newer than ts1
9468bfe6addSmrg        if $make -f conftest.mk | grep 'up to date' >/dev/null; then
9478bfe6addSmrg          make_ok=false
9488bfe6addSmrg          break # out of $n loop
9498bfe6addSmrg        fi
9508bfe6addSmrg        n=`expr $n + 1`
9518bfe6addSmrg      done
9528bfe6addSmrg    fi
9538bfe6addSmrg    #
9548bfe6addSmrg    if $make_ok; then
9558bfe6addSmrg      # Everything we know to check worked out, so call this resolution good.
9568bfe6addSmrg      am_cv_filesystem_timestamp_resolution=$am_try_res
9578bfe6addSmrg      break # out of $am_try_res loop
9588bfe6addSmrg    fi
9598bfe6addSmrg    # Otherwise, we'll go on to check the next resolution.
9608bfe6addSmrg  fi
9618bfe6addSmrgdone
9628bfe6addSmrgrm -f conftest.ts?
9638bfe6addSmrg# (end _am_filesystem_timestamp_resolution)
9648bfe6addSmrg])])
9658bfe6addSmrg
966db17cd6dSmrg# AM_SANITY_CHECK
967db17cd6dSmrg# ---------------
968db17cd6dSmrgAC_DEFUN([AM_SANITY_CHECK],
9698bfe6addSmrg[AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION])
9708bfe6addSmrg# This check should not be cached, as it may vary across builds of
9718bfe6addSmrg# different projects.
9728bfe6addSmrgAC_MSG_CHECKING([whether build environment is sane])
973db17cd6dSmrg# Reject unsafe characters in $srcdir or the absolute working directory
974db17cd6dSmrg# name.  Accept space and tab only in the latter.
975db17cd6dSmrgam_lf='
976db17cd6dSmrg'
977db17cd6dSmrgcase `pwd` in
978db17cd6dSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
979db17cd6dSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
980db17cd6dSmrgesac
981db17cd6dSmrgcase $srcdir in
982db17cd6dSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
9839ff100acSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
984db17cd6dSmrgesac
98576910425Smrg
9869ff100acSmrg# Do 'set' in a subshell so we don't clobber the current shell's
987db17cd6dSmrg# arguments.  Must try -L first in case configure is actually a
988db17cd6dSmrg# symlink; some systems play weird games with the mod time of symlinks
989db17cd6dSmrg# (eg FreeBSD returns the mod time of the symlink's containing
990db17cd6dSmrg# directory).
9918bfe6addSmrgam_build_env_is_sane=no
9928bfe6addSmrgam_has_slept=no
9938bfe6addSmrgrm -f conftest.file
9948bfe6addSmrgfor am_try in 1 2; do
9958bfe6addSmrg  echo "timestamp, slept: $am_has_slept" > conftest.file
9968bfe6addSmrg  if (
9978bfe6addSmrg    set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
9988bfe6addSmrg    if test "$[]*" = "X"; then
9998bfe6addSmrg      # -L didn't work.
10008bfe6addSmrg      set X `ls -t "$srcdir/configure" conftest.file`
10018bfe6addSmrg    fi
10028bfe6addSmrg    test "$[]2" = conftest.file
10038bfe6addSmrg  ); then
10048bfe6addSmrg    am_build_env_is_sane=yes
10058bfe6addSmrg    break
10068bfe6addSmrg  fi
10078bfe6addSmrg  # Just in case.
10088bfe6addSmrg  sleep "$am_cv_filesystem_timestamp_resolution"
10098bfe6addSmrg  am_has_slept=yes
10108bfe6addSmrgdone
10118bfe6addSmrg
10128bfe6addSmrgAC_MSG_RESULT([$am_build_env_is_sane])
10138bfe6addSmrgif test "$am_build_env_is_sane" = no; then
10148bfe6addSmrg  AC_MSG_ERROR([newly created file is older than distributed files!
1015db17cd6dSmrgCheck your system clock])
101676910425Smrgfi
10178bfe6addSmrg
10189ff100acSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
10199ff100acSmrg# generated files are strictly newer.
10209ff100acSmrgam_sleep_pid=
10218bfe6addSmrgAS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl
10228bfe6addSmrg  ( sleep "$am_cv_filesystem_timestamp_resolution" ) &
10239ff100acSmrg  am_sleep_pid=$!
10248bfe6addSmrg])
10259ff100acSmrgAC_CONFIG_COMMANDS_PRE(
10269ff100acSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
10279ff100acSmrg   if test -n "$am_sleep_pid"; then
10289ff100acSmrg     # Hide warnings about reused PIDs.
10299ff100acSmrg     wait $am_sleep_pid 2>/dev/null
10309ff100acSmrg   fi
10319ff100acSmrg   AC_MSG_RESULT([done])])
10329ff100acSmrgrm -f conftest.file
10339ff100acSmrg])
103476910425Smrg
10358bfe6addSmrg# Copyright (C) 2009-2024 Free Software Foundation, Inc.
1036db17cd6dSmrg#
1037db17cd6dSmrg# This file is free software; the Free Software Foundation
1038db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
1039db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
104076910425Smrg
10418bfe6addSmrg# _AM_SILENT_RULES
10428bfe6addSmrg# ----------------
10438bfe6addSmrg# Enable less verbose build rules support.
10448bfe6addSmrgAC_DEFUN([_AM_SILENT_RULES],
10458bfe6addSmrg[AM_DEFAULT_VERBOSITY=1
10468bfe6addSmrgAC_ARG_ENABLE([silent-rules], [dnl
10479ff100acSmrgAS_HELP_STRING(
10489ff100acSmrg  [--enable-silent-rules],
10499ff100acSmrg  [less verbose build output (undo: "make V=1")])
10509ff100acSmrgAS_HELP_STRING(
10519ff100acSmrg  [--disable-silent-rules],
10529ff100acSmrg  [verbose build output (undo: "make V=0")])dnl
10539ff100acSmrg])
10549ff100acSmrgdnl
10559ff100acSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
10569ff100acSmrgdnl do not support nested variable expansions.
10579ff100acSmrgdnl See automake bug#9928 and bug#10237.
10589ff100acSmrgam_make=${MAKE-make}
10599ff100acSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
10609ff100acSmrg   [am_cv_make_support_nested_variables],
10619ff100acSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
10629ff100acSmrgBAR0=false
10639ff100acSmrgBAR1=true
10649ff100acSmrgV=1
10659ff100acSmrgam__doit:
10669ff100acSmrg	@$(TRUE)
10679ff100acSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
10689ff100acSmrg  am_cv_make_support_nested_variables=yes
10699ff100acSmrgelse
10709ff100acSmrg  am_cv_make_support_nested_variables=no
10719ff100acSmrgfi])
10729ff100acSmrgAC_SUBST([AM_V])dnl
10739ff100acSmrgAM_SUBST_NOTMAKE([AM_V])dnl
10749ff100acSmrgAC_SUBST([AM_DEFAULT_V])dnl
10759ff100acSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
1076db17cd6dSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
1077db17cd6dSmrgAM_BACKSLASH='\'
1078db17cd6dSmrgAC_SUBST([AM_BACKSLASH])dnl
1079db17cd6dSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
10808bfe6addSmrgdnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls
10818bfe6addSmrgdnl to AM_SILENT_RULES to change the default value.
10828bfe6addSmrgAC_CONFIG_COMMANDS_PRE([dnl
10838bfe6addSmrgcase $enable_silent_rules in @%:@ (((
10848bfe6addSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
10858bfe6addSmrg   no) AM_DEFAULT_VERBOSITY=1;;
10868bfe6addSmrgesac
10878bfe6addSmrgif test $am_cv_make_support_nested_variables = yes; then
10888bfe6addSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
10898bfe6addSmrg  AM_V='$(V)'
10908bfe6addSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
10918bfe6addSmrgelse
10928bfe6addSmrg  AM_V=$AM_DEFAULT_VERBOSITY
10938bfe6addSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
10948bfe6addSmrgfi
10958bfe6addSmrg])dnl
1096db17cd6dSmrg])
109776910425Smrg
10988bfe6addSmrg# AM_SILENT_RULES([DEFAULT])
10998bfe6addSmrg# --------------------------
11008bfe6addSmrg# Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or
11018bfe6addSmrg# empty being verbose).
11028bfe6addSmrgAC_DEFUN([AM_SILENT_RULES],
11038bfe6addSmrg[AC_REQUIRE([_AM_SILENT_RULES])
11048bfe6addSmrgAM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])])
11058bfe6addSmrg
11068bfe6addSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
1107db17cd6dSmrg#
1108db17cd6dSmrg# This file is free software; the Free Software Foundation
1109db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
1110db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
111176910425Smrg
1112db17cd6dSmrg# AM_PROG_INSTALL_STRIP
1113db17cd6dSmrg# ---------------------
11149ff100acSmrg# One issue with vendor 'install' (even GNU) is that you can't
1115db17cd6dSmrg# specify the program used to strip binaries.  This is especially
1116db17cd6dSmrg# annoying in cross-compiling environments, where the build's strip
1117db17cd6dSmrg# is unlikely to handle the host's binaries.
1118db17cd6dSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
11199ff100acSmrg# always use install-sh in "make install-strip", and initialize
1120db17cd6dSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
1121db17cd6dSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
1122db17cd6dSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
11239ff100acSmrg# Installed binaries are usually stripped using 'strip' when the user
11249ff100acSmrg# run "make install-strip".  However 'strip' might not be the right
1125db17cd6dSmrg# tool to use in cross-compilation environments, therefore Automake
11269ff100acSmrg# will honor the 'STRIP' environment variable to overrule this program.
11279ff100acSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
1128db17cd6dSmrgif test "$cross_compiling" != no; then
1129db17cd6dSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
113076910425Smrgfi
1131db17cd6dSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
1132db17cd6dSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
113376910425Smrg
11348bfe6addSmrg# Copyright (C) 2006-2024 Free Software Foundation, Inc.
1135db17cd6dSmrg#
1136db17cd6dSmrg# This file is free software; the Free Software Foundation
1137db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
1138db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
113976910425Smrg
1140db17cd6dSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
1141db17cd6dSmrg# ---------------------------
1142db17cd6dSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1143db17cd6dSmrg# This macro is traced by Automake.
1144db17cd6dSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
114576910425Smrg
1146db17cd6dSmrg# AM_SUBST_NOTMAKE(VARIABLE)
11479ff100acSmrg# --------------------------
1148db17cd6dSmrg# Public sister of _AM_SUBST_NOTMAKE.
1149db17cd6dSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
115076910425Smrg
1151db17cd6dSmrg# Check how to create a tarball.                            -*- Autoconf -*-
1152db17cd6dSmrg
11538bfe6addSmrg# Copyright (C) 2004-2024 Free Software Foundation, Inc.
115476910425Smrg#
115576910425Smrg# This file is free software; the Free Software Foundation
115676910425Smrg# gives unlimited permission to copy and/or distribute it,
115776910425Smrg# with or without modifications, as long as this notice is preserved.
115876910425Smrg
1159db17cd6dSmrg# _AM_PROG_TAR(FORMAT)
1160db17cd6dSmrg# --------------------
1161db17cd6dSmrg# Check how to create a tarball in format FORMAT.
11629ff100acSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1163db17cd6dSmrg#
1164db17cd6dSmrg# Substitute a variable $(am__tar) that is a command
1165db17cd6dSmrg# writing to stdout a FORMAT-tarball containing the directory
1166db17cd6dSmrg# $tardir.
1167db17cd6dSmrg#     tardir=directory && $(am__tar) > result.tar
1168db17cd6dSmrg#
1169db17cd6dSmrg# Substitute a variable $(am__untar) that extract such
1170db17cd6dSmrg# a tarball read from stdin.
1171db17cd6dSmrg#     $(am__untar) < result.tar
11729ff100acSmrg#
1173db17cd6dSmrgAC_DEFUN([_AM_PROG_TAR],
11749ff100acSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
11759ff100acSmrg# in the wild :-(  We should find a proper way to deprecate it ...
11769ff100acSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
11779ff100acSmrg
11789ff100acSmrg# We'll loop over all known methods to create a tar archive until one works.
1179db17cd6dSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1180db17cd6dSmrg
11819ff100acSmrgm4_if([$1], [v7],
11829ff100acSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
11839ff100acSmrg
11849ff100acSmrg  [m4_case([$1],
11859ff100acSmrg    [ustar],
11869ff100acSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
11879ff100acSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
11889ff100acSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
11899ff100acSmrg      # and bug#13588).
11909ff100acSmrg      am_max_uid=2097151 # 2^21 - 1
11919ff100acSmrg      am_max_gid=$am_max_uid
11929ff100acSmrg      # The $UID and $GID variables are not portable, so we need to resort
11939ff100acSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
11949ff100acSmrg      # below are definitely unexpected, so allow the users to see them
11959ff100acSmrg      # (that is, avoid stderr redirection).
11969ff100acSmrg      am_uid=`id -u || echo unknown`
11979ff100acSmrg      am_gid=`id -g || echo unknown`
11989ff100acSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
11998bfe6addSmrg      if test x$am_uid = xunknown; then
12008bfe6addSmrg        AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work])
12018bfe6addSmrg      elif test $am_uid -le $am_max_uid; then
12028bfe6addSmrg        AC_MSG_RESULT([yes])
12039ff100acSmrg      else
12048bfe6addSmrg        AC_MSG_RESULT([no])
12058bfe6addSmrg        _am_tools=none
12069ff100acSmrg      fi
12079ff100acSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
12088bfe6addSmrg      if test x$gm_gid = xunknown; then
12098bfe6addSmrg        AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work])
12108bfe6addSmrg      elif test $am_gid -le $am_max_gid; then
12118bfe6addSmrg        AC_MSG_RESULT([yes])
12129ff100acSmrg      else
12139ff100acSmrg        AC_MSG_RESULT([no])
12149ff100acSmrg        _am_tools=none
12159ff100acSmrg      fi],
12169ff100acSmrg
12179ff100acSmrg  [pax],
12189ff100acSmrg    [],
12199ff100acSmrg
12209ff100acSmrg  [m4_fatal([Unknown tar format])])
12219ff100acSmrg
12229ff100acSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
12239ff100acSmrg
12249ff100acSmrg  # Go ahead even if we have the value already cached.  We do so because we
12259ff100acSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
12269ff100acSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
12279ff100acSmrg
12289ff100acSmrg  for _am_tool in $_am_tools; do
12299ff100acSmrg    case $_am_tool in
12309ff100acSmrg    gnutar)
12319ff100acSmrg      for _am_tar in tar gnutar gtar; do
12329ff100acSmrg        AM_RUN_LOG([$_am_tar --version]) && break
12339ff100acSmrg      done
12349ff100acSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
12359ff100acSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
12369ff100acSmrg      am__untar="$_am_tar -xf -"
12379ff100acSmrg      ;;
12389ff100acSmrg    plaintar)
12399ff100acSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
12409ff100acSmrg      # ustar tarball either.
12419ff100acSmrg      (tar --version) >/dev/null 2>&1 && continue
12429ff100acSmrg      am__tar='tar chf - "$$tardir"'
12439ff100acSmrg      am__tar_='tar chf - "$tardir"'
12449ff100acSmrg      am__untar='tar xf -'
12459ff100acSmrg      ;;
12469ff100acSmrg    pax)
12479ff100acSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
12489ff100acSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
12499ff100acSmrg      am__untar='pax -r'
12509ff100acSmrg      ;;
12519ff100acSmrg    cpio)
12529ff100acSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
12539ff100acSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
12549ff100acSmrg      am__untar='cpio -i -H $1 -d'
12559ff100acSmrg      ;;
12569ff100acSmrg    none)
12579ff100acSmrg      am__tar=false
12589ff100acSmrg      am__tar_=false
12599ff100acSmrg      am__untar=false
12609ff100acSmrg      ;;
12619ff100acSmrg    esac
126276910425Smrg
12639ff100acSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
12649ff100acSmrg    # and am__untar set.
12659ff100acSmrg    test -n "${am_cv_prog_tar_$1}" && break
12669ff100acSmrg
12679ff100acSmrg    # tar/untar a dummy directory, and stop if the command works.
12689ff100acSmrg    rm -rf conftest.dir
12699ff100acSmrg    mkdir conftest.dir
12709ff100acSmrg    echo GrepMe > conftest.dir/file
12719ff100acSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
12729ff100acSmrg    rm -rf conftest.dir
12739ff100acSmrg    if test -s conftest.tar; then
12749ff100acSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
12759ff100acSmrg      AM_RUN_LOG([cat conftest.dir/file])
12769ff100acSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
12779ff100acSmrg    fi
12789ff100acSmrg  done
1279db17cd6dSmrg  rm -rf conftest.dir
128076910425Smrg
12819ff100acSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
12829ff100acSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
12839ff100acSmrg
1284db17cd6dSmrgAC_SUBST([am__tar])
1285db17cd6dSmrgAC_SUBST([am__untar])
1286db17cd6dSmrg]) # _AM_PROG_TAR
128776910425Smrg
12888bfe6addSmrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
12898bfe6addSmrg#
12908bfe6addSmrg# This file is free software; the Free Software Foundation
12918bfe6addSmrg# gives unlimited permission to copy and/or distribute it,
12928bfe6addSmrg# with or without modifications, as long as this notice is preserved.
12938bfe6addSmrg
12948bfe6addSmrg# _AM_PROG_XARGS_N
12958bfe6addSmrg# ----------------
12968bfe6addSmrg# Check whether 'xargs -n' works.  It should work everywhere, so the fallback
12978bfe6addSmrg# is not optimized at all as we never expect to use it.
12988bfe6addSmrgAC_DEFUN([_AM_PROG_XARGS_N],
12998bfe6addSmrg[AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl
13008bfe6addSmrgAS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2
13018bfe6addSmrg3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])])
13028bfe6addSmrgAS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl
13038bfe6addSmrg  am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }'
13048bfe6addSmrg])dnl
13058bfe6addSmrgAC_SUBST(am__xargs_n)
13068bfe6addSmrg])
13078bfe6addSmrg
1308a67f45c3Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1309a67f45c3Smrgdnl serial 11 (pkg-config-0.29)
1310a67f45c3Smrgdnl
1311a67f45c3Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1312a67f45c3Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1313a67f45c3Smrgdnl
1314a67f45c3Smrgdnl This program is free software; you can redistribute it and/or modify
1315a67f45c3Smrgdnl it under the terms of the GNU General Public License as published by
1316a67f45c3Smrgdnl the Free Software Foundation; either version 2 of the License, or
1317a67f45c3Smrgdnl (at your option) any later version.
1318a67f45c3Smrgdnl
1319a67f45c3Smrgdnl This program is distributed in the hope that it will be useful, but
1320a67f45c3Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1321a67f45c3Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1322a67f45c3Smrgdnl General Public License for more details.
1323a67f45c3Smrgdnl
1324a67f45c3Smrgdnl You should have received a copy of the GNU General Public License
1325a67f45c3Smrgdnl along with this program; if not, write to the Free Software
1326a67f45c3Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1327a67f45c3Smrgdnl 02111-1307, USA.
1328a67f45c3Smrgdnl
1329a67f45c3Smrgdnl As a special exception to the GNU General Public License, if you
1330a67f45c3Smrgdnl distribute this file as part of a program that contains a
1331a67f45c3Smrgdnl configuration script generated by Autoconf, you may include it under
1332a67f45c3Smrgdnl the same distribution terms that you use for the rest of that
1333a67f45c3Smrgdnl program.
1334a67f45c3Smrg
1335a67f45c3Smrgdnl PKG_PREREQ(MIN-VERSION)
1336a67f45c3Smrgdnl -----------------------
1337a67f45c3Smrgdnl Since: 0.29
1338a67f45c3Smrgdnl
1339a67f45c3Smrgdnl Verify that the version of the pkg-config macros are at least
1340a67f45c3Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1341a67f45c3Smrgdnl installed version of pkg-config, this checks the developer's version
1342a67f45c3Smrgdnl of pkg.m4 when generating configure.
1343a67f45c3Smrgdnl
1344a67f45c3Smrgdnl To ensure that this macro is defined, also add:
1345a67f45c3Smrgdnl m4_ifndef([PKG_PREREQ],
1346a67f45c3Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1347a67f45c3Smrgdnl
1348a67f45c3Smrgdnl See the "Since" comment for each macro you use to see what version
1349a67f45c3Smrgdnl of the macros you require.
1350a67f45c3Smrgm4_defun([PKG_PREREQ],
1351a67f45c3Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
1352a67f45c3Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1353a67f45c3Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1354a67f45c3Smrg])dnl PKG_PREREQ
1355a67f45c3Smrg
1356a67f45c3Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1357a67f45c3Smrgdnl ----------------------------------
1358a67f45c3Smrgdnl Since: 0.16
1359a67f45c3Smrgdnl
1360a67f45c3Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1361a67f45c3Smrgdnl first found in the path. Checks that the version of pkg-config found
1362a67f45c3Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1363a67f45c3Smrgdnl used since that's the first version where most current features of
1364a67f45c3Smrgdnl pkg-config existed.
13659ff100acSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
13669ff100acSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1367a67f45c3Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1368a67f45c3Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1369a67f45c3SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1370a67f45c3SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1371a67f45c3SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1372a67f45c3Smrg
13739ff100acSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
13749ff100acSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
137576910425Smrgfi
13769ff100acSmrgif test -n "$PKG_CONFIG"; then
13779ff100acSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
13789ff100acSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
13799ff100acSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1380db17cd6dSmrg		AC_MSG_RESULT([yes])
1381db17cd6dSmrg	else
13829ff100acSmrg		AC_MSG_RESULT([no])
13839ff100acSmrg		PKG_CONFIG=""
1384db17cd6dSmrg	fi
13859ff100acSmrgfi[]dnl
1386a67f45c3Smrg])dnl PKG_PROG_PKG_CONFIG
138776910425Smrg
1388a67f45c3Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1389a67f45c3Smrgdnl -------------------------------------------------------------------
1390a67f45c3Smrgdnl Since: 0.18
1391a67f45c3Smrgdnl
1392a67f45c3Smrgdnl Check to see whether a particular set of modules exists. Similar to
1393a67f45c3Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1394a67f45c3Smrgdnl
1395a67f45c3Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1396a67f45c3Smrgdnl only at the first occurence in configure.ac, so if the first place
1397a67f45c3Smrgdnl it's called might be skipped (such as if it is within an "if", you
1398a67f45c3Smrgdnl have to call PKG_CHECK_EXISTS manually
13999ff100acSmrgAC_DEFUN([PKG_CHECK_EXISTS],
14009ff100acSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
14019ff100acSmrgif test -n "$PKG_CONFIG" && \
14029ff100acSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1403a67f45c3Smrg  m4_default([$2], [:])
14049ff100acSmrgm4_ifvaln([$3], [else
14059ff100acSmrg  $3])dnl
14069ff100acSmrgfi])
14079ff100acSmrg
1408a67f45c3Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1409a67f45c3Smrgdnl ---------------------------------------------
1410a67f45c3Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1411a67f45c3Smrgdnl pkg_failed based on the result.
14129ff100acSmrgm4_define([_PKG_CONFIG],
14139ff100acSmrg[if test -n "$$1"; then
14149ff100acSmrg    pkg_cv_[]$1="$$1"
14159ff100acSmrg elif test -n "$PKG_CONFIG"; then
14169ff100acSmrg    PKG_CHECK_EXISTS([$3],
1417a67f45c3Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1418a67f45c3Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
14199ff100acSmrg		     [pkg_failed=yes])
14209ff100acSmrg else
14219ff100acSmrg    pkg_failed=untried
14229ff100acSmrgfi[]dnl
1423a67f45c3Smrg])dnl _PKG_CONFIG
14249ff100acSmrg
1425a67f45c3Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1426a67f45c3Smrgdnl ---------------------------
1427a67f45c3Smrgdnl Internal check to see if pkg-config supports short errors.
14289ff100acSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
14299ff100acSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
14309ff100acSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
14319ff100acSmrg        _pkg_short_errors_supported=yes
14329ff100acSmrgelse
14339ff100acSmrg        _pkg_short_errors_supported=no
14349ff100acSmrgfi[]dnl
1435a67f45c3Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
14369ff100acSmrg
14379ff100acSmrg
1438a67f45c3Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1439a67f45c3Smrgdnl   [ACTION-IF-NOT-FOUND])
1440a67f45c3Smrgdnl --------------------------------------------------------------
1441a67f45c3Smrgdnl Since: 0.4.0
1442a67f45c3Smrgdnl
1443a67f45c3Smrgdnl Note that if there is a possibility the first call to
1444a67f45c3Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1445a67f45c3Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
14469ff100acSmrgAC_DEFUN([PKG_CHECK_MODULES],
14479ff100acSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
14489ff100acSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
14499ff100acSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
14509ff100acSmrg
14519ff100acSmrgpkg_failed=no
14529ff100acSmrgAC_MSG_CHECKING([for $1])
14539ff100acSmrg
14549ff100acSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
14559ff100acSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
14569ff100acSmrg
14579ff100acSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
14589ff100acSmrgand $1[]_LIBS to avoid the need to call pkg-config.
14599ff100acSmrgSee the pkg-config man page for more details.])
14609ff100acSmrg
14619ff100acSmrgif test $pkg_failed = yes; then
1462a67f45c3Smrg   	AC_MSG_RESULT([no])
14639ff100acSmrg        _PKG_SHORT_ERRORS_SUPPORTED
14649ff100acSmrg        if test $_pkg_short_errors_supported = yes; then
1465a67f45c3Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
14669ff100acSmrg        else 
1467a67f45c3Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
14689ff100acSmrg        fi
14699ff100acSmrg	# Put the nasty error message in config.log where it belongs
14709ff100acSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
14719ff100acSmrg
1472a67f45c3Smrg	m4_default([$4], [AC_MSG_ERROR(
14739ff100acSmrg[Package requirements ($2) were not met:
14749ff100acSmrg
14759ff100acSmrg$$1_PKG_ERRORS
14769ff100acSmrg
14779ff100acSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
14789ff100acSmrginstalled software in a non-standard prefix.
14799ff100acSmrg
1480a67f45c3Smrg_PKG_TEXT])[]dnl
1481a67f45c3Smrg        ])
14829ff100acSmrgelif test $pkg_failed = untried; then
1483a67f45c3Smrg     	AC_MSG_RESULT([no])
1484a67f45c3Smrg	m4_default([$4], [AC_MSG_FAILURE(
14859ff100acSmrg[The pkg-config script could not be found or is too old.  Make sure it
14869ff100acSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
14879ff100acSmrgpath to pkg-config.
14889ff100acSmrg
14899ff100acSmrg_PKG_TEXT
14909ff100acSmrg
1491a67f45c3SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1492a67f45c3Smrg        ])
14939ff100acSmrgelse
14949ff100acSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
14959ff100acSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
14969ff100acSmrg        AC_MSG_RESULT([yes])
1497a67f45c3Smrg	$3
14989ff100acSmrgfi[]dnl
1499a67f45c3Smrg])dnl PKG_CHECK_MODULES
1500a67f45c3Smrg
1501a67f45c3Smrg
1502a67f45c3Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1503a67f45c3Smrgdnl   [ACTION-IF-NOT-FOUND])
1504a67f45c3Smrgdnl ---------------------------------------------------------------------
1505a67f45c3Smrgdnl Since: 0.29
1506a67f45c3Smrgdnl
1507a67f45c3Smrgdnl Checks for existence of MODULES and gathers its build flags with
1508a67f45c3Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1509a67f45c3Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1510a67f45c3Smrgdnl
1511a67f45c3Smrgdnl Note that if there is a possibility the first call to
1512a67f45c3Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1513a67f45c3Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1514a67f45c3Smrgdnl configure.ac.
1515a67f45c3SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1516a67f45c3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1517a67f45c3Smrg_save_PKG_CONFIG=$PKG_CONFIG
1518a67f45c3SmrgPKG_CONFIG="$PKG_CONFIG --static"
1519a67f45c3SmrgPKG_CHECK_MODULES($@)
1520a67f45c3SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1521a67f45c3Smrg])dnl PKG_CHECK_MODULES_STATIC
1522a67f45c3Smrg
1523a67f45c3Smrg
1524a67f45c3Smrgdnl PKG_INSTALLDIR([DIRECTORY])
1525a67f45c3Smrgdnl -------------------------
1526a67f45c3Smrgdnl Since: 0.27
1527a67f45c3Smrgdnl
1528a67f45c3Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
1529a67f45c3Smrgdnl should install pkg-config .pc files. By default the directory is
1530a67f45c3Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
1531a67f45c3Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1532a67f45c3Smrgdnl parameter.
1533a67f45c3SmrgAC_DEFUN([PKG_INSTALLDIR],
1534a67f45c3Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1535a67f45c3Smrgm4_pushdef([pkg_description],
1536a67f45c3Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1537a67f45c3SmrgAC_ARG_WITH([pkgconfigdir],
1538a67f45c3Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1539a67f45c3Smrg    [with_pkgconfigdir=]pkg_default)
1540a67f45c3SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1541a67f45c3Smrgm4_popdef([pkg_default])
1542a67f45c3Smrgm4_popdef([pkg_description])
1543a67f45c3Smrg])dnl PKG_INSTALLDIR
1544a67f45c3Smrg
1545a67f45c3Smrg
1546a67f45c3Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1547a67f45c3Smrgdnl --------------------------------
1548a67f45c3Smrgdnl Since: 0.27
1549a67f45c3Smrgdnl
1550a67f45c3Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1551a67f45c3Smrgdnl module should install arch-independent pkg-config .pc files. By
1552a67f45c3Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
1553a67f45c3Smrgdnl changed by passing DIRECTORY. The user can override through the
1554a67f45c3Smrgdnl --with-noarch-pkgconfigdir parameter.
1555a67f45c3SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1556a67f45c3Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1557a67f45c3Smrgm4_pushdef([pkg_description],
1558a67f45c3Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1559a67f45c3SmrgAC_ARG_WITH([noarch-pkgconfigdir],
1560a67f45c3Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1561a67f45c3Smrg    [with_noarch_pkgconfigdir=]pkg_default)
1562a67f45c3SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1563a67f45c3Smrgm4_popdef([pkg_default])
1564a67f45c3Smrgm4_popdef([pkg_description])
1565a67f45c3Smrg])dnl PKG_NOARCH_INSTALLDIR
1566a67f45c3Smrg
1567a67f45c3Smrg
1568a67f45c3Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1569a67f45c3Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1570a67f45c3Smrgdnl -------------------------------------------
1571a67f45c3Smrgdnl Since: 0.28
1572a67f45c3Smrgdnl
1573a67f45c3Smrgdnl Retrieves the value of the pkg-config variable for the given module.
1574a67f45c3SmrgAC_DEFUN([PKG_CHECK_VAR],
1575a67f45c3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1576a67f45c3SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1577a67f45c3Smrg
1578a67f45c3Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1579a67f45c3SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1580a67f45c3Smrg
1581a67f45c3SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1582a67f45c3Smrg])dnl PKG_CHECK_VAR
15839ff100acSmrg
15849ff100acSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
15859ff100acSmrgdnl
15868bfe6addSmrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
15879ff100acSmrgdnl
15889ff100acSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
15899ff100acSmrgdnl copy of this software and associated documentation files (the "Software"),
15909ff100acSmrgdnl to deal in the Software without restriction, including without limitation
15919ff100acSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
15929ff100acSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
15939ff100acSmrgdnl Software is furnished to do so, subject to the following conditions:
15949ff100acSmrgdnl
15959ff100acSmrgdnl The above copyright notice and this permission notice (including the next
15969ff100acSmrgdnl paragraph) shall be included in all copies or substantial portions of the
15979ff100acSmrgdnl Software.
15989ff100acSmrgdnl
15999ff100acSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16009ff100acSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16019ff100acSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
16029ff100acSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16039ff100acSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
16049ff100acSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
16059ff100acSmrgdnl DEALINGS IN THE SOFTWARE.
16069ff100acSmrg
16079ff100acSmrg# XORG_MACROS_VERSION(required-version)
16089ff100acSmrg# -------------------------------------
16099ff100acSmrg# Minimum version: 1.1.0
16109ff100acSmrg#
16119ff100acSmrg# If you're using a macro added in Version 1.1 or newer, include this in
16129ff100acSmrg# your configure.ac with the minimum required version, such as:
16139ff100acSmrg# XORG_MACROS_VERSION(1.1)
16149ff100acSmrg#
16159ff100acSmrg# To ensure that this macro is defined, also add:
16169ff100acSmrg# m4_ifndef([XORG_MACROS_VERSION],
16179ff100acSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
16189ff100acSmrg#
16199ff100acSmrg#
16209ff100acSmrg# See the "minimum version" comment for each macro you use to see what
16219ff100acSmrg# version you require.
16229ff100acSmrgm4_defun([XORG_MACROS_VERSION],[
16238bfe6addSmrgm4_define([vers_have], [1.20.2])
16249ff100acSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
16259ff100acSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
16269ff100acSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
16279ff100acSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
16289ff100acSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
16299ff100acSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
16309ff100acSmrgm4_undefine([vers_have])
16319ff100acSmrgm4_undefine([maj_have])
16329ff100acSmrgm4_undefine([maj_needed])
16339ff100acSmrg]) # XORG_MACROS_VERSION
16349ff100acSmrg
16359ff100acSmrg# XORG_PROG_RAWCPP()
16369ff100acSmrg# ------------------
16379ff100acSmrg# Minimum version: 1.0.0
16389ff100acSmrg#
16399ff100acSmrg# Find cpp program and necessary flags for use in pre-processing text files
16409ff100acSmrg# such as man pages and config files
16419ff100acSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
16429ff100acSmrgAC_REQUIRE([AC_PROG_CPP])
1643a67f45c3SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
16449ff100acSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
16459ff100acSmrg
16469ff100acSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
16479ff100acSmrg# which is not the best choice for supporting other OS'es, but covers most
16489ff100acSmrg# of the ones we need for now.
16499ff100acSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
16509ff100acSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
16519ff100acSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
16529ff100acSmrg	AC_MSG_RESULT([no])
16539ff100acSmrgelse
16549ff100acSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
16559ff100acSmrg		RAWCPPFLAGS=-undef
16569ff100acSmrg		AC_MSG_RESULT([yes])
16579ff100acSmrg	# under Cygwin unix is still defined even with -undef
16589ff100acSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
16599ff100acSmrg		RAWCPPFLAGS="-undef -ansi"
16609ff100acSmrg		AC_MSG_RESULT([yes, with -ansi])
16619ff100acSmrg	else
16629ff100acSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
16639ff100acSmrg	fi
16649ff100acSmrgfi
16659ff100acSmrgrm -f conftest.$ac_ext
16669ff100acSmrg
16679ff100acSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
16689ff100acSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
16698bfe6addSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
16709ff100acSmrg	AC_MSG_RESULT([no])
16719ff100acSmrgelse
16728bfe6addSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
16739ff100acSmrg		TRADITIONALCPPFLAGS="-traditional"
16749ff100acSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
16759ff100acSmrg		AC_MSG_RESULT([yes])
16769ff100acSmrg	else
16779ff100acSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
16789ff100acSmrg	fi
16799ff100acSmrgfi
16809ff100acSmrgrm -f conftest.$ac_ext
16819ff100acSmrgAC_SUBST(RAWCPPFLAGS)
16829ff100acSmrgAC_SUBST(TRADITIONALCPPFLAGS)
16839ff100acSmrg]) # XORG_PROG_RAWCPP
16849ff100acSmrg
16859ff100acSmrg# XORG_MANPAGE_SECTIONS()
16869ff100acSmrg# -----------------------
16879ff100acSmrg# Minimum version: 1.0.0
16889ff100acSmrg#
16899ff100acSmrg# Determine which sections man pages go in for the different man page types
16909ff100acSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
16919ff100acSmrg# Not sure if there's any better way than just hardcoding by OS name.
16929ff100acSmrg# Override default settings by setting environment variables
16939ff100acSmrg# Added MAN_SUBSTS in version 1.8
16949ff100acSmrg# Added AC_PROG_SED in version 1.8
16959ff100acSmrg
16969ff100acSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
16979ff100acSmrgAC_REQUIRE([AC_CANONICAL_HOST])
16989ff100acSmrgAC_REQUIRE([AC_PROG_SED])
16999ff100acSmrg
1700a67f45c3Smrgcase $host_os in
1701a67f45c3Smrg    solaris*)
1702a67f45c3Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1703a67f45c3Smrg        # check for a man page file found in later versions that use
1704a67f45c3Smrg        # traditional section numbers instead
1705a67f45c3Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1706a67f45c3Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1707a67f45c3Smrg        ;;
1708a67f45c3Smrg    *) SYSV_MAN_SECTIONS=false ;;
1709a67f45c3Smrgesac
1710a67f45c3Smrg
17119ff100acSmrgif test x$APP_MAN_SUFFIX = x    ; then
17129ff100acSmrg    APP_MAN_SUFFIX=1
17139ff100acSmrgfi
17149ff100acSmrgif test x$APP_MAN_DIR = x    ; then
17159ff100acSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
17169ff100acSmrgfi
171776910425Smrg
1718db17cd6dSmrgif test x$LIB_MAN_SUFFIX = x    ; then
1719db17cd6dSmrg    LIB_MAN_SUFFIX=3
1720db17cd6dSmrgfi
1721db17cd6dSmrgif test x$LIB_MAN_DIR = x    ; then
1722db17cd6dSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
172376910425Smrgfi
172476910425Smrg
1725db17cd6dSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1726a67f45c3Smrg    case $SYSV_MAN_SECTIONS in
1727a67f45c3Smrg	true)				FILE_MAN_SUFFIX=4  ;;
1728a67f45c3Smrg	*)				FILE_MAN_SUFFIX=5  ;;
1729db17cd6dSmrg    esac
1730db17cd6dSmrgfi
1731db17cd6dSmrgif test x$FILE_MAN_DIR = x    ; then
1732db17cd6dSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1733db17cd6dSmrgfi
173476910425Smrg
1735db17cd6dSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1736a67f45c3Smrg    case $SYSV_MAN_SECTIONS in
1737a67f45c3Smrg	true)				MISC_MAN_SUFFIX=5  ;;
1738a67f45c3Smrg	*)				MISC_MAN_SUFFIX=7  ;;
1739db17cd6dSmrg    esac
1740db17cd6dSmrgfi
1741db17cd6dSmrgif test x$MISC_MAN_DIR = x    ; then
1742db17cd6dSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1743db17cd6dSmrgfi
174476910425Smrg
1745db17cd6dSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1746a67f45c3Smrg    case $SYSV_MAN_SECTIONS in
1747a67f45c3Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1748a67f45c3Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1749db17cd6dSmrg    esac
1750db17cd6dSmrgfi
1751db17cd6dSmrgif test x$DRIVER_MAN_DIR = x    ; then
1752db17cd6dSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1753db17cd6dSmrgfi
175476910425Smrg
1755db17cd6dSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1756a67f45c3Smrg    case $SYSV_MAN_SECTIONS in
1757a67f45c3Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1758a67f45c3Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
1759db17cd6dSmrg    esac
1760db17cd6dSmrgfi
1761db17cd6dSmrgif test x$ADMIN_MAN_DIR = x    ; then
1762db17cd6dSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
176376910425Smrgfi
176476910425Smrg
176576910425Smrg
1766db17cd6dSmrgAC_SUBST([APP_MAN_SUFFIX])
1767db17cd6dSmrgAC_SUBST([LIB_MAN_SUFFIX])
1768db17cd6dSmrgAC_SUBST([FILE_MAN_SUFFIX])
1769db17cd6dSmrgAC_SUBST([MISC_MAN_SUFFIX])
1770db17cd6dSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1771db17cd6dSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1772db17cd6dSmrgAC_SUBST([APP_MAN_DIR])
1773db17cd6dSmrgAC_SUBST([LIB_MAN_DIR])
1774db17cd6dSmrgAC_SUBST([FILE_MAN_DIR])
1775db17cd6dSmrgAC_SUBST([MISC_MAN_DIR])
1776db17cd6dSmrgAC_SUBST([DRIVER_MAN_DIR])
1777db17cd6dSmrgAC_SUBST([ADMIN_MAN_DIR])
1778482df631Smrg
1779482df631SmrgXORG_MAN_PAGE="X Version 11"
1780482df631SmrgAC_SUBST([XORG_MAN_PAGE])
1781482df631SmrgMAN_SUBSTS="\
1782482df631Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1783482df631Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1784482df631Smrg	-e 's|__xservername__|Xorg|g' \
1785482df631Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1786482df631Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1787482df631Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1788482df631Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1789482df631Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1790482df631Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1791482df631Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1792482df631Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1793482df631Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1794482df631SmrgAC_SUBST([MAN_SUBSTS])
1795482df631Smrg
1796db17cd6dSmrg]) # XORG_MANPAGE_SECTIONS
1797db17cd6dSmrg
1798482df631Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1799482df631Smrg# ------------------------
1800482df631Smrg# Minimum version: 1.7.0
1801482df631Smrg#
1802482df631Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1803482df631Smrg# provided by xorg-sgml-doctools, if installed.
1804482df631SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1805482df631SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1806482df631SmrgXORG_SGML_PATH=
1807482df631SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1808482df631Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1809482df631Smrg    [m4_ifval([$1],[:],
1810482df631Smrg        [if test x"$cross_compiling" != x"yes" ; then
1811482df631Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1812482df631Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1813482df631Smrg         fi])
1814482df631Smrg    ])
1815482df631Smrg
1816482df631Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1817482df631Smrg# the path and the name of the doc stylesheet
1818482df631Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1819482df631Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1820482df631Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1821482df631Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1822482df631Smrgelse
1823482df631Smrg   AC_MSG_RESULT([no])
1824482df631Smrgfi
1825482df631Smrg
1826482df631SmrgAC_SUBST(XORG_SGML_PATH)
1827482df631SmrgAC_SUBST(STYLESHEET_SRCDIR)
1828482df631SmrgAC_SUBST(XSL_STYLESHEET)
1829482df631SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1830482df631Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1831482df631Smrg
1832db17cd6dSmrg# XORG_CHECK_LINUXDOC
1833db17cd6dSmrg# -------------------
1834db17cd6dSmrg# Minimum version: 1.0.0
183576910425Smrg#
1836db17cd6dSmrg# Defines the variable MAKE_TEXT if the necessary tools and
1837db17cd6dSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1838db17cd6dSmrg# Whether or not the necessary tools and files are found can be checked
1839db17cd6dSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1840db17cd6dSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1841482df631SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1842482df631SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
184376910425Smrg
1844db17cd6dSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
184576910425Smrg
1846482df631SmrgAC_MSG_CHECKING([whether to build documentation])
184776910425Smrg
1848482df631Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1849db17cd6dSmrg   BUILDDOC=yes
1850db17cd6dSmrgelse
1851db17cd6dSmrg   BUILDDOC=no
1852db17cd6dSmrgfi
185376910425Smrg
1854db17cd6dSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
185576910425Smrg
1856db17cd6dSmrgAC_MSG_RESULT([$BUILDDOC])
185776910425Smrg
1858482df631SmrgAC_MSG_CHECKING([whether to build pdf documentation])
185976910425Smrg
1860482df631Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1861db17cd6dSmrg   BUILDPDFDOC=yes
1862db17cd6dSmrgelse
1863db17cd6dSmrg   BUILDPDFDOC=no
1864db17cd6dSmrgfi
186576910425Smrg
1866db17cd6dSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
186776910425Smrg
1868db17cd6dSmrgAC_MSG_RESULT([$BUILDPDFDOC])
186976910425Smrg
1870482df631SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1871db17cd6dSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1872db17cd6dSmrgMAKE_PDF="$PS2PDF"
1873db17cd6dSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
187476910425Smrg
1875db17cd6dSmrgAC_SUBST(MAKE_TEXT)
1876db17cd6dSmrgAC_SUBST(MAKE_PS)
1877db17cd6dSmrgAC_SUBST(MAKE_PDF)
1878db17cd6dSmrgAC_SUBST(MAKE_HTML)
1879db17cd6dSmrg]) # XORG_CHECK_LINUXDOC
1880db17cd6dSmrg
1881db17cd6dSmrg# XORG_CHECK_DOCBOOK
1882db17cd6dSmrg# -------------------
1883db17cd6dSmrg# Minimum version: 1.0.0
1884db17cd6dSmrg#
1885db17cd6dSmrg# Checks for the ability to build output formats from SGML DocBook source.
1886db17cd6dSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1887db17cd6dSmrg# indicates whether the necessary tools and files are found and, if set,
1888db17cd6dSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1889db17cd6dSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1890482df631SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1891482df631Smrg
1892db17cd6dSmrgBUILDTXTDOC=no
1893db17cd6dSmrgBUILDPDFDOC=no
1894db17cd6dSmrgBUILDPSDOC=no
1895db17cd6dSmrgBUILDHTMLDOC=no
1896db17cd6dSmrg
1897db17cd6dSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1898db17cd6dSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1899db17cd6dSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1900db17cd6dSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1901db17cd6dSmrg
1902482df631SmrgAC_MSG_CHECKING([whether to build text documentation])
1903482df631Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1904db17cd6dSmrg   test x$BUILD_TXTDOC != xno; then
1905db17cd6dSmrg	BUILDTXTDOC=yes
1906db17cd6dSmrgfi
1907db17cd6dSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1908db17cd6dSmrgAC_MSG_RESULT([$BUILDTXTDOC])
190976910425Smrg
1910482df631SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1911482df631Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1912db17cd6dSmrg   test x$BUILD_PDFDOC != xno; then
1913db17cd6dSmrg	BUILDPDFDOC=yes
191476910425Smrgfi
1915db17cd6dSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1916db17cd6dSmrgAC_MSG_RESULT([$BUILDPDFDOC])
191776910425Smrg
1918482df631SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1919482df631Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1920db17cd6dSmrg   test x$BUILD_PSDOC != xno; then
1921db17cd6dSmrg	BUILDPSDOC=yes
1922db17cd6dSmrgfi
1923db17cd6dSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1924db17cd6dSmrgAC_MSG_RESULT([$BUILDPSDOC])
192576910425Smrg
1926482df631SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1927482df631Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1928db17cd6dSmrg   test x$BUILD_HTMLDOC != xno; then
1929db17cd6dSmrg	BUILDHTMLDOC=yes
1930db17cd6dSmrgfi
1931db17cd6dSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1932db17cd6dSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
193376910425Smrg
1934db17cd6dSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1935db17cd6dSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1936db17cd6dSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1937db17cd6dSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
193876910425Smrg
1939db17cd6dSmrgAC_SUBST(MAKE_TEXT)
1940db17cd6dSmrgAC_SUBST(MAKE_PS)
1941db17cd6dSmrgAC_SUBST(MAKE_PDF)
1942db17cd6dSmrgAC_SUBST(MAKE_HTML)
1943db17cd6dSmrg]) # XORG_CHECK_DOCBOOK
194476910425Smrg
1945482df631Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1946482df631Smrg# ----------------
1947482df631Smrg# Minimum version: 1.5.0
1948482df631Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1949482df631Smrg#
1950482df631Smrg# Documentation tools are not always available on all platforms and sometimes
1951482df631Smrg# not at the appropriate level. This macro enables a module to test for the
1952482df631Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
19538bfe6addSmrg# the --with-xmlto option, it allows maximum flexibility in making decisions
1954482df631Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1955482df631Smrg# --with-xmlto assumes 'auto'.
1956482df631Smrg#
1957482df631Smrg# Interface to module:
1958482df631Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1959482df631Smrg# XMLTO:	returns the path of the xmlto program found
1960482df631Smrg#		returns the path set by the user in the environment
1961482df631Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1962482df631Smrg#		'no' user instructs the module not to use xmlto
1963482df631Smrg#
1964482df631Smrg# Added in version 1.10.0
1965482df631Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1966482df631Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1967482df631Smrg#
1968482df631Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1969482df631Smrg#
1970482df631SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1971482df631SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1972482df631Smrgm4_define([_defopt], m4_default([$2], [auto]))
1973482df631SmrgAC_ARG_WITH(xmlto,
1974482df631Smrg	AS_HELP_STRING([--with-xmlto],
1975482df631Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1976482df631Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1977482df631Smrgm4_undefine([_defopt])
1978482df631Smrg
1979482df631Smrgif test "x$use_xmlto" = x"auto"; then
1980482df631Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1981482df631Smrg   if test "x$XMLTO" = "x"; then
1982482df631Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1983482df631Smrg	have_xmlto=no
1984482df631Smrg   else
1985482df631Smrg        have_xmlto=yes
1986482df631Smrg   fi
1987482df631Smrgelif test "x$use_xmlto" = x"yes" ; then
1988482df631Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1989482df631Smrg   if test "x$XMLTO" = "x"; then
1990482df631Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1991482df631Smrg   fi
1992482df631Smrg   have_xmlto=yes
1993482df631Smrgelif test "x$use_xmlto" = x"no" ; then
1994482df631Smrg   if test "x$XMLTO" != "x"; then
1995482df631Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1996482df631Smrg   fi
1997482df631Smrg   have_xmlto=no
1998482df631Smrgelse
1999482df631Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
2000482df631Smrgfi
2001482df631Smrg
2002482df631Smrg# Test for a minimum version of xmlto, if provided.
2003482df631Smrgm4_ifval([$1],
2004482df631Smrg[if test "$have_xmlto" = yes; then
2005482df631Smrg    # scrape the xmlto version
2006482df631Smrg    AC_MSG_CHECKING([the xmlto version])
2007482df631Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
2008482df631Smrg    AC_MSG_RESULT([$xmlto_version])
2009482df631Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
2010482df631Smrg        [if test "x$use_xmlto" = xauto; then
2011482df631Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
2012482df631Smrg            have_xmlto=no
2013482df631Smrg        else
2014482df631Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
2015482df631Smrg        fi])
2016482df631Smrgfi])
2017482df631Smrg
2018482df631Smrg# Test for the ability of xmlto to generate a text target
2019a67f45c3Smrg#
2020a67f45c3Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
2021a67f45c3Smrg# following test for empty XML docbook files.
2022a67f45c3Smrg# For compatibility reasons use the following empty XML docbook file and if
2023a67f45c3Smrg# it fails try it again with a non-empty XML file.
2024482df631Smrghave_xmlto_text=no
2025482df631Smrgcat > conftest.xml << "EOF"
2026482df631SmrgEOF
2027482df631SmrgAS_IF([test "$have_xmlto" = yes],
2028482df631Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2029482df631Smrg             [have_xmlto_text=yes],
2030a67f45c3Smrg             [# Try it again with a non-empty XML file.
2031a67f45c3Smrg              cat > conftest.xml << "EOF"
2032a67f45c3Smrg<x></x>
2033a67f45c3SmrgEOF
2034a67f45c3Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2035a67f45c3Smrg                    [have_xmlto_text=yes],
2036a67f45c3Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
2037482df631Smrgrm -f conftest.xml
2038482df631SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
2039482df631SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
2040482df631Smrg]) # XORG_WITH_XMLTO
2041482df631Smrg
20429ff100acSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
20439ff100acSmrg# --------------------------------------------
20449ff100acSmrg# Minimum version: 1.12.0
20459ff100acSmrg# Minimum version for optional DEFAULT argument: 1.12.0
20469ff100acSmrg#
20479ff100acSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
20489ff100acSmrg# XML-based language used for the transformation of XML documents.
20499ff100acSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
20509ff100acSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
20519ff100acSmrg# The XSLT processor is often used as a standalone tool for transformations.
20529ff100acSmrg# It should not be assumed that this tool is used only to work with documnetation.
20539ff100acSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
20549ff100acSmrg#
20559ff100acSmrg# Interface to module:
20569ff100acSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
20579ff100acSmrg# XSLTPROC:	 returns the path of the xsltproc program found
20589ff100acSmrg#		 returns the path set by the user in the environment
20599ff100acSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
20609ff100acSmrg#		  'no' user instructs the module not to use xsltproc
20619ff100acSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
20629ff100acSmrg#
20639ff100acSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
20649ff100acSmrg#
20659ff100acSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
20669ff100acSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
20679ff100acSmrg# Preserves the interface, should it be implemented later
20689ff100acSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
20699ff100acSmrgm4_define([_defopt], m4_default([$2], [auto]))
20709ff100acSmrgAC_ARG_WITH(xsltproc,
20719ff100acSmrg	AS_HELP_STRING([--with-xsltproc],
20729ff100acSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
20739ff100acSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
20749ff100acSmrgm4_undefine([_defopt])
20759ff100acSmrg
20769ff100acSmrgif test "x$use_xsltproc" = x"auto"; then
20779ff100acSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
20789ff100acSmrg   if test "x$XSLTPROC" = "x"; then
20799ff100acSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
20809ff100acSmrg	have_xsltproc=no
20819ff100acSmrg   else
20829ff100acSmrg        have_xsltproc=yes
20839ff100acSmrg   fi
20849ff100acSmrgelif test "x$use_xsltproc" = x"yes" ; then
20859ff100acSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
20869ff100acSmrg   if test "x$XSLTPROC" = "x"; then
20879ff100acSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
20889ff100acSmrg   fi
20899ff100acSmrg   have_xsltproc=yes
20909ff100acSmrgelif test "x$use_xsltproc" = x"no" ; then
20919ff100acSmrg   if test "x$XSLTPROC" != "x"; then
20929ff100acSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
20939ff100acSmrg   fi
20949ff100acSmrg   have_xsltproc=no
20959ff100acSmrgelse
20969ff100acSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
20979ff100acSmrgfi
20989ff100acSmrg
20999ff100acSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
21009ff100acSmrg]) # XORG_WITH_XSLTPROC
21019ff100acSmrg
21029ff100acSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
21039ff100acSmrg# ----------------------------------------
21049ff100acSmrg# Minimum version: 1.15.0
21059ff100acSmrg#
21069ff100acSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
21079ff100acSmrg# scanning arbitrary text files, extracting information from those text files,
21089ff100acSmrg# and printing reports based on that information.
21099ff100acSmrg#
21109ff100acSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
21119ff100acSmrg#
21129ff100acSmrg# Interface to module:
21139ff100acSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
21149ff100acSmrg# PERL:	     returns the path of the perl program found
21159ff100acSmrg#	     returns the path set by the user in the environment
21169ff100acSmrg# --with-perl: 'yes' user instructs the module to use perl
21179ff100acSmrg#	       'no' user instructs the module not to use perl
21189ff100acSmrg# have_perl: returns yes if perl found in PATH or no
21199ff100acSmrg#
21209ff100acSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
21219ff100acSmrg#
21229ff100acSmrgAC_DEFUN([XORG_WITH_PERL],[
21239ff100acSmrgAC_ARG_VAR([PERL], [Path to perl command])
21249ff100acSmrg# Preserves the interface, should it be implemented later
21259ff100acSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
21269ff100acSmrgm4_define([_defopt], m4_default([$2], [auto]))
21279ff100acSmrgAC_ARG_WITH(perl,
21289ff100acSmrg	AS_HELP_STRING([--with-perl],
21299ff100acSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
21309ff100acSmrg	   [use_perl=$withval], [use_perl=]_defopt)
21319ff100acSmrgm4_undefine([_defopt])
21329ff100acSmrg
21339ff100acSmrgif test "x$use_perl" = x"auto"; then
21349ff100acSmrg   AC_PATH_PROG([PERL], [perl])
21359ff100acSmrg   if test "x$PERL" = "x"; then
21369ff100acSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
21379ff100acSmrg	have_perl=no
21389ff100acSmrg   else
21399ff100acSmrg        have_perl=yes
21409ff100acSmrg   fi
21419ff100acSmrgelif test "x$use_perl" = x"yes" ; then
21429ff100acSmrg   AC_PATH_PROG([PERL], [perl])
21439ff100acSmrg   if test "x$PERL" = "x"; then
21449ff100acSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
21459ff100acSmrg   fi
21469ff100acSmrg   have_perl=yes
21479ff100acSmrgelif test "x$use_perl" = x"no" ; then
21489ff100acSmrg   if test "x$PERL" != "x"; then
21499ff100acSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
21509ff100acSmrg   fi
21519ff100acSmrg   have_perl=no
21529ff100acSmrgelse
21539ff100acSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
21549ff100acSmrgfi
21559ff100acSmrg
21569ff100acSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
21579ff100acSmrg]) # XORG_WITH_PERL
21589ff100acSmrg
2159482df631Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2160482df631Smrg# ----------------
2161482df631Smrg# Minimum version: 1.5.0
2162482df631Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2163482df631Smrg#
2164482df631Smrg# Documentation tools are not always available on all platforms and sometimes
2165482df631Smrg# not at the appropriate level. This macro enables a module to test for the
2166482df631Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
21678bfe6addSmrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
2168482df631Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2169482df631Smrg# --with-asciidoc assumes 'auto'.
2170482df631Smrg#
2171482df631Smrg# Interface to module:
2172482df631Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2173482df631Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
2174482df631Smrg#		 returns the path set by the user in the environment
2175482df631Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2176482df631Smrg#		  'no' user instructs the module not to use asciidoc
2177482df631Smrg#
2178482df631Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2179482df631Smrg#
2180482df631SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2181482df631SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2182482df631Smrgm4_define([_defopt], m4_default([$2], [auto]))
2183482df631SmrgAC_ARG_WITH(asciidoc,
2184482df631Smrg	AS_HELP_STRING([--with-asciidoc],
2185482df631Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2186482df631Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2187482df631Smrgm4_undefine([_defopt])
2188482df631Smrg
2189482df631Smrgif test "x$use_asciidoc" = x"auto"; then
2190482df631Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2191482df631Smrg   if test "x$ASCIIDOC" = "x"; then
2192482df631Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2193482df631Smrg	have_asciidoc=no
2194482df631Smrg   else
2195482df631Smrg        have_asciidoc=yes
2196482df631Smrg   fi
2197482df631Smrgelif test "x$use_asciidoc" = x"yes" ; then
2198482df631Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2199482df631Smrg   if test "x$ASCIIDOC" = "x"; then
2200482df631Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2201482df631Smrg   fi
2202482df631Smrg   have_asciidoc=yes
2203482df631Smrgelif test "x$use_asciidoc" = x"no" ; then
2204482df631Smrg   if test "x$ASCIIDOC" != "x"; then
2205482df631Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2206482df631Smrg   fi
2207482df631Smrg   have_asciidoc=no
2208482df631Smrgelse
2209482df631Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2210482df631Smrgfi
2211482df631Smrgm4_ifval([$1],
2212482df631Smrg[if test "$have_asciidoc" = yes; then
2213482df631Smrg    # scrape the asciidoc version
2214482df631Smrg    AC_MSG_CHECKING([the asciidoc version])
2215482df631Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2216482df631Smrg    AC_MSG_RESULT([$asciidoc_version])
2217482df631Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2218482df631Smrg        [if test "x$use_asciidoc" = xauto; then
2219482df631Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2220482df631Smrg            have_asciidoc=no
2221482df631Smrg        else
2222482df631Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2223482df631Smrg        fi])
2224482df631Smrgfi])
2225482df631SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2226482df631Smrg]) # XORG_WITH_ASCIIDOC
2227482df631Smrg
2228482df631Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
22299ff100acSmrg# -------------------------------------------
2230482df631Smrg# Minimum version: 1.5.0
2231482df631Smrg# Minimum version for optional DEFAULT argument: 1.11.0
22329ff100acSmrg# Minimum version for optional DOT checking: 1.18.0
2233482df631Smrg#
2234482df631Smrg# Documentation tools are not always available on all platforms and sometimes
2235482df631Smrg# not at the appropriate level. This macro enables a module to test for the
2236482df631Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
22378bfe6addSmrg# the --with-doxygen option, it allows maximum flexibility in making decisions
2238482df631Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2239482df631Smrg# --with-doxygen assumes 'auto'.
2240482df631Smrg#
2241482df631Smrg# Interface to module:
2242482df631Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2243482df631Smrg# DOXYGEN:	 returns the path of the doxygen program found
2244482df631Smrg#		 returns the path set by the user in the environment
2245482df631Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2246482df631Smrg#		  'no' user instructs the module not to use doxygen
2247482df631Smrg#
2248482df631Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2249482df631Smrg#
2250482df631SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2251482df631SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
22529ff100acSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
2253482df631Smrgm4_define([_defopt], m4_default([$2], [auto]))
2254482df631SmrgAC_ARG_WITH(doxygen,
2255482df631Smrg	AS_HELP_STRING([--with-doxygen],
2256482df631Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2257482df631Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2258482df631Smrgm4_undefine([_defopt])
2259482df631Smrg
2260482df631Smrgif test "x$use_doxygen" = x"auto"; then
2261482df631Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2262482df631Smrg   if test "x$DOXYGEN" = "x"; then
2263482df631Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2264482df631Smrg	have_doxygen=no
2265482df631Smrg   else
2266482df631Smrg        have_doxygen=yes
2267482df631Smrg   fi
2268482df631Smrgelif test "x$use_doxygen" = x"yes" ; then
2269482df631Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2270482df631Smrg   if test "x$DOXYGEN" = "x"; then
2271482df631Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2272482df631Smrg   fi
2273482df631Smrg   have_doxygen=yes
2274482df631Smrgelif test "x$use_doxygen" = x"no" ; then
2275482df631Smrg   if test "x$DOXYGEN" != "x"; then
2276482df631Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2277482df631Smrg   fi
2278482df631Smrg   have_doxygen=no
2279482df631Smrgelse
2280482df631Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2281482df631Smrgfi
2282482df631Smrgm4_ifval([$1],
2283482df631Smrg[if test "$have_doxygen" = yes; then
2284482df631Smrg    # scrape the doxygen version
2285482df631Smrg    AC_MSG_CHECKING([the doxygen version])
2286482df631Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2287482df631Smrg    AC_MSG_RESULT([$doxygen_version])
2288482df631Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2289482df631Smrg        [if test "x$use_doxygen" = xauto; then
2290482df631Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2291482df631Smrg            have_doxygen=no
2292482df631Smrg        else
2293482df631Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2294482df631Smrg        fi])
2295482df631Smrgfi])
22969ff100acSmrg
22979ff100acSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
22989ff100acSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
22999ff100acSmrgdnl 	HAVE_DOT = @HAVE_DOT@
23009ff100acSmrgHAVE_DOT=no
23019ff100acSmrgif test "x$have_doxygen" = "xyes"; then
23029ff100acSmrg  AC_PATH_PROG([DOT], [dot])
23039ff100acSmrg    if test "x$DOT" != "x"; then
23049ff100acSmrg      HAVE_DOT=yes
23059ff100acSmrg    fi
23069ff100acSmrgfi
23079ff100acSmrg
23089ff100acSmrgAC_SUBST([HAVE_DOT])
23099ff100acSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2310482df631SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2311482df631Smrg]) # XORG_WITH_DOXYGEN
2312482df631Smrg
2313482df631Smrg# XORG_WITH_GROFF([DEFAULT])
2314482df631Smrg# ----------------
2315482df631Smrg# Minimum version: 1.6.0
2316482df631Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2317482df631Smrg#
2318482df631Smrg# Documentation tools are not always available on all platforms and sometimes
2319482df631Smrg# not at the appropriate level. This macro enables a module to test for the
2320482df631Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
23218bfe6addSmrg# the --with-groff option, it allows maximum flexibility in making decisions
2322482df631Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
2323482df631Smrg# --with-groff assumes 'auto'.
2324482df631Smrg#
2325482df631Smrg# Interface to module:
2326482df631Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2327482df631Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2328482df631Smrg# HAVE_GROFF_MS: the -ms macros package
2329482df631Smrg# GROFF:	 returns the path of the groff program found
2330482df631Smrg#		 returns the path set by the user in the environment
2331482df631Smrg# --with-groff:	 'yes' user instructs the module to use groff
2332482df631Smrg#		 'no' user instructs the module not to use groff
2333482df631Smrg#
2334482df631Smrg# Added in version 1.9.0:
2335482df631Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2336482df631Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2337482df631Smrg#		   psselect from the psutils package.
2338482df631Smrg#		   the ghostcript package. Refer to the grohtml man pages
2339482df631Smrg#
2340482df631Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2341482df631Smrg#
2342482df631Smrg# OS and distros often splits groff in a basic and full package, the former
2343482df631Smrg# having the groff program and the later having devices, fonts and macros
2344482df631Smrg# Checking for the groff executable is not enough.
2345482df631Smrg#
2346482df631Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
2347482df631Smrg# unset HAVE_GROFF or GROFF env variables.
2348482df631Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2349482df631Smrg#
2350482df631SmrgAC_DEFUN([XORG_WITH_GROFF],[
2351482df631SmrgAC_ARG_VAR([GROFF], [Path to groff command])
2352482df631Smrgm4_define([_defopt], m4_default([$1], [auto]))
2353482df631SmrgAC_ARG_WITH(groff,
2354482df631Smrg	AS_HELP_STRING([--with-groff],
2355482df631Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2356482df631Smrg	   [use_groff=$withval], [use_groff=]_defopt)
2357482df631Smrgm4_undefine([_defopt])
2358482df631Smrg
2359482df631Smrgif test "x$use_groff" = x"auto"; then
2360482df631Smrg   AC_PATH_PROG([GROFF], [groff])
2361482df631Smrg   if test "x$GROFF" = "x"; then
2362482df631Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2363482df631Smrg	have_groff=no
2364482df631Smrg   else
2365482df631Smrg        have_groff=yes
2366482df631Smrg   fi
2367482df631Smrgelif test "x$use_groff" = x"yes" ; then
2368482df631Smrg   AC_PATH_PROG([GROFF], [groff])
2369482df631Smrg   if test "x$GROFF" = "x"; then
2370482df631Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2371482df631Smrg   fi
2372482df631Smrg   have_groff=yes
2373482df631Smrgelif test "x$use_groff" = x"no" ; then
2374482df631Smrg   if test "x$GROFF" != "x"; then
2375482df631Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2376482df631Smrg   fi
2377482df631Smrg   have_groff=no
2378482df631Smrgelse
2379482df631Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2380482df631Smrgfi
2381482df631Smrg
2382482df631Smrg# We have groff, test for the presence of the macro packages
2383482df631Smrgif test "x$have_groff" = x"yes"; then
2384482df631Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2385482df631Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2386482df631Smrg        groff_ms_works=yes
2387482df631Smrg    else
2388482df631Smrg        groff_ms_works=no
2389482df631Smrg    fi
2390482df631Smrg    AC_MSG_RESULT([$groff_ms_works])
2391482df631Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2392482df631Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2393482df631Smrg        groff_mm_works=yes
2394482df631Smrg    else
2395482df631Smrg        groff_mm_works=no
2396482df631Smrg    fi
2397482df631Smrg    AC_MSG_RESULT([$groff_mm_works])
2398482df631Smrgfi
2399482df631Smrg
2400482df631Smrg# We have groff, test for HTML dependencies, one command per package
2401482df631Smrgif test "x$have_groff" = x"yes"; then
2402482df631Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2403482df631Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2404482df631Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2405482df631Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2406482df631Smrg      have_groff_html=yes
2407482df631Smrg   else
2408482df631Smrg      have_groff_html=no
2409482df631Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2410482df631Smrg   fi
2411482df631Smrgfi
2412482df631Smrg
2413482df631Smrg# Set Automake conditionals for Makefiles
2414482df631SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2415482df631SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2416482df631SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2417482df631SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2418482df631Smrg]) # XORG_WITH_GROFF
2419482df631Smrg
24209ff100acSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
24219ff100acSmrg# ---------------------------------------
2422482df631Smrg# Minimum version: 1.6.0
2423482df631Smrg# Minimum version for optional DEFAULT argument: 1.11.0
24249ff100acSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2425482df631Smrg#
2426482df631Smrg# Documentation tools are not always available on all platforms and sometimes
2427482df631Smrg# not at the appropriate level. This macro enables a module to test for the
2428482df631Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
24298bfe6addSmrg# the --with-fop option, it allows maximum flexibility in making decisions
2430482df631Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
2431482df631Smrg# --with-fop assumes 'auto'.
2432482df631Smrg#
2433482df631Smrg# Interface to module:
2434482df631Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2435482df631Smrg# FOP:	 	returns the path of the fop program found
2436482df631Smrg#		returns the path set by the user in the environment
2437482df631Smrg# --with-fop: 	'yes' user instructs the module to use fop
2438482df631Smrg#		'no' user instructs the module not to use fop
2439482df631Smrg#
2440482df631Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2441482df631Smrg#
2442482df631SmrgAC_DEFUN([XORG_WITH_FOP],[
2443482df631SmrgAC_ARG_VAR([FOP], [Path to fop command])
24449ff100acSmrgm4_define([_defopt], m4_default([$2], [auto]))
2445482df631SmrgAC_ARG_WITH(fop,
2446482df631Smrg	AS_HELP_STRING([--with-fop],
2447482df631Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2448482df631Smrg	   [use_fop=$withval], [use_fop=]_defopt)
2449482df631Smrgm4_undefine([_defopt])
2450482df631Smrg
2451482df631Smrgif test "x$use_fop" = x"auto"; then
2452482df631Smrg   AC_PATH_PROG([FOP], [fop])
2453482df631Smrg   if test "x$FOP" = "x"; then
2454482df631Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2455482df631Smrg	have_fop=no
2456482df631Smrg   else
2457482df631Smrg        have_fop=yes
2458482df631Smrg   fi
2459482df631Smrgelif test "x$use_fop" = x"yes" ; then
2460482df631Smrg   AC_PATH_PROG([FOP], [fop])
2461482df631Smrg   if test "x$FOP" = "x"; then
2462482df631Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2463482df631Smrg   fi
2464482df631Smrg   have_fop=yes
2465482df631Smrgelif test "x$use_fop" = x"no" ; then
2466482df631Smrg   if test "x$FOP" != "x"; then
2467482df631Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2468482df631Smrg   fi
2469482df631Smrg   have_fop=no
2470482df631Smrgelse
2471482df631Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2472482df631Smrgfi
24739ff100acSmrg
24749ff100acSmrg# Test for a minimum version of fop, if provided.
24759ff100acSmrgm4_ifval([$1],
24769ff100acSmrg[if test "$have_fop" = yes; then
24779ff100acSmrg    # scrape the fop version
24789ff100acSmrg    AC_MSG_CHECKING([for fop minimum version])
24799ff100acSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
24809ff100acSmrg    AC_MSG_RESULT([$fop_version])
24819ff100acSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
24829ff100acSmrg        [if test "x$use_fop" = xauto; then
24839ff100acSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
24849ff100acSmrg            have_fop=no
24859ff100acSmrg        else
24869ff100acSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
24879ff100acSmrg        fi])
24889ff100acSmrgfi])
2489482df631SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2490482df631Smrg]) # XORG_WITH_FOP
2491482df631Smrg
24929ff100acSmrg# XORG_WITH_M4([MIN-VERSION])
24939ff100acSmrg# ---------------------------
24949ff100acSmrg# Minimum version: 1.19.0
24959ff100acSmrg#
24969ff100acSmrg# This macro attempts to locate an m4 macro processor which supports
24979ff100acSmrg# -I option and is only useful for modules relying on M4 in order to
24989ff100acSmrg# expand macros in source code files.
24999ff100acSmrg#
25009ff100acSmrg# Interface to module:
25019ff100acSmrg# M4:	 	returns the path of the m4 program found
25029ff100acSmrg#		returns the path set by the user in the environment
25039ff100acSmrg#
25049ff100acSmrgAC_DEFUN([XORG_WITH_M4], [
25059ff100acSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
25069ff100acSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
25079ff100acSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
25089ff100acSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
25099ff100acSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
25109ff100acSmrg   [$PATH:/usr/gnu/bin])])
25119ff100acSmrg
25129ff100acSmrgAC_SUBST([M4], [$ac_cv_path_M4])
25139ff100acSmrg]) # XORG_WITH_M4
25149ff100acSmrg
2515482df631Smrg# XORG_WITH_PS2PDF([DEFAULT])
2516482df631Smrg# ----------------
2517482df631Smrg# Minimum version: 1.6.0
2518482df631Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2519482df631Smrg#
2520482df631Smrg# Documentation tools are not always available on all platforms and sometimes
2521482df631Smrg# not at the appropriate level. This macro enables a module to test for the
2522482df631Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
25238bfe6addSmrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
2524482df631Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2525482df631Smrg# --with-ps2pdf assumes 'auto'.
2526482df631Smrg#
2527482df631Smrg# Interface to module:
2528482df631Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2529482df631Smrg# PS2PDF:	returns the path of the ps2pdf program found
2530482df631Smrg#		returns the path set by the user in the environment
2531482df631Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2532482df631Smrg#		 'no' user instructs the module not to use ps2pdf
2533482df631Smrg#
2534482df631Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2535482df631Smrg#
2536482df631SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2537482df631SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2538482df631Smrgm4_define([_defopt], m4_default([$1], [auto]))
2539482df631SmrgAC_ARG_WITH(ps2pdf,
2540482df631Smrg	AS_HELP_STRING([--with-ps2pdf],
2541482df631Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2542482df631Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2543482df631Smrgm4_undefine([_defopt])
2544482df631Smrg
2545482df631Smrgif test "x$use_ps2pdf" = x"auto"; then
2546482df631Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2547482df631Smrg   if test "x$PS2PDF" = "x"; then
2548482df631Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2549482df631Smrg	have_ps2pdf=no
2550482df631Smrg   else
2551482df631Smrg        have_ps2pdf=yes
2552482df631Smrg   fi
2553482df631Smrgelif test "x$use_ps2pdf" = x"yes" ; then
2554482df631Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2555482df631Smrg   if test "x$PS2PDF" = "x"; then
2556482df631Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2557482df631Smrg   fi
2558482df631Smrg   have_ps2pdf=yes
2559482df631Smrgelif test "x$use_ps2pdf" = x"no" ; then
2560482df631Smrg   if test "x$PS2PDF" != "x"; then
2561482df631Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2562482df631Smrg   fi
2563482df631Smrg   have_ps2pdf=no
2564482df631Smrgelse
2565482df631Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2566482df631Smrgfi
2567482df631SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2568482df631Smrg]) # XORG_WITH_PS2PDF
2569482df631Smrg
2570482df631Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
2571482df631Smrg# ----------------
2572482df631Smrg# Minimum version: 1.6.0
2573482df631Smrg#
2574482df631Smrg# Documentation tools are not always available on all platforms and sometimes
2575482df631Smrg# not at the appropriate level. This macro enables a builder to skip all
2576482df631Smrg# documentation targets except traditional man pages.
2577482df631Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
25788bfe6addSmrg# maximum flexibility in controlling documentation building.
2579482df631Smrg# Refer to:
2580482df631Smrg# XORG_WITH_XMLTO         --with-xmlto
2581482df631Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2582482df631Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2583482df631Smrg# XORG_WITH_FOP           --with-fop
2584482df631Smrg# XORG_WITH_GROFF         --with-groff
2585482df631Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2586482df631Smrg#
2587482df631Smrg# Interface to module:
2588482df631Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2589482df631Smrg# --enable-docs: 'yes' user instructs the module to generate docs
2590482df631Smrg#		 'no' user instructs the module not to generate docs
2591482df631Smrg# parm1:	specify the default value, yes or no.
2592482df631Smrg#
2593482df631SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
25949ff100acSmrgm4_define([docs_default], m4_default([$1], [yes]))
2595482df631SmrgAC_ARG_ENABLE(docs,
2596482df631Smrg	AS_HELP_STRING([--enable-docs],
25979ff100acSmrg	   [Enable building the documentation (default: ]docs_default[)]),
25989ff100acSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
25999ff100acSmrgm4_undefine([docs_default])
2600482df631SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2601482df631SmrgAC_MSG_CHECKING([whether to build documentation])
2602482df631SmrgAC_MSG_RESULT([$build_docs])
2603482df631Smrg]) # XORG_ENABLE_DOCS
2604482df631Smrg
2605482df631Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2606482df631Smrg# ----------------
2607482df631Smrg# Minimum version: 1.6.0
2608482df631Smrg#
2609482df631Smrg# This macro enables a builder to skip all developer documentation.
2610482df631Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
26118bfe6addSmrg# maximum flexibility in controlling documentation building.
2612482df631Smrg# Refer to:
2613482df631Smrg# XORG_WITH_XMLTO         --with-xmlto
2614482df631Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2615482df631Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2616482df631Smrg# XORG_WITH_FOP           --with-fop
2617482df631Smrg# XORG_WITH_GROFF         --with-groff
2618482df631Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2619482df631Smrg#
2620482df631Smrg# Interface to module:
2621482df631Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2622482df631Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2623482df631Smrg#			'no' user instructs the module not to generate developer docs
2624482df631Smrg# parm1:		specify the default value, yes or no.
2625482df631Smrg#
2626482df631SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2627482df631Smrgm4_define([devel_default], m4_default([$1], [yes]))
2628482df631SmrgAC_ARG_ENABLE(devel-docs,
2629482df631Smrg	AS_HELP_STRING([--enable-devel-docs],
2630482df631Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2631482df631Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2632482df631Smrgm4_undefine([devel_default])
2633482df631SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2634482df631SmrgAC_MSG_CHECKING([whether to build developer documentation])
2635482df631SmrgAC_MSG_RESULT([$build_devel_docs])
2636482df631Smrg]) # XORG_ENABLE_DEVEL_DOCS
2637482df631Smrg
2638482df631Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2639482df631Smrg# ----------------
2640482df631Smrg# Minimum version: 1.6.0
2641482df631Smrg#
2642482df631Smrg# This macro enables a builder to skip all functional specification targets.
2643482df631Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
26448bfe6addSmrg# maximum flexibility in controlling documentation building.
2645482df631Smrg# Refer to:
2646482df631Smrg# XORG_WITH_XMLTO         --with-xmlto
2647482df631Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2648482df631Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2649482df631Smrg# XORG_WITH_FOP           --with-fop
2650482df631Smrg# XORG_WITH_GROFF         --with-groff
2651482df631Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2652482df631Smrg#
2653482df631Smrg# Interface to module:
2654482df631Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2655482df631Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2656482df631Smrg#			'no' user instructs the module not to generate specs
2657482df631Smrg# parm1:		specify the default value, yes or no.
2658482df631Smrg#
2659482df631SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2660482df631Smrgm4_define([spec_default], m4_default([$1], [yes]))
2661482df631SmrgAC_ARG_ENABLE(specs,
2662482df631Smrg	AS_HELP_STRING([--enable-specs],
2663482df631Smrg	   [Enable building the specs (default: ]spec_default[)]),
2664482df631Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2665482df631Smrgm4_undefine([spec_default])
2666482df631SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2667482df631SmrgAC_MSG_CHECKING([whether to build functional specifications])
2668482df631SmrgAC_MSG_RESULT([$build_specs])
2669482df631Smrg]) # XORG_ENABLE_SPECS
2670482df631Smrg
26719ff100acSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
26729ff100acSmrg# ----------------------------------------------
26739ff100acSmrg# Minimum version: 1.13.0
26749ff100acSmrg#
26759ff100acSmrg# This macro enables a builder to enable/disable unit testing
26769ff100acSmrg# It makes no assumption about the test cases implementation
26779ff100acSmrg# Test cases may or may not use Automake "Support for test suites"
26789ff100acSmrg# They may or may not use the software utility library GLib
26799ff100acSmrg#
26809ff100acSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
26819ff100acSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
26829ff100acSmrg# The variable enable_unit_tests is used by other macros in this file.
26839ff100acSmrg#
26849ff100acSmrg# Interface to module:
26859ff100acSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
26869ff100acSmrg# enable_unit_tests:    used in configure.ac for additional configuration
26879ff100acSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
26889ff100acSmrg#			'no' user instructs the module not to build tests
26899ff100acSmrg# parm1:		specify the default value, yes or no.
26909ff100acSmrg#
26919ff100acSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
26929ff100acSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
26939ff100acSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
26949ff100acSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
26959ff100acSmrgm4_define([_defopt], m4_default([$1], [auto]))
26969ff100acSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
26979ff100acSmrg	[Enable building unit test cases (default: ]_defopt[)]),
26989ff100acSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
26999ff100acSmrgm4_undefine([_defopt])
27009ff100acSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
27019ff100acSmrgAC_MSG_CHECKING([whether to build unit test cases])
27029ff100acSmrgAC_MSG_RESULT([$enable_unit_tests])
27039ff100acSmrg]) # XORG_ENABLE_UNIT_TESTS
27049ff100acSmrg
27059ff100acSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
27069ff100acSmrg# ------------------------------------------------------
27079ff100acSmrg# Minimum version: 1.17.0
27089ff100acSmrg#
27099ff100acSmrg# This macro enables a builder to enable/disable integration testing
27109ff100acSmrg# It makes no assumption about the test cases' implementation
27119ff100acSmrg# Test cases may or may not use Automake "Support for test suites"
27129ff100acSmrg#
27139ff100acSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
27149ff100acSmrg# usually requires less dependencies and may be built and run under less
27159ff100acSmrg# stringent environments than integration tests.
27169ff100acSmrg#
27179ff100acSmrg# Interface to module:
27189ff100acSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
27199ff100acSmrg# enable_integration_tests:   used in configure.ac for additional configuration
27209ff100acSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
27219ff100acSmrg#                             'no' user instructs the module not to build tests
27229ff100acSmrg# parm1:                      specify the default value, yes or no.
27239ff100acSmrg#
27249ff100acSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
27259ff100acSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
27269ff100acSmrgm4_define([_defopt], m4_default([$1], [auto]))
27279ff100acSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
27289ff100acSmrg	[Enable building integration test cases (default: ]_defopt[)]),
27299ff100acSmrg	[enable_integration_tests=$enableval],
27309ff100acSmrg	[enable_integration_tests=]_defopt)
27319ff100acSmrgm4_undefine([_defopt])
27329ff100acSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
27339ff100acSmrg	[test "x$enable_integration_tests" != xno])
27349ff100acSmrgAC_MSG_CHECKING([whether to build unit test cases])
27359ff100acSmrgAC_MSG_RESULT([$enable_integration_tests])
27369ff100acSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
27379ff100acSmrg
27389ff100acSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
27399ff100acSmrg# ----------------------------------------
27409ff100acSmrg# Minimum version: 1.13.0
27419ff100acSmrg#
27429ff100acSmrg# GLib is a library which provides advanced data structures and functions.
27439ff100acSmrg# This macro enables a module to test for the presence of Glib.
27449ff100acSmrg#
27459ff100acSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
27469ff100acSmrg# Otherwise the value of $enable_unit_tests is blank.
27479ff100acSmrg#
27489ff100acSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
27499ff100acSmrg# test support usually requires less dependencies and may be built and run under
27509ff100acSmrg# less stringent environments than integration tests.
27519ff100acSmrg#
27529ff100acSmrg# Interface to module:
27539ff100acSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
27549ff100acSmrg# with_glib: used in configure.ac to know if GLib has been found
27559ff100acSmrg# --with-glib:	'yes' user instructs the module to use glib
27569ff100acSmrg#		'no' user instructs the module not to use glib
27579ff100acSmrg#
27589ff100acSmrgAC_DEFUN([XORG_WITH_GLIB],[
27599ff100acSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
27609ff100acSmrgm4_define([_defopt], m4_default([$2], [auto]))
27619ff100acSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
27629ff100acSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
27639ff100acSmrg	[with_glib=$withval], [with_glib=]_defopt)
27649ff100acSmrgm4_undefine([_defopt])
27659ff100acSmrg
27669ff100acSmrghave_glib=no
27679ff100acSmrg# Do not probe GLib if user explicitly disabled unit testing
27689ff100acSmrgif test "x$enable_unit_tests" != x"no"; then
27699ff100acSmrg  # Do not probe GLib if user explicitly disabled it
27709ff100acSmrg  if test "x$with_glib" != x"no"; then
27719ff100acSmrg    m4_ifval(
27729ff100acSmrg      [$1],
27739ff100acSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
27749ff100acSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
27759ff100acSmrg    )
27769ff100acSmrg  fi
27779ff100acSmrgfi
27789ff100acSmrg
27799ff100acSmrg# Not having GLib when unit testing has been explicitly requested is an error
27809ff100acSmrgif test "x$enable_unit_tests" = x"yes"; then
27819ff100acSmrg  if test "x$have_glib" = x"no"; then
27829ff100acSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
27839ff100acSmrg  fi
27849ff100acSmrgfi
27859ff100acSmrg
27869ff100acSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
27879ff100acSmrgif test "x$enable_unit_tests" = x"no"; then
27889ff100acSmrg  if test "x$with_glib" = x"yes"; then
27899ff100acSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
27909ff100acSmrg  fi
27919ff100acSmrgfi
27929ff100acSmrg
27939ff100acSmrg# Not having GLib when it has been explicitly requested is an error
27949ff100acSmrgif test "x$with_glib" = x"yes"; then
27959ff100acSmrg  if test "x$have_glib" = x"no"; then
27969ff100acSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
27979ff100acSmrg  fi
27989ff100acSmrgfi
27999ff100acSmrg
28009ff100acSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
28019ff100acSmrg]) # XORG_WITH_GLIB
28029ff100acSmrg
28039ff100acSmrg# XORG_LD_WRAP([required|optional])
28049ff100acSmrg# ---------------------------------
28059ff100acSmrg# Minimum version: 1.13.0
28069ff100acSmrg#
28079ff100acSmrg# Check if linker supports -wrap, passed via compiler flags
28089ff100acSmrg#
28099ff100acSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
28109ff100acSmrg# Otherwise the value of $enable_unit_tests is blank.
28119ff100acSmrg#
28129ff100acSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
28139ff100acSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
28149ff100acSmrg# available, an argument of "optional" allows use when some unit tests require
28159ff100acSmrg# ld -wrap and others do not.
28169ff100acSmrg#
28179ff100acSmrgAC_DEFUN([XORG_LD_WRAP],[
28189ff100acSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
28199ff100acSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
28209ff100acSmrg                      void __wrap_exit(int status) { return; }],
28219ff100acSmrg                     [exit(0);])])
28229ff100acSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
28239ff100acSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
28249ff100acSmrg  if test "x$have_ld_wrap" = x"no"; then
28259ff100acSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
28269ff100acSmrg  fi
28279ff100acSmrgfi
28289ff100acSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
28299ff100acSmrg#
28309ff100acSmrg]) # XORG_LD_WRAP
28319ff100acSmrg
28329ff100acSmrg# XORG_CHECK_LINKER_FLAGS
28339ff100acSmrg# -----------------------
28349ff100acSmrg# SYNOPSIS
28359ff100acSmrg#
28369ff100acSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
28379ff100acSmrg#
28389ff100acSmrg# DESCRIPTION
28399ff100acSmrg#
28409ff100acSmrg#   Check whether the given linker FLAGS work with the current language's
28419ff100acSmrg#   linker, or whether they give an error.
28429ff100acSmrg#
28439ff100acSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
28449ff100acSmrg#   success/failure.
28459ff100acSmrg#
28469ff100acSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
28479ff100acSmrg#
28489ff100acSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
28499ff100acSmrg#
28509ff100acSmrg# LICENSE
28519ff100acSmrg#
28529ff100acSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
28539ff100acSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
28549ff100acSmrg#   Copyright (c) 2009 Matteo Frigo
28559ff100acSmrg#
28569ff100acSmrg#   This program is free software: you can redistribute it and/or modify it
28579ff100acSmrg#   under the terms of the GNU General Public License as published by the
28589ff100acSmrg#   Free Software Foundation, either version 3 of the License, or (at your
28599ff100acSmrg#   option) any later version.
28609ff100acSmrg#
28619ff100acSmrg#   This program is distributed in the hope that it will be useful, but
28629ff100acSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
28639ff100acSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
28649ff100acSmrg#   Public License for more details.
28659ff100acSmrg#
28669ff100acSmrg#   You should have received a copy of the GNU General Public License along
28679ff100acSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
28689ff100acSmrg#
28699ff100acSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
28709ff100acSmrg#   gives unlimited permission to copy, distribute and modify the configure
28719ff100acSmrg#   scripts that are the output of Autoconf when processing the Macro. You
28729ff100acSmrg#   need not follow the terms of the GNU General Public License when using
28739ff100acSmrg#   or distributing such scripts, even though portions of the text of the
28749ff100acSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
28759ff100acSmrg#   all other use of the material that constitutes the Autoconf Macro.
28769ff100acSmrg#
28779ff100acSmrg#   This special exception to the GPL applies to versions of the Autoconf
28789ff100acSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
28799ff100acSmrg#   modified version of the Autoconf Macro, you may extend this special
28809ff100acSmrg#   exception to the GPL to apply to your modified version as well.#
28819ff100acSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
28829ff100acSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
28839ff100acSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
28849ff100acSmrgAS_LITERAL_IF([$1],
28859ff100acSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
28869ff100acSmrg      ax_save_FLAGS=$LDFLAGS
28879ff100acSmrg      LDFLAGS="$1"
28889ff100acSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
28899ff100acSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
28909ff100acSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
28919ff100acSmrg      LDFLAGS=$ax_save_FLAGS])],
28929ff100acSmrg  [ax_save_FLAGS=$LDFLAGS
28939ff100acSmrg   LDFLAGS="$1"
28949ff100acSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
28959ff100acSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
28969ff100acSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
28979ff100acSmrg   LDFLAGS=$ax_save_FLAGS])
28989ff100acSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
28999ff100acSmrgAC_MSG_RESULT($xorg_check_linker_flags)
29009ff100acSmrgif test "x$xorg_check_linker_flags" = xyes; then
29019ff100acSmrg	m4_default([$2], :)
29029ff100acSmrgelse
29039ff100acSmrg	m4_default([$3], :)
29049ff100acSmrgfi
29059ff100acSmrg]) # XORG_CHECK_LINKER_FLAGS
29069ff100acSmrg
29079ff100acSmrg# XORG_MEMORY_CHECK_FLAGS
29089ff100acSmrg# -----------------------
29099ff100acSmrg# Minimum version: 1.16.0
29109ff100acSmrg#
29119ff100acSmrg# This macro attempts to find appropriate memory checking functionality
29129ff100acSmrg# for various platforms which unit testing code may use to catch various
29139ff100acSmrg# forms of memory allocation and access errors in testing.
29149ff100acSmrg#
29159ff100acSmrg# Interface to module:
29169ff100acSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
29179ff100acSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
29189ff100acSmrg#
29199ff100acSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
29209ff100acSmrg#
29219ff100acSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
29229ff100acSmrg
29239ff100acSmrgAC_REQUIRE([AC_CANONICAL_HOST])
29249ff100acSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
29259ff100acSmrg           [Environment variables to enable memory checking in tests])
29269ff100acSmrg
29279ff100acSmrg# Check for different types of support on different platforms
29289ff100acSmrgcase $host_os in
29299ff100acSmrg    solaris*)
29309ff100acSmrg        AC_CHECK_LIB([umem], [umem_alloc],
29319ff100acSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
29329ff100acSmrg        ;;
29339ff100acSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
29349ff100acSmrg        # both directly and inverted, so should not be 0 or 255.
29359ff100acSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
29369ff100acSmrg        ;;
29379ff100acSmrg    darwin*)
29389ff100acSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
29399ff100acSmrg        ;;
29409ff100acSmrg    *bsd*)
29419ff100acSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
29429ff100acSmrg        ;;
29439ff100acSmrgesac
29449ff100acSmrg
29459ff100acSmrg# User supplied flags override default flags
29469ff100acSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
29479ff100acSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
29489ff100acSmrgfi
29499ff100acSmrg
29509ff100acSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
29519ff100acSmrg]) # XORG_WITH_LINT
29529ff100acSmrg
2953db17cd6dSmrg# XORG_CHECK_MALLOC_ZERO
2954db17cd6dSmrg# ----------------------
2955db17cd6dSmrg# Minimum version: 1.0.0
2956db17cd6dSmrg#
2957db17cd6dSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2958db17cd6dSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2959db17cd6dSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
29608bfe6addSmrg#
29618bfe6addSmrg# No longer actually tests since there is no guarantee applications will
29628bfe6addSmrg# run with the same malloc implementation we tested against, and the cost
29638bfe6addSmrg# of always ensuring the size passed to malloc is non-zero is minimal now.
29648bfe6addSmrg# Still allows builders to override when they have complete control over
29658bfe6addSmrg# which malloc implementation will be used.
2966db17cd6dSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2967db17cd6dSmrgAC_ARG_ENABLE(malloc0returnsnull,
2968db17cd6dSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
29698bfe6addSmrg		       [assume malloc(0) can return NULL (default: yes)]),
2970db17cd6dSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
29718bfe6addSmrg	[MALLOC_ZERO_RETURNS_NULL=yes])
29728bfe6addSmrg
29738bfe6addSmrgAC_MSG_CHECKING([whether to act as if malloc(0) can return NULL])
2974db17cd6dSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
297576910425Smrg
2976db17cd6dSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2977db17cd6dSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2978db17cd6dSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2979db17cd6dSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2980db17cd6dSmrgelse
2981db17cd6dSmrg	MALLOC_ZERO_CFLAGS=""
2982db17cd6dSmrg	XMALLOC_ZERO_CFLAGS=""
2983db17cd6dSmrg	XTMALLOC_ZERO_CFLAGS=""
2984db17cd6dSmrgfi
298576910425Smrg
2986db17cd6dSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2987db17cd6dSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2988db17cd6dSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2989db17cd6dSmrg]) # XORG_CHECK_MALLOC_ZERO
299076910425Smrg
2991db17cd6dSmrg# XORG_WITH_LINT()
2992db17cd6dSmrg# ----------------
2993db17cd6dSmrg# Minimum version: 1.1.0
299476910425Smrg#
2995482df631Smrg# This macro enables the use of a tool that flags some suspicious and
2996482df631Smrg# non-portable constructs (likely to be bugs) in C language source code.
2997482df631Smrg# It will attempt to locate the tool and use appropriate options.
2998482df631Smrg# There are various lint type tools on different platforms.
2999482df631Smrg#
3000482df631Smrg# Interface to module:
3001482df631Smrg# LINT:		returns the path to the tool found on the platform
3002482df631Smrg#		or the value set to LINT on the configure cmd line
3003482df631Smrg#		also an Automake conditional
3004482df631Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
3005482df631Smrg#
3006482df631Smrg# --with-lint:	'yes' user instructs the module to use lint
3007482df631Smrg#		'no' user instructs the module not to use lint (default)
3008482df631Smrg#
3009482df631Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
3010482df631Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
3011db17cd6dSmrg#
3012db17cd6dSmrgAC_DEFUN([XORG_WITH_LINT],[
3013db17cd6dSmrg
3014482df631SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
3015482df631SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
3016db17cd6dSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
3017db17cd6dSmrg		[Use a lint-style source code checker (default: disabled)])],
3018db17cd6dSmrg		[use_lint=$withval], [use_lint=no])
3019482df631Smrg
3020482df631Smrg# Obtain platform specific info like program name and options
3021482df631Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
3022482df631Smrgcase $host_os in
3023482df631Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
3024482df631Smrg	lint_name=splint
3025482df631Smrg	lint_options="-badflag"
3026482df631Smrg	;;
3027482df631Smrg  *freebsd* | *netbsd*)
3028482df631Smrg	lint_name=lint
3029482df631Smrg	lint_options="-u -b"
3030482df631Smrg	;;
3031482df631Smrg  *solaris*)
3032482df631Smrg	lint_name=lint
3033482df631Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
3034482df631Smrg	;;
3035482df631Smrgesac
3036482df631Smrg
3037482df631Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
3038482df631Smrgif test "x$use_lint" = x"yes" ; then
3039482df631Smrg   AC_PATH_PROG([LINT], [$lint_name])
3040482df631Smrg   if test "x$LINT" = "x"; then
3041482df631Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
3042482df631Smrg   fi
3043482df631Smrgelif test "x$use_lint" = x"no" ; then
3044482df631Smrg   if test "x$LINT" != "x"; then
3045482df631Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
3046482df631Smrg   fi
304776910425Smrgelse
3048482df631Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
3049db17cd6dSmrgfi
3050482df631Smrg
3051482df631Smrg# User supplied flags override default flags
3052482df631Smrgif test "x$LINT_FLAGS" != "x"; then
3053482df631Smrg   lint_options=$LINT_FLAGS
305476910425Smrgfi
305576910425Smrg
3056482df631SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
3057482df631SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
305876910425Smrg
3059db17cd6dSmrg]) # XORG_WITH_LINT
306076910425Smrg
3061db17cd6dSmrg# XORG_LINT_LIBRARY(LIBNAME)
3062db17cd6dSmrg# --------------------------
3063db17cd6dSmrg# Minimum version: 1.1.0
3064db17cd6dSmrg#
3065db17cd6dSmrg# Sets up flags for building lint libraries for checking programs that call
3066db17cd6dSmrg# functions in the library.
3067db17cd6dSmrg#
3068482df631Smrg# Interface to module:
3069482df631Smrg# LINTLIB		- Automake variable with the name of lint library file to make
3070482df631Smrg# MAKE_LINT_LIB		- Automake conditional
3071482df631Smrg#
3072482df631Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
3073482df631Smrg#			  - 'no' user instructs the module not to create a lint library (default)
307476910425Smrg
3075db17cd6dSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
3076db17cd6dSmrgAC_REQUIRE([XORG_WITH_LINT])
3077db17cd6dSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
3078db17cd6dSmrg	[Create lint library (default: disabled)])],
3079db17cd6dSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
3080482df631Smrg
3081482df631Smrgif test "x$make_lint_lib" = x"yes" ; then
3082482df631Smrg   LINTLIB=llib-l$1.ln
3083482df631Smrg   if test "x$LINT" = "x"; then
3084482df631Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
3085482df631Smrg   fi
3086482df631Smrgelif test "x$make_lint_lib" != x"no" ; then
3087482df631Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
3088db17cd6dSmrgfi
3089482df631Smrg
3090db17cd6dSmrgAC_SUBST(LINTLIB)
3091db17cd6dSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
309276910425Smrg
3093db17cd6dSmrg]) # XORG_LINT_LIBRARY
309476910425Smrg
30959ff100acSmrg# XORG_COMPILER_BRAND
30969ff100acSmrg# -------------------
30979ff100acSmrg# Minimum version: 1.14.0
30989ff100acSmrg#
30999ff100acSmrg# Checks for various brands of compilers and sets flags as appropriate:
31009ff100acSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
31019ff100acSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
31029ff100acSmrg#   clang compiler - sets CLANGCC to "yes"
31039ff100acSmrg#   Intel compiler - sets INTELCC to "yes"
31049ff100acSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
31059ff100acSmrg#
31069ff100acSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
31079ff100acSmrgAC_LANG_CASE(
31089ff100acSmrg	[C], [
31098bfe6addSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
31108bfe6addSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
31118bfe6addSmrg		m4_version_prereq([2.70],
31128bfe6addSmrg			[AC_REQUIRE([AC_PROG_CC])],
31138bfe6addSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
31149ff100acSmrg	],
31159ff100acSmrg	[C++], [
31169ff100acSmrg		AC_REQUIRE([AC_PROG_CXX])
31179ff100acSmrg	]
31189ff100acSmrg)
31199ff100acSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
31209ff100acSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
31219ff100acSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
31229ff100acSmrg]) # XORG_COMPILER_BRAND
31239ff100acSmrg
31249ff100acSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
31259ff100acSmrg# ---------------
31269ff100acSmrg# Minimum version: 1.16.0
31279ff100acSmrg#
31289ff100acSmrg# Test if the compiler works when passed the given flag as a command line argument.
31298bfe6addSmrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
31309ff100acSmrg# next flag in the list until there are no more options.
31319ff100acSmrg#
31329ff100acSmrg# Note that this does not guarantee that the compiler supports the flag as some
31339ff100acSmrg# compilers will simply ignore arguments that they do not understand, but we do
31349ff100acSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
31359ff100acSmrg# -Werror=unused-command-line-argument
31369ff100acSmrg#
31379ff100acSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
31389ff100acSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
31399ff100acSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
31409ff100acSmrg
31419ff100acSmrgAC_LANG_COMPILER_REQUIRE
31429ff100acSmrg
31439ff100acSmrgAC_LANG_CASE(
31449ff100acSmrg	[C], [
31458bfe6addSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
31468bfe6addSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
31478bfe6addSmrg		m4_version_prereq([2.70],
31488bfe6addSmrg			[AC_REQUIRE([AC_PROG_CC])],
31498bfe6addSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
31509ff100acSmrg		define([PREFIX], [C])
31519ff100acSmrg		define([CACHE_PREFIX], [cc])
31529ff100acSmrg		define([COMPILER], [$CC])
31539ff100acSmrg	],
31549ff100acSmrg	[C++], [
31559ff100acSmrg		define([PREFIX], [CXX])
31569ff100acSmrg		define([CACHE_PREFIX], [cxx])
31579ff100acSmrg		define([COMPILER], [$CXX])
31589ff100acSmrg	]
31599ff100acSmrg)
31609ff100acSmrg
31619ff100acSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
31629ff100acSmrg
31639ff100acSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
31649ff100acSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
31659ff100acSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
31669ff100acSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
31679ff100acSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
31689ff100acSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
31699ff100acSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
31709ff100acSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
31719ff100acSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
31729ff100acSmrgfi
31739ff100acSmrg
31749ff100acSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
31759ff100acSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
31769ff100acSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
31779ff100acSmrg	fi
31789ff100acSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
31799ff100acSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
31809ff100acSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
31819ff100acSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
31829ff100acSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
31839ff100acSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
31849ff100acSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
31859ff100acSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
31869ff100acSmrgfi
31879ff100acSmrg
31889ff100acSmrgfound="no"
31899ff100acSmrgm4_foreach([flag], m4_cdr($@), [
31909ff100acSmrg	if test $found = "no" ; then
31919ff100acSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
31929ff100acSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
31939ff100acSmrg		fi
31949ff100acSmrg
31959ff100acSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
31969ff100acSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
31979ff100acSmrg		fi
31989ff100acSmrg
31999ff100acSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
32009ff100acSmrg
32019ff100acSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
32029ff100acSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
32039ff100acSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
32049ff100acSmrg		AC_CACHE_VAL($cacheid,
32059ff100acSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
32069ff100acSmrg					     [eval $cacheid=yes],
32079ff100acSmrg					     [eval $cacheid=no])])
32089ff100acSmrg
32099ff100acSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
32109ff100acSmrg
32119ff100acSmrg		eval supported=\$$cacheid
32129ff100acSmrg		AC_MSG_RESULT([$supported])
32139ff100acSmrg		if test "$supported" = "yes" ; then
32149ff100acSmrg			$1="$$1 ]flag["
32159ff100acSmrg			found="yes"
32169ff100acSmrg		fi
32179ff100acSmrg	fi
32189ff100acSmrg])
32199ff100acSmrg]) # XORG_TESTSET_CFLAG
32209ff100acSmrg
32219ff100acSmrg# XORG_COMPILER_FLAGS
32229ff100acSmrg# ---------------
32239ff100acSmrg# Minimum version: 1.16.0
32249ff100acSmrg#
32259ff100acSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
32269ff100acSmrg# arguments supported by the selected compiler which do NOT alter the generated
32279ff100acSmrg# code.  These arguments will cause the compiler to print various warnings
32289ff100acSmrg# during compilation AND turn a conservative set of warnings into errors.
32299ff100acSmrg#
32309ff100acSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
32319ff100acSmrg# future versions of util-macros as options are added to new compilers.
32329ff100acSmrg#
32339ff100acSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
32349ff100acSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
32359ff100acSmrg
32369ff100acSmrgAC_ARG_ENABLE(selective-werror,
32379ff100acSmrg              AS_HELP_STRING([--disable-selective-werror],
32389ff100acSmrg                             [Turn off selective compiler errors. (default: enabled)]),
32399ff100acSmrg              [SELECTIVE_WERROR=$enableval],
32409ff100acSmrg              [SELECTIVE_WERROR=yes])
32419ff100acSmrg
32429ff100acSmrgAC_LANG_CASE(
32439ff100acSmrg        [C], [
32449ff100acSmrg                define([PREFIX], [C])
32459ff100acSmrg        ],
32469ff100acSmrg        [C++], [
32479ff100acSmrg                define([PREFIX], [CXX])
32489ff100acSmrg        ]
32499ff100acSmrg)
32509ff100acSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
32519ff100acSmrgif test "x$SUNCC" = "xyes"; then
32529ff100acSmrg    [BASE_]PREFIX[FLAGS]="-v"
32539ff100acSmrgelse
32549ff100acSmrg    [BASE_]PREFIX[FLAGS]=""
32559ff100acSmrgfi
32569ff100acSmrg
32579ff100acSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
32589ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
32599ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
32609ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
32619ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
32629ff100acSmrg
32639ff100acSmrgAC_LANG_CASE(
32649ff100acSmrg	[C], [
32659ff100acSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
32669ff100acSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
32679ff100acSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
32689ff100acSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
32699ff100acSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
32709ff100acSmrg	]
32719ff100acSmrg)
32729ff100acSmrg
32739ff100acSmrg# This chunk adds additional warnings that could catch undesired effects.
32749ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
32759ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
32769ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
32779ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
32789ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
32799ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
32809ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
32819ff100acSmrg
32829ff100acSmrg# These are currently disabled because they are noisy.  They will be enabled
32839ff100acSmrg# in the future once the codebase is sufficiently modernized to silence
32849ff100acSmrg# them.  For now, I don't want them to drown out the other warnings.
32859ff100acSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
32869ff100acSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
32879ff100acSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
32889ff100acSmrg
32898bfe6addSmrg# Turn some warnings into errors, so we don't accidentally get successful builds
32909ff100acSmrg# when there are problems that should be fixed.
32919ff100acSmrg
32929ff100acSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
32939ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
32949ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
32959ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
32969ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
32979ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
32989ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
32999ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
33009ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
33019ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
33029ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
33039ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
33049ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
33059ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
33069ff100acSmrgelse
33079ff100acSmrgAC_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])
33089ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
33099ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
33109ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
33119ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
33129ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
33139ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
33149ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
33159ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
33169ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
33179ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
33189ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
33199ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
33209ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
33219ff100acSmrgfi
33229ff100acSmrg
33239ff100acSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
33249ff100acSmrg]) # XORG_COMPILER_FLAGS
33259ff100acSmrg
3326db17cd6dSmrg# XORG_CWARNFLAGS
3327db17cd6dSmrg# ---------------
3328db17cd6dSmrg# Minimum version: 1.2.0
33299ff100acSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3330db17cd6dSmrg#
3331db17cd6dSmrg# Defines CWARNFLAGS to enable C compiler warnings.
3332db17cd6dSmrg#
33339ff100acSmrg# This function is deprecated because it defines -fno-strict-aliasing
33349ff100acSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
33359ff100acSmrg# is needed, then it should be added explicitly in the module when
33369ff100acSmrg# it is updated to use BASE_CFLAGS.
33379ff100acSmrg#
3338db17cd6dSmrgAC_DEFUN([XORG_CWARNFLAGS], [
33399ff100acSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
33409ff100acSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
33419ff100acSmrgAC_LANG_CASE(
33429ff100acSmrg	[C], [
33439ff100acSmrg		CWARNFLAGS="$BASE_CFLAGS"
33449ff100acSmrg		if  test "x$GCC" = xyes ; then
33459ff100acSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
33469ff100acSmrg		fi
33479ff100acSmrg		AC_SUBST(CWARNFLAGS)
33489ff100acSmrg	]
33499ff100acSmrg)
3350db17cd6dSmrg]) # XORG_CWARNFLAGS
335176910425Smrg
3352db17cd6dSmrg# XORG_STRICT_OPTION
3353db17cd6dSmrg# -----------------------
3354db17cd6dSmrg# Minimum version: 1.3.0
335576910425Smrg#
33569ff100acSmrg# Add configure option to enable strict compilation flags, such as treating
33579ff100acSmrg# warnings as fatal errors.
33589ff100acSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
33599ff100acSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
33609ff100acSmrg#
33619ff100acSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
33629ff100acSmrg# when strict compilation is unconditionally desired.
3363db17cd6dSmrgAC_DEFUN([XORG_STRICT_OPTION], [
3364db17cd6dSmrgAC_REQUIRE([XORG_CWARNFLAGS])
33659ff100acSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3366db17cd6dSmrg
3367db17cd6dSmrgAC_ARG_ENABLE(strict-compilation,
3368db17cd6dSmrg			  AS_HELP_STRING([--enable-strict-compilation],
3369db17cd6dSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3370db17cd6dSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
33719ff100acSmrg
33729ff100acSmrgAC_LANG_CASE(
33739ff100acSmrg        [C], [
33749ff100acSmrg                define([PREFIX], [C])
33759ff100acSmrg        ],
33769ff100acSmrg        [C++], [
33779ff100acSmrg                define([PREFIX], [CXX])
33789ff100acSmrg        ]
33799ff100acSmrg)
33809ff100acSmrg
33819ff100acSmrg[STRICT_]PREFIX[FLAGS]=""
33829ff100acSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
33839ff100acSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
33849ff100acSmrg
33859ff100acSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
33869ff100acSmrg# activate it with -Werror, so we add it here explicitly.
33879ff100acSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
33889ff100acSmrg
3389db17cd6dSmrgif test "x$STRICT_COMPILE" = "xyes"; then
33909ff100acSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
33919ff100acSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3392db17cd6dSmrgfi
33939ff100acSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
33949ff100acSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
33959ff100acSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3396db17cd6dSmrg]) # XORG_STRICT_OPTION
339776910425Smrg
33988bfe6addSmrg# XORG_DEFAULT_NOCODE_OPTIONS
33998bfe6addSmrg# ---------------------------
34008bfe6addSmrg# Minimum version: 1.20.0
34018bfe6addSmrg#
34028bfe6addSmrg# Defines default options for X.Org modules which don't compile code,
34038bfe6addSmrg# such as fonts, bitmaps, cursors, and docs.
34048bfe6addSmrg#
34058bfe6addSmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
34068bfe6addSmrgAC_REQUIRE([AC_PROG_INSTALL])
34078bfe6addSmrgXORG_RELEASE_VERSION
34088bfe6addSmrgXORG_CHANGELOG
34098bfe6addSmrgXORG_INSTALL
34108bfe6addSmrgXORG_MANPAGE_SECTIONS
34118bfe6addSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
34128bfe6addSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
34138bfe6addSmrg]) # XORG_DEFAULT_NOCODE_OPTIONS
34148bfe6addSmrg
3415db17cd6dSmrg# XORG_DEFAULT_OPTIONS
3416db17cd6dSmrg# --------------------
3417db17cd6dSmrg# Minimum version: 1.3.0
3418db17cd6dSmrg#
34198bfe6addSmrg# Defines default options for X.Org modules which compile code.
3420db17cd6dSmrg#
3421db17cd6dSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3422482df631SmrgAC_REQUIRE([AC_PROG_INSTALL])
34239ff100acSmrgXORG_COMPILER_FLAGS
3424db17cd6dSmrgXORG_CWARNFLAGS
3425db17cd6dSmrgXORG_STRICT_OPTION
34268bfe6addSmrgXORG_DEFAULT_NOCODE_OPTIONS
3427db17cd6dSmrg]) # XORG_DEFAULT_OPTIONS
3428482df631Smrg
3429482df631Smrg# XORG_INSTALL()
3430482df631Smrg# ----------------
3431482df631Smrg# Minimum version: 1.4.0
3432482df631Smrg#
3433482df631Smrg# Defines the variable INSTALL_CMD as the command to copy
3434482df631Smrg# INSTALL from $prefix/share/util-macros.
3435482df631Smrg#
3436482df631SmrgAC_DEFUN([XORG_INSTALL], [
3437482df631SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3438482df631Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3439482df631SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3440482df631Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3441a67f45c3Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3442a67f45c3Smrgtouch \$(top_srcdir)/INSTALL; \
3443a67f45c3Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3444482df631SmrgAC_SUBST([INSTALL_CMD])
3445482df631Smrg]) # XORG_INSTALL
3446db17cd6dSmrgdnl Copyright 2005 Red Hat, Inc
3447db17cd6dSmrgdnl
3448db17cd6dSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3449db17cd6dSmrgdnl documentation for any purpose is hereby granted without fee, provided that
3450db17cd6dSmrgdnl the above copyright notice appear in all copies and that both that
3451db17cd6dSmrgdnl copyright notice and this permission notice appear in supporting
3452db17cd6dSmrgdnl documentation.
3453db17cd6dSmrgdnl
3454db17cd6dSmrgdnl The above copyright notice and this permission notice shall be included
3455db17cd6dSmrgdnl in all copies or substantial portions of the Software.
3456db17cd6dSmrgdnl
3457db17cd6dSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3458db17cd6dSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3459db17cd6dSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3460db17cd6dSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3461db17cd6dSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3462db17cd6dSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3463db17cd6dSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
3464db17cd6dSmrgdnl
3465db17cd6dSmrgdnl Except as contained in this notice, the name of the copyright holders shall
3466db17cd6dSmrgdnl not be used in advertising or otherwise to promote the sale, use or
3467db17cd6dSmrgdnl other dealings in this Software without prior written authorization
3468db17cd6dSmrgdnl from the copyright holders.
3469db17cd6dSmrgdnl
347076910425Smrg
3471db17cd6dSmrg# XORG_RELEASE_VERSION
3472db17cd6dSmrg# --------------------
3473482df631Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
34749ff100acSmrg
3475db17cd6dSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3476db17cd6dSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3477db17cd6dSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3478db17cd6dSmrg		[Major version of this package])
3479db17cd6dSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3480db17cd6dSmrg	if test "x$PVM" = "x"; then
3481db17cd6dSmrg		PVM="0"
3482db17cd6dSmrg	fi
3483db17cd6dSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3484db17cd6dSmrg		[$PVM],
3485db17cd6dSmrg		[Minor version of this package])
3486db17cd6dSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3487db17cd6dSmrg	if test "x$PVP" = "x"; then
3488db17cd6dSmrg		PVP="0"
3489db17cd6dSmrg	fi
3490db17cd6dSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3491db17cd6dSmrg		[$PVP],
3492db17cd6dSmrg		[Patch version of this package])
349376910425Smrg])
349476910425Smrg
3495db17cd6dSmrg# XORG_CHANGELOG()
3496db17cd6dSmrg# ----------------
3497db17cd6dSmrg# Minimum version: 1.2.0
3498db17cd6dSmrg#
3499db17cd6dSmrg# Defines the variable CHANGELOG_CMD as the command to generate
3500db17cd6dSmrg# ChangeLog from git.
3501db17cd6dSmrg#
3502db17cd6dSmrg#
3503db17cd6dSmrgAC_DEFUN([XORG_CHANGELOG], [
3504a67f45c3SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3505482df631Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3506a67f45c3Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3507a67f45c3Smrgtouch \$(top_srcdir)/ChangeLog; \
3508a67f45c3Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3509db17cd6dSmrgAC_SUBST([CHANGELOG_CMD])
3510db17cd6dSmrg]) # XORG_CHANGELOG
351176910425Smrg
3512