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