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