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