1541411ceSmrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2541411ceSmrg
3541411ceSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4a6fdc6faSmrg
5a6fdc6faSmrg# This file is free software; the Free Software Foundation
6a6fdc6faSmrg# gives unlimited permission to copy and/or distribute it,
7a6fdc6faSmrg# with or without modifications, as long as this notice is preserved.
8a6fdc6faSmrg
9a6fdc6faSmrg# This program is distributed in the hope that it will be useful,
10a6fdc6faSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11a6fdc6faSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12a6fdc6faSmrg# PARTICULAR PURPOSE.
13a6fdc6faSmrg
14541411ceSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
1535d5702bSmrgm4_ifndef([AC_AUTOCONF_VERSION],
1635d5702bSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17541411ceSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
18541411ceSmrg[m4_warning([this file was generated for autoconf 2.71.
1935d5702bSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
2035d5702bSmrgIf you have problems, you may need to regenerate the build system entirely.
21541411ceSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22eeced2e6Smrg
23541411ceSmrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
24eeced2e6Smrg#
25541411ceSmrg# This file is free software; the Free Software Foundation
26541411ceSmrg# gives unlimited permission to copy and/or distribute it,
27541411ceSmrg# with or without modifications, as long as this notice is preserved.
2835d5702bSmrg
29541411ceSmrg# AM_AUTOMAKE_VERSION(VERSION)
30541411ceSmrg# ----------------------------
31541411ceSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32541411ceSmrg# generated from the m4 files accompanying Automake X.Y.
33541411ceSmrg# (This private macro should not be called outside this file.)
34541411ceSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35541411ceSmrg[am__api_version='1.16'
36541411ceSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37541411ceSmrgdnl require some minimum version.  Point them to the right macro.
38541411ceSmrgm4_if([$1], [1.16.5], [],
39541411ceSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40541411ceSmrg])
41a6fdc6faSmrg
42541411ceSmrg# _AM_AUTOCONF_VERSION(VERSION)
43541411ceSmrg# -----------------------------
44541411ceSmrg# aclocal traces this macro to find the Autoconf version.
45541411ceSmrg# This is a private macro too.  Using m4_define simplifies
46541411ceSmrg# the logic in aclocal, which can simply ignore this definition.
47541411ceSmrgm4_define([_AM_AUTOCONF_VERSION], [])
48a6fdc6faSmrg
49541411ceSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50541411ceSmrg# -------------------------------
51541411ceSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52541411ceSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53541411ceSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54541411ceSmrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
55541411ceSmrgm4_ifndef([AC_AUTOCONF_VERSION],
56541411ceSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57541411ceSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58a6fdc6faSmrg
59541411ceSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60a6fdc6faSmrg
61541411ceSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
62541411ceSmrg#
63541411ceSmrg# This file is free software; the Free Software Foundation
64541411ceSmrg# gives unlimited permission to copy and/or distribute it,
65541411ceSmrg# with or without modifications, as long as this notice is preserved.
66eeced2e6Smrg
67541411ceSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68541411ceSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69541411ceSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70a6fdc6faSmrg#
71541411ceSmrg# Of course, Automake must honor this variable whenever it calls a
72541411ceSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73541411ceSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74541411ceSmrg# depending on how configure is run.  This is pretty annoying, since
75541411ceSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76541411ceSmrg# source directory, any form will work fine, but in subdirectories a
77541411ceSmrg# relative path needs to be adjusted first.
78a6fdc6faSmrg#
79541411ceSmrg# $ac_aux_dir/missing
80541411ceSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81541411ceSmrg# $top_srcdir/$ac_aux_dir/missing
82541411ceSmrg#    fails if $ac_aux_dir is absolute,
83541411ceSmrg#    fails when called from a subdirectory in a VPATH build with
84541411ceSmrg#          a relative $ac_aux_dir
8535d5702bSmrg#
86541411ceSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87541411ceSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
88541411ceSmrg# harmless because $srcdir is '.', but things will broke when you
89541411ceSmrg# start a VPATH build or use an absolute $srcdir.
90eeced2e6Smrg#
91541411ceSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92541411ceSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93541411ceSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94541411ceSmrg# and then we would define $MISSING as
95541411ceSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96541411ceSmrg# This will work as long as MISSING is not called from configure, because
97541411ceSmrg# unfortunately $(top_srcdir) has no meaning in configure.
98541411ceSmrg# However there are other variables, like CC, which are often used in
99541411ceSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100eeced2e6Smrg#
101541411ceSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
102541411ceSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
103541411ceSmrg# configured tree to be moved without reconfiguration.
104541411ceSmrg
105541411ceSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106541411ceSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107541411ceSmrg# Expand $ac_aux_dir to an absolute path.
108541411ceSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109eeced2e6Smrg])
110a6fdc6faSmrg
111541411ceSmrg# Do all the work for Automake.                             -*- Autoconf -*-
112a6fdc6faSmrg
113541411ceSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
11435d5702bSmrg#
115541411ceSmrg# This file is free software; the Free Software Foundation
116541411ceSmrg# gives unlimited permission to copy and/or distribute it,
117541411ceSmrg# with or without modifications, as long as this notice is preserved.
118a6fdc6faSmrg
119541411ceSmrg# This macro actually does too much.  Some checks are only needed if
120541411ceSmrg# your package does certain things.  But this isn't really a big deal.
121a6fdc6faSmrg
122541411ceSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
123541411ceSmrgm4_define([AC_PROG_CC],
124541411ceSmrgm4_defn([AC_PROG_CC])
125541411ceSmrg[_AM_PROG_CC_C_O
126eeced2e6Smrg])
127a6fdc6faSmrg
128541411ceSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
129541411ceSmrg# AM_INIT_AUTOMAKE([OPTIONS])
130541411ceSmrg# -----------------------------------------------
131541411ceSmrg# The call with PACKAGE and VERSION arguments is the old style
132541411ceSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
133541411ceSmrg# and VERSION should now be passed to AC_INIT and removed from
134541411ceSmrg# the call to AM_INIT_AUTOMAKE.
135541411ceSmrg# We support both call styles for the transition.  After
136541411ceSmrg# the next Automake release, Autoconf can make the AC_INIT
137541411ceSmrg# arguments mandatory, and then we can depend on a new Autoconf
138541411ceSmrg# release and drop the old call support.
139541411ceSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
140541411ceSmrg[AC_PREREQ([2.65])dnl
141541411ceSmrgm4_ifdef([_$0_ALREADY_INIT],
142541411ceSmrg  [m4_fatal([$0 expanded multiple times
143541411ceSmrg]m4_defn([_$0_ALREADY_INIT]))],
144541411ceSmrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
145541411ceSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
146541411ceSmrgdnl the ones we care about.
147541411ceSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
148541411ceSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
149541411ceSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
150541411ceSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
151541411ceSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
152541411ceSmrg  # is not polluted with repeated "-I."
153541411ceSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
154541411ceSmrg  # test to see if srcdir already configured
155541411ceSmrg  if test -f $srcdir/config.status; then
156541411ceSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
157541411ceSmrg  fi
158541411ceSmrgfi
159a6fdc6faSmrg
160541411ceSmrg# test whether we have cygpath
161541411ceSmrgif test -z "$CYGPATH_W"; then
162541411ceSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
163541411ceSmrg    CYGPATH_W='cygpath -w'
164541411ceSmrg  else
165541411ceSmrg    CYGPATH_W=echo
166541411ceSmrg  fi
167541411ceSmrgfi
168541411ceSmrgAC_SUBST([CYGPATH_W])
16935d5702bSmrg
170541411ceSmrg# Define the identity of the package.
171541411ceSmrgdnl Distinguish between old-style and new-style calls.
172541411ceSmrgm4_ifval([$2],
173541411ceSmrg[AC_DIAGNOSE([obsolete],
174541411ceSmrg             [$0: two- and three-arguments forms are deprecated.])
175541411ceSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
176541411ceSmrg AC_SUBST([PACKAGE], [$1])dnl
177541411ceSmrg AC_SUBST([VERSION], [$2])],
178541411ceSmrg[_AM_SET_OPTIONS([$1])dnl
179541411ceSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
180541411ceSmrgm4_if(
181541411ceSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
182541411ceSmrg  [ok:ok],,
183541411ceSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
184541411ceSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
185541411ceSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
186a6fdc6faSmrg
187541411ceSmrg_AM_IF_OPTION([no-define],,
188541411ceSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
189541411ceSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
190a6fdc6faSmrg
191541411ceSmrg# Some tools Automake needs.
192541411ceSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
193541411ceSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
194541411ceSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
195541411ceSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
196541411ceSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
197541411ceSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
198541411ceSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
199541411ceSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
200541411ceSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
201541411ceSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
202541411ceSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
203541411ceSmrg# dies out for good.  For more background, see:
204541411ceSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
205541411ceSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
206541411ceSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
207541411ceSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
208541411ceSmrg# system "awk" is bad on some platforms.
209541411ceSmrgAC_REQUIRE([AC_PROG_AWK])dnl
210541411ceSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
211541411ceSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
212541411ceSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
213541411ceSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
214541411ceSmrg			     [_AM_PROG_TAR([v7])])])
215541411ceSmrg_AM_IF_OPTION([no-dependencies],,
216541411ceSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
217541411ceSmrg		  [_AM_DEPENDENCIES([CC])],
218541411ceSmrg		  [m4_define([AC_PROG_CC],
219541411ceSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
220541411ceSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
221541411ceSmrg		  [_AM_DEPENDENCIES([CXX])],
222541411ceSmrg		  [m4_define([AC_PROG_CXX],
223541411ceSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
224541411ceSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
225541411ceSmrg		  [_AM_DEPENDENCIES([OBJC])],
226541411ceSmrg		  [m4_define([AC_PROG_OBJC],
227541411ceSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
228541411ceSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
229541411ceSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
230541411ceSmrg		  [m4_define([AC_PROG_OBJCXX],
231541411ceSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
23235d5702bSmrg])
233541411ceSmrg# Variables for tags utilities; see am/tags.am
234541411ceSmrgif test -z "$CTAGS"; then
235541411ceSmrg  CTAGS=ctags
236541411ceSmrgfi
237541411ceSmrgAC_SUBST([CTAGS])
238541411ceSmrgif test -z "$ETAGS"; then
239541411ceSmrg  ETAGS=etags
240541411ceSmrgfi
241541411ceSmrgAC_SUBST([ETAGS])
242541411ceSmrgif test -z "$CSCOPE"; then
243541411ceSmrg  CSCOPE=cscope
244541411ceSmrgfi
245541411ceSmrgAC_SUBST([CSCOPE])
24635d5702bSmrg
247541411ceSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
248541411ceSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
249541411ceSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
250541411ceSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
251541411ceSmrgAC_CONFIG_COMMANDS_PRE(dnl
252541411ceSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
253541411ceSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
25435d5702bSmrg
255541411ceSmrg# POSIX will say in a future version that running "rm -f" with no argument
256541411ceSmrg# is OK; and we want to be able to make that assumption in our Makefile
257541411ceSmrg# recipes.  So use an aggressive probe to check that the usage we want is
258541411ceSmrg# actually supported "in the wild" to an acceptable degree.
259541411ceSmrg# See automake bug#10828.
260541411ceSmrg# To make any issue more visible, cause the running configure to be aborted
261541411ceSmrg# by default if the 'rm' program in use doesn't match our expectations; the
262541411ceSmrg# user can still override this though.
263541411ceSmrgif rm -f && rm -fr && rm -rf; then : OK; else
264541411ceSmrg  cat >&2 <<'END'
265541411ceSmrgOops!
266541411ceSmrg
267541411ceSmrgYour 'rm' program seems unable to run without file operands specified
268541411ceSmrgon the command line, even when the '-f' option is present.  This is contrary
269541411ceSmrgto the behaviour of most rm programs out there, and not conforming with
270541411ceSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
271541411ceSmrg
272541411ceSmrgPlease tell bug-automake@gnu.org about your system, including the value
273541411ceSmrgof your $PATH and any error possibly output before this message.  This
274541411ceSmrgcan help us improve future automake versions.
27535d5702bSmrg
276541411ceSmrgEND
277541411ceSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
278541411ceSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
279541411ceSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
280541411ceSmrg    echo >&2
281541411ceSmrg  else
282541411ceSmrg    cat >&2 <<'END'
283541411ceSmrgAborting the configuration process, to ensure you take notice of the issue.
28435d5702bSmrg
285541411ceSmrgYou can download and install GNU coreutils to get an 'rm' implementation
286541411ceSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
287eeced2e6Smrg
288541411ceSmrgIf you want to complete the configuration process using your problematic
289541411ceSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
290541411ceSmrgto "yes", and re-run configure.
291541411ceSmrg
292541411ceSmrgEND
293541411ceSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
294541411ceSmrg  fi
295541411ceSmrgfi
296541411ceSmrgdnl The trailing newline in this macro's definition is deliberate, for
297541411ceSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
298541411ceSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
29935d5702bSmrg])
30035d5702bSmrg
301541411ceSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
302541411ceSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
303541411ceSmrgdnl mangled by Autoconf and run in a shell conditional statement.
304541411ceSmrgm4_define([_AC_COMPILER_EXEEXT],
305541411ceSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
30635d5702bSmrg
307541411ceSmrg# When config.status generates a header, we must update the stamp-h file.
308541411ceSmrg# This file resides in the same directory as the config header
309541411ceSmrg# that is generated.  The stamp files are numbered to have different names.
310eeced2e6Smrg
311541411ceSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
312541411ceSmrg# loop where config.status creates the headers, so we can generate
313541411ceSmrg# our stamp files there.
314541411ceSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
315541411ceSmrg[# Compute $1's index in $config_headers.
316541411ceSmrg_am_arg=$1
317541411ceSmrg_am_stamp_count=1
318541411ceSmrgfor _am_header in $config_headers :; do
319541411ceSmrg  case $_am_header in
320541411ceSmrg    $_am_arg | $_am_arg:* )
321541411ceSmrg      break ;;
322541411ceSmrg    * )
323541411ceSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
324541411ceSmrg  esac
325541411ceSmrgdone
326541411ceSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
32735d5702bSmrg
328541411ceSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
329541411ceSmrg#
330541411ceSmrg# This file is free software; the Free Software Foundation
331541411ceSmrg# gives unlimited permission to copy and/or distribute it,
332541411ceSmrg# with or without modifications, as long as this notice is preserved.
33335d5702bSmrg
334541411ceSmrg# AM_PROG_INSTALL_SH
335541411ceSmrg# ------------------
336541411ceSmrg# Define $install_sh.
337541411ceSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
338541411ceSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
339541411ceSmrgif test x"${install_sh+set}" != xset; then
340541411ceSmrg  case $am_aux_dir in
341541411ceSmrg  *\ * | *\	*)
342541411ceSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
343541411ceSmrg  *)
344541411ceSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
345541411ceSmrg  esac
346541411ceSmrgfi
347541411ceSmrgAC_SUBST([install_sh])])
34835d5702bSmrg
349541411ceSmrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
35035d5702bSmrg#
351541411ceSmrg# This file is free software; the Free Software Foundation
352541411ceSmrg# gives unlimited permission to copy and/or distribute it,
353541411ceSmrg# with or without modifications, as long as this notice is preserved.
35435d5702bSmrg
355541411ceSmrg# Check whether the underlying file-system supports filenames
356541411ceSmrg# with a leading dot.  For instance MS-DOS doesn't.
357541411ceSmrgAC_DEFUN([AM_SET_LEADING_DOT],
358541411ceSmrg[rm -rf .tst 2>/dev/null
359541411ceSmrgmkdir .tst 2>/dev/null
360541411ceSmrgif test -d .tst; then
361541411ceSmrg  am__leading_dot=.
362541411ceSmrgelse
363541411ceSmrg  am__leading_dot=_
364541411ceSmrgfi
365541411ceSmrgrmdir .tst 2>/dev/null
366541411ceSmrgAC_SUBST([am__leading_dot])])
36735d5702bSmrg
368541411ceSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
369eeced2e6Smrg
370541411ceSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
37135d5702bSmrg#
372541411ceSmrg# This file is free software; the Free Software Foundation
373541411ceSmrg# gives unlimited permission to copy and/or distribute it,
374541411ceSmrg# with or without modifications, as long as this notice is preserved.
37535d5702bSmrg
376541411ceSmrg# AM_MISSING_PROG(NAME, PROGRAM)
377541411ceSmrg# ------------------------------
378541411ceSmrgAC_DEFUN([AM_MISSING_PROG],
379541411ceSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
380541411ceSmrg$1=${$1-"${am_missing_run}$2"}
381541411ceSmrgAC_SUBST($1)])
382541411ceSmrg
383541411ceSmrg# AM_MISSING_HAS_RUN
384541411ceSmrg# ------------------
385541411ceSmrg# Define MISSING if not defined so far and test if it is modern enough.
386541411ceSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
387541411ceSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
388541411ceSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
389541411ceSmrgAC_REQUIRE_AUX_FILE([missing])dnl
390541411ceSmrgif test x"${MISSING+set}" != xset; then
391541411ceSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
392541411ceSmrgfi
393541411ceSmrg# Use eval to expand $SHELL
394541411ceSmrgif eval "$MISSING --is-lightweight"; then
395541411ceSmrg  am_missing_run="$MISSING "
396541411ceSmrgelse
397541411ceSmrg  am_missing_run=
398541411ceSmrg  AC_MSG_WARN(['missing' script is too old or missing])
399541411ceSmrgfi
400541411ceSmrg])
401541411ceSmrg
402541411ceSmrg# Helper functions for option handling.                     -*- Autoconf -*-
40335d5702bSmrg
404541411ceSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
405eeced2e6Smrg#
406541411ceSmrg# This file is free software; the Free Software Foundation
407541411ceSmrg# gives unlimited permission to copy and/or distribute it,
408541411ceSmrg# with or without modifications, as long as this notice is preserved.
409541411ceSmrg
410541411ceSmrg# _AM_MANGLE_OPTION(NAME)
411541411ceSmrg# -----------------------
412541411ceSmrgAC_DEFUN([_AM_MANGLE_OPTION],
413541411ceSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
414541411ceSmrg
415541411ceSmrg# _AM_SET_OPTION(NAME)
416541411ceSmrg# --------------------
417541411ceSmrg# Set option NAME.  Presently that only means defining a flag for this option.
418541411ceSmrgAC_DEFUN([_AM_SET_OPTION],
419541411ceSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
420541411ceSmrg
421541411ceSmrg# _AM_SET_OPTIONS(OPTIONS)
422541411ceSmrg# ------------------------
423541411ceSmrg# OPTIONS is a space-separated list of Automake options.
424541411ceSmrgAC_DEFUN([_AM_SET_OPTIONS],
425541411ceSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
426541411ceSmrg
427541411ceSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
428541411ceSmrg# -------------------------------------------
429541411ceSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
430541411ceSmrgAC_DEFUN([_AM_IF_OPTION],
431541411ceSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
432541411ceSmrg
433541411ceSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
434541411ceSmrg
435541411ceSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
436eeced2e6Smrg#
437541411ceSmrg# This file is free software; the Free Software Foundation
438541411ceSmrg# gives unlimited permission to copy and/or distribute it,
439541411ceSmrg# with or without modifications, as long as this notice is preserved.
440541411ceSmrg
441541411ceSmrg# AM_SANITY_CHECK
442541411ceSmrg# ---------------
443541411ceSmrgAC_DEFUN([AM_SANITY_CHECK],
444541411ceSmrg[AC_MSG_CHECKING([whether build environment is sane])
445541411ceSmrg# Reject unsafe characters in $srcdir or the absolute working directory
446541411ceSmrg# name.  Accept space and tab only in the latter.
447541411ceSmrgam_lf='
448541411ceSmrg'
449541411ceSmrgcase `pwd` in
450541411ceSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
451541411ceSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
452541411ceSmrgesac
453541411ceSmrgcase $srcdir in
454541411ceSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
455541411ceSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
456541411ceSmrgesac
457541411ceSmrg
458541411ceSmrg# Do 'set' in a subshell so we don't clobber the current shell's
459541411ceSmrg# arguments.  Must try -L first in case configure is actually a
460541411ceSmrg# symlink; some systems play weird games with the mod time of symlinks
461541411ceSmrg# (eg FreeBSD returns the mod time of the symlink's containing
462541411ceSmrg# directory).
463541411ceSmrgif (
464541411ceSmrg   am_has_slept=no
465541411ceSmrg   for am_try in 1 2; do
466541411ceSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
467541411ceSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
468541411ceSmrg     if test "$[*]" = "X"; then
469541411ceSmrg	# -L didn't work.
470541411ceSmrg	set X `ls -t "$srcdir/configure" conftest.file`
471541411ceSmrg     fi
472541411ceSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
473541411ceSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
474541411ceSmrg
475541411ceSmrg	# If neither matched, then we have a broken ls.  This can happen
476541411ceSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
477541411ceSmrg	# broken ls alias from the environment.  This has actually
478541411ceSmrg	# happened.  Such a system could not be considered "sane".
479541411ceSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
480541411ceSmrg  alias in your environment])
481541411ceSmrg     fi
482541411ceSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
483541411ceSmrg       break
484541411ceSmrg     fi
485541411ceSmrg     # Just in case.
486541411ceSmrg     sleep 1
487541411ceSmrg     am_has_slept=yes
488541411ceSmrg   done
489541411ceSmrg   test "$[2]" = conftest.file
490541411ceSmrg   )
491541411ceSmrgthen
492541411ceSmrg   # Ok.
493541411ceSmrg   :
494541411ceSmrgelse
495541411ceSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
496541411ceSmrgCheck your system clock])
497541411ceSmrgfi
498541411ceSmrgAC_MSG_RESULT([yes])
499541411ceSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
500541411ceSmrg# generated files are strictly newer.
501541411ceSmrgam_sleep_pid=
502541411ceSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
503541411ceSmrg  ( sleep 1 ) &
504541411ceSmrg  am_sleep_pid=$!
505541411ceSmrgfi
506541411ceSmrgAC_CONFIG_COMMANDS_PRE(
507541411ceSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
508541411ceSmrg   if test -n "$am_sleep_pid"; then
509541411ceSmrg     # Hide warnings about reused PIDs.
510541411ceSmrg     wait $am_sleep_pid 2>/dev/null
511541411ceSmrg   fi
512541411ceSmrg   AC_MSG_RESULT([done])])
513541411ceSmrgrm -f conftest.file
514541411ceSmrg])
515541411ceSmrg
516541411ceSmrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
517eeced2e6Smrg#
518541411ceSmrg# This file is free software; the Free Software Foundation
519541411ceSmrg# gives unlimited permission to copy and/or distribute it,
520541411ceSmrg# with or without modifications, as long as this notice is preserved.
521541411ceSmrg
522541411ceSmrg# AM_SILENT_RULES([DEFAULT])
523541411ceSmrg# --------------------------
524541411ceSmrg# Enable less verbose build rules; with the default set to DEFAULT
525541411ceSmrg# ("yes" being less verbose, "no" or empty being verbose).
526541411ceSmrgAC_DEFUN([AM_SILENT_RULES],
527541411ceSmrg[AC_ARG_ENABLE([silent-rules], [dnl
528541411ceSmrgAS_HELP_STRING(
529541411ceSmrg  [--enable-silent-rules],
530541411ceSmrg  [less verbose build output (undo: "make V=1")])
531541411ceSmrgAS_HELP_STRING(
532541411ceSmrg  [--disable-silent-rules],
533541411ceSmrg  [verbose build output (undo: "make V=0")])dnl
534541411ceSmrg])
535541411ceSmrgcase $enable_silent_rules in @%:@ (((
536541411ceSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
537541411ceSmrg   no) AM_DEFAULT_VERBOSITY=1;;
538541411ceSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
539541411ceSmrgesac
540541411ceSmrgdnl
541541411ceSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
542541411ceSmrgdnl do not support nested variable expansions.
543541411ceSmrgdnl See automake bug#9928 and bug#10237.
544541411ceSmrgam_make=${MAKE-make}
545541411ceSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
546541411ceSmrg   [am_cv_make_support_nested_variables],
547541411ceSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
548541411ceSmrgBAR0=false
549541411ceSmrgBAR1=true
550541411ceSmrgV=1
551541411ceSmrgam__doit:
552541411ceSmrg	@$(TRUE)
553541411ceSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
554541411ceSmrg  am_cv_make_support_nested_variables=yes
555541411ceSmrgelse
556541411ceSmrg  am_cv_make_support_nested_variables=no
557541411ceSmrgfi])
558541411ceSmrgif test $am_cv_make_support_nested_variables = yes; then
559541411ceSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
560541411ceSmrg  AM_V='$(V)'
561541411ceSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
562541411ceSmrgelse
563541411ceSmrg  AM_V=$AM_DEFAULT_VERBOSITY
564541411ceSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
565541411ceSmrgfi
566541411ceSmrgAC_SUBST([AM_V])dnl
567541411ceSmrgAM_SUBST_NOTMAKE([AM_V])dnl
568541411ceSmrgAC_SUBST([AM_DEFAULT_V])dnl
569541411ceSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
570541411ceSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
571541411ceSmrgAM_BACKSLASH='\'
572541411ceSmrgAC_SUBST([AM_BACKSLASH])dnl
573541411ceSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
574541411ceSmrg])
575541411ceSmrg
576541411ceSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
577eeced2e6Smrg#
578541411ceSmrg# This file is free software; the Free Software Foundation
579541411ceSmrg# gives unlimited permission to copy and/or distribute it,
580541411ceSmrg# with or without modifications, as long as this notice is preserved.
58135d5702bSmrg
582541411ceSmrg# AM_PROG_INSTALL_STRIP
583541411ceSmrg# ---------------------
584541411ceSmrg# One issue with vendor 'install' (even GNU) is that you can't
585541411ceSmrg# specify the program used to strip binaries.  This is especially
586541411ceSmrg# annoying in cross-compiling environments, where the build's strip
587541411ceSmrg# is unlikely to handle the host's binaries.
588541411ceSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
589541411ceSmrg# always use install-sh in "make install-strip", and initialize
590541411ceSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
591541411ceSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
592541411ceSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
593541411ceSmrg# Installed binaries are usually stripped using 'strip' when the user
594541411ceSmrg# run "make install-strip".  However 'strip' might not be the right
595541411ceSmrg# tool to use in cross-compilation environments, therefore Automake
596541411ceSmrg# will honor the 'STRIP' environment variable to overrule this program.
597541411ceSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
598541411ceSmrgif test "$cross_compiling" != no; then
599541411ceSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
600541411ceSmrgfi
601541411ceSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
602541411ceSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
603541411ceSmrg
604541411ceSmrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
605541411ceSmrg#
606541411ceSmrg# This file is free software; the Free Software Foundation
607541411ceSmrg# gives unlimited permission to copy and/or distribute it,
608541411ceSmrg# with or without modifications, as long as this notice is preserved.
609541411ceSmrg
610541411ceSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
611541411ceSmrg# ---------------------------
612541411ceSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
613541411ceSmrg# This macro is traced by Automake.
614541411ceSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
615541411ceSmrg
616541411ceSmrg# AM_SUBST_NOTMAKE(VARIABLE)
617541411ceSmrg# --------------------------
618541411ceSmrg# Public sister of _AM_SUBST_NOTMAKE.
619541411ceSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
620541411ceSmrg
621541411ceSmrg# Check how to create a tarball.                            -*- Autoconf -*-
622541411ceSmrg
623541411ceSmrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
624541411ceSmrg#
625541411ceSmrg# This file is free software; the Free Software Foundation
626541411ceSmrg# gives unlimited permission to copy and/or distribute it,
627541411ceSmrg# with or without modifications, as long as this notice is preserved.
628541411ceSmrg
629541411ceSmrg# _AM_PROG_TAR(FORMAT)
630541411ceSmrg# --------------------
631541411ceSmrg# Check how to create a tarball in format FORMAT.
632541411ceSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
633541411ceSmrg#
634541411ceSmrg# Substitute a variable $(am__tar) that is a command
635541411ceSmrg# writing to stdout a FORMAT-tarball containing the directory
636541411ceSmrg# $tardir.
637541411ceSmrg#     tardir=directory && $(am__tar) > result.tar
638541411ceSmrg#
639541411ceSmrg# Substitute a variable $(am__untar) that extract such
640541411ceSmrg# a tarball read from stdin.
641541411ceSmrg#     $(am__untar) < result.tar
642541411ceSmrg#
643541411ceSmrgAC_DEFUN([_AM_PROG_TAR],
644541411ceSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
645541411ceSmrg# in the wild :-(  We should find a proper way to deprecate it ...
646541411ceSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
647541411ceSmrg
648541411ceSmrg# We'll loop over all known methods to create a tar archive until one works.
649541411ceSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
650541411ceSmrg
651541411ceSmrgm4_if([$1], [v7],
652541411ceSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
653541411ceSmrg
654541411ceSmrg  [m4_case([$1],
655541411ceSmrg    [ustar],
656541411ceSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
657541411ceSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
658541411ceSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
659541411ceSmrg      # and bug#13588).
660541411ceSmrg      am_max_uid=2097151 # 2^21 - 1
661541411ceSmrg      am_max_gid=$am_max_uid
662541411ceSmrg      # The $UID and $GID variables are not portable, so we need to resort
663541411ceSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
664541411ceSmrg      # below are definitely unexpected, so allow the users to see them
665541411ceSmrg      # (that is, avoid stderr redirection).
666541411ceSmrg      am_uid=`id -u || echo unknown`
667541411ceSmrg      am_gid=`id -g || echo unknown`
668541411ceSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
669541411ceSmrg      if test $am_uid -le $am_max_uid; then
670541411ceSmrg         AC_MSG_RESULT([yes])
671541411ceSmrg      else
672541411ceSmrg         AC_MSG_RESULT([no])
673541411ceSmrg         _am_tools=none
674541411ceSmrg      fi
675541411ceSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
676541411ceSmrg      if test $am_gid -le $am_max_gid; then
677541411ceSmrg         AC_MSG_RESULT([yes])
678541411ceSmrg      else
679541411ceSmrg        AC_MSG_RESULT([no])
680541411ceSmrg        _am_tools=none
681541411ceSmrg      fi],
682541411ceSmrg
683541411ceSmrg  [pax],
684541411ceSmrg    [],
685541411ceSmrg
686541411ceSmrg  [m4_fatal([Unknown tar format])])
687541411ceSmrg
688541411ceSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
689541411ceSmrg
690541411ceSmrg  # Go ahead even if we have the value already cached.  We do so because we
691541411ceSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
692541411ceSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
693541411ceSmrg
694541411ceSmrg  for _am_tool in $_am_tools; do
695541411ceSmrg    case $_am_tool in
696541411ceSmrg    gnutar)
697541411ceSmrg      for _am_tar in tar gnutar gtar; do
698541411ceSmrg        AM_RUN_LOG([$_am_tar --version]) && break
699541411ceSmrg      done
700541411ceSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
701541411ceSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
702541411ceSmrg      am__untar="$_am_tar -xf -"
703541411ceSmrg      ;;
704541411ceSmrg    plaintar)
705541411ceSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
706541411ceSmrg      # ustar tarball either.
707541411ceSmrg      (tar --version) >/dev/null 2>&1 && continue
708541411ceSmrg      am__tar='tar chf - "$$tardir"'
709541411ceSmrg      am__tar_='tar chf - "$tardir"'
710541411ceSmrg      am__untar='tar xf -'
711541411ceSmrg      ;;
712541411ceSmrg    pax)
713541411ceSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
714541411ceSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
715541411ceSmrg      am__untar='pax -r'
716541411ceSmrg      ;;
717541411ceSmrg    cpio)
718541411ceSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
719541411ceSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
720541411ceSmrg      am__untar='cpio -i -H $1 -d'
721541411ceSmrg      ;;
722541411ceSmrg    none)
723541411ceSmrg      am__tar=false
724541411ceSmrg      am__tar_=false
725541411ceSmrg      am__untar=false
726541411ceSmrg      ;;
727541411ceSmrg    esac
728541411ceSmrg
729541411ceSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
730541411ceSmrg    # and am__untar set.
731541411ceSmrg    test -n "${am_cv_prog_tar_$1}" && break
732541411ceSmrg
733541411ceSmrg    # tar/untar a dummy directory, and stop if the command works.
734541411ceSmrg    rm -rf conftest.dir
735541411ceSmrg    mkdir conftest.dir
736541411ceSmrg    echo GrepMe > conftest.dir/file
737541411ceSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
738541411ceSmrg    rm -rf conftest.dir
739541411ceSmrg    if test -s conftest.tar; then
740541411ceSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
741541411ceSmrg      AM_RUN_LOG([cat conftest.dir/file])
742541411ceSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
743541411ceSmrg    fi
744541411ceSmrg  done
745541411ceSmrg  rm -rf conftest.dir
746541411ceSmrg
747541411ceSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
748541411ceSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
749541411ceSmrg
750541411ceSmrgAC_SUBST([am__tar])
751541411ceSmrgAC_SUBST([am__untar])
752541411ceSmrg]) # _AM_PROG_TAR
753541411ceSmrg
754541411ceSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
755541411ceSmrgdnl serial 11 (pkg-config-0.29)
756541411ceSmrgdnl
757541411ceSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
758541411ceSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
759541411ceSmrgdnl
760541411ceSmrgdnl This program is free software; you can redistribute it and/or modify
761541411ceSmrgdnl it under the terms of the GNU General Public License as published by
762541411ceSmrgdnl the Free Software Foundation; either version 2 of the License, or
763541411ceSmrgdnl (at your option) any later version.
764541411ceSmrgdnl
765541411ceSmrgdnl This program is distributed in the hope that it will be useful, but
766541411ceSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
767541411ceSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
768541411ceSmrgdnl General Public License for more details.
769541411ceSmrgdnl
770541411ceSmrgdnl You should have received a copy of the GNU General Public License
771541411ceSmrgdnl along with this program; if not, write to the Free Software
772541411ceSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
773541411ceSmrgdnl 02111-1307, USA.
774541411ceSmrgdnl
775541411ceSmrgdnl As a special exception to the GNU General Public License, if you
776541411ceSmrgdnl distribute this file as part of a program that contains a
777541411ceSmrgdnl configuration script generated by Autoconf, you may include it under
778541411ceSmrgdnl the same distribution terms that you use for the rest of that
779541411ceSmrgdnl program.
780541411ceSmrg
781541411ceSmrgdnl PKG_PREREQ(MIN-VERSION)
782541411ceSmrgdnl -----------------------
783541411ceSmrgdnl Since: 0.29
784541411ceSmrgdnl
785541411ceSmrgdnl Verify that the version of the pkg-config macros are at least
786541411ceSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
787541411ceSmrgdnl installed version of pkg-config, this checks the developer's version
788541411ceSmrgdnl of pkg.m4 when generating configure.
789541411ceSmrgdnl
790541411ceSmrgdnl To ensure that this macro is defined, also add:
791541411ceSmrgdnl m4_ifndef([PKG_PREREQ],
792541411ceSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
793541411ceSmrgdnl
794541411ceSmrgdnl See the "Since" comment for each macro you use to see what version
795541411ceSmrgdnl of the macros you require.
796541411ceSmrgm4_defun([PKG_PREREQ],
797541411ceSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
798541411ceSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
799541411ceSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
800541411ceSmrg])dnl PKG_PREREQ
801541411ceSmrg
802541411ceSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
803541411ceSmrgdnl ----------------------------------
804541411ceSmrgdnl Since: 0.16
805541411ceSmrgdnl
806541411ceSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
807541411ceSmrgdnl first found in the path. Checks that the version of pkg-config found
808541411ceSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
809541411ceSmrgdnl used since that's the first version where most current features of
810541411ceSmrgdnl pkg-config existed.
811eeced2e6SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
812eeced2e6Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
813541411ceSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
814541411ceSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
815eeced2e6SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
816eeced2e6SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
817eeced2e6SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
81835d5702bSmrg
819eeced2e6Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
820eeced2e6Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
82135d5702bSmrgfi
822eeced2e6Smrgif test -n "$PKG_CONFIG"; then
823eeced2e6Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
824eeced2e6Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
825eeced2e6Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
826eeced2e6Smrg		AC_MSG_RESULT([yes])
827eeced2e6Smrg	else
828eeced2e6Smrg		AC_MSG_RESULT([no])
829eeced2e6Smrg		PKG_CONFIG=""
830eeced2e6Smrg	fi
831eeced2e6Smrgfi[]dnl
832541411ceSmrg])dnl PKG_PROG_PKG_CONFIG
83335d5702bSmrg
834541411ceSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
835541411ceSmrgdnl -------------------------------------------------------------------
836541411ceSmrgdnl Since: 0.18
837541411ceSmrgdnl
838541411ceSmrgdnl Check to see whether a particular set of modules exists. Similar to
839541411ceSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
840541411ceSmrgdnl
841541411ceSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
842541411ceSmrgdnl only at the first occurence in configure.ac, so if the first place
843541411ceSmrgdnl it's called might be skipped (such as if it is within an "if", you
844541411ceSmrgdnl have to call PKG_CHECK_EXISTS manually
845eeced2e6SmrgAC_DEFUN([PKG_CHECK_EXISTS],
846eeced2e6Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
847eeced2e6Smrgif test -n "$PKG_CONFIG" && \
848eeced2e6Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
849eeced2e6Smrg  m4_default([$2], [:])
850eeced2e6Smrgm4_ifvaln([$3], [else
851eeced2e6Smrg  $3])dnl
852eeced2e6Smrgfi])
85335d5702bSmrg
854541411ceSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
855541411ceSmrgdnl ---------------------------------------------
856541411ceSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
857541411ceSmrgdnl pkg_failed based on the result.
858eeced2e6Smrgm4_define([_PKG_CONFIG],
859eeced2e6Smrg[if test -n "$$1"; then
860eeced2e6Smrg    pkg_cv_[]$1="$$1"
861eeced2e6Smrg elif test -n "$PKG_CONFIG"; then
862eeced2e6Smrg    PKG_CHECK_EXISTS([$3],
863541411ceSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
864541411ceSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
865eeced2e6Smrg		     [pkg_failed=yes])
866eeced2e6Smrg else
867eeced2e6Smrg    pkg_failed=untried
868eeced2e6Smrgfi[]dnl
869541411ceSmrg])dnl _PKG_CONFIG
87035d5702bSmrg
871541411ceSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
872541411ceSmrgdnl ---------------------------
873541411ceSmrgdnl Internal check to see if pkg-config supports short errors.
874eeced2e6SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
875eeced2e6Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
876eeced2e6Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
877eeced2e6Smrg        _pkg_short_errors_supported=yes
878eeced2e6Smrgelse
879eeced2e6Smrg        _pkg_short_errors_supported=no
880eeced2e6Smrgfi[]dnl
881541411ceSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
88235d5702bSmrg
88335d5702bSmrg
884541411ceSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
885541411ceSmrgdnl   [ACTION-IF-NOT-FOUND])
886541411ceSmrgdnl --------------------------------------------------------------
887541411ceSmrgdnl Since: 0.4.0
888541411ceSmrgdnl
889541411ceSmrgdnl Note that if there is a possibility the first call to
890541411ceSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
891541411ceSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
892eeced2e6SmrgAC_DEFUN([PKG_CHECK_MODULES],
893eeced2e6Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
894eeced2e6SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
895eeced2e6SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
89635d5702bSmrg
897eeced2e6Smrgpkg_failed=no
898eeced2e6SmrgAC_MSG_CHECKING([for $1])
899eeced2e6Smrg
900eeced2e6Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
901eeced2e6Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
902eeced2e6Smrg
903eeced2e6Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
904eeced2e6Smrgand $1[]_LIBS to avoid the need to call pkg-config.
905eeced2e6SmrgSee the pkg-config man page for more details.])
906eeced2e6Smrg
907eeced2e6Smrgif test $pkg_failed = yes; then
908eeced2e6Smrg   	AC_MSG_RESULT([no])
909eeced2e6Smrg        _PKG_SHORT_ERRORS_SUPPORTED
910eeced2e6Smrg        if test $_pkg_short_errors_supported = yes; then
911541411ceSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
912eeced2e6Smrg        else 
913541411ceSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
914eeced2e6Smrg        fi
915eeced2e6Smrg	# Put the nasty error message in config.log where it belongs
916eeced2e6Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
917eeced2e6Smrg
918eeced2e6Smrg	m4_default([$4], [AC_MSG_ERROR(
919eeced2e6Smrg[Package requirements ($2) were not met:
920eeced2e6Smrg
921eeced2e6Smrg$$1_PKG_ERRORS
922eeced2e6Smrg
923eeced2e6SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
924eeced2e6Smrginstalled software in a non-standard prefix.
925eeced2e6Smrg
926eeced2e6Smrg_PKG_TEXT])[]dnl
927eeced2e6Smrg        ])
928eeced2e6Smrgelif test $pkg_failed = untried; then
929eeced2e6Smrg     	AC_MSG_RESULT([no])
930eeced2e6Smrg	m4_default([$4], [AC_MSG_FAILURE(
931eeced2e6Smrg[The pkg-config script could not be found or is too old.  Make sure it
932eeced2e6Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
933eeced2e6Smrgpath to pkg-config.
934eeced2e6Smrg
935eeced2e6Smrg_PKG_TEXT
936eeced2e6Smrg
937541411ceSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
938eeced2e6Smrg        ])
939eeced2e6Smrgelse
940eeced2e6Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
941eeced2e6Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
942eeced2e6Smrg        AC_MSG_RESULT([yes])
943eeced2e6Smrg	$3
944eeced2e6Smrgfi[]dnl
945541411ceSmrg])dnl PKG_CHECK_MODULES
94635d5702bSmrg
947541411ceSmrg
948541411ceSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
949541411ceSmrgdnl   [ACTION-IF-NOT-FOUND])
950541411ceSmrgdnl ---------------------------------------------------------------------
951541411ceSmrgdnl Since: 0.29
952541411ceSmrgdnl
953541411ceSmrgdnl Checks for existence of MODULES and gathers its build flags with
954541411ceSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
955541411ceSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
956541411ceSmrgdnl
957541411ceSmrgdnl Note that if there is a possibility the first call to
958541411ceSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
959541411ceSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
960541411ceSmrgdnl configure.ac.
961541411ceSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
962541411ceSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
963541411ceSmrg_save_PKG_CONFIG=$PKG_CONFIG
964541411ceSmrgPKG_CONFIG="$PKG_CONFIG --static"
965541411ceSmrgPKG_CHECK_MODULES($@)
966541411ceSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
967541411ceSmrg])dnl PKG_CHECK_MODULES_STATIC
968541411ceSmrg
969541411ceSmrg
970541411ceSmrgdnl PKG_INSTALLDIR([DIRECTORY])
971541411ceSmrgdnl -------------------------
972541411ceSmrgdnl Since: 0.27
973541411ceSmrgdnl
974541411ceSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
975541411ceSmrgdnl should install pkg-config .pc files. By default the directory is
976541411ceSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
977541411ceSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
978541411ceSmrgdnl parameter.
979541411ceSmrgAC_DEFUN([PKG_INSTALLDIR],
980541411ceSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
981541411ceSmrgm4_pushdef([pkg_description],
982541411ceSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
983541411ceSmrgAC_ARG_WITH([pkgconfigdir],
984541411ceSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
985541411ceSmrg    [with_pkgconfigdir=]pkg_default)
986541411ceSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
987541411ceSmrgm4_popdef([pkg_default])
988541411ceSmrgm4_popdef([pkg_description])
989541411ceSmrg])dnl PKG_INSTALLDIR
990541411ceSmrg
991541411ceSmrg
992541411ceSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
993541411ceSmrgdnl --------------------------------
994541411ceSmrgdnl Since: 0.27
995541411ceSmrgdnl
996541411ceSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
997541411ceSmrgdnl module should install arch-independent pkg-config .pc files. By
998541411ceSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
999541411ceSmrgdnl changed by passing DIRECTORY. The user can override through the
1000541411ceSmrgdnl --with-noarch-pkgconfigdir parameter.
1001541411ceSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1002541411ceSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1003541411ceSmrgm4_pushdef([pkg_description],
1004541411ceSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1005541411ceSmrgAC_ARG_WITH([noarch-pkgconfigdir],
1006541411ceSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1007541411ceSmrg    [with_noarch_pkgconfigdir=]pkg_default)
1008541411ceSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1009541411ceSmrgm4_popdef([pkg_default])
1010541411ceSmrgm4_popdef([pkg_description])
1011541411ceSmrg])dnl PKG_NOARCH_INSTALLDIR
1012541411ceSmrg
1013541411ceSmrg
1014541411ceSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1015541411ceSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1016541411ceSmrgdnl -------------------------------------------
1017541411ceSmrgdnl Since: 0.28
1018541411ceSmrgdnl
1019541411ceSmrgdnl Retrieves the value of the pkg-config variable for the given module.
1020541411ceSmrgAC_DEFUN([PKG_CHECK_VAR],
1021541411ceSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1022541411ceSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1023541411ceSmrg
1024541411ceSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1025541411ceSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1026541411ceSmrg
1027541411ceSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1028541411ceSmrg])dnl PKG_CHECK_VAR
1029541411ceSmrg
1030541411ceSmrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
1031541411ceSmrgdnl
1032541411ceSmrgdnl This file comes from X.Org's font-util 1.4.0
1033541411ceSmrgdnl
1034541411ceSmrgdnl Copyright (c) 2009, 2023, Oracle and/or its affiliates.
1035eeced2e6Smrgdnl
1036eeced2e6Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1037eeced2e6Smrgdnl copy of this software and associated documentation files (the "Software"),
1038eeced2e6Smrgdnl to deal in the Software without restriction, including without limitation
1039eeced2e6Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1040eeced2e6Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1041eeced2e6Smrgdnl Software is furnished to do so, subject to the following conditions:
1042eeced2e6Smrgdnl
1043eeced2e6Smrgdnl The above copyright notice and this permission notice (including the next
1044eeced2e6Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1045eeced2e6Smrgdnl Software.
1046eeced2e6Smrgdnl
1047eeced2e6Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1048eeced2e6Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1049eeced2e6Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1050eeced2e6Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1051eeced2e6Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1052eeced2e6Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1053eeced2e6Smrgdnl DEALINGS IN THE SOFTWARE.
1054541411ceSmrgdnl
1055541411ceSmrgdnl --------------------------------------------------------------------
1056541411ceSmrgdnl
1057541411ceSmrgdnl Copyright 2005 Red Hat, Inc
1058541411ceSmrgdnl
1059541411ceSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
1060541411ceSmrgdnl documentation for any purpose is hereby granted without fee, provided that
1061541411ceSmrgdnl the above copyright notice appear in all copies and that both that
1062541411ceSmrgdnl copyright notice and this permission notice appear in supporting
1063541411ceSmrgdnl documentation.
1064541411ceSmrgdnl
1065541411ceSmrgdnl The above copyright notice and this permission notice shall be included
1066541411ceSmrgdnl in all copies or substantial portions of the Software.
1067541411ceSmrgdnl
1068541411ceSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1069541411ceSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1070541411ceSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1071541411ceSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
1072541411ceSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1073541411ceSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1074541411ceSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
1075541411ceSmrgdnl
1076541411ceSmrgdnl Except as contained in this notice, the name of the copyright holders shall
1077541411ceSmrgdnl not be used in advertising or otherwise to promote the sale, use or
1078541411ceSmrgdnl other dealings in this Software without prior written authorization
1079541411ceSmrgdnl from the copyright holders.
108035d5702bSmrg
1081541411ceSmrg# XORG_FONT_MACROS_VERSION(required-version)
1082541411ceSmrg# ------------------------------------------
1083eeced2e6Smrg# Minimum version: 1.1.0
108435d5702bSmrg#
1085eeced2e6Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1086eeced2e6Smrg# your configure.ac with the minimum required version, such as:
1087541411ceSmrg# XORG_FONT_MACROS_VERSION(1.1)
1088eeced2e6Smrg#
1089eeced2e6Smrg# To ensure that this macro is defined, also add:
1090541411ceSmrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
1091541411ceSmrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
1092eeced2e6Smrg#
1093eeced2e6Smrg#
1094541411ceSmrg# See the "minimum version" comment for each macro you use to see what
1095eeced2e6Smrg# version you require.
1096541411ceSmrgm4_defun([XORG_FONT_MACROS_VERSION],[
1097541411ceSmrgm4_define([vers_have], [1.4.0])
1098eeced2e6Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1099eeced2e6Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1100eeced2e6Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1101541411ceSmrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
1102eeced2e6Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1103541411ceSmrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
1104eeced2e6Smrgm4_undefine([vers_have])
1105eeced2e6Smrgm4_undefine([maj_have])
1106eeced2e6Smrgm4_undefine([maj_needed])
1107541411ceSmrg]) # XORG_FONT_MACROS_VERSION
110835d5702bSmrg
1109541411ceSmrg# XORG_FONT_CHECK_{maps}()
1110541411ceSmrg# ------------------------
1111eeced2e6Smrg# Minimum version: 1.0.0
1112541411ceSmrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
1113541411ceSmrg# JISX0201 or KOI8_R.  By default, they are all enabled.
111435d5702bSmrg
1115541411ceSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
1116541411ceSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
1117541411ceSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
1118541411ceSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
1119541411ceSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
1120541411ceSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
1121541411ceSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
1122541411ceSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
1123541411ceSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
1124541411ceSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
1125541411ceSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
1126541411ceSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
1127541411ceSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
1128541411ceSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
1129541411ceSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
1130541411ceSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
1131541411ceSmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
1132541411ceSmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
113335d5702bSmrg
1134541411ceSmrg# XORG_FONT_CHECK_ENCODING(encoding)
1135541411ceSmrg# ----------------------------------
1136541411ceSmrg# Minimum version: 1.1.0
1137541411ceSmrg# This macro adds --enable/disable-<encoding>, enabled by default.
1138541411ceSmrg# It replaced individual copies of this code in the above macros in 1.1.
1139541411ceSmrg# Currently assumes encoding names will be all upper-case - add m4_toupper
1140541411ceSmrg# calls if this is not true in the future.
114135d5702bSmrg
1142541411ceSmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
1143541411ceSmrg	AC_ARG_ENABLE(m4_tolower($1),
1144541411ceSmrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
1145541411ceSmrg				[Build $1 fonts (default: yes)]),
1146541411ceSmrg		[AS_TR_SH($1)=$enableval])
1147541411ceSmrg	AC_MSG_CHECKING([whether to build $1 fonts])
1148541411ceSmrg	AC_MSG_RESULT($[AS_TR_SH($1)])
1149541411ceSmrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
1150541411ceSmrg]) # XORG_FONT_CHECK_ENCODING
115135d5702bSmrg
1152541411ceSmrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
1153541411ceSmrg# -----------------------------------------------------
1154541411ceSmrg# Minimum version: 1.1.0
1155541411ceSmrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
1156541411ceSmrg# Add a shorthand --enable/disable-all-encodings option.
115735d5702bSmrg
1158541411ceSmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
1159541411ceSmrg	AC_ARG_ENABLE([all-encodings],
1160541411ceSmrg		AS_HELP_STRING([--disable-all-encodings],
1161541411ceSmrg				[Disable building of all font encodings]),
1162541411ceSmrg		[m4_foreach_w([enc], [$1], [
1163541411ceSmrg			AS_TR_SH(enc)=$enableval
1164541411ceSmrg		])],
1165541411ceSmrg		[m4_foreach_w([enc], [$1], [
1166541411ceSmrg			AS_TR_SH(enc)=yes
1167541411ceSmrg		])])
1168541411ceSmrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
1169541411ceSmrg]) # XORG_FONT_CHECK_ENCODING_LIST
117035d5702bSmrg
1171541411ceSmrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
1172541411ceSmrg# ------------------------------------------
1173541411ceSmrg# Minimum version: 1.1.0
1174541411ceSmrg#
1175541411ceSmrg# Simple wrapper around AC_PATH_PROG that errors if not found
1176541411ceSmrg#
117735d5702bSmrg
1178541411ceSmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
1179541411ceSmrg	AC_PATH_PROG($1, $2)
1180541411ceSmrg	if test x"$$1" = x; then
1181541411ceSmrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
1182541411ceSmrg	fi
1183541411ceSmrg])
118435d5702bSmrg
118535d5702bSmrg
1186541411ceSmrg# XORG_FONT_FCCACHE()
1187541411ceSmrg# -------------------
1188541411ceSmrg# Minimum version: 1.1.0
1189541411ceSmrg#
1190541411ceSmrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
1191541411ceSmrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
1192541411ceSmrg# to run fc-cache if found and not installing to $DESTDIR and not
1193541411ceSmrg# cross-compiling
1194541411ceSmrg#
1195541411ceSmrg# fc-cache is optional, not required, and should be skipped when making
1196541411ceSmrg# packages (installing to $DESTDIR) or cross-compiling
1197541411ceSmrg#
1198541411ceSmrgAC_DEFUN([XORG_FONT_FCCACHE],[
1199541411ceSmrg	AC_PATH_PROG(FCCACHE, fc-cache)
1200541411ceSmrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
1201541411ceSmrg	if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then
1202541411ceSmrg		RUN_FCCACHE="${FCCACHE_WARN}"
1203541411ceSmrg	else
1204541411ceSmrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
1205541411ceSmrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
1206541411ceSmrg	fi
1207541411ceSmrg	AC_SUBST([RUN_FCCACHE])
1208541411ceSmrg])
120935d5702bSmrg
1210541411ceSmrg# XORG_FONT_MKFONTDIR()
1211541411ceSmrg# -------------------
1212541411ceSmrg# Minimum version: 1.3.0
1213541411ceSmrg#
1214541411ceSmrg# Set MKFONTDIR to path to mkfontdir.
1215541411ceSmrg#
1216541411ceSmrg# If cross-compiling, and if mkdir is not found, use a shell command
1217541411ceSmrg# which warns mkfontdir needs to be run on the target
1218541411ceSmrg#
1219541411ceSmrg# If not cross-compiling, mkfontdir must be found
1220541411ceSmrg#
1221541411ceSmrgAC_DEFUN([XORG_FONT_MKFONTDIR],[
1222541411ceSmrg	if test x"$cross_compiling" != x"no" ; then
1223541411ceSmrg		AC_PATH_PROG(MKFONTDIR, mkfontdir, "")
1224541411ceSmrg		MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run mkfontdir manually on host system"'
122535d5702bSmrg
1226541411ceSmrg		if test x"$MKFONTDIR" = x; then
1227541411ceSmrg			MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'"
1228541411ceSmrg		fi
1229541411ceSmrg	else
1230541411ceSmrg		XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
1231541411ceSmrg	fi
123235d5702bSmrg
1233541411ceSmrg	AC_SUBST([MKFONTDIR])
1234541411ceSmrg])
123535d5702bSmrg
1236541411ceSmrg# XORG_FONT_COMMON_UTILS()
1237541411ceSmrg# ------------------------
1238541411ceSmrg# Minimum version: 1.1.0
1239541411ceSmrg#
1240541411ceSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
124135d5702bSmrg
1242541411ceSmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
1243541411ceSmrg	XORG_FONT_FCCACHE
1244541411ceSmrg	XORG_FONT_MKFONTDIR
1245541411ceSmrg])
124635d5702bSmrg
1247541411ceSmrg# XORG_FONT_SCALED_UTILS()
1248eeced2e6Smrg# ------------------------
1249541411ceSmrg# Minimum version: 1.1.0
1250eeced2e6Smrg#
1251541411ceSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
1252541411ceSmrg# (TrueType, OpenType, Type1)
1253eeced2e6Smrg
1254541411ceSmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
1255541411ceSmrg	XORG_FONT_COMMON_UTILS
1256541411ceSmrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
1257541411ceSmrg])
1258eeced2e6Smrg
1259541411ceSmrg# XORG_FONT_BDF_UTILS()
1260541411ceSmrg# ---------------------
1261541411ceSmrg# Minimum version: 1.1.0
126235d5702bSmrg#
1263541411ceSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
1264541411ceSmrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
1265541411ceSmrg# PCF output files created by bdftopcf
126635d5702bSmrg
1267541411ceSmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
1268541411ceSmrg	XORG_FONT_COMMON_UTILS
1269541411ceSmrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
1270541411ceSmrg	XORG_FONT_CHECK_COMPRESSION
1271541411ceSmrg])
127235d5702bSmrg
1273541411ceSmrg# XORG_FONT_CHECK_COMPRESSION()
1274541411ceSmrg# -----------------------------
1275541411ceSmrg# Minimum version: 1.1.0
1276541411ceSmrg#
1277541411ceSmrg# Offer a --with-compression flag to control what compression method is
1278541411ceSmrg# used for pcf font files.   Offers all the methods currently supported
1279541411ceSmrg# by libXfont, including no compression.
1280541411ceSmrg#
1281541411ceSmrg# If COMPRESS_FLAGS is not set, and the compression method has flags needed
1282541411ceSmrg# for reproducible builds, such as gzip -n to not record timestamp, will
1283541411ceSmrg# set COMPRESS_FLAGS to those options.
128435d5702bSmrg
1285541411ceSmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
1286541411ceSmrg	AC_MSG_CHECKING([font compression method])
1287541411ceSmrg	AC_ARG_WITH(compression,
1288541411ceSmrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
1289541411ceSmrg			 [compression method to use on pcf fonts])],
1290541411ceSmrg         [compression="$withval"], [compression="yes"])
1291541411ceSmrg	if test x"$compression" = "xyes" ; then
1292541411ceSmrg		compression="gzip"
1293541411ceSmrg	fi
1294541411ceSmrg	AC_MSG_RESULT([${compression}])
1295541411ceSmrg	case ${compression} in
1296541411ceSmrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
1297541411ceSmrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;
1298541411ceSmrg			COMPRESS_FLAGS="${COMPRESS_FLAGS--n}" ;;
1299541411ceSmrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
1300541411ceSmrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
1301541411ceSmrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
1302541411ceSmrg	esac
1303541411ceSmrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
1304541411ceSmrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
1305541411ceSmrg	fi
1306541411ceSmrg	AC_MSG_CHECKING([options to font compression command])
1307541411ceSmrg	AC_MSG_RESULT([${COMPRESS_FLAGS:-none}])
1308541411ceSmrg	AC_SUBST([COMPRESS_FLAGS])
1309541411ceSmrg	AC_SUBST([COMPRESS_SUFFIX])
1310541411ceSmrg])
131135d5702bSmrg
1312541411ceSmrg# XORG_FONT_UCS2ANY()
1313541411ceSmrg# -------------------
1314541411ceSmrg# Minimum version: 1.1.0
1315541411ceSmrg#
1316541411ceSmrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
1317541411ceSmrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
1318541411ceSmrg# Also call pkg-config to find the directory with the encoding files needed
1319541411ceSmrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
132035d5702bSmrg
1321541411ceSmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
1322541411ceSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1323541411ceSmrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
1324541411ceSmrg	PKG_CHECK_MODULES(MAPS, [fontutil])
1325541411ceSmrg	AC_MSG_CHECKING([for ucs2any encoding data files])
1326541411ceSmrg	MAPFILES_PATH=`$PKG_CONFIG --variable=mapdir fontutil`
1327541411ceSmrg	AC_SUBST(MAPFILES_PATH)
1328541411ceSmrg	AC_MSG_RESULT([${MAPFILES_PATH}])
1329541411ceSmrg])
133035d5702bSmrg
133135d5702bSmrg
133235d5702bSmrg
1333541411ceSmrg# XORG_FONT_FC_CONFDIR()
1334541411ceSmrg# --------------------
1335541411ceSmrg# Minimum version: 1.2.0
1336541411ceSmrg#
1337541411ceSmrg# Sets FC_CONFDIR to the fontconfig config directory
1338541411ceSmrg# (which should be --with-confdir=... when building fontconfig)
1339541411ceSmrg# found from:
1340541411ceSmrg#	--with-fc-confdir=...
1341541411ceSmrg#	pkg-config --variable=confdir fontconfig
1342541411ceSmrg#	${sysconfdir}/fonts
134335d5702bSmrg
1344541411ceSmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
1345541411ceSmrg	dnl Ensure $PKG_CONFIG is set first
1346541411ceSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
134735d5702bSmrg
1348541411ceSmrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
1349541411ceSmrg	AC_ARG_WITH(fc-confdir,
1350541411ceSmrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
1351541411ceSmrg			   [Path to fontconfig's configuration directory]),
1352541411ceSmrg		    [FC_CONFDIR="$withval"])
1353541411ceSmrg	# if --with-fc-confdir was not specified
1354541411ceSmrg	if test "x${FC_CONFDIR}" = "x"; then
1355541411ceSmrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
1356541411ceSmrg	fi
1357541411ceSmrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
1358541411ceSmrg	if test "x${FC_CONFDIR}" = "x"; then
1359541411ceSmrg		FC_CONFDIR="${sysconfdir}/fonts"
1360541411ceSmrg	fi
1361541411ceSmrg	AC_SUBST(FC_CONFDIR)
1362541411ceSmrg	AC_MSG_RESULT([${FC_CONFDIR}])
1363541411ceSmrg])
136435d5702bSmrg
136535d5702bSmrg
136635d5702bSmrg
1367541411ceSmrg# XORG_FONTROOTDIR()
1368541411ceSmrg# --------------------
1369541411ceSmrg# Minimum version: 1.1.0
1370541411ceSmrg#
1371541411ceSmrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
1372541411ceSmrg# found from:
1373541411ceSmrg#	--with-fontrootdir
1374541411ceSmrg#	pkg-config --variable=fontrootdir fontutil
1375541411ceSmrg#	${datadir}/fonts/X11
137635d5702bSmrg
1377541411ceSmrgAC_DEFUN([XORG_FONTROOTDIR],[
1378541411ceSmrg	dnl Ensure $PKG_CONFIG is set first
1379541411ceSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
138035d5702bSmrg
1381541411ceSmrg	AC_MSG_CHECKING([for root directory for font files])
1382541411ceSmrg	AC_ARG_WITH(fontrootdir,
1383541411ceSmrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
1384541411ceSmrg			   [Path to root directory for font files]),
1385541411ceSmrg		    [FONTROOTDIR="$withval"])
1386541411ceSmrg	# if --with-fontrootdir not specified...
1387541411ceSmrg	if test "x${FONTROOTDIR}" = "x"; then
1388541411ceSmrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
1389541411ceSmrg	fi
1390541411ceSmrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
1391541411ceSmrg	if test "x${FONTROOTDIR}" = "x"; then
1392541411ceSmrg		FONTROOTDIR="${datadir}/fonts/X11"
1393541411ceSmrg	fi
1394541411ceSmrg	AC_SUBST(FONTROOTDIR)
1395541411ceSmrg	AC_MSG_RESULT([${FONTROOTDIR}])
1396541411ceSmrg])
139735d5702bSmrg
1398541411ceSmrg# XORG_FONTSUBDIR(variable, flag, subdir)
1399541411ceSmrg# ---------------------------------------
1400541411ceSmrg# Minimum version: 1.1.0
1401541411ceSmrg#
1402541411ceSmrg# Offer a --with-<flag> flag to control directory for font installation
1403541411ceSmrg# Default is the specified <subdir> of the font root directory.
1404541411ceSmrg# Sets <variable> to the selected directory
140535d5702bSmrg
1406541411ceSmrgAC_DEFUN([XORG_FONTSUBDIR],[
1407541411ceSmrg	AC_REQUIRE([XORG_FONTROOTDIR])
140835d5702bSmrg
1409541411ceSmrg	AC_MSG_CHECKING([for directory for $3 files])
1410541411ceSmrg	AC_ARG_WITH($2,
1411541411ceSmrg		    [AS_HELP_STRING([--with-$2=DIR],
1412541411ceSmrg				    [Path to $3 files [FONTROOTDIR/$3]])],
1413541411ceSmrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
1414541411ceSmrg	AC_SUBST($1)
1415541411ceSmrg	AC_MSG_RESULT([${$1}])
1416541411ceSmrg]) # XORG_FONTSUBDIR
1417eeced2e6Smrg
1418541411ceSmrg# XORG_FONTDIR(subdir)
1419541411ceSmrg# --------------------
1420541411ceSmrg# Minimum version: 1.1.0
1421541411ceSmrg#
1422541411ceSmrg# Offer a --with-fontdir flag to control directory for font installation
1423541411ceSmrg# Default is the specified subdir of the font root directory.
1424541411ceSmrg# Sets FONTDIR to the selected directory
142535d5702bSmrg
1426541411ceSmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
142735d5702bSmrg
1428541411ceSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1429541411ceSmrgdnl
1430541411ceSmrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
1431541411ceSmrgdnl
1432541411ceSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1433541411ceSmrgdnl copy of this software and associated documentation files (the "Software"),
1434541411ceSmrgdnl to deal in the Software without restriction, including without limitation
1435541411ceSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1436541411ceSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1437541411ceSmrgdnl Software is furnished to do so, subject to the following conditions:
1438541411ceSmrgdnl
1439541411ceSmrgdnl The above copyright notice and this permission notice (including the next
1440541411ceSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1441541411ceSmrgdnl Software.
1442541411ceSmrgdnl
1443541411ceSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1444541411ceSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1445541411ceSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1446541411ceSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1447541411ceSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1448541411ceSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1449541411ceSmrgdnl DEALINGS IN THE SOFTWARE.
1450541411ceSmrg
1451541411ceSmrg# XORG_MACROS_VERSION(required-version)
1452541411ceSmrg# -------------------------------------
1453541411ceSmrg# Minimum version: 1.1.0
1454eeced2e6Smrg#
1455541411ceSmrg# If you're using a macro added in Version 1.1 or newer, include this in
1456541411ceSmrg# your configure.ac with the minimum required version, such as:
1457541411ceSmrg# XORG_MACROS_VERSION(1.1)
1458eeced2e6Smrg#
1459541411ceSmrg# To ensure that this macro is defined, also add:
1460541411ceSmrg# m4_ifndef([XORG_MACROS_VERSION],
1461541411ceSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1462eeced2e6Smrg#
1463eeced2e6Smrg#
1464541411ceSmrg# See the "minimum version" comment for each macro you use to see what
1465541411ceSmrg# version you require.
1466541411ceSmrgm4_defun([XORG_MACROS_VERSION],[
1467541411ceSmrgm4_define([vers_have], [1.20.0])
1468541411ceSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1469541411ceSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1470541411ceSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1471541411ceSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1472541411ceSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1473541411ceSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1474541411ceSmrgm4_undefine([vers_have])
1475541411ceSmrgm4_undefine([maj_have])
1476541411ceSmrgm4_undefine([maj_needed])
1477541411ceSmrg]) # XORG_MACROS_VERSION
1478eeced2e6Smrg
1479541411ceSmrg# XORG_PROG_RAWCPP()
1480541411ceSmrg# ------------------
1481541411ceSmrg# Minimum version: 1.0.0
1482541411ceSmrg#
1483541411ceSmrg# Find cpp program and necessary flags for use in pre-processing text files
1484541411ceSmrg# such as man pages and config files
1485541411ceSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1486541411ceSmrgAC_REQUIRE([AC_PROG_CPP])
1487541411ceSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1488541411ceSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1489541411ceSmrg
1490541411ceSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1491541411ceSmrg# which is not the best choice for supporting other OS'es, but covers most
1492541411ceSmrg# of the ones we need for now.
1493541411ceSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1494541411ceSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1495541411ceSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1496541411ceSmrg	AC_MSG_RESULT([no])
1497eeced2e6Smrgelse
1498541411ceSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1499541411ceSmrg		RAWCPPFLAGS=-undef
1500541411ceSmrg		AC_MSG_RESULT([yes])
1501541411ceSmrg	# under Cygwin unix is still defined even with -undef
1502541411ceSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1503541411ceSmrg		RAWCPPFLAGS="-undef -ansi"
1504541411ceSmrg		AC_MSG_RESULT([yes, with -ansi])
1505541411ceSmrg	else
1506541411ceSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1507541411ceSmrg	fi
150835d5702bSmrgfi
1509541411ceSmrgrm -f conftest.$ac_ext
151035d5702bSmrg
1511541411ceSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1512541411ceSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1513541411ceSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1514541411ceSmrg	AC_MSG_RESULT([no])
1515eeced2e6Smrgelse
1516541411ceSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1517541411ceSmrg		TRADITIONALCPPFLAGS="-traditional"
1518541411ceSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1519541411ceSmrg		AC_MSG_RESULT([yes])
1520541411ceSmrg	else
1521541411ceSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1522541411ceSmrg	fi
1523eeced2e6Smrgfi
1524541411ceSmrgrm -f conftest.$ac_ext
1525541411ceSmrgAC_SUBST(RAWCPPFLAGS)
1526541411ceSmrgAC_SUBST(TRADITIONALCPPFLAGS)
1527541411ceSmrg]) # XORG_PROG_RAWCPP
1528eeced2e6Smrg
1529541411ceSmrg# XORG_MANPAGE_SECTIONS()
1530541411ceSmrg# -----------------------
1531541411ceSmrg# Minimum version: 1.0.0
1532eeced2e6Smrg#
1533541411ceSmrg# Determine which sections man pages go in for the different man page types
1534541411ceSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1535541411ceSmrg# Not sure if there's any better way than just hardcoding by OS name.
1536541411ceSmrg# Override default settings by setting environment variables
1537541411ceSmrg# Added MAN_SUBSTS in version 1.8
1538541411ceSmrg# Added AC_PROG_SED in version 1.8
1539eeced2e6Smrg
1540541411ceSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1541541411ceSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1542541411ceSmrgAC_REQUIRE([AC_PROG_SED])
154335d5702bSmrg
1544541411ceSmrgcase $host_os in
1545541411ceSmrg    solaris*)
1546541411ceSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1547541411ceSmrg        # check for a man page file found in later versions that use
1548541411ceSmrg        # traditional section numbers instead
1549541411ceSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1550541411ceSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1551541411ceSmrg        ;;
1552541411ceSmrg    *) SYSV_MAN_SECTIONS=false ;;
1553541411ceSmrgesac
1554eeced2e6Smrg
1555541411ceSmrgif test x$APP_MAN_SUFFIX = x    ; then
1556541411ceSmrg    APP_MAN_SUFFIX=1
1557541411ceSmrgfi
1558541411ceSmrgif test x$APP_MAN_DIR = x    ; then
1559541411ceSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1560eeced2e6Smrgfi
156135d5702bSmrg
1562541411ceSmrgif test x$LIB_MAN_SUFFIX = x    ; then
1563541411ceSmrg    LIB_MAN_SUFFIX=3
1564541411ceSmrgfi
1565541411ceSmrgif test x$LIB_MAN_DIR = x    ; then
1566541411ceSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1567eeced2e6Smrgfi
156835d5702bSmrg
1569541411ceSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1570541411ceSmrg    case $SYSV_MAN_SECTIONS in
1571541411ceSmrg	true)				FILE_MAN_SUFFIX=4  ;;
1572541411ceSmrg	*)				FILE_MAN_SUFFIX=5  ;;
1573541411ceSmrg    esac
1574541411ceSmrgfi
1575541411ceSmrgif test x$FILE_MAN_DIR = x    ; then
1576541411ceSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1577eeced2e6Smrgfi
157835d5702bSmrg
1579541411ceSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1580541411ceSmrg    case $SYSV_MAN_SECTIONS in
1581541411ceSmrg	true)				MISC_MAN_SUFFIX=5  ;;
1582541411ceSmrg	*)				MISC_MAN_SUFFIX=7  ;;
1583541411ceSmrg    esac
1584541411ceSmrgfi
1585541411ceSmrgif test x$MISC_MAN_DIR = x    ; then
1586541411ceSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1587541411ceSmrgfi
158835d5702bSmrg
1589541411ceSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1590541411ceSmrg    case $SYSV_MAN_SECTIONS in
1591541411ceSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1592541411ceSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1593541411ceSmrg    esac
1594541411ceSmrgfi
1595541411ceSmrgif test x$DRIVER_MAN_DIR = x    ; then
1596541411ceSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1597541411ceSmrgfi
1598eeced2e6Smrg
1599541411ceSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1600541411ceSmrg    case $SYSV_MAN_SECTIONS in
1601541411ceSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1602541411ceSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
1603541411ceSmrg    esac
1604541411ceSmrgfi
1605541411ceSmrgif test x$ADMIN_MAN_DIR = x    ; then
1606541411ceSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1607eeced2e6Smrgfi
160835d5702bSmrg
1609eeced2e6Smrg
1610541411ceSmrgAC_SUBST([APP_MAN_SUFFIX])
1611541411ceSmrgAC_SUBST([LIB_MAN_SUFFIX])
1612541411ceSmrgAC_SUBST([FILE_MAN_SUFFIX])
1613541411ceSmrgAC_SUBST([MISC_MAN_SUFFIX])
1614541411ceSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1615541411ceSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1616541411ceSmrgAC_SUBST([APP_MAN_DIR])
1617541411ceSmrgAC_SUBST([LIB_MAN_DIR])
1618541411ceSmrgAC_SUBST([FILE_MAN_DIR])
1619541411ceSmrgAC_SUBST([MISC_MAN_DIR])
1620541411ceSmrgAC_SUBST([DRIVER_MAN_DIR])
1621541411ceSmrgAC_SUBST([ADMIN_MAN_DIR])
162235d5702bSmrg
1623541411ceSmrgXORG_MAN_PAGE="X Version 11"
1624541411ceSmrgAC_SUBST([XORG_MAN_PAGE])
1625541411ceSmrgMAN_SUBSTS="\
1626541411ceSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1627541411ceSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1628541411ceSmrg	-e 's|__xservername__|Xorg|g' \
1629541411ceSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
1630541411ceSmrg	-e 's|__projectroot__|\$(prefix)|g' \
1631541411ceSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1632541411ceSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1633541411ceSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1634541411ceSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1635541411ceSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1636541411ceSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1637541411ceSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1638541411ceSmrgAC_SUBST([MAN_SUBSTS])
1639eeced2e6Smrg
1640541411ceSmrg]) # XORG_MANPAGE_SECTIONS
1641eeced2e6Smrg
1642541411ceSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1643541411ceSmrg# ------------------------
1644541411ceSmrg# Minimum version: 1.7.0
1645eeced2e6Smrg#
1646541411ceSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1647541411ceSmrg# provided by xorg-sgml-doctools, if installed.
1648541411ceSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1649541411ceSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1650541411ceSmrgXORG_SGML_PATH=
1651541411ceSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1652541411ceSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1653541411ceSmrg    [m4_ifval([$1],[:],
1654541411ceSmrg        [if test x"$cross_compiling" != x"yes" ; then
1655541411ceSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1656541411ceSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1657541411ceSmrg         fi])
1658541411ceSmrg    ])
1659541411ceSmrg
1660541411ceSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1661541411ceSmrg# the path and the name of the doc stylesheet
1662541411ceSmrgif test "x$XORG_SGML_PATH" != "x" ; then
1663541411ceSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1664541411ceSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1665541411ceSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1666541411ceSmrgelse
1667541411ceSmrg   AC_MSG_RESULT([no])
1668541411ceSmrgfi
1669541411ceSmrg
1670541411ceSmrgAC_SUBST(XORG_SGML_PATH)
1671541411ceSmrgAC_SUBST(STYLESHEET_SRCDIR)
1672541411ceSmrgAC_SUBST(XSL_STYLESHEET)
1673541411ceSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1674541411ceSmrg]) # XORG_CHECK_SGML_DOCTOOLS
167535d5702bSmrg
1676541411ceSmrg# XORG_CHECK_LINUXDOC
1677541411ceSmrg# -------------------
1678eeced2e6Smrg# Minimum version: 1.0.0
1679eeced2e6Smrg#
1680541411ceSmrg# Defines the variable MAKE_TEXT if the necessary tools and
1681541411ceSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1682541411ceSmrg# Whether or not the necessary tools and files are found can be checked
1683541411ceSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1684541411ceSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1685541411ceSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1686541411ceSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
168735d5702bSmrg
1688541411ceSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1689541411ceSmrg
1690541411ceSmrgAC_MSG_CHECKING([whether to build documentation])
1691541411ceSmrg
1692541411ceSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1693541411ceSmrg   BUILDDOC=yes
1694541411ceSmrgelse
1695541411ceSmrg   BUILDDOC=no
1696eeced2e6Smrgfi
169735d5702bSmrg
1698541411ceSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1699541411ceSmrg
1700541411ceSmrgAC_MSG_RESULT([$BUILDDOC])
1701541411ceSmrg
1702541411ceSmrgAC_MSG_CHECKING([whether to build pdf documentation])
1703541411ceSmrg
1704541411ceSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1705541411ceSmrg   BUILDPDFDOC=yes
1706eeced2e6Smrgelse
1707541411ceSmrg   BUILDPDFDOC=no
1708eeced2e6Smrgfi
1709eeced2e6Smrg
1710541411ceSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
171135d5702bSmrg
1712541411ceSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1713541411ceSmrg
1714541411ceSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1715541411ceSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1716541411ceSmrgMAKE_PDF="$PS2PDF"
1717541411ceSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1718541411ceSmrg
1719541411ceSmrgAC_SUBST(MAKE_TEXT)
1720541411ceSmrgAC_SUBST(MAKE_PS)
1721541411ceSmrgAC_SUBST(MAKE_PDF)
1722541411ceSmrgAC_SUBST(MAKE_HTML)
1723541411ceSmrg]) # XORG_CHECK_LINUXDOC
1724541411ceSmrg
1725541411ceSmrg# XORG_CHECK_DOCBOOK
1726541411ceSmrg# -------------------
1727541411ceSmrg# Minimum version: 1.0.0
1728541411ceSmrg#
1729541411ceSmrg# Checks for the ability to build output formats from SGML DocBook source.
1730541411ceSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1731541411ceSmrg# indicates whether the necessary tools and files are found and, if set,
1732541411ceSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1733541411ceSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1734541411ceSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1735541411ceSmrg
1736541411ceSmrgBUILDTXTDOC=no
1737541411ceSmrgBUILDPDFDOC=no
1738541411ceSmrgBUILDPSDOC=no
1739541411ceSmrgBUILDHTMLDOC=no
1740541411ceSmrg
1741541411ceSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1742541411ceSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1743541411ceSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1744541411ceSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1745541411ceSmrg
1746541411ceSmrgAC_MSG_CHECKING([whether to build text documentation])
1747541411ceSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1748541411ceSmrg   test x$BUILD_TXTDOC != xno; then
1749541411ceSmrg	BUILDTXTDOC=yes
1750541411ceSmrgfi
1751541411ceSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1752541411ceSmrgAC_MSG_RESULT([$BUILDTXTDOC])
1753541411ceSmrg
1754541411ceSmrgAC_MSG_CHECKING([whether to build PDF documentation])
1755541411ceSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1756541411ceSmrg   test x$BUILD_PDFDOC != xno; then
1757541411ceSmrg	BUILDPDFDOC=yes
1758541411ceSmrgfi
1759541411ceSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1760541411ceSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1761541411ceSmrg
1762541411ceSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1763541411ceSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1764541411ceSmrg   test x$BUILD_PSDOC != xno; then
1765541411ceSmrg	BUILDPSDOC=yes
1766541411ceSmrgfi
1767541411ceSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1768541411ceSmrgAC_MSG_RESULT([$BUILDPSDOC])
1769541411ceSmrg
1770541411ceSmrgAC_MSG_CHECKING([whether to build HTML documentation])
1771541411ceSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1772541411ceSmrg   test x$BUILD_HTMLDOC != xno; then
1773541411ceSmrg	BUILDHTMLDOC=yes
1774541411ceSmrgfi
1775541411ceSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1776541411ceSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1777541411ceSmrg
1778541411ceSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1779541411ceSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1780541411ceSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1781541411ceSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1782541411ceSmrg
1783541411ceSmrgAC_SUBST(MAKE_TEXT)
1784541411ceSmrgAC_SUBST(MAKE_PS)
1785541411ceSmrgAC_SUBST(MAKE_PDF)
1786541411ceSmrgAC_SUBST(MAKE_HTML)
1787541411ceSmrg]) # XORG_CHECK_DOCBOOK
1788541411ceSmrg
1789541411ceSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1790eeced2e6Smrg# ----------------
1791541411ceSmrg# Minimum version: 1.5.0
1792541411ceSmrg# Minimum version for optional DEFAULT argument: 1.11.0
179335d5702bSmrg#
1794541411ceSmrg# Documentation tools are not always available on all platforms and sometimes
1795541411ceSmrg# not at the appropriate level. This macro enables a module to test for the
1796541411ceSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1797541411ceSmrg# the --with-xmlto option, it allows maximum flexibility in making decisions
1798541411ceSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1799541411ceSmrg# --with-xmlto assumes 'auto'.
180035d5702bSmrg#
1801eeced2e6Smrg# Interface to module:
1802541411ceSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1803541411ceSmrg# XMLTO:	returns the path of the xmlto program found
1804541411ceSmrg#		returns the path set by the user in the environment
1805541411ceSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1806541411ceSmrg#		'no' user instructs the module not to use xmlto
180735d5702bSmrg#
1808541411ceSmrg# Added in version 1.10.0
1809541411ceSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1810541411ceSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
181135d5702bSmrg#
1812541411ceSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1813eeced2e6Smrg#
1814541411ceSmrgAC_DEFUN([XORG_WITH_XMLTO],[
1815541411ceSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1816541411ceSmrgm4_define([_defopt], m4_default([$2], [auto]))
1817541411ceSmrgAC_ARG_WITH(xmlto,
1818541411ceSmrg	AS_HELP_STRING([--with-xmlto],
1819541411ceSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1820541411ceSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1821541411ceSmrgm4_undefine([_defopt])
182235d5702bSmrg
1823541411ceSmrgif test "x$use_xmlto" = x"auto"; then
1824541411ceSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1825541411ceSmrg   if test "x$XMLTO" = "x"; then
1826541411ceSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1827541411ceSmrg	have_xmlto=no
1828541411ceSmrg   else
1829541411ceSmrg        have_xmlto=yes
1830eeced2e6Smrg   fi
1831541411ceSmrgelif test "x$use_xmlto" = x"yes" ; then
1832541411ceSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1833541411ceSmrg   if test "x$XMLTO" = "x"; then
1834541411ceSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1835eeced2e6Smrg   fi
1836541411ceSmrg   have_xmlto=yes
1837541411ceSmrgelif test "x$use_xmlto" = x"no" ; then
1838541411ceSmrg   if test "x$XMLTO" != "x"; then
1839541411ceSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1840541411ceSmrg   fi
1841541411ceSmrg   have_xmlto=no
1842eeced2e6Smrgelse
1843541411ceSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1844eeced2e6Smrgfi
184535d5702bSmrg
1846541411ceSmrg# Test for a minimum version of xmlto, if provided.
1847541411ceSmrgm4_ifval([$1],
1848541411ceSmrg[if test "$have_xmlto" = yes; then
1849541411ceSmrg    # scrape the xmlto version
1850541411ceSmrg    AC_MSG_CHECKING([the xmlto version])
1851541411ceSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1852541411ceSmrg    AC_MSG_RESULT([$xmlto_version])
1853541411ceSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1854541411ceSmrg        [if test "x$use_xmlto" = xauto; then
1855541411ceSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1856541411ceSmrg            have_xmlto=no
1857541411ceSmrg        else
1858541411ceSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1859541411ceSmrg        fi])
1860541411ceSmrgfi])
186135d5702bSmrg
1862541411ceSmrg# Test for the ability of xmlto to generate a text target
1863541411ceSmrg#
1864541411ceSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
1865541411ceSmrg# following test for empty XML docbook files.
1866541411ceSmrg# For compatibility reasons use the following empty XML docbook file and if
1867541411ceSmrg# it fails try it again with a non-empty XML file.
1868541411ceSmrghave_xmlto_text=no
1869541411ceSmrgcat > conftest.xml << "EOF"
1870541411ceSmrgEOF
1871541411ceSmrgAS_IF([test "$have_xmlto" = yes],
1872541411ceSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1873541411ceSmrg             [have_xmlto_text=yes],
1874541411ceSmrg             [# Try it again with a non-empty XML file.
1875541411ceSmrg              cat > conftest.xml << "EOF"
1876541411ceSmrg<x></x>
1877541411ceSmrgEOF
1878541411ceSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1879541411ceSmrg                    [have_xmlto_text=yes],
1880541411ceSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
1881541411ceSmrgrm -f conftest.xml
1882541411ceSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1883541411ceSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1884541411ceSmrg]) # XORG_WITH_XMLTO
188535d5702bSmrg
1886541411ceSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1887541411ceSmrg# --------------------------------------------
1888541411ceSmrg# Minimum version: 1.12.0
1889541411ceSmrg# Minimum version for optional DEFAULT argument: 1.12.0
189035d5702bSmrg#
1891541411ceSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1892541411ceSmrg# XML-based language used for the transformation of XML documents.
1893541411ceSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1894541411ceSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1895541411ceSmrg# The XSLT processor is often used as a standalone tool for transformations.
1896541411ceSmrg# It should not be assumed that this tool is used only to work with documnetation.
1897541411ceSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
189835d5702bSmrg#
1899eeced2e6Smrg# Interface to module:
1900541411ceSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1901541411ceSmrg# XSLTPROC:	 returns the path of the xsltproc program found
1902541411ceSmrg#		 returns the path set by the user in the environment
1903541411ceSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1904541411ceSmrg#		  'no' user instructs the module not to use xsltproc
1905541411ceSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
190635d5702bSmrg#
1907541411ceSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1908541411ceSmrg#
1909541411ceSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1910541411ceSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1911541411ceSmrg# Preserves the interface, should it be implemented later
1912541411ceSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1913541411ceSmrgm4_define([_defopt], m4_default([$2], [auto]))
1914541411ceSmrgAC_ARG_WITH(xsltproc,
1915541411ceSmrg	AS_HELP_STRING([--with-xsltproc],
1916541411ceSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1917541411ceSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1918541411ceSmrgm4_undefine([_defopt])
1919a6fdc6faSmrg
1920541411ceSmrgif test "x$use_xsltproc" = x"auto"; then
1921541411ceSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1922541411ceSmrg   if test "x$XSLTPROC" = "x"; then
1923541411ceSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1924541411ceSmrg	have_xsltproc=no
1925541411ceSmrg   else
1926541411ceSmrg        have_xsltproc=yes
1927eeced2e6Smrg   fi
1928541411ceSmrgelif test "x$use_xsltproc" = x"yes" ; then
1929541411ceSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1930541411ceSmrg   if test "x$XSLTPROC" = "x"; then
1931541411ceSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1932541411ceSmrg   fi
1933541411ceSmrg   have_xsltproc=yes
1934541411ceSmrgelif test "x$use_xsltproc" = x"no" ; then
1935541411ceSmrg   if test "x$XSLTPROC" != "x"; then
1936541411ceSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1937541411ceSmrg   fi
1938541411ceSmrg   have_xsltproc=no
1939541411ceSmrgelse
1940541411ceSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1941eeced2e6Smrgfi
1942a6fdc6faSmrg
1943541411ceSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1944541411ceSmrg]) # XORG_WITH_XSLTPROC
1945a6fdc6faSmrg
1946541411ceSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1947541411ceSmrg# ----------------------------------------
1948541411ceSmrg# Minimum version: 1.15.0
194935d5702bSmrg#
1950541411ceSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
1951541411ceSmrg# scanning arbitrary text files, extracting information from those text files,
1952541411ceSmrg# and printing reports based on that information.
195335d5702bSmrg#
1954541411ceSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
195535d5702bSmrg#
1956541411ceSmrg# Interface to module:
1957541411ceSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
1958541411ceSmrg# PERL:	     returns the path of the perl program found
1959541411ceSmrg#	     returns the path set by the user in the environment
1960541411ceSmrg# --with-perl: 'yes' user instructs the module to use perl
1961541411ceSmrg#	       'no' user instructs the module not to use perl
1962541411ceSmrg# have_perl: returns yes if perl found in PATH or no
1963541411ceSmrg#
1964541411ceSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1965541411ceSmrg#
1966541411ceSmrgAC_DEFUN([XORG_WITH_PERL],[
1967541411ceSmrgAC_ARG_VAR([PERL], [Path to perl command])
1968541411ceSmrg# Preserves the interface, should it be implemented later
1969541411ceSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1970541411ceSmrgm4_define([_defopt], m4_default([$2], [auto]))
1971541411ceSmrgAC_ARG_WITH(perl,
1972541411ceSmrg	AS_HELP_STRING([--with-perl],
1973541411ceSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1974541411ceSmrg	   [use_perl=$withval], [use_perl=]_defopt)
1975541411ceSmrgm4_undefine([_defopt])
1976a6fdc6faSmrg
1977541411ceSmrgif test "x$use_perl" = x"auto"; then
1978541411ceSmrg   AC_PATH_PROG([PERL], [perl])
1979541411ceSmrg   if test "x$PERL" = "x"; then
1980541411ceSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1981541411ceSmrg	have_perl=no
1982541411ceSmrg   else
1983541411ceSmrg        have_perl=yes
1984541411ceSmrg   fi
1985541411ceSmrgelif test "x$use_perl" = x"yes" ; then
1986541411ceSmrg   AC_PATH_PROG([PERL], [perl])
1987541411ceSmrg   if test "x$PERL" = "x"; then
1988541411ceSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1989541411ceSmrg   fi
1990541411ceSmrg   have_perl=yes
1991541411ceSmrgelif test "x$use_perl" = x"no" ; then
1992541411ceSmrg   if test "x$PERL" != "x"; then
1993541411ceSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1994541411ceSmrg   fi
1995541411ceSmrg   have_perl=no
1996541411ceSmrgelse
1997541411ceSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1998eeced2e6Smrgfi
1999a6fdc6faSmrg
2000541411ceSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2001541411ceSmrg]) # XORG_WITH_PERL
200235d5702bSmrg
2003541411ceSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2004eeced2e6Smrg# ----------------
2005541411ceSmrg# Minimum version: 1.5.0
2006541411ceSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2007eeced2e6Smrg#
2008541411ceSmrg# Documentation tools are not always available on all platforms and sometimes
2009541411ceSmrg# not at the appropriate level. This macro enables a module to test for the
2010541411ceSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2011541411ceSmrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
2012541411ceSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2013541411ceSmrg# --with-asciidoc assumes 'auto'.
2014eeced2e6Smrg#
2015541411ceSmrg# Interface to module:
2016541411ceSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2017541411ceSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
2018541411ceSmrg#		 returns the path set by the user in the environment
2019541411ceSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2020541411ceSmrg#		  'no' user instructs the module not to use asciidoc
2021541411ceSmrg#
2022541411ceSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2023541411ceSmrg#
2024541411ceSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2025541411ceSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2026541411ceSmrgm4_define([_defopt], m4_default([$2], [auto]))
2027541411ceSmrgAC_ARG_WITH(asciidoc,
2028541411ceSmrg	AS_HELP_STRING([--with-asciidoc],
2029541411ceSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2030541411ceSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2031541411ceSmrgm4_undefine([_defopt])
203235d5702bSmrg
2033541411ceSmrgif test "x$use_asciidoc" = x"auto"; then
2034541411ceSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2035541411ceSmrg   if test "x$ASCIIDOC" = "x"; then
2036541411ceSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2037541411ceSmrg	have_asciidoc=no
2038541411ceSmrg   else
2039541411ceSmrg        have_asciidoc=yes
2040541411ceSmrg   fi
2041541411ceSmrgelif test "x$use_asciidoc" = x"yes" ; then
2042541411ceSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2043541411ceSmrg   if test "x$ASCIIDOC" = "x"; then
2044541411ceSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2045541411ceSmrg   fi
2046541411ceSmrg   have_asciidoc=yes
2047541411ceSmrgelif test "x$use_asciidoc" = x"no" ; then
2048541411ceSmrg   if test "x$ASCIIDOC" != "x"; then
2049541411ceSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2050541411ceSmrg   fi
2051541411ceSmrg   have_asciidoc=no
2052541411ceSmrgelse
2053541411ceSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2054541411ceSmrgfi
2055541411ceSmrgm4_ifval([$1],
2056541411ceSmrg[if test "$have_asciidoc" = yes; then
2057541411ceSmrg    # scrape the asciidoc version
2058541411ceSmrg    AC_MSG_CHECKING([the asciidoc version])
2059541411ceSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2060541411ceSmrg    AC_MSG_RESULT([$asciidoc_version])
2061541411ceSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2062541411ceSmrg        [if test "x$use_asciidoc" = xauto; then
2063541411ceSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2064541411ceSmrg            have_asciidoc=no
2065541411ceSmrg        else
2066541411ceSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2067541411ceSmrg        fi])
2068541411ceSmrgfi])
2069541411ceSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2070541411ceSmrg]) # XORG_WITH_ASCIIDOC
2071a6fdc6faSmrg
2072541411ceSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
2073541411ceSmrg# -------------------------------------------
2074541411ceSmrg# Minimum version: 1.5.0
2075541411ceSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2076541411ceSmrg# Minimum version for optional DOT checking: 1.18.0
207735d5702bSmrg#
2078541411ceSmrg# Documentation tools are not always available on all platforms and sometimes
2079541411ceSmrg# not at the appropriate level. This macro enables a module to test for the
2080541411ceSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2081541411ceSmrg# the --with-doxygen option, it allows maximum flexibility in making decisions
2082541411ceSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2083541411ceSmrg# --with-doxygen assumes 'auto'.
2084eeced2e6Smrg#
2085541411ceSmrg# Interface to module:
2086541411ceSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2087541411ceSmrg# DOXYGEN:	 returns the path of the doxygen program found
2088541411ceSmrg#		 returns the path set by the user in the environment
2089541411ceSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2090541411ceSmrg#		  'no' user instructs the module not to use doxygen
2091eeced2e6Smrg#
2092541411ceSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2093eeced2e6Smrg#
2094541411ceSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2095541411ceSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2096541411ceSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
2097541411ceSmrgm4_define([_defopt], m4_default([$2], [auto]))
2098541411ceSmrgAC_ARG_WITH(doxygen,
2099541411ceSmrg	AS_HELP_STRING([--with-doxygen],
2100541411ceSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2101541411ceSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2102541411ceSmrgm4_undefine([_defopt])
2103a6fdc6faSmrg
2104541411ceSmrgif test "x$use_doxygen" = x"auto"; then
2105541411ceSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2106541411ceSmrg   if test "x$DOXYGEN" = "x"; then
2107541411ceSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2108541411ceSmrg	have_doxygen=no
2109541411ceSmrg   else
2110541411ceSmrg        have_doxygen=yes
2111541411ceSmrg   fi
2112541411ceSmrgelif test "x$use_doxygen" = x"yes" ; then
2113541411ceSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2114541411ceSmrg   if test "x$DOXYGEN" = "x"; then
2115541411ceSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2116541411ceSmrg   fi
2117541411ceSmrg   have_doxygen=yes
2118541411ceSmrgelif test "x$use_doxygen" = x"no" ; then
2119541411ceSmrg   if test "x$DOXYGEN" != "x"; then
2120541411ceSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2121541411ceSmrg   fi
2122541411ceSmrg   have_doxygen=no
2123541411ceSmrgelse
2124541411ceSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2125541411ceSmrgfi
2126541411ceSmrgm4_ifval([$1],
2127541411ceSmrg[if test "$have_doxygen" = yes; then
2128541411ceSmrg    # scrape the doxygen version
2129541411ceSmrg    AC_MSG_CHECKING([the doxygen version])
2130541411ceSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2131541411ceSmrg    AC_MSG_RESULT([$doxygen_version])
2132541411ceSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2133541411ceSmrg        [if test "x$use_doxygen" = xauto; then
2134541411ceSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2135541411ceSmrg            have_doxygen=no
2136541411ceSmrg        else
2137541411ceSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2138541411ceSmrg        fi])
2139541411ceSmrgfi])
2140a6fdc6faSmrg
2141541411ceSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2142541411ceSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2143541411ceSmrgdnl 	HAVE_DOT = @HAVE_DOT@
2144541411ceSmrgHAVE_DOT=no
2145541411ceSmrgif test "x$have_doxygen" = "xyes"; then
2146541411ceSmrg  AC_PATH_PROG([DOT], [dot])
2147541411ceSmrg    if test "x$DOT" != "x"; then
2148541411ceSmrg      HAVE_DOT=yes
2149541411ceSmrg    fi
2150541411ceSmrgfi
215135d5702bSmrg
2152541411ceSmrgAC_SUBST([HAVE_DOT])
2153541411ceSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2154541411ceSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2155541411ceSmrg]) # XORG_WITH_DOXYGEN
2156eeced2e6Smrg
2157541411ceSmrg# XORG_WITH_GROFF([DEFAULT])
2158541411ceSmrg# ----------------
2159541411ceSmrg# Minimum version: 1.6.0
2160541411ceSmrg# Minimum version for optional DEFAULT argument: 1.11.0
216135d5702bSmrg#
2162541411ceSmrg# Documentation tools are not always available on all platforms and sometimes
2163541411ceSmrg# not at the appropriate level. This macro enables a module to test for the
2164541411ceSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2165541411ceSmrg# the --with-groff option, it allows maximum flexibility in making decisions
2166541411ceSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
2167541411ceSmrg# --with-groff assumes 'auto'.
216835d5702bSmrg#
2169541411ceSmrg# Interface to module:
2170541411ceSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2171541411ceSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2172541411ceSmrg# HAVE_GROFF_MS: the -ms macros package
2173541411ceSmrg# GROFF:	 returns the path of the groff program found
2174541411ceSmrg#		 returns the path set by the user in the environment
2175541411ceSmrg# --with-groff:	 'yes' user instructs the module to use groff
2176541411ceSmrg#		 'no' user instructs the module not to use groff
217735d5702bSmrg#
2178541411ceSmrg# Added in version 1.9.0:
2179541411ceSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2180541411ceSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2181541411ceSmrg#		   psselect from the psutils package.
2182541411ceSmrg#		   the ghostcript package. Refer to the grohtml man pages
218335d5702bSmrg#
2184541411ceSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2185eeced2e6Smrg#
2186541411ceSmrg# OS and distros often splits groff in a basic and full package, the former
2187541411ceSmrg# having the groff program and the later having devices, fonts and macros
2188541411ceSmrg# Checking for the groff executable is not enough.
2189eeced2e6Smrg#
2190541411ceSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
2191541411ceSmrg# unset HAVE_GROFF or GROFF env variables.
2192541411ceSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2193541411ceSmrg#
2194541411ceSmrgAC_DEFUN([XORG_WITH_GROFF],[
2195541411ceSmrgAC_ARG_VAR([GROFF], [Path to groff command])
2196541411ceSmrgm4_define([_defopt], m4_default([$1], [auto]))
2197541411ceSmrgAC_ARG_WITH(groff,
2198541411ceSmrg	AS_HELP_STRING([--with-groff],
2199541411ceSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2200541411ceSmrg	   [use_groff=$withval], [use_groff=]_defopt)
2201541411ceSmrgm4_undefine([_defopt])
2202eeced2e6Smrg
2203541411ceSmrgif test "x$use_groff" = x"auto"; then
2204541411ceSmrg   AC_PATH_PROG([GROFF], [groff])
2205541411ceSmrg   if test "x$GROFF" = "x"; then
2206541411ceSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2207541411ceSmrg	have_groff=no
2208541411ceSmrg   else
2209541411ceSmrg        have_groff=yes
2210541411ceSmrg   fi
2211541411ceSmrgelif test "x$use_groff" = x"yes" ; then
2212541411ceSmrg   AC_PATH_PROG([GROFF], [groff])
2213541411ceSmrg   if test "x$GROFF" = "x"; then
2214541411ceSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2215541411ceSmrg   fi
2216541411ceSmrg   have_groff=yes
2217541411ceSmrgelif test "x$use_groff" = x"no" ; then
2218541411ceSmrg   if test "x$GROFF" != "x"; then
2219541411ceSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2220541411ceSmrg   fi
2221541411ceSmrg   have_groff=no
222235d5702bSmrgelse
2223541411ceSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
222435d5702bSmrgfi
2225a6fdc6faSmrg
2226541411ceSmrg# We have groff, test for the presence of the macro packages
2227541411ceSmrgif test "x$have_groff" = x"yes"; then
2228541411ceSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2229541411ceSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2230541411ceSmrg        groff_ms_works=yes
2231541411ceSmrg    else
2232541411ceSmrg        groff_ms_works=no
2233eeced2e6Smrg    fi
2234541411ceSmrg    AC_MSG_RESULT([$groff_ms_works])
2235541411ceSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2236541411ceSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2237541411ceSmrg        groff_mm_works=yes
2238541411ceSmrg    else
2239541411ceSmrg        groff_mm_works=no
2240541411ceSmrg    fi
2241541411ceSmrg    AC_MSG_RESULT([$groff_mm_works])
224235d5702bSmrgfi
2243eeced2e6Smrg
2244541411ceSmrg# We have groff, test for HTML dependencies, one command per package
2245541411ceSmrgif test "x$have_groff" = x"yes"; then
2246541411ceSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2247541411ceSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2248541411ceSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2249541411ceSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2250541411ceSmrg      have_groff_html=yes
2251541411ceSmrg   else
2252541411ceSmrg      have_groff_html=no
2253541411ceSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2254541411ceSmrg   fi
2255541411ceSmrgfi
2256eeced2e6Smrg
2257541411ceSmrg# Set Automake conditionals for Makefiles
2258541411ceSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2259541411ceSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2260541411ceSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2261541411ceSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2262541411ceSmrg]) # XORG_WITH_GROFF
2263eeced2e6Smrg
2264541411ceSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2265541411ceSmrg# ---------------------------------------
2266541411ceSmrg# Minimum version: 1.6.0
2267541411ceSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2268541411ceSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2269541411ceSmrg#
2270541411ceSmrg# Documentation tools are not always available on all platforms and sometimes
2271541411ceSmrg# not at the appropriate level. This macro enables a module to test for the
2272541411ceSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2273541411ceSmrg# the --with-fop option, it allows maximum flexibility in making decisions
2274541411ceSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
2275541411ceSmrg# --with-fop assumes 'auto'.
2276541411ceSmrg#
2277541411ceSmrg# Interface to module:
2278541411ceSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2279541411ceSmrg# FOP:	 	returns the path of the fop program found
2280541411ceSmrg#		returns the path set by the user in the environment
2281541411ceSmrg# --with-fop: 	'yes' user instructs the module to use fop
2282541411ceSmrg#		'no' user instructs the module not to use fop
2283541411ceSmrg#
2284541411ceSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2285541411ceSmrg#
2286541411ceSmrgAC_DEFUN([XORG_WITH_FOP],[
2287541411ceSmrgAC_ARG_VAR([FOP], [Path to fop command])
2288541411ceSmrgm4_define([_defopt], m4_default([$2], [auto]))
2289541411ceSmrgAC_ARG_WITH(fop,
2290541411ceSmrg	AS_HELP_STRING([--with-fop],
2291541411ceSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2292541411ceSmrg	   [use_fop=$withval], [use_fop=]_defopt)
2293541411ceSmrgm4_undefine([_defopt])
2294eeced2e6Smrg
2295541411ceSmrgif test "x$use_fop" = x"auto"; then
2296541411ceSmrg   AC_PATH_PROG([FOP], [fop])
2297541411ceSmrg   if test "x$FOP" = "x"; then
2298541411ceSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2299541411ceSmrg	have_fop=no
2300541411ceSmrg   else
2301541411ceSmrg        have_fop=yes
2302541411ceSmrg   fi
2303541411ceSmrgelif test "x$use_fop" = x"yes" ; then
2304541411ceSmrg   AC_PATH_PROG([FOP], [fop])
2305541411ceSmrg   if test "x$FOP" = "x"; then
2306541411ceSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2307541411ceSmrg   fi
2308541411ceSmrg   have_fop=yes
2309541411ceSmrgelif test "x$use_fop" = x"no" ; then
2310541411ceSmrg   if test "x$FOP" != "x"; then
2311541411ceSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2312541411ceSmrg   fi
2313541411ceSmrg   have_fop=no
2314541411ceSmrgelse
2315541411ceSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
231635d5702bSmrgfi
2317a6fdc6faSmrg
2318541411ceSmrg# Test for a minimum version of fop, if provided.
2319541411ceSmrgm4_ifval([$1],
2320541411ceSmrg[if test "$have_fop" = yes; then
2321541411ceSmrg    # scrape the fop version
2322541411ceSmrg    AC_MSG_CHECKING([for fop minimum version])
2323541411ceSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2324541411ceSmrg    AC_MSG_RESULT([$fop_version])
2325541411ceSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
2326541411ceSmrg        [if test "x$use_fop" = xauto; then
2327541411ceSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2328541411ceSmrg            have_fop=no
2329541411ceSmrg        else
2330541411ceSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2331541411ceSmrg        fi])
2332541411ceSmrgfi])
2333541411ceSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2334541411ceSmrg]) # XORG_WITH_FOP
2335a6fdc6faSmrg
2336541411ceSmrg# XORG_WITH_M4([MIN-VERSION])
2337541411ceSmrg# ---------------------------
2338541411ceSmrg# Minimum version: 1.19.0
233935d5702bSmrg#
2340541411ceSmrg# This macro attempts to locate an m4 macro processor which supports
2341541411ceSmrg# -I option and is only useful for modules relying on M4 in order to
2342541411ceSmrg# expand macros in source code files.
2343eeced2e6Smrg#
2344541411ceSmrg# Interface to module:
2345541411ceSmrg# M4:	 	returns the path of the m4 program found
2346541411ceSmrg#		returns the path set by the user in the environment
2347541411ceSmrg#
2348541411ceSmrgAC_DEFUN([XORG_WITH_M4], [
2349541411ceSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2350541411ceSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2351541411ceSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2352541411ceSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2353541411ceSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2354541411ceSmrg   [$PATH:/usr/gnu/bin])])
2355a6fdc6faSmrg
2356541411ceSmrgAC_SUBST([M4], [$ac_cv_path_M4])
2357541411ceSmrg]) # XORG_WITH_M4
2358a6fdc6faSmrg
2359541411ceSmrg# XORG_WITH_PS2PDF([DEFAULT])
2360541411ceSmrg# ----------------
2361541411ceSmrg# Minimum version: 1.6.0
2362541411ceSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2363541411ceSmrg#
2364541411ceSmrg# Documentation tools are not always available on all platforms and sometimes
2365541411ceSmrg# not at the appropriate level. This macro enables a module to test for the
2366541411ceSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2367541411ceSmrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
2368541411ceSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2369541411ceSmrg# --with-ps2pdf assumes 'auto'.
2370541411ceSmrg#
2371541411ceSmrg# Interface to module:
2372541411ceSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2373541411ceSmrg# PS2PDF:	returns the path of the ps2pdf program found
2374541411ceSmrg#		returns the path set by the user in the environment
2375541411ceSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2376541411ceSmrg#		 'no' user instructs the module not to use ps2pdf
2377541411ceSmrg#
2378541411ceSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2379541411ceSmrg#
2380541411ceSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2381541411ceSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2382541411ceSmrgm4_define([_defopt], m4_default([$1], [auto]))
2383541411ceSmrgAC_ARG_WITH(ps2pdf,
2384541411ceSmrg	AS_HELP_STRING([--with-ps2pdf],
2385541411ceSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2386541411ceSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2387541411ceSmrgm4_undefine([_defopt])
2388a6fdc6faSmrg
2389541411ceSmrgif test "x$use_ps2pdf" = x"auto"; then
2390541411ceSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2391541411ceSmrg   if test "x$PS2PDF" = "x"; then
2392541411ceSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2393541411ceSmrg	have_ps2pdf=no
2394541411ceSmrg   else
2395541411ceSmrg        have_ps2pdf=yes
2396541411ceSmrg   fi
2397541411ceSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2398541411ceSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2399541411ceSmrg   if test "x$PS2PDF" = "x"; then
2400541411ceSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2401541411ceSmrg   fi
2402541411ceSmrg   have_ps2pdf=yes
2403541411ceSmrgelif test "x$use_ps2pdf" = x"no" ; then
2404541411ceSmrg   if test "x$PS2PDF" != "x"; then
2405541411ceSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2406541411ceSmrg   fi
2407541411ceSmrg   have_ps2pdf=no
2408541411ceSmrgelse
2409541411ceSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2410eeced2e6Smrgfi
2411541411ceSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2412541411ceSmrg]) # XORG_WITH_PS2PDF
2413a6fdc6faSmrg
2414541411ceSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2415541411ceSmrg# ----------------
2416541411ceSmrg# Minimum version: 1.6.0
2417541411ceSmrg#
2418541411ceSmrg# Documentation tools are not always available on all platforms and sometimes
2419541411ceSmrg# not at the appropriate level. This macro enables a builder to skip all
2420541411ceSmrg# documentation targets except traditional man pages.
2421541411ceSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2422541411ceSmrg# maximum flexibility in controlling documentation building.
2423541411ceSmrg# Refer to:
2424541411ceSmrg# XORG_WITH_XMLTO         --with-xmlto
2425541411ceSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2426541411ceSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2427541411ceSmrg# XORG_WITH_FOP           --with-fop
2428541411ceSmrg# XORG_WITH_GROFF         --with-groff
2429541411ceSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2430541411ceSmrg#
2431541411ceSmrg# Interface to module:
2432541411ceSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2433541411ceSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2434541411ceSmrg#		 'no' user instructs the module not to generate docs
2435541411ceSmrg# parm1:	specify the default value, yes or no.
2436541411ceSmrg#
2437541411ceSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2438541411ceSmrgm4_define([docs_default], m4_default([$1], [yes]))
2439541411ceSmrgAC_ARG_ENABLE(docs,
2440541411ceSmrg	AS_HELP_STRING([--enable-docs],
2441541411ceSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2442541411ceSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2443541411ceSmrgm4_undefine([docs_default])
2444541411ceSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2445541411ceSmrgAC_MSG_CHECKING([whether to build documentation])
2446541411ceSmrgAC_MSG_RESULT([$build_docs])
2447541411ceSmrg]) # XORG_ENABLE_DOCS
2448a6fdc6faSmrg
2449541411ceSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2450541411ceSmrg# ----------------
2451541411ceSmrg# Minimum version: 1.6.0
2452541411ceSmrg#
2453541411ceSmrg# This macro enables a builder to skip all developer documentation.
2454541411ceSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2455541411ceSmrg# maximum flexibility in controlling documentation building.
2456541411ceSmrg# Refer to:
2457541411ceSmrg# XORG_WITH_XMLTO         --with-xmlto
2458541411ceSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2459541411ceSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2460541411ceSmrg# XORG_WITH_FOP           --with-fop
2461541411ceSmrg# XORG_WITH_GROFF         --with-groff
2462541411ceSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2463541411ceSmrg#
2464541411ceSmrg# Interface to module:
2465541411ceSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2466541411ceSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2467541411ceSmrg#			'no' user instructs the module not to generate developer docs
2468541411ceSmrg# parm1:		specify the default value, yes or no.
2469541411ceSmrg#
2470541411ceSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2471541411ceSmrgm4_define([devel_default], m4_default([$1], [yes]))
2472541411ceSmrgAC_ARG_ENABLE(devel-docs,
2473541411ceSmrg	AS_HELP_STRING([--enable-devel-docs],
2474541411ceSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2475541411ceSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2476541411ceSmrgm4_undefine([devel_default])
2477541411ceSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2478541411ceSmrgAC_MSG_CHECKING([whether to build developer documentation])
2479541411ceSmrgAC_MSG_RESULT([$build_devel_docs])
2480541411ceSmrg]) # XORG_ENABLE_DEVEL_DOCS
2481a6fdc6faSmrg
2482541411ceSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
2483541411ceSmrg# ----------------
2484541411ceSmrg# Minimum version: 1.6.0
2485541411ceSmrg#
2486541411ceSmrg# This macro enables a builder to skip all functional specification targets.
2487541411ceSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2488541411ceSmrg# maximum flexibility in controlling documentation building.
2489541411ceSmrg# Refer to:
2490541411ceSmrg# XORG_WITH_XMLTO         --with-xmlto
2491541411ceSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2492541411ceSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2493541411ceSmrg# XORG_WITH_FOP           --with-fop
2494541411ceSmrg# XORG_WITH_GROFF         --with-groff
2495541411ceSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2496541411ceSmrg#
2497541411ceSmrg# Interface to module:
2498541411ceSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2499541411ceSmrg# --enable-specs:	'yes' user instructs the module to generate specs
2500541411ceSmrg#			'no' user instructs the module not to generate specs
2501541411ceSmrg# parm1:		specify the default value, yes or no.
2502541411ceSmrg#
2503541411ceSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2504541411ceSmrgm4_define([spec_default], m4_default([$1], [yes]))
2505541411ceSmrgAC_ARG_ENABLE(specs,
2506541411ceSmrg	AS_HELP_STRING([--enable-specs],
2507541411ceSmrg	   [Enable building the specs (default: ]spec_default[)]),
2508541411ceSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
2509541411ceSmrgm4_undefine([spec_default])
2510541411ceSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2511541411ceSmrgAC_MSG_CHECKING([whether to build functional specifications])
2512541411ceSmrgAC_MSG_RESULT([$build_specs])
2513541411ceSmrg]) # XORG_ENABLE_SPECS
251435d5702bSmrg
2515541411ceSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2516541411ceSmrg# ----------------------------------------------
2517541411ceSmrg# Minimum version: 1.13.0
2518541411ceSmrg#
2519541411ceSmrg# This macro enables a builder to enable/disable unit testing
2520541411ceSmrg# It makes no assumption about the test cases implementation
2521541411ceSmrg# Test cases may or may not use Automake "Support for test suites"
2522541411ceSmrg# They may or may not use the software utility library GLib
2523541411ceSmrg#
2524541411ceSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2525541411ceSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2526541411ceSmrg# The variable enable_unit_tests is used by other macros in this file.
2527541411ceSmrg#
2528541411ceSmrg# Interface to module:
2529541411ceSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2530541411ceSmrg# enable_unit_tests:    used in configure.ac for additional configuration
2531541411ceSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2532541411ceSmrg#			'no' user instructs the module not to build tests
2533541411ceSmrg# parm1:		specify the default value, yes or no.
2534541411ceSmrg#
2535541411ceSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2536541411ceSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2537541411ceSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2538541411ceSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2539541411ceSmrgm4_define([_defopt], m4_default([$1], [auto]))
2540541411ceSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2541541411ceSmrg	[Enable building unit test cases (default: ]_defopt[)]),
2542541411ceSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2543541411ceSmrgm4_undefine([_defopt])
2544541411ceSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2545541411ceSmrgAC_MSG_CHECKING([whether to build unit test cases])
2546541411ceSmrgAC_MSG_RESULT([$enable_unit_tests])
2547541411ceSmrg]) # XORG_ENABLE_UNIT_TESTS
2548eeced2e6Smrg
2549541411ceSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2550541411ceSmrg# ------------------------------------------------------
2551541411ceSmrg# Minimum version: 1.17.0
2552541411ceSmrg#
2553541411ceSmrg# This macro enables a builder to enable/disable integration testing
2554541411ceSmrg# It makes no assumption about the test cases' implementation
2555541411ceSmrg# Test cases may or may not use Automake "Support for test suites"
2556541411ceSmrg#
2557541411ceSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2558541411ceSmrg# usually requires less dependencies and may be built and run under less
2559541411ceSmrg# stringent environments than integration tests.
2560541411ceSmrg#
2561541411ceSmrg# Interface to module:
2562541411ceSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2563541411ceSmrg# enable_integration_tests:   used in configure.ac for additional configuration
2564541411ceSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2565541411ceSmrg#                             'no' user instructs the module not to build tests
2566541411ceSmrg# parm1:                      specify the default value, yes or no.
2567541411ceSmrg#
2568541411ceSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2569541411ceSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2570541411ceSmrgm4_define([_defopt], m4_default([$1], [auto]))
2571541411ceSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2572541411ceSmrg	[Enable building integration test cases (default: ]_defopt[)]),
2573541411ceSmrg	[enable_integration_tests=$enableval],
2574541411ceSmrg	[enable_integration_tests=]_defopt)
2575541411ceSmrgm4_undefine([_defopt])
2576541411ceSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2577541411ceSmrg	[test "x$enable_integration_tests" != xno])
2578541411ceSmrgAC_MSG_CHECKING([whether to build unit test cases])
2579541411ceSmrgAC_MSG_RESULT([$enable_integration_tests])
2580541411ceSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
2581eeced2e6Smrg
2582541411ceSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2583541411ceSmrg# ----------------------------------------
2584541411ceSmrg# Minimum version: 1.13.0
2585541411ceSmrg#
2586541411ceSmrg# GLib is a library which provides advanced data structures and functions.
2587541411ceSmrg# This macro enables a module to test for the presence of Glib.
2588541411ceSmrg#
2589541411ceSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2590541411ceSmrg# Otherwise the value of $enable_unit_tests is blank.
2591541411ceSmrg#
2592541411ceSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2593541411ceSmrg# test support usually requires less dependencies and may be built and run under
2594541411ceSmrg# less stringent environments than integration tests.
2595541411ceSmrg#
2596541411ceSmrg# Interface to module:
2597541411ceSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
2598541411ceSmrg# with_glib: used in configure.ac to know if GLib has been found
2599541411ceSmrg# --with-glib:	'yes' user instructs the module to use glib
2600541411ceSmrg#		'no' user instructs the module not to use glib
2601541411ceSmrg#
2602541411ceSmrgAC_DEFUN([XORG_WITH_GLIB],[
2603541411ceSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2604541411ceSmrgm4_define([_defopt], m4_default([$2], [auto]))
2605541411ceSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2606541411ceSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2607541411ceSmrg	[with_glib=$withval], [with_glib=]_defopt)
2608541411ceSmrgm4_undefine([_defopt])
2609eeced2e6Smrg
2610541411ceSmrghave_glib=no
2611541411ceSmrg# Do not probe GLib if user explicitly disabled unit testing
2612541411ceSmrgif test "x$enable_unit_tests" != x"no"; then
2613541411ceSmrg  # Do not probe GLib if user explicitly disabled it
2614541411ceSmrg  if test "x$with_glib" != x"no"; then
2615541411ceSmrg    m4_ifval(
2616541411ceSmrg      [$1],
2617541411ceSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2618541411ceSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2619541411ceSmrg    )
2620541411ceSmrg  fi
2621541411ceSmrgfi
2622eeced2e6Smrg
2623541411ceSmrg# Not having GLib when unit testing has been explicitly requested is an error
2624541411ceSmrgif test "x$enable_unit_tests" = x"yes"; then
2625541411ceSmrg  if test "x$have_glib" = x"no"; then
2626541411ceSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2627541411ceSmrg  fi
2628541411ceSmrgfi
2629eeced2e6Smrg
2630541411ceSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
2631541411ceSmrgif test "x$enable_unit_tests" = x"no"; then
2632541411ceSmrg  if test "x$with_glib" = x"yes"; then
2633541411ceSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2634541411ceSmrg  fi
263535d5702bSmrgfi
263635d5702bSmrg
2637541411ceSmrg# Not having GLib when it has been explicitly requested is an error
2638541411ceSmrgif test "x$with_glib" = x"yes"; then
2639541411ceSmrg  if test "x$have_glib" = x"no"; then
2640541411ceSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2641541411ceSmrg  fi
2642541411ceSmrgfi
264335d5702bSmrg
2644541411ceSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2645541411ceSmrg]) # XORG_WITH_GLIB
264635d5702bSmrg
2647541411ceSmrg# XORG_LD_WRAP([required|optional])
2648541411ceSmrg# ---------------------------------
2649541411ceSmrg# Minimum version: 1.13.0
2650541411ceSmrg#
2651541411ceSmrg# Check if linker supports -wrap, passed via compiler flags
2652541411ceSmrg#
2653541411ceSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2654541411ceSmrg# Otherwise the value of $enable_unit_tests is blank.
2655541411ceSmrg#
2656541411ceSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2657541411ceSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2658541411ceSmrg# available, an argument of "optional" allows use when some unit tests require
2659541411ceSmrg# ld -wrap and others do not.
2660541411ceSmrg#
2661541411ceSmrgAC_DEFUN([XORG_LD_WRAP],[
2662541411ceSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2663541411ceSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2664541411ceSmrg                      void __wrap_exit(int status) { return; }],
2665541411ceSmrg                     [exit(0);])])
2666541411ceSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
2667541411ceSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2668541411ceSmrg  if test "x$have_ld_wrap" = x"no"; then
2669541411ceSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2670541411ceSmrg  fi
267135d5702bSmrgfi
2672541411ceSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2673541411ceSmrg#
2674541411ceSmrg]) # XORG_LD_WRAP
267535d5702bSmrg
2676541411ceSmrg# XORG_CHECK_LINKER_FLAGS
2677541411ceSmrg# -----------------------
2678541411ceSmrg# SYNOPSIS
2679541411ceSmrg#
2680541411ceSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2681541411ceSmrg#
2682541411ceSmrg# DESCRIPTION
2683541411ceSmrg#
2684541411ceSmrg#   Check whether the given linker FLAGS work with the current language's
2685541411ceSmrg#   linker, or whether they give an error.
2686541411ceSmrg#
2687541411ceSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2688541411ceSmrg#   success/failure.
2689541411ceSmrg#
2690541411ceSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
2691541411ceSmrg#
2692541411ceSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2693541411ceSmrg#
2694541411ceSmrg# LICENSE
2695541411ceSmrg#
2696541411ceSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2697541411ceSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2698541411ceSmrg#   Copyright (c) 2009 Matteo Frigo
2699541411ceSmrg#
2700541411ceSmrg#   This program is free software: you can redistribute it and/or modify it
2701541411ceSmrg#   under the terms of the GNU General Public License as published by the
2702541411ceSmrg#   Free Software Foundation, either version 3 of the License, or (at your
2703541411ceSmrg#   option) any later version.
2704541411ceSmrg#
2705541411ceSmrg#   This program is distributed in the hope that it will be useful, but
2706541411ceSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2707541411ceSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2708541411ceSmrg#   Public License for more details.
2709541411ceSmrg#
2710541411ceSmrg#   You should have received a copy of the GNU General Public License along
2711541411ceSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2712541411ceSmrg#
2713541411ceSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
2714541411ceSmrg#   gives unlimited permission to copy, distribute and modify the configure
2715541411ceSmrg#   scripts that are the output of Autoconf when processing the Macro. You
2716541411ceSmrg#   need not follow the terms of the GNU General Public License when using
2717541411ceSmrg#   or distributing such scripts, even though portions of the text of the
2718541411ceSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2719541411ceSmrg#   all other use of the material that constitutes the Autoconf Macro.
2720541411ceSmrg#
2721541411ceSmrg#   This special exception to the GPL applies to versions of the Autoconf
2722541411ceSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
2723541411ceSmrg#   modified version of the Autoconf Macro, you may extend this special
2724541411ceSmrg#   exception to the GPL to apply to your modified version as well.#
2725541411ceSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2726541411ceSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
2727541411ceSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2728541411ceSmrgAS_LITERAL_IF([$1],
2729541411ceSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2730541411ceSmrg      ax_save_FLAGS=$LDFLAGS
2731541411ceSmrg      LDFLAGS="$1"
2732541411ceSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2733541411ceSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2734541411ceSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2735541411ceSmrg      LDFLAGS=$ax_save_FLAGS])],
2736541411ceSmrg  [ax_save_FLAGS=$LDFLAGS
2737541411ceSmrg   LDFLAGS="$1"
2738541411ceSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2739541411ceSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2740541411ceSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2741541411ceSmrg   LDFLAGS=$ax_save_FLAGS])
2742541411ceSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2743541411ceSmrgAC_MSG_RESULT($xorg_check_linker_flags)
2744541411ceSmrgif test "x$xorg_check_linker_flags" = xyes; then
2745541411ceSmrg	m4_default([$2], :)
2746541411ceSmrgelse
2747541411ceSmrg	m4_default([$3], :)
2748541411ceSmrgfi
2749541411ceSmrg]) # XORG_CHECK_LINKER_FLAGS
275035d5702bSmrg
2751541411ceSmrg# XORG_MEMORY_CHECK_FLAGS
2752541411ceSmrg# -----------------------
2753541411ceSmrg# Minimum version: 1.16.0
2754eeced2e6Smrg#
2755541411ceSmrg# This macro attempts to find appropriate memory checking functionality
2756541411ceSmrg# for various platforms which unit testing code may use to catch various
2757541411ceSmrg# forms of memory allocation and access errors in testing.
2758541411ceSmrg#
2759541411ceSmrg# Interface to module:
2760541411ceSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2761541411ceSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2762541411ceSmrg#
2763541411ceSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2764541411ceSmrg#
2765541411ceSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
276635d5702bSmrg
2767541411ceSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2768541411ceSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2769541411ceSmrg           [Environment variables to enable memory checking in tests])
277035d5702bSmrg
2771541411ceSmrg# Check for different types of support on different platforms
2772541411ceSmrgcase $host_os in
2773541411ceSmrg    solaris*)
2774541411ceSmrg        AC_CHECK_LIB([umem], [umem_alloc],
2775541411ceSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2776541411ceSmrg        ;;
2777541411ceSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2778541411ceSmrg        # both directly and inverted, so should not be 0 or 255.
2779541411ceSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
2780541411ceSmrg        ;;
2781541411ceSmrg    darwin*)
2782541411ceSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2783541411ceSmrg        ;;
2784541411ceSmrg    *bsd*)
2785541411ceSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2786541411ceSmrg        ;;
2787541411ceSmrgesac
278835d5702bSmrg
2789541411ceSmrg# User supplied flags override default flags
2790541411ceSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2791541411ceSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2792541411ceSmrgfi
279335d5702bSmrg
2794541411ceSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2795541411ceSmrg]) # XORG_WITH_LINT
2796eeced2e6Smrg
2797541411ceSmrg# XORG_CHECK_MALLOC_ZERO
2798541411ceSmrg# ----------------------
2799541411ceSmrg# Minimum version: 1.0.0
280035d5702bSmrg#
2801541411ceSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2802541411ceSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2803541411ceSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2804541411ceSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2805541411ceSmrgAC_ARG_ENABLE(malloc0returnsnull,
2806541411ceSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2807541411ceSmrg		       [malloc(0) returns NULL (default: auto)]),
2808541411ceSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2809541411ceSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
281035d5702bSmrg
2811541411ceSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2812541411ceSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2813541411ceSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
2814541411ceSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2815541411ceSmrg#include <stdlib.h>
2816541411ceSmrg],[
2817541411ceSmrg    char *m0, *r0, *c0, *p;
2818541411ceSmrg    m0 = malloc(0);
2819541411ceSmrg    p = malloc(10);
2820541411ceSmrg    r0 = realloc(p,0);
2821541411ceSmrg    c0 = calloc(0,10);
2822541411ceSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2823541411ceSmrg])],
2824541411ceSmrg		[xorg_cv_malloc0_returns_null=yes],
2825541411ceSmrg		[xorg_cv_malloc0_returns_null=no])])
2826541411ceSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2827541411ceSmrgfi
2828541411ceSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
282935d5702bSmrg
2830541411ceSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2831541411ceSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2832541411ceSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2833541411ceSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2834541411ceSmrgelse
2835541411ceSmrg	MALLOC_ZERO_CFLAGS=""
2836541411ceSmrg	XMALLOC_ZERO_CFLAGS=""
2837541411ceSmrg	XTMALLOC_ZERO_CFLAGS=""
2838541411ceSmrgfi
283935d5702bSmrg
2840541411ceSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2841541411ceSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2842541411ceSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2843541411ceSmrg]) # XORG_CHECK_MALLOC_ZERO
2844a6fdc6faSmrg
2845541411ceSmrg# XORG_WITH_LINT()
2846541411ceSmrg# ----------------
2847541411ceSmrg# Minimum version: 1.1.0
284835d5702bSmrg#
2849541411ceSmrg# This macro enables the use of a tool that flags some suspicious and
2850541411ceSmrg# non-portable constructs (likely to be bugs) in C language source code.
2851541411ceSmrg# It will attempt to locate the tool and use appropriate options.
2852541411ceSmrg# There are various lint type tools on different platforms.
2853541411ceSmrg#
2854541411ceSmrg# Interface to module:
2855541411ceSmrg# LINT:		returns the path to the tool found on the platform
2856541411ceSmrg#		or the value set to LINT on the configure cmd line
2857541411ceSmrg#		also an Automake conditional
2858541411ceSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
2859541411ceSmrg#
2860541411ceSmrg# --with-lint:	'yes' user instructs the module to use lint
2861541411ceSmrg#		'no' user instructs the module not to use lint (default)
2862541411ceSmrg#
2863541411ceSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2864541411ceSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2865541411ceSmrg#
2866541411ceSmrgAC_DEFUN([XORG_WITH_LINT],[
286735d5702bSmrg
2868541411ceSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2869541411ceSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2870541411ceSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2871541411ceSmrg		[Use a lint-style source code checker (default: disabled)])],
2872541411ceSmrg		[use_lint=$withval], [use_lint=no])
287335d5702bSmrg
2874541411ceSmrg# Obtain platform specific info like program name and options
2875541411ceSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2876541411ceSmrgcase $host_os in
2877541411ceSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2878541411ceSmrg	lint_name=splint
2879541411ceSmrg	lint_options="-badflag"
2880541411ceSmrg	;;
2881541411ceSmrg  *freebsd* | *netbsd*)
2882541411ceSmrg	lint_name=lint
2883541411ceSmrg	lint_options="-u -b"
2884541411ceSmrg	;;
2885541411ceSmrg  *solaris*)
2886541411ceSmrg	lint_name=lint
2887541411ceSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2888541411ceSmrg	;;
2889541411ceSmrgesac
289035d5702bSmrg
2891541411ceSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2892541411ceSmrgif test "x$use_lint" = x"yes" ; then
2893541411ceSmrg   AC_PATH_PROG([LINT], [$lint_name])
2894541411ceSmrg   if test "x$LINT" = "x"; then
2895541411ceSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2896541411ceSmrg   fi
2897541411ceSmrgelif test "x$use_lint" = x"no" ; then
2898541411ceSmrg   if test "x$LINT" != "x"; then
2899541411ceSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2900541411ceSmrg   fi
2901eeced2e6Smrgelse
2902541411ceSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2903eeced2e6Smrgfi
290435d5702bSmrg
2905541411ceSmrg# User supplied flags override default flags
2906541411ceSmrgif test "x$LINT_FLAGS" != "x"; then
2907541411ceSmrg   lint_options=$LINT_FLAGS
2908541411ceSmrgfi
290935d5702bSmrg
2910541411ceSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2911541411ceSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2912eeced2e6Smrg
2913541411ceSmrg]) # XORG_WITH_LINT
2914eeced2e6Smrg
2915541411ceSmrg# XORG_LINT_LIBRARY(LIBNAME)
2916541411ceSmrg# --------------------------
2917541411ceSmrg# Minimum version: 1.1.0
291835d5702bSmrg#
2919541411ceSmrg# Sets up flags for building lint libraries for checking programs that call
2920541411ceSmrg# functions in the library.
2921541411ceSmrg#
2922541411ceSmrg# Interface to module:
2923541411ceSmrg# LINTLIB		- Automake variable with the name of lint library file to make
2924541411ceSmrg# MAKE_LINT_LIB		- Automake conditional
2925541411ceSmrg#
2926541411ceSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2927541411ceSmrg#			  - 'no' user instructs the module not to create a lint library (default)
2928eeced2e6Smrg
2929541411ceSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2930541411ceSmrgAC_REQUIRE([XORG_WITH_LINT])
2931541411ceSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2932541411ceSmrg	[Create lint library (default: disabled)])],
2933541411ceSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
293435d5702bSmrg
2935541411ceSmrgif test "x$make_lint_lib" = x"yes" ; then
2936541411ceSmrg   LINTLIB=llib-l$1.ln
2937541411ceSmrg   if test "x$LINT" = "x"; then
2938541411ceSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2939541411ceSmrg   fi
2940541411ceSmrgelif test "x$make_lint_lib" != x"no" ; then
2941541411ceSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2942541411ceSmrgfi
294335d5702bSmrg
2944541411ceSmrgAC_SUBST(LINTLIB)
2945541411ceSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2946a6fdc6faSmrg
2947541411ceSmrg]) # XORG_LINT_LIBRARY
2948a6fdc6faSmrg
2949541411ceSmrg# XORG_COMPILER_BRAND
2950541411ceSmrg# -------------------
2951541411ceSmrg# Minimum version: 1.14.0
2952541411ceSmrg#
2953541411ceSmrg# Checks for various brands of compilers and sets flags as appropriate:
2954541411ceSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2955541411ceSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2956541411ceSmrg#   clang compiler - sets CLANGCC to "yes"
2957541411ceSmrg#   Intel compiler - sets INTELCC to "yes"
2958541411ceSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2959541411ceSmrg#
2960541411ceSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2961541411ceSmrgAC_LANG_CASE(
2962541411ceSmrg	[C], [
2963541411ceSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
2964541411ceSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
2965541411ceSmrg		m4_version_prereq([2.70],
2966541411ceSmrg			[AC_REQUIRE([AC_PROG_CC])],
2967541411ceSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
2968541411ceSmrg	],
2969541411ceSmrg	[C++], [
2970541411ceSmrg		AC_REQUIRE([AC_PROG_CXX])
2971541411ceSmrg	]
2972541411ceSmrg)
2973541411ceSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2974541411ceSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2975541411ceSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2976541411ceSmrg]) # XORG_COMPILER_BRAND
297735d5702bSmrg
2978541411ceSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2979541411ceSmrg# ---------------
2980541411ceSmrg# Minimum version: 1.16.0
2981541411ceSmrg#
2982541411ceSmrg# Test if the compiler works when passed the given flag as a command line argument.
2983541411ceSmrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
2984541411ceSmrg# next flag in the list until there are no more options.
2985541411ceSmrg#
2986541411ceSmrg# Note that this does not guarantee that the compiler supports the flag as some
2987541411ceSmrg# compilers will simply ignore arguments that they do not understand, but we do
2988541411ceSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2989541411ceSmrg# -Werror=unused-command-line-argument
2990541411ceSmrg#
2991541411ceSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2992541411ceSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2993541411ceSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2994541411ceSmrg
2995541411ceSmrgAC_LANG_COMPILER_REQUIRE
2996541411ceSmrg
2997541411ceSmrgAC_LANG_CASE(
2998541411ceSmrg	[C], [
2999541411ceSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
3000541411ceSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3001541411ceSmrg		m4_version_prereq([2.70],
3002541411ceSmrg			[AC_REQUIRE([AC_PROG_CC])],
3003541411ceSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3004541411ceSmrg		define([PREFIX], [C])
3005541411ceSmrg		define([CACHE_PREFIX], [cc])
3006541411ceSmrg		define([COMPILER], [$CC])
3007541411ceSmrg	],
3008541411ceSmrg	[C++], [
3009541411ceSmrg		define([PREFIX], [CXX])
3010541411ceSmrg		define([CACHE_PREFIX], [cxx])
3011541411ceSmrg		define([COMPILER], [$CXX])
3012541411ceSmrg	]
3013541411ceSmrg)
301435d5702bSmrg
3015541411ceSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
3016541411ceSmrg
3017541411ceSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
3018541411ceSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3019541411ceSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
3020541411ceSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3021541411ceSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3022541411ceSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
3023541411ceSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
3024541411ceSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
3025541411ceSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3026541411ceSmrgfi
3027eeced2e6Smrg
3028541411ceSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
3029541411ceSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
3030541411ceSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3031541411ceSmrg	fi
3032541411ceSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3033541411ceSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
3034541411ceSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3035541411ceSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3036541411ceSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
3037541411ceSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
3038541411ceSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
3039541411ceSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3040541411ceSmrgfi
3041eeced2e6Smrg
3042541411ceSmrgfound="no"
3043541411ceSmrgm4_foreach([flag], m4_cdr($@), [
3044541411ceSmrg	if test $found = "no" ; then
3045541411ceSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
3046541411ceSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3047541411ceSmrg		fi
3048541411ceSmrg
3049541411ceSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
3050541411ceSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3051541411ceSmrg		fi
3052541411ceSmrg
3053541411ceSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
3054541411ceSmrg
3055541411ceSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
3056541411ceSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
3057541411ceSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
3058541411ceSmrg		AC_CACHE_VAL($cacheid,
3059541411ceSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3060541411ceSmrg					     [eval $cacheid=yes],
3061541411ceSmrg					     [eval $cacheid=no])])
3062541411ceSmrg
3063541411ceSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3064541411ceSmrg
3065541411ceSmrg		eval supported=\$$cacheid
3066541411ceSmrg		AC_MSG_RESULT([$supported])
3067541411ceSmrg		if test "$supported" = "yes" ; then
3068541411ceSmrg			$1="$$1 ]flag["
3069541411ceSmrg			found="yes"
3070541411ceSmrg		fi
3071541411ceSmrg	fi
3072541411ceSmrg])
3073541411ceSmrg]) # XORG_TESTSET_CFLAG
3074eeced2e6Smrg
3075541411ceSmrg# XORG_COMPILER_FLAGS
3076541411ceSmrg# ---------------
3077541411ceSmrg# Minimum version: 1.16.0
3078541411ceSmrg#
3079541411ceSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
3080541411ceSmrg# arguments supported by the selected compiler which do NOT alter the generated
3081541411ceSmrg# code.  These arguments will cause the compiler to print various warnings
3082541411ceSmrg# during compilation AND turn a conservative set of warnings into errors.
3083541411ceSmrg#
3084541411ceSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
3085541411ceSmrg# future versions of util-macros as options are added to new compilers.
3086541411ceSmrg#
3087541411ceSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
3088541411ceSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3089541411ceSmrg
3090541411ceSmrgAC_ARG_ENABLE(selective-werror,
3091541411ceSmrg              AS_HELP_STRING([--disable-selective-werror],
3092541411ceSmrg                             [Turn off selective compiler errors. (default: enabled)]),
3093541411ceSmrg              [SELECTIVE_WERROR=$enableval],
3094541411ceSmrg              [SELECTIVE_WERROR=yes])
3095541411ceSmrg
3096541411ceSmrgAC_LANG_CASE(
3097541411ceSmrg        [C], [
3098541411ceSmrg                define([PREFIX], [C])
3099541411ceSmrg        ],
3100541411ceSmrg        [C++], [
3101541411ceSmrg                define([PREFIX], [CXX])
3102541411ceSmrg        ]
3103541411ceSmrg)
3104541411ceSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
3105541411ceSmrgif test "x$SUNCC" = "xyes"; then
3106541411ceSmrg    [BASE_]PREFIX[FLAGS]="-v"
3107eeced2e6Smrgelse
3108541411ceSmrg    [BASE_]PREFIX[FLAGS]=""
310935d5702bSmrgfi
311035d5702bSmrg
3111541411ceSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3112541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
3113541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
3114541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
3115541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3116541411ceSmrg
3117541411ceSmrgAC_LANG_CASE(
3118541411ceSmrg	[C], [
3119541411ceSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
3120541411ceSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
3121541411ceSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
3122541411ceSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
3123541411ceSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
3124541411ceSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
3125541411ceSmrg	]
3126541411ceSmrg)
312735d5702bSmrg
3128541411ceSmrg# This chunk adds additional warnings that could catch undesired effects.
3129541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
3130541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
3131541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
3132541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
3133541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
3134541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
3135541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3136541411ceSmrg
3137541411ceSmrg# These are currently disabled because they are noisy.  They will be enabled
3138541411ceSmrg# in the future once the codebase is sufficiently modernized to silence
3139541411ceSmrg# them.  For now, I don't want them to drown out the other warnings.
3140541411ceSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3141541411ceSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3142541411ceSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3143541411ceSmrg
3144541411ceSmrg# Turn some warnings into errors, so we don't accidentally get successful builds
3145541411ceSmrg# when there are problems that should be fixed.
3146541411ceSmrg
3147541411ceSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3148541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3149541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3150541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3151541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3152541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3153541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3154541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3155541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3156541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3157541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3158541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3159541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3160541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3161541411ceSmrgelse
3162541411ceSmrgAC_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])
3163541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3164541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3165541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3166541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3167541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3168541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3169541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3170541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3171541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3172541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3173541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3174541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3175541411ceSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3176541411ceSmrgfi
317735d5702bSmrg
3178541411ceSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3179541411ceSmrg]) # XORG_COMPILER_FLAGS
318035d5702bSmrg
3181541411ceSmrg# XORG_CWARNFLAGS
3182541411ceSmrg# ---------------
3183541411ceSmrg# Minimum version: 1.2.0
3184541411ceSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3185eeced2e6Smrg#
3186541411ceSmrg# Defines CWARNFLAGS to enable C compiler warnings.
3187541411ceSmrg#
3188541411ceSmrg# This function is deprecated because it defines -fno-strict-aliasing
3189541411ceSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3190541411ceSmrg# is needed, then it should be added explicitly in the module when
3191541411ceSmrg# it is updated to use BASE_CFLAGS.
3192541411ceSmrg#
3193541411ceSmrgAC_DEFUN([XORG_CWARNFLAGS], [
3194541411ceSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3195541411ceSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3196541411ceSmrgAC_LANG_CASE(
3197541411ceSmrg	[C], [
3198541411ceSmrg		CWARNFLAGS="$BASE_CFLAGS"
3199541411ceSmrg		if  test "x$GCC" = xyes ; then
3200541411ceSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3201541411ceSmrg		fi
3202541411ceSmrg		AC_SUBST(CWARNFLAGS)
3203541411ceSmrg	]
3204541411ceSmrg)
3205541411ceSmrg]) # XORG_CWARNFLAGS
320635d5702bSmrg
3207541411ceSmrg# XORG_STRICT_OPTION
3208541411ceSmrg# -----------------------
3209541411ceSmrg# Minimum version: 1.3.0
321035d5702bSmrg#
3211541411ceSmrg# Add configure option to enable strict compilation flags, such as treating
3212541411ceSmrg# warnings as fatal errors.
3213541411ceSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3214541411ceSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3215541411ceSmrg#
3216541411ceSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3217541411ceSmrg# when strict compilation is unconditionally desired.
3218541411ceSmrgAC_DEFUN([XORG_STRICT_OPTION], [
3219541411ceSmrgAC_REQUIRE([XORG_CWARNFLAGS])
3220541411ceSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3221541411ceSmrg
3222541411ceSmrgAC_ARG_ENABLE(strict-compilation,
3223541411ceSmrg			  AS_HELP_STRING([--enable-strict-compilation],
3224541411ceSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3225541411ceSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
322635d5702bSmrg
3227541411ceSmrgAC_LANG_CASE(
3228541411ceSmrg        [C], [
3229541411ceSmrg                define([PREFIX], [C])
3230541411ceSmrg        ],
3231541411ceSmrg        [C++], [
3232541411ceSmrg                define([PREFIX], [CXX])
3233541411ceSmrg        ]
3234541411ceSmrg)
323535d5702bSmrg
3236541411ceSmrg[STRICT_]PREFIX[FLAGS]=""
3237541411ceSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3238541411ceSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
323935d5702bSmrg
3240541411ceSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3241541411ceSmrg# activate it with -Werror, so we add it here explicitly.
3242541411ceSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
324335d5702bSmrg
3244541411ceSmrgif test "x$STRICT_COMPILE" = "xyes"; then
3245541411ceSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3246541411ceSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3247541411ceSmrgfi
3248541411ceSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3249541411ceSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3250541411ceSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3251541411ceSmrg]) # XORG_STRICT_OPTION
325235d5702bSmrg
3253541411ceSmrg# XORG_DEFAULT_NOCODE_OPTIONS
3254541411ceSmrg# ---------------------------
3255541411ceSmrg# Minimum version: 1.20.0
3256eeced2e6Smrg#
3257541411ceSmrg# Defines default options for X.Org modules which don't compile code,
3258541411ceSmrg# such as fonts, bitmaps, cursors, and docs.
3259541411ceSmrg#
3260541411ceSmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
3261541411ceSmrgAC_REQUIRE([AC_PROG_INSTALL])
3262541411ceSmrgXORG_RELEASE_VERSION
3263541411ceSmrgXORG_CHANGELOG
3264541411ceSmrgXORG_INSTALL
3265541411ceSmrgXORG_MANPAGE_SECTIONS
3266541411ceSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3267541411ceSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3268541411ceSmrg]) # XORG_DEFAULT_NOCODE_OPTIONS
326935d5702bSmrg
3270541411ceSmrg# XORG_DEFAULT_OPTIONS
3271eeced2e6Smrg# --------------------
3272541411ceSmrg# Minimum version: 1.3.0
3273eeced2e6Smrg#
3274541411ceSmrg# Defines default options for X.Org modules which compile code.
3275eeced2e6Smrg#
3276541411ceSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3277541411ceSmrgAC_REQUIRE([AC_PROG_INSTALL])
3278541411ceSmrgXORG_COMPILER_FLAGS
3279541411ceSmrgXORG_CWARNFLAGS
3280541411ceSmrgXORG_STRICT_OPTION
3281541411ceSmrgXORG_DEFAULT_NOCODE_OPTIONS
3282541411ceSmrg]) # XORG_DEFAULT_OPTIONS
3283541411ceSmrg
3284541411ceSmrg# XORG_INSTALL()
3285541411ceSmrg# ----------------
3286541411ceSmrg# Minimum version: 1.4.0
3287541411ceSmrg#
3288541411ceSmrg# Defines the variable INSTALL_CMD as the command to copy
3289541411ceSmrg# INSTALL from $prefix/share/util-macros.
3290541411ceSmrg#
3291541411ceSmrgAC_DEFUN([XORG_INSTALL], [
3292541411ceSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3293541411ceSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3294541411ceSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3295541411ceSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3296541411ceSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3297541411ceSmrgtouch \$(top_srcdir)/INSTALL; \
3298541411ceSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3299541411ceSmrgAC_SUBST([INSTALL_CMD])
3300541411ceSmrg]) # XORG_INSTALL
3301541411ceSmrgdnl Copyright 2005 Red Hat, Inc
3302541411ceSmrgdnl
3303541411ceSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3304541411ceSmrgdnl documentation for any purpose is hereby granted without fee, provided that
3305541411ceSmrgdnl the above copyright notice appear in all copies and that both that
3306541411ceSmrgdnl copyright notice and this permission notice appear in supporting
3307541411ceSmrgdnl documentation.
3308541411ceSmrgdnl
3309541411ceSmrgdnl The above copyright notice and this permission notice shall be included
3310541411ceSmrgdnl in all copies or substantial portions of the Software.
3311541411ceSmrgdnl
3312541411ceSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3313541411ceSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3314541411ceSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3315541411ceSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3316541411ceSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3317541411ceSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3318541411ceSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
3319541411ceSmrgdnl
3320541411ceSmrgdnl Except as contained in this notice, the name of the copyright holders shall
3321541411ceSmrgdnl not be used in advertising or otherwise to promote the sale, use or
3322541411ceSmrgdnl other dealings in this Software without prior written authorization
3323541411ceSmrgdnl from the copyright holders.
3324541411ceSmrgdnl
332535d5702bSmrg
3326541411ceSmrg# XORG_RELEASE_VERSION
3327541411ceSmrg# --------------------
3328541411ceSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
332935d5702bSmrg
3330541411ceSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3331541411ceSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3332541411ceSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3333541411ceSmrg		[Major version of this package])
3334541411ceSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3335541411ceSmrg	if test "x$PVM" = "x"; then
3336541411ceSmrg		PVM="0"
3337541411ceSmrg	fi
3338541411ceSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3339541411ceSmrg		[$PVM],
3340541411ceSmrg		[Minor version of this package])
3341541411ceSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3342541411ceSmrg	if test "x$PVP" = "x"; then
3343541411ceSmrg		PVP="0"
3344541411ceSmrg	fi
3345541411ceSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3346541411ceSmrg		[$PVP],
3347541411ceSmrg		[Patch version of this package])
3348541411ceSmrg])
334935d5702bSmrg
3350541411ceSmrg# XORG_CHANGELOG()
3351541411ceSmrg# ----------------
3352541411ceSmrg# Minimum version: 1.2.0
3353541411ceSmrg#
3354541411ceSmrg# Defines the variable CHANGELOG_CMD as the command to generate
3355541411ceSmrg# ChangeLog from git.
3356541411ceSmrg#
3357541411ceSmrg#
3358541411ceSmrgAC_DEFUN([XORG_CHANGELOG], [
3359541411ceSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3360541411ceSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3361541411ceSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3362541411ceSmrgtouch \$(top_srcdir)/ChangeLog; \
3363541411ceSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3364541411ceSmrgAC_SUBST([CHANGELOG_CMD])
3365541411ceSmrg]) # XORG_CHANGELOG
336635d5702bSmrg
3367