1023b3b36Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2023b3b36Smrg
3023b3b36Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4023b3b36Smrg
5023b3b36Smrg# This file is free software; the Free Software Foundation
6023b3b36Smrg# gives unlimited permission to copy and/or distribute it,
7023b3b36Smrg# with or without modifications, as long as this notice is preserved.
8023b3b36Smrg
9023b3b36Smrg# This program is distributed in the hope that it will be useful,
10023b3b36Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11023b3b36Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12023b3b36Smrg# PARTICULAR PURPOSE.
13023b3b36Smrg
14023b3b36Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15023b3b36Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16023b3b36Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17023b3b36Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
18023b3b36Smrg[m4_warning([this file was generated for autoconf 2.71.
19023b3b36SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20023b3b36SmrgIf you have problems, you may need to regenerate the build system entirely.
21023b3b36SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22023b3b36Smrg
23023b3b36Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
24023b3b36Smrg#
25023b3b36Smrg# This file is free software; the Free Software Foundation
26023b3b36Smrg# gives unlimited permission to copy and/or distribute it,
27023b3b36Smrg# with or without modifications, as long as this notice is preserved.
28023b3b36Smrg
29023b3b36Smrg# AM_AUTOMAKE_VERSION(VERSION)
30023b3b36Smrg# ----------------------------
31023b3b36Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32023b3b36Smrg# generated from the m4 files accompanying Automake X.Y.
33023b3b36Smrg# (This private macro should not be called outside this file.)
34023b3b36SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35023b3b36Smrg[am__api_version='1.16'
36023b3b36Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37023b3b36Smrgdnl require some minimum version.  Point them to the right macro.
38023b3b36Smrgm4_if([$1], [1.16.5], [],
39023b3b36Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40023b3b36Smrg])
41023b3b36Smrg
42023b3b36Smrg# _AM_AUTOCONF_VERSION(VERSION)
43023b3b36Smrg# -----------------------------
44023b3b36Smrg# aclocal traces this macro to find the Autoconf version.
45023b3b36Smrg# This is a private macro too.  Using m4_define simplifies
46023b3b36Smrg# the logic in aclocal, which can simply ignore this definition.
47023b3b36Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48023b3b36Smrg
49023b3b36Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50023b3b36Smrg# -------------------------------
51023b3b36Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52023b3b36Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53023b3b36SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54023b3b36Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
55023b3b36Smrgm4_ifndef([AC_AUTOCONF_VERSION],
56023b3b36Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57023b3b36Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58023b3b36Smrg
59023b3b36Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60023b3b36Smrg
61023b3b36Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
62023b3b36Smrg#
63023b3b36Smrg# This file is free software; the Free Software Foundation
64023b3b36Smrg# gives unlimited permission to copy and/or distribute it,
65023b3b36Smrg# with or without modifications, as long as this notice is preserved.
66023b3b36Smrg
67023b3b36Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68023b3b36Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69023b3b36Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70023b3b36Smrg#
71023b3b36Smrg# Of course, Automake must honor this variable whenever it calls a
72023b3b36Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73023b3b36Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74023b3b36Smrg# depending on how configure is run.  This is pretty annoying, since
75023b3b36Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76023b3b36Smrg# source directory, any form will work fine, but in subdirectories a
77023b3b36Smrg# relative path needs to be adjusted first.
78023b3b36Smrg#
79023b3b36Smrg# $ac_aux_dir/missing
80023b3b36Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81023b3b36Smrg# $top_srcdir/$ac_aux_dir/missing
82023b3b36Smrg#    fails if $ac_aux_dir is absolute,
83023b3b36Smrg#    fails when called from a subdirectory in a VPATH build with
84023b3b36Smrg#          a relative $ac_aux_dir
85023b3b36Smrg#
86023b3b36Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87023b3b36Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
88023b3b36Smrg# harmless because $srcdir is '.', but things will broke when you
89023b3b36Smrg# start a VPATH build or use an absolute $srcdir.
90023b3b36Smrg#
91023b3b36Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92023b3b36Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93023b3b36Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94023b3b36Smrg# and then we would define $MISSING as
95023b3b36Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96023b3b36Smrg# This will work as long as MISSING is not called from configure, because
97023b3b36Smrg# unfortunately $(top_srcdir) has no meaning in configure.
98023b3b36Smrg# However there are other variables, like CC, which are often used in
99023b3b36Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100023b3b36Smrg#
101023b3b36Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
102023b3b36Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
103023b3b36Smrg# configured tree to be moved without reconfiguration.
104023b3b36Smrg
105023b3b36SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106023b3b36Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107023b3b36Smrg# Expand $ac_aux_dir to an absolute path.
108023b3b36Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109023b3b36Smrg])
110023b3b36Smrg
111023b3b36Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112023b3b36Smrg
113023b3b36Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
114023b3b36Smrg#
115023b3b36Smrg# This file is free software; the Free Software Foundation
116023b3b36Smrg# gives unlimited permission to copy and/or distribute it,
117023b3b36Smrg# with or without modifications, as long as this notice is preserved.
118023b3b36Smrg
119023b3b36Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120023b3b36Smrg# -------------------------------------
121023b3b36Smrg# Define a conditional.
122023b3b36SmrgAC_DEFUN([AM_CONDITIONAL],
123023b3b36Smrg[AC_PREREQ([2.52])dnl
124023b3b36Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
125023b3b36Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126023b3b36SmrgAC_SUBST([$1_TRUE])dnl
127023b3b36SmrgAC_SUBST([$1_FALSE])dnl
128023b3b36Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129023b3b36Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130023b3b36Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131023b3b36Smrgif $2; then
132023b3b36Smrg  $1_TRUE=
133023b3b36Smrg  $1_FALSE='#'
134023b3b36Smrgelse
135023b3b36Smrg  $1_TRUE='#'
136023b3b36Smrg  $1_FALSE=
137023b3b36Smrgfi
138023b3b36SmrgAC_CONFIG_COMMANDS_PRE(
139023b3b36Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140023b3b36Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141023b3b36SmrgUsually this means the macro was only invoked conditionally.]])
142023b3b36Smrgfi])])
143023b3b36Smrg
144023b3b36Smrg# Do all the work for Automake.                             -*- Autoconf -*-
145023b3b36Smrg
146023b3b36Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
147023b3b36Smrg#
148023b3b36Smrg# This file is free software; the Free Software Foundation
149023b3b36Smrg# gives unlimited permission to copy and/or distribute it,
150023b3b36Smrg# with or without modifications, as long as this notice is preserved.
151023b3b36Smrg
152023b3b36Smrg# This macro actually does too much.  Some checks are only needed if
153023b3b36Smrg# your package does certain things.  But this isn't really a big deal.
154023b3b36Smrg
155023b3b36Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
156023b3b36Smrgm4_define([AC_PROG_CC],
157023b3b36Smrgm4_defn([AC_PROG_CC])
158023b3b36Smrg[_AM_PROG_CC_C_O
159023b3b36Smrg])
160023b3b36Smrg
161023b3b36Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
162023b3b36Smrg# AM_INIT_AUTOMAKE([OPTIONS])
163023b3b36Smrg# -----------------------------------------------
164023b3b36Smrg# The call with PACKAGE and VERSION arguments is the old style
165023b3b36Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
166023b3b36Smrg# and VERSION should now be passed to AC_INIT and removed from
167023b3b36Smrg# the call to AM_INIT_AUTOMAKE.
168023b3b36Smrg# We support both call styles for the transition.  After
169023b3b36Smrg# the next Automake release, Autoconf can make the AC_INIT
170023b3b36Smrg# arguments mandatory, and then we can depend on a new Autoconf
171023b3b36Smrg# release and drop the old call support.
172023b3b36SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
173023b3b36Smrg[AC_PREREQ([2.65])dnl
174023b3b36Smrgm4_ifdef([_$0_ALREADY_INIT],
175023b3b36Smrg  [m4_fatal([$0 expanded multiple times
176023b3b36Smrg]m4_defn([_$0_ALREADY_INIT]))],
177023b3b36Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
178023b3b36Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
179023b3b36Smrgdnl the ones we care about.
180023b3b36Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
181023b3b36SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
182023b3b36SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
183023b3b36Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
184023b3b36Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
185023b3b36Smrg  # is not polluted with repeated "-I."
186023b3b36Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
187023b3b36Smrg  # test to see if srcdir already configured
188023b3b36Smrg  if test -f $srcdir/config.status; then
189023b3b36Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
190023b3b36Smrg  fi
191023b3b36Smrgfi
192023b3b36Smrg
193023b3b36Smrg# test whether we have cygpath
194023b3b36Smrgif test -z "$CYGPATH_W"; then
195023b3b36Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
196023b3b36Smrg    CYGPATH_W='cygpath -w'
197023b3b36Smrg  else
198023b3b36Smrg    CYGPATH_W=echo
199023b3b36Smrg  fi
200023b3b36Smrgfi
201023b3b36SmrgAC_SUBST([CYGPATH_W])
202023b3b36Smrg
203023b3b36Smrg# Define the identity of the package.
204023b3b36Smrgdnl Distinguish between old-style and new-style calls.
205023b3b36Smrgm4_ifval([$2],
206023b3b36Smrg[AC_DIAGNOSE([obsolete],
207023b3b36Smrg             [$0: two- and three-arguments forms are deprecated.])
208023b3b36Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
209023b3b36Smrg AC_SUBST([PACKAGE], [$1])dnl
210023b3b36Smrg AC_SUBST([VERSION], [$2])],
211023b3b36Smrg[_AM_SET_OPTIONS([$1])dnl
212023b3b36Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
213023b3b36Smrgm4_if(
214023b3b36Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
215023b3b36Smrg  [ok:ok],,
216023b3b36Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
217023b3b36Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
218023b3b36Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
219023b3b36Smrg
220023b3b36Smrg_AM_IF_OPTION([no-define],,
221023b3b36Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
222023b3b36Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
223023b3b36Smrg
224023b3b36Smrg# Some tools Automake needs.
225023b3b36SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
226023b3b36SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
227023b3b36SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
228023b3b36SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
229023b3b36SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
230023b3b36SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
231023b3b36SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
232023b3b36SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
233023b3b36SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
234023b3b36SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
235023b3b36Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
236023b3b36Smrg# dies out for good.  For more background, see:
237023b3b36Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
238023b3b36Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
239023b3b36SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
240023b3b36Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
241023b3b36Smrg# system "awk" is bad on some platforms.
242023b3b36SmrgAC_REQUIRE([AC_PROG_AWK])dnl
243023b3b36SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
244023b3b36SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
245023b3b36Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
246023b3b36Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
247023b3b36Smrg			     [_AM_PROG_TAR([v7])])])
248023b3b36Smrg_AM_IF_OPTION([no-dependencies],,
249023b3b36Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
250023b3b36Smrg		  [_AM_DEPENDENCIES([CC])],
251023b3b36Smrg		  [m4_define([AC_PROG_CC],
252023b3b36Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
253023b3b36SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
254023b3b36Smrg		  [_AM_DEPENDENCIES([CXX])],
255023b3b36Smrg		  [m4_define([AC_PROG_CXX],
256023b3b36Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
257023b3b36SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
258023b3b36Smrg		  [_AM_DEPENDENCIES([OBJC])],
259023b3b36Smrg		  [m4_define([AC_PROG_OBJC],
260023b3b36Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
261023b3b36SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
262023b3b36Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
263023b3b36Smrg		  [m4_define([AC_PROG_OBJCXX],
264023b3b36Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
265023b3b36Smrg])
266023b3b36Smrg# Variables for tags utilities; see am/tags.am
267023b3b36Smrgif test -z "$CTAGS"; then
268023b3b36Smrg  CTAGS=ctags
269023b3b36Smrgfi
270023b3b36SmrgAC_SUBST([CTAGS])
271023b3b36Smrgif test -z "$ETAGS"; then
272023b3b36Smrg  ETAGS=etags
273023b3b36Smrgfi
274023b3b36SmrgAC_SUBST([ETAGS])
275023b3b36Smrgif test -z "$CSCOPE"; then
276023b3b36Smrg  CSCOPE=cscope
277023b3b36Smrgfi
278023b3b36SmrgAC_SUBST([CSCOPE])
279023b3b36Smrg
280023b3b36SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
281023b3b36Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
282023b3b36Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
283023b3b36Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
284023b3b36SmrgAC_CONFIG_COMMANDS_PRE(dnl
285023b3b36Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
286023b3b36Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
287023b3b36Smrg
288023b3b36Smrg# POSIX will say in a future version that running "rm -f" with no argument
289023b3b36Smrg# is OK; and we want to be able to make that assumption in our Makefile
290023b3b36Smrg# recipes.  So use an aggressive probe to check that the usage we want is
291023b3b36Smrg# actually supported "in the wild" to an acceptable degree.
292023b3b36Smrg# See automake bug#10828.
293023b3b36Smrg# To make any issue more visible, cause the running configure to be aborted
294023b3b36Smrg# by default if the 'rm' program in use doesn't match our expectations; the
295023b3b36Smrg# user can still override this though.
296023b3b36Smrgif rm -f && rm -fr && rm -rf; then : OK; else
297023b3b36Smrg  cat >&2 <<'END'
298023b3b36SmrgOops!
299023b3b36Smrg
300023b3b36SmrgYour 'rm' program seems unable to run without file operands specified
301023b3b36Smrgon the command line, even when the '-f' option is present.  This is contrary
302023b3b36Smrgto the behaviour of most rm programs out there, and not conforming with
303023b3b36Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
304023b3b36Smrg
305023b3b36SmrgPlease tell bug-automake@gnu.org about your system, including the value
306023b3b36Smrgof your $PATH and any error possibly output before this message.  This
307023b3b36Smrgcan help us improve future automake versions.
308023b3b36Smrg
309023b3b36SmrgEND
310023b3b36Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
311023b3b36Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
312023b3b36Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
313023b3b36Smrg    echo >&2
314023b3b36Smrg  else
315023b3b36Smrg    cat >&2 <<'END'
316023b3b36SmrgAborting the configuration process, to ensure you take notice of the issue.
317023b3b36Smrg
318023b3b36SmrgYou can download and install GNU coreutils to get an 'rm' implementation
319023b3b36Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
320023b3b36Smrg
321023b3b36SmrgIf you want to complete the configuration process using your problematic
322023b3b36Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
323023b3b36Smrgto "yes", and re-run configure.
324023b3b36Smrg
325023b3b36SmrgEND
326023b3b36Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
327023b3b36Smrg  fi
328023b3b36Smrgfi
329023b3b36Smrgdnl The trailing newline in this macro's definition is deliberate, for
330023b3b36Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
331023b3b36Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
332023b3b36Smrg])
333023b3b36Smrg
334023b3b36Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
335023b3b36Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
336023b3b36Smrgdnl mangled by Autoconf and run in a shell conditional statement.
337023b3b36Smrgm4_define([_AC_COMPILER_EXEEXT],
338023b3b36Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
339023b3b36Smrg
340023b3b36Smrg# When config.status generates a header, we must update the stamp-h file.
341023b3b36Smrg# This file resides in the same directory as the config header
342023b3b36Smrg# that is generated.  The stamp files are numbered to have different names.
343023b3b36Smrg
344023b3b36Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
345023b3b36Smrg# loop where config.status creates the headers, so we can generate
346023b3b36Smrg# our stamp files there.
347023b3b36SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
348023b3b36Smrg[# Compute $1's index in $config_headers.
349023b3b36Smrg_am_arg=$1
350023b3b36Smrg_am_stamp_count=1
351023b3b36Smrgfor _am_header in $config_headers :; do
352023b3b36Smrg  case $_am_header in
353023b3b36Smrg    $_am_arg | $_am_arg:* )
354023b3b36Smrg      break ;;
355023b3b36Smrg    * )
356023b3b36Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
357023b3b36Smrg  esac
358023b3b36Smrgdone
359023b3b36Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
360023b3b36Smrg
361023b3b36Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
362023b3b36Smrg#
363023b3b36Smrg# This file is free software; the Free Software Foundation
364023b3b36Smrg# gives unlimited permission to copy and/or distribute it,
365023b3b36Smrg# with or without modifications, as long as this notice is preserved.
366023b3b36Smrg
367023b3b36Smrg# AM_PROG_INSTALL_SH
368023b3b36Smrg# ------------------
369023b3b36Smrg# Define $install_sh.
370023b3b36SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
371023b3b36Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
372023b3b36Smrgif test x"${install_sh+set}" != xset; then
373023b3b36Smrg  case $am_aux_dir in
374023b3b36Smrg  *\ * | *\	*)
375023b3b36Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
376023b3b36Smrg  *)
377023b3b36Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
378023b3b36Smrg  esac
379023b3b36Smrgfi
380023b3b36SmrgAC_SUBST([install_sh])])
381023b3b36Smrg
382023b3b36Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
383023b3b36Smrg#
384023b3b36Smrg# This file is free software; the Free Software Foundation
385023b3b36Smrg# gives unlimited permission to copy and/or distribute it,
386023b3b36Smrg# with or without modifications, as long as this notice is preserved.
387023b3b36Smrg
388023b3b36Smrg# Check whether the underlying file-system supports filenames
389023b3b36Smrg# with a leading dot.  For instance MS-DOS doesn't.
390023b3b36SmrgAC_DEFUN([AM_SET_LEADING_DOT],
391023b3b36Smrg[rm -rf .tst 2>/dev/null
392023b3b36Smrgmkdir .tst 2>/dev/null
393023b3b36Smrgif test -d .tst; then
394023b3b36Smrg  am__leading_dot=.
395023b3b36Smrgelse
396023b3b36Smrg  am__leading_dot=_
397023b3b36Smrgfi
398023b3b36Smrgrmdir .tst 2>/dev/null
399023b3b36SmrgAC_SUBST([am__leading_dot])])
400023b3b36Smrg
401023b3b36Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
402023b3b36Smrg
403023b3b36Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
404023b3b36Smrg#
405023b3b36Smrg# This file is free software; the Free Software Foundation
406023b3b36Smrg# gives unlimited permission to copy and/or distribute it,
407023b3b36Smrg# with or without modifications, as long as this notice is preserved.
408023b3b36Smrg
409023b3b36Smrg# AM_MISSING_PROG(NAME, PROGRAM)
410023b3b36Smrg# ------------------------------
411023b3b36SmrgAC_DEFUN([AM_MISSING_PROG],
412023b3b36Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
413023b3b36Smrg$1=${$1-"${am_missing_run}$2"}
414023b3b36SmrgAC_SUBST($1)])
415023b3b36Smrg
416023b3b36Smrg# AM_MISSING_HAS_RUN
417023b3b36Smrg# ------------------
418023b3b36Smrg# Define MISSING if not defined so far and test if it is modern enough.
419023b3b36Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
420023b3b36SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
421023b3b36Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
422023b3b36SmrgAC_REQUIRE_AUX_FILE([missing])dnl
423023b3b36Smrgif test x"${MISSING+set}" != xset; then
424023b3b36Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
425023b3b36Smrgfi
426023b3b36Smrg# Use eval to expand $SHELL
427023b3b36Smrgif eval "$MISSING --is-lightweight"; then
428023b3b36Smrg  am_missing_run="$MISSING "
429023b3b36Smrgelse
430023b3b36Smrg  am_missing_run=
431023b3b36Smrg  AC_MSG_WARN(['missing' script is too old or missing])
432023b3b36Smrgfi
433023b3b36Smrg])
434023b3b36Smrg
435023b3b36Smrg# Helper functions for option handling.                     -*- Autoconf -*-
436023b3b36Smrg
437023b3b36Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
438023b3b36Smrg#
439023b3b36Smrg# This file is free software; the Free Software Foundation
440023b3b36Smrg# gives unlimited permission to copy and/or distribute it,
441023b3b36Smrg# with or without modifications, as long as this notice is preserved.
442023b3b36Smrg
443023b3b36Smrg# _AM_MANGLE_OPTION(NAME)
444023b3b36Smrg# -----------------------
445023b3b36SmrgAC_DEFUN([_AM_MANGLE_OPTION],
446023b3b36Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
447023b3b36Smrg
448023b3b36Smrg# _AM_SET_OPTION(NAME)
449023b3b36Smrg# --------------------
450023b3b36Smrg# Set option NAME.  Presently that only means defining a flag for this option.
451023b3b36SmrgAC_DEFUN([_AM_SET_OPTION],
452023b3b36Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
453023b3b36Smrg
454023b3b36Smrg# _AM_SET_OPTIONS(OPTIONS)
455023b3b36Smrg# ------------------------
456023b3b36Smrg# OPTIONS is a space-separated list of Automake options.
457023b3b36SmrgAC_DEFUN([_AM_SET_OPTIONS],
458023b3b36Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
459023b3b36Smrg
460023b3b36Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
461023b3b36Smrg# -------------------------------------------
462023b3b36Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
463023b3b36SmrgAC_DEFUN([_AM_IF_OPTION],
464023b3b36Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
465023b3b36Smrg
466023b3b36Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
467023b3b36Smrg
468023b3b36Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
469023b3b36Smrg#
470023b3b36Smrg# This file is free software; the Free Software Foundation
471023b3b36Smrg# gives unlimited permission to copy and/or distribute it,
472023b3b36Smrg# with or without modifications, as long as this notice is preserved.
473023b3b36Smrg
474023b3b36Smrg# AM_SANITY_CHECK
475023b3b36Smrg# ---------------
476023b3b36SmrgAC_DEFUN([AM_SANITY_CHECK],
477023b3b36Smrg[AC_MSG_CHECKING([whether build environment is sane])
478023b3b36Smrg# Reject unsafe characters in $srcdir or the absolute working directory
479023b3b36Smrg# name.  Accept space and tab only in the latter.
480023b3b36Smrgam_lf='
481023b3b36Smrg'
482023b3b36Smrgcase `pwd` in
483023b3b36Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
484023b3b36Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
485023b3b36Smrgesac
486023b3b36Smrgcase $srcdir in
487023b3b36Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
488023b3b36Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
489023b3b36Smrgesac
490023b3b36Smrg
491023b3b36Smrg# Do 'set' in a subshell so we don't clobber the current shell's
492023b3b36Smrg# arguments.  Must try -L first in case configure is actually a
493023b3b36Smrg# symlink; some systems play weird games with the mod time of symlinks
494023b3b36Smrg# (eg FreeBSD returns the mod time of the symlink's containing
495023b3b36Smrg# directory).
496023b3b36Smrgif (
497023b3b36Smrg   am_has_slept=no
498023b3b36Smrg   for am_try in 1 2; do
499023b3b36Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
500023b3b36Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
501023b3b36Smrg     if test "$[*]" = "X"; then
502023b3b36Smrg	# -L didn't work.
503023b3b36Smrg	set X `ls -t "$srcdir/configure" conftest.file`
504023b3b36Smrg     fi
505023b3b36Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
506023b3b36Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
507023b3b36Smrg
508023b3b36Smrg	# If neither matched, then we have a broken ls.  This can happen
509023b3b36Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
510023b3b36Smrg	# broken ls alias from the environment.  This has actually
511023b3b36Smrg	# happened.  Such a system could not be considered "sane".
512023b3b36Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
513023b3b36Smrg  alias in your environment])
514023b3b36Smrg     fi
515023b3b36Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
516023b3b36Smrg       break
517023b3b36Smrg     fi
518023b3b36Smrg     # Just in case.
519023b3b36Smrg     sleep 1
520023b3b36Smrg     am_has_slept=yes
521023b3b36Smrg   done
522023b3b36Smrg   test "$[2]" = conftest.file
523023b3b36Smrg   )
524023b3b36Smrgthen
525023b3b36Smrg   # Ok.
526023b3b36Smrg   :
527023b3b36Smrgelse
528023b3b36Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
529023b3b36SmrgCheck your system clock])
530023b3b36Smrgfi
531023b3b36SmrgAC_MSG_RESULT([yes])
532023b3b36Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
533023b3b36Smrg# generated files are strictly newer.
534023b3b36Smrgam_sleep_pid=
535023b3b36Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
536023b3b36Smrg  ( sleep 1 ) &
537023b3b36Smrg  am_sleep_pid=$!
538023b3b36Smrgfi
539023b3b36SmrgAC_CONFIG_COMMANDS_PRE(
540023b3b36Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
541023b3b36Smrg   if test -n "$am_sleep_pid"; then
542023b3b36Smrg     # Hide warnings about reused PIDs.
543023b3b36Smrg     wait $am_sleep_pid 2>/dev/null
544023b3b36Smrg   fi
545023b3b36Smrg   AC_MSG_RESULT([done])])
546023b3b36Smrgrm -f conftest.file
547023b3b36Smrg])
548023b3b36Smrg
549023b3b36Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
550023b3b36Smrg#
551023b3b36Smrg# This file is free software; the Free Software Foundation
552023b3b36Smrg# gives unlimited permission to copy and/or distribute it,
553023b3b36Smrg# with or without modifications, as long as this notice is preserved.
554023b3b36Smrg
555023b3b36Smrg# AM_SILENT_RULES([DEFAULT])
556023b3b36Smrg# --------------------------
557023b3b36Smrg# Enable less verbose build rules; with the default set to DEFAULT
558023b3b36Smrg# ("yes" being less verbose, "no" or empty being verbose).
559023b3b36SmrgAC_DEFUN([AM_SILENT_RULES],
560023b3b36Smrg[AC_ARG_ENABLE([silent-rules], [dnl
561023b3b36SmrgAS_HELP_STRING(
562023b3b36Smrg  [--enable-silent-rules],
563023b3b36Smrg  [less verbose build output (undo: "make V=1")])
564023b3b36SmrgAS_HELP_STRING(
565023b3b36Smrg  [--disable-silent-rules],
566023b3b36Smrg  [verbose build output (undo: "make V=0")])dnl
567023b3b36Smrg])
568023b3b36Smrgcase $enable_silent_rules in @%:@ (((
569023b3b36Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
570023b3b36Smrg   no) AM_DEFAULT_VERBOSITY=1;;
571023b3b36Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
572023b3b36Smrgesac
573023b3b36Smrgdnl
574023b3b36Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
575023b3b36Smrgdnl do not support nested variable expansions.
576023b3b36Smrgdnl See automake bug#9928 and bug#10237.
577023b3b36Smrgam_make=${MAKE-make}
578023b3b36SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
579023b3b36Smrg   [am_cv_make_support_nested_variables],
580023b3b36Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
581023b3b36SmrgBAR0=false
582023b3b36SmrgBAR1=true
583023b3b36SmrgV=1
584023b3b36Smrgam__doit:
585023b3b36Smrg	@$(TRUE)
586023b3b36Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
587023b3b36Smrg  am_cv_make_support_nested_variables=yes
588023b3b36Smrgelse
589023b3b36Smrg  am_cv_make_support_nested_variables=no
590023b3b36Smrgfi])
591023b3b36Smrgif test $am_cv_make_support_nested_variables = yes; then
592023b3b36Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
593023b3b36Smrg  AM_V='$(V)'
594023b3b36Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
595023b3b36Smrgelse
596023b3b36Smrg  AM_V=$AM_DEFAULT_VERBOSITY
597023b3b36Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
598023b3b36Smrgfi
599023b3b36SmrgAC_SUBST([AM_V])dnl
600023b3b36SmrgAM_SUBST_NOTMAKE([AM_V])dnl
601023b3b36SmrgAC_SUBST([AM_DEFAULT_V])dnl
602023b3b36SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
603023b3b36SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
604023b3b36SmrgAM_BACKSLASH='\'
605023b3b36SmrgAC_SUBST([AM_BACKSLASH])dnl
606023b3b36Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
607023b3b36Smrg])
608023b3b36Smrg
609023b3b36Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
610023b3b36Smrg#
611023b3b36Smrg# This file is free software; the Free Software Foundation
612023b3b36Smrg# gives unlimited permission to copy and/or distribute it,
613023b3b36Smrg# with or without modifications, as long as this notice is preserved.
614023b3b36Smrg
615023b3b36Smrg# AM_PROG_INSTALL_STRIP
616023b3b36Smrg# ---------------------
617023b3b36Smrg# One issue with vendor 'install' (even GNU) is that you can't
618023b3b36Smrg# specify the program used to strip binaries.  This is especially
619023b3b36Smrg# annoying in cross-compiling environments, where the build's strip
620023b3b36Smrg# is unlikely to handle the host's binaries.
621023b3b36Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
622023b3b36Smrg# always use install-sh in "make install-strip", and initialize
623023b3b36Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
624023b3b36SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
625023b3b36Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
626023b3b36Smrg# Installed binaries are usually stripped using 'strip' when the user
627023b3b36Smrg# run "make install-strip".  However 'strip' might not be the right
628023b3b36Smrg# tool to use in cross-compilation environments, therefore Automake
629023b3b36Smrg# will honor the 'STRIP' environment variable to overrule this program.
630023b3b36Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
631023b3b36Smrgif test "$cross_compiling" != no; then
632023b3b36Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
633023b3b36Smrgfi
634023b3b36SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
635023b3b36SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
636023b3b36Smrg
637023b3b36Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
638023b3b36Smrg#
639023b3b36Smrg# This file is free software; the Free Software Foundation
640023b3b36Smrg# gives unlimited permission to copy and/or distribute it,
641023b3b36Smrg# with or without modifications, as long as this notice is preserved.
642023b3b36Smrg
643023b3b36Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
644023b3b36Smrg# ---------------------------
645023b3b36Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
646023b3b36Smrg# This macro is traced by Automake.
647023b3b36SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
648023b3b36Smrg
649023b3b36Smrg# AM_SUBST_NOTMAKE(VARIABLE)
650023b3b36Smrg# --------------------------
651023b3b36Smrg# Public sister of _AM_SUBST_NOTMAKE.
652023b3b36SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
653023b3b36Smrg
654023b3b36Smrg# Check how to create a tarball.                            -*- Autoconf -*-
655023b3b36Smrg
656023b3b36Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
657023b3b36Smrg#
658023b3b36Smrg# This file is free software; the Free Software Foundation
659023b3b36Smrg# gives unlimited permission to copy and/or distribute it,
660023b3b36Smrg# with or without modifications, as long as this notice is preserved.
661023b3b36Smrg
662023b3b36Smrg# _AM_PROG_TAR(FORMAT)
663023b3b36Smrg# --------------------
664023b3b36Smrg# Check how to create a tarball in format FORMAT.
665023b3b36Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
666023b3b36Smrg#
667023b3b36Smrg# Substitute a variable $(am__tar) that is a command
668023b3b36Smrg# writing to stdout a FORMAT-tarball containing the directory
669023b3b36Smrg# $tardir.
670023b3b36Smrg#     tardir=directory && $(am__tar) > result.tar
671023b3b36Smrg#
672023b3b36Smrg# Substitute a variable $(am__untar) that extract such
673023b3b36Smrg# a tarball read from stdin.
674023b3b36Smrg#     $(am__untar) < result.tar
675023b3b36Smrg#
676023b3b36SmrgAC_DEFUN([_AM_PROG_TAR],
677023b3b36Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
678023b3b36Smrg# in the wild :-(  We should find a proper way to deprecate it ...
679023b3b36SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
680023b3b36Smrg
681023b3b36Smrg# We'll loop over all known methods to create a tar archive until one works.
682023b3b36Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
683023b3b36Smrg
684023b3b36Smrgm4_if([$1], [v7],
685023b3b36Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
686023b3b36Smrg
687023b3b36Smrg  [m4_case([$1],
688023b3b36Smrg    [ustar],
689023b3b36Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
690023b3b36Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
691023b3b36Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
692023b3b36Smrg      # and bug#13588).
693023b3b36Smrg      am_max_uid=2097151 # 2^21 - 1
694023b3b36Smrg      am_max_gid=$am_max_uid
695023b3b36Smrg      # The $UID and $GID variables are not portable, so we need to resort
696023b3b36Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
697023b3b36Smrg      # below are definitely unexpected, so allow the users to see them
698023b3b36Smrg      # (that is, avoid stderr redirection).
699023b3b36Smrg      am_uid=`id -u || echo unknown`
700023b3b36Smrg      am_gid=`id -g || echo unknown`
701023b3b36Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
702023b3b36Smrg      if test $am_uid -le $am_max_uid; then
703023b3b36Smrg         AC_MSG_RESULT([yes])
704023b3b36Smrg      else
705023b3b36Smrg         AC_MSG_RESULT([no])
706023b3b36Smrg         _am_tools=none
707023b3b36Smrg      fi
708023b3b36Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
709023b3b36Smrg      if test $am_gid -le $am_max_gid; then
710023b3b36Smrg         AC_MSG_RESULT([yes])
711023b3b36Smrg      else
712023b3b36Smrg        AC_MSG_RESULT([no])
713023b3b36Smrg        _am_tools=none
714023b3b36Smrg      fi],
715023b3b36Smrg
716023b3b36Smrg  [pax],
717023b3b36Smrg    [],
718023b3b36Smrg
719023b3b36Smrg  [m4_fatal([Unknown tar format])])
720023b3b36Smrg
721023b3b36Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
722023b3b36Smrg
723023b3b36Smrg  # Go ahead even if we have the value already cached.  We do so because we
724023b3b36Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
725023b3b36Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
726023b3b36Smrg
727023b3b36Smrg  for _am_tool in $_am_tools; do
728023b3b36Smrg    case $_am_tool in
729023b3b36Smrg    gnutar)
730023b3b36Smrg      for _am_tar in tar gnutar gtar; do
731023b3b36Smrg        AM_RUN_LOG([$_am_tar --version]) && break
732023b3b36Smrg      done
733023b3b36Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
734023b3b36Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
735023b3b36Smrg      am__untar="$_am_tar -xf -"
736023b3b36Smrg      ;;
737023b3b36Smrg    plaintar)
738023b3b36Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
739023b3b36Smrg      # ustar tarball either.
740023b3b36Smrg      (tar --version) >/dev/null 2>&1 && continue
741023b3b36Smrg      am__tar='tar chf - "$$tardir"'
742023b3b36Smrg      am__tar_='tar chf - "$tardir"'
743023b3b36Smrg      am__untar='tar xf -'
744023b3b36Smrg      ;;
745023b3b36Smrg    pax)
746023b3b36Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
747023b3b36Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
748023b3b36Smrg      am__untar='pax -r'
749023b3b36Smrg      ;;
750023b3b36Smrg    cpio)
751023b3b36Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
752023b3b36Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
753023b3b36Smrg      am__untar='cpio -i -H $1 -d'
754023b3b36Smrg      ;;
755023b3b36Smrg    none)
756023b3b36Smrg      am__tar=false
757023b3b36Smrg      am__tar_=false
758023b3b36Smrg      am__untar=false
759023b3b36Smrg      ;;
760023b3b36Smrg    esac
761023b3b36Smrg
762023b3b36Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
763023b3b36Smrg    # and am__untar set.
764023b3b36Smrg    test -n "${am_cv_prog_tar_$1}" && break
765023b3b36Smrg
766023b3b36Smrg    # tar/untar a dummy directory, and stop if the command works.
767023b3b36Smrg    rm -rf conftest.dir
768023b3b36Smrg    mkdir conftest.dir
769023b3b36Smrg    echo GrepMe > conftest.dir/file
770023b3b36Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
771023b3b36Smrg    rm -rf conftest.dir
772023b3b36Smrg    if test -s conftest.tar; then
773023b3b36Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
774023b3b36Smrg      AM_RUN_LOG([cat conftest.dir/file])
775023b3b36Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
776023b3b36Smrg    fi
777023b3b36Smrg  done
778023b3b36Smrg  rm -rf conftest.dir
779023b3b36Smrg
780023b3b36Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
781023b3b36Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
782023b3b36Smrg
783023b3b36SmrgAC_SUBST([am__tar])
784023b3b36SmrgAC_SUBST([am__untar])
785023b3b36Smrg]) # _AM_PROG_TAR
786023b3b36Smrg
787023b3b36Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
788023b3b36Smrgdnl serial 11 (pkg-config-0.29)
789023b3b36Smrgdnl
790023b3b36Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
791023b3b36Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
792023b3b36Smrgdnl
793023b3b36Smrgdnl This program is free software; you can redistribute it and/or modify
794023b3b36Smrgdnl it under the terms of the GNU General Public License as published by
795023b3b36Smrgdnl the Free Software Foundation; either version 2 of the License, or
796023b3b36Smrgdnl (at your option) any later version.
797023b3b36Smrgdnl
798023b3b36Smrgdnl This program is distributed in the hope that it will be useful, but
799023b3b36Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
800023b3b36Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
801023b3b36Smrgdnl General Public License for more details.
802023b3b36Smrgdnl
803023b3b36Smrgdnl You should have received a copy of the GNU General Public License
804023b3b36Smrgdnl along with this program; if not, write to the Free Software
805023b3b36Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
806023b3b36Smrgdnl 02111-1307, USA.
807023b3b36Smrgdnl
808023b3b36Smrgdnl As a special exception to the GNU General Public License, if you
809023b3b36Smrgdnl distribute this file as part of a program that contains a
810023b3b36Smrgdnl configuration script generated by Autoconf, you may include it under
811023b3b36Smrgdnl the same distribution terms that you use for the rest of that
812023b3b36Smrgdnl program.
813023b3b36Smrg
814023b3b36Smrgdnl PKG_PREREQ(MIN-VERSION)
815023b3b36Smrgdnl -----------------------
816023b3b36Smrgdnl Since: 0.29
817023b3b36Smrgdnl
818023b3b36Smrgdnl Verify that the version of the pkg-config macros are at least
819023b3b36Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
820023b3b36Smrgdnl installed version of pkg-config, this checks the developer's version
821023b3b36Smrgdnl of pkg.m4 when generating configure.
822023b3b36Smrgdnl
823023b3b36Smrgdnl To ensure that this macro is defined, also add:
824023b3b36Smrgdnl m4_ifndef([PKG_PREREQ],
825023b3b36Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
826023b3b36Smrgdnl
827023b3b36Smrgdnl See the "Since" comment for each macro you use to see what version
828023b3b36Smrgdnl of the macros you require.
829023b3b36Smrgm4_defun([PKG_PREREQ],
830023b3b36Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
831023b3b36Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
832023b3b36Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
833023b3b36Smrg])dnl PKG_PREREQ
834023b3b36Smrg
835023b3b36Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
836023b3b36Smrgdnl ----------------------------------
837023b3b36Smrgdnl Since: 0.16
838023b3b36Smrgdnl
839023b3b36Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
840023b3b36Smrgdnl first found in the path. Checks that the version of pkg-config found
841023b3b36Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
842023b3b36Smrgdnl used since that's the first version where most current features of
843023b3b36Smrgdnl pkg-config existed.
844023b3b36SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
845023b3b36Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
846023b3b36Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
847023b3b36Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
848023b3b36SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
849023b3b36SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
850023b3b36SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
851023b3b36Smrg
852023b3b36Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
853023b3b36Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
854023b3b36Smrgfi
855023b3b36Smrgif test -n "$PKG_CONFIG"; then
856023b3b36Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
857023b3b36Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
858023b3b36Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
859023b3b36Smrg		AC_MSG_RESULT([yes])
860023b3b36Smrg	else
861023b3b36Smrg		AC_MSG_RESULT([no])
862023b3b36Smrg		PKG_CONFIG=""
863023b3b36Smrg	fi
864023b3b36Smrgfi[]dnl
865023b3b36Smrg])dnl PKG_PROG_PKG_CONFIG
866023b3b36Smrg
867023b3b36Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
868023b3b36Smrgdnl -------------------------------------------------------------------
869023b3b36Smrgdnl Since: 0.18
870023b3b36Smrgdnl
871023b3b36Smrgdnl Check to see whether a particular set of modules exists. Similar to
872023b3b36Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
873023b3b36Smrgdnl
874023b3b36Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
875023b3b36Smrgdnl only at the first occurence in configure.ac, so if the first place
876023b3b36Smrgdnl it's called might be skipped (such as if it is within an "if", you
877023b3b36Smrgdnl have to call PKG_CHECK_EXISTS manually
878023b3b36SmrgAC_DEFUN([PKG_CHECK_EXISTS],
879023b3b36Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
880023b3b36Smrgif test -n "$PKG_CONFIG" && \
881023b3b36Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
882023b3b36Smrg  m4_default([$2], [:])
883023b3b36Smrgm4_ifvaln([$3], [else
884023b3b36Smrg  $3])dnl
885023b3b36Smrgfi])
886023b3b36Smrg
887023b3b36Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
888023b3b36Smrgdnl ---------------------------------------------
889023b3b36Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
890023b3b36Smrgdnl pkg_failed based on the result.
891023b3b36Smrgm4_define([_PKG_CONFIG],
892023b3b36Smrg[if test -n "$$1"; then
893023b3b36Smrg    pkg_cv_[]$1="$$1"
894023b3b36Smrg elif test -n "$PKG_CONFIG"; then
895023b3b36Smrg    PKG_CHECK_EXISTS([$3],
896023b3b36Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
897023b3b36Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
898023b3b36Smrg		     [pkg_failed=yes])
899023b3b36Smrg else
900023b3b36Smrg    pkg_failed=untried
901023b3b36Smrgfi[]dnl
902023b3b36Smrg])dnl _PKG_CONFIG
903023b3b36Smrg
904023b3b36Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
905023b3b36Smrgdnl ---------------------------
906023b3b36Smrgdnl Internal check to see if pkg-config supports short errors.
907023b3b36SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
908023b3b36Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
909023b3b36Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
910023b3b36Smrg        _pkg_short_errors_supported=yes
911023b3b36Smrgelse
912023b3b36Smrg        _pkg_short_errors_supported=no
913023b3b36Smrgfi[]dnl
914023b3b36Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
915023b3b36Smrg
916023b3b36Smrg
917023b3b36Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
918023b3b36Smrgdnl   [ACTION-IF-NOT-FOUND])
919023b3b36Smrgdnl --------------------------------------------------------------
920023b3b36Smrgdnl Since: 0.4.0
921023b3b36Smrgdnl
922023b3b36Smrgdnl Note that if there is a possibility the first call to
923023b3b36Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
924023b3b36Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
925023b3b36SmrgAC_DEFUN([PKG_CHECK_MODULES],
926023b3b36Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
927023b3b36SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
928023b3b36SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
929023b3b36Smrg
930023b3b36Smrgpkg_failed=no
931023b3b36SmrgAC_MSG_CHECKING([for $1])
932023b3b36Smrg
933023b3b36Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
934023b3b36Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
935023b3b36Smrg
936023b3b36Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
937023b3b36Smrgand $1[]_LIBS to avoid the need to call pkg-config.
938023b3b36SmrgSee the pkg-config man page for more details.])
939023b3b36Smrg
940023b3b36Smrgif test $pkg_failed = yes; then
941023b3b36Smrg   	AC_MSG_RESULT([no])
942023b3b36Smrg        _PKG_SHORT_ERRORS_SUPPORTED
943023b3b36Smrg        if test $_pkg_short_errors_supported = yes; then
944023b3b36Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
945023b3b36Smrg        else 
946023b3b36Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
947023b3b36Smrg        fi
948023b3b36Smrg	# Put the nasty error message in config.log where it belongs
949023b3b36Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
950023b3b36Smrg
951023b3b36Smrg	m4_default([$4], [AC_MSG_ERROR(
952023b3b36Smrg[Package requirements ($2) were not met:
953023b3b36Smrg
954023b3b36Smrg$$1_PKG_ERRORS
955023b3b36Smrg
956023b3b36SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
957023b3b36Smrginstalled software in a non-standard prefix.
958023b3b36Smrg
959023b3b36Smrg_PKG_TEXT])[]dnl
960023b3b36Smrg        ])
961023b3b36Smrgelif test $pkg_failed = untried; then
962023b3b36Smrg     	AC_MSG_RESULT([no])
963023b3b36Smrg	m4_default([$4], [AC_MSG_FAILURE(
964023b3b36Smrg[The pkg-config script could not be found or is too old.  Make sure it
965023b3b36Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
966023b3b36Smrgpath to pkg-config.
967023b3b36Smrg
968023b3b36Smrg_PKG_TEXT
969023b3b36Smrg
970023b3b36SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
971023b3b36Smrg        ])
972023b3b36Smrgelse
973023b3b36Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
974023b3b36Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
975023b3b36Smrg        AC_MSG_RESULT([yes])
976023b3b36Smrg	$3
977023b3b36Smrgfi[]dnl
978023b3b36Smrg])dnl PKG_CHECK_MODULES
979023b3b36Smrg
980023b3b36Smrg
981023b3b36Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
982023b3b36Smrgdnl   [ACTION-IF-NOT-FOUND])
983023b3b36Smrgdnl ---------------------------------------------------------------------
984023b3b36Smrgdnl Since: 0.29
985023b3b36Smrgdnl
986023b3b36Smrgdnl Checks for existence of MODULES and gathers its build flags with
987023b3b36Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
988023b3b36Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
989023b3b36Smrgdnl
990023b3b36Smrgdnl Note that if there is a possibility the first call to
991023b3b36Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
992023b3b36Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
993023b3b36Smrgdnl configure.ac.
994023b3b36SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
995023b3b36Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
996023b3b36Smrg_save_PKG_CONFIG=$PKG_CONFIG
997023b3b36SmrgPKG_CONFIG="$PKG_CONFIG --static"
998023b3b36SmrgPKG_CHECK_MODULES($@)
999023b3b36SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1000023b3b36Smrg])dnl PKG_CHECK_MODULES_STATIC
1001023b3b36Smrg
1002023b3b36Smrg
1003023b3b36Smrgdnl PKG_INSTALLDIR([DIRECTORY])
1004023b3b36Smrgdnl -------------------------
1005023b3b36Smrgdnl Since: 0.27
1006023b3b36Smrgdnl
1007023b3b36Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
1008023b3b36Smrgdnl should install pkg-config .pc files. By default the directory is
1009023b3b36Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
1010023b3b36Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1011023b3b36Smrgdnl parameter.
1012023b3b36SmrgAC_DEFUN([PKG_INSTALLDIR],
1013023b3b36Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1014023b3b36Smrgm4_pushdef([pkg_description],
1015023b3b36Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1016023b3b36SmrgAC_ARG_WITH([pkgconfigdir],
1017023b3b36Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1018023b3b36Smrg    [with_pkgconfigdir=]pkg_default)
1019023b3b36SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1020023b3b36Smrgm4_popdef([pkg_default])
1021023b3b36Smrgm4_popdef([pkg_description])
1022023b3b36Smrg])dnl PKG_INSTALLDIR
1023023b3b36Smrg
1024023b3b36Smrg
1025023b3b36Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1026023b3b36Smrgdnl --------------------------------
1027023b3b36Smrgdnl Since: 0.27
1028023b3b36Smrgdnl
1029023b3b36Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1030023b3b36Smrgdnl module should install arch-independent pkg-config .pc files. By
1031023b3b36Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
1032023b3b36Smrgdnl changed by passing DIRECTORY. The user can override through the
1033023b3b36Smrgdnl --with-noarch-pkgconfigdir parameter.
1034023b3b36SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1035023b3b36Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1036023b3b36Smrgm4_pushdef([pkg_description],
1037023b3b36Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1038023b3b36SmrgAC_ARG_WITH([noarch-pkgconfigdir],
1039023b3b36Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1040023b3b36Smrg    [with_noarch_pkgconfigdir=]pkg_default)
1041023b3b36SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1042023b3b36Smrgm4_popdef([pkg_default])
1043023b3b36Smrgm4_popdef([pkg_description])
1044023b3b36Smrg])dnl PKG_NOARCH_INSTALLDIR
1045023b3b36Smrg
1046023b3b36Smrg
1047023b3b36Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1048023b3b36Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1049023b3b36Smrgdnl -------------------------------------------
1050023b3b36Smrgdnl Since: 0.28
1051023b3b36Smrgdnl
1052023b3b36Smrgdnl Retrieves the value of the pkg-config variable for the given module.
1053023b3b36SmrgAC_DEFUN([PKG_CHECK_VAR],
1054023b3b36Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1055023b3b36SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1056023b3b36Smrg
1057023b3b36Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1058023b3b36SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1059023b3b36Smrg
1060023b3b36SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1061023b3b36Smrg])dnl PKG_CHECK_VAR
1062023b3b36Smrg
1063023b3b36Smrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
1064023b3b36Smrgdnl
1065023b3b36Smrgdnl This file comes from X.Org's font-util 1.4.0
1066023b3b36Smrgdnl
1067023b3b36Smrgdnl Copyright (c) 2009, 2023, Oracle and/or its affiliates.
1068023b3b36Smrgdnl
1069023b3b36Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1070023b3b36Smrgdnl copy of this software and associated documentation files (the "Software"),
1071023b3b36Smrgdnl to deal in the Software without restriction, including without limitation
1072023b3b36Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1073023b3b36Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1074023b3b36Smrgdnl Software is furnished to do so, subject to the following conditions:
1075023b3b36Smrgdnl
1076023b3b36Smrgdnl The above copyright notice and this permission notice (including the next
1077023b3b36Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1078023b3b36Smrgdnl Software.
1079023b3b36Smrgdnl
1080023b3b36Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1081023b3b36Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1082023b3b36Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1083023b3b36Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1084023b3b36Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1085023b3b36Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1086023b3b36Smrgdnl DEALINGS IN THE SOFTWARE.
1087023b3b36Smrgdnl
1088023b3b36Smrgdnl --------------------------------------------------------------------
1089023b3b36Smrgdnl
1090023b3b36Smrgdnl Copyright 2005 Red Hat, Inc
1091023b3b36Smrgdnl
1092023b3b36Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
1093023b3b36Smrgdnl documentation for any purpose is hereby granted without fee, provided that
1094023b3b36Smrgdnl the above copyright notice appear in all copies and that both that
1095023b3b36Smrgdnl copyright notice and this permission notice appear in supporting
1096023b3b36Smrgdnl documentation.
1097023b3b36Smrgdnl
1098023b3b36Smrgdnl The above copyright notice and this permission notice shall be included
1099023b3b36Smrgdnl in all copies or substantial portions of the Software.
1100023b3b36Smrgdnl
1101023b3b36Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1102023b3b36Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1103023b3b36Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1104023b3b36Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
1105023b3b36Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1106023b3b36Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1107023b3b36Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
1108023b3b36Smrgdnl
1109023b3b36Smrgdnl Except as contained in this notice, the name of the copyright holders shall
1110023b3b36Smrgdnl not be used in advertising or otherwise to promote the sale, use or
1111023b3b36Smrgdnl other dealings in this Software without prior written authorization
1112023b3b36Smrgdnl from the copyright holders.
1113023b3b36Smrg
1114023b3b36Smrg# XORG_FONT_MACROS_VERSION(required-version)
1115023b3b36Smrg# ------------------------------------------
1116023b3b36Smrg# Minimum version: 1.1.0
1117023b3b36Smrg#
1118023b3b36Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1119023b3b36Smrg# your configure.ac with the minimum required version, such as:
1120023b3b36Smrg# XORG_FONT_MACROS_VERSION(1.1)
1121023b3b36Smrg#
1122023b3b36Smrg# To ensure that this macro is defined, also add:
1123023b3b36Smrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
1124023b3b36Smrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
1125023b3b36Smrg#
1126023b3b36Smrg#
1127023b3b36Smrg# See the "minimum version" comment for each macro you use to see what
1128023b3b36Smrg# version you require.
1129023b3b36Smrgm4_defun([XORG_FONT_MACROS_VERSION],[
1130023b3b36Smrgm4_define([vers_have], [1.4.0])
1131023b3b36Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1132023b3b36Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1133023b3b36Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1134023b3b36Smrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
1135023b3b36Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1136023b3b36Smrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
1137023b3b36Smrgm4_undefine([vers_have])
1138023b3b36Smrgm4_undefine([maj_have])
1139023b3b36Smrgm4_undefine([maj_needed])
1140023b3b36Smrg]) # XORG_FONT_MACROS_VERSION
1141023b3b36Smrg
1142023b3b36Smrg# XORG_FONT_CHECK_{maps}()
1143023b3b36Smrg# ------------------------
1144023b3b36Smrg# Minimum version: 1.0.0
1145023b3b36Smrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
1146023b3b36Smrg# JISX0201 or KOI8_R.  By default, they are all enabled.
1147023b3b36Smrg
1148023b3b36SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
1149023b3b36SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
1150023b3b36SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
1151023b3b36SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
1152023b3b36SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
1153023b3b36SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
1154023b3b36SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
1155023b3b36SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
1156023b3b36SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
1157023b3b36SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
1158023b3b36SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
1159023b3b36SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
1160023b3b36SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
1161023b3b36SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
1162023b3b36SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
1163023b3b36SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
1164023b3b36SmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
1165023b3b36SmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
1166023b3b36Smrg
1167023b3b36Smrg# XORG_FONT_CHECK_ENCODING(encoding)
1168023b3b36Smrg# ----------------------------------
1169023b3b36Smrg# Minimum version: 1.1.0
1170023b3b36Smrg# This macro adds --enable/disable-<encoding>, enabled by default.
1171023b3b36Smrg# It replaced individual copies of this code in the above macros in 1.1.
1172023b3b36Smrg# Currently assumes encoding names will be all upper-case - add m4_toupper
1173023b3b36Smrg# calls if this is not true in the future.
1174023b3b36Smrg
1175023b3b36SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
1176023b3b36Smrg	AC_ARG_ENABLE(m4_tolower($1),
1177023b3b36Smrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
1178023b3b36Smrg				[Build $1 fonts (default: yes)]),
1179023b3b36Smrg		[AS_TR_SH($1)=$enableval])
1180023b3b36Smrg	AC_MSG_CHECKING([whether to build $1 fonts])
1181023b3b36Smrg	AC_MSG_RESULT($[AS_TR_SH($1)])
1182023b3b36Smrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
1183023b3b36Smrg]) # XORG_FONT_CHECK_ENCODING
1184023b3b36Smrg
1185023b3b36Smrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
1186023b3b36Smrg# -----------------------------------------------------
1187023b3b36Smrg# Minimum version: 1.1.0
1188023b3b36Smrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
1189023b3b36Smrg# Add a shorthand --enable/disable-all-encodings option.
1190023b3b36Smrg
1191023b3b36SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
1192023b3b36Smrg	AC_ARG_ENABLE([all-encodings],
1193023b3b36Smrg		AS_HELP_STRING([--disable-all-encodings],
1194023b3b36Smrg				[Disable building of all font encodings]),
1195023b3b36Smrg		[m4_foreach_w([enc], [$1], [
1196023b3b36Smrg			AS_TR_SH(enc)=$enableval
1197023b3b36Smrg		])],
1198023b3b36Smrg		[m4_foreach_w([enc], [$1], [
1199023b3b36Smrg			AS_TR_SH(enc)=yes
1200023b3b36Smrg		])])
1201023b3b36Smrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
1202023b3b36Smrg]) # XORG_FONT_CHECK_ENCODING_LIST
1203023b3b36Smrg
1204023b3b36Smrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
1205023b3b36Smrg# ------------------------------------------
1206023b3b36Smrg# Minimum version: 1.1.0
1207023b3b36Smrg#
1208023b3b36Smrg# Simple wrapper around AC_PATH_PROG that errors if not found
1209023b3b36Smrg#
1210023b3b36Smrg
1211023b3b36SmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
1212023b3b36Smrg	AC_PATH_PROG($1, $2)
1213023b3b36Smrg	if test x"$$1" = x; then
1214023b3b36Smrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
1215023b3b36Smrg	fi
1216023b3b36Smrg])
1217023b3b36Smrg
1218023b3b36Smrg
1219023b3b36Smrg# XORG_FONT_FCCACHE()
1220023b3b36Smrg# -------------------
1221023b3b36Smrg# Minimum version: 1.1.0
1222023b3b36Smrg#
1223023b3b36Smrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
1224023b3b36Smrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
1225023b3b36Smrg# to run fc-cache if found and not installing to $DESTDIR and not
1226023b3b36Smrg# cross-compiling
1227023b3b36Smrg#
1228023b3b36Smrg# fc-cache is optional, not required, and should be skipped when making
1229023b3b36Smrg# packages (installing to $DESTDIR) or cross-compiling
1230023b3b36Smrg#
1231023b3b36SmrgAC_DEFUN([XORG_FONT_FCCACHE],[
1232023b3b36Smrg	AC_PATH_PROG(FCCACHE, fc-cache)
1233023b3b36Smrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
1234023b3b36Smrg	if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then
1235023b3b36Smrg		RUN_FCCACHE="${FCCACHE_WARN}"
1236023b3b36Smrg	else
1237023b3b36Smrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
1238023b3b36Smrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
1239023b3b36Smrg	fi
1240023b3b36Smrg	AC_SUBST([RUN_FCCACHE])
1241023b3b36Smrg])
1242023b3b36Smrg
1243023b3b36Smrg# XORG_FONT_MKFONTDIR()
1244023b3b36Smrg# -------------------
1245023b3b36Smrg# Minimum version: 1.3.0
1246023b3b36Smrg#
1247023b3b36Smrg# Set MKFONTDIR to path to mkfontdir.
1248023b3b36Smrg#
1249023b3b36Smrg# If cross-compiling, and if mkdir is not found, use a shell command
1250023b3b36Smrg# which warns mkfontdir needs to be run on the target
1251023b3b36Smrg#
1252023b3b36Smrg# If not cross-compiling, mkfontdir must be found
1253023b3b36Smrg#
1254023b3b36SmrgAC_DEFUN([XORG_FONT_MKFONTDIR],[
1255023b3b36Smrg	if test x"$cross_compiling" != x"no" ; then
1256023b3b36Smrg		AC_PATH_PROG(MKFONTDIR, mkfontdir, "")
1257023b3b36Smrg		MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run mkfontdir manually on host system"'
1258023b3b36Smrg
1259023b3b36Smrg		if test x"$MKFONTDIR" = x; then
1260023b3b36Smrg			MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'"
1261023b3b36Smrg		fi
1262023b3b36Smrg	else
1263023b3b36Smrg		XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
1264023b3b36Smrg	fi
1265023b3b36Smrg
1266023b3b36Smrg	AC_SUBST([MKFONTDIR])
1267023b3b36Smrg])
1268023b3b36Smrg
1269023b3b36Smrg# XORG_FONT_COMMON_UTILS()
1270023b3b36Smrg# ------------------------
1271023b3b36Smrg# Minimum version: 1.1.0
1272023b3b36Smrg#
1273023b3b36Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
1274023b3b36Smrg
1275023b3b36SmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
1276023b3b36Smrg	XORG_FONT_FCCACHE
1277023b3b36Smrg	XORG_FONT_MKFONTDIR
1278023b3b36Smrg])
1279023b3b36Smrg
1280023b3b36Smrg# XORG_FONT_SCALED_UTILS()
1281023b3b36Smrg# ------------------------
1282023b3b36Smrg# Minimum version: 1.1.0
1283023b3b36Smrg#
1284023b3b36Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
1285023b3b36Smrg# (TrueType, OpenType, Type1)
1286023b3b36Smrg
1287023b3b36SmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
1288023b3b36Smrg	XORG_FONT_COMMON_UTILS
1289023b3b36Smrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
1290023b3b36Smrg])
1291023b3b36Smrg
1292023b3b36Smrg# XORG_FONT_BDF_UTILS()
1293023b3b36Smrg# ---------------------
1294023b3b36Smrg# Minimum version: 1.1.0
1295023b3b36Smrg#
1296023b3b36Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
1297023b3b36Smrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
1298023b3b36Smrg# PCF output files created by bdftopcf
1299023b3b36Smrg
1300023b3b36SmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
1301023b3b36Smrg	XORG_FONT_COMMON_UTILS
1302023b3b36Smrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
1303023b3b36Smrg	XORG_FONT_CHECK_COMPRESSION
1304023b3b36Smrg])
1305023b3b36Smrg
1306023b3b36Smrg# XORG_FONT_CHECK_COMPRESSION()
1307023b3b36Smrg# -----------------------------
1308023b3b36Smrg# Minimum version: 1.1.0
1309023b3b36Smrg#
1310023b3b36Smrg# Offer a --with-compression flag to control what compression method is
1311023b3b36Smrg# used for pcf font files.   Offers all the methods currently supported
1312023b3b36Smrg# by libXfont, including no compression.
1313023b3b36Smrg#
1314023b3b36Smrg# If COMPRESS_FLAGS is not set, and the compression method has flags needed
1315023b3b36Smrg# for reproducible builds, such as gzip -n to not record timestamp, will
1316023b3b36Smrg# set COMPRESS_FLAGS to those options.
1317023b3b36Smrg
1318023b3b36SmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
1319023b3b36Smrg	AC_MSG_CHECKING([font compression method])
1320023b3b36Smrg	AC_ARG_WITH(compression,
1321023b3b36Smrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
1322023b3b36Smrg			 [compression method to use on pcf fonts])],
1323023b3b36Smrg         [compression="$withval"], [compression="yes"])
1324023b3b36Smrg	if test x"$compression" = "xyes" ; then
1325023b3b36Smrg		compression="gzip"
1326023b3b36Smrg	fi
1327023b3b36Smrg	AC_MSG_RESULT([${compression}])
1328023b3b36Smrg	case ${compression} in
1329023b3b36Smrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
1330023b3b36Smrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;
1331023b3b36Smrg			COMPRESS_FLAGS="${COMPRESS_FLAGS--n}" ;;
1332023b3b36Smrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
1333023b3b36Smrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
1334023b3b36Smrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
1335023b3b36Smrg	esac
1336023b3b36Smrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
1337023b3b36Smrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
1338023b3b36Smrg	fi
1339023b3b36Smrg	AC_MSG_CHECKING([options to font compression command])
1340023b3b36Smrg	AC_MSG_RESULT([${COMPRESS_FLAGS:-none}])
1341023b3b36Smrg	AC_SUBST([COMPRESS_FLAGS])
1342023b3b36Smrg	AC_SUBST([COMPRESS_SUFFIX])
1343023b3b36Smrg])
1344023b3b36Smrg
1345023b3b36Smrg# XORG_FONT_UCS2ANY()
1346023b3b36Smrg# -------------------
1347023b3b36Smrg# Minimum version: 1.1.0
1348023b3b36Smrg#
1349023b3b36Smrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
1350023b3b36Smrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
1351023b3b36Smrg# Also call pkg-config to find the directory with the encoding files needed
1352023b3b36Smrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
1353023b3b36Smrg
1354023b3b36SmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
1355023b3b36Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1356023b3b36Smrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
1357023b3b36Smrg	PKG_CHECK_MODULES(MAPS, [fontutil])
1358023b3b36Smrg	AC_MSG_CHECKING([for ucs2any encoding data files])
1359023b3b36Smrg	MAPFILES_PATH=`$PKG_CONFIG --variable=mapdir fontutil`
1360023b3b36Smrg	AC_SUBST(MAPFILES_PATH)
1361023b3b36Smrg	AC_MSG_RESULT([${MAPFILES_PATH}])
1362023b3b36Smrg])
1363023b3b36Smrg
1364023b3b36Smrg
1365023b3b36Smrg
1366023b3b36Smrg# XORG_FONT_FC_CONFDIR()
1367023b3b36Smrg# --------------------
1368023b3b36Smrg# Minimum version: 1.2.0
1369023b3b36Smrg#
1370023b3b36Smrg# Sets FC_CONFDIR to the fontconfig config directory
1371023b3b36Smrg# (which should be --with-confdir=... when building fontconfig)
1372023b3b36Smrg# found from:
1373023b3b36Smrg#	--with-fc-confdir=...
1374023b3b36Smrg#	pkg-config --variable=confdir fontconfig
1375023b3b36Smrg#	${sysconfdir}/fonts
1376023b3b36Smrg
1377023b3b36SmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
1378023b3b36Smrg	dnl Ensure $PKG_CONFIG is set first
1379023b3b36Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1380023b3b36Smrg
1381023b3b36Smrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
1382023b3b36Smrg	AC_ARG_WITH(fc-confdir,
1383023b3b36Smrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
1384023b3b36Smrg			   [Path to fontconfig's configuration directory]),
1385023b3b36Smrg		    [FC_CONFDIR="$withval"])
1386023b3b36Smrg	# if --with-fc-confdir was not specified
1387023b3b36Smrg	if test "x${FC_CONFDIR}" = "x"; then
1388023b3b36Smrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
1389023b3b36Smrg	fi
1390023b3b36Smrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
1391023b3b36Smrg	if test "x${FC_CONFDIR}" = "x"; then
1392023b3b36Smrg		FC_CONFDIR="${sysconfdir}/fonts"
1393023b3b36Smrg	fi
1394023b3b36Smrg	AC_SUBST(FC_CONFDIR)
1395023b3b36Smrg	AC_MSG_RESULT([${FC_CONFDIR}])
1396023b3b36Smrg])
1397023b3b36Smrg
1398023b3b36Smrg
1399023b3b36Smrg
1400023b3b36Smrg# XORG_FONTROOTDIR()
1401023b3b36Smrg# --------------------
1402023b3b36Smrg# Minimum version: 1.1.0
1403023b3b36Smrg#
1404023b3b36Smrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
1405023b3b36Smrg# found from:
1406023b3b36Smrg#	--with-fontrootdir
1407023b3b36Smrg#	pkg-config --variable=fontrootdir fontutil
1408023b3b36Smrg#	${datadir}/fonts/X11
1409023b3b36Smrg
1410023b3b36SmrgAC_DEFUN([XORG_FONTROOTDIR],[
1411023b3b36Smrg	dnl Ensure $PKG_CONFIG is set first
1412023b3b36Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1413023b3b36Smrg
1414023b3b36Smrg	AC_MSG_CHECKING([for root directory for font files])
1415023b3b36Smrg	AC_ARG_WITH(fontrootdir,
1416023b3b36Smrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
1417023b3b36Smrg			   [Path to root directory for font files]),
1418023b3b36Smrg		    [FONTROOTDIR="$withval"])
1419023b3b36Smrg	# if --with-fontrootdir not specified...
1420023b3b36Smrg	if test "x${FONTROOTDIR}" = "x"; then
1421023b3b36Smrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
1422023b3b36Smrg	fi
1423023b3b36Smrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
1424023b3b36Smrg	if test "x${FONTROOTDIR}" = "x"; then
1425023b3b36Smrg		FONTROOTDIR="${datadir}/fonts/X11"
1426023b3b36Smrg	fi
1427023b3b36Smrg	AC_SUBST(FONTROOTDIR)
1428023b3b36Smrg	AC_MSG_RESULT([${FONTROOTDIR}])
1429023b3b36Smrg])
1430023b3b36Smrg
1431023b3b36Smrg# XORG_FONTSUBDIR(variable, flag, subdir)
1432023b3b36Smrg# ---------------------------------------
1433023b3b36Smrg# Minimum version: 1.1.0
1434023b3b36Smrg#
1435023b3b36Smrg# Offer a --with-<flag> flag to control directory for font installation
1436023b3b36Smrg# Default is the specified <subdir> of the font root directory.
1437023b3b36Smrg# Sets <variable> to the selected directory
1438023b3b36Smrg
1439023b3b36SmrgAC_DEFUN([XORG_FONTSUBDIR],[
1440023b3b36Smrg	AC_REQUIRE([XORG_FONTROOTDIR])
1441023b3b36Smrg
1442023b3b36Smrg	AC_MSG_CHECKING([for directory for $3 files])
1443023b3b36Smrg	AC_ARG_WITH($2,
1444023b3b36Smrg		    [AS_HELP_STRING([--with-$2=DIR],
1445023b3b36Smrg				    [Path to $3 files [FONTROOTDIR/$3]])],
1446023b3b36Smrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
1447023b3b36Smrg	AC_SUBST($1)
1448023b3b36Smrg	AC_MSG_RESULT([${$1}])
1449023b3b36Smrg]) # XORG_FONTSUBDIR
1450023b3b36Smrg
1451023b3b36Smrg# XORG_FONTDIR(subdir)
1452023b3b36Smrg# --------------------
1453023b3b36Smrg# Minimum version: 1.1.0
1454023b3b36Smrg#
1455023b3b36Smrg# Offer a --with-fontdir flag to control directory for font installation
1456023b3b36Smrg# Default is the specified subdir of the font root directory.
1457023b3b36Smrg# Sets FONTDIR to the selected directory
1458023b3b36Smrg
1459023b3b36SmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
1460023b3b36Smrg
1461023b3b36Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1462023b3b36Smrgdnl
1463023b3b36Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
1464023b3b36Smrgdnl
1465023b3b36Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1466023b3b36Smrgdnl copy of this software and associated documentation files (the "Software"),
1467023b3b36Smrgdnl to deal in the Software without restriction, including without limitation
1468023b3b36Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1469023b3b36Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1470023b3b36Smrgdnl Software is furnished to do so, subject to the following conditions:
1471023b3b36Smrgdnl
1472023b3b36Smrgdnl The above copyright notice and this permission notice (including the next
1473023b3b36Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1474023b3b36Smrgdnl Software.
1475023b3b36Smrgdnl
1476023b3b36Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1477023b3b36Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1478023b3b36Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1479023b3b36Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1480023b3b36Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1481023b3b36Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1482023b3b36Smrgdnl DEALINGS IN THE SOFTWARE.
1483023b3b36Smrg
1484023b3b36Smrg# XORG_MACROS_VERSION(required-version)
1485023b3b36Smrg# -------------------------------------
1486023b3b36Smrg# Minimum version: 1.1.0
1487023b3b36Smrg#
1488023b3b36Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1489023b3b36Smrg# your configure.ac with the minimum required version, such as:
1490023b3b36Smrg# XORG_MACROS_VERSION(1.1)
1491023b3b36Smrg#
1492023b3b36Smrg# To ensure that this macro is defined, also add:
1493023b3b36Smrg# m4_ifndef([XORG_MACROS_VERSION],
1494023b3b36Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1495023b3b36Smrg#
1496023b3b36Smrg#
1497023b3b36Smrg# See the "minimum version" comment for each macro you use to see what
1498023b3b36Smrg# version you require.
1499023b3b36Smrgm4_defun([XORG_MACROS_VERSION],[
1500023b3b36Smrgm4_define([vers_have], [1.20.0])
1501023b3b36Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1502023b3b36Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1503023b3b36Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1504023b3b36Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1505023b3b36Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1506023b3b36Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1507023b3b36Smrgm4_undefine([vers_have])
1508023b3b36Smrgm4_undefine([maj_have])
1509023b3b36Smrgm4_undefine([maj_needed])
1510023b3b36Smrg]) # XORG_MACROS_VERSION
1511023b3b36Smrg
1512023b3b36Smrg# XORG_PROG_RAWCPP()
1513023b3b36Smrg# ------------------
1514023b3b36Smrg# Minimum version: 1.0.0
1515023b3b36Smrg#
1516023b3b36Smrg# Find cpp program and necessary flags for use in pre-processing text files
1517023b3b36Smrg# such as man pages and config files
1518023b3b36SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1519023b3b36SmrgAC_REQUIRE([AC_PROG_CPP])
1520023b3b36SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1521023b3b36Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1522023b3b36Smrg
1523023b3b36Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1524023b3b36Smrg# which is not the best choice for supporting other OS'es, but covers most
1525023b3b36Smrg# of the ones we need for now.
1526023b3b36SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1527023b3b36SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1528023b3b36Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1529023b3b36Smrg	AC_MSG_RESULT([no])
1530023b3b36Smrgelse
1531023b3b36Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1532023b3b36Smrg		RAWCPPFLAGS=-undef
1533023b3b36Smrg		AC_MSG_RESULT([yes])
1534023b3b36Smrg	# under Cygwin unix is still defined even with -undef
1535023b3b36Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1536023b3b36Smrg		RAWCPPFLAGS="-undef -ansi"
1537023b3b36Smrg		AC_MSG_RESULT([yes, with -ansi])
1538023b3b36Smrg	else
1539023b3b36Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1540023b3b36Smrg	fi
1541023b3b36Smrgfi
1542023b3b36Smrgrm -f conftest.$ac_ext
1543023b3b36Smrg
1544023b3b36SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1545023b3b36SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1546023b3b36Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1547023b3b36Smrg	AC_MSG_RESULT([no])
1548023b3b36Smrgelse
1549023b3b36Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1550023b3b36Smrg		TRADITIONALCPPFLAGS="-traditional"
1551023b3b36Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1552023b3b36Smrg		AC_MSG_RESULT([yes])
1553023b3b36Smrg	else
1554023b3b36Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1555023b3b36Smrg	fi
1556023b3b36Smrgfi
1557023b3b36Smrgrm -f conftest.$ac_ext
1558023b3b36SmrgAC_SUBST(RAWCPPFLAGS)
1559023b3b36SmrgAC_SUBST(TRADITIONALCPPFLAGS)
1560023b3b36Smrg]) # XORG_PROG_RAWCPP
1561023b3b36Smrg
1562023b3b36Smrg# XORG_MANPAGE_SECTIONS()
1563023b3b36Smrg# -----------------------
1564023b3b36Smrg# Minimum version: 1.0.0
1565023b3b36Smrg#
1566023b3b36Smrg# Determine which sections man pages go in for the different man page types
1567023b3b36Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1568023b3b36Smrg# Not sure if there's any better way than just hardcoding by OS name.
1569023b3b36Smrg# Override default settings by setting environment variables
1570023b3b36Smrg# Added MAN_SUBSTS in version 1.8
1571023b3b36Smrg# Added AC_PROG_SED in version 1.8
1572023b3b36Smrg
1573023b3b36SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1574023b3b36SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1575023b3b36SmrgAC_REQUIRE([AC_PROG_SED])
1576023b3b36Smrg
1577023b3b36Smrgcase $host_os in
1578023b3b36Smrg    solaris*)
1579023b3b36Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1580023b3b36Smrg        # check for a man page file found in later versions that use
1581023b3b36Smrg        # traditional section numbers instead
1582023b3b36Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1583023b3b36Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1584023b3b36Smrg        ;;
1585023b3b36Smrg    *) SYSV_MAN_SECTIONS=false ;;
1586023b3b36Smrgesac
1587023b3b36Smrg
1588023b3b36Smrgif test x$APP_MAN_SUFFIX = x    ; then
1589023b3b36Smrg    APP_MAN_SUFFIX=1
1590023b3b36Smrgfi
1591023b3b36Smrgif test x$APP_MAN_DIR = x    ; then
1592023b3b36Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1593023b3b36Smrgfi
1594023b3b36Smrg
1595023b3b36Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1596023b3b36Smrg    LIB_MAN_SUFFIX=3
1597023b3b36Smrgfi
1598023b3b36Smrgif test x$LIB_MAN_DIR = x    ; then
1599023b3b36Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1600023b3b36Smrgfi
1601023b3b36Smrg
1602023b3b36Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1603023b3b36Smrg    case $SYSV_MAN_SECTIONS in
1604023b3b36Smrg	true)				FILE_MAN_SUFFIX=4  ;;
1605023b3b36Smrg	*)				FILE_MAN_SUFFIX=5  ;;
1606023b3b36Smrg    esac
1607023b3b36Smrgfi
1608023b3b36Smrgif test x$FILE_MAN_DIR = x    ; then
1609023b3b36Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1610023b3b36Smrgfi
1611023b3b36Smrg
1612023b3b36Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1613023b3b36Smrg    case $SYSV_MAN_SECTIONS in
1614023b3b36Smrg	true)				MISC_MAN_SUFFIX=5  ;;
1615023b3b36Smrg	*)				MISC_MAN_SUFFIX=7  ;;
1616023b3b36Smrg    esac
1617023b3b36Smrgfi
1618023b3b36Smrgif test x$MISC_MAN_DIR = x    ; then
1619023b3b36Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1620023b3b36Smrgfi
1621023b3b36Smrg
1622023b3b36Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1623023b3b36Smrg    case $SYSV_MAN_SECTIONS in
1624023b3b36Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1625023b3b36Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1626023b3b36Smrg    esac
1627023b3b36Smrgfi
1628023b3b36Smrgif test x$DRIVER_MAN_DIR = x    ; then
1629023b3b36Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1630023b3b36Smrgfi
1631023b3b36Smrg
1632023b3b36Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1633023b3b36Smrg    case $SYSV_MAN_SECTIONS in
1634023b3b36Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1635023b3b36Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
1636023b3b36Smrg    esac
1637023b3b36Smrgfi
1638023b3b36Smrgif test x$ADMIN_MAN_DIR = x    ; then
1639023b3b36Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1640023b3b36Smrgfi
1641023b3b36Smrg
1642023b3b36Smrg
1643023b3b36SmrgAC_SUBST([APP_MAN_SUFFIX])
1644023b3b36SmrgAC_SUBST([LIB_MAN_SUFFIX])
1645023b3b36SmrgAC_SUBST([FILE_MAN_SUFFIX])
1646023b3b36SmrgAC_SUBST([MISC_MAN_SUFFIX])
1647023b3b36SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1648023b3b36SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1649023b3b36SmrgAC_SUBST([APP_MAN_DIR])
1650023b3b36SmrgAC_SUBST([LIB_MAN_DIR])
1651023b3b36SmrgAC_SUBST([FILE_MAN_DIR])
1652023b3b36SmrgAC_SUBST([MISC_MAN_DIR])
1653023b3b36SmrgAC_SUBST([DRIVER_MAN_DIR])
1654023b3b36SmrgAC_SUBST([ADMIN_MAN_DIR])
1655023b3b36Smrg
1656023b3b36SmrgXORG_MAN_PAGE="X Version 11"
1657023b3b36SmrgAC_SUBST([XORG_MAN_PAGE])
1658023b3b36SmrgMAN_SUBSTS="\
1659023b3b36Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1660023b3b36Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1661023b3b36Smrg	-e 's|__xservername__|Xorg|g' \
1662023b3b36Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1663023b3b36Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1664023b3b36Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1665023b3b36Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1666023b3b36Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1667023b3b36Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1668023b3b36Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1669023b3b36Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1670023b3b36Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1671023b3b36SmrgAC_SUBST([MAN_SUBSTS])
1672023b3b36Smrg
1673023b3b36Smrg]) # XORG_MANPAGE_SECTIONS
1674023b3b36Smrg
1675023b3b36Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1676023b3b36Smrg# ------------------------
1677023b3b36Smrg# Minimum version: 1.7.0
1678023b3b36Smrg#
1679023b3b36Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1680023b3b36Smrg# provided by xorg-sgml-doctools, if installed.
1681023b3b36SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1682023b3b36SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1683023b3b36SmrgXORG_SGML_PATH=
1684023b3b36SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1685023b3b36Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1686023b3b36Smrg    [m4_ifval([$1],[:],
1687023b3b36Smrg        [if test x"$cross_compiling" != x"yes" ; then
1688023b3b36Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1689023b3b36Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1690023b3b36Smrg         fi])
1691023b3b36Smrg    ])
1692023b3b36Smrg
1693023b3b36Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1694023b3b36Smrg# the path and the name of the doc stylesheet
1695023b3b36Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1696023b3b36Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1697023b3b36Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1698023b3b36Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1699023b3b36Smrgelse
1700023b3b36Smrg   AC_MSG_RESULT([no])
1701023b3b36Smrgfi
1702023b3b36Smrg
1703023b3b36SmrgAC_SUBST(XORG_SGML_PATH)
1704023b3b36SmrgAC_SUBST(STYLESHEET_SRCDIR)
1705023b3b36SmrgAC_SUBST(XSL_STYLESHEET)
1706023b3b36SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1707023b3b36Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1708023b3b36Smrg
1709023b3b36Smrg# XORG_CHECK_LINUXDOC
1710023b3b36Smrg# -------------------
1711023b3b36Smrg# Minimum version: 1.0.0
1712023b3b36Smrg#
1713023b3b36Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1714023b3b36Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1715023b3b36Smrg# Whether or not the necessary tools and files are found can be checked
1716023b3b36Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1717023b3b36SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1718023b3b36SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1719023b3b36SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1720023b3b36Smrg
1721023b3b36SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1722023b3b36Smrg
1723023b3b36SmrgAC_MSG_CHECKING([whether to build documentation])
1724023b3b36Smrg
1725023b3b36Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1726023b3b36Smrg   BUILDDOC=yes
1727023b3b36Smrgelse
1728023b3b36Smrg   BUILDDOC=no
1729023b3b36Smrgfi
1730023b3b36Smrg
1731023b3b36SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1732023b3b36Smrg
1733023b3b36SmrgAC_MSG_RESULT([$BUILDDOC])
1734023b3b36Smrg
1735023b3b36SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1736023b3b36Smrg
1737023b3b36Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1738023b3b36Smrg   BUILDPDFDOC=yes
1739023b3b36Smrgelse
1740023b3b36Smrg   BUILDPDFDOC=no
1741023b3b36Smrgfi
1742023b3b36Smrg
1743023b3b36SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1744023b3b36Smrg
1745023b3b36SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1746023b3b36Smrg
1747023b3b36SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1748023b3b36SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1749023b3b36SmrgMAKE_PDF="$PS2PDF"
1750023b3b36SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1751023b3b36Smrg
1752023b3b36SmrgAC_SUBST(MAKE_TEXT)
1753023b3b36SmrgAC_SUBST(MAKE_PS)
1754023b3b36SmrgAC_SUBST(MAKE_PDF)
1755023b3b36SmrgAC_SUBST(MAKE_HTML)
1756023b3b36Smrg]) # XORG_CHECK_LINUXDOC
1757023b3b36Smrg
1758023b3b36Smrg# XORG_CHECK_DOCBOOK
1759023b3b36Smrg# -------------------
1760023b3b36Smrg# Minimum version: 1.0.0
1761023b3b36Smrg#
1762023b3b36Smrg# Checks for the ability to build output formats from SGML DocBook source.
1763023b3b36Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1764023b3b36Smrg# indicates whether the necessary tools and files are found and, if set,
1765023b3b36Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1766023b3b36SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1767023b3b36SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1768023b3b36Smrg
1769023b3b36SmrgBUILDTXTDOC=no
1770023b3b36SmrgBUILDPDFDOC=no
1771023b3b36SmrgBUILDPSDOC=no
1772023b3b36SmrgBUILDHTMLDOC=no
1773023b3b36Smrg
1774023b3b36SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1775023b3b36SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1776023b3b36SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1777023b3b36SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1778023b3b36Smrg
1779023b3b36SmrgAC_MSG_CHECKING([whether to build text documentation])
1780023b3b36Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1781023b3b36Smrg   test x$BUILD_TXTDOC != xno; then
1782023b3b36Smrg	BUILDTXTDOC=yes
1783023b3b36Smrgfi
1784023b3b36SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1785023b3b36SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1786023b3b36Smrg
1787023b3b36SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1788023b3b36Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1789023b3b36Smrg   test x$BUILD_PDFDOC != xno; then
1790023b3b36Smrg	BUILDPDFDOC=yes
1791023b3b36Smrgfi
1792023b3b36SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1793023b3b36SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1794023b3b36Smrg
1795023b3b36SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1796023b3b36Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1797023b3b36Smrg   test x$BUILD_PSDOC != xno; then
1798023b3b36Smrg	BUILDPSDOC=yes
1799023b3b36Smrgfi
1800023b3b36SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1801023b3b36SmrgAC_MSG_RESULT([$BUILDPSDOC])
1802023b3b36Smrg
1803023b3b36SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1804023b3b36Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1805023b3b36Smrg   test x$BUILD_HTMLDOC != xno; then
1806023b3b36Smrg	BUILDHTMLDOC=yes
1807023b3b36Smrgfi
1808023b3b36SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1809023b3b36SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1810023b3b36Smrg
1811023b3b36SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1812023b3b36SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1813023b3b36SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1814023b3b36SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1815023b3b36Smrg
1816023b3b36SmrgAC_SUBST(MAKE_TEXT)
1817023b3b36SmrgAC_SUBST(MAKE_PS)
1818023b3b36SmrgAC_SUBST(MAKE_PDF)
1819023b3b36SmrgAC_SUBST(MAKE_HTML)
1820023b3b36Smrg]) # XORG_CHECK_DOCBOOK
1821023b3b36Smrg
1822023b3b36Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1823023b3b36Smrg# ----------------
1824023b3b36Smrg# Minimum version: 1.5.0
1825023b3b36Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1826023b3b36Smrg#
1827023b3b36Smrg# Documentation tools are not always available on all platforms and sometimes
1828023b3b36Smrg# not at the appropriate level. This macro enables a module to test for the
1829023b3b36Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1830023b3b36Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
1831023b3b36Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1832023b3b36Smrg# --with-xmlto assumes 'auto'.
1833023b3b36Smrg#
1834023b3b36Smrg# Interface to module:
1835023b3b36Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1836023b3b36Smrg# XMLTO:	returns the path of the xmlto program found
1837023b3b36Smrg#		returns the path set by the user in the environment
1838023b3b36Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1839023b3b36Smrg#		'no' user instructs the module not to use xmlto
1840023b3b36Smrg#
1841023b3b36Smrg# Added in version 1.10.0
1842023b3b36Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1843023b3b36Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1844023b3b36Smrg#
1845023b3b36Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1846023b3b36Smrg#
1847023b3b36SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1848023b3b36SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1849023b3b36Smrgm4_define([_defopt], m4_default([$2], [auto]))
1850023b3b36SmrgAC_ARG_WITH(xmlto,
1851023b3b36Smrg	AS_HELP_STRING([--with-xmlto],
1852023b3b36Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1853023b3b36Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1854023b3b36Smrgm4_undefine([_defopt])
1855023b3b36Smrg
1856023b3b36Smrgif test "x$use_xmlto" = x"auto"; then
1857023b3b36Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1858023b3b36Smrg   if test "x$XMLTO" = "x"; then
1859023b3b36Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1860023b3b36Smrg	have_xmlto=no
1861023b3b36Smrg   else
1862023b3b36Smrg        have_xmlto=yes
1863023b3b36Smrg   fi
1864023b3b36Smrgelif test "x$use_xmlto" = x"yes" ; then
1865023b3b36Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1866023b3b36Smrg   if test "x$XMLTO" = "x"; then
1867023b3b36Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1868023b3b36Smrg   fi
1869023b3b36Smrg   have_xmlto=yes
1870023b3b36Smrgelif test "x$use_xmlto" = x"no" ; then
1871023b3b36Smrg   if test "x$XMLTO" != "x"; then
1872023b3b36Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1873023b3b36Smrg   fi
1874023b3b36Smrg   have_xmlto=no
1875023b3b36Smrgelse
1876023b3b36Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1877023b3b36Smrgfi
1878023b3b36Smrg
1879023b3b36Smrg# Test for a minimum version of xmlto, if provided.
1880023b3b36Smrgm4_ifval([$1],
1881023b3b36Smrg[if test "$have_xmlto" = yes; then
1882023b3b36Smrg    # scrape the xmlto version
1883023b3b36Smrg    AC_MSG_CHECKING([the xmlto version])
1884023b3b36Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1885023b3b36Smrg    AC_MSG_RESULT([$xmlto_version])
1886023b3b36Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1887023b3b36Smrg        [if test "x$use_xmlto" = xauto; then
1888023b3b36Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1889023b3b36Smrg            have_xmlto=no
1890023b3b36Smrg        else
1891023b3b36Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1892023b3b36Smrg        fi])
1893023b3b36Smrgfi])
1894023b3b36Smrg
1895023b3b36Smrg# Test for the ability of xmlto to generate a text target
1896023b3b36Smrg#
1897023b3b36Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
1898023b3b36Smrg# following test for empty XML docbook files.
1899023b3b36Smrg# For compatibility reasons use the following empty XML docbook file and if
1900023b3b36Smrg# it fails try it again with a non-empty XML file.
1901023b3b36Smrghave_xmlto_text=no
1902023b3b36Smrgcat > conftest.xml << "EOF"
1903023b3b36SmrgEOF
1904023b3b36SmrgAS_IF([test "$have_xmlto" = yes],
1905023b3b36Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1906023b3b36Smrg             [have_xmlto_text=yes],
1907023b3b36Smrg             [# Try it again with a non-empty XML file.
1908023b3b36Smrg              cat > conftest.xml << "EOF"
1909023b3b36Smrg<x></x>
1910023b3b36SmrgEOF
1911023b3b36Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1912023b3b36Smrg                    [have_xmlto_text=yes],
1913023b3b36Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
1914023b3b36Smrgrm -f conftest.xml
1915023b3b36SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1916023b3b36SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1917023b3b36Smrg]) # XORG_WITH_XMLTO
1918023b3b36Smrg
1919023b3b36Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1920023b3b36Smrg# --------------------------------------------
1921023b3b36Smrg# Minimum version: 1.12.0
1922023b3b36Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1923023b3b36Smrg#
1924023b3b36Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1925023b3b36Smrg# XML-based language used for the transformation of XML documents.
1926023b3b36Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1927023b3b36Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1928023b3b36Smrg# The XSLT processor is often used as a standalone tool for transformations.
1929023b3b36Smrg# It should not be assumed that this tool is used only to work with documnetation.
1930023b3b36Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1931023b3b36Smrg#
1932023b3b36Smrg# Interface to module:
1933023b3b36Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1934023b3b36Smrg# XSLTPROC:	 returns the path of the xsltproc program found
1935023b3b36Smrg#		 returns the path set by the user in the environment
1936023b3b36Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1937023b3b36Smrg#		  'no' user instructs the module not to use xsltproc
1938023b3b36Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1939023b3b36Smrg#
1940023b3b36Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1941023b3b36Smrg#
1942023b3b36SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1943023b3b36SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1944023b3b36Smrg# Preserves the interface, should it be implemented later
1945023b3b36Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1946023b3b36Smrgm4_define([_defopt], m4_default([$2], [auto]))
1947023b3b36SmrgAC_ARG_WITH(xsltproc,
1948023b3b36Smrg	AS_HELP_STRING([--with-xsltproc],
1949023b3b36Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1950023b3b36Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1951023b3b36Smrgm4_undefine([_defopt])
1952023b3b36Smrg
1953023b3b36Smrgif test "x$use_xsltproc" = x"auto"; then
1954023b3b36Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1955023b3b36Smrg   if test "x$XSLTPROC" = "x"; then
1956023b3b36Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1957023b3b36Smrg	have_xsltproc=no
1958023b3b36Smrg   else
1959023b3b36Smrg        have_xsltproc=yes
1960023b3b36Smrg   fi
1961023b3b36Smrgelif test "x$use_xsltproc" = x"yes" ; then
1962023b3b36Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1963023b3b36Smrg   if test "x$XSLTPROC" = "x"; then
1964023b3b36Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1965023b3b36Smrg   fi
1966023b3b36Smrg   have_xsltproc=yes
1967023b3b36Smrgelif test "x$use_xsltproc" = x"no" ; then
1968023b3b36Smrg   if test "x$XSLTPROC" != "x"; then
1969023b3b36Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1970023b3b36Smrg   fi
1971023b3b36Smrg   have_xsltproc=no
1972023b3b36Smrgelse
1973023b3b36Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1974023b3b36Smrgfi
1975023b3b36Smrg
1976023b3b36SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1977023b3b36Smrg]) # XORG_WITH_XSLTPROC
1978023b3b36Smrg
1979023b3b36Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1980023b3b36Smrg# ----------------------------------------
1981023b3b36Smrg# Minimum version: 1.15.0
1982023b3b36Smrg#
1983023b3b36Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
1984023b3b36Smrg# scanning arbitrary text files, extracting information from those text files,
1985023b3b36Smrg# and printing reports based on that information.
1986023b3b36Smrg#
1987023b3b36Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1988023b3b36Smrg#
1989023b3b36Smrg# Interface to module:
1990023b3b36Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
1991023b3b36Smrg# PERL:	     returns the path of the perl program found
1992023b3b36Smrg#	     returns the path set by the user in the environment
1993023b3b36Smrg# --with-perl: 'yes' user instructs the module to use perl
1994023b3b36Smrg#	       'no' user instructs the module not to use perl
1995023b3b36Smrg# have_perl: returns yes if perl found in PATH or no
1996023b3b36Smrg#
1997023b3b36Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1998023b3b36Smrg#
1999023b3b36SmrgAC_DEFUN([XORG_WITH_PERL],[
2000023b3b36SmrgAC_ARG_VAR([PERL], [Path to perl command])
2001023b3b36Smrg# Preserves the interface, should it be implemented later
2002023b3b36Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
2003023b3b36Smrgm4_define([_defopt], m4_default([$2], [auto]))
2004023b3b36SmrgAC_ARG_WITH(perl,
2005023b3b36Smrg	AS_HELP_STRING([--with-perl],
2006023b3b36Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
2007023b3b36Smrg	   [use_perl=$withval], [use_perl=]_defopt)
2008023b3b36Smrgm4_undefine([_defopt])
2009023b3b36Smrg
2010023b3b36Smrgif test "x$use_perl" = x"auto"; then
2011023b3b36Smrg   AC_PATH_PROG([PERL], [perl])
2012023b3b36Smrg   if test "x$PERL" = "x"; then
2013023b3b36Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
2014023b3b36Smrg	have_perl=no
2015023b3b36Smrg   else
2016023b3b36Smrg        have_perl=yes
2017023b3b36Smrg   fi
2018023b3b36Smrgelif test "x$use_perl" = x"yes" ; then
2019023b3b36Smrg   AC_PATH_PROG([PERL], [perl])
2020023b3b36Smrg   if test "x$PERL" = "x"; then
2021023b3b36Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
2022023b3b36Smrg   fi
2023023b3b36Smrg   have_perl=yes
2024023b3b36Smrgelif test "x$use_perl" = x"no" ; then
2025023b3b36Smrg   if test "x$PERL" != "x"; then
2026023b3b36Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
2027023b3b36Smrg   fi
2028023b3b36Smrg   have_perl=no
2029023b3b36Smrgelse
2030023b3b36Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
2031023b3b36Smrgfi
2032023b3b36Smrg
2033023b3b36SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2034023b3b36Smrg]) # XORG_WITH_PERL
2035023b3b36Smrg
2036023b3b36Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2037023b3b36Smrg# ----------------
2038023b3b36Smrg# Minimum version: 1.5.0
2039023b3b36Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2040023b3b36Smrg#
2041023b3b36Smrg# Documentation tools are not always available on all platforms and sometimes
2042023b3b36Smrg# not at the appropriate level. This macro enables a module to test for the
2043023b3b36Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2044023b3b36Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
2045023b3b36Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2046023b3b36Smrg# --with-asciidoc assumes 'auto'.
2047023b3b36Smrg#
2048023b3b36Smrg# Interface to module:
2049023b3b36Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2050023b3b36Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
2051023b3b36Smrg#		 returns the path set by the user in the environment
2052023b3b36Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2053023b3b36Smrg#		  'no' user instructs the module not to use asciidoc
2054023b3b36Smrg#
2055023b3b36Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2056023b3b36Smrg#
2057023b3b36SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2058023b3b36SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2059023b3b36Smrgm4_define([_defopt], m4_default([$2], [auto]))
2060023b3b36SmrgAC_ARG_WITH(asciidoc,
2061023b3b36Smrg	AS_HELP_STRING([--with-asciidoc],
2062023b3b36Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2063023b3b36Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2064023b3b36Smrgm4_undefine([_defopt])
2065023b3b36Smrg
2066023b3b36Smrgif test "x$use_asciidoc" = x"auto"; then
2067023b3b36Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2068023b3b36Smrg   if test "x$ASCIIDOC" = "x"; then
2069023b3b36Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2070023b3b36Smrg	have_asciidoc=no
2071023b3b36Smrg   else
2072023b3b36Smrg        have_asciidoc=yes
2073023b3b36Smrg   fi
2074023b3b36Smrgelif test "x$use_asciidoc" = x"yes" ; then
2075023b3b36Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2076023b3b36Smrg   if test "x$ASCIIDOC" = "x"; then
2077023b3b36Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2078023b3b36Smrg   fi
2079023b3b36Smrg   have_asciidoc=yes
2080023b3b36Smrgelif test "x$use_asciidoc" = x"no" ; then
2081023b3b36Smrg   if test "x$ASCIIDOC" != "x"; then
2082023b3b36Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2083023b3b36Smrg   fi
2084023b3b36Smrg   have_asciidoc=no
2085023b3b36Smrgelse
2086023b3b36Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2087023b3b36Smrgfi
2088023b3b36Smrgm4_ifval([$1],
2089023b3b36Smrg[if test "$have_asciidoc" = yes; then
2090023b3b36Smrg    # scrape the asciidoc version
2091023b3b36Smrg    AC_MSG_CHECKING([the asciidoc version])
2092023b3b36Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2093023b3b36Smrg    AC_MSG_RESULT([$asciidoc_version])
2094023b3b36Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2095023b3b36Smrg        [if test "x$use_asciidoc" = xauto; then
2096023b3b36Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2097023b3b36Smrg            have_asciidoc=no
2098023b3b36Smrg        else
2099023b3b36Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2100023b3b36Smrg        fi])
2101023b3b36Smrgfi])
2102023b3b36SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2103023b3b36Smrg]) # XORG_WITH_ASCIIDOC
2104023b3b36Smrg
2105023b3b36Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
2106023b3b36Smrg# -------------------------------------------
2107023b3b36Smrg# Minimum version: 1.5.0
2108023b3b36Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2109023b3b36Smrg# Minimum version for optional DOT checking: 1.18.0
2110023b3b36Smrg#
2111023b3b36Smrg# Documentation tools are not always available on all platforms and sometimes
2112023b3b36Smrg# not at the appropriate level. This macro enables a module to test for the
2113023b3b36Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2114023b3b36Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
2115023b3b36Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2116023b3b36Smrg# --with-doxygen assumes 'auto'.
2117023b3b36Smrg#
2118023b3b36Smrg# Interface to module:
2119023b3b36Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2120023b3b36Smrg# DOXYGEN:	 returns the path of the doxygen program found
2121023b3b36Smrg#		 returns the path set by the user in the environment
2122023b3b36Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2123023b3b36Smrg#		  'no' user instructs the module not to use doxygen
2124023b3b36Smrg#
2125023b3b36Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2126023b3b36Smrg#
2127023b3b36SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2128023b3b36SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2129023b3b36SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
2130023b3b36Smrgm4_define([_defopt], m4_default([$2], [auto]))
2131023b3b36SmrgAC_ARG_WITH(doxygen,
2132023b3b36Smrg	AS_HELP_STRING([--with-doxygen],
2133023b3b36Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2134023b3b36Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2135023b3b36Smrgm4_undefine([_defopt])
2136023b3b36Smrg
2137023b3b36Smrgif test "x$use_doxygen" = x"auto"; then
2138023b3b36Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2139023b3b36Smrg   if test "x$DOXYGEN" = "x"; then
2140023b3b36Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2141023b3b36Smrg	have_doxygen=no
2142023b3b36Smrg   else
2143023b3b36Smrg        have_doxygen=yes
2144023b3b36Smrg   fi
2145023b3b36Smrgelif test "x$use_doxygen" = x"yes" ; then
2146023b3b36Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2147023b3b36Smrg   if test "x$DOXYGEN" = "x"; then
2148023b3b36Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2149023b3b36Smrg   fi
2150023b3b36Smrg   have_doxygen=yes
2151023b3b36Smrgelif test "x$use_doxygen" = x"no" ; then
2152023b3b36Smrg   if test "x$DOXYGEN" != "x"; then
2153023b3b36Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2154023b3b36Smrg   fi
2155023b3b36Smrg   have_doxygen=no
2156023b3b36Smrgelse
2157023b3b36Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2158023b3b36Smrgfi
2159023b3b36Smrgm4_ifval([$1],
2160023b3b36Smrg[if test "$have_doxygen" = yes; then
2161023b3b36Smrg    # scrape the doxygen version
2162023b3b36Smrg    AC_MSG_CHECKING([the doxygen version])
2163023b3b36Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2164023b3b36Smrg    AC_MSG_RESULT([$doxygen_version])
2165023b3b36Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2166023b3b36Smrg        [if test "x$use_doxygen" = xauto; then
2167023b3b36Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2168023b3b36Smrg            have_doxygen=no
2169023b3b36Smrg        else
2170023b3b36Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2171023b3b36Smrg        fi])
2172023b3b36Smrgfi])
2173023b3b36Smrg
2174023b3b36Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2175023b3b36Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2176023b3b36Smrgdnl 	HAVE_DOT = @HAVE_DOT@
2177023b3b36SmrgHAVE_DOT=no
2178023b3b36Smrgif test "x$have_doxygen" = "xyes"; then
2179023b3b36Smrg  AC_PATH_PROG([DOT], [dot])
2180023b3b36Smrg    if test "x$DOT" != "x"; then
2181023b3b36Smrg      HAVE_DOT=yes
2182023b3b36Smrg    fi
2183023b3b36Smrgfi
2184023b3b36Smrg
2185023b3b36SmrgAC_SUBST([HAVE_DOT])
2186023b3b36SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2187023b3b36SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2188023b3b36Smrg]) # XORG_WITH_DOXYGEN
2189023b3b36Smrg
2190023b3b36Smrg# XORG_WITH_GROFF([DEFAULT])
2191023b3b36Smrg# ----------------
2192023b3b36Smrg# Minimum version: 1.6.0
2193023b3b36Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2194023b3b36Smrg#
2195023b3b36Smrg# Documentation tools are not always available on all platforms and sometimes
2196023b3b36Smrg# not at the appropriate level. This macro enables a module to test for the
2197023b3b36Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2198023b3b36Smrg# the --with-groff option, it allows maximum flexibility in making decisions
2199023b3b36Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
2200023b3b36Smrg# --with-groff assumes 'auto'.
2201023b3b36Smrg#
2202023b3b36Smrg# Interface to module:
2203023b3b36Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2204023b3b36Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2205023b3b36Smrg# HAVE_GROFF_MS: the -ms macros package
2206023b3b36Smrg# GROFF:	 returns the path of the groff program found
2207023b3b36Smrg#		 returns the path set by the user in the environment
2208023b3b36Smrg# --with-groff:	 'yes' user instructs the module to use groff
2209023b3b36Smrg#		 'no' user instructs the module not to use groff
2210023b3b36Smrg#
2211023b3b36Smrg# Added in version 1.9.0:
2212023b3b36Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2213023b3b36Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2214023b3b36Smrg#		   psselect from the psutils package.
2215023b3b36Smrg#		   the ghostcript package. Refer to the grohtml man pages
2216023b3b36Smrg#
2217023b3b36Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2218023b3b36Smrg#
2219023b3b36Smrg# OS and distros often splits groff in a basic and full package, the former
2220023b3b36Smrg# having the groff program and the later having devices, fonts and macros
2221023b3b36Smrg# Checking for the groff executable is not enough.
2222023b3b36Smrg#
2223023b3b36Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
2224023b3b36Smrg# unset HAVE_GROFF or GROFF env variables.
2225023b3b36Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2226023b3b36Smrg#
2227023b3b36SmrgAC_DEFUN([XORG_WITH_GROFF],[
2228023b3b36SmrgAC_ARG_VAR([GROFF], [Path to groff command])
2229023b3b36Smrgm4_define([_defopt], m4_default([$1], [auto]))
2230023b3b36SmrgAC_ARG_WITH(groff,
2231023b3b36Smrg	AS_HELP_STRING([--with-groff],
2232023b3b36Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2233023b3b36Smrg	   [use_groff=$withval], [use_groff=]_defopt)
2234023b3b36Smrgm4_undefine([_defopt])
2235023b3b36Smrg
2236023b3b36Smrgif test "x$use_groff" = x"auto"; then
2237023b3b36Smrg   AC_PATH_PROG([GROFF], [groff])
2238023b3b36Smrg   if test "x$GROFF" = "x"; then
2239023b3b36Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2240023b3b36Smrg	have_groff=no
2241023b3b36Smrg   else
2242023b3b36Smrg        have_groff=yes
2243023b3b36Smrg   fi
2244023b3b36Smrgelif test "x$use_groff" = x"yes" ; then
2245023b3b36Smrg   AC_PATH_PROG([GROFF], [groff])
2246023b3b36Smrg   if test "x$GROFF" = "x"; then
2247023b3b36Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2248023b3b36Smrg   fi
2249023b3b36Smrg   have_groff=yes
2250023b3b36Smrgelif test "x$use_groff" = x"no" ; then
2251023b3b36Smrg   if test "x$GROFF" != "x"; then
2252023b3b36Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2253023b3b36Smrg   fi
2254023b3b36Smrg   have_groff=no
2255023b3b36Smrgelse
2256023b3b36Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2257023b3b36Smrgfi
2258023b3b36Smrg
2259023b3b36Smrg# We have groff, test for the presence of the macro packages
2260023b3b36Smrgif test "x$have_groff" = x"yes"; then
2261023b3b36Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2262023b3b36Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2263023b3b36Smrg        groff_ms_works=yes
2264023b3b36Smrg    else
2265023b3b36Smrg        groff_ms_works=no
2266023b3b36Smrg    fi
2267023b3b36Smrg    AC_MSG_RESULT([$groff_ms_works])
2268023b3b36Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2269023b3b36Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2270023b3b36Smrg        groff_mm_works=yes
2271023b3b36Smrg    else
2272023b3b36Smrg        groff_mm_works=no
2273023b3b36Smrg    fi
2274023b3b36Smrg    AC_MSG_RESULT([$groff_mm_works])
2275023b3b36Smrgfi
2276023b3b36Smrg
2277023b3b36Smrg# We have groff, test for HTML dependencies, one command per package
2278023b3b36Smrgif test "x$have_groff" = x"yes"; then
2279023b3b36Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2280023b3b36Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2281023b3b36Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2282023b3b36Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2283023b3b36Smrg      have_groff_html=yes
2284023b3b36Smrg   else
2285023b3b36Smrg      have_groff_html=no
2286023b3b36Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2287023b3b36Smrg   fi
2288023b3b36Smrgfi
2289023b3b36Smrg
2290023b3b36Smrg# Set Automake conditionals for Makefiles
2291023b3b36SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2292023b3b36SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2293023b3b36SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2294023b3b36SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2295023b3b36Smrg]) # XORG_WITH_GROFF
2296023b3b36Smrg
2297023b3b36Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2298023b3b36Smrg# ---------------------------------------
2299023b3b36Smrg# Minimum version: 1.6.0
2300023b3b36Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2301023b3b36Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2302023b3b36Smrg#
2303023b3b36Smrg# Documentation tools are not always available on all platforms and sometimes
2304023b3b36Smrg# not at the appropriate level. This macro enables a module to test for the
2305023b3b36Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2306023b3b36Smrg# the --with-fop option, it allows maximum flexibility in making decisions
2307023b3b36Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
2308023b3b36Smrg# --with-fop assumes 'auto'.
2309023b3b36Smrg#
2310023b3b36Smrg# Interface to module:
2311023b3b36Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2312023b3b36Smrg# FOP:	 	returns the path of the fop program found
2313023b3b36Smrg#		returns the path set by the user in the environment
2314023b3b36Smrg# --with-fop: 	'yes' user instructs the module to use fop
2315023b3b36Smrg#		'no' user instructs the module not to use fop
2316023b3b36Smrg#
2317023b3b36Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2318023b3b36Smrg#
2319023b3b36SmrgAC_DEFUN([XORG_WITH_FOP],[
2320023b3b36SmrgAC_ARG_VAR([FOP], [Path to fop command])
2321023b3b36Smrgm4_define([_defopt], m4_default([$2], [auto]))
2322023b3b36SmrgAC_ARG_WITH(fop,
2323023b3b36Smrg	AS_HELP_STRING([--with-fop],
2324023b3b36Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2325023b3b36Smrg	   [use_fop=$withval], [use_fop=]_defopt)
2326023b3b36Smrgm4_undefine([_defopt])
2327023b3b36Smrg
2328023b3b36Smrgif test "x$use_fop" = x"auto"; then
2329023b3b36Smrg   AC_PATH_PROG([FOP], [fop])
2330023b3b36Smrg   if test "x$FOP" = "x"; then
2331023b3b36Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2332023b3b36Smrg	have_fop=no
2333023b3b36Smrg   else
2334023b3b36Smrg        have_fop=yes
2335023b3b36Smrg   fi
2336023b3b36Smrgelif test "x$use_fop" = x"yes" ; then
2337023b3b36Smrg   AC_PATH_PROG([FOP], [fop])
2338023b3b36Smrg   if test "x$FOP" = "x"; then
2339023b3b36Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2340023b3b36Smrg   fi
2341023b3b36Smrg   have_fop=yes
2342023b3b36Smrgelif test "x$use_fop" = x"no" ; then
2343023b3b36Smrg   if test "x$FOP" != "x"; then
2344023b3b36Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2345023b3b36Smrg   fi
2346023b3b36Smrg   have_fop=no
2347023b3b36Smrgelse
2348023b3b36Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2349023b3b36Smrgfi
2350023b3b36Smrg
2351023b3b36Smrg# Test for a minimum version of fop, if provided.
2352023b3b36Smrgm4_ifval([$1],
2353023b3b36Smrg[if test "$have_fop" = yes; then
2354023b3b36Smrg    # scrape the fop version
2355023b3b36Smrg    AC_MSG_CHECKING([for fop minimum version])
2356023b3b36Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2357023b3b36Smrg    AC_MSG_RESULT([$fop_version])
2358023b3b36Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2359023b3b36Smrg        [if test "x$use_fop" = xauto; then
2360023b3b36Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2361023b3b36Smrg            have_fop=no
2362023b3b36Smrg        else
2363023b3b36Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2364023b3b36Smrg        fi])
2365023b3b36Smrgfi])
2366023b3b36SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2367023b3b36Smrg]) # XORG_WITH_FOP
2368023b3b36Smrg
2369023b3b36Smrg# XORG_WITH_M4([MIN-VERSION])
2370023b3b36Smrg# ---------------------------
2371023b3b36Smrg# Minimum version: 1.19.0
2372023b3b36Smrg#
2373023b3b36Smrg# This macro attempts to locate an m4 macro processor which supports
2374023b3b36Smrg# -I option and is only useful for modules relying on M4 in order to
2375023b3b36Smrg# expand macros in source code files.
2376023b3b36Smrg#
2377023b3b36Smrg# Interface to module:
2378023b3b36Smrg# M4:	 	returns the path of the m4 program found
2379023b3b36Smrg#		returns the path set by the user in the environment
2380023b3b36Smrg#
2381023b3b36SmrgAC_DEFUN([XORG_WITH_M4], [
2382023b3b36SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2383023b3b36Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2384023b3b36Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2385023b3b36Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2386023b3b36Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2387023b3b36Smrg   [$PATH:/usr/gnu/bin])])
2388023b3b36Smrg
2389023b3b36SmrgAC_SUBST([M4], [$ac_cv_path_M4])
2390023b3b36Smrg]) # XORG_WITH_M4
2391023b3b36Smrg
2392023b3b36Smrg# XORG_WITH_PS2PDF([DEFAULT])
2393023b3b36Smrg# ----------------
2394023b3b36Smrg# Minimum version: 1.6.0
2395023b3b36Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2396023b3b36Smrg#
2397023b3b36Smrg# Documentation tools are not always available on all platforms and sometimes
2398023b3b36Smrg# not at the appropriate level. This macro enables a module to test for the
2399023b3b36Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2400023b3b36Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
2401023b3b36Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2402023b3b36Smrg# --with-ps2pdf assumes 'auto'.
2403023b3b36Smrg#
2404023b3b36Smrg# Interface to module:
2405023b3b36Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2406023b3b36Smrg# PS2PDF:	returns the path of the ps2pdf program found
2407023b3b36Smrg#		returns the path set by the user in the environment
2408023b3b36Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2409023b3b36Smrg#		 'no' user instructs the module not to use ps2pdf
2410023b3b36Smrg#
2411023b3b36Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2412023b3b36Smrg#
2413023b3b36SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2414023b3b36SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2415023b3b36Smrgm4_define([_defopt], m4_default([$1], [auto]))
2416023b3b36SmrgAC_ARG_WITH(ps2pdf,
2417023b3b36Smrg	AS_HELP_STRING([--with-ps2pdf],
2418023b3b36Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2419023b3b36Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2420023b3b36Smrgm4_undefine([_defopt])
2421023b3b36Smrg
2422023b3b36Smrgif test "x$use_ps2pdf" = x"auto"; then
2423023b3b36Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2424023b3b36Smrg   if test "x$PS2PDF" = "x"; then
2425023b3b36Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2426023b3b36Smrg	have_ps2pdf=no
2427023b3b36Smrg   else
2428023b3b36Smrg        have_ps2pdf=yes
2429023b3b36Smrg   fi
2430023b3b36Smrgelif test "x$use_ps2pdf" = x"yes" ; then
2431023b3b36Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2432023b3b36Smrg   if test "x$PS2PDF" = "x"; then
2433023b3b36Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2434023b3b36Smrg   fi
2435023b3b36Smrg   have_ps2pdf=yes
2436023b3b36Smrgelif test "x$use_ps2pdf" = x"no" ; then
2437023b3b36Smrg   if test "x$PS2PDF" != "x"; then
2438023b3b36Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2439023b3b36Smrg   fi
2440023b3b36Smrg   have_ps2pdf=no
2441023b3b36Smrgelse
2442023b3b36Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2443023b3b36Smrgfi
2444023b3b36SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2445023b3b36Smrg]) # XORG_WITH_PS2PDF
2446023b3b36Smrg
2447023b3b36Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
2448023b3b36Smrg# ----------------
2449023b3b36Smrg# Minimum version: 1.6.0
2450023b3b36Smrg#
2451023b3b36Smrg# Documentation tools are not always available on all platforms and sometimes
2452023b3b36Smrg# not at the appropriate level. This macro enables a builder to skip all
2453023b3b36Smrg# documentation targets except traditional man pages.
2454023b3b36Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2455023b3b36Smrg# maximum flexibility in controlling documentation building.
2456023b3b36Smrg# Refer to:
2457023b3b36Smrg# XORG_WITH_XMLTO         --with-xmlto
2458023b3b36Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2459023b3b36Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2460023b3b36Smrg# XORG_WITH_FOP           --with-fop
2461023b3b36Smrg# XORG_WITH_GROFF         --with-groff
2462023b3b36Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2463023b3b36Smrg#
2464023b3b36Smrg# Interface to module:
2465023b3b36Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2466023b3b36Smrg# --enable-docs: 'yes' user instructs the module to generate docs
2467023b3b36Smrg#		 'no' user instructs the module not to generate docs
2468023b3b36Smrg# parm1:	specify the default value, yes or no.
2469023b3b36Smrg#
2470023b3b36SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2471023b3b36Smrgm4_define([docs_default], m4_default([$1], [yes]))
2472023b3b36SmrgAC_ARG_ENABLE(docs,
2473023b3b36Smrg	AS_HELP_STRING([--enable-docs],
2474023b3b36Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2475023b3b36Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2476023b3b36Smrgm4_undefine([docs_default])
2477023b3b36SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2478023b3b36SmrgAC_MSG_CHECKING([whether to build documentation])
2479023b3b36SmrgAC_MSG_RESULT([$build_docs])
2480023b3b36Smrg]) # XORG_ENABLE_DOCS
2481023b3b36Smrg
2482023b3b36Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2483023b3b36Smrg# ----------------
2484023b3b36Smrg# Minimum version: 1.6.0
2485023b3b36Smrg#
2486023b3b36Smrg# This macro enables a builder to skip all developer documentation.
2487023b3b36Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2488023b3b36Smrg# maximum flexibility in controlling documentation building.
2489023b3b36Smrg# Refer to:
2490023b3b36Smrg# XORG_WITH_XMLTO         --with-xmlto
2491023b3b36Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2492023b3b36Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2493023b3b36Smrg# XORG_WITH_FOP           --with-fop
2494023b3b36Smrg# XORG_WITH_GROFF         --with-groff
2495023b3b36Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2496023b3b36Smrg#
2497023b3b36Smrg# Interface to module:
2498023b3b36Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2499023b3b36Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2500023b3b36Smrg#			'no' user instructs the module not to generate developer docs
2501023b3b36Smrg# parm1:		specify the default value, yes or no.
2502023b3b36Smrg#
2503023b3b36SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2504023b3b36Smrgm4_define([devel_default], m4_default([$1], [yes]))
2505023b3b36SmrgAC_ARG_ENABLE(devel-docs,
2506023b3b36Smrg	AS_HELP_STRING([--enable-devel-docs],
2507023b3b36Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2508023b3b36Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2509023b3b36Smrgm4_undefine([devel_default])
2510023b3b36SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2511023b3b36SmrgAC_MSG_CHECKING([whether to build developer documentation])
2512023b3b36SmrgAC_MSG_RESULT([$build_devel_docs])
2513023b3b36Smrg]) # XORG_ENABLE_DEVEL_DOCS
2514023b3b36Smrg
2515023b3b36Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2516023b3b36Smrg# ----------------
2517023b3b36Smrg# Minimum version: 1.6.0
2518023b3b36Smrg#
2519023b3b36Smrg# This macro enables a builder to skip all functional specification targets.
2520023b3b36Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2521023b3b36Smrg# maximum flexibility in controlling documentation building.
2522023b3b36Smrg# Refer to:
2523023b3b36Smrg# XORG_WITH_XMLTO         --with-xmlto
2524023b3b36Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2525023b3b36Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2526023b3b36Smrg# XORG_WITH_FOP           --with-fop
2527023b3b36Smrg# XORG_WITH_GROFF         --with-groff
2528023b3b36Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2529023b3b36Smrg#
2530023b3b36Smrg# Interface to module:
2531023b3b36Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2532023b3b36Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2533023b3b36Smrg#			'no' user instructs the module not to generate specs
2534023b3b36Smrg# parm1:		specify the default value, yes or no.
2535023b3b36Smrg#
2536023b3b36SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2537023b3b36Smrgm4_define([spec_default], m4_default([$1], [yes]))
2538023b3b36SmrgAC_ARG_ENABLE(specs,
2539023b3b36Smrg	AS_HELP_STRING([--enable-specs],
2540023b3b36Smrg	   [Enable building the specs (default: ]spec_default[)]),
2541023b3b36Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2542023b3b36Smrgm4_undefine([spec_default])
2543023b3b36SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2544023b3b36SmrgAC_MSG_CHECKING([whether to build functional specifications])
2545023b3b36SmrgAC_MSG_RESULT([$build_specs])
2546023b3b36Smrg]) # XORG_ENABLE_SPECS
2547023b3b36Smrg
2548023b3b36Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2549023b3b36Smrg# ----------------------------------------------
2550023b3b36Smrg# Minimum version: 1.13.0
2551023b3b36Smrg#
2552023b3b36Smrg# This macro enables a builder to enable/disable unit testing
2553023b3b36Smrg# It makes no assumption about the test cases implementation
2554023b3b36Smrg# Test cases may or may not use Automake "Support for test suites"
2555023b3b36Smrg# They may or may not use the software utility library GLib
2556023b3b36Smrg#
2557023b3b36Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2558023b3b36Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2559023b3b36Smrg# The variable enable_unit_tests is used by other macros in this file.
2560023b3b36Smrg#
2561023b3b36Smrg# Interface to module:
2562023b3b36Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2563023b3b36Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2564023b3b36Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2565023b3b36Smrg#			'no' user instructs the module not to build tests
2566023b3b36Smrg# parm1:		specify the default value, yes or no.
2567023b3b36Smrg#
2568023b3b36SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2569023b3b36SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2570023b3b36SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2571023b3b36SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2572023b3b36Smrgm4_define([_defopt], m4_default([$1], [auto]))
2573023b3b36SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2574023b3b36Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2575023b3b36Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2576023b3b36Smrgm4_undefine([_defopt])
2577023b3b36SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2578023b3b36SmrgAC_MSG_CHECKING([whether to build unit test cases])
2579023b3b36SmrgAC_MSG_RESULT([$enable_unit_tests])
2580023b3b36Smrg]) # XORG_ENABLE_UNIT_TESTS
2581023b3b36Smrg
2582023b3b36Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2583023b3b36Smrg# ------------------------------------------------------
2584023b3b36Smrg# Minimum version: 1.17.0
2585023b3b36Smrg#
2586023b3b36Smrg# This macro enables a builder to enable/disable integration testing
2587023b3b36Smrg# It makes no assumption about the test cases' implementation
2588023b3b36Smrg# Test cases may or may not use Automake "Support for test suites"
2589023b3b36Smrg#
2590023b3b36Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2591023b3b36Smrg# usually requires less dependencies and may be built and run under less
2592023b3b36Smrg# stringent environments than integration tests.
2593023b3b36Smrg#
2594023b3b36Smrg# Interface to module:
2595023b3b36Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2596023b3b36Smrg# enable_integration_tests:   used in configure.ac for additional configuration
2597023b3b36Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2598023b3b36Smrg#                             'no' user instructs the module not to build tests
2599023b3b36Smrg# parm1:                      specify the default value, yes or no.
2600023b3b36Smrg#
2601023b3b36SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2602023b3b36SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2603023b3b36Smrgm4_define([_defopt], m4_default([$1], [auto]))
2604023b3b36SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2605023b3b36Smrg	[Enable building integration test cases (default: ]_defopt[)]),
2606023b3b36Smrg	[enable_integration_tests=$enableval],
2607023b3b36Smrg	[enable_integration_tests=]_defopt)
2608023b3b36Smrgm4_undefine([_defopt])
2609023b3b36SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2610023b3b36Smrg	[test "x$enable_integration_tests" != xno])
2611023b3b36SmrgAC_MSG_CHECKING([whether to build unit test cases])
2612023b3b36SmrgAC_MSG_RESULT([$enable_integration_tests])
2613023b3b36Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2614023b3b36Smrg
2615023b3b36Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2616023b3b36Smrg# ----------------------------------------
2617023b3b36Smrg# Minimum version: 1.13.0
2618023b3b36Smrg#
2619023b3b36Smrg# GLib is a library which provides advanced data structures and functions.
2620023b3b36Smrg# This macro enables a module to test for the presence of Glib.
2621023b3b36Smrg#
2622023b3b36Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2623023b3b36Smrg# Otherwise the value of $enable_unit_tests is blank.
2624023b3b36Smrg#
2625023b3b36Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2626023b3b36Smrg# test support usually requires less dependencies and may be built and run under
2627023b3b36Smrg# less stringent environments than integration tests.
2628023b3b36Smrg#
2629023b3b36Smrg# Interface to module:
2630023b3b36Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2631023b3b36Smrg# with_glib: used in configure.ac to know if GLib has been found
2632023b3b36Smrg# --with-glib:	'yes' user instructs the module to use glib
2633023b3b36Smrg#		'no' user instructs the module not to use glib
2634023b3b36Smrg#
2635023b3b36SmrgAC_DEFUN([XORG_WITH_GLIB],[
2636023b3b36SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2637023b3b36Smrgm4_define([_defopt], m4_default([$2], [auto]))
2638023b3b36SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2639023b3b36Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2640023b3b36Smrg	[with_glib=$withval], [with_glib=]_defopt)
2641023b3b36Smrgm4_undefine([_defopt])
2642023b3b36Smrg
2643023b3b36Smrghave_glib=no
2644023b3b36Smrg# Do not probe GLib if user explicitly disabled unit testing
2645023b3b36Smrgif test "x$enable_unit_tests" != x"no"; then
2646023b3b36Smrg  # Do not probe GLib if user explicitly disabled it
2647023b3b36Smrg  if test "x$with_glib" != x"no"; then
2648023b3b36Smrg    m4_ifval(
2649023b3b36Smrg      [$1],
2650023b3b36Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2651023b3b36Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2652023b3b36Smrg    )
2653023b3b36Smrg  fi
2654023b3b36Smrgfi
2655023b3b36Smrg
2656023b3b36Smrg# Not having GLib when unit testing has been explicitly requested is an error
2657023b3b36Smrgif test "x$enable_unit_tests" = x"yes"; then
2658023b3b36Smrg  if test "x$have_glib" = x"no"; then
2659023b3b36Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2660023b3b36Smrg  fi
2661023b3b36Smrgfi
2662023b3b36Smrg
2663023b3b36Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2664023b3b36Smrgif test "x$enable_unit_tests" = x"no"; then
2665023b3b36Smrg  if test "x$with_glib" = x"yes"; then
2666023b3b36Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2667023b3b36Smrg  fi
2668023b3b36Smrgfi
2669023b3b36Smrg
2670023b3b36Smrg# Not having GLib when it has been explicitly requested is an error
2671023b3b36Smrgif test "x$with_glib" = x"yes"; then
2672023b3b36Smrg  if test "x$have_glib" = x"no"; then
2673023b3b36Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2674023b3b36Smrg  fi
2675023b3b36Smrgfi
2676023b3b36Smrg
2677023b3b36SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2678023b3b36Smrg]) # XORG_WITH_GLIB
2679023b3b36Smrg
2680023b3b36Smrg# XORG_LD_WRAP([required|optional])
2681023b3b36Smrg# ---------------------------------
2682023b3b36Smrg# Minimum version: 1.13.0
2683023b3b36Smrg#
2684023b3b36Smrg# Check if linker supports -wrap, passed via compiler flags
2685023b3b36Smrg#
2686023b3b36Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2687023b3b36Smrg# Otherwise the value of $enable_unit_tests is blank.
2688023b3b36Smrg#
2689023b3b36Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2690023b3b36Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2691023b3b36Smrg# available, an argument of "optional" allows use when some unit tests require
2692023b3b36Smrg# ld -wrap and others do not.
2693023b3b36Smrg#
2694023b3b36SmrgAC_DEFUN([XORG_LD_WRAP],[
2695023b3b36SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2696023b3b36Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2697023b3b36Smrg                      void __wrap_exit(int status) { return; }],
2698023b3b36Smrg                     [exit(0);])])
2699023b3b36Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2700023b3b36Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2701023b3b36Smrg  if test "x$have_ld_wrap" = x"no"; then
2702023b3b36Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2703023b3b36Smrg  fi
2704023b3b36Smrgfi
2705023b3b36SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2706023b3b36Smrg#
2707023b3b36Smrg]) # XORG_LD_WRAP
2708023b3b36Smrg
2709023b3b36Smrg# XORG_CHECK_LINKER_FLAGS
2710023b3b36Smrg# -----------------------
2711023b3b36Smrg# SYNOPSIS
2712023b3b36Smrg#
2713023b3b36Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2714023b3b36Smrg#
2715023b3b36Smrg# DESCRIPTION
2716023b3b36Smrg#
2717023b3b36Smrg#   Check whether the given linker FLAGS work with the current language's
2718023b3b36Smrg#   linker, or whether they give an error.
2719023b3b36Smrg#
2720023b3b36Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2721023b3b36Smrg#   success/failure.
2722023b3b36Smrg#
2723023b3b36Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2724023b3b36Smrg#
2725023b3b36Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2726023b3b36Smrg#
2727023b3b36Smrg# LICENSE
2728023b3b36Smrg#
2729023b3b36Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2730023b3b36Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2731023b3b36Smrg#   Copyright (c) 2009 Matteo Frigo
2732023b3b36Smrg#
2733023b3b36Smrg#   This program is free software: you can redistribute it and/or modify it
2734023b3b36Smrg#   under the terms of the GNU General Public License as published by the
2735023b3b36Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2736023b3b36Smrg#   option) any later version.
2737023b3b36Smrg#
2738023b3b36Smrg#   This program is distributed in the hope that it will be useful, but
2739023b3b36Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2740023b3b36Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2741023b3b36Smrg#   Public License for more details.
2742023b3b36Smrg#
2743023b3b36Smrg#   You should have received a copy of the GNU General Public License along
2744023b3b36Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2745023b3b36Smrg#
2746023b3b36Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2747023b3b36Smrg#   gives unlimited permission to copy, distribute and modify the configure
2748023b3b36Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2749023b3b36Smrg#   need not follow the terms of the GNU General Public License when using
2750023b3b36Smrg#   or distributing such scripts, even though portions of the text of the
2751023b3b36Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2752023b3b36Smrg#   all other use of the material that constitutes the Autoconf Macro.
2753023b3b36Smrg#
2754023b3b36Smrg#   This special exception to the GPL applies to versions of the Autoconf
2755023b3b36Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2756023b3b36Smrg#   modified version of the Autoconf Macro, you may extend this special
2757023b3b36Smrg#   exception to the GPL to apply to your modified version as well.#
2758023b3b36SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2759023b3b36Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2760023b3b36Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2761023b3b36SmrgAS_LITERAL_IF([$1],
2762023b3b36Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2763023b3b36Smrg      ax_save_FLAGS=$LDFLAGS
2764023b3b36Smrg      LDFLAGS="$1"
2765023b3b36Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2766023b3b36Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2767023b3b36Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2768023b3b36Smrg      LDFLAGS=$ax_save_FLAGS])],
2769023b3b36Smrg  [ax_save_FLAGS=$LDFLAGS
2770023b3b36Smrg   LDFLAGS="$1"
2771023b3b36Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2772023b3b36Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2773023b3b36Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2774023b3b36Smrg   LDFLAGS=$ax_save_FLAGS])
2775023b3b36Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2776023b3b36SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2777023b3b36Smrgif test "x$xorg_check_linker_flags" = xyes; then
2778023b3b36Smrg	m4_default([$2], :)
2779023b3b36Smrgelse
2780023b3b36Smrg	m4_default([$3], :)
2781023b3b36Smrgfi
2782023b3b36Smrg]) # XORG_CHECK_LINKER_FLAGS
2783023b3b36Smrg
2784023b3b36Smrg# XORG_MEMORY_CHECK_FLAGS
2785023b3b36Smrg# -----------------------
2786023b3b36Smrg# Minimum version: 1.16.0
2787023b3b36Smrg#
2788023b3b36Smrg# This macro attempts to find appropriate memory checking functionality
2789023b3b36Smrg# for various platforms which unit testing code may use to catch various
2790023b3b36Smrg# forms of memory allocation and access errors in testing.
2791023b3b36Smrg#
2792023b3b36Smrg# Interface to module:
2793023b3b36Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2794023b3b36Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2795023b3b36Smrg#
2796023b3b36Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2797023b3b36Smrg#
2798023b3b36SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2799023b3b36Smrg
2800023b3b36SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2801023b3b36SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2802023b3b36Smrg           [Environment variables to enable memory checking in tests])
2803023b3b36Smrg
2804023b3b36Smrg# Check for different types of support on different platforms
2805023b3b36Smrgcase $host_os in
2806023b3b36Smrg    solaris*)
2807023b3b36Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2808023b3b36Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2809023b3b36Smrg        ;;
2810023b3b36Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2811023b3b36Smrg        # both directly and inverted, so should not be 0 or 255.
2812023b3b36Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2813023b3b36Smrg        ;;
2814023b3b36Smrg    darwin*)
2815023b3b36Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2816023b3b36Smrg        ;;
2817023b3b36Smrg    *bsd*)
2818023b3b36Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2819023b3b36Smrg        ;;
2820023b3b36Smrgesac
2821023b3b36Smrg
2822023b3b36Smrg# User supplied flags override default flags
2823023b3b36Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2824023b3b36Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2825023b3b36Smrgfi
2826023b3b36Smrg
2827023b3b36SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2828023b3b36Smrg]) # XORG_WITH_LINT
2829023b3b36Smrg
2830023b3b36Smrg# XORG_CHECK_MALLOC_ZERO
2831023b3b36Smrg# ----------------------
2832023b3b36Smrg# Minimum version: 1.0.0
2833023b3b36Smrg#
2834023b3b36Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2835023b3b36Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2836023b3b36Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2837023b3b36SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2838023b3b36SmrgAC_ARG_ENABLE(malloc0returnsnull,
2839023b3b36Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2840023b3b36Smrg		       [malloc(0) returns NULL (default: auto)]),
2841023b3b36Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2842023b3b36Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2843023b3b36Smrg
2844023b3b36SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2845023b3b36Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2846023b3b36SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
2847023b3b36Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2848023b3b36Smrg#include <stdlib.h>
2849023b3b36Smrg],[
2850023b3b36Smrg    char *m0, *r0, *c0, *p;
2851023b3b36Smrg    m0 = malloc(0);
2852023b3b36Smrg    p = malloc(10);
2853023b3b36Smrg    r0 = realloc(p,0);
2854023b3b36Smrg    c0 = calloc(0,10);
2855023b3b36Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2856023b3b36Smrg])],
2857023b3b36Smrg		[xorg_cv_malloc0_returns_null=yes],
2858023b3b36Smrg		[xorg_cv_malloc0_returns_null=no])])
2859023b3b36SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2860023b3b36Smrgfi
2861023b3b36SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2862023b3b36Smrg
2863023b3b36Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2864023b3b36Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2865023b3b36Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2866023b3b36Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2867023b3b36Smrgelse
2868023b3b36Smrg	MALLOC_ZERO_CFLAGS=""
2869023b3b36Smrg	XMALLOC_ZERO_CFLAGS=""
2870023b3b36Smrg	XTMALLOC_ZERO_CFLAGS=""
2871023b3b36Smrgfi
2872023b3b36Smrg
2873023b3b36SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2874023b3b36SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2875023b3b36SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2876023b3b36Smrg]) # XORG_CHECK_MALLOC_ZERO
2877023b3b36Smrg
2878023b3b36Smrg# XORG_WITH_LINT()
2879023b3b36Smrg# ----------------
2880023b3b36Smrg# Minimum version: 1.1.0
2881023b3b36Smrg#
2882023b3b36Smrg# This macro enables the use of a tool that flags some suspicious and
2883023b3b36Smrg# non-portable constructs (likely to be bugs) in C language source code.
2884023b3b36Smrg# It will attempt to locate the tool and use appropriate options.
2885023b3b36Smrg# There are various lint type tools on different platforms.
2886023b3b36Smrg#
2887023b3b36Smrg# Interface to module:
2888023b3b36Smrg# LINT:		returns the path to the tool found on the platform
2889023b3b36Smrg#		or the value set to LINT on the configure cmd line
2890023b3b36Smrg#		also an Automake conditional
2891023b3b36Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
2892023b3b36Smrg#
2893023b3b36Smrg# --with-lint:	'yes' user instructs the module to use lint
2894023b3b36Smrg#		'no' user instructs the module not to use lint (default)
2895023b3b36Smrg#
2896023b3b36Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2897023b3b36Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2898023b3b36Smrg#
2899023b3b36SmrgAC_DEFUN([XORG_WITH_LINT],[
2900023b3b36Smrg
2901023b3b36SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2902023b3b36SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2903023b3b36SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2904023b3b36Smrg		[Use a lint-style source code checker (default: disabled)])],
2905023b3b36Smrg		[use_lint=$withval], [use_lint=no])
2906023b3b36Smrg
2907023b3b36Smrg# Obtain platform specific info like program name and options
2908023b3b36Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2909023b3b36Smrgcase $host_os in
2910023b3b36Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2911023b3b36Smrg	lint_name=splint
2912023b3b36Smrg	lint_options="-badflag"
2913023b3b36Smrg	;;
2914023b3b36Smrg  *freebsd* | *netbsd*)
2915023b3b36Smrg	lint_name=lint
2916023b3b36Smrg	lint_options="-u -b"
2917023b3b36Smrg	;;
2918023b3b36Smrg  *solaris*)
2919023b3b36Smrg	lint_name=lint
2920023b3b36Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2921023b3b36Smrg	;;
2922023b3b36Smrgesac
2923023b3b36Smrg
2924023b3b36Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2925023b3b36Smrgif test "x$use_lint" = x"yes" ; then
2926023b3b36Smrg   AC_PATH_PROG([LINT], [$lint_name])
2927023b3b36Smrg   if test "x$LINT" = "x"; then
2928023b3b36Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2929023b3b36Smrg   fi
2930023b3b36Smrgelif test "x$use_lint" = x"no" ; then
2931023b3b36Smrg   if test "x$LINT" != "x"; then
2932023b3b36Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2933023b3b36Smrg   fi
2934023b3b36Smrgelse
2935023b3b36Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2936023b3b36Smrgfi
2937023b3b36Smrg
2938023b3b36Smrg# User supplied flags override default flags
2939023b3b36Smrgif test "x$LINT_FLAGS" != "x"; then
2940023b3b36Smrg   lint_options=$LINT_FLAGS
2941023b3b36Smrgfi
2942023b3b36Smrg
2943023b3b36SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2944023b3b36SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2945023b3b36Smrg
2946023b3b36Smrg]) # XORG_WITH_LINT
2947023b3b36Smrg
2948023b3b36Smrg# XORG_LINT_LIBRARY(LIBNAME)
2949023b3b36Smrg# --------------------------
2950023b3b36Smrg# Minimum version: 1.1.0
2951023b3b36Smrg#
2952023b3b36Smrg# Sets up flags for building lint libraries for checking programs that call
2953023b3b36Smrg# functions in the library.
2954023b3b36Smrg#
2955023b3b36Smrg# Interface to module:
2956023b3b36Smrg# LINTLIB		- Automake variable with the name of lint library file to make
2957023b3b36Smrg# MAKE_LINT_LIB		- Automake conditional
2958023b3b36Smrg#
2959023b3b36Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2960023b3b36Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2961023b3b36Smrg
2962023b3b36SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2963023b3b36SmrgAC_REQUIRE([XORG_WITH_LINT])
2964023b3b36SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2965023b3b36Smrg	[Create lint library (default: disabled)])],
2966023b3b36Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2967023b3b36Smrg
2968023b3b36Smrgif test "x$make_lint_lib" = x"yes" ; then
2969023b3b36Smrg   LINTLIB=llib-l$1.ln
2970023b3b36Smrg   if test "x$LINT" = "x"; then
2971023b3b36Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2972023b3b36Smrg   fi
2973023b3b36Smrgelif test "x$make_lint_lib" != x"no" ; then
2974023b3b36Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2975023b3b36Smrgfi
2976023b3b36Smrg
2977023b3b36SmrgAC_SUBST(LINTLIB)
2978023b3b36SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2979023b3b36Smrg
2980023b3b36Smrg]) # XORG_LINT_LIBRARY
2981023b3b36Smrg
2982023b3b36Smrg# XORG_COMPILER_BRAND
2983023b3b36Smrg# -------------------
2984023b3b36Smrg# Minimum version: 1.14.0
2985023b3b36Smrg#
2986023b3b36Smrg# Checks for various brands of compilers and sets flags as appropriate:
2987023b3b36Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2988023b3b36Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2989023b3b36Smrg#   clang compiler - sets CLANGCC to "yes"
2990023b3b36Smrg#   Intel compiler - sets INTELCC to "yes"
2991023b3b36Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2992023b3b36Smrg#
2993023b3b36SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2994023b3b36SmrgAC_LANG_CASE(
2995023b3b36Smrg	[C], [
2996023b3b36Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
2997023b3b36Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
2998023b3b36Smrg		m4_version_prereq([2.70],
2999023b3b36Smrg			[AC_REQUIRE([AC_PROG_CC])],
3000023b3b36Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3001023b3b36Smrg	],
3002023b3b36Smrg	[C++], [
3003023b3b36Smrg		AC_REQUIRE([AC_PROG_CXX])
3004023b3b36Smrg	]
3005023b3b36Smrg)
3006023b3b36SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
3007023b3b36SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
3008023b3b36SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
3009023b3b36Smrg]) # XORG_COMPILER_BRAND
3010023b3b36Smrg
3011023b3b36Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
3012023b3b36Smrg# ---------------
3013023b3b36Smrg# Minimum version: 1.16.0
3014023b3b36Smrg#
3015023b3b36Smrg# Test if the compiler works when passed the given flag as a command line argument.
3016023b3b36Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
3017023b3b36Smrg# next flag in the list until there are no more options.
3018023b3b36Smrg#
3019023b3b36Smrg# Note that this does not guarantee that the compiler supports the flag as some
3020023b3b36Smrg# compilers will simply ignore arguments that they do not understand, but we do
3021023b3b36Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
3022023b3b36Smrg# -Werror=unused-command-line-argument
3023023b3b36Smrg#
3024023b3b36SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
3025023b3b36Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3026023b3b36Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3027023b3b36Smrg
3028023b3b36SmrgAC_LANG_COMPILER_REQUIRE
3029023b3b36Smrg
3030023b3b36SmrgAC_LANG_CASE(
3031023b3b36Smrg	[C], [
3032023b3b36Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
3033023b3b36Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3034023b3b36Smrg		m4_version_prereq([2.70],
3035023b3b36Smrg			[AC_REQUIRE([AC_PROG_CC])],
3036023b3b36Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3037023b3b36Smrg		define([PREFIX], [C])
3038023b3b36Smrg		define([CACHE_PREFIX], [cc])
3039023b3b36Smrg		define([COMPILER], [$CC])
3040023b3b36Smrg	],
3041023b3b36Smrg	[C++], [
3042023b3b36Smrg		define([PREFIX], [CXX])
3043023b3b36Smrg		define([CACHE_PREFIX], [cxx])
3044023b3b36Smrg		define([COMPILER], [$CXX])
3045023b3b36Smrg	]
3046023b3b36Smrg)
3047023b3b36Smrg
3048023b3b36Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
3049023b3b36Smrg
3050023b3b36Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
3051023b3b36Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3052023b3b36Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
3053023b3b36Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3054023b3b36Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3055023b3b36Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
3056023b3b36Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
3057023b3b36Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
3058023b3b36Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3059023b3b36Smrgfi
3060023b3b36Smrg
3061023b3b36Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
3062023b3b36Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
3063023b3b36Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3064023b3b36Smrg	fi
3065023b3b36Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3066023b3b36Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
3067023b3b36Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3068023b3b36Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3069023b3b36Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
3070023b3b36Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
3071023b3b36Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
3072023b3b36Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3073023b3b36Smrgfi
3074023b3b36Smrg
3075023b3b36Smrgfound="no"
3076023b3b36Smrgm4_foreach([flag], m4_cdr($@), [
3077023b3b36Smrg	if test $found = "no" ; then
3078023b3b36Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
3079023b3b36Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3080023b3b36Smrg		fi
3081023b3b36Smrg
3082023b3b36Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
3083023b3b36Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3084023b3b36Smrg		fi
3085023b3b36Smrg
3086023b3b36Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
3087023b3b36Smrg
3088023b3b36Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
3089023b3b36Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
3090023b3b36Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
3091023b3b36Smrg		AC_CACHE_VAL($cacheid,
3092023b3b36Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3093023b3b36Smrg					     [eval $cacheid=yes],
3094023b3b36Smrg					     [eval $cacheid=no])])
3095023b3b36Smrg
3096023b3b36Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3097023b3b36Smrg
3098023b3b36Smrg		eval supported=\$$cacheid
3099023b3b36Smrg		AC_MSG_RESULT([$supported])
3100023b3b36Smrg		if test "$supported" = "yes" ; then
3101023b3b36Smrg			$1="$$1 ]flag["
3102023b3b36Smrg			found="yes"
3103023b3b36Smrg		fi
3104023b3b36Smrg	fi
3105023b3b36Smrg])
3106023b3b36Smrg]) # XORG_TESTSET_CFLAG
3107023b3b36Smrg
3108023b3b36Smrg# XORG_COMPILER_FLAGS
3109023b3b36Smrg# ---------------
3110023b3b36Smrg# Minimum version: 1.16.0
3111023b3b36Smrg#
3112023b3b36Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
3113023b3b36Smrg# arguments supported by the selected compiler which do NOT alter the generated
3114023b3b36Smrg# code.  These arguments will cause the compiler to print various warnings
3115023b3b36Smrg# during compilation AND turn a conservative set of warnings into errors.
3116023b3b36Smrg#
3117023b3b36Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
3118023b3b36Smrg# future versions of util-macros as options are added to new compilers.
3119023b3b36Smrg#
3120023b3b36SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
3121023b3b36SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3122023b3b36Smrg
3123023b3b36SmrgAC_ARG_ENABLE(selective-werror,
3124023b3b36Smrg              AS_HELP_STRING([--disable-selective-werror],
3125023b3b36Smrg                             [Turn off selective compiler errors. (default: enabled)]),
3126023b3b36Smrg              [SELECTIVE_WERROR=$enableval],
3127023b3b36Smrg              [SELECTIVE_WERROR=yes])
3128023b3b36Smrg
3129023b3b36SmrgAC_LANG_CASE(
3130023b3b36Smrg        [C], [
3131023b3b36Smrg                define([PREFIX], [C])
3132023b3b36Smrg        ],
3133023b3b36Smrg        [C++], [
3134023b3b36Smrg                define([PREFIX], [CXX])
3135023b3b36Smrg        ]
3136023b3b36Smrg)
3137023b3b36Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
3138023b3b36Smrgif test "x$SUNCC" = "xyes"; then
3139023b3b36Smrg    [BASE_]PREFIX[FLAGS]="-v"
3140023b3b36Smrgelse
3141023b3b36Smrg    [BASE_]PREFIX[FLAGS]=""
3142023b3b36Smrgfi
3143023b3b36Smrg
3144023b3b36Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3145023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
3146023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
3147023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
3148023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3149023b3b36Smrg
3150023b3b36SmrgAC_LANG_CASE(
3151023b3b36Smrg	[C], [
3152023b3b36Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
3153023b3b36Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
3154023b3b36Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
3155023b3b36Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
3156023b3b36Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
3157023b3b36Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
3158023b3b36Smrg	]
3159023b3b36Smrg)
3160023b3b36Smrg
3161023b3b36Smrg# This chunk adds additional warnings that could catch undesired effects.
3162023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
3163023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
3164023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
3165023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
3166023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
3167023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
3168023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3169023b3b36Smrg
3170023b3b36Smrg# These are currently disabled because they are noisy.  They will be enabled
3171023b3b36Smrg# in the future once the codebase is sufficiently modernized to silence
3172023b3b36Smrg# them.  For now, I don't want them to drown out the other warnings.
3173023b3b36Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3174023b3b36Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3175023b3b36Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3176023b3b36Smrg
3177023b3b36Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
3178023b3b36Smrg# when there are problems that should be fixed.
3179023b3b36Smrg
3180023b3b36Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3181023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3182023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3183023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3184023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3185023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3186023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3187023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3188023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3189023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3190023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3191023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3192023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3193023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3194023b3b36Smrgelse
3195023b3b36SmrgAC_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])
3196023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3197023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3198023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3199023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3200023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3201023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3202023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3203023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3204023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3205023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3206023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3207023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3208023b3b36SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3209023b3b36Smrgfi
3210023b3b36Smrg
3211023b3b36SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3212023b3b36Smrg]) # XORG_COMPILER_FLAGS
3213023b3b36Smrg
3214023b3b36Smrg# XORG_CWARNFLAGS
3215023b3b36Smrg# ---------------
3216023b3b36Smrg# Minimum version: 1.2.0
3217023b3b36Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3218023b3b36Smrg#
3219023b3b36Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3220023b3b36Smrg#
3221023b3b36Smrg# This function is deprecated because it defines -fno-strict-aliasing
3222023b3b36Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3223023b3b36Smrg# is needed, then it should be added explicitly in the module when
3224023b3b36Smrg# it is updated to use BASE_CFLAGS.
3225023b3b36Smrg#
3226023b3b36SmrgAC_DEFUN([XORG_CWARNFLAGS], [
3227023b3b36SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3228023b3b36SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3229023b3b36SmrgAC_LANG_CASE(
3230023b3b36Smrg	[C], [
3231023b3b36Smrg		CWARNFLAGS="$BASE_CFLAGS"
3232023b3b36Smrg		if  test "x$GCC" = xyes ; then
3233023b3b36Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3234023b3b36Smrg		fi
3235023b3b36Smrg		AC_SUBST(CWARNFLAGS)
3236023b3b36Smrg	]
3237023b3b36Smrg)
3238023b3b36Smrg]) # XORG_CWARNFLAGS
3239023b3b36Smrg
3240023b3b36Smrg# XORG_STRICT_OPTION
3241023b3b36Smrg# -----------------------
3242023b3b36Smrg# Minimum version: 1.3.0
3243023b3b36Smrg#
3244023b3b36Smrg# Add configure option to enable strict compilation flags, such as treating
3245023b3b36Smrg# warnings as fatal errors.
3246023b3b36Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3247023b3b36Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3248023b3b36Smrg#
3249023b3b36Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3250023b3b36Smrg# when strict compilation is unconditionally desired.
3251023b3b36SmrgAC_DEFUN([XORG_STRICT_OPTION], [
3252023b3b36SmrgAC_REQUIRE([XORG_CWARNFLAGS])
3253023b3b36SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3254023b3b36Smrg
3255023b3b36SmrgAC_ARG_ENABLE(strict-compilation,
3256023b3b36Smrg			  AS_HELP_STRING([--enable-strict-compilation],
3257023b3b36Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3258023b3b36Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3259023b3b36Smrg
3260023b3b36SmrgAC_LANG_CASE(
3261023b3b36Smrg        [C], [
3262023b3b36Smrg                define([PREFIX], [C])
3263023b3b36Smrg        ],
3264023b3b36Smrg        [C++], [
3265023b3b36Smrg                define([PREFIX], [CXX])
3266023b3b36Smrg        ]
3267023b3b36Smrg)
3268023b3b36Smrg
3269023b3b36Smrg[STRICT_]PREFIX[FLAGS]=""
3270023b3b36SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3271023b3b36SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3272023b3b36Smrg
3273023b3b36Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3274023b3b36Smrg# activate it with -Werror, so we add it here explicitly.
3275023b3b36SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3276023b3b36Smrg
3277023b3b36Smrgif test "x$STRICT_COMPILE" = "xyes"; then
3278023b3b36Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3279023b3b36Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3280023b3b36Smrgfi
3281023b3b36SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3282023b3b36SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3283023b3b36SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3284023b3b36Smrg]) # XORG_STRICT_OPTION
3285023b3b36Smrg
3286023b3b36Smrg# XORG_DEFAULT_NOCODE_OPTIONS
3287023b3b36Smrg# ---------------------------
3288023b3b36Smrg# Minimum version: 1.20.0
3289023b3b36Smrg#
3290023b3b36Smrg# Defines default options for X.Org modules which don't compile code,
3291023b3b36Smrg# such as fonts, bitmaps, cursors, and docs.
3292023b3b36Smrg#
3293023b3b36SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
3294023b3b36SmrgAC_REQUIRE([AC_PROG_INSTALL])
3295023b3b36SmrgXORG_RELEASE_VERSION
3296023b3b36SmrgXORG_CHANGELOG
3297023b3b36SmrgXORG_INSTALL
3298023b3b36SmrgXORG_MANPAGE_SECTIONS
3299023b3b36Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3300023b3b36Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3301023b3b36Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
3302023b3b36Smrg
3303023b3b36Smrg# XORG_DEFAULT_OPTIONS
3304023b3b36Smrg# --------------------
3305023b3b36Smrg# Minimum version: 1.3.0
3306023b3b36Smrg#
3307023b3b36Smrg# Defines default options for X.Org modules which compile code.
3308023b3b36Smrg#
3309023b3b36SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3310023b3b36SmrgAC_REQUIRE([AC_PROG_INSTALL])
3311023b3b36SmrgXORG_COMPILER_FLAGS
3312023b3b36SmrgXORG_CWARNFLAGS
3313023b3b36SmrgXORG_STRICT_OPTION
3314023b3b36SmrgXORG_DEFAULT_NOCODE_OPTIONS
3315023b3b36Smrg]) # XORG_DEFAULT_OPTIONS
3316023b3b36Smrg
3317023b3b36Smrg# XORG_INSTALL()
3318023b3b36Smrg# ----------------
3319023b3b36Smrg# Minimum version: 1.4.0
3320023b3b36Smrg#
3321023b3b36Smrg# Defines the variable INSTALL_CMD as the command to copy
3322023b3b36Smrg# INSTALL from $prefix/share/util-macros.
3323023b3b36Smrg#
3324023b3b36SmrgAC_DEFUN([XORG_INSTALL], [
3325023b3b36SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3326023b3b36Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3327023b3b36SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3328023b3b36Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3329023b3b36Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3330023b3b36Smrgtouch \$(top_srcdir)/INSTALL; \
3331023b3b36Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3332023b3b36SmrgAC_SUBST([INSTALL_CMD])
3333023b3b36Smrg]) # XORG_INSTALL
3334023b3b36Smrgdnl Copyright 2005 Red Hat, Inc
3335023b3b36Smrgdnl
3336023b3b36Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3337023b3b36Smrgdnl documentation for any purpose is hereby granted without fee, provided that
3338023b3b36Smrgdnl the above copyright notice appear in all copies and that both that
3339023b3b36Smrgdnl copyright notice and this permission notice appear in supporting
3340023b3b36Smrgdnl documentation.
3341023b3b36Smrgdnl
3342023b3b36Smrgdnl The above copyright notice and this permission notice shall be included
3343023b3b36Smrgdnl in all copies or substantial portions of the Software.
3344023b3b36Smrgdnl
3345023b3b36Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3346023b3b36Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3347023b3b36Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3348023b3b36Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3349023b3b36Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3350023b3b36Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3351023b3b36Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3352023b3b36Smrgdnl
3353023b3b36Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3354023b3b36Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3355023b3b36Smrgdnl other dealings in this Software without prior written authorization
3356023b3b36Smrgdnl from the copyright holders.
3357023b3b36Smrgdnl
3358023b3b36Smrg
3359023b3b36Smrg# XORG_RELEASE_VERSION
3360023b3b36Smrg# --------------------
3361023b3b36Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3362023b3b36Smrg
3363023b3b36SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3364023b3b36Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3365023b3b36Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3366023b3b36Smrg		[Major version of this package])
3367023b3b36Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3368023b3b36Smrg	if test "x$PVM" = "x"; then
3369023b3b36Smrg		PVM="0"
3370023b3b36Smrg	fi
3371023b3b36Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3372023b3b36Smrg		[$PVM],
3373023b3b36Smrg		[Minor version of this package])
3374023b3b36Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3375023b3b36Smrg	if test "x$PVP" = "x"; then
3376023b3b36Smrg		PVP="0"
3377023b3b36Smrg	fi
3378023b3b36Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3379023b3b36Smrg		[$PVP],
3380023b3b36Smrg		[Patch version of this package])
3381023b3b36Smrg])
3382023b3b36Smrg
3383023b3b36Smrg# XORG_CHANGELOG()
3384023b3b36Smrg# ----------------
3385023b3b36Smrg# Minimum version: 1.2.0
3386023b3b36Smrg#
3387023b3b36Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3388023b3b36Smrg# ChangeLog from git.
3389023b3b36Smrg#
3390023b3b36Smrg#
3391023b3b36SmrgAC_DEFUN([XORG_CHANGELOG], [
3392023b3b36SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3393023b3b36Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3394023b3b36Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3395023b3b36Smrgtouch \$(top_srcdir)/ChangeLog; \
3396023b3b36Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3397023b3b36SmrgAC_SUBST([CHANGELOG_CMD])
3398023b3b36Smrg]) # XORG_CHANGELOG
3399023b3b36Smrg
3400