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