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