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.71],,
18[m4_warning([this file was generated for autoconf 2.71.
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 fontutil.m4.  Generated from fontutil.m4.in by configure.
1064dnl
1065dnl This file comes from X.Org's font-util 1.4.0
1066dnl
1067dnl Copyright (c) 2009, 2023, Oracle and/or its affiliates.
1068dnl
1069dnl Permission is hereby granted, free of charge, to any person obtaining a
1070dnl copy of this software and associated documentation files (the "Software"),
1071dnl to deal in the Software without restriction, including without limitation
1072dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1073dnl and/or sell copies of the Software, and to permit persons to whom the
1074dnl Software is furnished to do so, subject to the following conditions:
1075dnl
1076dnl The above copyright notice and this permission notice (including the next
1077dnl paragraph) shall be included in all copies or substantial portions of the
1078dnl Software.
1079dnl
1080dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1081dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1082dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1083dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1084dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1085dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1086dnl DEALINGS IN THE SOFTWARE.
1087dnl
1088dnl --------------------------------------------------------------------
1089dnl
1090dnl Copyright 2005 Red Hat, Inc
1091dnl
1092dnl Permission to use, copy, modify, distribute, and sell this software and its
1093dnl documentation for any purpose is hereby granted without fee, provided that
1094dnl the above copyright notice appear in all copies and that both that
1095dnl copyright notice and this permission notice appear in supporting
1096dnl documentation.
1097dnl
1098dnl The above copyright notice and this permission notice shall be included
1099dnl in all copies or substantial portions of the Software.
1100dnl
1101dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1102dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1103dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1104dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
1105dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1106dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1107dnl OTHER DEALINGS IN THE SOFTWARE.
1108dnl
1109dnl Except as contained in this notice, the name of the copyright holders shall
1110dnl not be used in advertising or otherwise to promote the sale, use or
1111dnl other dealings in this Software without prior written authorization
1112dnl from the copyright holders.
1113
1114# XORG_FONT_MACROS_VERSION(required-version)
1115# ------------------------------------------
1116# Minimum version: 1.1.0
1117#
1118# If you're using a macro added in Version 1.1 or newer, include this in
1119# your configure.ac with the minimum required version, such as:
1120# XORG_FONT_MACROS_VERSION(1.1)
1121#
1122# To ensure that this macro is defined, also add:
1123# m4_ifndef([XORG_FONT_MACROS_VERSION],
1124#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
1125#
1126#
1127# See the "minimum version" comment for each macro you use to see what
1128# version you require.
1129m4_defun([XORG_FONT_MACROS_VERSION],[
1130m4_define([vers_have], [1.4.0])
1131m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1132m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1133m4_if(m4_cmp(maj_have, maj_needed), 0,,
1134    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
1135m4_if(m4_version_compare(vers_have, [$1]), -1,
1136    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
1137m4_undefine([vers_have])
1138m4_undefine([maj_have])
1139m4_undefine([maj_needed])
1140]) # XORG_FONT_MACROS_VERSION
1141
1142# XORG_FONT_CHECK_{maps}()
1143# ------------------------
1144# Minimum version: 1.0.0
1145# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
1146# JISX0201 or KOI8_R.  By default, they are all enabled.
1147
1148AC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
1149AC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
1150AC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
1151AC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
1152AC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
1153AC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
1154AC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
1155AC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
1156AC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
1157AC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
1158AC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
1159AC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
1160AC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
1161AC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
1162AC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
1163AC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
1164AC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
1165AC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
1166
1167# XORG_FONT_CHECK_ENCODING(encoding)
1168# ----------------------------------
1169# Minimum version: 1.1.0
1170# This macro adds --enable/disable-<encoding>, enabled by default.
1171# It replaced individual copies of this code in the above macros in 1.1.
1172# Currently assumes encoding names will be all upper-case - add m4_toupper
1173# calls if this is not true in the future.
1174
1175AC_DEFUN([XORG_FONT_CHECK_ENCODING],[
1176	AC_ARG_ENABLE(m4_tolower($1),
1177		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
1178				[Build $1 fonts (default: yes)]),
1179		[AS_TR_SH($1)=$enableval])
1180	AC_MSG_CHECKING([whether to build $1 fonts])
1181	AC_MSG_RESULT($[AS_TR_SH($1)])
1182	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
1183]) # XORG_FONT_CHECK_ENCODING
1184
1185# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
1186# -----------------------------------------------------
1187# Minimum version: 1.1.0
1188# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
1189# Add a shorthand --enable/disable-all-encodings option.
1190
1191AC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
1192	AC_ARG_ENABLE([all-encodings],
1193		AS_HELP_STRING([--disable-all-encodings],
1194				[Disable building of all font encodings]),
1195		[m4_foreach_w([enc], [$1], [
1196			AS_TR_SH(enc)=$enableval
1197		])],
1198		[m4_foreach_w([enc], [$1], [
1199			AS_TR_SH(enc)=yes
1200		])])
1201	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
1202]) # XORG_FONT_CHECK_ENCODING_LIST
1203
1204# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
1205# ------------------------------------------
1206# Minimum version: 1.1.0
1207#
1208# Simple wrapper around AC_PATH_PROG that errors if not found
1209#
1210
1211AC_DEFUN([XORG_FONT_REQUIRED_PROG],[
1212	AC_PATH_PROG($1, $2)
1213	if test x"$$1" = x; then
1214		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
1215	fi
1216])
1217
1218
1219# XORG_FONT_FCCACHE()
1220# -------------------
1221# Minimum version: 1.1.0
1222#
1223# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
1224# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
1225# to run fc-cache if found and not installing to $DESTDIR and not
1226# cross-compiling
1227#
1228# fc-cache is optional, not required, and should be skipped when making
1229# packages (installing to $DESTDIR) or cross-compiling
1230#
1231AC_DEFUN([XORG_FONT_FCCACHE],[
1232	AC_PATH_PROG(FCCACHE, fc-cache)
1233	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
1234	if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then
1235		RUN_FCCACHE="${FCCACHE_WARN}"
1236	else
1237		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
1238		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
1239	fi
1240	AC_SUBST([RUN_FCCACHE])
1241])
1242
1243# XORG_FONT_MKFONTDIR()
1244# -------------------
1245# Minimum version: 1.3.0
1246#
1247# Set MKFONTDIR to path to mkfontdir.
1248#
1249# If cross-compiling, and if mkdir is not found, use a shell command
1250# which warns mkfontdir needs to be run on the target
1251#
1252# If not cross-compiling, mkfontdir must be found
1253#
1254AC_DEFUN([XORG_FONT_MKFONTDIR],[
1255	if test x"$cross_compiling" != x"no" ; then
1256		AC_PATH_PROG(MKFONTDIR, mkfontdir, "")
1257		MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run mkfontdir manually on host system"'
1258
1259		if test x"$MKFONTDIR" = x; then
1260			MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'"
1261		fi
1262	else
1263		XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
1264	fi
1265
1266	AC_SUBST([MKFONTDIR])
1267])
1268
1269# XORG_FONT_COMMON_UTILS()
1270# ------------------------
1271# Minimum version: 1.1.0
1272#
1273# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
1274
1275AC_DEFUN([XORG_FONT_COMMON_UTILS],[
1276	XORG_FONT_FCCACHE
1277	XORG_FONT_MKFONTDIR
1278])
1279
1280# XORG_FONT_SCALED_UTILS()
1281# ------------------------
1282# Minimum version: 1.1.0
1283#
1284# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
1285# (TrueType, OpenType, Type1)
1286
1287AC_DEFUN([XORG_FONT_SCALED_UTILS],[
1288	XORG_FONT_COMMON_UTILS
1289	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
1290])
1291
1292# XORG_FONT_BDF_UTILS()
1293# ---------------------
1294# Minimum version: 1.1.0
1295#
1296# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
1297# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
1298# PCF output files created by bdftopcf
1299
1300AC_DEFUN([XORG_FONT_BDF_UTILS],[
1301	XORG_FONT_COMMON_UTILS
1302	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
1303	XORG_FONT_CHECK_COMPRESSION
1304])
1305
1306# XORG_FONT_CHECK_COMPRESSION()
1307# -----------------------------
1308# Minimum version: 1.1.0
1309#
1310# Offer a --with-compression flag to control what compression method is
1311# used for pcf font files.   Offers all the methods currently supported
1312# by libXfont, including no compression.
1313#
1314# If COMPRESS_FLAGS is not set, and the compression method has flags needed
1315# for reproducible builds, such as gzip -n to not record timestamp, will
1316# set COMPRESS_FLAGS to those options.
1317
1318AC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
1319	AC_MSG_CHECKING([font compression method])
1320	AC_ARG_WITH(compression,
1321	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
1322			 [compression method to use on pcf fonts])],
1323         [compression="$withval"], [compression="yes"])
1324	if test x"$compression" = "xyes" ; then
1325		compression="gzip"
1326	fi
1327	AC_MSG_RESULT([${compression}])
1328	case ${compression} in
1329	 *compress)	COMPRESS_SUFFIX=".Z" ;;
1330	 *gzip)		COMPRESS_SUFFIX=".gz" ;
1331			COMPRESS_FLAGS="${COMPRESS_FLAGS--n}" ;;
1332	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
1333	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
1334	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
1335	esac
1336	if test x"$COMPRESS_SUFFIX" != "x" ; then
1337	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
1338	fi
1339	AC_MSG_CHECKING([options to font compression command])
1340	AC_MSG_RESULT([${COMPRESS_FLAGS:-none}])
1341	AC_SUBST([COMPRESS_FLAGS])
1342	AC_SUBST([COMPRESS_SUFFIX])
1343])
1344
1345# XORG_FONT_UCS2ANY()
1346# -------------------
1347# Minimum version: 1.1.0
1348#
1349# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
1350# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
1351# Also call pkg-config to find the directory with the encoding files needed
1352# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
1353
1354AC_DEFUN([XORG_FONT_UCS2ANY],[
1355	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1356	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
1357	PKG_CHECK_MODULES(MAPS, [fontutil])
1358	AC_MSG_CHECKING([for ucs2any encoding data files])
1359	MAPFILES_PATH=`$PKG_CONFIG --variable=mapdir fontutil`
1360	AC_SUBST(MAPFILES_PATH)
1361	AC_MSG_RESULT([${MAPFILES_PATH}])
1362])
1363
1364
1365
1366# XORG_FONT_FC_CONFDIR()
1367# --------------------
1368# Minimum version: 1.2.0
1369#
1370# Sets FC_CONFDIR to the fontconfig config directory
1371# (which should be --with-confdir=... when building fontconfig)
1372# found from:
1373#	--with-fc-confdir=...
1374#	pkg-config --variable=confdir fontconfig
1375#	${sysconfdir}/fonts
1376
1377AC_DEFUN([XORG_FONT_FC_CONFDIR],[
1378	dnl Ensure $PKG_CONFIG is set first
1379	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1380
1381	AC_MSG_CHECKING([for fontconfig's configuration directory])
1382	AC_ARG_WITH(fc-confdir,
1383		    AS_HELP_STRING([--with-fc-confdir=DIR],
1384			   [Path to fontconfig's configuration directory]),
1385		    [FC_CONFDIR="$withval"])
1386	# if --with-fc-confdir was not specified
1387	if test "x${FC_CONFDIR}" = "x"; then
1388		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
1389	fi
1390	# ...and if pkg-config didn't find confdir in fontconfig.pc...
1391	if test "x${FC_CONFDIR}" = "x"; then
1392		FC_CONFDIR="${sysconfdir}/fonts"
1393	fi
1394	AC_SUBST(FC_CONFDIR)
1395	AC_MSG_RESULT([${FC_CONFDIR}])
1396])
1397
1398
1399
1400# XORG_FONTROOTDIR()
1401# --------------------
1402# Minimum version: 1.1.0
1403#
1404# Sets FONTROOTDIR to the root directory for font files.  Uses the first
1405# found from:
1406#	--with-fontrootdir
1407#	pkg-config --variable=fontrootdir fontutil
1408#	${datadir}/fonts/X11
1409
1410AC_DEFUN([XORG_FONTROOTDIR],[
1411	dnl Ensure $PKG_CONFIG is set first
1412	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1413
1414	AC_MSG_CHECKING([for root directory for font files])
1415	AC_ARG_WITH(fontrootdir,
1416		    AS_HELP_STRING([--with-fontrootdir=DIR],
1417			   [Path to root directory for font files]),
1418		    [FONTROOTDIR="$withval"])
1419	# if --with-fontrootdir not specified...
1420	if test "x${FONTROOTDIR}" = "x"; then
1421		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
1422	fi
1423	# ...and if pkg-config didn't find fontdir in fontutil.pc...
1424	if test "x${FONTROOTDIR}" = "x"; then
1425		FONTROOTDIR="${datadir}/fonts/X11"
1426	fi
1427	AC_SUBST(FONTROOTDIR)
1428	AC_MSG_RESULT([${FONTROOTDIR}])
1429])
1430
1431# XORG_FONTSUBDIR(variable, flag, subdir)
1432# ---------------------------------------
1433# Minimum version: 1.1.0
1434#
1435# Offer a --with-<flag> flag to control directory for font installation
1436# Default is the specified <subdir> of the font root directory.
1437# Sets <variable> to the selected directory
1438
1439AC_DEFUN([XORG_FONTSUBDIR],[
1440	AC_REQUIRE([XORG_FONTROOTDIR])
1441
1442	AC_MSG_CHECKING([for directory for $3 files])
1443	AC_ARG_WITH($2,
1444		    [AS_HELP_STRING([--with-$2=DIR],
1445				    [Path to $3 files [FONTROOTDIR/$3]])],
1446		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
1447	AC_SUBST($1)
1448	AC_MSG_RESULT([${$1}])
1449]) # XORG_FONTSUBDIR
1450
1451# XORG_FONTDIR(subdir)
1452# --------------------
1453# Minimum version: 1.1.0
1454#
1455# Offer a --with-fontdir flag to control directory for font installation
1456# Default is the specified subdir of the font root directory.
1457# Sets FONTDIR to the selected directory
1458
1459AC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
1460
1461dnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1462dnl
1463dnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
1464dnl
1465dnl Permission is hereby granted, free of charge, to any person obtaining a
1466dnl copy of this software and associated documentation files (the "Software"),
1467dnl to deal in the Software without restriction, including without limitation
1468dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1469dnl and/or sell copies of the Software, and to permit persons to whom the
1470dnl Software is furnished to do so, subject to the following conditions:
1471dnl
1472dnl The above copyright notice and this permission notice (including the next
1473dnl paragraph) shall be included in all copies or substantial portions of the
1474dnl Software.
1475dnl
1476dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1477dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1478dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1479dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1480dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1481dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1482dnl DEALINGS IN THE SOFTWARE.
1483
1484# XORG_MACROS_VERSION(required-version)
1485# -------------------------------------
1486# Minimum version: 1.1.0
1487#
1488# If you're using a macro added in Version 1.1 or newer, include this in
1489# your configure.ac with the minimum required version, such as:
1490# XORG_MACROS_VERSION(1.1)
1491#
1492# To ensure that this macro is defined, also add:
1493# m4_ifndef([XORG_MACROS_VERSION],
1494#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1495#
1496#
1497# See the "minimum version" comment for each macro you use to see what
1498# version you require.
1499m4_defun([XORG_MACROS_VERSION],[
1500m4_define([vers_have], [1.20.0])
1501m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1502m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1503m4_if(m4_cmp(maj_have, maj_needed), 0,,
1504    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1505m4_if(m4_version_compare(vers_have, [$1]), -1,
1506    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1507m4_undefine([vers_have])
1508m4_undefine([maj_have])
1509m4_undefine([maj_needed])
1510]) # XORG_MACROS_VERSION
1511
1512# XORG_PROG_RAWCPP()
1513# ------------------
1514# Minimum version: 1.0.0
1515#
1516# Find cpp program and necessary flags for use in pre-processing text files
1517# such as man pages and config files
1518AC_DEFUN([XORG_PROG_RAWCPP],[
1519AC_REQUIRE([AC_PROG_CPP])
1520AC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1521   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1522
1523# Check for flag to avoid builtin definitions - assumes unix is predefined,
1524# which is not the best choice for supporting other OS'es, but covers most
1525# of the ones we need for now.
1526AC_MSG_CHECKING([if $RAWCPP requires -undef])
1527AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1528if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1529	AC_MSG_RESULT([no])
1530else
1531	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1532		RAWCPPFLAGS=-undef
1533		AC_MSG_RESULT([yes])
1534	# under Cygwin unix is still defined even with -undef
1535	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1536		RAWCPPFLAGS="-undef -ansi"
1537		AC_MSG_RESULT([yes, with -ansi])
1538	else
1539		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1540	fi
1541fi
1542rm -f conftest.$ac_ext
1543
1544AC_MSG_CHECKING([if $RAWCPP requires -traditional])
1545AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1546if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1547	AC_MSG_RESULT([no])
1548else
1549	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1550		TRADITIONALCPPFLAGS="-traditional"
1551		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1552		AC_MSG_RESULT([yes])
1553	else
1554		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1555	fi
1556fi
1557rm -f conftest.$ac_ext
1558AC_SUBST(RAWCPPFLAGS)
1559AC_SUBST(TRADITIONALCPPFLAGS)
1560]) # XORG_PROG_RAWCPP
1561
1562# XORG_MANPAGE_SECTIONS()
1563# -----------------------
1564# Minimum version: 1.0.0
1565#
1566# Determine which sections man pages go in for the different man page types
1567# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1568# Not sure if there's any better way than just hardcoding by OS name.
1569# Override default settings by setting environment variables
1570# Added MAN_SUBSTS in version 1.8
1571# Added AC_PROG_SED in version 1.8
1572
1573AC_DEFUN([XORG_MANPAGE_SECTIONS],[
1574AC_REQUIRE([AC_CANONICAL_HOST])
1575AC_REQUIRE([AC_PROG_SED])
1576
1577case $host_os in
1578    solaris*)
1579        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1580        # check for a man page file found in later versions that use
1581        # traditional section numbers instead
1582        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1583                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1584        ;;
1585    *) SYSV_MAN_SECTIONS=false ;;
1586esac
1587
1588if test x$APP_MAN_SUFFIX = x    ; then
1589    APP_MAN_SUFFIX=1
1590fi
1591if test x$APP_MAN_DIR = x    ; then
1592    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1593fi
1594
1595if test x$LIB_MAN_SUFFIX = x    ; then
1596    LIB_MAN_SUFFIX=3
1597fi
1598if test x$LIB_MAN_DIR = x    ; then
1599    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1600fi
1601
1602if test x$FILE_MAN_SUFFIX = x    ; then
1603    case $SYSV_MAN_SECTIONS in
1604	true)				FILE_MAN_SUFFIX=4  ;;
1605	*)				FILE_MAN_SUFFIX=5  ;;
1606    esac
1607fi
1608if test x$FILE_MAN_DIR = x    ; then
1609    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1610fi
1611
1612if test x$MISC_MAN_SUFFIX = x    ; then
1613    case $SYSV_MAN_SECTIONS in
1614	true)				MISC_MAN_SUFFIX=5  ;;
1615	*)				MISC_MAN_SUFFIX=7  ;;
1616    esac
1617fi
1618if test x$MISC_MAN_DIR = x    ; then
1619    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1620fi
1621
1622if test x$DRIVER_MAN_SUFFIX = x    ; then
1623    case $SYSV_MAN_SECTIONS in
1624	true)				DRIVER_MAN_SUFFIX=7  ;;
1625	*)				DRIVER_MAN_SUFFIX=4  ;;
1626    esac
1627fi
1628if test x$DRIVER_MAN_DIR = x    ; then
1629    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1630fi
1631
1632if test x$ADMIN_MAN_SUFFIX = x    ; then
1633    case $SYSV_MAN_SECTIONS in
1634	true)				ADMIN_MAN_SUFFIX=1m ;;
1635	*)				ADMIN_MAN_SUFFIX=8  ;;
1636    esac
1637fi
1638if test x$ADMIN_MAN_DIR = x    ; then
1639    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1640fi
1641
1642
1643AC_SUBST([APP_MAN_SUFFIX])
1644AC_SUBST([LIB_MAN_SUFFIX])
1645AC_SUBST([FILE_MAN_SUFFIX])
1646AC_SUBST([MISC_MAN_SUFFIX])
1647AC_SUBST([DRIVER_MAN_SUFFIX])
1648AC_SUBST([ADMIN_MAN_SUFFIX])
1649AC_SUBST([APP_MAN_DIR])
1650AC_SUBST([LIB_MAN_DIR])
1651AC_SUBST([FILE_MAN_DIR])
1652AC_SUBST([MISC_MAN_DIR])
1653AC_SUBST([DRIVER_MAN_DIR])
1654AC_SUBST([ADMIN_MAN_DIR])
1655
1656XORG_MAN_PAGE="X Version 11"
1657AC_SUBST([XORG_MAN_PAGE])
1658MAN_SUBSTS="\
1659	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1660	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1661	-e 's|__xservername__|Xorg|g' \
1662	-e 's|__xconfigfile__|xorg.conf|g' \
1663	-e 's|__projectroot__|\$(prefix)|g' \
1664	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1665	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1666	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1667	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1668	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1669	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1670	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1671AC_SUBST([MAN_SUBSTS])
1672
1673]) # XORG_MANPAGE_SECTIONS
1674
1675# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1676# ------------------------
1677# Minimum version: 1.7.0
1678#
1679# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1680# provided by xorg-sgml-doctools, if installed.
1681AC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1682AC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1683XORG_SGML_PATH=
1684PKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1685    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1686    [m4_ifval([$1],[:],
1687        [if test x"$cross_compiling" != x"yes" ; then
1688            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1689                          [XORG_SGML_PATH=$prefix/share/sgml])
1690         fi])
1691    ])
1692
1693# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1694# the path and the name of the doc stylesheet
1695if test "x$XORG_SGML_PATH" != "x" ; then
1696   AC_MSG_RESULT([$XORG_SGML_PATH])
1697   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1698   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1699else
1700   AC_MSG_RESULT([no])
1701fi
1702
1703AC_SUBST(XORG_SGML_PATH)
1704AC_SUBST(STYLESHEET_SRCDIR)
1705AC_SUBST(XSL_STYLESHEET)
1706AM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1707]) # XORG_CHECK_SGML_DOCTOOLS
1708
1709# XORG_CHECK_LINUXDOC
1710# -------------------
1711# Minimum version: 1.0.0
1712#
1713# Defines the variable MAKE_TEXT if the necessary tools and
1714# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1715# Whether or not the necessary tools and files are found can be checked
1716# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1717AC_DEFUN([XORG_CHECK_LINUXDOC],[
1718AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1719AC_REQUIRE([XORG_WITH_PS2PDF])
1720
1721AC_PATH_PROG(LINUXDOC, linuxdoc)
1722
1723AC_MSG_CHECKING([whether to build documentation])
1724
1725if test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1726   BUILDDOC=yes
1727else
1728   BUILDDOC=no
1729fi
1730
1731AM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1732
1733AC_MSG_RESULT([$BUILDDOC])
1734
1735AC_MSG_CHECKING([whether to build pdf documentation])
1736
1737if test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1738   BUILDPDFDOC=yes
1739else
1740   BUILDPDFDOC=no
1741fi
1742
1743AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1744
1745AC_MSG_RESULT([$BUILDPDFDOC])
1746
1747MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1748MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1749MAKE_PDF="$PS2PDF"
1750MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1751
1752AC_SUBST(MAKE_TEXT)
1753AC_SUBST(MAKE_PS)
1754AC_SUBST(MAKE_PDF)
1755AC_SUBST(MAKE_HTML)
1756]) # XORG_CHECK_LINUXDOC
1757
1758# XORG_CHECK_DOCBOOK
1759# -------------------
1760# Minimum version: 1.0.0
1761#
1762# Checks for the ability to build output formats from SGML DocBook source.
1763# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1764# indicates whether the necessary tools and files are found and, if set,
1765# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1766AC_DEFUN([XORG_CHECK_DOCBOOK],[
1767AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1768
1769BUILDTXTDOC=no
1770BUILDPDFDOC=no
1771BUILDPSDOC=no
1772BUILDHTMLDOC=no
1773
1774AC_PATH_PROG(DOCBOOKPS, docbook2ps)
1775AC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1776AC_PATH_PROG(DOCBOOKHTML, docbook2html)
1777AC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1778
1779AC_MSG_CHECKING([whether to build text documentation])
1780if test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1781   test x$BUILD_TXTDOC != xno; then
1782	BUILDTXTDOC=yes
1783fi
1784AM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1785AC_MSG_RESULT([$BUILDTXTDOC])
1786
1787AC_MSG_CHECKING([whether to build PDF documentation])
1788if test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1789   test x$BUILD_PDFDOC != xno; then
1790	BUILDPDFDOC=yes
1791fi
1792AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1793AC_MSG_RESULT([$BUILDPDFDOC])
1794
1795AC_MSG_CHECKING([whether to build PostScript documentation])
1796if test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1797   test x$BUILD_PSDOC != xno; then
1798	BUILDPSDOC=yes
1799fi
1800AM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1801AC_MSG_RESULT([$BUILDPSDOC])
1802
1803AC_MSG_CHECKING([whether to build HTML documentation])
1804if test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1805   test x$BUILD_HTMLDOC != xno; then
1806	BUILDHTMLDOC=yes
1807fi
1808AM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1809AC_MSG_RESULT([$BUILDHTMLDOC])
1810
1811MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1812MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1813MAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1814MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1815
1816AC_SUBST(MAKE_TEXT)
1817AC_SUBST(MAKE_PS)
1818AC_SUBST(MAKE_PDF)
1819AC_SUBST(MAKE_HTML)
1820]) # XORG_CHECK_DOCBOOK
1821
1822# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1823# ----------------
1824# Minimum version: 1.5.0
1825# Minimum version for optional DEFAULT argument: 1.11.0
1826#
1827# Documentation tools are not always available on all platforms and sometimes
1828# not at the appropriate level. This macro enables a module to test for the
1829# presence of the tool and obtain it's path in separate variables. Coupled with
1830# the --with-xmlto option, it allows maximum flexibility in making decisions
1831# as whether or not to use the xmlto package. When DEFAULT is not specified,
1832# --with-xmlto assumes 'auto'.
1833#
1834# Interface to module:
1835# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1836# XMLTO:	returns the path of the xmlto program found
1837#		returns the path set by the user in the environment
1838# --with-xmlto:	'yes' user instructs the module to use xmlto
1839#		'no' user instructs the module not to use xmlto
1840#
1841# Added in version 1.10.0
1842# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1843#                  xmlto for text output requires either lynx, links, or w3m browsers
1844#
1845# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1846#
1847AC_DEFUN([XORG_WITH_XMLTO],[
1848AC_ARG_VAR([XMLTO], [Path to xmlto command])
1849m4_define([_defopt], m4_default([$2], [auto]))
1850AC_ARG_WITH(xmlto,
1851	AS_HELP_STRING([--with-xmlto],
1852	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1853	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1854m4_undefine([_defopt])
1855
1856if test "x$use_xmlto" = x"auto"; then
1857   AC_PATH_PROG([XMLTO], [xmlto])
1858   if test "x$XMLTO" = "x"; then
1859        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1860	have_xmlto=no
1861   else
1862        have_xmlto=yes
1863   fi
1864elif test "x$use_xmlto" = x"yes" ; then
1865   AC_PATH_PROG([XMLTO], [xmlto])
1866   if test "x$XMLTO" = "x"; then
1867        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1868   fi
1869   have_xmlto=yes
1870elif test "x$use_xmlto" = x"no" ; then
1871   if test "x$XMLTO" != "x"; then
1872      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1873   fi
1874   have_xmlto=no
1875else
1876   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1877fi
1878
1879# Test for a minimum version of xmlto, if provided.
1880m4_ifval([$1],
1881[if test "$have_xmlto" = yes; then
1882    # scrape the xmlto version
1883    AC_MSG_CHECKING([the xmlto version])
1884    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1885    AC_MSG_RESULT([$xmlto_version])
1886    AS_VERSION_COMPARE([$xmlto_version], [$1],
1887        [if test "x$use_xmlto" = xauto; then
1888            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1889            have_xmlto=no
1890        else
1891            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1892        fi])
1893fi])
1894
1895# Test for the ability of xmlto to generate a text target
1896#
1897# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
1898# following test for empty XML docbook files.
1899# For compatibility reasons use the following empty XML docbook file and if
1900# it fails try it again with a non-empty XML file.
1901have_xmlto_text=no
1902cat > conftest.xml << "EOF"
1903EOF
1904AS_IF([test "$have_xmlto" = yes],
1905      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1906             [have_xmlto_text=yes],
1907             [# Try it again with a non-empty XML file.
1908              cat > conftest.xml << "EOF"
1909<x></x>
1910EOF
1911              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1912                    [have_xmlto_text=yes],
1913                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
1914rm -f conftest.xml
1915AM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1916AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1917]) # XORG_WITH_XMLTO
1918
1919# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1920# --------------------------------------------
1921# Minimum version: 1.12.0
1922# Minimum version for optional DEFAULT argument: 1.12.0
1923#
1924# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1925# XML-based language used for the transformation of XML documents.
1926# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1927# It is used under the cover by xmlto to generate html files from DocBook/XML.
1928# The XSLT processor is often used as a standalone tool for transformations.
1929# It should not be assumed that this tool is used only to work with documnetation.
1930# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1931#
1932# Interface to module:
1933# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1934# XSLTPROC:	 returns the path of the xsltproc program found
1935#		 returns the path set by the user in the environment
1936# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1937#		  'no' user instructs the module not to use xsltproc
1938# have_xsltproc: returns yes if xsltproc found in PATH or no
1939#
1940# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1941#
1942AC_DEFUN([XORG_WITH_XSLTPROC],[
1943AC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1944# Preserves the interface, should it be implemented later
1945m4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1946m4_define([_defopt], m4_default([$2], [auto]))
1947AC_ARG_WITH(xsltproc,
1948	AS_HELP_STRING([--with-xsltproc],
1949	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1950	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1951m4_undefine([_defopt])
1952
1953if test "x$use_xsltproc" = x"auto"; then
1954   AC_PATH_PROG([XSLTPROC], [xsltproc])
1955   if test "x$XSLTPROC" = "x"; then
1956        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1957	have_xsltproc=no
1958   else
1959        have_xsltproc=yes
1960   fi
1961elif test "x$use_xsltproc" = x"yes" ; then
1962   AC_PATH_PROG([XSLTPROC], [xsltproc])
1963   if test "x$XSLTPROC" = "x"; then
1964        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1965   fi
1966   have_xsltproc=yes
1967elif test "x$use_xsltproc" = x"no" ; then
1968   if test "x$XSLTPROC" != "x"; then
1969      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1970   fi
1971   have_xsltproc=no
1972else
1973   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1974fi
1975
1976AM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1977]) # XORG_WITH_XSLTPROC
1978
1979# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1980# ----------------------------------------
1981# Minimum version: 1.15.0
1982#
1983# PERL (Practical Extraction and Report Language) is a language optimized for
1984# scanning arbitrary text files, extracting information from those text files,
1985# and printing reports based on that information.
1986#
1987# When DEFAULT is not specified, --with-perl assumes 'auto'.
1988#
1989# Interface to module:
1990# HAVE_PERL: used in makefiles to conditionally scan text files
1991# PERL:	     returns the path of the perl program found
1992#	     returns the path set by the user in the environment
1993# --with-perl: 'yes' user instructs the module to use perl
1994#	       'no' user instructs the module not to use perl
1995# have_perl: returns yes if perl found in PATH or no
1996#
1997# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1998#
1999AC_DEFUN([XORG_WITH_PERL],[
2000AC_ARG_VAR([PERL], [Path to perl command])
2001# Preserves the interface, should it be implemented later
2002m4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
2003m4_define([_defopt], m4_default([$2], [auto]))
2004AC_ARG_WITH(perl,
2005	AS_HELP_STRING([--with-perl],
2006	   [Use perl for extracting information from files (default: ]_defopt[)]),
2007	   [use_perl=$withval], [use_perl=]_defopt)
2008m4_undefine([_defopt])
2009
2010if test "x$use_perl" = x"auto"; then
2011   AC_PATH_PROG([PERL], [perl])
2012   if test "x$PERL" = "x"; then
2013        AC_MSG_WARN([perl not found - cannot extract information and report])
2014	have_perl=no
2015   else
2016        have_perl=yes
2017   fi
2018elif test "x$use_perl" = x"yes" ; then
2019   AC_PATH_PROG([PERL], [perl])
2020   if test "x$PERL" = "x"; then
2021        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
2022   fi
2023   have_perl=yes
2024elif test "x$use_perl" = x"no" ; then
2025   if test "x$PERL" != "x"; then
2026      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
2027   fi
2028   have_perl=no
2029else
2030   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
2031fi
2032
2033AM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2034]) # XORG_WITH_PERL
2035
2036# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2037# ----------------
2038# Minimum version: 1.5.0
2039# Minimum version for optional DEFAULT argument: 1.11.0
2040#
2041# Documentation tools are not always available on all platforms and sometimes
2042# not at the appropriate level. This macro enables a module to test for the
2043# presence of the tool and obtain it's path in separate variables. Coupled with
2044# the --with-asciidoc option, it allows maximum flexibility in making decisions
2045# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2046# --with-asciidoc assumes 'auto'.
2047#
2048# Interface to module:
2049# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2050# ASCIIDOC:	 returns the path of the asciidoc program found
2051#		 returns the path set by the user in the environment
2052# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2053#		  'no' user instructs the module not to use asciidoc
2054#
2055# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2056#
2057AC_DEFUN([XORG_WITH_ASCIIDOC],[
2058AC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2059m4_define([_defopt], m4_default([$2], [auto]))
2060AC_ARG_WITH(asciidoc,
2061	AS_HELP_STRING([--with-asciidoc],
2062	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2063	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2064m4_undefine([_defopt])
2065
2066if test "x$use_asciidoc" = x"auto"; then
2067   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2068   if test "x$ASCIIDOC" = "x"; then
2069        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2070	have_asciidoc=no
2071   else
2072        have_asciidoc=yes
2073   fi
2074elif test "x$use_asciidoc" = x"yes" ; then
2075   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2076   if test "x$ASCIIDOC" = "x"; then
2077        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2078   fi
2079   have_asciidoc=yes
2080elif test "x$use_asciidoc" = x"no" ; then
2081   if test "x$ASCIIDOC" != "x"; then
2082      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2083   fi
2084   have_asciidoc=no
2085else
2086   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2087fi
2088m4_ifval([$1],
2089[if test "$have_asciidoc" = yes; then
2090    # scrape the asciidoc version
2091    AC_MSG_CHECKING([the asciidoc version])
2092    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2093    AC_MSG_RESULT([$asciidoc_version])
2094    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2095        [if test "x$use_asciidoc" = xauto; then
2096            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2097            have_asciidoc=no
2098        else
2099            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2100        fi])
2101fi])
2102AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2103]) # XORG_WITH_ASCIIDOC
2104
2105# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
2106# -------------------------------------------
2107# Minimum version: 1.5.0
2108# Minimum version for optional DEFAULT argument: 1.11.0
2109# Minimum version for optional DOT checking: 1.18.0
2110#
2111# Documentation tools are not always available on all platforms and sometimes
2112# not at the appropriate level. This macro enables a module to test for the
2113# presence of the tool and obtain it's path in separate variables. Coupled with
2114# the --with-doxygen option, it allows maximum flexibility in making decisions
2115# as whether or not to use the doxygen package. When DEFAULT is not specified,
2116# --with-doxygen assumes 'auto'.
2117#
2118# Interface to module:
2119# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2120# DOXYGEN:	 returns the path of the doxygen program found
2121#		 returns the path set by the user in the environment
2122# --with-doxygen: 'yes' user instructs the module to use doxygen
2123#		  'no' user instructs the module not to use doxygen
2124#
2125# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2126#
2127AC_DEFUN([XORG_WITH_DOXYGEN],[
2128AC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2129AC_ARG_VAR([DOT], [Path to the dot graphics utility])
2130m4_define([_defopt], m4_default([$2], [auto]))
2131AC_ARG_WITH(doxygen,
2132	AS_HELP_STRING([--with-doxygen],
2133	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2134	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2135m4_undefine([_defopt])
2136
2137if test "x$use_doxygen" = x"auto"; then
2138   AC_PATH_PROG([DOXYGEN], [doxygen])
2139   if test "x$DOXYGEN" = "x"; then
2140        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2141	have_doxygen=no
2142   else
2143        have_doxygen=yes
2144   fi
2145elif test "x$use_doxygen" = x"yes" ; then
2146   AC_PATH_PROG([DOXYGEN], [doxygen])
2147   if test "x$DOXYGEN" = "x"; then
2148        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2149   fi
2150   have_doxygen=yes
2151elif test "x$use_doxygen" = x"no" ; then
2152   if test "x$DOXYGEN" != "x"; then
2153      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2154   fi
2155   have_doxygen=no
2156else
2157   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2158fi
2159m4_ifval([$1],
2160[if test "$have_doxygen" = yes; then
2161    # scrape the doxygen version
2162    AC_MSG_CHECKING([the doxygen version])
2163    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2164    AC_MSG_RESULT([$doxygen_version])
2165    AS_VERSION_COMPARE([$doxygen_version], [$1],
2166        [if test "x$use_doxygen" = xauto; then
2167            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2168            have_doxygen=no
2169        else
2170            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2171        fi])
2172fi])
2173
2174dnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2175dnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2176dnl 	HAVE_DOT = @HAVE_DOT@
2177HAVE_DOT=no
2178if test "x$have_doxygen" = "xyes"; then
2179  AC_PATH_PROG([DOT], [dot])
2180    if test "x$DOT" != "x"; then
2181      HAVE_DOT=yes
2182    fi
2183fi
2184
2185AC_SUBST([HAVE_DOT])
2186AM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2187AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2188]) # XORG_WITH_DOXYGEN
2189
2190# XORG_WITH_GROFF([DEFAULT])
2191# ----------------
2192# Minimum version: 1.6.0
2193# Minimum version for optional DEFAULT argument: 1.11.0
2194#
2195# Documentation tools are not always available on all platforms and sometimes
2196# not at the appropriate level. This macro enables a module to test for the
2197# presence of the tool and obtain it's path in separate variables. Coupled with
2198# the --with-groff option, it allows maximum flexibility in making decisions
2199# as whether or not to use the groff package. When DEFAULT is not specified,
2200# --with-groff assumes 'auto'.
2201#
2202# Interface to module:
2203# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2204# HAVE_GROFF_MM: the memorandum macros (-mm) package
2205# HAVE_GROFF_MS: the -ms macros package
2206# GROFF:	 returns the path of the groff program found
2207#		 returns the path set by the user in the environment
2208# --with-groff:	 'yes' user instructs the module to use groff
2209#		 'no' user instructs the module not to use groff
2210#
2211# Added in version 1.9.0:
2212# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2213#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2214#		   psselect from the psutils package.
2215#		   the ghostcript package. Refer to the grohtml man pages
2216#
2217# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2218#
2219# OS and distros often splits groff in a basic and full package, the former
2220# having the groff program and the later having devices, fonts and macros
2221# Checking for the groff executable is not enough.
2222#
2223# If macros are missing, we cannot assume that groff is useless, so we don't
2224# unset HAVE_GROFF or GROFF env variables.
2225# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2226#
2227AC_DEFUN([XORG_WITH_GROFF],[
2228AC_ARG_VAR([GROFF], [Path to groff command])
2229m4_define([_defopt], m4_default([$1], [auto]))
2230AC_ARG_WITH(groff,
2231	AS_HELP_STRING([--with-groff],
2232	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2233	   [use_groff=$withval], [use_groff=]_defopt)
2234m4_undefine([_defopt])
2235
2236if test "x$use_groff" = x"auto"; then
2237   AC_PATH_PROG([GROFF], [groff])
2238   if test "x$GROFF" = "x"; then
2239        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2240	have_groff=no
2241   else
2242        have_groff=yes
2243   fi
2244elif test "x$use_groff" = x"yes" ; then
2245   AC_PATH_PROG([GROFF], [groff])
2246   if test "x$GROFF" = "x"; then
2247        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2248   fi
2249   have_groff=yes
2250elif test "x$use_groff" = x"no" ; then
2251   if test "x$GROFF" != "x"; then
2252      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2253   fi
2254   have_groff=no
2255else
2256   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2257fi
2258
2259# We have groff, test for the presence of the macro packages
2260if test "x$have_groff" = x"yes"; then
2261    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2262    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2263        groff_ms_works=yes
2264    else
2265        groff_ms_works=no
2266    fi
2267    AC_MSG_RESULT([$groff_ms_works])
2268    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2269    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2270        groff_mm_works=yes
2271    else
2272        groff_mm_works=no
2273    fi
2274    AC_MSG_RESULT([$groff_mm_works])
2275fi
2276
2277# We have groff, test for HTML dependencies, one command per package
2278if test "x$have_groff" = x"yes"; then
2279   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2280   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2281   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2282   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2283      have_groff_html=yes
2284   else
2285      have_groff_html=no
2286      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2287   fi
2288fi
2289
2290# Set Automake conditionals for Makefiles
2291AM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2292AM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2293AM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2294AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2295]) # XORG_WITH_GROFF
2296
2297# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2298# ---------------------------------------
2299# Minimum version: 1.6.0
2300# Minimum version for optional DEFAULT argument: 1.11.0
2301# Minimum version for optional MIN-VERSION argument: 1.15.0
2302#
2303# Documentation tools are not always available on all platforms and sometimes
2304# not at the appropriate level. This macro enables a module to test for the
2305# presence of the tool and obtain it's path in separate variables. Coupled with
2306# the --with-fop option, it allows maximum flexibility in making decisions
2307# as whether or not to use the fop package. When DEFAULT is not specified,
2308# --with-fop assumes 'auto'.
2309#
2310# Interface to module:
2311# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2312# FOP:	 	returns the path of the fop program found
2313#		returns the path set by the user in the environment
2314# --with-fop: 	'yes' user instructs the module to use fop
2315#		'no' user instructs the module not to use fop
2316#
2317# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2318#
2319AC_DEFUN([XORG_WITH_FOP],[
2320AC_ARG_VAR([FOP], [Path to fop command])
2321m4_define([_defopt], m4_default([$2], [auto]))
2322AC_ARG_WITH(fop,
2323	AS_HELP_STRING([--with-fop],
2324	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2325	   [use_fop=$withval], [use_fop=]_defopt)
2326m4_undefine([_defopt])
2327
2328if test "x$use_fop" = x"auto"; then
2329   AC_PATH_PROG([FOP], [fop])
2330   if test "x$FOP" = "x"; then
2331        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2332	have_fop=no
2333   else
2334        have_fop=yes
2335   fi
2336elif test "x$use_fop" = x"yes" ; then
2337   AC_PATH_PROG([FOP], [fop])
2338   if test "x$FOP" = "x"; then
2339        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2340   fi
2341   have_fop=yes
2342elif test "x$use_fop" = x"no" ; then
2343   if test "x$FOP" != "x"; then
2344      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2345   fi
2346   have_fop=no
2347else
2348   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2349fi
2350
2351# Test for a minimum version of fop, if provided.
2352m4_ifval([$1],
2353[if test "$have_fop" = yes; then
2354    # scrape the fop version
2355    AC_MSG_CHECKING([for fop minimum version])
2356    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2357    AC_MSG_RESULT([$fop_version])
2358    AS_VERSION_COMPARE([$fop_version], [$1],
2359        [if test "x$use_fop" = xauto; then
2360            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2361            have_fop=no
2362        else
2363            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2364        fi])
2365fi])
2366AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2367]) # XORG_WITH_FOP
2368
2369# XORG_WITH_M4([MIN-VERSION])
2370# ---------------------------
2371# Minimum version: 1.19.0
2372#
2373# This macro attempts to locate an m4 macro processor which supports
2374# -I option and is only useful for modules relying on M4 in order to
2375# expand macros in source code files.
2376#
2377# Interface to module:
2378# M4:	 	returns the path of the m4 program found
2379#		returns the path set by the user in the environment
2380#
2381AC_DEFUN([XORG_WITH_M4], [
2382AC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2383   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2384       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2385         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2386   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2387   [$PATH:/usr/gnu/bin])])
2388
2389AC_SUBST([M4], [$ac_cv_path_M4])
2390]) # XORG_WITH_M4
2391
2392# XORG_WITH_PS2PDF([DEFAULT])
2393# ----------------
2394# Minimum version: 1.6.0
2395# Minimum version for optional DEFAULT argument: 1.11.0
2396#
2397# Documentation tools are not always available on all platforms and sometimes
2398# not at the appropriate level. This macro enables a module to test for the
2399# presence of the tool and obtain it's path in separate variables. Coupled with
2400# the --with-ps2pdf option, it allows maximum flexibility in making decisions
2401# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2402# --with-ps2pdf assumes 'auto'.
2403#
2404# Interface to module:
2405# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2406# PS2PDF:	returns the path of the ps2pdf program found
2407#		returns the path set by the user in the environment
2408# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2409#		 'no' user instructs the module not to use ps2pdf
2410#
2411# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2412#
2413AC_DEFUN([XORG_WITH_PS2PDF],[
2414AC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2415m4_define([_defopt], m4_default([$1], [auto]))
2416AC_ARG_WITH(ps2pdf,
2417	AS_HELP_STRING([--with-ps2pdf],
2418	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2419	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2420m4_undefine([_defopt])
2421
2422if test "x$use_ps2pdf" = x"auto"; then
2423   AC_PATH_PROG([PS2PDF], [ps2pdf])
2424   if test "x$PS2PDF" = "x"; then
2425        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2426	have_ps2pdf=no
2427   else
2428        have_ps2pdf=yes
2429   fi
2430elif test "x$use_ps2pdf" = x"yes" ; then
2431   AC_PATH_PROG([PS2PDF], [ps2pdf])
2432   if test "x$PS2PDF" = "x"; then
2433        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2434   fi
2435   have_ps2pdf=yes
2436elif test "x$use_ps2pdf" = x"no" ; then
2437   if test "x$PS2PDF" != "x"; then
2438      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2439   fi
2440   have_ps2pdf=no
2441else
2442   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2443fi
2444AM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2445]) # XORG_WITH_PS2PDF
2446
2447# XORG_ENABLE_DOCS (enable_docs=yes)
2448# ----------------
2449# Minimum version: 1.6.0
2450#
2451# Documentation tools are not always available on all platforms and sometimes
2452# not at the appropriate level. This macro enables a builder to skip all
2453# documentation targets except traditional man pages.
2454# Combined with the specific tool checking macros XORG_WITH_*, it provides
2455# maximum flexibility in controlling documentation building.
2456# Refer to:
2457# XORG_WITH_XMLTO         --with-xmlto
2458# XORG_WITH_ASCIIDOC      --with-asciidoc
2459# XORG_WITH_DOXYGEN       --with-doxygen
2460# XORG_WITH_FOP           --with-fop
2461# XORG_WITH_GROFF         --with-groff
2462# XORG_WITH_PS2PDF        --with-ps2pdf
2463#
2464# Interface to module:
2465# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2466# --enable-docs: 'yes' user instructs the module to generate docs
2467#		 'no' user instructs the module not to generate docs
2468# parm1:	specify the default value, yes or no.
2469#
2470AC_DEFUN([XORG_ENABLE_DOCS],[
2471m4_define([docs_default], m4_default([$1], [yes]))
2472AC_ARG_ENABLE(docs,
2473	AS_HELP_STRING([--enable-docs],
2474	   [Enable building the documentation (default: ]docs_default[)]),
2475	   [build_docs=$enableval], [build_docs=]docs_default)
2476m4_undefine([docs_default])
2477AM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2478AC_MSG_CHECKING([whether to build documentation])
2479AC_MSG_RESULT([$build_docs])
2480]) # XORG_ENABLE_DOCS
2481
2482# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2483# ----------------
2484# Minimum version: 1.6.0
2485#
2486# This macro enables a builder to skip all developer documentation.
2487# Combined with the specific tool checking macros XORG_WITH_*, it provides
2488# maximum flexibility in controlling documentation building.
2489# Refer to:
2490# XORG_WITH_XMLTO         --with-xmlto
2491# XORG_WITH_ASCIIDOC      --with-asciidoc
2492# XORG_WITH_DOXYGEN       --with-doxygen
2493# XORG_WITH_FOP           --with-fop
2494# XORG_WITH_GROFF         --with-groff
2495# XORG_WITH_PS2PDF        --with-ps2pdf
2496#
2497# Interface to module:
2498# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2499# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2500#			'no' user instructs the module not to generate developer docs
2501# parm1:		specify the default value, yes or no.
2502#
2503AC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2504m4_define([devel_default], m4_default([$1], [yes]))
2505AC_ARG_ENABLE(devel-docs,
2506	AS_HELP_STRING([--enable-devel-docs],
2507	   [Enable building the developer documentation (default: ]devel_default[)]),
2508	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2509m4_undefine([devel_default])
2510AM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2511AC_MSG_CHECKING([whether to build developer documentation])
2512AC_MSG_RESULT([$build_devel_docs])
2513]) # XORG_ENABLE_DEVEL_DOCS
2514
2515# XORG_ENABLE_SPECS (enable_specs=yes)
2516# ----------------
2517# Minimum version: 1.6.0
2518#
2519# This macro enables a builder to skip all functional specification targets.
2520# Combined with the specific tool checking macros XORG_WITH_*, it provides
2521# maximum flexibility in controlling documentation building.
2522# Refer to:
2523# XORG_WITH_XMLTO         --with-xmlto
2524# XORG_WITH_ASCIIDOC      --with-asciidoc
2525# XORG_WITH_DOXYGEN       --with-doxygen
2526# XORG_WITH_FOP           --with-fop
2527# XORG_WITH_GROFF         --with-groff
2528# XORG_WITH_PS2PDF        --with-ps2pdf
2529#
2530# Interface to module:
2531# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2532# --enable-specs:	'yes' user instructs the module to generate specs
2533#			'no' user instructs the module not to generate specs
2534# parm1:		specify the default value, yes or no.
2535#
2536AC_DEFUN([XORG_ENABLE_SPECS],[
2537m4_define([spec_default], m4_default([$1], [yes]))
2538AC_ARG_ENABLE(specs,
2539	AS_HELP_STRING([--enable-specs],
2540	   [Enable building the specs (default: ]spec_default[)]),
2541	   [build_specs=$enableval], [build_specs=]spec_default)
2542m4_undefine([spec_default])
2543AM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2544AC_MSG_CHECKING([whether to build functional specifications])
2545AC_MSG_RESULT([$build_specs])
2546]) # XORG_ENABLE_SPECS
2547
2548# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2549# ----------------------------------------------
2550# Minimum version: 1.13.0
2551#
2552# This macro enables a builder to enable/disable unit testing
2553# It makes no assumption about the test cases implementation
2554# Test cases may or may not use Automake "Support for test suites"
2555# They may or may not use the software utility library GLib
2556#
2557# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2558# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2559# The variable enable_unit_tests is used by other macros in this file.
2560#
2561# Interface to module:
2562# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2563# enable_unit_tests:    used in configure.ac for additional configuration
2564# --enable-unit-tests:	'yes' user instructs the module to build tests
2565#			'no' user instructs the module not to build tests
2566# parm1:		specify the default value, yes or no.
2567#
2568AC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2569AC_BEFORE([$0], [XORG_WITH_GLIB])
2570AC_BEFORE([$0], [XORG_LD_WRAP])
2571AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2572m4_define([_defopt], m4_default([$1], [auto]))
2573AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2574	[Enable building unit test cases (default: ]_defopt[)]),
2575	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2576m4_undefine([_defopt])
2577AM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2578AC_MSG_CHECKING([whether to build unit test cases])
2579AC_MSG_RESULT([$enable_unit_tests])
2580]) # XORG_ENABLE_UNIT_TESTS
2581
2582# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2583# ------------------------------------------------------
2584# Minimum version: 1.17.0
2585#
2586# This macro enables a builder to enable/disable integration testing
2587# It makes no assumption about the test cases' implementation
2588# Test cases may or may not use Automake "Support for test suites"
2589#
2590# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2591# usually requires less dependencies and may be built and run under less
2592# stringent environments than integration tests.
2593#
2594# Interface to module:
2595# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2596# enable_integration_tests:   used in configure.ac for additional configuration
2597# --enable-integration-tests: 'yes' user instructs the module to build tests
2598#                             'no' user instructs the module not to build tests
2599# parm1:                      specify the default value, yes or no.
2600#
2601AC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2602AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2603m4_define([_defopt], m4_default([$1], [auto]))
2604AC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2605	[Enable building integration test cases (default: ]_defopt[)]),
2606	[enable_integration_tests=$enableval],
2607	[enable_integration_tests=]_defopt)
2608m4_undefine([_defopt])
2609AM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2610	[test "x$enable_integration_tests" != xno])
2611AC_MSG_CHECKING([whether to build unit test cases])
2612AC_MSG_RESULT([$enable_integration_tests])
2613]) # XORG_ENABLE_INTEGRATION_TESTS
2614
2615# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2616# ----------------------------------------
2617# Minimum version: 1.13.0
2618#
2619# GLib is a library which provides advanced data structures and functions.
2620# This macro enables a module to test for the presence of Glib.
2621#
2622# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2623# Otherwise the value of $enable_unit_tests is blank.
2624#
2625# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2626# test support usually requires less dependencies and may be built and run under
2627# less stringent environments than integration tests.
2628#
2629# Interface to module:
2630# HAVE_GLIB: used in makefiles to conditionally build targets
2631# with_glib: used in configure.ac to know if GLib has been found
2632# --with-glib:	'yes' user instructs the module to use glib
2633#		'no' user instructs the module not to use glib
2634#
2635AC_DEFUN([XORG_WITH_GLIB],[
2636AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2637m4_define([_defopt], m4_default([$2], [auto]))
2638AC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2639	[Use GLib library for unit testing (default: ]_defopt[)]),
2640	[with_glib=$withval], [with_glib=]_defopt)
2641m4_undefine([_defopt])
2642
2643have_glib=no
2644# Do not probe GLib if user explicitly disabled unit testing
2645if test "x$enable_unit_tests" != x"no"; then
2646  # Do not probe GLib if user explicitly disabled it
2647  if test "x$with_glib" != x"no"; then
2648    m4_ifval(
2649      [$1],
2650      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2651      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2652    )
2653  fi
2654fi
2655
2656# Not having GLib when unit testing has been explicitly requested is an error
2657if test "x$enable_unit_tests" = x"yes"; then
2658  if test "x$have_glib" = x"no"; then
2659    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2660  fi
2661fi
2662
2663# Having unit testing disabled when GLib has been explicitly requested is an error
2664if test "x$enable_unit_tests" = x"no"; then
2665  if test "x$with_glib" = x"yes"; then
2666    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2667  fi
2668fi
2669
2670# Not having GLib when it has been explicitly requested is an error
2671if test "x$with_glib" = x"yes"; then
2672  if test "x$have_glib" = x"no"; then
2673    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2674  fi
2675fi
2676
2677AM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2678]) # XORG_WITH_GLIB
2679
2680# XORG_LD_WRAP([required|optional])
2681# ---------------------------------
2682# Minimum version: 1.13.0
2683#
2684# Check if linker supports -wrap, passed via compiler flags
2685#
2686# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2687# Otherwise the value of $enable_unit_tests is blank.
2688#
2689# Argument added in 1.16.0 - default is "required", to match existing behavior
2690# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2691# available, an argument of "optional" allows use when some unit tests require
2692# ld -wrap and others do not.
2693#
2694AC_DEFUN([XORG_LD_WRAP],[
2695XORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2696    [AC_LANG_PROGRAM([#include <stdlib.h>
2697                      void __wrap_exit(int status) { return; }],
2698                     [exit(0);])])
2699# Not having ld wrap when unit testing has been explicitly requested is an error
2700if test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2701  if test "x$have_ld_wrap" = x"no"; then
2702    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2703  fi
2704fi
2705AM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2706#
2707]) # XORG_LD_WRAP
2708
2709# XORG_CHECK_LINKER_FLAGS
2710# -----------------------
2711# SYNOPSIS
2712#
2713#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2714#
2715# DESCRIPTION
2716#
2717#   Check whether the given linker FLAGS work with the current language's
2718#   linker, or whether they give an error.
2719#
2720#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2721#   success/failure.
2722#
2723#   PROGRAM-SOURCE is the program source to link with, if needed
2724#
2725#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2726#
2727# LICENSE
2728#
2729#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2730#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2731#   Copyright (c) 2009 Matteo Frigo
2732#
2733#   This program is free software: you can redistribute it and/or modify it
2734#   under the terms of the GNU General Public License as published by the
2735#   Free Software Foundation, either version 3 of the License, or (at your
2736#   option) any later version.
2737#
2738#   This program is distributed in the hope that it will be useful, but
2739#   WITHOUT ANY WARRANTY; without even the implied warranty of
2740#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2741#   Public License for more details.
2742#
2743#   You should have received a copy of the GNU General Public License along
2744#   with this program. If not, see <http://www.gnu.org/licenses/>.
2745#
2746#   As a special exception, the respective Autoconf Macro's copyright owner
2747#   gives unlimited permission to copy, distribute and modify the configure
2748#   scripts that are the output of Autoconf when processing the Macro. You
2749#   need not follow the terms of the GNU General Public License when using
2750#   or distributing such scripts, even though portions of the text of the
2751#   Macro appear in them. The GNU General Public License (GPL) does govern
2752#   all other use of the material that constitutes the Autoconf Macro.
2753#
2754#   This special exception to the GPL applies to versions of the Autoconf
2755#   Macro released by the Autoconf Archive. When you make and distribute a
2756#   modified version of the Autoconf Macro, you may extend this special
2757#   exception to the GPL to apply to your modified version as well.#
2758AC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2759[AC_MSG_CHECKING([whether the linker accepts $1])
2760dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2761AS_LITERAL_IF([$1],
2762  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2763      ax_save_FLAGS=$LDFLAGS
2764      LDFLAGS="$1"
2765      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2766        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2767        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2768      LDFLAGS=$ax_save_FLAGS])],
2769  [ax_save_FLAGS=$LDFLAGS
2770   LDFLAGS="$1"
2771   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2772     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2773     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2774   LDFLAGS=$ax_save_FLAGS])
2775eval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2776AC_MSG_RESULT($xorg_check_linker_flags)
2777if test "x$xorg_check_linker_flags" = xyes; then
2778	m4_default([$2], :)
2779else
2780	m4_default([$3], :)
2781fi
2782]) # XORG_CHECK_LINKER_FLAGS
2783
2784# XORG_MEMORY_CHECK_FLAGS
2785# -----------------------
2786# Minimum version: 1.16.0
2787#
2788# This macro attempts to find appropriate memory checking functionality
2789# for various platforms which unit testing code may use to catch various
2790# forms of memory allocation and access errors in testing.
2791#
2792# Interface to module:
2793# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2794#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2795#
2796# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2797#
2798AC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2799
2800AC_REQUIRE([AC_CANONICAL_HOST])
2801AC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2802           [Environment variables to enable memory checking in tests])
2803
2804# Check for different types of support on different platforms
2805case $host_os in
2806    solaris*)
2807        AC_CHECK_LIB([umem], [umem_alloc],
2808            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2809        ;;
2810    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2811        # both directly and inverted, so should not be 0 or 255.
2812        malloc_debug_env='MALLOC_PERTURB_=15'
2813        ;;
2814    darwin*)
2815        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2816        ;;
2817    *bsd*)
2818        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2819        ;;
2820esac
2821
2822# User supplied flags override default flags
2823if test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2824    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2825fi
2826
2827AC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2828]) # XORG_WITH_LINT
2829
2830# XORG_CHECK_MALLOC_ZERO
2831# ----------------------
2832# Minimum version: 1.0.0
2833#
2834# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2835# malloc(0) returns NULL.  Packages should add one of these cflags to
2836# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2837AC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2838AC_ARG_ENABLE(malloc0returnsnull,
2839	AS_HELP_STRING([--enable-malloc0returnsnull],
2840		       [malloc(0) returns NULL (default: auto)]),
2841	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2842	[MALLOC_ZERO_RETURNS_NULL=auto])
2843
2844AC_MSG_CHECKING([whether malloc(0) returns NULL])
2845if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2846AC_CACHE_VAL([xorg_cv_malloc0_returns_null],
2847	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2848#include <stdlib.h>
2849],[
2850    char *m0, *r0, *c0, *p;
2851    m0 = malloc(0);
2852    p = malloc(10);
2853    r0 = realloc(p,0);
2854    c0 = calloc(0,10);
2855    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2856])],
2857		[xorg_cv_malloc0_returns_null=yes],
2858		[xorg_cv_malloc0_returns_null=no])])
2859MALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2860fi
2861AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2862
2863if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2864	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2865	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2866	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2867else
2868	MALLOC_ZERO_CFLAGS=""
2869	XMALLOC_ZERO_CFLAGS=""
2870	XTMALLOC_ZERO_CFLAGS=""
2871fi
2872
2873AC_SUBST([MALLOC_ZERO_CFLAGS])
2874AC_SUBST([XMALLOC_ZERO_CFLAGS])
2875AC_SUBST([XTMALLOC_ZERO_CFLAGS])
2876]) # XORG_CHECK_MALLOC_ZERO
2877
2878# XORG_WITH_LINT()
2879# ----------------
2880# Minimum version: 1.1.0
2881#
2882# This macro enables the use of a tool that flags some suspicious and
2883# non-portable constructs (likely to be bugs) in C language source code.
2884# It will attempt to locate the tool and use appropriate options.
2885# There are various lint type tools on different platforms.
2886#
2887# Interface to module:
2888# LINT:		returns the path to the tool found on the platform
2889#		or the value set to LINT on the configure cmd line
2890#		also an Automake conditional
2891# LINT_FLAGS:	an Automake variable with appropriate flags
2892#
2893# --with-lint:	'yes' user instructs the module to use lint
2894#		'no' user instructs the module not to use lint (default)
2895#
2896# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2897# If the user sets the value of LINT_FLAGS, they are used verbatim.
2898#
2899AC_DEFUN([XORG_WITH_LINT],[
2900
2901AC_ARG_VAR([LINT], [Path to a lint-style command])
2902AC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2903AC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2904		[Use a lint-style source code checker (default: disabled)])],
2905		[use_lint=$withval], [use_lint=no])
2906
2907# Obtain platform specific info like program name and options
2908# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2909case $host_os in
2910  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2911	lint_name=splint
2912	lint_options="-badflag"
2913	;;
2914  *freebsd* | *netbsd*)
2915	lint_name=lint
2916	lint_options="-u -b"
2917	;;
2918  *solaris*)
2919	lint_name=lint
2920	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2921	;;
2922esac
2923
2924# Test for the presence of the program (either guessed by the code or spelled out by the user)
2925if test "x$use_lint" = x"yes" ; then
2926   AC_PATH_PROG([LINT], [$lint_name])
2927   if test "x$LINT" = "x"; then
2928        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2929   fi
2930elif test "x$use_lint" = x"no" ; then
2931   if test "x$LINT" != "x"; then
2932      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2933   fi
2934else
2935   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2936fi
2937
2938# User supplied flags override default flags
2939if test "x$LINT_FLAGS" != "x"; then
2940   lint_options=$LINT_FLAGS
2941fi
2942
2943AC_SUBST([LINT_FLAGS],[$lint_options])
2944AM_CONDITIONAL(LINT, [test "x$LINT" != x])
2945
2946]) # XORG_WITH_LINT
2947
2948# XORG_LINT_LIBRARY(LIBNAME)
2949# --------------------------
2950# Minimum version: 1.1.0
2951#
2952# Sets up flags for building lint libraries for checking programs that call
2953# functions in the library.
2954#
2955# Interface to module:
2956# LINTLIB		- Automake variable with the name of lint library file to make
2957# MAKE_LINT_LIB		- Automake conditional
2958#
2959# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2960#			  - 'no' user instructs the module not to create a lint library (default)
2961
2962AC_DEFUN([XORG_LINT_LIBRARY],[
2963AC_REQUIRE([XORG_WITH_LINT])
2964AC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2965	[Create lint library (default: disabled)])],
2966	[make_lint_lib=$enableval], [make_lint_lib=no])
2967
2968if test "x$make_lint_lib" = x"yes" ; then
2969   LINTLIB=llib-l$1.ln
2970   if test "x$LINT" = "x"; then
2971        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2972   fi
2973elif test "x$make_lint_lib" != x"no" ; then
2974   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2975fi
2976
2977AC_SUBST(LINTLIB)
2978AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2979
2980]) # XORG_LINT_LIBRARY
2981
2982# XORG_COMPILER_BRAND
2983# -------------------
2984# Minimum version: 1.14.0
2985#
2986# Checks for various brands of compilers and sets flags as appropriate:
2987#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2988#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2989#   clang compiler - sets CLANGCC to "yes"
2990#   Intel compiler - sets INTELCC to "yes"
2991#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2992#
2993AC_DEFUN([XORG_COMPILER_BRAND], [
2994AC_LANG_CASE(
2995	[C], [
2996		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
2997		dnl and complains that AC_PROG_CC_C99 is obsolete
2998		m4_version_prereq([2.70],
2999			[AC_REQUIRE([AC_PROG_CC])],
3000			[AC_REQUIRE([AC_PROG_CC_C99])])
3001	],
3002	[C++], [
3003		AC_REQUIRE([AC_PROG_CXX])
3004	]
3005)
3006AC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
3007AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
3008AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
3009]) # XORG_COMPILER_BRAND
3010
3011# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
3012# ---------------
3013# Minimum version: 1.16.0
3014#
3015# Test if the compiler works when passed the given flag as a command line argument.
3016# If it succeeds, the flag is appended to the given variable.  If not, it tries the
3017# next flag in the list until there are no more options.
3018#
3019# Note that this does not guarantee that the compiler supports the flag as some
3020# compilers will simply ignore arguments that they do not understand, but we do
3021# attempt to weed out false positives by using -Werror=unknown-warning-option and
3022# -Werror=unused-command-line-argument
3023#
3024AC_DEFUN([XORG_TESTSET_CFLAG], [
3025m4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3026m4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3027
3028AC_LANG_COMPILER_REQUIRE
3029
3030AC_LANG_CASE(
3031	[C], [
3032		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
3033		dnl and complains that AC_PROG_CC_C99 is obsolete
3034		m4_version_prereq([2.70],
3035			[AC_REQUIRE([AC_PROG_CC])],
3036			[AC_REQUIRE([AC_PROG_CC_C99])])
3037		define([PREFIX], [C])
3038		define([CACHE_PREFIX], [cc])
3039		define([COMPILER], [$CC])
3040	],
3041	[C++], [
3042		define([PREFIX], [CXX])
3043		define([CACHE_PREFIX], [cxx])
3044		define([COMPILER], [$CXX])
3045	]
3046)
3047
3048[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
3049
3050if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
3051	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3052	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
3053			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3054			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3055					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
3056					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
3057	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
3058	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3059fi
3060
3061if test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
3062	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
3063		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3064	fi
3065	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3066	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
3067			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3068			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3069					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
3070					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
3071	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
3072	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3073fi
3074
3075found="no"
3076m4_foreach([flag], m4_cdr($@), [
3077	if test $found = "no" ; then
3078		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
3079			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3080		fi
3081
3082		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
3083			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3084		fi
3085
3086		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
3087
3088dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
3089		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
3090		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
3091		AC_CACHE_VAL($cacheid,
3092			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3093					     [eval $cacheid=yes],
3094					     [eval $cacheid=no])])
3095
3096		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3097
3098		eval supported=\$$cacheid
3099		AC_MSG_RESULT([$supported])
3100		if test "$supported" = "yes" ; then
3101			$1="$$1 ]flag["
3102			found="yes"
3103		fi
3104	fi
3105])
3106]) # XORG_TESTSET_CFLAG
3107
3108# XORG_COMPILER_FLAGS
3109# ---------------
3110# Minimum version: 1.16.0
3111#
3112# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
3113# arguments supported by the selected compiler which do NOT alter the generated
3114# code.  These arguments will cause the compiler to print various warnings
3115# during compilation AND turn a conservative set of warnings into errors.
3116#
3117# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
3118# future versions of util-macros as options are added to new compilers.
3119#
3120AC_DEFUN([XORG_COMPILER_FLAGS], [
3121AC_REQUIRE([XORG_COMPILER_BRAND])
3122
3123AC_ARG_ENABLE(selective-werror,
3124              AS_HELP_STRING([--disable-selective-werror],
3125                             [Turn off selective compiler errors. (default: enabled)]),
3126              [SELECTIVE_WERROR=$enableval],
3127              [SELECTIVE_WERROR=yes])
3128
3129AC_LANG_CASE(
3130        [C], [
3131                define([PREFIX], [C])
3132        ],
3133        [C++], [
3134                define([PREFIX], [CXX])
3135        ]
3136)
3137# -v is too short to test reliably with XORG_TESTSET_CFLAG
3138if test "x$SUNCC" = "xyes"; then
3139    [BASE_]PREFIX[FLAGS]="-v"
3140else
3141    [BASE_]PREFIX[FLAGS]=""
3142fi
3143
3144# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3145XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
3146XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
3147XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
3148XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3149
3150AC_LANG_CASE(
3151	[C], [
3152		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
3153		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
3154		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
3155		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
3156		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
3157		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
3158	]
3159)
3160
3161# This chunk adds additional warnings that could catch undesired effects.
3162XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
3163XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
3164XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
3165XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
3166XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
3167XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
3168XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3169
3170# These are currently disabled because they are noisy.  They will be enabled
3171# in the future once the codebase is sufficiently modernized to silence
3172# them.  For now, I don't want them to drown out the other warnings.
3173# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3174# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3175# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3176
3177# Turn some warnings into errors, so we don't accidentally get successful builds
3178# when there are problems that should be fixed.
3179
3180if test "x$SELECTIVE_WERROR" = "xyes" ; then
3181XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3182XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3183XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3184XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3185XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3186XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3187XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3188XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3189XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3190XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3191XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3192XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3193XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3194else
3195AC_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])
3196XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3197XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3198XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3199XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3200XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3201XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3202XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3203XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3204XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3205XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3206XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3207XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3208XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3209fi
3210
3211AC_SUBST([BASE_]PREFIX[FLAGS])
3212]) # XORG_COMPILER_FLAGS
3213
3214# XORG_CWARNFLAGS
3215# ---------------
3216# Minimum version: 1.2.0
3217# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3218#
3219# Defines CWARNFLAGS to enable C compiler warnings.
3220#
3221# This function is deprecated because it defines -fno-strict-aliasing
3222# which alters the code generated by the compiler.  If -fno-strict-aliasing
3223# is needed, then it should be added explicitly in the module when
3224# it is updated to use BASE_CFLAGS.
3225#
3226AC_DEFUN([XORG_CWARNFLAGS], [
3227AC_REQUIRE([XORG_COMPILER_FLAGS])
3228AC_REQUIRE([XORG_COMPILER_BRAND])
3229AC_LANG_CASE(
3230	[C], [
3231		CWARNFLAGS="$BASE_CFLAGS"
3232		if  test "x$GCC" = xyes ; then
3233		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3234		fi
3235		AC_SUBST(CWARNFLAGS)
3236	]
3237)
3238]) # XORG_CWARNFLAGS
3239
3240# XORG_STRICT_OPTION
3241# -----------------------
3242# Minimum version: 1.3.0
3243#
3244# Add configure option to enable strict compilation flags, such as treating
3245# warnings as fatal errors.
3246# If --enable-strict-compilation is passed to configure, adds strict flags to
3247# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3248#
3249# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3250# when strict compilation is unconditionally desired.
3251AC_DEFUN([XORG_STRICT_OPTION], [
3252AC_REQUIRE([XORG_CWARNFLAGS])
3253AC_REQUIRE([XORG_COMPILER_FLAGS])
3254
3255AC_ARG_ENABLE(strict-compilation,
3256			  AS_HELP_STRING([--enable-strict-compilation],
3257			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3258			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3259
3260AC_LANG_CASE(
3261        [C], [
3262                define([PREFIX], [C])
3263        ],
3264        [C++], [
3265                define([PREFIX], [CXX])
3266        ]
3267)
3268
3269[STRICT_]PREFIX[FLAGS]=""
3270XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3271XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3272
3273# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3274# activate it with -Werror, so we add it here explicitly.
3275XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3276
3277if test "x$STRICT_COMPILE" = "xyes"; then
3278    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3279    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3280fi
3281AC_SUBST([STRICT_]PREFIX[FLAGS])
3282AC_SUBST([BASE_]PREFIX[FLAGS])
3283AC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3284]) # XORG_STRICT_OPTION
3285
3286# XORG_DEFAULT_NOCODE_OPTIONS
3287# ---------------------------
3288# Minimum version: 1.20.0
3289#
3290# Defines default options for X.Org modules which don't compile code,
3291# such as fonts, bitmaps, cursors, and docs.
3292#
3293AC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
3294AC_REQUIRE([AC_PROG_INSTALL])
3295XORG_RELEASE_VERSION
3296XORG_CHANGELOG
3297XORG_INSTALL
3298XORG_MANPAGE_SECTIONS
3299m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3300    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3301]) # XORG_DEFAULT_NOCODE_OPTIONS
3302
3303# XORG_DEFAULT_OPTIONS
3304# --------------------
3305# Minimum version: 1.3.0
3306#
3307# Defines default options for X.Org modules which compile code.
3308#
3309AC_DEFUN([XORG_DEFAULT_OPTIONS], [
3310AC_REQUIRE([AC_PROG_INSTALL])
3311XORG_COMPILER_FLAGS
3312XORG_CWARNFLAGS
3313XORG_STRICT_OPTION
3314XORG_DEFAULT_NOCODE_OPTIONS
3315]) # XORG_DEFAULT_OPTIONS
3316
3317# XORG_INSTALL()
3318# ----------------
3319# Minimum version: 1.4.0
3320#
3321# Defines the variable INSTALL_CMD as the command to copy
3322# INSTALL from $prefix/share/util-macros.
3323#
3324AC_DEFUN([XORG_INSTALL], [
3325AC_REQUIRE([PKG_PROG_PKG_CONFIG])
3326macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3327INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3328mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3329|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3330touch \$(top_srcdir)/INSTALL; \
3331echo 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3332AC_SUBST([INSTALL_CMD])
3333]) # XORG_INSTALL
3334dnl Copyright 2005 Red Hat, Inc
3335dnl
3336dnl Permission to use, copy, modify, distribute, and sell this software and its
3337dnl documentation for any purpose is hereby granted without fee, provided that
3338dnl the above copyright notice appear in all copies and that both that
3339dnl copyright notice and this permission notice appear in supporting
3340dnl documentation.
3341dnl
3342dnl The above copyright notice and this permission notice shall be included
3343dnl in all copies or substantial portions of the Software.
3344dnl
3345dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3346dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3347dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3348dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3349dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3350dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3351dnl OTHER DEALINGS IN THE SOFTWARE.
3352dnl
3353dnl Except as contained in this notice, the name of the copyright holders shall
3354dnl not be used in advertising or otherwise to promote the sale, use or
3355dnl other dealings in this Software without prior written authorization
3356dnl from the copyright holders.
3357dnl
3358
3359# XORG_RELEASE_VERSION
3360# --------------------
3361# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3362
3363AC_DEFUN([XORG_RELEASE_VERSION],[
3364	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3365		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3366		[Major version of this package])
3367	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3368	if test "x$PVM" = "x"; then
3369		PVM="0"
3370	fi
3371	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3372		[$PVM],
3373		[Minor version of this package])
3374	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3375	if test "x$PVP" = "x"; then
3376		PVP="0"
3377	fi
3378	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3379		[$PVP],
3380		[Patch version of this package])
3381])
3382
3383# XORG_CHANGELOG()
3384# ----------------
3385# Minimum version: 1.2.0
3386#
3387# Defines the variable CHANGELOG_CMD as the command to generate
3388# ChangeLog from git.
3389#
3390#
3391AC_DEFUN([XORG_CHANGELOG], [
3392CHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3393mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3394|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3395touch \$(top_srcdir)/ChangeLog; \
3396echo 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3397AC_SUBST([CHANGELOG_CMD])
3398]) # XORG_CHANGELOG
3399
3400