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