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