1414cce6aSmrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2414cce6aSmrg
3414cce6aSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4ded1caa4Smrg
5ded1caa4Smrg# This file is free software; the Free Software Foundation
6ded1caa4Smrg# gives unlimited permission to copy and/or distribute it,
7ded1caa4Smrg# with or without modifications, as long as this notice is preserved.
8ded1caa4Smrg
9ded1caa4Smrg# This program is distributed in the hope that it will be useful,
10ded1caa4Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11ded1caa4Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12ded1caa4Smrg# PARTICULAR PURPOSE.
13ded1caa4Smrg
14414cce6aSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
1550539131Smrgm4_ifndef([AC_AUTOCONF_VERSION],
1650539131Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17414cce6aSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
18414cce6aSmrg[m4_warning([this file was generated for autoconf 2.71.
1950539131SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
2050539131SmrgIf you have problems, you may need to regenerate the build system entirely.
21414cce6aSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2244d8e951Smrg
23414cce6aSmrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2444d8e951Smrg#
25414cce6aSmrg# This file is free software; the Free Software Foundation
26414cce6aSmrg# gives unlimited permission to copy and/or distribute it,
27414cce6aSmrg# with or without modifications, as long as this notice is preserved.
2850539131Smrg
29414cce6aSmrg# AM_AUTOMAKE_VERSION(VERSION)
30414cce6aSmrg# ----------------------------
31414cce6aSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32414cce6aSmrg# generated from the m4 files accompanying Automake X.Y.
33414cce6aSmrg# (This private macro should not be called outside this file.)
34414cce6aSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35414cce6aSmrg[am__api_version='1.16'
36414cce6aSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37414cce6aSmrgdnl require some minimum version.  Point them to the right macro.
38414cce6aSmrgm4_if([$1], [1.16.5], [],
39414cce6aSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40414cce6aSmrg])
41ded1caa4Smrg
42414cce6aSmrg# _AM_AUTOCONF_VERSION(VERSION)
43414cce6aSmrg# -----------------------------
44414cce6aSmrg# aclocal traces this macro to find the Autoconf version.
45414cce6aSmrg# This is a private macro too.  Using m4_define simplifies
46414cce6aSmrg# the logic in aclocal, which can simply ignore this definition.
47414cce6aSmrgm4_define([_AM_AUTOCONF_VERSION], [])
48ded1caa4Smrg
49414cce6aSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50414cce6aSmrg# -------------------------------
51414cce6aSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52414cce6aSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53414cce6aSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54414cce6aSmrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
55414cce6aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
56414cce6aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57414cce6aSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58ded1caa4Smrg
59414cce6aSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60ded1caa4Smrg
61414cce6aSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
62414cce6aSmrg#
63414cce6aSmrg# This file is free software; the Free Software Foundation
64414cce6aSmrg# gives unlimited permission to copy and/or distribute it,
65414cce6aSmrg# with or without modifications, as long as this notice is preserved.
6644d8e951Smrg
67414cce6aSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68414cce6aSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69414cce6aSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70ded1caa4Smrg#
71414cce6aSmrg# Of course, Automake must honor this variable whenever it calls a
72414cce6aSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73414cce6aSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74414cce6aSmrg# depending on how configure is run.  This is pretty annoying, since
75414cce6aSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76414cce6aSmrg# source directory, any form will work fine, but in subdirectories a
77414cce6aSmrg# relative path needs to be adjusted first.
78ded1caa4Smrg#
79414cce6aSmrg# $ac_aux_dir/missing
80414cce6aSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81414cce6aSmrg# $top_srcdir/$ac_aux_dir/missing
82414cce6aSmrg#    fails if $ac_aux_dir is absolute,
83414cce6aSmrg#    fails when called from a subdirectory in a VPATH build with
84414cce6aSmrg#          a relative $ac_aux_dir
8550539131Smrg#
86414cce6aSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87414cce6aSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
88414cce6aSmrg# harmless because $srcdir is '.', but things will broke when you
89414cce6aSmrg# start a VPATH build or use an absolute $srcdir.
9044d8e951Smrg#
91414cce6aSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92414cce6aSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93414cce6aSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94414cce6aSmrg# and then we would define $MISSING as
95414cce6aSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96414cce6aSmrg# This will work as long as MISSING is not called from configure, because
97414cce6aSmrg# unfortunately $(top_srcdir) has no meaning in configure.
98414cce6aSmrg# However there are other variables, like CC, which are often used in
99414cce6aSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10044d8e951Smrg#
101414cce6aSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
102414cce6aSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
103414cce6aSmrg# configured tree to be moved without reconfiguration.
104414cce6aSmrg
105414cce6aSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106414cce6aSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107414cce6aSmrg# Expand $ac_aux_dir to an absolute path.
108414cce6aSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10944d8e951Smrg])
110ded1caa4Smrg
111414cce6aSmrg# Do all the work for Automake.                             -*- Autoconf -*-
112ded1caa4Smrg
113414cce6aSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
11450539131Smrg#
115414cce6aSmrg# This file is free software; the Free Software Foundation
116414cce6aSmrg# gives unlimited permission to copy and/or distribute it,
117414cce6aSmrg# with or without modifications, as long as this notice is preserved.
118ded1caa4Smrg
119414cce6aSmrg# This macro actually does too much.  Some checks are only needed if
120414cce6aSmrg# your package does certain things.  But this isn't really a big deal.
121ded1caa4Smrg
122414cce6aSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
123414cce6aSmrgm4_define([AC_PROG_CC],
124414cce6aSmrgm4_defn([AC_PROG_CC])
125414cce6aSmrg[_AM_PROG_CC_C_O
12644d8e951Smrg])
127ded1caa4Smrg
128414cce6aSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
129414cce6aSmrg# AM_INIT_AUTOMAKE([OPTIONS])
130414cce6aSmrg# -----------------------------------------------
131414cce6aSmrg# The call with PACKAGE and VERSION arguments is the old style
132414cce6aSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
133414cce6aSmrg# and VERSION should now be passed to AC_INIT and removed from
134414cce6aSmrg# the call to AM_INIT_AUTOMAKE.
135414cce6aSmrg# We support both call styles for the transition.  After
136414cce6aSmrg# the next Automake release, Autoconf can make the AC_INIT
137414cce6aSmrg# arguments mandatory, and then we can depend on a new Autoconf
138414cce6aSmrg# release and drop the old call support.
139414cce6aSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
140414cce6aSmrg[AC_PREREQ([2.65])dnl
141414cce6aSmrgm4_ifdef([_$0_ALREADY_INIT],
142414cce6aSmrg  [m4_fatal([$0 expanded multiple times
143414cce6aSmrg]m4_defn([_$0_ALREADY_INIT]))],
144414cce6aSmrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
145414cce6aSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
146414cce6aSmrgdnl the ones we care about.
147414cce6aSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
148414cce6aSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
149414cce6aSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
150414cce6aSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
151414cce6aSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
152414cce6aSmrg  # is not polluted with repeated "-I."
153414cce6aSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
154414cce6aSmrg  # test to see if srcdir already configured
155414cce6aSmrg  if test -f $srcdir/config.status; then
156414cce6aSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
157414cce6aSmrg  fi
158414cce6aSmrgfi
159ded1caa4Smrg
160414cce6aSmrg# test whether we have cygpath
161414cce6aSmrgif test -z "$CYGPATH_W"; then
162414cce6aSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
163414cce6aSmrg    CYGPATH_W='cygpath -w'
164414cce6aSmrg  else
165414cce6aSmrg    CYGPATH_W=echo
166414cce6aSmrg  fi
167414cce6aSmrgfi
168414cce6aSmrgAC_SUBST([CYGPATH_W])
16950539131Smrg
170414cce6aSmrg# Define the identity of the package.
171414cce6aSmrgdnl Distinguish between old-style and new-style calls.
172414cce6aSmrgm4_ifval([$2],
173414cce6aSmrg[AC_DIAGNOSE([obsolete],
174414cce6aSmrg             [$0: two- and three-arguments forms are deprecated.])
175414cce6aSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
176414cce6aSmrg AC_SUBST([PACKAGE], [$1])dnl
177414cce6aSmrg AC_SUBST([VERSION], [$2])],
178414cce6aSmrg[_AM_SET_OPTIONS([$1])dnl
179414cce6aSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
180414cce6aSmrgm4_if(
181414cce6aSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
182414cce6aSmrg  [ok:ok],,
183414cce6aSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
184414cce6aSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
185414cce6aSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
186ded1caa4Smrg
187414cce6aSmrg_AM_IF_OPTION([no-define],,
188414cce6aSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
189414cce6aSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
190ded1caa4Smrg
191414cce6aSmrg# Some tools Automake needs.
192414cce6aSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
193414cce6aSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
194414cce6aSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
195414cce6aSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
196414cce6aSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
197414cce6aSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
198414cce6aSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
199414cce6aSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
200414cce6aSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
201414cce6aSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
202414cce6aSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
203414cce6aSmrg# dies out for good.  For more background, see:
204414cce6aSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
205414cce6aSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
206414cce6aSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
207414cce6aSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
208414cce6aSmrg# system "awk" is bad on some platforms.
209414cce6aSmrgAC_REQUIRE([AC_PROG_AWK])dnl
210414cce6aSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
211414cce6aSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
212414cce6aSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
213414cce6aSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
214414cce6aSmrg			     [_AM_PROG_TAR([v7])])])
215414cce6aSmrg_AM_IF_OPTION([no-dependencies],,
216414cce6aSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
217414cce6aSmrg		  [_AM_DEPENDENCIES([CC])],
218414cce6aSmrg		  [m4_define([AC_PROG_CC],
219414cce6aSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
220414cce6aSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
221414cce6aSmrg		  [_AM_DEPENDENCIES([CXX])],
222414cce6aSmrg		  [m4_define([AC_PROG_CXX],
223414cce6aSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
224414cce6aSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
225414cce6aSmrg		  [_AM_DEPENDENCIES([OBJC])],
226414cce6aSmrg		  [m4_define([AC_PROG_OBJC],
227414cce6aSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
228414cce6aSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
229414cce6aSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
230414cce6aSmrg		  [m4_define([AC_PROG_OBJCXX],
231414cce6aSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
23250539131Smrg])
233414cce6aSmrg# Variables for tags utilities; see am/tags.am
234414cce6aSmrgif test -z "$CTAGS"; then
235414cce6aSmrg  CTAGS=ctags
236414cce6aSmrgfi
237414cce6aSmrgAC_SUBST([CTAGS])
238414cce6aSmrgif test -z "$ETAGS"; then
239414cce6aSmrg  ETAGS=etags
240414cce6aSmrgfi
241414cce6aSmrgAC_SUBST([ETAGS])
242414cce6aSmrgif test -z "$CSCOPE"; then
243414cce6aSmrg  CSCOPE=cscope
244414cce6aSmrgfi
245414cce6aSmrgAC_SUBST([CSCOPE])
24650539131Smrg
247414cce6aSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
248414cce6aSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
249414cce6aSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
250414cce6aSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
251414cce6aSmrgAC_CONFIG_COMMANDS_PRE(dnl
252414cce6aSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
253414cce6aSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
25450539131Smrg
255414cce6aSmrg# POSIX will say in a future version that running "rm -f" with no argument
256414cce6aSmrg# is OK; and we want to be able to make that assumption in our Makefile
257414cce6aSmrg# recipes.  So use an aggressive probe to check that the usage we want is
258414cce6aSmrg# actually supported "in the wild" to an acceptable degree.
259414cce6aSmrg# See automake bug#10828.
260414cce6aSmrg# To make any issue more visible, cause the running configure to be aborted
261414cce6aSmrg# by default if the 'rm' program in use doesn't match our expectations; the
262414cce6aSmrg# user can still override this though.
263414cce6aSmrgif rm -f && rm -fr && rm -rf; then : OK; else
264414cce6aSmrg  cat >&2 <<'END'
265414cce6aSmrgOops!
266414cce6aSmrg
267414cce6aSmrgYour 'rm' program seems unable to run without file operands specified
268414cce6aSmrgon the command line, even when the '-f' option is present.  This is contrary
269414cce6aSmrgto the behaviour of most rm programs out there, and not conforming with
270414cce6aSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
271414cce6aSmrg
272414cce6aSmrgPlease tell bug-automake@gnu.org about your system, including the value
273414cce6aSmrgof your $PATH and any error possibly output before this message.  This
274414cce6aSmrgcan help us improve future automake versions.
27550539131Smrg
276414cce6aSmrgEND
277414cce6aSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
278414cce6aSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
279414cce6aSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
280414cce6aSmrg    echo >&2
281414cce6aSmrg  else
282414cce6aSmrg    cat >&2 <<'END'
283414cce6aSmrgAborting the configuration process, to ensure you take notice of the issue.
28450539131Smrg
285414cce6aSmrgYou can download and install GNU coreutils to get an 'rm' implementation
286414cce6aSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
28744d8e951Smrg
288414cce6aSmrgIf you want to complete the configuration process using your problematic
289414cce6aSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
290414cce6aSmrgto "yes", and re-run configure.
291414cce6aSmrg
292414cce6aSmrgEND
293414cce6aSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
294414cce6aSmrg  fi
295414cce6aSmrgfi
296414cce6aSmrgdnl The trailing newline in this macro's definition is deliberate, for
297414cce6aSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
298414cce6aSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
29950539131Smrg])
30050539131Smrg
301414cce6aSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
302414cce6aSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
303414cce6aSmrgdnl mangled by Autoconf and run in a shell conditional statement.
304414cce6aSmrgm4_define([_AC_COMPILER_EXEEXT],
305414cce6aSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
30650539131Smrg
307414cce6aSmrg# When config.status generates a header, we must update the stamp-h file.
308414cce6aSmrg# This file resides in the same directory as the config header
309414cce6aSmrg# that is generated.  The stamp files are numbered to have different names.
31044d8e951Smrg
311414cce6aSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
312414cce6aSmrg# loop where config.status creates the headers, so we can generate
313414cce6aSmrg# our stamp files there.
314414cce6aSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
315414cce6aSmrg[# Compute $1's index in $config_headers.
316414cce6aSmrg_am_arg=$1
317414cce6aSmrg_am_stamp_count=1
318414cce6aSmrgfor _am_header in $config_headers :; do
319414cce6aSmrg  case $_am_header in
320414cce6aSmrg    $_am_arg | $_am_arg:* )
321414cce6aSmrg      break ;;
322414cce6aSmrg    * )
323414cce6aSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
324414cce6aSmrg  esac
325414cce6aSmrgdone
326414cce6aSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
32750539131Smrg
328414cce6aSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
329414cce6aSmrg#
330414cce6aSmrg# This file is free software; the Free Software Foundation
331414cce6aSmrg# gives unlimited permission to copy and/or distribute it,
332414cce6aSmrg# with or without modifications, as long as this notice is preserved.
33350539131Smrg
334414cce6aSmrg# AM_PROG_INSTALL_SH
335414cce6aSmrg# ------------------
336414cce6aSmrg# Define $install_sh.
337414cce6aSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
338414cce6aSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
339414cce6aSmrgif test x"${install_sh+set}" != xset; then
340414cce6aSmrg  case $am_aux_dir in
341414cce6aSmrg  *\ * | *\	*)
342414cce6aSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
343414cce6aSmrg  *)
344414cce6aSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
345414cce6aSmrg  esac
346414cce6aSmrgfi
347414cce6aSmrgAC_SUBST([install_sh])])
34850539131Smrg
349414cce6aSmrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
35050539131Smrg#
351414cce6aSmrg# This file is free software; the Free Software Foundation
352414cce6aSmrg# gives unlimited permission to copy and/or distribute it,
353414cce6aSmrg# with or without modifications, as long as this notice is preserved.
35450539131Smrg
355414cce6aSmrg# Check whether the underlying file-system supports filenames
356414cce6aSmrg# with a leading dot.  For instance MS-DOS doesn't.
357414cce6aSmrgAC_DEFUN([AM_SET_LEADING_DOT],
358414cce6aSmrg[rm -rf .tst 2>/dev/null
359414cce6aSmrgmkdir .tst 2>/dev/null
360414cce6aSmrgif test -d .tst; then
361414cce6aSmrg  am__leading_dot=.
362414cce6aSmrgelse
363414cce6aSmrg  am__leading_dot=_
364414cce6aSmrgfi
365414cce6aSmrgrmdir .tst 2>/dev/null
366414cce6aSmrgAC_SUBST([am__leading_dot])])
36750539131Smrg
368414cce6aSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
36944d8e951Smrg
370414cce6aSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
37150539131Smrg#
372414cce6aSmrg# This file is free software; the Free Software Foundation
373414cce6aSmrg# gives unlimited permission to copy and/or distribute it,
374414cce6aSmrg# with or without modifications, as long as this notice is preserved.
37550539131Smrg
376414cce6aSmrg# AM_MISSING_PROG(NAME, PROGRAM)
377414cce6aSmrg# ------------------------------
378414cce6aSmrgAC_DEFUN([AM_MISSING_PROG],
379414cce6aSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
380414cce6aSmrg$1=${$1-"${am_missing_run}$2"}
381414cce6aSmrgAC_SUBST($1)])
382414cce6aSmrg
383414cce6aSmrg# AM_MISSING_HAS_RUN
384414cce6aSmrg# ------------------
385414cce6aSmrg# Define MISSING if not defined so far and test if it is modern enough.
386414cce6aSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
387414cce6aSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
388414cce6aSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
389414cce6aSmrgAC_REQUIRE_AUX_FILE([missing])dnl
390414cce6aSmrgif test x"${MISSING+set}" != xset; then
391414cce6aSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
392414cce6aSmrgfi
393414cce6aSmrg# Use eval to expand $SHELL
394414cce6aSmrgif eval "$MISSING --is-lightweight"; then
395414cce6aSmrg  am_missing_run="$MISSING "
396414cce6aSmrgelse
397414cce6aSmrg  am_missing_run=
398414cce6aSmrg  AC_MSG_WARN(['missing' script is too old or missing])
399414cce6aSmrgfi
400414cce6aSmrg])
401414cce6aSmrg
402414cce6aSmrg# Helper functions for option handling.                     -*- Autoconf -*-
40350539131Smrg
404414cce6aSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
40544d8e951Smrg#
406414cce6aSmrg# This file is free software; the Free Software Foundation
407414cce6aSmrg# gives unlimited permission to copy and/or distribute it,
408414cce6aSmrg# with or without modifications, as long as this notice is preserved.
409414cce6aSmrg
410414cce6aSmrg# _AM_MANGLE_OPTION(NAME)
411414cce6aSmrg# -----------------------
412414cce6aSmrgAC_DEFUN([_AM_MANGLE_OPTION],
413414cce6aSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
414414cce6aSmrg
415414cce6aSmrg# _AM_SET_OPTION(NAME)
416414cce6aSmrg# --------------------
417414cce6aSmrg# Set option NAME.  Presently that only means defining a flag for this option.
418414cce6aSmrgAC_DEFUN([_AM_SET_OPTION],
419414cce6aSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
420414cce6aSmrg
421414cce6aSmrg# _AM_SET_OPTIONS(OPTIONS)
422414cce6aSmrg# ------------------------
423414cce6aSmrg# OPTIONS is a space-separated list of Automake options.
424414cce6aSmrgAC_DEFUN([_AM_SET_OPTIONS],
425414cce6aSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
426414cce6aSmrg
427414cce6aSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
428414cce6aSmrg# -------------------------------------------
429414cce6aSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
430414cce6aSmrgAC_DEFUN([_AM_IF_OPTION],
431414cce6aSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
432414cce6aSmrg
433414cce6aSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
434414cce6aSmrg
435414cce6aSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
43644d8e951Smrg#
437414cce6aSmrg# This file is free software; the Free Software Foundation
438414cce6aSmrg# gives unlimited permission to copy and/or distribute it,
439414cce6aSmrg# with or without modifications, as long as this notice is preserved.
440414cce6aSmrg
441414cce6aSmrg# AM_SANITY_CHECK
442414cce6aSmrg# ---------------
443414cce6aSmrgAC_DEFUN([AM_SANITY_CHECK],
444414cce6aSmrg[AC_MSG_CHECKING([whether build environment is sane])
445414cce6aSmrg# Reject unsafe characters in $srcdir or the absolute working directory
446414cce6aSmrg# name.  Accept space and tab only in the latter.
447414cce6aSmrgam_lf='
448414cce6aSmrg'
449414cce6aSmrgcase `pwd` in
450414cce6aSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
451414cce6aSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
452414cce6aSmrgesac
453414cce6aSmrgcase $srcdir in
454414cce6aSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
455414cce6aSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
456414cce6aSmrgesac
457414cce6aSmrg
458414cce6aSmrg# Do 'set' in a subshell so we don't clobber the current shell's
459414cce6aSmrg# arguments.  Must try -L first in case configure is actually a
460414cce6aSmrg# symlink; some systems play weird games with the mod time of symlinks
461414cce6aSmrg# (eg FreeBSD returns the mod time of the symlink's containing
462414cce6aSmrg# directory).
463414cce6aSmrgif (
464414cce6aSmrg   am_has_slept=no
465414cce6aSmrg   for am_try in 1 2; do
466414cce6aSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
467414cce6aSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
468414cce6aSmrg     if test "$[*]" = "X"; then
469414cce6aSmrg	# -L didn't work.
470414cce6aSmrg	set X `ls -t "$srcdir/configure" conftest.file`
471414cce6aSmrg     fi
472414cce6aSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
473414cce6aSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
474414cce6aSmrg
475414cce6aSmrg	# If neither matched, then we have a broken ls.  This can happen
476414cce6aSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
477414cce6aSmrg	# broken ls alias from the environment.  This has actually
478414cce6aSmrg	# happened.  Such a system could not be considered "sane".
479414cce6aSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
480414cce6aSmrg  alias in your environment])
481414cce6aSmrg     fi
482414cce6aSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
483414cce6aSmrg       break
484414cce6aSmrg     fi
485414cce6aSmrg     # Just in case.
486414cce6aSmrg     sleep 1
487414cce6aSmrg     am_has_slept=yes
488414cce6aSmrg   done
489414cce6aSmrg   test "$[2]" = conftest.file
490414cce6aSmrg   )
491414cce6aSmrgthen
492414cce6aSmrg   # Ok.
493414cce6aSmrg   :
494414cce6aSmrgelse
495414cce6aSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
496414cce6aSmrgCheck your system clock])
497414cce6aSmrgfi
498414cce6aSmrgAC_MSG_RESULT([yes])
499414cce6aSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
500414cce6aSmrg# generated files are strictly newer.
501414cce6aSmrgam_sleep_pid=
502414cce6aSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
503414cce6aSmrg  ( sleep 1 ) &
504414cce6aSmrg  am_sleep_pid=$!
505414cce6aSmrgfi
506414cce6aSmrgAC_CONFIG_COMMANDS_PRE(
507414cce6aSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
508414cce6aSmrg   if test -n "$am_sleep_pid"; then
509414cce6aSmrg     # Hide warnings about reused PIDs.
510414cce6aSmrg     wait $am_sleep_pid 2>/dev/null
511414cce6aSmrg   fi
512414cce6aSmrg   AC_MSG_RESULT([done])])
513414cce6aSmrgrm -f conftest.file
514414cce6aSmrg])
515414cce6aSmrg
516414cce6aSmrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
51744d8e951Smrg#
518414cce6aSmrg# This file is free software; the Free Software Foundation
519414cce6aSmrg# gives unlimited permission to copy and/or distribute it,
520414cce6aSmrg# with or without modifications, as long as this notice is preserved.
521414cce6aSmrg
522414cce6aSmrg# AM_SILENT_RULES([DEFAULT])
523414cce6aSmrg# --------------------------
524414cce6aSmrg# Enable less verbose build rules; with the default set to DEFAULT
525414cce6aSmrg# ("yes" being less verbose, "no" or empty being verbose).
526414cce6aSmrgAC_DEFUN([AM_SILENT_RULES],
527414cce6aSmrg[AC_ARG_ENABLE([silent-rules], [dnl
528414cce6aSmrgAS_HELP_STRING(
529414cce6aSmrg  [--enable-silent-rules],
530414cce6aSmrg  [less verbose build output (undo: "make V=1")])
531414cce6aSmrgAS_HELP_STRING(
532414cce6aSmrg  [--disable-silent-rules],
533414cce6aSmrg  [verbose build output (undo: "make V=0")])dnl
534414cce6aSmrg])
535414cce6aSmrgcase $enable_silent_rules in @%:@ (((
536414cce6aSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
537414cce6aSmrg   no) AM_DEFAULT_VERBOSITY=1;;
538414cce6aSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
539414cce6aSmrgesac
540414cce6aSmrgdnl
541414cce6aSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
542414cce6aSmrgdnl do not support nested variable expansions.
543414cce6aSmrgdnl See automake bug#9928 and bug#10237.
544414cce6aSmrgam_make=${MAKE-make}
545414cce6aSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
546414cce6aSmrg   [am_cv_make_support_nested_variables],
547414cce6aSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
548414cce6aSmrgBAR0=false
549414cce6aSmrgBAR1=true
550414cce6aSmrgV=1
551414cce6aSmrgam__doit:
552414cce6aSmrg	@$(TRUE)
553414cce6aSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
554414cce6aSmrg  am_cv_make_support_nested_variables=yes
555414cce6aSmrgelse
556414cce6aSmrg  am_cv_make_support_nested_variables=no
557414cce6aSmrgfi])
558414cce6aSmrgif test $am_cv_make_support_nested_variables = yes; then
559414cce6aSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
560414cce6aSmrg  AM_V='$(V)'
561414cce6aSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
562414cce6aSmrgelse
563414cce6aSmrg  AM_V=$AM_DEFAULT_VERBOSITY
564414cce6aSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
565414cce6aSmrgfi
566414cce6aSmrgAC_SUBST([AM_V])dnl
567414cce6aSmrgAM_SUBST_NOTMAKE([AM_V])dnl
568414cce6aSmrgAC_SUBST([AM_DEFAULT_V])dnl
569414cce6aSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
570414cce6aSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
571414cce6aSmrgAM_BACKSLASH='\'
572414cce6aSmrgAC_SUBST([AM_BACKSLASH])dnl
573414cce6aSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
574414cce6aSmrg])
575414cce6aSmrg
576414cce6aSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
57744d8e951Smrg#
578414cce6aSmrg# This file is free software; the Free Software Foundation
579414cce6aSmrg# gives unlimited permission to copy and/or distribute it,
580414cce6aSmrg# with or without modifications, as long as this notice is preserved.
58150539131Smrg
582414cce6aSmrg# AM_PROG_INSTALL_STRIP
583414cce6aSmrg# ---------------------
584414cce6aSmrg# One issue with vendor 'install' (even GNU) is that you can't
585414cce6aSmrg# specify the program used to strip binaries.  This is especially
586414cce6aSmrg# annoying in cross-compiling environments, where the build's strip
587414cce6aSmrg# is unlikely to handle the host's binaries.
588414cce6aSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
589414cce6aSmrg# always use install-sh in "make install-strip", and initialize
590414cce6aSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
591414cce6aSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
592414cce6aSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
593414cce6aSmrg# Installed binaries are usually stripped using 'strip' when the user
594414cce6aSmrg# run "make install-strip".  However 'strip' might not be the right
595414cce6aSmrg# tool to use in cross-compilation environments, therefore Automake
596414cce6aSmrg# will honor the 'STRIP' environment variable to overrule this program.
597414cce6aSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
598414cce6aSmrgif test "$cross_compiling" != no; then
599414cce6aSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
600414cce6aSmrgfi
601414cce6aSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
602414cce6aSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
603414cce6aSmrg
604414cce6aSmrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
605414cce6aSmrg#
606414cce6aSmrg# This file is free software; the Free Software Foundation
607414cce6aSmrg# gives unlimited permission to copy and/or distribute it,
608414cce6aSmrg# with or without modifications, as long as this notice is preserved.
609414cce6aSmrg
610414cce6aSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
611414cce6aSmrg# ---------------------------
612414cce6aSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
613414cce6aSmrg# This macro is traced by Automake.
614414cce6aSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
615414cce6aSmrg
616414cce6aSmrg# AM_SUBST_NOTMAKE(VARIABLE)
617414cce6aSmrg# --------------------------
618414cce6aSmrg# Public sister of _AM_SUBST_NOTMAKE.
619414cce6aSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
620414cce6aSmrg
621414cce6aSmrg# Check how to create a tarball.                            -*- Autoconf -*-
622414cce6aSmrg
623414cce6aSmrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
624414cce6aSmrg#
625414cce6aSmrg# This file is free software; the Free Software Foundation
626414cce6aSmrg# gives unlimited permission to copy and/or distribute it,
627414cce6aSmrg# with or without modifications, as long as this notice is preserved.
628414cce6aSmrg
629414cce6aSmrg# _AM_PROG_TAR(FORMAT)
630414cce6aSmrg# --------------------
631414cce6aSmrg# Check how to create a tarball in format FORMAT.
632414cce6aSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
633414cce6aSmrg#
634414cce6aSmrg# Substitute a variable $(am__tar) that is a command
635414cce6aSmrg# writing to stdout a FORMAT-tarball containing the directory
636414cce6aSmrg# $tardir.
637414cce6aSmrg#     tardir=directory && $(am__tar) > result.tar
638414cce6aSmrg#
639414cce6aSmrg# Substitute a variable $(am__untar) that extract such
640414cce6aSmrg# a tarball read from stdin.
641414cce6aSmrg#     $(am__untar) < result.tar
642414cce6aSmrg#
643414cce6aSmrgAC_DEFUN([_AM_PROG_TAR],
644414cce6aSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
645414cce6aSmrg# in the wild :-(  We should find a proper way to deprecate it ...
646414cce6aSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
647414cce6aSmrg
648414cce6aSmrg# We'll loop over all known methods to create a tar archive until one works.
649414cce6aSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
650414cce6aSmrg
651414cce6aSmrgm4_if([$1], [v7],
652414cce6aSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
653414cce6aSmrg
654414cce6aSmrg  [m4_case([$1],
655414cce6aSmrg    [ustar],
656414cce6aSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
657414cce6aSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
658414cce6aSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
659414cce6aSmrg      # and bug#13588).
660414cce6aSmrg      am_max_uid=2097151 # 2^21 - 1
661414cce6aSmrg      am_max_gid=$am_max_uid
662414cce6aSmrg      # The $UID and $GID variables are not portable, so we need to resort
663414cce6aSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
664414cce6aSmrg      # below are definitely unexpected, so allow the users to see them
665414cce6aSmrg      # (that is, avoid stderr redirection).
666414cce6aSmrg      am_uid=`id -u || echo unknown`
667414cce6aSmrg      am_gid=`id -g || echo unknown`
668414cce6aSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
669414cce6aSmrg      if test $am_uid -le $am_max_uid; then
670414cce6aSmrg         AC_MSG_RESULT([yes])
671414cce6aSmrg      else
672414cce6aSmrg         AC_MSG_RESULT([no])
673414cce6aSmrg         _am_tools=none
674414cce6aSmrg      fi
675414cce6aSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
676414cce6aSmrg      if test $am_gid -le $am_max_gid; then
677414cce6aSmrg         AC_MSG_RESULT([yes])
678414cce6aSmrg      else
679414cce6aSmrg        AC_MSG_RESULT([no])
680414cce6aSmrg        _am_tools=none
681414cce6aSmrg      fi],
682414cce6aSmrg
683414cce6aSmrg  [pax],
684414cce6aSmrg    [],
685414cce6aSmrg
686414cce6aSmrg  [m4_fatal([Unknown tar format])])
687414cce6aSmrg
688414cce6aSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
689414cce6aSmrg
690414cce6aSmrg  # Go ahead even if we have the value already cached.  We do so because we
691414cce6aSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
692414cce6aSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
693414cce6aSmrg
694414cce6aSmrg  for _am_tool in $_am_tools; do
695414cce6aSmrg    case $_am_tool in
696414cce6aSmrg    gnutar)
697414cce6aSmrg      for _am_tar in tar gnutar gtar; do
698414cce6aSmrg        AM_RUN_LOG([$_am_tar --version]) && break
699414cce6aSmrg      done
700414cce6aSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
701414cce6aSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
702414cce6aSmrg      am__untar="$_am_tar -xf -"
703414cce6aSmrg      ;;
704414cce6aSmrg    plaintar)
705414cce6aSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
706414cce6aSmrg      # ustar tarball either.
707414cce6aSmrg      (tar --version) >/dev/null 2>&1 && continue
708414cce6aSmrg      am__tar='tar chf - "$$tardir"'
709414cce6aSmrg      am__tar_='tar chf - "$tardir"'
710414cce6aSmrg      am__untar='tar xf -'
711414cce6aSmrg      ;;
712414cce6aSmrg    pax)
713414cce6aSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
714414cce6aSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
715414cce6aSmrg      am__untar='pax -r'
716414cce6aSmrg      ;;
717414cce6aSmrg    cpio)
718414cce6aSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
719414cce6aSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
720414cce6aSmrg      am__untar='cpio -i -H $1 -d'
721414cce6aSmrg      ;;
722414cce6aSmrg    none)
723414cce6aSmrg      am__tar=false
724414cce6aSmrg      am__tar_=false
725414cce6aSmrg      am__untar=false
726414cce6aSmrg      ;;
727414cce6aSmrg    esac
728414cce6aSmrg
729414cce6aSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
730414cce6aSmrg    # and am__untar set.
731414cce6aSmrg    test -n "${am_cv_prog_tar_$1}" && break
732414cce6aSmrg
733414cce6aSmrg    # tar/untar a dummy directory, and stop if the command works.
734414cce6aSmrg    rm -rf conftest.dir
735414cce6aSmrg    mkdir conftest.dir
736414cce6aSmrg    echo GrepMe > conftest.dir/file
737414cce6aSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
738414cce6aSmrg    rm -rf conftest.dir
739414cce6aSmrg    if test -s conftest.tar; then
740414cce6aSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
741414cce6aSmrg      AM_RUN_LOG([cat conftest.dir/file])
742414cce6aSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
743414cce6aSmrg    fi
744414cce6aSmrg  done
745414cce6aSmrg  rm -rf conftest.dir
746414cce6aSmrg
747414cce6aSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
748414cce6aSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
749414cce6aSmrg
750414cce6aSmrgAC_SUBST([am__tar])
751414cce6aSmrgAC_SUBST([am__untar])
752414cce6aSmrg]) # _AM_PROG_TAR
753414cce6aSmrg
754414cce6aSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
755414cce6aSmrgdnl serial 11 (pkg-config-0.29)
756414cce6aSmrgdnl
757414cce6aSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
758414cce6aSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
759414cce6aSmrgdnl
760414cce6aSmrgdnl This program is free software; you can redistribute it and/or modify
761414cce6aSmrgdnl it under the terms of the GNU General Public License as published by
762414cce6aSmrgdnl the Free Software Foundation; either version 2 of the License, or
763414cce6aSmrgdnl (at your option) any later version.
764414cce6aSmrgdnl
765414cce6aSmrgdnl This program is distributed in the hope that it will be useful, but
766414cce6aSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
767414cce6aSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
768414cce6aSmrgdnl General Public License for more details.
769414cce6aSmrgdnl
770414cce6aSmrgdnl You should have received a copy of the GNU General Public License
771414cce6aSmrgdnl along with this program; if not, write to the Free Software
772414cce6aSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
773414cce6aSmrgdnl 02111-1307, USA.
774414cce6aSmrgdnl
775414cce6aSmrgdnl As a special exception to the GNU General Public License, if you
776414cce6aSmrgdnl distribute this file as part of a program that contains a
777414cce6aSmrgdnl configuration script generated by Autoconf, you may include it under
778414cce6aSmrgdnl the same distribution terms that you use for the rest of that
779414cce6aSmrgdnl program.
780414cce6aSmrg
781414cce6aSmrgdnl PKG_PREREQ(MIN-VERSION)
782414cce6aSmrgdnl -----------------------
783414cce6aSmrgdnl Since: 0.29
784414cce6aSmrgdnl
785414cce6aSmrgdnl Verify that the version of the pkg-config macros are at least
786414cce6aSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
787414cce6aSmrgdnl installed version of pkg-config, this checks the developer's version
788414cce6aSmrgdnl of pkg.m4 when generating configure.
789414cce6aSmrgdnl
790414cce6aSmrgdnl To ensure that this macro is defined, also add:
791414cce6aSmrgdnl m4_ifndef([PKG_PREREQ],
792414cce6aSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
793414cce6aSmrgdnl
794414cce6aSmrgdnl See the "Since" comment for each macro you use to see what version
795414cce6aSmrgdnl of the macros you require.
796414cce6aSmrgm4_defun([PKG_PREREQ],
797414cce6aSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
798414cce6aSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
799414cce6aSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
800414cce6aSmrg])dnl PKG_PREREQ
801414cce6aSmrg
802414cce6aSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
803414cce6aSmrgdnl ----------------------------------
804414cce6aSmrgdnl Since: 0.16
805414cce6aSmrgdnl
806414cce6aSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
807414cce6aSmrgdnl first found in the path. Checks that the version of pkg-config found
808414cce6aSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
809414cce6aSmrgdnl used since that's the first version where most current features of
810414cce6aSmrgdnl pkg-config existed.
81144d8e951SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
81244d8e951Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
813414cce6aSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
814414cce6aSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
81544d8e951SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
81644d8e951SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
81744d8e951SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
81850539131Smrg
81944d8e951Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
82044d8e951Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
82150539131Smrgfi
82244d8e951Smrgif test -n "$PKG_CONFIG"; then
82344d8e951Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
82444d8e951Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
82544d8e951Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
82644d8e951Smrg		AC_MSG_RESULT([yes])
82744d8e951Smrg	else
82844d8e951Smrg		AC_MSG_RESULT([no])
82944d8e951Smrg		PKG_CONFIG=""
83044d8e951Smrg	fi
83144d8e951Smrgfi[]dnl
832414cce6aSmrg])dnl PKG_PROG_PKG_CONFIG
83350539131Smrg
834414cce6aSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
835414cce6aSmrgdnl -------------------------------------------------------------------
836414cce6aSmrgdnl Since: 0.18
837414cce6aSmrgdnl
838414cce6aSmrgdnl Check to see whether a particular set of modules exists. Similar to
839414cce6aSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
840414cce6aSmrgdnl
841414cce6aSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
842414cce6aSmrgdnl only at the first occurence in configure.ac, so if the first place
843414cce6aSmrgdnl it's called might be skipped (such as if it is within an "if", you
844414cce6aSmrgdnl have to call PKG_CHECK_EXISTS manually
84544d8e951SmrgAC_DEFUN([PKG_CHECK_EXISTS],
84644d8e951Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
84744d8e951Smrgif test -n "$PKG_CONFIG" && \
84844d8e951Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
84944d8e951Smrg  m4_default([$2], [:])
85044d8e951Smrgm4_ifvaln([$3], [else
85144d8e951Smrg  $3])dnl
85244d8e951Smrgfi])
85350539131Smrg
854414cce6aSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
855414cce6aSmrgdnl ---------------------------------------------
856414cce6aSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
857414cce6aSmrgdnl pkg_failed based on the result.
85844d8e951Smrgm4_define([_PKG_CONFIG],
85944d8e951Smrg[if test -n "$$1"; then
86044d8e951Smrg    pkg_cv_[]$1="$$1"
86144d8e951Smrg elif test -n "$PKG_CONFIG"; then
86244d8e951Smrg    PKG_CHECK_EXISTS([$3],
863414cce6aSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
864414cce6aSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
86544d8e951Smrg		     [pkg_failed=yes])
86644d8e951Smrg else
86744d8e951Smrg    pkg_failed=untried
86844d8e951Smrgfi[]dnl
869414cce6aSmrg])dnl _PKG_CONFIG
87050539131Smrg
871414cce6aSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
872414cce6aSmrgdnl ---------------------------
873414cce6aSmrgdnl Internal check to see if pkg-config supports short errors.
87444d8e951SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
87544d8e951Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
87644d8e951Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
87744d8e951Smrg        _pkg_short_errors_supported=yes
87844d8e951Smrgelse
87944d8e951Smrg        _pkg_short_errors_supported=no
88044d8e951Smrgfi[]dnl
881414cce6aSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
88250539131Smrg
88350539131Smrg
884414cce6aSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
885414cce6aSmrgdnl   [ACTION-IF-NOT-FOUND])
886414cce6aSmrgdnl --------------------------------------------------------------
887414cce6aSmrgdnl Since: 0.4.0
888414cce6aSmrgdnl
889414cce6aSmrgdnl Note that if there is a possibility the first call to
890414cce6aSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
891414cce6aSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
89244d8e951SmrgAC_DEFUN([PKG_CHECK_MODULES],
89344d8e951Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
89444d8e951SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
89544d8e951SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
89650539131Smrg
89744d8e951Smrgpkg_failed=no
89844d8e951SmrgAC_MSG_CHECKING([for $1])
89944d8e951Smrg
90044d8e951Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
90144d8e951Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
90244d8e951Smrg
90344d8e951Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
90444d8e951Smrgand $1[]_LIBS to avoid the need to call pkg-config.
90544d8e951SmrgSee the pkg-config man page for more details.])
90644d8e951Smrg
90744d8e951Smrgif test $pkg_failed = yes; then
90844d8e951Smrg   	AC_MSG_RESULT([no])
90944d8e951Smrg        _PKG_SHORT_ERRORS_SUPPORTED
91044d8e951Smrg        if test $_pkg_short_errors_supported = yes; then
911414cce6aSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
91244d8e951Smrg        else 
913414cce6aSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
91444d8e951Smrg        fi
91544d8e951Smrg	# Put the nasty error message in config.log where it belongs
91644d8e951Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
91744d8e951Smrg
91844d8e951Smrg	m4_default([$4], [AC_MSG_ERROR(
91944d8e951Smrg[Package requirements ($2) were not met:
92044d8e951Smrg
92144d8e951Smrg$$1_PKG_ERRORS
92244d8e951Smrg
92344d8e951SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
92444d8e951Smrginstalled software in a non-standard prefix.
92544d8e951Smrg
92644d8e951Smrg_PKG_TEXT])[]dnl
92744d8e951Smrg        ])
92844d8e951Smrgelif test $pkg_failed = untried; then
92944d8e951Smrg     	AC_MSG_RESULT([no])
93044d8e951Smrg	m4_default([$4], [AC_MSG_FAILURE(
93144d8e951Smrg[The pkg-config script could not be found or is too old.  Make sure it
93244d8e951Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
93344d8e951Smrgpath to pkg-config.
93444d8e951Smrg
93544d8e951Smrg_PKG_TEXT
93644d8e951Smrg
937414cce6aSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
93844d8e951Smrg        ])
93944d8e951Smrgelse
94044d8e951Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
94144d8e951Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
94244d8e951Smrg        AC_MSG_RESULT([yes])
94344d8e951Smrg	$3
94444d8e951Smrgfi[]dnl
945414cce6aSmrg])dnl PKG_CHECK_MODULES
94650539131Smrg
947414cce6aSmrg
948414cce6aSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
949414cce6aSmrgdnl   [ACTION-IF-NOT-FOUND])
950414cce6aSmrgdnl ---------------------------------------------------------------------
951414cce6aSmrgdnl Since: 0.29
952414cce6aSmrgdnl
953414cce6aSmrgdnl Checks for existence of MODULES and gathers its build flags with
954414cce6aSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
955414cce6aSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
956414cce6aSmrgdnl
957414cce6aSmrgdnl Note that if there is a possibility the first call to
958414cce6aSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
959414cce6aSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
960414cce6aSmrgdnl configure.ac.
961414cce6aSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
962414cce6aSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
963414cce6aSmrg_save_PKG_CONFIG=$PKG_CONFIG
964414cce6aSmrgPKG_CONFIG="$PKG_CONFIG --static"
965414cce6aSmrgPKG_CHECK_MODULES($@)
966414cce6aSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
967414cce6aSmrg])dnl PKG_CHECK_MODULES_STATIC
968414cce6aSmrg
969414cce6aSmrg
970414cce6aSmrgdnl PKG_INSTALLDIR([DIRECTORY])
971414cce6aSmrgdnl -------------------------
972414cce6aSmrgdnl Since: 0.27
973414cce6aSmrgdnl
974414cce6aSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
975414cce6aSmrgdnl should install pkg-config .pc files. By default the directory is
976414cce6aSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
977414cce6aSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
978414cce6aSmrgdnl parameter.
979414cce6aSmrgAC_DEFUN([PKG_INSTALLDIR],
980414cce6aSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
981414cce6aSmrgm4_pushdef([pkg_description],
982414cce6aSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
983414cce6aSmrgAC_ARG_WITH([pkgconfigdir],
984414cce6aSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
985414cce6aSmrg    [with_pkgconfigdir=]pkg_default)
986414cce6aSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
987414cce6aSmrgm4_popdef([pkg_default])
988414cce6aSmrgm4_popdef([pkg_description])
989414cce6aSmrg])dnl PKG_INSTALLDIR
990414cce6aSmrg
991414cce6aSmrg
992414cce6aSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
993414cce6aSmrgdnl --------------------------------
994414cce6aSmrgdnl Since: 0.27
995414cce6aSmrgdnl
996414cce6aSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
997414cce6aSmrgdnl module should install arch-independent pkg-config .pc files. By
998414cce6aSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
999414cce6aSmrgdnl changed by passing DIRECTORY. The user can override through the
1000414cce6aSmrgdnl --with-noarch-pkgconfigdir parameter.
1001414cce6aSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1002414cce6aSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1003414cce6aSmrgm4_pushdef([pkg_description],
1004414cce6aSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1005414cce6aSmrgAC_ARG_WITH([noarch-pkgconfigdir],
1006414cce6aSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1007414cce6aSmrg    [with_noarch_pkgconfigdir=]pkg_default)
1008414cce6aSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1009414cce6aSmrgm4_popdef([pkg_default])
1010414cce6aSmrgm4_popdef([pkg_description])
1011414cce6aSmrg])dnl PKG_NOARCH_INSTALLDIR
1012414cce6aSmrg
1013414cce6aSmrg
1014414cce6aSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1015414cce6aSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1016414cce6aSmrgdnl -------------------------------------------
1017414cce6aSmrgdnl Since: 0.28
1018414cce6aSmrgdnl
1019414cce6aSmrgdnl Retrieves the value of the pkg-config variable for the given module.
1020414cce6aSmrgAC_DEFUN([PKG_CHECK_VAR],
1021414cce6aSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1022414cce6aSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1023414cce6aSmrg
1024414cce6aSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1025414cce6aSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1026414cce6aSmrg
1027414cce6aSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1028414cce6aSmrg])dnl PKG_CHECK_VAR
1029414cce6aSmrg
1030414cce6aSmrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
1031414cce6aSmrgdnl
1032414cce6aSmrgdnl This file comes from X.Org's font-util 1.4.0
1033414cce6aSmrgdnl
1034414cce6aSmrgdnl Copyright (c) 2009, 2023, Oracle and/or its affiliates.
103544d8e951Smrgdnl
103644d8e951Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
103744d8e951Smrgdnl copy of this software and associated documentation files (the "Software"),
103844d8e951Smrgdnl to deal in the Software without restriction, including without limitation
103944d8e951Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
104044d8e951Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
104144d8e951Smrgdnl Software is furnished to do so, subject to the following conditions:
104244d8e951Smrgdnl
104344d8e951Smrgdnl The above copyright notice and this permission notice (including the next
104444d8e951Smrgdnl paragraph) shall be included in all copies or substantial portions of the
104544d8e951Smrgdnl Software.
104644d8e951Smrgdnl
104744d8e951Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
104844d8e951Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
104944d8e951Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
105044d8e951Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
105144d8e951Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
105244d8e951Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
105344d8e951Smrgdnl DEALINGS IN THE SOFTWARE.
1054414cce6aSmrgdnl
1055414cce6aSmrgdnl --------------------------------------------------------------------
1056414cce6aSmrgdnl
1057414cce6aSmrgdnl Copyright 2005 Red Hat, Inc
1058414cce6aSmrgdnl
1059414cce6aSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
1060414cce6aSmrgdnl documentation for any purpose is hereby granted without fee, provided that
1061414cce6aSmrgdnl the above copyright notice appear in all copies and that both that
1062414cce6aSmrgdnl copyright notice and this permission notice appear in supporting
1063414cce6aSmrgdnl documentation.
1064414cce6aSmrgdnl
1065414cce6aSmrgdnl The above copyright notice and this permission notice shall be included
1066414cce6aSmrgdnl in all copies or substantial portions of the Software.
1067414cce6aSmrgdnl
1068414cce6aSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1069414cce6aSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1070414cce6aSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1071414cce6aSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
1072414cce6aSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1073414cce6aSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1074414cce6aSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
1075414cce6aSmrgdnl
1076414cce6aSmrgdnl Except as contained in this notice, the name of the copyright holders shall
1077414cce6aSmrgdnl not be used in advertising or otherwise to promote the sale, use or
1078414cce6aSmrgdnl other dealings in this Software without prior written authorization
1079414cce6aSmrgdnl from the copyright holders.
108050539131Smrg
1081414cce6aSmrg# XORG_FONT_MACROS_VERSION(required-version)
1082414cce6aSmrg# ------------------------------------------
108344d8e951Smrg# Minimum version: 1.1.0
108450539131Smrg#
108544d8e951Smrg# If you're using a macro added in Version 1.1 or newer, include this in
108644d8e951Smrg# your configure.ac with the minimum required version, such as:
1087414cce6aSmrg# XORG_FONT_MACROS_VERSION(1.1)
108844d8e951Smrg#
108944d8e951Smrg# To ensure that this macro is defined, also add:
1090414cce6aSmrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
1091414cce6aSmrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
109244d8e951Smrg#
109344d8e951Smrg#
1094414cce6aSmrg# See the "minimum version" comment for each macro you use to see what
109544d8e951Smrg# version you require.
1096414cce6aSmrgm4_defun([XORG_FONT_MACROS_VERSION],[
1097414cce6aSmrgm4_define([vers_have], [1.4.0])
109844d8e951Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
109944d8e951Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
110044d8e951Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1101414cce6aSmrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
110244d8e951Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1103414cce6aSmrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
110444d8e951Smrgm4_undefine([vers_have])
110544d8e951Smrgm4_undefine([maj_have])
110644d8e951Smrgm4_undefine([maj_needed])
1107414cce6aSmrg]) # XORG_FONT_MACROS_VERSION
110850539131Smrg
1109414cce6aSmrg# XORG_FONT_CHECK_{maps}()
1110414cce6aSmrg# ------------------------
111144d8e951Smrg# Minimum version: 1.0.0
1112414cce6aSmrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
1113414cce6aSmrg# JISX0201 or KOI8_R.  By default, they are all enabled.
111450539131Smrg
1115414cce6aSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
1116414cce6aSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
1117414cce6aSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
1118414cce6aSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
1119414cce6aSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
1120414cce6aSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
1121414cce6aSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
1122414cce6aSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
1123414cce6aSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
1124414cce6aSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
1125414cce6aSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
1126414cce6aSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
1127414cce6aSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
1128414cce6aSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
1129414cce6aSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
1130414cce6aSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
1131414cce6aSmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
1132414cce6aSmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
113350539131Smrg
1134414cce6aSmrg# XORG_FONT_CHECK_ENCODING(encoding)
1135414cce6aSmrg# ----------------------------------
1136414cce6aSmrg# Minimum version: 1.1.0
1137414cce6aSmrg# This macro adds --enable/disable-<encoding>, enabled by default.
1138414cce6aSmrg# It replaced individual copies of this code in the above macros in 1.1.
1139414cce6aSmrg# Currently assumes encoding names will be all upper-case - add m4_toupper
1140414cce6aSmrg# calls if this is not true in the future.
114150539131Smrg
1142414cce6aSmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
1143414cce6aSmrg	AC_ARG_ENABLE(m4_tolower($1),
1144414cce6aSmrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
1145414cce6aSmrg				[Build $1 fonts (default: yes)]),
1146414cce6aSmrg		[AS_TR_SH($1)=$enableval])
1147414cce6aSmrg	AC_MSG_CHECKING([whether to build $1 fonts])
1148414cce6aSmrg	AC_MSG_RESULT($[AS_TR_SH($1)])
1149414cce6aSmrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
1150414cce6aSmrg]) # XORG_FONT_CHECK_ENCODING
115150539131Smrg
1152414cce6aSmrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
1153414cce6aSmrg# -----------------------------------------------------
1154414cce6aSmrg# Minimum version: 1.1.0
1155414cce6aSmrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
1156414cce6aSmrg# Add a shorthand --enable/disable-all-encodings option.
115750539131Smrg
1158414cce6aSmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
1159414cce6aSmrg	AC_ARG_ENABLE([all-encodings],
1160414cce6aSmrg		AS_HELP_STRING([--disable-all-encodings],
1161414cce6aSmrg				[Disable building of all font encodings]),
1162414cce6aSmrg		[m4_foreach_w([enc], [$1], [
1163414cce6aSmrg			AS_TR_SH(enc)=$enableval
1164414cce6aSmrg		])],
1165414cce6aSmrg		[m4_foreach_w([enc], [$1], [
1166414cce6aSmrg			AS_TR_SH(enc)=yes
1167414cce6aSmrg		])])
1168414cce6aSmrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
1169414cce6aSmrg]) # XORG_FONT_CHECK_ENCODING_LIST
117050539131Smrg
1171414cce6aSmrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
1172414cce6aSmrg# ------------------------------------------
1173414cce6aSmrg# Minimum version: 1.1.0
1174414cce6aSmrg#
1175414cce6aSmrg# Simple wrapper around AC_PATH_PROG that errors if not found
1176414cce6aSmrg#
117750539131Smrg
1178414cce6aSmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
1179414cce6aSmrg	AC_PATH_PROG($1, $2)
1180414cce6aSmrg	if test x"$$1" = x; then
1181414cce6aSmrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
1182414cce6aSmrg	fi
1183414cce6aSmrg])
118450539131Smrg
118550539131Smrg
1186414cce6aSmrg# XORG_FONT_FCCACHE()
1187414cce6aSmrg# -------------------
1188414cce6aSmrg# Minimum version: 1.1.0
1189414cce6aSmrg#
1190414cce6aSmrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
1191414cce6aSmrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
1192414cce6aSmrg# to run fc-cache if found and not installing to $DESTDIR and not
1193414cce6aSmrg# cross-compiling
1194414cce6aSmrg#
1195414cce6aSmrg# fc-cache is optional, not required, and should be skipped when making
1196414cce6aSmrg# packages (installing to $DESTDIR) or cross-compiling
1197414cce6aSmrg#
1198414cce6aSmrgAC_DEFUN([XORG_FONT_FCCACHE],[
1199414cce6aSmrg	AC_PATH_PROG(FCCACHE, fc-cache)
1200414cce6aSmrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
1201414cce6aSmrg	if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then
1202414cce6aSmrg		RUN_FCCACHE="${FCCACHE_WARN}"
1203414cce6aSmrg	else
1204414cce6aSmrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
1205414cce6aSmrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
1206414cce6aSmrg	fi
1207414cce6aSmrg	AC_SUBST([RUN_FCCACHE])
1208414cce6aSmrg])
120950539131Smrg
1210414cce6aSmrg# XORG_FONT_MKFONTDIR()
1211414cce6aSmrg# -------------------
1212414cce6aSmrg# Minimum version: 1.3.0
1213414cce6aSmrg#
1214414cce6aSmrg# Set MKFONTDIR to path to mkfontdir.
1215414cce6aSmrg#
1216414cce6aSmrg# If cross-compiling, and if mkdir is not found, use a shell command
1217414cce6aSmrg# which warns mkfontdir needs to be run on the target
1218414cce6aSmrg#
1219414cce6aSmrg# If not cross-compiling, mkfontdir must be found
1220414cce6aSmrg#
1221414cce6aSmrgAC_DEFUN([XORG_FONT_MKFONTDIR],[
1222414cce6aSmrg	if test x"$cross_compiling" != x"no" ; then
1223414cce6aSmrg		AC_PATH_PROG(MKFONTDIR, mkfontdir, "")
1224414cce6aSmrg		MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run mkfontdir manually on host system"'
122550539131Smrg
1226414cce6aSmrg		if test x"$MKFONTDIR" = x; then
1227414cce6aSmrg			MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'"
1228414cce6aSmrg		fi
1229414cce6aSmrg	else
1230414cce6aSmrg		XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
1231414cce6aSmrg	fi
123250539131Smrg
1233414cce6aSmrg	AC_SUBST([MKFONTDIR])
1234414cce6aSmrg])
123550539131Smrg
1236414cce6aSmrg# XORG_FONT_COMMON_UTILS()
1237414cce6aSmrg# ------------------------
1238414cce6aSmrg# Minimum version: 1.1.0
1239414cce6aSmrg#
1240414cce6aSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
124150539131Smrg
1242414cce6aSmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
1243414cce6aSmrg	XORG_FONT_FCCACHE
1244414cce6aSmrg	XORG_FONT_MKFONTDIR
1245414cce6aSmrg])
124650539131Smrg
1247414cce6aSmrg# XORG_FONT_SCALED_UTILS()
124844d8e951Smrg# ------------------------
1249414cce6aSmrg# Minimum version: 1.1.0
125044d8e951Smrg#
1251414cce6aSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
1252414cce6aSmrg# (TrueType, OpenType, Type1)
125344d8e951Smrg
1254414cce6aSmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
1255414cce6aSmrg	XORG_FONT_COMMON_UTILS
1256414cce6aSmrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
1257414cce6aSmrg])
125844d8e951Smrg
1259414cce6aSmrg# XORG_FONT_BDF_UTILS()
1260414cce6aSmrg# ---------------------
1261414cce6aSmrg# Minimum version: 1.1.0
126250539131Smrg#
1263414cce6aSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
1264414cce6aSmrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
1265414cce6aSmrg# PCF output files created by bdftopcf
126650539131Smrg
1267414cce6aSmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
1268414cce6aSmrg	XORG_FONT_COMMON_UTILS
1269414cce6aSmrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
1270414cce6aSmrg	XORG_FONT_CHECK_COMPRESSION
1271414cce6aSmrg])
127250539131Smrg
1273414cce6aSmrg# XORG_FONT_CHECK_COMPRESSION()
1274414cce6aSmrg# -----------------------------
1275414cce6aSmrg# Minimum version: 1.1.0
1276414cce6aSmrg#
1277414cce6aSmrg# Offer a --with-compression flag to control what compression method is
1278414cce6aSmrg# used for pcf font files.   Offers all the methods currently supported
1279414cce6aSmrg# by libXfont, including no compression.
1280414cce6aSmrg#
1281414cce6aSmrg# If COMPRESS_FLAGS is not set, and the compression method has flags needed
1282414cce6aSmrg# for reproducible builds, such as gzip -n to not record timestamp, will
1283414cce6aSmrg# set COMPRESS_FLAGS to those options.
128450539131Smrg
1285414cce6aSmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
1286414cce6aSmrg	AC_MSG_CHECKING([font compression method])
1287414cce6aSmrg	AC_ARG_WITH(compression,
1288414cce6aSmrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
1289414cce6aSmrg			 [compression method to use on pcf fonts])],
1290414cce6aSmrg         [compression="$withval"], [compression="yes"])
1291414cce6aSmrg	if test x"$compression" = "xyes" ; then
1292414cce6aSmrg		compression="gzip"
1293414cce6aSmrg	fi
1294414cce6aSmrg	AC_MSG_RESULT([${compression}])
1295414cce6aSmrg	case ${compression} in
1296414cce6aSmrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
1297414cce6aSmrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;
1298414cce6aSmrg			COMPRESS_FLAGS="${COMPRESS_FLAGS--n}" ;;
1299414cce6aSmrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
1300414cce6aSmrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
1301414cce6aSmrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
1302414cce6aSmrg	esac
1303414cce6aSmrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
1304414cce6aSmrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
1305414cce6aSmrg	fi
1306414cce6aSmrg	AC_MSG_CHECKING([options to font compression command])
1307414cce6aSmrg	AC_MSG_RESULT([${COMPRESS_FLAGS:-none}])
1308414cce6aSmrg	AC_SUBST([COMPRESS_FLAGS])
1309414cce6aSmrg	AC_SUBST([COMPRESS_SUFFIX])
1310414cce6aSmrg])
131150539131Smrg
1312414cce6aSmrg# XORG_FONT_UCS2ANY()
1313414cce6aSmrg# -------------------
1314414cce6aSmrg# Minimum version: 1.1.0
1315414cce6aSmrg#
1316414cce6aSmrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
1317414cce6aSmrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
1318414cce6aSmrg# Also call pkg-config to find the directory with the encoding files needed
1319414cce6aSmrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
132050539131Smrg
1321414cce6aSmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
1322414cce6aSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1323414cce6aSmrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
1324414cce6aSmrg	PKG_CHECK_MODULES(MAPS, [fontutil])
1325414cce6aSmrg	AC_MSG_CHECKING([for ucs2any encoding data files])
1326414cce6aSmrg	MAPFILES_PATH=`$PKG_CONFIG --variable=mapdir fontutil`
1327414cce6aSmrg	AC_SUBST(MAPFILES_PATH)
1328414cce6aSmrg	AC_MSG_RESULT([${MAPFILES_PATH}])
1329414cce6aSmrg])
133050539131Smrg
133150539131Smrg
133250539131Smrg
1333414cce6aSmrg# XORG_FONT_FC_CONFDIR()
1334414cce6aSmrg# --------------------
1335414cce6aSmrg# Minimum version: 1.2.0
1336414cce6aSmrg#
1337414cce6aSmrg# Sets FC_CONFDIR to the fontconfig config directory
1338414cce6aSmrg# (which should be --with-confdir=... when building fontconfig)
1339414cce6aSmrg# found from:
1340414cce6aSmrg#	--with-fc-confdir=...
1341414cce6aSmrg#	pkg-config --variable=confdir fontconfig
1342414cce6aSmrg#	${sysconfdir}/fonts
134350539131Smrg
1344414cce6aSmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
1345414cce6aSmrg	dnl Ensure $PKG_CONFIG is set first
1346414cce6aSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
134750539131Smrg
1348414cce6aSmrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
1349414cce6aSmrg	AC_ARG_WITH(fc-confdir,
1350414cce6aSmrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
1351414cce6aSmrg			   [Path to fontconfig's configuration directory]),
1352414cce6aSmrg		    [FC_CONFDIR="$withval"])
1353414cce6aSmrg	# if --with-fc-confdir was not specified
1354414cce6aSmrg	if test "x${FC_CONFDIR}" = "x"; then
1355414cce6aSmrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
1356414cce6aSmrg	fi
1357414cce6aSmrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
1358414cce6aSmrg	if test "x${FC_CONFDIR}" = "x"; then
1359414cce6aSmrg		FC_CONFDIR="${sysconfdir}/fonts"
1360414cce6aSmrg	fi
1361414cce6aSmrg	AC_SUBST(FC_CONFDIR)
1362414cce6aSmrg	AC_MSG_RESULT([${FC_CONFDIR}])
1363414cce6aSmrg])
136450539131Smrg
136550539131Smrg
136650539131Smrg
1367414cce6aSmrg# XORG_FONTROOTDIR()
1368414cce6aSmrg# --------------------
1369414cce6aSmrg# Minimum version: 1.1.0
1370414cce6aSmrg#
1371414cce6aSmrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
1372414cce6aSmrg# found from:
1373414cce6aSmrg#	--with-fontrootdir
1374414cce6aSmrg#	pkg-config --variable=fontrootdir fontutil
1375414cce6aSmrg#	${datadir}/fonts/X11
137650539131Smrg
1377414cce6aSmrgAC_DEFUN([XORG_FONTROOTDIR],[
1378414cce6aSmrg	dnl Ensure $PKG_CONFIG is set first
1379414cce6aSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
138050539131Smrg
1381414cce6aSmrg	AC_MSG_CHECKING([for root directory for font files])
1382414cce6aSmrg	AC_ARG_WITH(fontrootdir,
1383414cce6aSmrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
1384414cce6aSmrg			   [Path to root directory for font files]),
1385414cce6aSmrg		    [FONTROOTDIR="$withval"])
1386414cce6aSmrg	# if --with-fontrootdir not specified...
1387414cce6aSmrg	if test "x${FONTROOTDIR}" = "x"; then
1388414cce6aSmrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
1389414cce6aSmrg	fi
1390414cce6aSmrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
1391414cce6aSmrg	if test "x${FONTROOTDIR}" = "x"; then
1392414cce6aSmrg		FONTROOTDIR="${datadir}/fonts/X11"
1393414cce6aSmrg	fi
1394414cce6aSmrg	AC_SUBST(FONTROOTDIR)
1395414cce6aSmrg	AC_MSG_RESULT([${FONTROOTDIR}])
1396414cce6aSmrg])
139750539131Smrg
1398414cce6aSmrg# XORG_FONTSUBDIR(variable, flag, subdir)
1399414cce6aSmrg# ---------------------------------------
1400414cce6aSmrg# Minimum version: 1.1.0
1401414cce6aSmrg#
1402414cce6aSmrg# Offer a --with-<flag> flag to control directory for font installation
1403414cce6aSmrg# Default is the specified <subdir> of the font root directory.
1404414cce6aSmrg# Sets <variable> to the selected directory
140550539131Smrg
1406414cce6aSmrgAC_DEFUN([XORG_FONTSUBDIR],[
1407414cce6aSmrg	AC_REQUIRE([XORG_FONTROOTDIR])
140850539131Smrg
1409414cce6aSmrg	AC_MSG_CHECKING([for directory for $3 files])
1410414cce6aSmrg	AC_ARG_WITH($2,
1411414cce6aSmrg		    [AS_HELP_STRING([--with-$2=DIR],
1412414cce6aSmrg				    [Path to $3 files [FONTROOTDIR/$3]])],
1413414cce6aSmrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
1414414cce6aSmrg	AC_SUBST($1)
1415414cce6aSmrg	AC_MSG_RESULT([${$1}])
1416414cce6aSmrg]) # XORG_FONTSUBDIR
141744d8e951Smrg
1418414cce6aSmrg# XORG_FONTDIR(subdir)
1419414cce6aSmrg# --------------------
1420414cce6aSmrg# Minimum version: 1.1.0
1421414cce6aSmrg#
1422414cce6aSmrg# Offer a --with-fontdir flag to control directory for font installation
1423414cce6aSmrg# Default is the specified subdir of the font root directory.
1424414cce6aSmrg# Sets FONTDIR to the selected directory
142550539131Smrg
1426414cce6aSmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
142750539131Smrg
1428414cce6aSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1429414cce6aSmrgdnl
1430414cce6aSmrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
1431414cce6aSmrgdnl
1432414cce6aSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1433414cce6aSmrgdnl copy of this software and associated documentation files (the "Software"),
1434414cce6aSmrgdnl to deal in the Software without restriction, including without limitation
1435414cce6aSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1436414cce6aSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1437414cce6aSmrgdnl Software is furnished to do so, subject to the following conditions:
1438414cce6aSmrgdnl
1439414cce6aSmrgdnl The above copyright notice and this permission notice (including the next
1440414cce6aSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1441414cce6aSmrgdnl Software.
1442414cce6aSmrgdnl
1443414cce6aSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1444414cce6aSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1445414cce6aSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1446414cce6aSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1447414cce6aSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1448414cce6aSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1449414cce6aSmrgdnl DEALINGS IN THE SOFTWARE.
1450414cce6aSmrg
1451414cce6aSmrg# XORG_MACROS_VERSION(required-version)
1452414cce6aSmrg# -------------------------------------
1453414cce6aSmrg# Minimum version: 1.1.0
145444d8e951Smrg#
1455414cce6aSmrg# If you're using a macro added in Version 1.1 or newer, include this in
1456414cce6aSmrg# your configure.ac with the minimum required version, such as:
1457414cce6aSmrg# XORG_MACROS_VERSION(1.1)
145844d8e951Smrg#
1459414cce6aSmrg# To ensure that this macro is defined, also add:
1460414cce6aSmrg# m4_ifndef([XORG_MACROS_VERSION],
1461414cce6aSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
146244d8e951Smrg#
146344d8e951Smrg#
1464414cce6aSmrg# See the "minimum version" comment for each macro you use to see what
1465414cce6aSmrg# version you require.
1466414cce6aSmrgm4_defun([XORG_MACROS_VERSION],[
1467414cce6aSmrgm4_define([vers_have], [1.20.0])
1468414cce6aSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1469414cce6aSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1470414cce6aSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1471414cce6aSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1472414cce6aSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1473414cce6aSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1474414cce6aSmrgm4_undefine([vers_have])
1475414cce6aSmrgm4_undefine([maj_have])
1476414cce6aSmrgm4_undefine([maj_needed])
1477414cce6aSmrg]) # XORG_MACROS_VERSION
147844d8e951Smrg
1479414cce6aSmrg# XORG_PROG_RAWCPP()
1480414cce6aSmrg# ------------------
1481414cce6aSmrg# Minimum version: 1.0.0
1482414cce6aSmrg#
1483414cce6aSmrg# Find cpp program and necessary flags for use in pre-processing text files
1484414cce6aSmrg# such as man pages and config files
1485414cce6aSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1486414cce6aSmrgAC_REQUIRE([AC_PROG_CPP])
1487414cce6aSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1488414cce6aSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1489414cce6aSmrg
1490414cce6aSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1491414cce6aSmrg# which is not the best choice for supporting other OS'es, but covers most
1492414cce6aSmrg# of the ones we need for now.
1493414cce6aSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1494414cce6aSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1495414cce6aSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1496414cce6aSmrg	AC_MSG_RESULT([no])
149744d8e951Smrgelse
1498414cce6aSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1499414cce6aSmrg		RAWCPPFLAGS=-undef
1500414cce6aSmrg		AC_MSG_RESULT([yes])
1501414cce6aSmrg	# under Cygwin unix is still defined even with -undef
1502414cce6aSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1503414cce6aSmrg		RAWCPPFLAGS="-undef -ansi"
1504414cce6aSmrg		AC_MSG_RESULT([yes, with -ansi])
1505414cce6aSmrg	else
1506414cce6aSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1507414cce6aSmrg	fi
150850539131Smrgfi
1509414cce6aSmrgrm -f conftest.$ac_ext
151050539131Smrg
1511414cce6aSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1512414cce6aSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1513414cce6aSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1514414cce6aSmrg	AC_MSG_RESULT([no])
151544d8e951Smrgelse
1516414cce6aSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1517414cce6aSmrg		TRADITIONALCPPFLAGS="-traditional"
1518414cce6aSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1519414cce6aSmrg		AC_MSG_RESULT([yes])
1520414cce6aSmrg	else
1521414cce6aSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1522414cce6aSmrg	fi
152344d8e951Smrgfi
1524414cce6aSmrgrm -f conftest.$ac_ext
1525414cce6aSmrgAC_SUBST(RAWCPPFLAGS)
1526414cce6aSmrgAC_SUBST(TRADITIONALCPPFLAGS)
1527414cce6aSmrg]) # XORG_PROG_RAWCPP
152844d8e951Smrg
1529414cce6aSmrg# XORG_MANPAGE_SECTIONS()
1530414cce6aSmrg# -----------------------
1531414cce6aSmrg# Minimum version: 1.0.0
153244d8e951Smrg#
1533414cce6aSmrg# Determine which sections man pages go in for the different man page types
1534414cce6aSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1535414cce6aSmrg# Not sure if there's any better way than just hardcoding by OS name.
1536414cce6aSmrg# Override default settings by setting environment variables
1537414cce6aSmrg# Added MAN_SUBSTS in version 1.8
1538414cce6aSmrg# Added AC_PROG_SED in version 1.8
153944d8e951Smrg
1540414cce6aSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1541414cce6aSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1542414cce6aSmrgAC_REQUIRE([AC_PROG_SED])
154350539131Smrg
1544414cce6aSmrgcase $host_os in
1545414cce6aSmrg    solaris*)
1546414cce6aSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1547414cce6aSmrg        # check for a man page file found in later versions that use
1548414cce6aSmrg        # traditional section numbers instead
1549414cce6aSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1550414cce6aSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1551414cce6aSmrg        ;;
1552414cce6aSmrg    *) SYSV_MAN_SECTIONS=false ;;
1553414cce6aSmrgesac
155444d8e951Smrg
1555414cce6aSmrgif test x$APP_MAN_SUFFIX = x    ; then
1556414cce6aSmrg    APP_MAN_SUFFIX=1
1557414cce6aSmrgfi
1558414cce6aSmrgif test x$APP_MAN_DIR = x    ; then
1559414cce6aSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
156044d8e951Smrgfi
156150539131Smrg
1562414cce6aSmrgif test x$LIB_MAN_SUFFIX = x    ; then
1563414cce6aSmrg    LIB_MAN_SUFFIX=3
1564414cce6aSmrgfi
1565414cce6aSmrgif test x$LIB_MAN_DIR = x    ; then
1566414cce6aSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
156744d8e951Smrgfi
156850539131Smrg
1569414cce6aSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1570414cce6aSmrg    case $SYSV_MAN_SECTIONS in
1571414cce6aSmrg	true)				FILE_MAN_SUFFIX=4  ;;
1572414cce6aSmrg	*)				FILE_MAN_SUFFIX=5  ;;
1573414cce6aSmrg    esac
1574414cce6aSmrgfi
1575414cce6aSmrgif test x$FILE_MAN_DIR = x    ; then
1576414cce6aSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
157744d8e951Smrgfi
157850539131Smrg
1579414cce6aSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1580414cce6aSmrg    case $SYSV_MAN_SECTIONS in
1581414cce6aSmrg	true)				MISC_MAN_SUFFIX=5  ;;
1582414cce6aSmrg	*)				MISC_MAN_SUFFIX=7  ;;
1583414cce6aSmrg    esac
1584414cce6aSmrgfi
1585414cce6aSmrgif test x$MISC_MAN_DIR = x    ; then
1586414cce6aSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1587414cce6aSmrgfi
158850539131Smrg
1589414cce6aSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1590414cce6aSmrg    case $SYSV_MAN_SECTIONS in
1591414cce6aSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1592414cce6aSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1593414cce6aSmrg    esac
1594414cce6aSmrgfi
1595414cce6aSmrgif test x$DRIVER_MAN_DIR = x    ; then
1596414cce6aSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1597414cce6aSmrgfi
159844d8e951Smrg
1599414cce6aSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1600414cce6aSmrg    case $SYSV_MAN_SECTIONS in
1601414cce6aSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1602414cce6aSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
1603414cce6aSmrg    esac
1604414cce6aSmrgfi
1605414cce6aSmrgif test x$ADMIN_MAN_DIR = x    ; then
1606414cce6aSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
160744d8e951Smrgfi
160850539131Smrg
160944d8e951Smrg
1610414cce6aSmrgAC_SUBST([APP_MAN_SUFFIX])
1611414cce6aSmrgAC_SUBST([LIB_MAN_SUFFIX])
1612414cce6aSmrgAC_SUBST([FILE_MAN_SUFFIX])
1613414cce6aSmrgAC_SUBST([MISC_MAN_SUFFIX])
1614414cce6aSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1615414cce6aSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1616414cce6aSmrgAC_SUBST([APP_MAN_DIR])
1617414cce6aSmrgAC_SUBST([LIB_MAN_DIR])
1618414cce6aSmrgAC_SUBST([FILE_MAN_DIR])
1619414cce6aSmrgAC_SUBST([MISC_MAN_DIR])
1620414cce6aSmrgAC_SUBST([DRIVER_MAN_DIR])
1621414cce6aSmrgAC_SUBST([ADMIN_MAN_DIR])
162250539131Smrg
1623414cce6aSmrgXORG_MAN_PAGE="X Version 11"
1624414cce6aSmrgAC_SUBST([XORG_MAN_PAGE])
1625414cce6aSmrgMAN_SUBSTS="\
1626414cce6aSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1627414cce6aSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1628414cce6aSmrg	-e 's|__xservername__|Xorg|g' \
1629414cce6aSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
1630414cce6aSmrg	-e 's|__projectroot__|\$(prefix)|g' \
1631414cce6aSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1632414cce6aSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1633414cce6aSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1634414cce6aSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1635414cce6aSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1636414cce6aSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1637414cce6aSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1638414cce6aSmrgAC_SUBST([MAN_SUBSTS])
163944d8e951Smrg
1640414cce6aSmrg]) # XORG_MANPAGE_SECTIONS
164144d8e951Smrg
1642414cce6aSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1643414cce6aSmrg# ------------------------
1644414cce6aSmrg# Minimum version: 1.7.0
164544d8e951Smrg#
1646414cce6aSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1647414cce6aSmrg# provided by xorg-sgml-doctools, if installed.
1648414cce6aSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1649414cce6aSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1650414cce6aSmrgXORG_SGML_PATH=
1651414cce6aSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1652414cce6aSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1653414cce6aSmrg    [m4_ifval([$1],[:],
1654414cce6aSmrg        [if test x"$cross_compiling" != x"yes" ; then
1655414cce6aSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1656414cce6aSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1657414cce6aSmrg         fi])
1658414cce6aSmrg    ])
1659414cce6aSmrg
1660414cce6aSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1661414cce6aSmrg# the path and the name of the doc stylesheet
1662414cce6aSmrgif test "x$XORG_SGML_PATH" != "x" ; then
1663414cce6aSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1664414cce6aSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1665414cce6aSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1666414cce6aSmrgelse
1667414cce6aSmrg   AC_MSG_RESULT([no])
1668414cce6aSmrgfi
1669414cce6aSmrg
1670414cce6aSmrgAC_SUBST(XORG_SGML_PATH)
1671414cce6aSmrgAC_SUBST(STYLESHEET_SRCDIR)
1672414cce6aSmrgAC_SUBST(XSL_STYLESHEET)
1673414cce6aSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1674414cce6aSmrg]) # XORG_CHECK_SGML_DOCTOOLS
167550539131Smrg
1676414cce6aSmrg# XORG_CHECK_LINUXDOC
1677414cce6aSmrg# -------------------
167844d8e951Smrg# Minimum version: 1.0.0
167944d8e951Smrg#
1680414cce6aSmrg# Defines the variable MAKE_TEXT if the necessary tools and
1681414cce6aSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1682414cce6aSmrg# Whether or not the necessary tools and files are found can be checked
1683414cce6aSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1684414cce6aSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1685414cce6aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1686414cce6aSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
168750539131Smrg
1688414cce6aSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1689414cce6aSmrg
1690414cce6aSmrgAC_MSG_CHECKING([whether to build documentation])
1691414cce6aSmrg
1692414cce6aSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1693414cce6aSmrg   BUILDDOC=yes
1694414cce6aSmrgelse
1695414cce6aSmrg   BUILDDOC=no
169644d8e951Smrgfi
169750539131Smrg
1698414cce6aSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1699414cce6aSmrg
1700414cce6aSmrgAC_MSG_RESULT([$BUILDDOC])
1701414cce6aSmrg
1702414cce6aSmrgAC_MSG_CHECKING([whether to build pdf documentation])
1703414cce6aSmrg
1704414cce6aSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1705414cce6aSmrg   BUILDPDFDOC=yes
170644d8e951Smrgelse
1707414cce6aSmrg   BUILDPDFDOC=no
170844d8e951Smrgfi
170944d8e951Smrg
1710414cce6aSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
171150539131Smrg
1712414cce6aSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1713414cce6aSmrg
1714414cce6aSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1715414cce6aSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1716414cce6aSmrgMAKE_PDF="$PS2PDF"
1717414cce6aSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1718414cce6aSmrg
1719414cce6aSmrgAC_SUBST(MAKE_TEXT)
1720414cce6aSmrgAC_SUBST(MAKE_PS)
1721414cce6aSmrgAC_SUBST(MAKE_PDF)
1722414cce6aSmrgAC_SUBST(MAKE_HTML)
1723414cce6aSmrg]) # XORG_CHECK_LINUXDOC
1724414cce6aSmrg
1725414cce6aSmrg# XORG_CHECK_DOCBOOK
1726414cce6aSmrg# -------------------
1727414cce6aSmrg# Minimum version: 1.0.0
1728414cce6aSmrg#
1729414cce6aSmrg# Checks for the ability to build output formats from SGML DocBook source.
1730414cce6aSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1731414cce6aSmrg# indicates whether the necessary tools and files are found and, if set,
1732414cce6aSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1733414cce6aSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1734414cce6aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1735414cce6aSmrg
1736414cce6aSmrgBUILDTXTDOC=no
1737414cce6aSmrgBUILDPDFDOC=no
1738414cce6aSmrgBUILDPSDOC=no
1739414cce6aSmrgBUILDHTMLDOC=no
1740414cce6aSmrg
1741414cce6aSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1742414cce6aSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1743414cce6aSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1744414cce6aSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1745414cce6aSmrg
1746414cce6aSmrgAC_MSG_CHECKING([whether to build text documentation])
1747414cce6aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1748414cce6aSmrg   test x$BUILD_TXTDOC != xno; then
1749414cce6aSmrg	BUILDTXTDOC=yes
1750414cce6aSmrgfi
1751414cce6aSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1752414cce6aSmrgAC_MSG_RESULT([$BUILDTXTDOC])
1753414cce6aSmrg
1754414cce6aSmrgAC_MSG_CHECKING([whether to build PDF documentation])
1755414cce6aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1756414cce6aSmrg   test x$BUILD_PDFDOC != xno; then
1757414cce6aSmrg	BUILDPDFDOC=yes
1758414cce6aSmrgfi
1759414cce6aSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1760414cce6aSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1761414cce6aSmrg
1762414cce6aSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1763414cce6aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1764414cce6aSmrg   test x$BUILD_PSDOC != xno; then
1765414cce6aSmrg	BUILDPSDOC=yes
1766414cce6aSmrgfi
1767414cce6aSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1768414cce6aSmrgAC_MSG_RESULT([$BUILDPSDOC])
1769414cce6aSmrg
1770414cce6aSmrgAC_MSG_CHECKING([whether to build HTML documentation])
1771414cce6aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1772414cce6aSmrg   test x$BUILD_HTMLDOC != xno; then
1773414cce6aSmrg	BUILDHTMLDOC=yes
1774414cce6aSmrgfi
1775414cce6aSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1776414cce6aSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1777414cce6aSmrg
1778414cce6aSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1779414cce6aSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1780414cce6aSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1781414cce6aSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1782414cce6aSmrg
1783414cce6aSmrgAC_SUBST(MAKE_TEXT)
1784414cce6aSmrgAC_SUBST(MAKE_PS)
1785414cce6aSmrgAC_SUBST(MAKE_PDF)
1786414cce6aSmrgAC_SUBST(MAKE_HTML)
1787414cce6aSmrg]) # XORG_CHECK_DOCBOOK
1788414cce6aSmrg
1789414cce6aSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
179044d8e951Smrg# ----------------
1791414cce6aSmrg# Minimum version: 1.5.0
1792414cce6aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
179350539131Smrg#
1794414cce6aSmrg# Documentation tools are not always available on all platforms and sometimes
1795414cce6aSmrg# not at the appropriate level. This macro enables a module to test for the
1796414cce6aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1797414cce6aSmrg# the --with-xmlto option, it allows maximum flexibility in making decisions
1798414cce6aSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1799414cce6aSmrg# --with-xmlto assumes 'auto'.
180050539131Smrg#
180144d8e951Smrg# Interface to module:
1802414cce6aSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1803414cce6aSmrg# XMLTO:	returns the path of the xmlto program found
1804414cce6aSmrg#		returns the path set by the user in the environment
1805414cce6aSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1806414cce6aSmrg#		'no' user instructs the module not to use xmlto
180750539131Smrg#
1808414cce6aSmrg# Added in version 1.10.0
1809414cce6aSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1810414cce6aSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
181150539131Smrg#
1812414cce6aSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
181344d8e951Smrg#
1814414cce6aSmrgAC_DEFUN([XORG_WITH_XMLTO],[
1815414cce6aSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1816414cce6aSmrgm4_define([_defopt], m4_default([$2], [auto]))
1817414cce6aSmrgAC_ARG_WITH(xmlto,
1818414cce6aSmrg	AS_HELP_STRING([--with-xmlto],
1819414cce6aSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1820414cce6aSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1821414cce6aSmrgm4_undefine([_defopt])
182250539131Smrg
1823414cce6aSmrgif test "x$use_xmlto" = x"auto"; then
1824414cce6aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1825414cce6aSmrg   if test "x$XMLTO" = "x"; then
1826414cce6aSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1827414cce6aSmrg	have_xmlto=no
1828414cce6aSmrg   else
1829414cce6aSmrg        have_xmlto=yes
183044d8e951Smrg   fi
1831414cce6aSmrgelif test "x$use_xmlto" = x"yes" ; then
1832414cce6aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1833414cce6aSmrg   if test "x$XMLTO" = "x"; then
1834414cce6aSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
183544d8e951Smrg   fi
1836414cce6aSmrg   have_xmlto=yes
1837414cce6aSmrgelif test "x$use_xmlto" = x"no" ; then
1838414cce6aSmrg   if test "x$XMLTO" != "x"; then
1839414cce6aSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1840414cce6aSmrg   fi
1841414cce6aSmrg   have_xmlto=no
184244d8e951Smrgelse
1843414cce6aSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
184444d8e951Smrgfi
184550539131Smrg
1846414cce6aSmrg# Test for a minimum version of xmlto, if provided.
1847414cce6aSmrgm4_ifval([$1],
1848414cce6aSmrg[if test "$have_xmlto" = yes; then
1849414cce6aSmrg    # scrape the xmlto version
1850414cce6aSmrg    AC_MSG_CHECKING([the xmlto version])
1851414cce6aSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1852414cce6aSmrg    AC_MSG_RESULT([$xmlto_version])
1853414cce6aSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1854414cce6aSmrg        [if test "x$use_xmlto" = xauto; then
1855414cce6aSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1856414cce6aSmrg            have_xmlto=no
1857414cce6aSmrg        else
1858414cce6aSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1859414cce6aSmrg        fi])
1860414cce6aSmrgfi])
186150539131Smrg
1862414cce6aSmrg# Test for the ability of xmlto to generate a text target
1863414cce6aSmrg#
1864414cce6aSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
1865414cce6aSmrg# following test for empty XML docbook files.
1866414cce6aSmrg# For compatibility reasons use the following empty XML docbook file and if
1867414cce6aSmrg# it fails try it again with a non-empty XML file.
1868414cce6aSmrghave_xmlto_text=no
1869414cce6aSmrgcat > conftest.xml << "EOF"
1870414cce6aSmrgEOF
1871414cce6aSmrgAS_IF([test "$have_xmlto" = yes],
1872414cce6aSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1873414cce6aSmrg             [have_xmlto_text=yes],
1874414cce6aSmrg             [# Try it again with a non-empty XML file.
1875414cce6aSmrg              cat > conftest.xml << "EOF"
1876414cce6aSmrg<x></x>
1877414cce6aSmrgEOF
1878414cce6aSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1879414cce6aSmrg                    [have_xmlto_text=yes],
1880414cce6aSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
1881414cce6aSmrgrm -f conftest.xml
1882414cce6aSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1883414cce6aSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1884414cce6aSmrg]) # XORG_WITH_XMLTO
188550539131Smrg
1886414cce6aSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1887414cce6aSmrg# --------------------------------------------
1888414cce6aSmrg# Minimum version: 1.12.0
1889414cce6aSmrg# Minimum version for optional DEFAULT argument: 1.12.0
189050539131Smrg#
1891414cce6aSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1892414cce6aSmrg# XML-based language used for the transformation of XML documents.
1893414cce6aSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1894414cce6aSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1895414cce6aSmrg# The XSLT processor is often used as a standalone tool for transformations.
1896414cce6aSmrg# It should not be assumed that this tool is used only to work with documnetation.
1897414cce6aSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
189850539131Smrg#
189944d8e951Smrg# Interface to module:
1900414cce6aSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1901414cce6aSmrg# XSLTPROC:	 returns the path of the xsltproc program found
1902414cce6aSmrg#		 returns the path set by the user in the environment
1903414cce6aSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1904414cce6aSmrg#		  'no' user instructs the module not to use xsltproc
1905414cce6aSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
190650539131Smrg#
1907414cce6aSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1908414cce6aSmrg#
1909414cce6aSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1910414cce6aSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1911414cce6aSmrg# Preserves the interface, should it be implemented later
1912414cce6aSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1913414cce6aSmrgm4_define([_defopt], m4_default([$2], [auto]))
1914414cce6aSmrgAC_ARG_WITH(xsltproc,
1915414cce6aSmrg	AS_HELP_STRING([--with-xsltproc],
1916414cce6aSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1917414cce6aSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1918414cce6aSmrgm4_undefine([_defopt])
1919ded1caa4Smrg
1920414cce6aSmrgif test "x$use_xsltproc" = x"auto"; then
1921414cce6aSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1922414cce6aSmrg   if test "x$XSLTPROC" = "x"; then
1923414cce6aSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1924414cce6aSmrg	have_xsltproc=no
1925414cce6aSmrg   else
1926414cce6aSmrg        have_xsltproc=yes
192744d8e951Smrg   fi
1928414cce6aSmrgelif test "x$use_xsltproc" = x"yes" ; then
1929414cce6aSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1930414cce6aSmrg   if test "x$XSLTPROC" = "x"; then
1931414cce6aSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1932414cce6aSmrg   fi
1933414cce6aSmrg   have_xsltproc=yes
1934414cce6aSmrgelif test "x$use_xsltproc" = x"no" ; then
1935414cce6aSmrg   if test "x$XSLTPROC" != "x"; then
1936414cce6aSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1937414cce6aSmrg   fi
1938414cce6aSmrg   have_xsltproc=no
1939414cce6aSmrgelse
1940414cce6aSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
194144d8e951Smrgfi
1942ded1caa4Smrg
1943414cce6aSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1944414cce6aSmrg]) # XORG_WITH_XSLTPROC
1945ded1caa4Smrg
1946414cce6aSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1947414cce6aSmrg# ----------------------------------------
1948414cce6aSmrg# Minimum version: 1.15.0
194950539131Smrg#
1950414cce6aSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
1951414cce6aSmrg# scanning arbitrary text files, extracting information from those text files,
1952414cce6aSmrg# and printing reports based on that information.
195350539131Smrg#
1954414cce6aSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
195550539131Smrg#
1956414cce6aSmrg# Interface to module:
1957414cce6aSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
1958414cce6aSmrg# PERL:	     returns the path of the perl program found
1959414cce6aSmrg#	     returns the path set by the user in the environment
1960414cce6aSmrg# --with-perl: 'yes' user instructs the module to use perl
1961414cce6aSmrg#	       'no' user instructs the module not to use perl
1962414cce6aSmrg# have_perl: returns yes if perl found in PATH or no
1963414cce6aSmrg#
1964414cce6aSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1965414cce6aSmrg#
1966414cce6aSmrgAC_DEFUN([XORG_WITH_PERL],[
1967414cce6aSmrgAC_ARG_VAR([PERL], [Path to perl command])
1968414cce6aSmrg# Preserves the interface, should it be implemented later
1969414cce6aSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1970414cce6aSmrgm4_define([_defopt], m4_default([$2], [auto]))
1971414cce6aSmrgAC_ARG_WITH(perl,
1972414cce6aSmrg	AS_HELP_STRING([--with-perl],
1973414cce6aSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1974414cce6aSmrg	   [use_perl=$withval], [use_perl=]_defopt)
1975414cce6aSmrgm4_undefine([_defopt])
1976ded1caa4Smrg
1977414cce6aSmrgif test "x$use_perl" = x"auto"; then
1978414cce6aSmrg   AC_PATH_PROG([PERL], [perl])
1979414cce6aSmrg   if test "x$PERL" = "x"; then
1980414cce6aSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1981414cce6aSmrg	have_perl=no
1982414cce6aSmrg   else
1983414cce6aSmrg        have_perl=yes
1984414cce6aSmrg   fi
1985414cce6aSmrgelif test "x$use_perl" = x"yes" ; then
1986414cce6aSmrg   AC_PATH_PROG([PERL], [perl])
1987414cce6aSmrg   if test "x$PERL" = "x"; then
1988414cce6aSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1989414cce6aSmrg   fi
1990414cce6aSmrg   have_perl=yes
1991414cce6aSmrgelif test "x$use_perl" = x"no" ; then
1992414cce6aSmrg   if test "x$PERL" != "x"; then
1993414cce6aSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1994414cce6aSmrg   fi
1995414cce6aSmrg   have_perl=no
1996414cce6aSmrgelse
1997414cce6aSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
199844d8e951Smrgfi
1999ded1caa4Smrg
2000414cce6aSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2001414cce6aSmrg]) # XORG_WITH_PERL
200250539131Smrg
2003414cce6aSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
200444d8e951Smrg# ----------------
2005414cce6aSmrg# Minimum version: 1.5.0
2006414cce6aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
200744d8e951Smrg#
2008414cce6aSmrg# Documentation tools are not always available on all platforms and sometimes
2009414cce6aSmrg# not at the appropriate level. This macro enables a module to test for the
2010414cce6aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2011414cce6aSmrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
2012414cce6aSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2013414cce6aSmrg# --with-asciidoc assumes 'auto'.
201444d8e951Smrg#
2015414cce6aSmrg# Interface to module:
2016414cce6aSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2017414cce6aSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
2018414cce6aSmrg#		 returns the path set by the user in the environment
2019414cce6aSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2020414cce6aSmrg#		  'no' user instructs the module not to use asciidoc
2021414cce6aSmrg#
2022414cce6aSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2023414cce6aSmrg#
2024414cce6aSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2025414cce6aSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2026414cce6aSmrgm4_define([_defopt], m4_default([$2], [auto]))
2027414cce6aSmrgAC_ARG_WITH(asciidoc,
2028414cce6aSmrg	AS_HELP_STRING([--with-asciidoc],
2029414cce6aSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2030414cce6aSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2031414cce6aSmrgm4_undefine([_defopt])
203250539131Smrg
2033414cce6aSmrgif test "x$use_asciidoc" = x"auto"; then
2034414cce6aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2035414cce6aSmrg   if test "x$ASCIIDOC" = "x"; then
2036414cce6aSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2037414cce6aSmrg	have_asciidoc=no
2038414cce6aSmrg   else
2039414cce6aSmrg        have_asciidoc=yes
2040414cce6aSmrg   fi
2041414cce6aSmrgelif test "x$use_asciidoc" = x"yes" ; then
2042414cce6aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2043414cce6aSmrg   if test "x$ASCIIDOC" = "x"; then
2044414cce6aSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2045414cce6aSmrg   fi
2046414cce6aSmrg   have_asciidoc=yes
2047414cce6aSmrgelif test "x$use_asciidoc" = x"no" ; then
2048414cce6aSmrg   if test "x$ASCIIDOC" != "x"; then
2049414cce6aSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2050414cce6aSmrg   fi
2051414cce6aSmrg   have_asciidoc=no
2052414cce6aSmrgelse
2053414cce6aSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2054414cce6aSmrgfi
2055414cce6aSmrgm4_ifval([$1],
2056414cce6aSmrg[if test "$have_asciidoc" = yes; then
2057414cce6aSmrg    # scrape the asciidoc version
2058414cce6aSmrg    AC_MSG_CHECKING([the asciidoc version])
2059414cce6aSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2060414cce6aSmrg    AC_MSG_RESULT([$asciidoc_version])
2061414cce6aSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2062414cce6aSmrg        [if test "x$use_asciidoc" = xauto; then
2063414cce6aSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2064414cce6aSmrg            have_asciidoc=no
2065414cce6aSmrg        else
2066414cce6aSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2067414cce6aSmrg        fi])
2068414cce6aSmrgfi])
2069414cce6aSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2070414cce6aSmrg]) # XORG_WITH_ASCIIDOC
2071ded1caa4Smrg
2072414cce6aSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
2073414cce6aSmrg# -------------------------------------------
2074414cce6aSmrg# Minimum version: 1.5.0
2075414cce6aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2076414cce6aSmrg# Minimum version for optional DOT checking: 1.18.0
207750539131Smrg#
2078414cce6aSmrg# Documentation tools are not always available on all platforms and sometimes
2079414cce6aSmrg# not at the appropriate level. This macro enables a module to test for the
2080414cce6aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2081414cce6aSmrg# the --with-doxygen option, it allows maximum flexibility in making decisions
2082414cce6aSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2083414cce6aSmrg# --with-doxygen assumes 'auto'.
208444d8e951Smrg#
2085414cce6aSmrg# Interface to module:
2086414cce6aSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2087414cce6aSmrg# DOXYGEN:	 returns the path of the doxygen program found
2088414cce6aSmrg#		 returns the path set by the user in the environment
2089414cce6aSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2090414cce6aSmrg#		  'no' user instructs the module not to use doxygen
209144d8e951Smrg#
2092414cce6aSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
209344d8e951Smrg#
2094414cce6aSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2095414cce6aSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2096414cce6aSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
2097414cce6aSmrgm4_define([_defopt], m4_default([$2], [auto]))
2098414cce6aSmrgAC_ARG_WITH(doxygen,
2099414cce6aSmrg	AS_HELP_STRING([--with-doxygen],
2100414cce6aSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2101414cce6aSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2102414cce6aSmrgm4_undefine([_defopt])
2103ded1caa4Smrg
2104414cce6aSmrgif test "x$use_doxygen" = x"auto"; then
2105414cce6aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2106414cce6aSmrg   if test "x$DOXYGEN" = "x"; then
2107414cce6aSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2108414cce6aSmrg	have_doxygen=no
2109414cce6aSmrg   else
2110414cce6aSmrg        have_doxygen=yes
2111414cce6aSmrg   fi
2112414cce6aSmrgelif test "x$use_doxygen" = x"yes" ; then
2113414cce6aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2114414cce6aSmrg   if test "x$DOXYGEN" = "x"; then
2115414cce6aSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2116414cce6aSmrg   fi
2117414cce6aSmrg   have_doxygen=yes
2118414cce6aSmrgelif test "x$use_doxygen" = x"no" ; then
2119414cce6aSmrg   if test "x$DOXYGEN" != "x"; then
2120414cce6aSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2121414cce6aSmrg   fi
2122414cce6aSmrg   have_doxygen=no
2123414cce6aSmrgelse
2124414cce6aSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2125414cce6aSmrgfi
2126414cce6aSmrgm4_ifval([$1],
2127414cce6aSmrg[if test "$have_doxygen" = yes; then
2128414cce6aSmrg    # scrape the doxygen version
2129414cce6aSmrg    AC_MSG_CHECKING([the doxygen version])
2130414cce6aSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2131414cce6aSmrg    AC_MSG_RESULT([$doxygen_version])
2132414cce6aSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2133414cce6aSmrg        [if test "x$use_doxygen" = xauto; then
2134414cce6aSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2135414cce6aSmrg            have_doxygen=no
2136414cce6aSmrg        else
2137414cce6aSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2138414cce6aSmrg        fi])
2139414cce6aSmrgfi])
2140ded1caa4Smrg
2141414cce6aSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2142414cce6aSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2143414cce6aSmrgdnl 	HAVE_DOT = @HAVE_DOT@
2144414cce6aSmrgHAVE_DOT=no
2145414cce6aSmrgif test "x$have_doxygen" = "xyes"; then
2146414cce6aSmrg  AC_PATH_PROG([DOT], [dot])
2147414cce6aSmrg    if test "x$DOT" != "x"; then
2148414cce6aSmrg      HAVE_DOT=yes
2149414cce6aSmrg    fi
2150414cce6aSmrgfi
215150539131Smrg
2152414cce6aSmrgAC_SUBST([HAVE_DOT])
2153414cce6aSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2154414cce6aSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2155414cce6aSmrg]) # XORG_WITH_DOXYGEN
215644d8e951Smrg
2157414cce6aSmrg# XORG_WITH_GROFF([DEFAULT])
2158414cce6aSmrg# ----------------
2159414cce6aSmrg# Minimum version: 1.6.0
2160414cce6aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
216150539131Smrg#
2162414cce6aSmrg# Documentation tools are not always available on all platforms and sometimes
2163414cce6aSmrg# not at the appropriate level. This macro enables a module to test for the
2164414cce6aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2165414cce6aSmrg# the --with-groff option, it allows maximum flexibility in making decisions
2166414cce6aSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
2167414cce6aSmrg# --with-groff assumes 'auto'.
216850539131Smrg#
2169414cce6aSmrg# Interface to module:
2170414cce6aSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2171414cce6aSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2172414cce6aSmrg# HAVE_GROFF_MS: the -ms macros package
2173414cce6aSmrg# GROFF:	 returns the path of the groff program found
2174414cce6aSmrg#		 returns the path set by the user in the environment
2175414cce6aSmrg# --with-groff:	 'yes' user instructs the module to use groff
2176414cce6aSmrg#		 'no' user instructs the module not to use groff
217750539131Smrg#
2178414cce6aSmrg# Added in version 1.9.0:
2179414cce6aSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2180414cce6aSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2181414cce6aSmrg#		   psselect from the psutils package.
2182414cce6aSmrg#		   the ghostcript package. Refer to the grohtml man pages
218350539131Smrg#
2184414cce6aSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
218544d8e951Smrg#
2186414cce6aSmrg# OS and distros often splits groff in a basic and full package, the former
2187414cce6aSmrg# having the groff program and the later having devices, fonts and macros
2188414cce6aSmrg# Checking for the groff executable is not enough.
218944d8e951Smrg#
2190414cce6aSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
2191414cce6aSmrg# unset HAVE_GROFF or GROFF env variables.
2192414cce6aSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2193414cce6aSmrg#
2194414cce6aSmrgAC_DEFUN([XORG_WITH_GROFF],[
2195414cce6aSmrgAC_ARG_VAR([GROFF], [Path to groff command])
2196414cce6aSmrgm4_define([_defopt], m4_default([$1], [auto]))
2197414cce6aSmrgAC_ARG_WITH(groff,
2198414cce6aSmrg	AS_HELP_STRING([--with-groff],
2199414cce6aSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2200414cce6aSmrg	   [use_groff=$withval], [use_groff=]_defopt)
2201414cce6aSmrgm4_undefine([_defopt])
220244d8e951Smrg
2203414cce6aSmrgif test "x$use_groff" = x"auto"; then
2204414cce6aSmrg   AC_PATH_PROG([GROFF], [groff])
2205414cce6aSmrg   if test "x$GROFF" = "x"; then
2206414cce6aSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2207414cce6aSmrg	have_groff=no
2208414cce6aSmrg   else
2209414cce6aSmrg        have_groff=yes
2210414cce6aSmrg   fi
2211414cce6aSmrgelif test "x$use_groff" = x"yes" ; then
2212414cce6aSmrg   AC_PATH_PROG([GROFF], [groff])
2213414cce6aSmrg   if test "x$GROFF" = "x"; then
2214414cce6aSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2215414cce6aSmrg   fi
2216414cce6aSmrg   have_groff=yes
2217414cce6aSmrgelif test "x$use_groff" = x"no" ; then
2218414cce6aSmrg   if test "x$GROFF" != "x"; then
2219414cce6aSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2220414cce6aSmrg   fi
2221414cce6aSmrg   have_groff=no
222250539131Smrgelse
2223414cce6aSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
222450539131Smrgfi
2225ded1caa4Smrg
2226414cce6aSmrg# We have groff, test for the presence of the macro packages
2227414cce6aSmrgif test "x$have_groff" = x"yes"; then
2228414cce6aSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2229414cce6aSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2230414cce6aSmrg        groff_ms_works=yes
2231414cce6aSmrg    else
2232414cce6aSmrg        groff_ms_works=no
223344d8e951Smrg    fi
2234414cce6aSmrg    AC_MSG_RESULT([$groff_ms_works])
2235414cce6aSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2236414cce6aSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2237414cce6aSmrg        groff_mm_works=yes
2238414cce6aSmrg    else
2239414cce6aSmrg        groff_mm_works=no
2240414cce6aSmrg    fi
2241414cce6aSmrg    AC_MSG_RESULT([$groff_mm_works])
224250539131Smrgfi
224344d8e951Smrg
2244414cce6aSmrg# We have groff, test for HTML dependencies, one command per package
2245414cce6aSmrgif test "x$have_groff" = x"yes"; then
2246414cce6aSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2247414cce6aSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2248414cce6aSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2249414cce6aSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2250414cce6aSmrg      have_groff_html=yes
2251414cce6aSmrg   else
2252414cce6aSmrg      have_groff_html=no
2253414cce6aSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2254414cce6aSmrg   fi
2255414cce6aSmrgfi
225644d8e951Smrg
2257414cce6aSmrg# Set Automake conditionals for Makefiles
2258414cce6aSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2259414cce6aSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2260414cce6aSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2261414cce6aSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2262414cce6aSmrg]) # XORG_WITH_GROFF
226344d8e951Smrg
2264414cce6aSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2265414cce6aSmrg# ---------------------------------------
2266414cce6aSmrg# Minimum version: 1.6.0
2267414cce6aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2268414cce6aSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2269414cce6aSmrg#
2270414cce6aSmrg# Documentation tools are not always available on all platforms and sometimes
2271414cce6aSmrg# not at the appropriate level. This macro enables a module to test for the
2272414cce6aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2273414cce6aSmrg# the --with-fop option, it allows maximum flexibility in making decisions
2274414cce6aSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
2275414cce6aSmrg# --with-fop assumes 'auto'.
2276414cce6aSmrg#
2277414cce6aSmrg# Interface to module:
2278414cce6aSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2279414cce6aSmrg# FOP:	 	returns the path of the fop program found
2280414cce6aSmrg#		returns the path set by the user in the environment
2281414cce6aSmrg# --with-fop: 	'yes' user instructs the module to use fop
2282414cce6aSmrg#		'no' user instructs the module not to use fop
2283414cce6aSmrg#
2284414cce6aSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2285414cce6aSmrg#
2286414cce6aSmrgAC_DEFUN([XORG_WITH_FOP],[
2287414cce6aSmrgAC_ARG_VAR([FOP], [Path to fop command])
2288414cce6aSmrgm4_define([_defopt], m4_default([$2], [auto]))
2289414cce6aSmrgAC_ARG_WITH(fop,
2290414cce6aSmrg	AS_HELP_STRING([--with-fop],
2291414cce6aSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2292414cce6aSmrg	   [use_fop=$withval], [use_fop=]_defopt)
2293414cce6aSmrgm4_undefine([_defopt])
229444d8e951Smrg
2295414cce6aSmrgif test "x$use_fop" = x"auto"; then
2296414cce6aSmrg   AC_PATH_PROG([FOP], [fop])
2297414cce6aSmrg   if test "x$FOP" = "x"; then
2298414cce6aSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2299414cce6aSmrg	have_fop=no
2300414cce6aSmrg   else
2301414cce6aSmrg        have_fop=yes
2302414cce6aSmrg   fi
2303414cce6aSmrgelif test "x$use_fop" = x"yes" ; then
2304414cce6aSmrg   AC_PATH_PROG([FOP], [fop])
2305414cce6aSmrg   if test "x$FOP" = "x"; then
2306414cce6aSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2307414cce6aSmrg   fi
2308414cce6aSmrg   have_fop=yes
2309414cce6aSmrgelif test "x$use_fop" = x"no" ; then
2310414cce6aSmrg   if test "x$FOP" != "x"; then
2311414cce6aSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2312414cce6aSmrg   fi
2313414cce6aSmrg   have_fop=no
2314414cce6aSmrgelse
2315414cce6aSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
231650539131Smrgfi
2317ded1caa4Smrg
2318414cce6aSmrg# Test for a minimum version of fop, if provided.
2319414cce6aSmrgm4_ifval([$1],
2320414cce6aSmrg[if test "$have_fop" = yes; then
2321414cce6aSmrg    # scrape the fop version
2322414cce6aSmrg    AC_MSG_CHECKING([for fop minimum version])
2323414cce6aSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2324414cce6aSmrg    AC_MSG_RESULT([$fop_version])
2325414cce6aSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
2326414cce6aSmrg        [if test "x$use_fop" = xauto; then
2327414cce6aSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2328414cce6aSmrg            have_fop=no
2329414cce6aSmrg        else
2330414cce6aSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2331414cce6aSmrg        fi])
2332414cce6aSmrgfi])
2333414cce6aSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2334414cce6aSmrg]) # XORG_WITH_FOP
2335ded1caa4Smrg
2336414cce6aSmrg# XORG_WITH_M4([MIN-VERSION])
2337414cce6aSmrg# ---------------------------
2338414cce6aSmrg# Minimum version: 1.19.0
233950539131Smrg#
2340414cce6aSmrg# This macro attempts to locate an m4 macro processor which supports
2341414cce6aSmrg# -I option and is only useful for modules relying on M4 in order to
2342414cce6aSmrg# expand macros in source code files.
234344d8e951Smrg#
2344414cce6aSmrg# Interface to module:
2345414cce6aSmrg# M4:	 	returns the path of the m4 program found
2346414cce6aSmrg#		returns the path set by the user in the environment
2347414cce6aSmrg#
2348414cce6aSmrgAC_DEFUN([XORG_WITH_M4], [
2349414cce6aSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2350414cce6aSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2351414cce6aSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2352414cce6aSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2353414cce6aSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2354414cce6aSmrg   [$PATH:/usr/gnu/bin])])
2355ded1caa4Smrg
2356414cce6aSmrgAC_SUBST([M4], [$ac_cv_path_M4])
2357414cce6aSmrg]) # XORG_WITH_M4
2358ded1caa4Smrg
2359414cce6aSmrg# XORG_WITH_PS2PDF([DEFAULT])
2360414cce6aSmrg# ----------------
2361414cce6aSmrg# Minimum version: 1.6.0
2362414cce6aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2363414cce6aSmrg#
2364414cce6aSmrg# Documentation tools are not always available on all platforms and sometimes
2365414cce6aSmrg# not at the appropriate level. This macro enables a module to test for the
2366414cce6aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2367414cce6aSmrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
2368414cce6aSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2369414cce6aSmrg# --with-ps2pdf assumes 'auto'.
2370414cce6aSmrg#
2371414cce6aSmrg# Interface to module:
2372414cce6aSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2373414cce6aSmrg# PS2PDF:	returns the path of the ps2pdf program found
2374414cce6aSmrg#		returns the path set by the user in the environment
2375414cce6aSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2376414cce6aSmrg#		 'no' user instructs the module not to use ps2pdf
2377414cce6aSmrg#
2378414cce6aSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2379414cce6aSmrg#
2380414cce6aSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2381414cce6aSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2382414cce6aSmrgm4_define([_defopt], m4_default([$1], [auto]))
2383414cce6aSmrgAC_ARG_WITH(ps2pdf,
2384414cce6aSmrg	AS_HELP_STRING([--with-ps2pdf],
2385414cce6aSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2386414cce6aSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2387414cce6aSmrgm4_undefine([_defopt])
2388ded1caa4Smrg
2389414cce6aSmrgif test "x$use_ps2pdf" = x"auto"; then
2390414cce6aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2391414cce6aSmrg   if test "x$PS2PDF" = "x"; then
2392414cce6aSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2393414cce6aSmrg	have_ps2pdf=no
2394414cce6aSmrg   else
2395414cce6aSmrg        have_ps2pdf=yes
2396414cce6aSmrg   fi
2397414cce6aSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2398414cce6aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2399414cce6aSmrg   if test "x$PS2PDF" = "x"; then
2400414cce6aSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2401414cce6aSmrg   fi
2402414cce6aSmrg   have_ps2pdf=yes
2403414cce6aSmrgelif test "x$use_ps2pdf" = x"no" ; then
2404414cce6aSmrg   if test "x$PS2PDF" != "x"; then
2405414cce6aSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2406414cce6aSmrg   fi
2407414cce6aSmrg   have_ps2pdf=no
2408414cce6aSmrgelse
2409414cce6aSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
241044d8e951Smrgfi
2411414cce6aSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2412414cce6aSmrg]) # XORG_WITH_PS2PDF
2413ded1caa4Smrg
2414414cce6aSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2415414cce6aSmrg# ----------------
2416414cce6aSmrg# Minimum version: 1.6.0
2417414cce6aSmrg#
2418414cce6aSmrg# Documentation tools are not always available on all platforms and sometimes
2419414cce6aSmrg# not at the appropriate level. This macro enables a builder to skip all
2420414cce6aSmrg# documentation targets except traditional man pages.
2421414cce6aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2422414cce6aSmrg# maximum flexibility in controlling documentation building.
2423414cce6aSmrg# Refer to:
2424414cce6aSmrg# XORG_WITH_XMLTO         --with-xmlto
2425414cce6aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2426414cce6aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2427414cce6aSmrg# XORG_WITH_FOP           --with-fop
2428414cce6aSmrg# XORG_WITH_GROFF         --with-groff
2429414cce6aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2430414cce6aSmrg#
2431414cce6aSmrg# Interface to module:
2432414cce6aSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2433414cce6aSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2434414cce6aSmrg#		 'no' user instructs the module not to generate docs
2435414cce6aSmrg# parm1:	specify the default value, yes or no.
2436414cce6aSmrg#
2437414cce6aSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2438414cce6aSmrgm4_define([docs_default], m4_default([$1], [yes]))
2439414cce6aSmrgAC_ARG_ENABLE(docs,
2440414cce6aSmrg	AS_HELP_STRING([--enable-docs],
2441414cce6aSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2442414cce6aSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2443414cce6aSmrgm4_undefine([docs_default])
2444414cce6aSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2445414cce6aSmrgAC_MSG_CHECKING([whether to build documentation])
2446414cce6aSmrgAC_MSG_RESULT([$build_docs])
2447414cce6aSmrg]) # XORG_ENABLE_DOCS
2448ded1caa4Smrg
2449414cce6aSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2450414cce6aSmrg# ----------------
2451414cce6aSmrg# Minimum version: 1.6.0
2452414cce6aSmrg#
2453414cce6aSmrg# This macro enables a builder to skip all developer documentation.
2454414cce6aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2455414cce6aSmrg# maximum flexibility in controlling documentation building.
2456414cce6aSmrg# Refer to:
2457414cce6aSmrg# XORG_WITH_XMLTO         --with-xmlto
2458414cce6aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2459414cce6aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2460414cce6aSmrg# XORG_WITH_FOP           --with-fop
2461414cce6aSmrg# XORG_WITH_GROFF         --with-groff
2462414cce6aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2463414cce6aSmrg#
2464414cce6aSmrg# Interface to module:
2465414cce6aSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2466414cce6aSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2467414cce6aSmrg#			'no' user instructs the module not to generate developer docs
2468414cce6aSmrg# parm1:		specify the default value, yes or no.
2469414cce6aSmrg#
2470414cce6aSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2471414cce6aSmrgm4_define([devel_default], m4_default([$1], [yes]))
2472414cce6aSmrgAC_ARG_ENABLE(devel-docs,
2473414cce6aSmrg	AS_HELP_STRING([--enable-devel-docs],
2474414cce6aSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2475414cce6aSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2476414cce6aSmrgm4_undefine([devel_default])
2477414cce6aSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2478414cce6aSmrgAC_MSG_CHECKING([whether to build developer documentation])
2479414cce6aSmrgAC_MSG_RESULT([$build_devel_docs])
2480414cce6aSmrg]) # XORG_ENABLE_DEVEL_DOCS
2481ded1caa4Smrg
2482414cce6aSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
2483414cce6aSmrg# ----------------
2484414cce6aSmrg# Minimum version: 1.6.0
2485414cce6aSmrg#
2486414cce6aSmrg# This macro enables a builder to skip all functional specification targets.
2487414cce6aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2488414cce6aSmrg# maximum flexibility in controlling documentation building.
2489414cce6aSmrg# Refer to:
2490414cce6aSmrg# XORG_WITH_XMLTO         --with-xmlto
2491414cce6aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2492414cce6aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2493414cce6aSmrg# XORG_WITH_FOP           --with-fop
2494414cce6aSmrg# XORG_WITH_GROFF         --with-groff
2495414cce6aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2496414cce6aSmrg#
2497414cce6aSmrg# Interface to module:
2498414cce6aSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2499414cce6aSmrg# --enable-specs:	'yes' user instructs the module to generate specs
2500414cce6aSmrg#			'no' user instructs the module not to generate specs
2501414cce6aSmrg# parm1:		specify the default value, yes or no.
2502414cce6aSmrg#
2503414cce6aSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2504414cce6aSmrgm4_define([spec_default], m4_default([$1], [yes]))
2505414cce6aSmrgAC_ARG_ENABLE(specs,
2506414cce6aSmrg	AS_HELP_STRING([--enable-specs],
2507414cce6aSmrg	   [Enable building the specs (default: ]spec_default[)]),
2508414cce6aSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
2509414cce6aSmrgm4_undefine([spec_default])
2510414cce6aSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2511414cce6aSmrgAC_MSG_CHECKING([whether to build functional specifications])
2512414cce6aSmrgAC_MSG_RESULT([$build_specs])
2513414cce6aSmrg]) # XORG_ENABLE_SPECS
251450539131Smrg
2515414cce6aSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2516414cce6aSmrg# ----------------------------------------------
2517414cce6aSmrg# Minimum version: 1.13.0
2518414cce6aSmrg#
2519414cce6aSmrg# This macro enables a builder to enable/disable unit testing
2520414cce6aSmrg# It makes no assumption about the test cases implementation
2521414cce6aSmrg# Test cases may or may not use Automake "Support for test suites"
2522414cce6aSmrg# They may or may not use the software utility library GLib
2523414cce6aSmrg#
2524414cce6aSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2525414cce6aSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2526414cce6aSmrg# The variable enable_unit_tests is used by other macros in this file.
2527414cce6aSmrg#
2528414cce6aSmrg# Interface to module:
2529414cce6aSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2530414cce6aSmrg# enable_unit_tests:    used in configure.ac for additional configuration
2531414cce6aSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2532414cce6aSmrg#			'no' user instructs the module not to build tests
2533414cce6aSmrg# parm1:		specify the default value, yes or no.
2534414cce6aSmrg#
2535414cce6aSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2536414cce6aSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2537414cce6aSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2538414cce6aSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2539414cce6aSmrgm4_define([_defopt], m4_default([$1], [auto]))
2540414cce6aSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2541414cce6aSmrg	[Enable building unit test cases (default: ]_defopt[)]),
2542414cce6aSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2543414cce6aSmrgm4_undefine([_defopt])
2544414cce6aSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2545414cce6aSmrgAC_MSG_CHECKING([whether to build unit test cases])
2546414cce6aSmrgAC_MSG_RESULT([$enable_unit_tests])
2547414cce6aSmrg]) # XORG_ENABLE_UNIT_TESTS
254844d8e951Smrg
2549414cce6aSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2550414cce6aSmrg# ------------------------------------------------------
2551414cce6aSmrg# Minimum version: 1.17.0
2552414cce6aSmrg#
2553414cce6aSmrg# This macro enables a builder to enable/disable integration testing
2554414cce6aSmrg# It makes no assumption about the test cases' implementation
2555414cce6aSmrg# Test cases may or may not use Automake "Support for test suites"
2556414cce6aSmrg#
2557414cce6aSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2558414cce6aSmrg# usually requires less dependencies and may be built and run under less
2559414cce6aSmrg# stringent environments than integration tests.
2560414cce6aSmrg#
2561414cce6aSmrg# Interface to module:
2562414cce6aSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2563414cce6aSmrg# enable_integration_tests:   used in configure.ac for additional configuration
2564414cce6aSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2565414cce6aSmrg#                             'no' user instructs the module not to build tests
2566414cce6aSmrg# parm1:                      specify the default value, yes or no.
2567414cce6aSmrg#
2568414cce6aSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2569414cce6aSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2570414cce6aSmrgm4_define([_defopt], m4_default([$1], [auto]))
2571414cce6aSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2572414cce6aSmrg	[Enable building integration test cases (default: ]_defopt[)]),
2573414cce6aSmrg	[enable_integration_tests=$enableval],
2574414cce6aSmrg	[enable_integration_tests=]_defopt)
2575414cce6aSmrgm4_undefine([_defopt])
2576414cce6aSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2577414cce6aSmrg	[test "x$enable_integration_tests" != xno])
2578414cce6aSmrgAC_MSG_CHECKING([whether to build unit test cases])
2579414cce6aSmrgAC_MSG_RESULT([$enable_integration_tests])
2580414cce6aSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
258144d8e951Smrg
2582414cce6aSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2583414cce6aSmrg# ----------------------------------------
2584414cce6aSmrg# Minimum version: 1.13.0
2585414cce6aSmrg#
2586414cce6aSmrg# GLib is a library which provides advanced data structures and functions.
2587414cce6aSmrg# This macro enables a module to test for the presence of Glib.
2588414cce6aSmrg#
2589414cce6aSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2590414cce6aSmrg# Otherwise the value of $enable_unit_tests is blank.
2591414cce6aSmrg#
2592414cce6aSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2593414cce6aSmrg# test support usually requires less dependencies and may be built and run under
2594414cce6aSmrg# less stringent environments than integration tests.
2595414cce6aSmrg#
2596414cce6aSmrg# Interface to module:
2597414cce6aSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
2598414cce6aSmrg# with_glib: used in configure.ac to know if GLib has been found
2599414cce6aSmrg# --with-glib:	'yes' user instructs the module to use glib
2600414cce6aSmrg#		'no' user instructs the module not to use glib
2601414cce6aSmrg#
2602414cce6aSmrgAC_DEFUN([XORG_WITH_GLIB],[
2603414cce6aSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2604414cce6aSmrgm4_define([_defopt], m4_default([$2], [auto]))
2605414cce6aSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2606414cce6aSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2607414cce6aSmrg	[with_glib=$withval], [with_glib=]_defopt)
2608414cce6aSmrgm4_undefine([_defopt])
260944d8e951Smrg
2610414cce6aSmrghave_glib=no
2611414cce6aSmrg# Do not probe GLib if user explicitly disabled unit testing
2612414cce6aSmrgif test "x$enable_unit_tests" != x"no"; then
2613414cce6aSmrg  # Do not probe GLib if user explicitly disabled it
2614414cce6aSmrg  if test "x$with_glib" != x"no"; then
2615414cce6aSmrg    m4_ifval(
2616414cce6aSmrg      [$1],
2617414cce6aSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2618414cce6aSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2619414cce6aSmrg    )
2620414cce6aSmrg  fi
2621414cce6aSmrgfi
262244d8e951Smrg
2623414cce6aSmrg# Not having GLib when unit testing has been explicitly requested is an error
2624414cce6aSmrgif test "x$enable_unit_tests" = x"yes"; then
2625414cce6aSmrg  if test "x$have_glib" = x"no"; then
2626414cce6aSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2627414cce6aSmrg  fi
2628414cce6aSmrgfi
262944d8e951Smrg
2630414cce6aSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
2631414cce6aSmrgif test "x$enable_unit_tests" = x"no"; then
2632414cce6aSmrg  if test "x$with_glib" = x"yes"; then
2633414cce6aSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2634414cce6aSmrg  fi
263550539131Smrgfi
263650539131Smrg
2637414cce6aSmrg# Not having GLib when it has been explicitly requested is an error
2638414cce6aSmrgif test "x$with_glib" = x"yes"; then
2639414cce6aSmrg  if test "x$have_glib" = x"no"; then
2640414cce6aSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2641414cce6aSmrg  fi
2642414cce6aSmrgfi
264350539131Smrg
2644414cce6aSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2645414cce6aSmrg]) # XORG_WITH_GLIB
264650539131Smrg
2647414cce6aSmrg# XORG_LD_WRAP([required|optional])
2648414cce6aSmrg# ---------------------------------
2649414cce6aSmrg# Minimum version: 1.13.0
2650414cce6aSmrg#
2651414cce6aSmrg# Check if linker supports -wrap, passed via compiler flags
2652414cce6aSmrg#
2653414cce6aSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2654414cce6aSmrg# Otherwise the value of $enable_unit_tests is blank.
2655414cce6aSmrg#
2656414cce6aSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2657414cce6aSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2658414cce6aSmrg# available, an argument of "optional" allows use when some unit tests require
2659414cce6aSmrg# ld -wrap and others do not.
2660414cce6aSmrg#
2661414cce6aSmrgAC_DEFUN([XORG_LD_WRAP],[
2662414cce6aSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2663414cce6aSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2664414cce6aSmrg                      void __wrap_exit(int status) { return; }],
2665414cce6aSmrg                     [exit(0);])])
2666414cce6aSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
2667414cce6aSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2668414cce6aSmrg  if test "x$have_ld_wrap" = x"no"; then
2669414cce6aSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2670414cce6aSmrg  fi
267150539131Smrgfi
2672414cce6aSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2673414cce6aSmrg#
2674414cce6aSmrg]) # XORG_LD_WRAP
267550539131Smrg
2676414cce6aSmrg# XORG_CHECK_LINKER_FLAGS
2677414cce6aSmrg# -----------------------
2678414cce6aSmrg# SYNOPSIS
2679414cce6aSmrg#
2680414cce6aSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2681414cce6aSmrg#
2682414cce6aSmrg# DESCRIPTION
2683414cce6aSmrg#
2684414cce6aSmrg#   Check whether the given linker FLAGS work with the current language's
2685414cce6aSmrg#   linker, or whether they give an error.
2686414cce6aSmrg#
2687414cce6aSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2688414cce6aSmrg#   success/failure.
2689414cce6aSmrg#
2690414cce6aSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
2691414cce6aSmrg#
2692414cce6aSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2693414cce6aSmrg#
2694414cce6aSmrg# LICENSE
2695414cce6aSmrg#
2696414cce6aSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2697414cce6aSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2698414cce6aSmrg#   Copyright (c) 2009 Matteo Frigo
2699414cce6aSmrg#
2700414cce6aSmrg#   This program is free software: you can redistribute it and/or modify it
2701414cce6aSmrg#   under the terms of the GNU General Public License as published by the
2702414cce6aSmrg#   Free Software Foundation, either version 3 of the License, or (at your
2703414cce6aSmrg#   option) any later version.
2704414cce6aSmrg#
2705414cce6aSmrg#   This program is distributed in the hope that it will be useful, but
2706414cce6aSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2707414cce6aSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2708414cce6aSmrg#   Public License for more details.
2709414cce6aSmrg#
2710414cce6aSmrg#   You should have received a copy of the GNU General Public License along
2711414cce6aSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2712414cce6aSmrg#
2713414cce6aSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
2714414cce6aSmrg#   gives unlimited permission to copy, distribute and modify the configure
2715414cce6aSmrg#   scripts that are the output of Autoconf when processing the Macro. You
2716414cce6aSmrg#   need not follow the terms of the GNU General Public License when using
2717414cce6aSmrg#   or distributing such scripts, even though portions of the text of the
2718414cce6aSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2719414cce6aSmrg#   all other use of the material that constitutes the Autoconf Macro.
2720414cce6aSmrg#
2721414cce6aSmrg#   This special exception to the GPL applies to versions of the Autoconf
2722414cce6aSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
2723414cce6aSmrg#   modified version of the Autoconf Macro, you may extend this special
2724414cce6aSmrg#   exception to the GPL to apply to your modified version as well.#
2725414cce6aSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2726414cce6aSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
2727414cce6aSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2728414cce6aSmrgAS_LITERAL_IF([$1],
2729414cce6aSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2730414cce6aSmrg      ax_save_FLAGS=$LDFLAGS
2731414cce6aSmrg      LDFLAGS="$1"
2732414cce6aSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2733414cce6aSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2734414cce6aSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2735414cce6aSmrg      LDFLAGS=$ax_save_FLAGS])],
2736414cce6aSmrg  [ax_save_FLAGS=$LDFLAGS
2737414cce6aSmrg   LDFLAGS="$1"
2738414cce6aSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2739414cce6aSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2740414cce6aSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2741414cce6aSmrg   LDFLAGS=$ax_save_FLAGS])
2742414cce6aSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2743414cce6aSmrgAC_MSG_RESULT($xorg_check_linker_flags)
2744414cce6aSmrgif test "x$xorg_check_linker_flags" = xyes; then
2745414cce6aSmrg	m4_default([$2], :)
2746414cce6aSmrgelse
2747414cce6aSmrg	m4_default([$3], :)
2748414cce6aSmrgfi
2749414cce6aSmrg]) # XORG_CHECK_LINKER_FLAGS
275050539131Smrg
2751414cce6aSmrg# XORG_MEMORY_CHECK_FLAGS
2752414cce6aSmrg# -----------------------
2753414cce6aSmrg# Minimum version: 1.16.0
275444d8e951Smrg#
2755414cce6aSmrg# This macro attempts to find appropriate memory checking functionality
2756414cce6aSmrg# for various platforms which unit testing code may use to catch various
2757414cce6aSmrg# forms of memory allocation and access errors in testing.
2758414cce6aSmrg#
2759414cce6aSmrg# Interface to module:
2760414cce6aSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2761414cce6aSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2762414cce6aSmrg#
2763414cce6aSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2764414cce6aSmrg#
2765414cce6aSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
276650539131Smrg
2767414cce6aSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2768414cce6aSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2769414cce6aSmrg           [Environment variables to enable memory checking in tests])
277050539131Smrg
2771414cce6aSmrg# Check for different types of support on different platforms
2772414cce6aSmrgcase $host_os in
2773414cce6aSmrg    solaris*)
2774414cce6aSmrg        AC_CHECK_LIB([umem], [umem_alloc],
2775414cce6aSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2776414cce6aSmrg        ;;
2777414cce6aSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2778414cce6aSmrg        # both directly and inverted, so should not be 0 or 255.
2779414cce6aSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
2780414cce6aSmrg        ;;
2781414cce6aSmrg    darwin*)
2782414cce6aSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2783414cce6aSmrg        ;;
2784414cce6aSmrg    *bsd*)
2785414cce6aSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2786414cce6aSmrg        ;;
2787414cce6aSmrgesac
278850539131Smrg
2789414cce6aSmrg# User supplied flags override default flags
2790414cce6aSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2791414cce6aSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2792414cce6aSmrgfi
279350539131Smrg
2794414cce6aSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2795414cce6aSmrg]) # XORG_WITH_LINT
279644d8e951Smrg
2797414cce6aSmrg# XORG_CHECK_MALLOC_ZERO
2798414cce6aSmrg# ----------------------
2799414cce6aSmrg# Minimum version: 1.0.0
280050539131Smrg#
2801414cce6aSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2802414cce6aSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2803414cce6aSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2804414cce6aSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2805414cce6aSmrgAC_ARG_ENABLE(malloc0returnsnull,
2806414cce6aSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2807414cce6aSmrg		       [malloc(0) returns NULL (default: auto)]),
2808414cce6aSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2809414cce6aSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
281050539131Smrg
2811414cce6aSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2812414cce6aSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2813414cce6aSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
2814414cce6aSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2815414cce6aSmrg#include <stdlib.h>
2816414cce6aSmrg],[
2817414cce6aSmrg    char *m0, *r0, *c0, *p;
2818414cce6aSmrg    m0 = malloc(0);
2819414cce6aSmrg    p = malloc(10);
2820414cce6aSmrg    r0 = realloc(p,0);
2821414cce6aSmrg    c0 = calloc(0,10);
2822414cce6aSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2823414cce6aSmrg])],
2824414cce6aSmrg		[xorg_cv_malloc0_returns_null=yes],
2825414cce6aSmrg		[xorg_cv_malloc0_returns_null=no])])
2826414cce6aSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2827414cce6aSmrgfi
2828414cce6aSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
282950539131Smrg
2830414cce6aSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2831414cce6aSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2832414cce6aSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2833414cce6aSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2834414cce6aSmrgelse
2835414cce6aSmrg	MALLOC_ZERO_CFLAGS=""
2836414cce6aSmrg	XMALLOC_ZERO_CFLAGS=""
2837414cce6aSmrg	XTMALLOC_ZERO_CFLAGS=""
2838414cce6aSmrgfi
283950539131Smrg
2840414cce6aSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2841414cce6aSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2842414cce6aSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2843414cce6aSmrg]) # XORG_CHECK_MALLOC_ZERO
2844ded1caa4Smrg
2845414cce6aSmrg# XORG_WITH_LINT()
2846414cce6aSmrg# ----------------
2847414cce6aSmrg# Minimum version: 1.1.0
284850539131Smrg#
2849414cce6aSmrg# This macro enables the use of a tool that flags some suspicious and
2850414cce6aSmrg# non-portable constructs (likely to be bugs) in C language source code.
2851414cce6aSmrg# It will attempt to locate the tool and use appropriate options.
2852414cce6aSmrg# There are various lint type tools on different platforms.
2853414cce6aSmrg#
2854414cce6aSmrg# Interface to module:
2855414cce6aSmrg# LINT:		returns the path to the tool found on the platform
2856414cce6aSmrg#		or the value set to LINT on the configure cmd line
2857414cce6aSmrg#		also an Automake conditional
2858414cce6aSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
2859414cce6aSmrg#
2860414cce6aSmrg# --with-lint:	'yes' user instructs the module to use lint
2861414cce6aSmrg#		'no' user instructs the module not to use lint (default)
2862414cce6aSmrg#
2863414cce6aSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2864414cce6aSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2865414cce6aSmrg#
2866414cce6aSmrgAC_DEFUN([XORG_WITH_LINT],[
286750539131Smrg
2868414cce6aSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2869414cce6aSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2870414cce6aSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2871414cce6aSmrg		[Use a lint-style source code checker (default: disabled)])],
2872414cce6aSmrg		[use_lint=$withval], [use_lint=no])
287350539131Smrg
2874414cce6aSmrg# Obtain platform specific info like program name and options
2875414cce6aSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2876414cce6aSmrgcase $host_os in
2877414cce6aSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2878414cce6aSmrg	lint_name=splint
2879414cce6aSmrg	lint_options="-badflag"
2880414cce6aSmrg	;;
2881414cce6aSmrg  *freebsd* | *netbsd*)
2882414cce6aSmrg	lint_name=lint
2883414cce6aSmrg	lint_options="-u -b"
2884414cce6aSmrg	;;
2885414cce6aSmrg  *solaris*)
2886414cce6aSmrg	lint_name=lint
2887414cce6aSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2888414cce6aSmrg	;;
2889414cce6aSmrgesac
289050539131Smrg
2891414cce6aSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2892414cce6aSmrgif test "x$use_lint" = x"yes" ; then
2893414cce6aSmrg   AC_PATH_PROG([LINT], [$lint_name])
2894414cce6aSmrg   if test "x$LINT" = "x"; then
2895414cce6aSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2896414cce6aSmrg   fi
2897414cce6aSmrgelif test "x$use_lint" = x"no" ; then
2898414cce6aSmrg   if test "x$LINT" != "x"; then
2899414cce6aSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2900414cce6aSmrg   fi
290144d8e951Smrgelse
2902414cce6aSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
290344d8e951Smrgfi
290450539131Smrg
2905414cce6aSmrg# User supplied flags override default flags
2906414cce6aSmrgif test "x$LINT_FLAGS" != "x"; then
2907414cce6aSmrg   lint_options=$LINT_FLAGS
2908414cce6aSmrgfi
290950539131Smrg
2910414cce6aSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2911414cce6aSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
291244d8e951Smrg
2913414cce6aSmrg]) # XORG_WITH_LINT
291444d8e951Smrg
2915414cce6aSmrg# XORG_LINT_LIBRARY(LIBNAME)
2916414cce6aSmrg# --------------------------
2917414cce6aSmrg# Minimum version: 1.1.0
291850539131Smrg#
2919414cce6aSmrg# Sets up flags for building lint libraries for checking programs that call
2920414cce6aSmrg# functions in the library.
2921414cce6aSmrg#
2922414cce6aSmrg# Interface to module:
2923414cce6aSmrg# LINTLIB		- Automake variable with the name of lint library file to make
2924414cce6aSmrg# MAKE_LINT_LIB		- Automake conditional
2925414cce6aSmrg#
2926414cce6aSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2927414cce6aSmrg#			  - 'no' user instructs the module not to create a lint library (default)
292844d8e951Smrg
2929414cce6aSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2930414cce6aSmrgAC_REQUIRE([XORG_WITH_LINT])
2931414cce6aSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2932414cce6aSmrg	[Create lint library (default: disabled)])],
2933414cce6aSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
293450539131Smrg
2935414cce6aSmrgif test "x$make_lint_lib" = x"yes" ; then
2936414cce6aSmrg   LINTLIB=llib-l$1.ln
2937414cce6aSmrg   if test "x$LINT" = "x"; then
2938414cce6aSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2939414cce6aSmrg   fi
2940414cce6aSmrgelif test "x$make_lint_lib" != x"no" ; then
2941414cce6aSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2942414cce6aSmrgfi
294350539131Smrg
2944414cce6aSmrgAC_SUBST(LINTLIB)
2945414cce6aSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2946ded1caa4Smrg
2947414cce6aSmrg]) # XORG_LINT_LIBRARY
2948ded1caa4Smrg
2949414cce6aSmrg# XORG_COMPILER_BRAND
2950414cce6aSmrg# -------------------
2951414cce6aSmrg# Minimum version: 1.14.0
2952414cce6aSmrg#
2953414cce6aSmrg# Checks for various brands of compilers and sets flags as appropriate:
2954414cce6aSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2955414cce6aSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2956414cce6aSmrg#   clang compiler - sets CLANGCC to "yes"
2957414cce6aSmrg#   Intel compiler - sets INTELCC to "yes"
2958414cce6aSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2959414cce6aSmrg#
2960414cce6aSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2961414cce6aSmrgAC_LANG_CASE(
2962414cce6aSmrg	[C], [
2963414cce6aSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
2964414cce6aSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
2965414cce6aSmrg		m4_version_prereq([2.70],
2966414cce6aSmrg			[AC_REQUIRE([AC_PROG_CC])],
2967414cce6aSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
2968414cce6aSmrg	],
2969414cce6aSmrg	[C++], [
2970414cce6aSmrg		AC_REQUIRE([AC_PROG_CXX])
2971414cce6aSmrg	]
2972414cce6aSmrg)
2973414cce6aSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2974414cce6aSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2975414cce6aSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2976414cce6aSmrg]) # XORG_COMPILER_BRAND
297750539131Smrg
2978414cce6aSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2979414cce6aSmrg# ---------------
2980414cce6aSmrg# Minimum version: 1.16.0
2981414cce6aSmrg#
2982414cce6aSmrg# Test if the compiler works when passed the given flag as a command line argument.
2983414cce6aSmrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
2984414cce6aSmrg# next flag in the list until there are no more options.
2985414cce6aSmrg#
2986414cce6aSmrg# Note that this does not guarantee that the compiler supports the flag as some
2987414cce6aSmrg# compilers will simply ignore arguments that they do not understand, but we do
2988414cce6aSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2989414cce6aSmrg# -Werror=unused-command-line-argument
2990414cce6aSmrg#
2991414cce6aSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2992414cce6aSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2993414cce6aSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2994414cce6aSmrg
2995414cce6aSmrgAC_LANG_COMPILER_REQUIRE
2996414cce6aSmrg
2997414cce6aSmrgAC_LANG_CASE(
2998414cce6aSmrg	[C], [
2999414cce6aSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
3000414cce6aSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3001414cce6aSmrg		m4_version_prereq([2.70],
3002414cce6aSmrg			[AC_REQUIRE([AC_PROG_CC])],
3003414cce6aSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3004414cce6aSmrg		define([PREFIX], [C])
3005414cce6aSmrg		define([CACHE_PREFIX], [cc])
3006414cce6aSmrg		define([COMPILER], [$CC])
3007414cce6aSmrg	],
3008414cce6aSmrg	[C++], [
3009414cce6aSmrg		define([PREFIX], [CXX])
3010414cce6aSmrg		define([CACHE_PREFIX], [cxx])
3011414cce6aSmrg		define([COMPILER], [$CXX])
3012414cce6aSmrg	]
3013414cce6aSmrg)
301450539131Smrg
3015414cce6aSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
3016414cce6aSmrg
3017414cce6aSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
3018414cce6aSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3019414cce6aSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
3020414cce6aSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3021414cce6aSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3022414cce6aSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
3023414cce6aSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
3024414cce6aSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
3025414cce6aSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3026414cce6aSmrgfi
302744d8e951Smrg
3028414cce6aSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
3029414cce6aSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
3030414cce6aSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3031414cce6aSmrg	fi
3032414cce6aSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3033414cce6aSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
3034414cce6aSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3035414cce6aSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3036414cce6aSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
3037414cce6aSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
3038414cce6aSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
3039414cce6aSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3040414cce6aSmrgfi
304144d8e951Smrg
3042414cce6aSmrgfound="no"
3043414cce6aSmrgm4_foreach([flag], m4_cdr($@), [
3044414cce6aSmrg	if test $found = "no" ; then
3045414cce6aSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
3046414cce6aSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3047414cce6aSmrg		fi
3048414cce6aSmrg
3049414cce6aSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
3050414cce6aSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3051414cce6aSmrg		fi
3052414cce6aSmrg
3053414cce6aSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
3054414cce6aSmrg
3055414cce6aSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
3056414cce6aSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
3057414cce6aSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
3058414cce6aSmrg		AC_CACHE_VAL($cacheid,
3059414cce6aSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3060414cce6aSmrg					     [eval $cacheid=yes],
3061414cce6aSmrg					     [eval $cacheid=no])])
3062414cce6aSmrg
3063414cce6aSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3064414cce6aSmrg
3065414cce6aSmrg		eval supported=\$$cacheid
3066414cce6aSmrg		AC_MSG_RESULT([$supported])
3067414cce6aSmrg		if test "$supported" = "yes" ; then
3068414cce6aSmrg			$1="$$1 ]flag["
3069414cce6aSmrg			found="yes"
3070414cce6aSmrg		fi
3071414cce6aSmrg	fi
3072414cce6aSmrg])
3073414cce6aSmrg]) # XORG_TESTSET_CFLAG
307444d8e951Smrg
3075414cce6aSmrg# XORG_COMPILER_FLAGS
3076414cce6aSmrg# ---------------
3077414cce6aSmrg# Minimum version: 1.16.0
3078414cce6aSmrg#
3079414cce6aSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
3080414cce6aSmrg# arguments supported by the selected compiler which do NOT alter the generated
3081414cce6aSmrg# code.  These arguments will cause the compiler to print various warnings
3082414cce6aSmrg# during compilation AND turn a conservative set of warnings into errors.
3083414cce6aSmrg#
3084414cce6aSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
3085414cce6aSmrg# future versions of util-macros as options are added to new compilers.
3086414cce6aSmrg#
3087414cce6aSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
3088414cce6aSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3089414cce6aSmrg
3090414cce6aSmrgAC_ARG_ENABLE(selective-werror,
3091414cce6aSmrg              AS_HELP_STRING([--disable-selective-werror],
3092414cce6aSmrg                             [Turn off selective compiler errors. (default: enabled)]),
3093414cce6aSmrg              [SELECTIVE_WERROR=$enableval],
3094414cce6aSmrg              [SELECTIVE_WERROR=yes])
3095414cce6aSmrg
3096414cce6aSmrgAC_LANG_CASE(
3097414cce6aSmrg        [C], [
3098414cce6aSmrg                define([PREFIX], [C])
3099414cce6aSmrg        ],
3100414cce6aSmrg        [C++], [
3101414cce6aSmrg                define([PREFIX], [CXX])
3102414cce6aSmrg        ]
3103414cce6aSmrg)
3104414cce6aSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
3105414cce6aSmrgif test "x$SUNCC" = "xyes"; then
3106414cce6aSmrg    [BASE_]PREFIX[FLAGS]="-v"
310744d8e951Smrgelse
3108414cce6aSmrg    [BASE_]PREFIX[FLAGS]=""
310950539131Smrgfi
311050539131Smrg
3111414cce6aSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3112414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
3113414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
3114414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
3115414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3116414cce6aSmrg
3117414cce6aSmrgAC_LANG_CASE(
3118414cce6aSmrg	[C], [
3119414cce6aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
3120414cce6aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
3121414cce6aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
3122414cce6aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
3123414cce6aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
3124414cce6aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
3125414cce6aSmrg	]
3126414cce6aSmrg)
312750539131Smrg
3128414cce6aSmrg# This chunk adds additional warnings that could catch undesired effects.
3129414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
3130414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
3131414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
3132414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
3133414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
3134414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
3135414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3136414cce6aSmrg
3137414cce6aSmrg# These are currently disabled because they are noisy.  They will be enabled
3138414cce6aSmrg# in the future once the codebase is sufficiently modernized to silence
3139414cce6aSmrg# them.  For now, I don't want them to drown out the other warnings.
3140414cce6aSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3141414cce6aSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3142414cce6aSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3143414cce6aSmrg
3144414cce6aSmrg# Turn some warnings into errors, so we don't accidentally get successful builds
3145414cce6aSmrg# when there are problems that should be fixed.
3146414cce6aSmrg
3147414cce6aSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3148414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3149414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3150414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3151414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3152414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3153414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3154414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3155414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3156414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3157414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3158414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3159414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3160414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3161414cce6aSmrgelse
3162414cce6aSmrgAC_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])
3163414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3164414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3165414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3166414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3167414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3168414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3169414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3170414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3171414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3172414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3173414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3174414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3175414cce6aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3176414cce6aSmrgfi
317750539131Smrg
3178414cce6aSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3179414cce6aSmrg]) # XORG_COMPILER_FLAGS
318050539131Smrg
3181414cce6aSmrg# XORG_CWARNFLAGS
3182414cce6aSmrg# ---------------
3183414cce6aSmrg# Minimum version: 1.2.0
3184414cce6aSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
318544d8e951Smrg#
3186414cce6aSmrg# Defines CWARNFLAGS to enable C compiler warnings.
3187414cce6aSmrg#
3188414cce6aSmrg# This function is deprecated because it defines -fno-strict-aliasing
3189414cce6aSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3190414cce6aSmrg# is needed, then it should be added explicitly in the module when
3191414cce6aSmrg# it is updated to use BASE_CFLAGS.
3192414cce6aSmrg#
3193414cce6aSmrgAC_DEFUN([XORG_CWARNFLAGS], [
3194414cce6aSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3195414cce6aSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3196414cce6aSmrgAC_LANG_CASE(
3197414cce6aSmrg	[C], [
3198414cce6aSmrg		CWARNFLAGS="$BASE_CFLAGS"
3199414cce6aSmrg		if  test "x$GCC" = xyes ; then
3200414cce6aSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3201414cce6aSmrg		fi
3202414cce6aSmrg		AC_SUBST(CWARNFLAGS)
3203414cce6aSmrg	]
3204414cce6aSmrg)
3205414cce6aSmrg]) # XORG_CWARNFLAGS
320650539131Smrg
3207414cce6aSmrg# XORG_STRICT_OPTION
3208414cce6aSmrg# -----------------------
3209414cce6aSmrg# Minimum version: 1.3.0
321050539131Smrg#
3211414cce6aSmrg# Add configure option to enable strict compilation flags, such as treating
3212414cce6aSmrg# warnings as fatal errors.
3213414cce6aSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3214414cce6aSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3215414cce6aSmrg#
3216414cce6aSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3217414cce6aSmrg# when strict compilation is unconditionally desired.
3218414cce6aSmrgAC_DEFUN([XORG_STRICT_OPTION], [
3219414cce6aSmrgAC_REQUIRE([XORG_CWARNFLAGS])
3220414cce6aSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3221414cce6aSmrg
3222414cce6aSmrgAC_ARG_ENABLE(strict-compilation,
3223414cce6aSmrg			  AS_HELP_STRING([--enable-strict-compilation],
3224414cce6aSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3225414cce6aSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
322650539131Smrg
3227414cce6aSmrgAC_LANG_CASE(
3228414cce6aSmrg        [C], [
3229414cce6aSmrg                define([PREFIX], [C])
3230414cce6aSmrg        ],
3231414cce6aSmrg        [C++], [
3232414cce6aSmrg                define([PREFIX], [CXX])
3233414cce6aSmrg        ]
3234414cce6aSmrg)
323550539131Smrg
3236414cce6aSmrg[STRICT_]PREFIX[FLAGS]=""
3237414cce6aSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3238414cce6aSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
323950539131Smrg
3240414cce6aSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3241414cce6aSmrg# activate it with -Werror, so we add it here explicitly.
3242414cce6aSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
324350539131Smrg
3244414cce6aSmrgif test "x$STRICT_COMPILE" = "xyes"; then
3245414cce6aSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3246414cce6aSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3247414cce6aSmrgfi
3248414cce6aSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3249414cce6aSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3250414cce6aSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3251414cce6aSmrg]) # XORG_STRICT_OPTION
325250539131Smrg
3253414cce6aSmrg# XORG_DEFAULT_NOCODE_OPTIONS
3254414cce6aSmrg# ---------------------------
3255414cce6aSmrg# Minimum version: 1.20.0
325644d8e951Smrg#
3257414cce6aSmrg# Defines default options for X.Org modules which don't compile code,
3258414cce6aSmrg# such as fonts, bitmaps, cursors, and docs.
3259414cce6aSmrg#
3260414cce6aSmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
3261414cce6aSmrgAC_REQUIRE([AC_PROG_INSTALL])
3262414cce6aSmrgXORG_RELEASE_VERSION
3263414cce6aSmrgXORG_CHANGELOG
3264414cce6aSmrgXORG_INSTALL
3265414cce6aSmrgXORG_MANPAGE_SECTIONS
3266414cce6aSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3267414cce6aSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3268414cce6aSmrg]) # XORG_DEFAULT_NOCODE_OPTIONS
326950539131Smrg
3270414cce6aSmrg# XORG_DEFAULT_OPTIONS
327144d8e951Smrg# --------------------
3272414cce6aSmrg# Minimum version: 1.3.0
327344d8e951Smrg#
3274414cce6aSmrg# Defines default options for X.Org modules which compile code.
327544d8e951Smrg#
3276414cce6aSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3277414cce6aSmrgAC_REQUIRE([AC_PROG_INSTALL])
3278414cce6aSmrgXORG_COMPILER_FLAGS
3279414cce6aSmrgXORG_CWARNFLAGS
3280414cce6aSmrgXORG_STRICT_OPTION
3281414cce6aSmrgXORG_DEFAULT_NOCODE_OPTIONS
3282414cce6aSmrg]) # XORG_DEFAULT_OPTIONS
3283414cce6aSmrg
3284414cce6aSmrg# XORG_INSTALL()
3285414cce6aSmrg# ----------------
3286414cce6aSmrg# Minimum version: 1.4.0
3287414cce6aSmrg#
3288414cce6aSmrg# Defines the variable INSTALL_CMD as the command to copy
3289414cce6aSmrg# INSTALL from $prefix/share/util-macros.
3290414cce6aSmrg#
3291414cce6aSmrgAC_DEFUN([XORG_INSTALL], [
3292414cce6aSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3293414cce6aSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3294414cce6aSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3295414cce6aSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3296414cce6aSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3297414cce6aSmrgtouch \$(top_srcdir)/INSTALL; \
3298414cce6aSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3299414cce6aSmrgAC_SUBST([INSTALL_CMD])
3300414cce6aSmrg]) # XORG_INSTALL
3301414cce6aSmrgdnl Copyright 2005 Red Hat, Inc
3302414cce6aSmrgdnl
3303414cce6aSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3304414cce6aSmrgdnl documentation for any purpose is hereby granted without fee, provided that
3305414cce6aSmrgdnl the above copyright notice appear in all copies and that both that
3306414cce6aSmrgdnl copyright notice and this permission notice appear in supporting
3307414cce6aSmrgdnl documentation.
3308414cce6aSmrgdnl
3309414cce6aSmrgdnl The above copyright notice and this permission notice shall be included
3310414cce6aSmrgdnl in all copies or substantial portions of the Software.
3311414cce6aSmrgdnl
3312414cce6aSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3313414cce6aSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3314414cce6aSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3315414cce6aSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3316414cce6aSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3317414cce6aSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3318414cce6aSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
3319414cce6aSmrgdnl
3320414cce6aSmrgdnl Except as contained in this notice, the name of the copyright holders shall
3321414cce6aSmrgdnl not be used in advertising or otherwise to promote the sale, use or
3322414cce6aSmrgdnl other dealings in this Software without prior written authorization
3323414cce6aSmrgdnl from the copyright holders.
3324414cce6aSmrgdnl
332550539131Smrg
3326414cce6aSmrg# XORG_RELEASE_VERSION
3327414cce6aSmrg# --------------------
3328414cce6aSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
332950539131Smrg
3330414cce6aSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3331414cce6aSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3332414cce6aSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3333414cce6aSmrg		[Major version of this package])
3334414cce6aSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3335414cce6aSmrg	if test "x$PVM" = "x"; then
3336414cce6aSmrg		PVM="0"
3337414cce6aSmrg	fi
3338414cce6aSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3339414cce6aSmrg		[$PVM],
3340414cce6aSmrg		[Minor version of this package])
3341414cce6aSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3342414cce6aSmrg	if test "x$PVP" = "x"; then
3343414cce6aSmrg		PVP="0"
3344414cce6aSmrg	fi
3345414cce6aSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3346414cce6aSmrg		[$PVP],
3347414cce6aSmrg		[Patch version of this package])
3348414cce6aSmrg])
334950539131Smrg
3350414cce6aSmrg# XORG_CHANGELOG()
3351414cce6aSmrg# ----------------
3352414cce6aSmrg# Minimum version: 1.2.0
3353414cce6aSmrg#
3354414cce6aSmrg# Defines the variable CHANGELOG_CMD as the command to generate
3355414cce6aSmrg# ChangeLog from git.
3356414cce6aSmrg#
3357414cce6aSmrg#
3358414cce6aSmrgAC_DEFUN([XORG_CHANGELOG], [
3359414cce6aSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3360414cce6aSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3361414cce6aSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3362414cce6aSmrgtouch \$(top_srcdir)/ChangeLog; \
3363414cce6aSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3364414cce6aSmrgAC_SUBST([CHANGELOG_CMD])
3365414cce6aSmrg]) # XORG_CHANGELOG
336650539131Smrg
3367