1111ba1daSmrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2111ba1daSmrg
3111ba1daSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
40bd0e222Smrg
50bd0e222Smrg# This file is free software; the Free Software Foundation
60bd0e222Smrg# gives unlimited permission to copy and/or distribute it,
70bd0e222Smrg# with or without modifications, as long as this notice is preserved.
80bd0e222Smrg
90bd0e222Smrg# This program is distributed in the hope that it will be useful,
100bd0e222Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
110bd0e222Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
120bd0e222Smrg# PARTICULAR PURPOSE.
130bd0e222Smrg
14111ba1daSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
158ff16396Smrgm4_ifndef([AC_AUTOCONF_VERSION],
168ff16396Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17111ba1daSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
18111ba1daSmrg[m4_warning([this file was generated for autoconf 2.71.
198ff16396SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
208ff16396SmrgIf you have problems, you may need to regenerate the build system entirely.
21111ba1daSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22d5d8cc55Smrg
23111ba1daSmrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
24d5d8cc55Smrg#
25111ba1daSmrg# This file is free software; the Free Software Foundation
26111ba1daSmrg# gives unlimited permission to copy and/or distribute it,
27111ba1daSmrg# with or without modifications, as long as this notice is preserved.
288ff16396Smrg
29111ba1daSmrg# AM_AUTOMAKE_VERSION(VERSION)
30111ba1daSmrg# ----------------------------
31111ba1daSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32111ba1daSmrg# generated from the m4 files accompanying Automake X.Y.
33111ba1daSmrg# (This private macro should not be called outside this file.)
34111ba1daSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35111ba1daSmrg[am__api_version='1.16'
36111ba1daSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37111ba1daSmrgdnl require some minimum version.  Point them to the right macro.
38111ba1daSmrgm4_if([$1], [1.16.5], [],
39111ba1daSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40111ba1daSmrg])
410bd0e222Smrg
42111ba1daSmrg# _AM_AUTOCONF_VERSION(VERSION)
43111ba1daSmrg# -----------------------------
44111ba1daSmrg# aclocal traces this macro to find the Autoconf version.
45111ba1daSmrg# This is a private macro too.  Using m4_define simplifies
46111ba1daSmrg# the logic in aclocal, which can simply ignore this definition.
47111ba1daSmrgm4_define([_AM_AUTOCONF_VERSION], [])
480bd0e222Smrg
49111ba1daSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50111ba1daSmrg# -------------------------------
51111ba1daSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52111ba1daSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53111ba1daSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54111ba1daSmrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
55111ba1daSmrgm4_ifndef([AC_AUTOCONF_VERSION],
56111ba1daSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57111ba1daSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
580bd0e222Smrg
59111ba1daSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
600bd0e222Smrg
61111ba1daSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
62111ba1daSmrg#
63111ba1daSmrg# This file is free software; the Free Software Foundation
64111ba1daSmrg# gives unlimited permission to copy and/or distribute it,
65111ba1daSmrg# with or without modifications, as long as this notice is preserved.
66d5d8cc55Smrg
67111ba1daSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68111ba1daSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69111ba1daSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
700bd0e222Smrg#
71111ba1daSmrg# Of course, Automake must honor this variable whenever it calls a
72111ba1daSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73111ba1daSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74111ba1daSmrg# depending on how configure is run.  This is pretty annoying, since
75111ba1daSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76111ba1daSmrg# source directory, any form will work fine, but in subdirectories a
77111ba1daSmrg# relative path needs to be adjusted first.
780bd0e222Smrg#
79111ba1daSmrg# $ac_aux_dir/missing
80111ba1daSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81111ba1daSmrg# $top_srcdir/$ac_aux_dir/missing
82111ba1daSmrg#    fails if $ac_aux_dir is absolute,
83111ba1daSmrg#    fails when called from a subdirectory in a VPATH build with
84111ba1daSmrg#          a relative $ac_aux_dir
858ff16396Smrg#
86111ba1daSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87111ba1daSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
88111ba1daSmrg# harmless because $srcdir is '.', but things will broke when you
89111ba1daSmrg# start a VPATH build or use an absolute $srcdir.
90d5d8cc55Smrg#
91111ba1daSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92111ba1daSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93111ba1daSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94111ba1daSmrg# and then we would define $MISSING as
95111ba1daSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96111ba1daSmrg# This will work as long as MISSING is not called from configure, because
97111ba1daSmrg# unfortunately $(top_srcdir) has no meaning in configure.
98111ba1daSmrg# However there are other variables, like CC, which are often used in
99111ba1daSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100d5d8cc55Smrg#
101111ba1daSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
102111ba1daSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
103111ba1daSmrg# configured tree to be moved without reconfiguration.
104111ba1daSmrg
105111ba1daSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106111ba1daSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107111ba1daSmrg# Expand $ac_aux_dir to an absolute path.
108111ba1daSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109d5d8cc55Smrg])
1100bd0e222Smrg
111111ba1daSmrg# Do all the work for Automake.                             -*- Autoconf -*-
1120bd0e222Smrg
113111ba1daSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
1148ff16396Smrg#
115111ba1daSmrg# This file is free software; the Free Software Foundation
116111ba1daSmrg# gives unlimited permission to copy and/or distribute it,
117111ba1daSmrg# with or without modifications, as long as this notice is preserved.
1180bd0e222Smrg
119111ba1daSmrg# This macro actually does too much.  Some checks are only needed if
120111ba1daSmrg# your package does certain things.  But this isn't really a big deal.
1210bd0e222Smrg
122111ba1daSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
123111ba1daSmrgm4_define([AC_PROG_CC],
124111ba1daSmrgm4_defn([AC_PROG_CC])
125111ba1daSmrg[_AM_PROG_CC_C_O
126d5d8cc55Smrg])
1270bd0e222Smrg
128111ba1daSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
129111ba1daSmrg# AM_INIT_AUTOMAKE([OPTIONS])
130111ba1daSmrg# -----------------------------------------------
131111ba1daSmrg# The call with PACKAGE and VERSION arguments is the old style
132111ba1daSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
133111ba1daSmrg# and VERSION should now be passed to AC_INIT and removed from
134111ba1daSmrg# the call to AM_INIT_AUTOMAKE.
135111ba1daSmrg# We support both call styles for the transition.  After
136111ba1daSmrg# the next Automake release, Autoconf can make the AC_INIT
137111ba1daSmrg# arguments mandatory, and then we can depend on a new Autoconf
138111ba1daSmrg# release and drop the old call support.
139111ba1daSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
140111ba1daSmrg[AC_PREREQ([2.65])dnl
141111ba1daSmrgm4_ifdef([_$0_ALREADY_INIT],
142111ba1daSmrg  [m4_fatal([$0 expanded multiple times
143111ba1daSmrg]m4_defn([_$0_ALREADY_INIT]))],
144111ba1daSmrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
145111ba1daSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
146111ba1daSmrgdnl the ones we care about.
147111ba1daSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
148111ba1daSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
149111ba1daSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
150111ba1daSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
151111ba1daSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
152111ba1daSmrg  # is not polluted with repeated "-I."
153111ba1daSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
154111ba1daSmrg  # test to see if srcdir already configured
155111ba1daSmrg  if test -f $srcdir/config.status; then
156111ba1daSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
157111ba1daSmrg  fi
158111ba1daSmrgfi
1590bd0e222Smrg
160111ba1daSmrg# test whether we have cygpath
161111ba1daSmrgif test -z "$CYGPATH_W"; then
162111ba1daSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
163111ba1daSmrg    CYGPATH_W='cygpath -w'
164111ba1daSmrg  else
165111ba1daSmrg    CYGPATH_W=echo
166111ba1daSmrg  fi
167111ba1daSmrgfi
168111ba1daSmrgAC_SUBST([CYGPATH_W])
1698ff16396Smrg
170111ba1daSmrg# Define the identity of the package.
171111ba1daSmrgdnl Distinguish between old-style and new-style calls.
172111ba1daSmrgm4_ifval([$2],
173111ba1daSmrg[AC_DIAGNOSE([obsolete],
174111ba1daSmrg             [$0: two- and three-arguments forms are deprecated.])
175111ba1daSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
176111ba1daSmrg AC_SUBST([PACKAGE], [$1])dnl
177111ba1daSmrg AC_SUBST([VERSION], [$2])],
178111ba1daSmrg[_AM_SET_OPTIONS([$1])dnl
179111ba1daSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
180111ba1daSmrgm4_if(
181111ba1daSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
182111ba1daSmrg  [ok:ok],,
183111ba1daSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
184111ba1daSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
185111ba1daSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
1860bd0e222Smrg
187111ba1daSmrg_AM_IF_OPTION([no-define],,
188111ba1daSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
189111ba1daSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
1900bd0e222Smrg
191111ba1daSmrg# Some tools Automake needs.
192111ba1daSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
193111ba1daSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
194111ba1daSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
195111ba1daSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
196111ba1daSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
197111ba1daSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
198111ba1daSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
199111ba1daSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
200111ba1daSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
201111ba1daSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
202111ba1daSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
203111ba1daSmrg# dies out for good.  For more background, see:
204111ba1daSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
205111ba1daSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
206111ba1daSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
207111ba1daSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
208111ba1daSmrg# system "awk" is bad on some platforms.
209111ba1daSmrgAC_REQUIRE([AC_PROG_AWK])dnl
210111ba1daSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
211111ba1daSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
212111ba1daSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
213111ba1daSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
214111ba1daSmrg			     [_AM_PROG_TAR([v7])])])
215111ba1daSmrg_AM_IF_OPTION([no-dependencies],,
216111ba1daSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
217111ba1daSmrg		  [_AM_DEPENDENCIES([CC])],
218111ba1daSmrg		  [m4_define([AC_PROG_CC],
219111ba1daSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
220111ba1daSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
221111ba1daSmrg		  [_AM_DEPENDENCIES([CXX])],
222111ba1daSmrg		  [m4_define([AC_PROG_CXX],
223111ba1daSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
224111ba1daSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
225111ba1daSmrg		  [_AM_DEPENDENCIES([OBJC])],
226111ba1daSmrg		  [m4_define([AC_PROG_OBJC],
227111ba1daSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
228111ba1daSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
229111ba1daSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
230111ba1daSmrg		  [m4_define([AC_PROG_OBJCXX],
231111ba1daSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
2328ff16396Smrg])
233111ba1daSmrg# Variables for tags utilities; see am/tags.am
234111ba1daSmrgif test -z "$CTAGS"; then
235111ba1daSmrg  CTAGS=ctags
236111ba1daSmrgfi
237111ba1daSmrgAC_SUBST([CTAGS])
238111ba1daSmrgif test -z "$ETAGS"; then
239111ba1daSmrg  ETAGS=etags
240111ba1daSmrgfi
241111ba1daSmrgAC_SUBST([ETAGS])
242111ba1daSmrgif test -z "$CSCOPE"; then
243111ba1daSmrg  CSCOPE=cscope
244111ba1daSmrgfi
245111ba1daSmrgAC_SUBST([CSCOPE])
2468ff16396Smrg
247111ba1daSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
248111ba1daSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
249111ba1daSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
250111ba1daSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
251111ba1daSmrgAC_CONFIG_COMMANDS_PRE(dnl
252111ba1daSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
253111ba1daSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2548ff16396Smrg
255111ba1daSmrg# POSIX will say in a future version that running "rm -f" with no argument
256111ba1daSmrg# is OK; and we want to be able to make that assumption in our Makefile
257111ba1daSmrg# recipes.  So use an aggressive probe to check that the usage we want is
258111ba1daSmrg# actually supported "in the wild" to an acceptable degree.
259111ba1daSmrg# See automake bug#10828.
260111ba1daSmrg# To make any issue more visible, cause the running configure to be aborted
261111ba1daSmrg# by default if the 'rm' program in use doesn't match our expectations; the
262111ba1daSmrg# user can still override this though.
263111ba1daSmrgif rm -f && rm -fr && rm -rf; then : OK; else
264111ba1daSmrg  cat >&2 <<'END'
265111ba1daSmrgOops!
266111ba1daSmrg
267111ba1daSmrgYour 'rm' program seems unable to run without file operands specified
268111ba1daSmrgon the command line, even when the '-f' option is present.  This is contrary
269111ba1daSmrgto the behaviour of most rm programs out there, and not conforming with
270111ba1daSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
271111ba1daSmrg
272111ba1daSmrgPlease tell bug-automake@gnu.org about your system, including the value
273111ba1daSmrgof your $PATH and any error possibly output before this message.  This
274111ba1daSmrgcan help us improve future automake versions.
2758ff16396Smrg
276111ba1daSmrgEND
277111ba1daSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
278111ba1daSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
279111ba1daSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
280111ba1daSmrg    echo >&2
281111ba1daSmrg  else
282111ba1daSmrg    cat >&2 <<'END'
283111ba1daSmrgAborting the configuration process, to ensure you take notice of the issue.
2848ff16396Smrg
285111ba1daSmrgYou can download and install GNU coreutils to get an 'rm' implementation
286111ba1daSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
287d5d8cc55Smrg
288111ba1daSmrgIf you want to complete the configuration process using your problematic
289111ba1daSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
290111ba1daSmrgto "yes", and re-run configure.
291111ba1daSmrg
292111ba1daSmrgEND
293111ba1daSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
294111ba1daSmrg  fi
295111ba1daSmrgfi
296111ba1daSmrgdnl The trailing newline in this macro's definition is deliberate, for
297111ba1daSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
298111ba1daSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
2998ff16396Smrg])
3008ff16396Smrg
301111ba1daSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
302111ba1daSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
303111ba1daSmrgdnl mangled by Autoconf and run in a shell conditional statement.
304111ba1daSmrgm4_define([_AC_COMPILER_EXEEXT],
305111ba1daSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
3068ff16396Smrg
307111ba1daSmrg# When config.status generates a header, we must update the stamp-h file.
308111ba1daSmrg# This file resides in the same directory as the config header
309111ba1daSmrg# that is generated.  The stamp files are numbered to have different names.
310d5d8cc55Smrg
311111ba1daSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
312111ba1daSmrg# loop where config.status creates the headers, so we can generate
313111ba1daSmrg# our stamp files there.
314111ba1daSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
315111ba1daSmrg[# Compute $1's index in $config_headers.
316111ba1daSmrg_am_arg=$1
317111ba1daSmrg_am_stamp_count=1
318111ba1daSmrgfor _am_header in $config_headers :; do
319111ba1daSmrg  case $_am_header in
320111ba1daSmrg    $_am_arg | $_am_arg:* )
321111ba1daSmrg      break ;;
322111ba1daSmrg    * )
323111ba1daSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
324111ba1daSmrg  esac
325111ba1daSmrgdone
326111ba1daSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
3278ff16396Smrg
328111ba1daSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
329111ba1daSmrg#
330111ba1daSmrg# This file is free software; the Free Software Foundation
331111ba1daSmrg# gives unlimited permission to copy and/or distribute it,
332111ba1daSmrg# with or without modifications, as long as this notice is preserved.
3338ff16396Smrg
334111ba1daSmrg# AM_PROG_INSTALL_SH
335111ba1daSmrg# ------------------
336111ba1daSmrg# Define $install_sh.
337111ba1daSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
338111ba1daSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
339111ba1daSmrgif test x"${install_sh+set}" != xset; then
340111ba1daSmrg  case $am_aux_dir in
341111ba1daSmrg  *\ * | *\	*)
342111ba1daSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
343111ba1daSmrg  *)
344111ba1daSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
345111ba1daSmrg  esac
346111ba1daSmrgfi
347111ba1daSmrgAC_SUBST([install_sh])])
3488ff16396Smrg
349111ba1daSmrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
3508ff16396Smrg#
351111ba1daSmrg# This file is free software; the Free Software Foundation
352111ba1daSmrg# gives unlimited permission to copy and/or distribute it,
353111ba1daSmrg# with or without modifications, as long as this notice is preserved.
3548ff16396Smrg
355111ba1daSmrg# Check whether the underlying file-system supports filenames
356111ba1daSmrg# with a leading dot.  For instance MS-DOS doesn't.
357111ba1daSmrgAC_DEFUN([AM_SET_LEADING_DOT],
358111ba1daSmrg[rm -rf .tst 2>/dev/null
359111ba1daSmrgmkdir .tst 2>/dev/null
360111ba1daSmrgif test -d .tst; then
361111ba1daSmrg  am__leading_dot=.
362111ba1daSmrgelse
363111ba1daSmrg  am__leading_dot=_
364111ba1daSmrgfi
365111ba1daSmrgrmdir .tst 2>/dev/null
366111ba1daSmrgAC_SUBST([am__leading_dot])])
3678ff16396Smrg
368111ba1daSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
369d5d8cc55Smrg
370111ba1daSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
3718ff16396Smrg#
372111ba1daSmrg# This file is free software; the Free Software Foundation
373111ba1daSmrg# gives unlimited permission to copy and/or distribute it,
374111ba1daSmrg# with or without modifications, as long as this notice is preserved.
3758ff16396Smrg
376111ba1daSmrg# AM_MISSING_PROG(NAME, PROGRAM)
377111ba1daSmrg# ------------------------------
378111ba1daSmrgAC_DEFUN([AM_MISSING_PROG],
379111ba1daSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
380111ba1daSmrg$1=${$1-"${am_missing_run}$2"}
381111ba1daSmrgAC_SUBST($1)])
382111ba1daSmrg
383111ba1daSmrg# AM_MISSING_HAS_RUN
384111ba1daSmrg# ------------------
385111ba1daSmrg# Define MISSING if not defined so far and test if it is modern enough.
386111ba1daSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
387111ba1daSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
388111ba1daSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
389111ba1daSmrgAC_REQUIRE_AUX_FILE([missing])dnl
390111ba1daSmrgif test x"${MISSING+set}" != xset; then
391111ba1daSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
392111ba1daSmrgfi
393111ba1daSmrg# Use eval to expand $SHELL
394111ba1daSmrgif eval "$MISSING --is-lightweight"; then
395111ba1daSmrg  am_missing_run="$MISSING "
396111ba1daSmrgelse
397111ba1daSmrg  am_missing_run=
398111ba1daSmrg  AC_MSG_WARN(['missing' script is too old or missing])
399111ba1daSmrgfi
400111ba1daSmrg])
401111ba1daSmrg
402111ba1daSmrg# Helper functions for option handling.                     -*- Autoconf -*-
4038ff16396Smrg
404111ba1daSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
405d5d8cc55Smrg#
406111ba1daSmrg# This file is free software; the Free Software Foundation
407111ba1daSmrg# gives unlimited permission to copy and/or distribute it,
408111ba1daSmrg# with or without modifications, as long as this notice is preserved.
409111ba1daSmrg
410111ba1daSmrg# _AM_MANGLE_OPTION(NAME)
411111ba1daSmrg# -----------------------
412111ba1daSmrgAC_DEFUN([_AM_MANGLE_OPTION],
413111ba1daSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
414111ba1daSmrg
415111ba1daSmrg# _AM_SET_OPTION(NAME)
416111ba1daSmrg# --------------------
417111ba1daSmrg# Set option NAME.  Presently that only means defining a flag for this option.
418111ba1daSmrgAC_DEFUN([_AM_SET_OPTION],
419111ba1daSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
420111ba1daSmrg
421111ba1daSmrg# _AM_SET_OPTIONS(OPTIONS)
422111ba1daSmrg# ------------------------
423111ba1daSmrg# OPTIONS is a space-separated list of Automake options.
424111ba1daSmrgAC_DEFUN([_AM_SET_OPTIONS],
425111ba1daSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
426111ba1daSmrg
427111ba1daSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
428111ba1daSmrg# -------------------------------------------
429111ba1daSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
430111ba1daSmrgAC_DEFUN([_AM_IF_OPTION],
431111ba1daSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
432111ba1daSmrg
433111ba1daSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
434111ba1daSmrg
435111ba1daSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
436d5d8cc55Smrg#
437111ba1daSmrg# This file is free software; the Free Software Foundation
438111ba1daSmrg# gives unlimited permission to copy and/or distribute it,
439111ba1daSmrg# with or without modifications, as long as this notice is preserved.
440111ba1daSmrg
441111ba1daSmrg# AM_SANITY_CHECK
442111ba1daSmrg# ---------------
443111ba1daSmrgAC_DEFUN([AM_SANITY_CHECK],
444111ba1daSmrg[AC_MSG_CHECKING([whether build environment is sane])
445111ba1daSmrg# Reject unsafe characters in $srcdir or the absolute working directory
446111ba1daSmrg# name.  Accept space and tab only in the latter.
447111ba1daSmrgam_lf='
448111ba1daSmrg'
449111ba1daSmrgcase `pwd` in
450111ba1daSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
451111ba1daSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
452111ba1daSmrgesac
453111ba1daSmrgcase $srcdir in
454111ba1daSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
455111ba1daSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
456111ba1daSmrgesac
457111ba1daSmrg
458111ba1daSmrg# Do 'set' in a subshell so we don't clobber the current shell's
459111ba1daSmrg# arguments.  Must try -L first in case configure is actually a
460111ba1daSmrg# symlink; some systems play weird games with the mod time of symlinks
461111ba1daSmrg# (eg FreeBSD returns the mod time of the symlink's containing
462111ba1daSmrg# directory).
463111ba1daSmrgif (
464111ba1daSmrg   am_has_slept=no
465111ba1daSmrg   for am_try in 1 2; do
466111ba1daSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
467111ba1daSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
468111ba1daSmrg     if test "$[*]" = "X"; then
469111ba1daSmrg	# -L didn't work.
470111ba1daSmrg	set X `ls -t "$srcdir/configure" conftest.file`
471111ba1daSmrg     fi
472111ba1daSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
473111ba1daSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
474111ba1daSmrg
475111ba1daSmrg	# If neither matched, then we have a broken ls.  This can happen
476111ba1daSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
477111ba1daSmrg	# broken ls alias from the environment.  This has actually
478111ba1daSmrg	# happened.  Such a system could not be considered "sane".
479111ba1daSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
480111ba1daSmrg  alias in your environment])
481111ba1daSmrg     fi
482111ba1daSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
483111ba1daSmrg       break
484111ba1daSmrg     fi
485111ba1daSmrg     # Just in case.
486111ba1daSmrg     sleep 1
487111ba1daSmrg     am_has_slept=yes
488111ba1daSmrg   done
489111ba1daSmrg   test "$[2]" = conftest.file
490111ba1daSmrg   )
491111ba1daSmrgthen
492111ba1daSmrg   # Ok.
493111ba1daSmrg   :
494111ba1daSmrgelse
495111ba1daSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
496111ba1daSmrgCheck your system clock])
497111ba1daSmrgfi
498111ba1daSmrgAC_MSG_RESULT([yes])
499111ba1daSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
500111ba1daSmrg# generated files are strictly newer.
501111ba1daSmrgam_sleep_pid=
502111ba1daSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
503111ba1daSmrg  ( sleep 1 ) &
504111ba1daSmrg  am_sleep_pid=$!
505111ba1daSmrgfi
506111ba1daSmrgAC_CONFIG_COMMANDS_PRE(
507111ba1daSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
508111ba1daSmrg   if test -n "$am_sleep_pid"; then
509111ba1daSmrg     # Hide warnings about reused PIDs.
510111ba1daSmrg     wait $am_sleep_pid 2>/dev/null
511111ba1daSmrg   fi
512111ba1daSmrg   AC_MSG_RESULT([done])])
513111ba1daSmrgrm -f conftest.file
514111ba1daSmrg])
515111ba1daSmrg
516111ba1daSmrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
517d5d8cc55Smrg#
518111ba1daSmrg# This file is free software; the Free Software Foundation
519111ba1daSmrg# gives unlimited permission to copy and/or distribute it,
520111ba1daSmrg# with or without modifications, as long as this notice is preserved.
521111ba1daSmrg
522111ba1daSmrg# AM_SILENT_RULES([DEFAULT])
523111ba1daSmrg# --------------------------
524111ba1daSmrg# Enable less verbose build rules; with the default set to DEFAULT
525111ba1daSmrg# ("yes" being less verbose, "no" or empty being verbose).
526111ba1daSmrgAC_DEFUN([AM_SILENT_RULES],
527111ba1daSmrg[AC_ARG_ENABLE([silent-rules], [dnl
528111ba1daSmrgAS_HELP_STRING(
529111ba1daSmrg  [--enable-silent-rules],
530111ba1daSmrg  [less verbose build output (undo: "make V=1")])
531111ba1daSmrgAS_HELP_STRING(
532111ba1daSmrg  [--disable-silent-rules],
533111ba1daSmrg  [verbose build output (undo: "make V=0")])dnl
534111ba1daSmrg])
535111ba1daSmrgcase $enable_silent_rules in @%:@ (((
536111ba1daSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
537111ba1daSmrg   no) AM_DEFAULT_VERBOSITY=1;;
538111ba1daSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
539111ba1daSmrgesac
540111ba1daSmrgdnl
541111ba1daSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
542111ba1daSmrgdnl do not support nested variable expansions.
543111ba1daSmrgdnl See automake bug#9928 and bug#10237.
544111ba1daSmrgam_make=${MAKE-make}
545111ba1daSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
546111ba1daSmrg   [am_cv_make_support_nested_variables],
547111ba1daSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
548111ba1daSmrgBAR0=false
549111ba1daSmrgBAR1=true
550111ba1daSmrgV=1
551111ba1daSmrgam__doit:
552111ba1daSmrg	@$(TRUE)
553111ba1daSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
554111ba1daSmrg  am_cv_make_support_nested_variables=yes
555111ba1daSmrgelse
556111ba1daSmrg  am_cv_make_support_nested_variables=no
557111ba1daSmrgfi])
558111ba1daSmrgif test $am_cv_make_support_nested_variables = yes; then
559111ba1daSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
560111ba1daSmrg  AM_V='$(V)'
561111ba1daSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
562111ba1daSmrgelse
563111ba1daSmrg  AM_V=$AM_DEFAULT_VERBOSITY
564111ba1daSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
565111ba1daSmrgfi
566111ba1daSmrgAC_SUBST([AM_V])dnl
567111ba1daSmrgAM_SUBST_NOTMAKE([AM_V])dnl
568111ba1daSmrgAC_SUBST([AM_DEFAULT_V])dnl
569111ba1daSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
570111ba1daSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
571111ba1daSmrgAM_BACKSLASH='\'
572111ba1daSmrgAC_SUBST([AM_BACKSLASH])dnl
573111ba1daSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
574111ba1daSmrg])
575111ba1daSmrg
576111ba1daSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
577d5d8cc55Smrg#
578111ba1daSmrg# This file is free software; the Free Software Foundation
579111ba1daSmrg# gives unlimited permission to copy and/or distribute it,
580111ba1daSmrg# with or without modifications, as long as this notice is preserved.
5818ff16396Smrg
582111ba1daSmrg# AM_PROG_INSTALL_STRIP
583111ba1daSmrg# ---------------------
584111ba1daSmrg# One issue with vendor 'install' (even GNU) is that you can't
585111ba1daSmrg# specify the program used to strip binaries.  This is especially
586111ba1daSmrg# annoying in cross-compiling environments, where the build's strip
587111ba1daSmrg# is unlikely to handle the host's binaries.
588111ba1daSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
589111ba1daSmrg# always use install-sh in "make install-strip", and initialize
590111ba1daSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
591111ba1daSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
592111ba1daSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
593111ba1daSmrg# Installed binaries are usually stripped using 'strip' when the user
594111ba1daSmrg# run "make install-strip".  However 'strip' might not be the right
595111ba1daSmrg# tool to use in cross-compilation environments, therefore Automake
596111ba1daSmrg# will honor the 'STRIP' environment variable to overrule this program.
597111ba1daSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
598111ba1daSmrgif test "$cross_compiling" != no; then
599111ba1daSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
600111ba1daSmrgfi
601111ba1daSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
602111ba1daSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
603111ba1daSmrg
604111ba1daSmrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
605111ba1daSmrg#
606111ba1daSmrg# This file is free software; the Free Software Foundation
607111ba1daSmrg# gives unlimited permission to copy and/or distribute it,
608111ba1daSmrg# with or without modifications, as long as this notice is preserved.
609111ba1daSmrg
610111ba1daSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
611111ba1daSmrg# ---------------------------
612111ba1daSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
613111ba1daSmrg# This macro is traced by Automake.
614111ba1daSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
615111ba1daSmrg
616111ba1daSmrg# AM_SUBST_NOTMAKE(VARIABLE)
617111ba1daSmrg# --------------------------
618111ba1daSmrg# Public sister of _AM_SUBST_NOTMAKE.
619111ba1daSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
620111ba1daSmrg
621111ba1daSmrg# Check how to create a tarball.                            -*- Autoconf -*-
622111ba1daSmrg
623111ba1daSmrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
624111ba1daSmrg#
625111ba1daSmrg# This file is free software; the Free Software Foundation
626111ba1daSmrg# gives unlimited permission to copy and/or distribute it,
627111ba1daSmrg# with or without modifications, as long as this notice is preserved.
628111ba1daSmrg
629111ba1daSmrg# _AM_PROG_TAR(FORMAT)
630111ba1daSmrg# --------------------
631111ba1daSmrg# Check how to create a tarball in format FORMAT.
632111ba1daSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
633111ba1daSmrg#
634111ba1daSmrg# Substitute a variable $(am__tar) that is a command
635111ba1daSmrg# writing to stdout a FORMAT-tarball containing the directory
636111ba1daSmrg# $tardir.
637111ba1daSmrg#     tardir=directory && $(am__tar) > result.tar
638111ba1daSmrg#
639111ba1daSmrg# Substitute a variable $(am__untar) that extract such
640111ba1daSmrg# a tarball read from stdin.
641111ba1daSmrg#     $(am__untar) < result.tar
642111ba1daSmrg#
643111ba1daSmrgAC_DEFUN([_AM_PROG_TAR],
644111ba1daSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
645111ba1daSmrg# in the wild :-(  We should find a proper way to deprecate it ...
646111ba1daSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
647111ba1daSmrg
648111ba1daSmrg# We'll loop over all known methods to create a tar archive until one works.
649111ba1daSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
650111ba1daSmrg
651111ba1daSmrgm4_if([$1], [v7],
652111ba1daSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
653111ba1daSmrg
654111ba1daSmrg  [m4_case([$1],
655111ba1daSmrg    [ustar],
656111ba1daSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
657111ba1daSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
658111ba1daSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
659111ba1daSmrg      # and bug#13588).
660111ba1daSmrg      am_max_uid=2097151 # 2^21 - 1
661111ba1daSmrg      am_max_gid=$am_max_uid
662111ba1daSmrg      # The $UID and $GID variables are not portable, so we need to resort
663111ba1daSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
664111ba1daSmrg      # below are definitely unexpected, so allow the users to see them
665111ba1daSmrg      # (that is, avoid stderr redirection).
666111ba1daSmrg      am_uid=`id -u || echo unknown`
667111ba1daSmrg      am_gid=`id -g || echo unknown`
668111ba1daSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
669111ba1daSmrg      if test $am_uid -le $am_max_uid; then
670111ba1daSmrg         AC_MSG_RESULT([yes])
671111ba1daSmrg      else
672111ba1daSmrg         AC_MSG_RESULT([no])
673111ba1daSmrg         _am_tools=none
674111ba1daSmrg      fi
675111ba1daSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
676111ba1daSmrg      if test $am_gid -le $am_max_gid; then
677111ba1daSmrg         AC_MSG_RESULT([yes])
678111ba1daSmrg      else
679111ba1daSmrg        AC_MSG_RESULT([no])
680111ba1daSmrg        _am_tools=none
681111ba1daSmrg      fi],
682111ba1daSmrg
683111ba1daSmrg  [pax],
684111ba1daSmrg    [],
685111ba1daSmrg
686111ba1daSmrg  [m4_fatal([Unknown tar format])])
687111ba1daSmrg
688111ba1daSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
689111ba1daSmrg
690111ba1daSmrg  # Go ahead even if we have the value already cached.  We do so because we
691111ba1daSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
692111ba1daSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
693111ba1daSmrg
694111ba1daSmrg  for _am_tool in $_am_tools; do
695111ba1daSmrg    case $_am_tool in
696111ba1daSmrg    gnutar)
697111ba1daSmrg      for _am_tar in tar gnutar gtar; do
698111ba1daSmrg        AM_RUN_LOG([$_am_tar --version]) && break
699111ba1daSmrg      done
700111ba1daSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
701111ba1daSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
702111ba1daSmrg      am__untar="$_am_tar -xf -"
703111ba1daSmrg      ;;
704111ba1daSmrg    plaintar)
705111ba1daSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
706111ba1daSmrg      # ustar tarball either.
707111ba1daSmrg      (tar --version) >/dev/null 2>&1 && continue
708111ba1daSmrg      am__tar='tar chf - "$$tardir"'
709111ba1daSmrg      am__tar_='tar chf - "$tardir"'
710111ba1daSmrg      am__untar='tar xf -'
711111ba1daSmrg      ;;
712111ba1daSmrg    pax)
713111ba1daSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
714111ba1daSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
715111ba1daSmrg      am__untar='pax -r'
716111ba1daSmrg      ;;
717111ba1daSmrg    cpio)
718111ba1daSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
719111ba1daSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
720111ba1daSmrg      am__untar='cpio -i -H $1 -d'
721111ba1daSmrg      ;;
722111ba1daSmrg    none)
723111ba1daSmrg      am__tar=false
724111ba1daSmrg      am__tar_=false
725111ba1daSmrg      am__untar=false
726111ba1daSmrg      ;;
727111ba1daSmrg    esac
728111ba1daSmrg
729111ba1daSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
730111ba1daSmrg    # and am__untar set.
731111ba1daSmrg    test -n "${am_cv_prog_tar_$1}" && break
732111ba1daSmrg
733111ba1daSmrg    # tar/untar a dummy directory, and stop if the command works.
734111ba1daSmrg    rm -rf conftest.dir
735111ba1daSmrg    mkdir conftest.dir
736111ba1daSmrg    echo GrepMe > conftest.dir/file
737111ba1daSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
738111ba1daSmrg    rm -rf conftest.dir
739111ba1daSmrg    if test -s conftest.tar; then
740111ba1daSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
741111ba1daSmrg      AM_RUN_LOG([cat conftest.dir/file])
742111ba1daSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
743111ba1daSmrg    fi
744111ba1daSmrg  done
745111ba1daSmrg  rm -rf conftest.dir
746111ba1daSmrg
747111ba1daSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
748111ba1daSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
749111ba1daSmrg
750111ba1daSmrgAC_SUBST([am__tar])
751111ba1daSmrgAC_SUBST([am__untar])
752111ba1daSmrg]) # _AM_PROG_TAR
753111ba1daSmrg
754111ba1daSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
755111ba1daSmrgdnl serial 11 (pkg-config-0.29)
756111ba1daSmrgdnl
757111ba1daSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
758111ba1daSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
759111ba1daSmrgdnl
760111ba1daSmrgdnl This program is free software; you can redistribute it and/or modify
761111ba1daSmrgdnl it under the terms of the GNU General Public License as published by
762111ba1daSmrgdnl the Free Software Foundation; either version 2 of the License, or
763111ba1daSmrgdnl (at your option) any later version.
764111ba1daSmrgdnl
765111ba1daSmrgdnl This program is distributed in the hope that it will be useful, but
766111ba1daSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
767111ba1daSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
768111ba1daSmrgdnl General Public License for more details.
769111ba1daSmrgdnl
770111ba1daSmrgdnl You should have received a copy of the GNU General Public License
771111ba1daSmrgdnl along with this program; if not, write to the Free Software
772111ba1daSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
773111ba1daSmrgdnl 02111-1307, USA.
774111ba1daSmrgdnl
775111ba1daSmrgdnl As a special exception to the GNU General Public License, if you
776111ba1daSmrgdnl distribute this file as part of a program that contains a
777111ba1daSmrgdnl configuration script generated by Autoconf, you may include it under
778111ba1daSmrgdnl the same distribution terms that you use for the rest of that
779111ba1daSmrgdnl program.
780111ba1daSmrg
781111ba1daSmrgdnl PKG_PREREQ(MIN-VERSION)
782111ba1daSmrgdnl -----------------------
783111ba1daSmrgdnl Since: 0.29
784111ba1daSmrgdnl
785111ba1daSmrgdnl Verify that the version of the pkg-config macros are at least
786111ba1daSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
787111ba1daSmrgdnl installed version of pkg-config, this checks the developer's version
788111ba1daSmrgdnl of pkg.m4 when generating configure.
789111ba1daSmrgdnl
790111ba1daSmrgdnl To ensure that this macro is defined, also add:
791111ba1daSmrgdnl m4_ifndef([PKG_PREREQ],
792111ba1daSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
793111ba1daSmrgdnl
794111ba1daSmrgdnl See the "Since" comment for each macro you use to see what version
795111ba1daSmrgdnl of the macros you require.
796111ba1daSmrgm4_defun([PKG_PREREQ],
797111ba1daSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
798111ba1daSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
799111ba1daSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
800111ba1daSmrg])dnl PKG_PREREQ
801111ba1daSmrg
802111ba1daSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
803111ba1daSmrgdnl ----------------------------------
804111ba1daSmrgdnl Since: 0.16
805111ba1daSmrgdnl
806111ba1daSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
807111ba1daSmrgdnl first found in the path. Checks that the version of pkg-config found
808111ba1daSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
809111ba1daSmrgdnl used since that's the first version where most current features of
810111ba1daSmrgdnl pkg-config existed.
811d5d8cc55SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
812d5d8cc55Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
813111ba1daSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
814111ba1daSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
815d5d8cc55SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
816d5d8cc55SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
817d5d8cc55SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
8188ff16396Smrg
819d5d8cc55Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
820d5d8cc55Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
8218ff16396Smrgfi
822d5d8cc55Smrgif test -n "$PKG_CONFIG"; then
823d5d8cc55Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
824d5d8cc55Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
825d5d8cc55Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
826d5d8cc55Smrg		AC_MSG_RESULT([yes])
827d5d8cc55Smrg	else
828d5d8cc55Smrg		AC_MSG_RESULT([no])
829d5d8cc55Smrg		PKG_CONFIG=""
830d5d8cc55Smrg	fi
831d5d8cc55Smrgfi[]dnl
832111ba1daSmrg])dnl PKG_PROG_PKG_CONFIG
8338ff16396Smrg
834111ba1daSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
835111ba1daSmrgdnl -------------------------------------------------------------------
836111ba1daSmrgdnl Since: 0.18
837111ba1daSmrgdnl
838111ba1daSmrgdnl Check to see whether a particular set of modules exists. Similar to
839111ba1daSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
840111ba1daSmrgdnl
841111ba1daSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
842111ba1daSmrgdnl only at the first occurence in configure.ac, so if the first place
843111ba1daSmrgdnl it's called might be skipped (such as if it is within an "if", you
844111ba1daSmrgdnl have to call PKG_CHECK_EXISTS manually
845d5d8cc55SmrgAC_DEFUN([PKG_CHECK_EXISTS],
846d5d8cc55Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
847d5d8cc55Smrgif test -n "$PKG_CONFIG" && \
848d5d8cc55Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
849d5d8cc55Smrg  m4_default([$2], [:])
850d5d8cc55Smrgm4_ifvaln([$3], [else
851d5d8cc55Smrg  $3])dnl
852d5d8cc55Smrgfi])
8538ff16396Smrg
854111ba1daSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
855111ba1daSmrgdnl ---------------------------------------------
856111ba1daSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
857111ba1daSmrgdnl pkg_failed based on the result.
858d5d8cc55Smrgm4_define([_PKG_CONFIG],
859d5d8cc55Smrg[if test -n "$$1"; then
860d5d8cc55Smrg    pkg_cv_[]$1="$$1"
861d5d8cc55Smrg elif test -n "$PKG_CONFIG"; then
862d5d8cc55Smrg    PKG_CHECK_EXISTS([$3],
863111ba1daSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
864111ba1daSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
865d5d8cc55Smrg		     [pkg_failed=yes])
866d5d8cc55Smrg else
867d5d8cc55Smrg    pkg_failed=untried
868d5d8cc55Smrgfi[]dnl
869111ba1daSmrg])dnl _PKG_CONFIG
8708ff16396Smrg
871111ba1daSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
872111ba1daSmrgdnl ---------------------------
873111ba1daSmrgdnl Internal check to see if pkg-config supports short errors.
874d5d8cc55SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
875d5d8cc55Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
876d5d8cc55Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
877d5d8cc55Smrg        _pkg_short_errors_supported=yes
878d5d8cc55Smrgelse
879d5d8cc55Smrg        _pkg_short_errors_supported=no
880d5d8cc55Smrgfi[]dnl
881111ba1daSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
8828ff16396Smrg
8838ff16396Smrg
884111ba1daSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
885111ba1daSmrgdnl   [ACTION-IF-NOT-FOUND])
886111ba1daSmrgdnl --------------------------------------------------------------
887111ba1daSmrgdnl Since: 0.4.0
888111ba1daSmrgdnl
889111ba1daSmrgdnl Note that if there is a possibility the first call to
890111ba1daSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
891111ba1daSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
892d5d8cc55SmrgAC_DEFUN([PKG_CHECK_MODULES],
893d5d8cc55Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
894d5d8cc55SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
895d5d8cc55SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
8968ff16396Smrg
897d5d8cc55Smrgpkg_failed=no
898d5d8cc55SmrgAC_MSG_CHECKING([for $1])
899d5d8cc55Smrg
900d5d8cc55Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
901d5d8cc55Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
902d5d8cc55Smrg
903d5d8cc55Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
904d5d8cc55Smrgand $1[]_LIBS to avoid the need to call pkg-config.
905d5d8cc55SmrgSee the pkg-config man page for more details.])
906d5d8cc55Smrg
907d5d8cc55Smrgif test $pkg_failed = yes; then
908d5d8cc55Smrg   	AC_MSG_RESULT([no])
909d5d8cc55Smrg        _PKG_SHORT_ERRORS_SUPPORTED
910d5d8cc55Smrg        if test $_pkg_short_errors_supported = yes; then
911111ba1daSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
912d5d8cc55Smrg        else 
913111ba1daSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
914d5d8cc55Smrg        fi
915d5d8cc55Smrg	# Put the nasty error message in config.log where it belongs
916d5d8cc55Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
917d5d8cc55Smrg
918d5d8cc55Smrg	m4_default([$4], [AC_MSG_ERROR(
919d5d8cc55Smrg[Package requirements ($2) were not met:
920d5d8cc55Smrg
921d5d8cc55Smrg$$1_PKG_ERRORS
922d5d8cc55Smrg
923d5d8cc55SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
924d5d8cc55Smrginstalled software in a non-standard prefix.
925d5d8cc55Smrg
926d5d8cc55Smrg_PKG_TEXT])[]dnl
927d5d8cc55Smrg        ])
928d5d8cc55Smrgelif test $pkg_failed = untried; then
929d5d8cc55Smrg     	AC_MSG_RESULT([no])
930d5d8cc55Smrg	m4_default([$4], [AC_MSG_FAILURE(
931d5d8cc55Smrg[The pkg-config script could not be found or is too old.  Make sure it
932d5d8cc55Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
933d5d8cc55Smrgpath to pkg-config.
934d5d8cc55Smrg
935d5d8cc55Smrg_PKG_TEXT
936d5d8cc55Smrg
937111ba1daSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
938d5d8cc55Smrg        ])
939d5d8cc55Smrgelse
940d5d8cc55Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
941d5d8cc55Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
942d5d8cc55Smrg        AC_MSG_RESULT([yes])
943d5d8cc55Smrg	$3
944d5d8cc55Smrgfi[]dnl
945111ba1daSmrg])dnl PKG_CHECK_MODULES
9468ff16396Smrg
947111ba1daSmrg
948111ba1daSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
949111ba1daSmrgdnl   [ACTION-IF-NOT-FOUND])
950111ba1daSmrgdnl ---------------------------------------------------------------------
951111ba1daSmrgdnl Since: 0.29
952111ba1daSmrgdnl
953111ba1daSmrgdnl Checks for existence of MODULES and gathers its build flags with
954111ba1daSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
955111ba1daSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
956111ba1daSmrgdnl
957111ba1daSmrgdnl Note that if there is a possibility the first call to
958111ba1daSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
959111ba1daSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
960111ba1daSmrgdnl configure.ac.
961111ba1daSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
962111ba1daSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
963111ba1daSmrg_save_PKG_CONFIG=$PKG_CONFIG
964111ba1daSmrgPKG_CONFIG="$PKG_CONFIG --static"
965111ba1daSmrgPKG_CHECK_MODULES($@)
966111ba1daSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
967111ba1daSmrg])dnl PKG_CHECK_MODULES_STATIC
968111ba1daSmrg
969111ba1daSmrg
970111ba1daSmrgdnl PKG_INSTALLDIR([DIRECTORY])
971111ba1daSmrgdnl -------------------------
972111ba1daSmrgdnl Since: 0.27
973111ba1daSmrgdnl
974111ba1daSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
975111ba1daSmrgdnl should install pkg-config .pc files. By default the directory is
976111ba1daSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
977111ba1daSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
978111ba1daSmrgdnl parameter.
979111ba1daSmrgAC_DEFUN([PKG_INSTALLDIR],
980111ba1daSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
981111ba1daSmrgm4_pushdef([pkg_description],
982111ba1daSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
983111ba1daSmrgAC_ARG_WITH([pkgconfigdir],
984111ba1daSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
985111ba1daSmrg    [with_pkgconfigdir=]pkg_default)
986111ba1daSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
987111ba1daSmrgm4_popdef([pkg_default])
988111ba1daSmrgm4_popdef([pkg_description])
989111ba1daSmrg])dnl PKG_INSTALLDIR
990111ba1daSmrg
991111ba1daSmrg
992111ba1daSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
993111ba1daSmrgdnl --------------------------------
994111ba1daSmrgdnl Since: 0.27
995111ba1daSmrgdnl
996111ba1daSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
997111ba1daSmrgdnl module should install arch-independent pkg-config .pc files. By
998111ba1daSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
999111ba1daSmrgdnl changed by passing DIRECTORY. The user can override through the
1000111ba1daSmrgdnl --with-noarch-pkgconfigdir parameter.
1001111ba1daSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1002111ba1daSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1003111ba1daSmrgm4_pushdef([pkg_description],
1004111ba1daSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1005111ba1daSmrgAC_ARG_WITH([noarch-pkgconfigdir],
1006111ba1daSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1007111ba1daSmrg    [with_noarch_pkgconfigdir=]pkg_default)
1008111ba1daSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1009111ba1daSmrgm4_popdef([pkg_default])
1010111ba1daSmrgm4_popdef([pkg_description])
1011111ba1daSmrg])dnl PKG_NOARCH_INSTALLDIR
1012111ba1daSmrg
1013111ba1daSmrg
1014111ba1daSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1015111ba1daSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1016111ba1daSmrgdnl -------------------------------------------
1017111ba1daSmrgdnl Since: 0.28
1018111ba1daSmrgdnl
1019111ba1daSmrgdnl Retrieves the value of the pkg-config variable for the given module.
1020111ba1daSmrgAC_DEFUN([PKG_CHECK_VAR],
1021111ba1daSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1022111ba1daSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1023111ba1daSmrg
1024111ba1daSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1025111ba1daSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1026111ba1daSmrg
1027111ba1daSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1028111ba1daSmrg])dnl PKG_CHECK_VAR
1029111ba1daSmrg
1030111ba1daSmrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
1031111ba1daSmrgdnl
1032111ba1daSmrgdnl This file comes from X.Org's font-util 1.4.0
1033111ba1daSmrgdnl
1034111ba1daSmrgdnl Copyright (c) 2009, 2023, Oracle and/or its affiliates.
1035d5d8cc55Smrgdnl
1036d5d8cc55Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1037d5d8cc55Smrgdnl copy of this software and associated documentation files (the "Software"),
1038d5d8cc55Smrgdnl to deal in the Software without restriction, including without limitation
1039d5d8cc55Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1040d5d8cc55Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1041d5d8cc55Smrgdnl Software is furnished to do so, subject to the following conditions:
1042d5d8cc55Smrgdnl
1043d5d8cc55Smrgdnl The above copyright notice and this permission notice (including the next
1044d5d8cc55Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1045d5d8cc55Smrgdnl Software.
1046d5d8cc55Smrgdnl
1047d5d8cc55Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1048d5d8cc55Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1049d5d8cc55Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1050d5d8cc55Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1051d5d8cc55Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1052d5d8cc55Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1053d5d8cc55Smrgdnl DEALINGS IN THE SOFTWARE.
1054111ba1daSmrgdnl
1055111ba1daSmrgdnl --------------------------------------------------------------------
1056111ba1daSmrgdnl
1057111ba1daSmrgdnl Copyright 2005 Red Hat, Inc
1058111ba1daSmrgdnl
1059111ba1daSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
1060111ba1daSmrgdnl documentation for any purpose is hereby granted without fee, provided that
1061111ba1daSmrgdnl the above copyright notice appear in all copies and that both that
1062111ba1daSmrgdnl copyright notice and this permission notice appear in supporting
1063111ba1daSmrgdnl documentation.
1064111ba1daSmrgdnl
1065111ba1daSmrgdnl The above copyright notice and this permission notice shall be included
1066111ba1daSmrgdnl in all copies or substantial portions of the Software.
1067111ba1daSmrgdnl
1068111ba1daSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1069111ba1daSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1070111ba1daSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1071111ba1daSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
1072111ba1daSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1073111ba1daSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1074111ba1daSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
1075111ba1daSmrgdnl
1076111ba1daSmrgdnl Except as contained in this notice, the name of the copyright holders shall
1077111ba1daSmrgdnl not be used in advertising or otherwise to promote the sale, use or
1078111ba1daSmrgdnl other dealings in this Software without prior written authorization
1079111ba1daSmrgdnl from the copyright holders.
10808ff16396Smrg
1081111ba1daSmrg# XORG_FONT_MACROS_VERSION(required-version)
1082111ba1daSmrg# ------------------------------------------
1083d5d8cc55Smrg# Minimum version: 1.1.0
10848ff16396Smrg#
1085d5d8cc55Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1086d5d8cc55Smrg# your configure.ac with the minimum required version, such as:
1087111ba1daSmrg# XORG_FONT_MACROS_VERSION(1.1)
1088d5d8cc55Smrg#
1089d5d8cc55Smrg# To ensure that this macro is defined, also add:
1090111ba1daSmrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
1091111ba1daSmrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
1092d5d8cc55Smrg#
1093d5d8cc55Smrg#
1094111ba1daSmrg# See the "minimum version" comment for each macro you use to see what
1095d5d8cc55Smrg# version you require.
1096111ba1daSmrgm4_defun([XORG_FONT_MACROS_VERSION],[
1097111ba1daSmrgm4_define([vers_have], [1.4.0])
1098d5d8cc55Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1099d5d8cc55Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1100d5d8cc55Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1101111ba1daSmrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
1102d5d8cc55Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1103111ba1daSmrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
1104d5d8cc55Smrgm4_undefine([vers_have])
1105d5d8cc55Smrgm4_undefine([maj_have])
1106d5d8cc55Smrgm4_undefine([maj_needed])
1107111ba1daSmrg]) # XORG_FONT_MACROS_VERSION
11088ff16396Smrg
1109111ba1daSmrg# XORG_FONT_CHECK_{maps}()
1110111ba1daSmrg# ------------------------
1111d5d8cc55Smrg# Minimum version: 1.0.0
1112111ba1daSmrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
1113111ba1daSmrg# JISX0201 or KOI8_R.  By default, they are all enabled.
11148ff16396Smrg
1115111ba1daSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
1116111ba1daSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
1117111ba1daSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
1118111ba1daSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
1119111ba1daSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
1120111ba1daSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
1121111ba1daSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
1122111ba1daSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
1123111ba1daSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
1124111ba1daSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
1125111ba1daSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
1126111ba1daSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
1127111ba1daSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
1128111ba1daSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
1129111ba1daSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
1130111ba1daSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
1131111ba1daSmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
1132111ba1daSmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
11338ff16396Smrg
1134111ba1daSmrg# XORG_FONT_CHECK_ENCODING(encoding)
1135111ba1daSmrg# ----------------------------------
1136111ba1daSmrg# Minimum version: 1.1.0
1137111ba1daSmrg# This macro adds --enable/disable-<encoding>, enabled by default.
1138111ba1daSmrg# It replaced individual copies of this code in the above macros in 1.1.
1139111ba1daSmrg# Currently assumes encoding names will be all upper-case - add m4_toupper
1140111ba1daSmrg# calls if this is not true in the future.
11418ff16396Smrg
1142111ba1daSmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
1143111ba1daSmrg	AC_ARG_ENABLE(m4_tolower($1),
1144111ba1daSmrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
1145111ba1daSmrg				[Build $1 fonts (default: yes)]),
1146111ba1daSmrg		[AS_TR_SH($1)=$enableval])
1147111ba1daSmrg	AC_MSG_CHECKING([whether to build $1 fonts])
1148111ba1daSmrg	AC_MSG_RESULT($[AS_TR_SH($1)])
1149111ba1daSmrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
1150111ba1daSmrg]) # XORG_FONT_CHECK_ENCODING
11518ff16396Smrg
1152111ba1daSmrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
1153111ba1daSmrg# -----------------------------------------------------
1154111ba1daSmrg# Minimum version: 1.1.0
1155111ba1daSmrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
1156111ba1daSmrg# Add a shorthand --enable/disable-all-encodings option.
11578ff16396Smrg
1158111ba1daSmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
1159111ba1daSmrg	AC_ARG_ENABLE([all-encodings],
1160111ba1daSmrg		AS_HELP_STRING([--disable-all-encodings],
1161111ba1daSmrg				[Disable building of all font encodings]),
1162111ba1daSmrg		[m4_foreach_w([enc], [$1], [
1163111ba1daSmrg			AS_TR_SH(enc)=$enableval
1164111ba1daSmrg		])],
1165111ba1daSmrg		[m4_foreach_w([enc], [$1], [
1166111ba1daSmrg			AS_TR_SH(enc)=yes
1167111ba1daSmrg		])])
1168111ba1daSmrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
1169111ba1daSmrg]) # XORG_FONT_CHECK_ENCODING_LIST
11708ff16396Smrg
1171111ba1daSmrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
1172111ba1daSmrg# ------------------------------------------
1173111ba1daSmrg# Minimum version: 1.1.0
1174111ba1daSmrg#
1175111ba1daSmrg# Simple wrapper around AC_PATH_PROG that errors if not found
1176111ba1daSmrg#
11778ff16396Smrg
1178111ba1daSmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
1179111ba1daSmrg	AC_PATH_PROG($1, $2)
1180111ba1daSmrg	if test x"$$1" = x; then
1181111ba1daSmrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
1182111ba1daSmrg	fi
1183111ba1daSmrg])
11848ff16396Smrg
11858ff16396Smrg
1186111ba1daSmrg# XORG_FONT_FCCACHE()
1187111ba1daSmrg# -------------------
1188111ba1daSmrg# Minimum version: 1.1.0
1189111ba1daSmrg#
1190111ba1daSmrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
1191111ba1daSmrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
1192111ba1daSmrg# to run fc-cache if found and not installing to $DESTDIR and not
1193111ba1daSmrg# cross-compiling
1194111ba1daSmrg#
1195111ba1daSmrg# fc-cache is optional, not required, and should be skipped when making
1196111ba1daSmrg# packages (installing to $DESTDIR) or cross-compiling
1197111ba1daSmrg#
1198111ba1daSmrgAC_DEFUN([XORG_FONT_FCCACHE],[
1199111ba1daSmrg	AC_PATH_PROG(FCCACHE, fc-cache)
1200111ba1daSmrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
1201111ba1daSmrg	if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then
1202111ba1daSmrg		RUN_FCCACHE="${FCCACHE_WARN}"
1203111ba1daSmrg	else
1204111ba1daSmrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
1205111ba1daSmrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
1206111ba1daSmrg	fi
1207111ba1daSmrg	AC_SUBST([RUN_FCCACHE])
1208111ba1daSmrg])
12098ff16396Smrg
1210111ba1daSmrg# XORG_FONT_MKFONTDIR()
1211111ba1daSmrg# -------------------
1212111ba1daSmrg# Minimum version: 1.3.0
1213111ba1daSmrg#
1214111ba1daSmrg# Set MKFONTDIR to path to mkfontdir.
1215111ba1daSmrg#
1216111ba1daSmrg# If cross-compiling, and if mkdir is not found, use a shell command
1217111ba1daSmrg# which warns mkfontdir needs to be run on the target
1218111ba1daSmrg#
1219111ba1daSmrg# If not cross-compiling, mkfontdir must be found
1220111ba1daSmrg#
1221111ba1daSmrgAC_DEFUN([XORG_FONT_MKFONTDIR],[
1222111ba1daSmrg	if test x"$cross_compiling" != x"no" ; then
1223111ba1daSmrg		AC_PATH_PROG(MKFONTDIR, mkfontdir, "")
1224111ba1daSmrg		MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run mkfontdir manually on host system"'
12258ff16396Smrg
1226111ba1daSmrg		if test x"$MKFONTDIR" = x; then
1227111ba1daSmrg			MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'"
1228111ba1daSmrg		fi
1229111ba1daSmrg	else
1230111ba1daSmrg		XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
1231111ba1daSmrg	fi
12328ff16396Smrg
1233111ba1daSmrg	AC_SUBST([MKFONTDIR])
1234111ba1daSmrg])
12358ff16396Smrg
1236111ba1daSmrg# XORG_FONT_COMMON_UTILS()
1237111ba1daSmrg# ------------------------
1238111ba1daSmrg# Minimum version: 1.1.0
1239111ba1daSmrg#
1240111ba1daSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
12418ff16396Smrg
1242111ba1daSmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
1243111ba1daSmrg	XORG_FONT_FCCACHE
1244111ba1daSmrg	XORG_FONT_MKFONTDIR
1245111ba1daSmrg])
12468ff16396Smrg
1247111ba1daSmrg# XORG_FONT_SCALED_UTILS()
1248d5d8cc55Smrg# ------------------------
1249111ba1daSmrg# Minimum version: 1.1.0
1250d5d8cc55Smrg#
1251111ba1daSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
1252111ba1daSmrg# (TrueType, OpenType, Type1)
1253d5d8cc55Smrg
1254111ba1daSmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
1255111ba1daSmrg	XORG_FONT_COMMON_UTILS
1256111ba1daSmrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
1257111ba1daSmrg])
1258d5d8cc55Smrg
1259111ba1daSmrg# XORG_FONT_BDF_UTILS()
1260111ba1daSmrg# ---------------------
1261111ba1daSmrg# Minimum version: 1.1.0
12628ff16396Smrg#
1263111ba1daSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
1264111ba1daSmrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
1265111ba1daSmrg# PCF output files created by bdftopcf
12668ff16396Smrg
1267111ba1daSmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
1268111ba1daSmrg	XORG_FONT_COMMON_UTILS
1269111ba1daSmrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
1270111ba1daSmrg	XORG_FONT_CHECK_COMPRESSION
1271111ba1daSmrg])
12728ff16396Smrg
1273111ba1daSmrg# XORG_FONT_CHECK_COMPRESSION()
1274111ba1daSmrg# -----------------------------
1275111ba1daSmrg# Minimum version: 1.1.0
1276111ba1daSmrg#
1277111ba1daSmrg# Offer a --with-compression flag to control what compression method is
1278111ba1daSmrg# used for pcf font files.   Offers all the methods currently supported
1279111ba1daSmrg# by libXfont, including no compression.
1280111ba1daSmrg#
1281111ba1daSmrg# If COMPRESS_FLAGS is not set, and the compression method has flags needed
1282111ba1daSmrg# for reproducible builds, such as gzip -n to not record timestamp, will
1283111ba1daSmrg# set COMPRESS_FLAGS to those options.
12848ff16396Smrg
1285111ba1daSmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
1286111ba1daSmrg	AC_MSG_CHECKING([font compression method])
1287111ba1daSmrg	AC_ARG_WITH(compression,
1288111ba1daSmrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
1289111ba1daSmrg			 [compression method to use on pcf fonts])],
1290111ba1daSmrg         [compression="$withval"], [compression="yes"])
1291111ba1daSmrg	if test x"$compression" = "xyes" ; then
1292111ba1daSmrg		compression="gzip"
1293111ba1daSmrg	fi
1294111ba1daSmrg	AC_MSG_RESULT([${compression}])
1295111ba1daSmrg	case ${compression} in
1296111ba1daSmrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
1297111ba1daSmrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;
1298111ba1daSmrg			COMPRESS_FLAGS="${COMPRESS_FLAGS--n}" ;;
1299111ba1daSmrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
1300111ba1daSmrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
1301111ba1daSmrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
1302111ba1daSmrg	esac
1303111ba1daSmrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
1304111ba1daSmrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
1305111ba1daSmrg	fi
1306111ba1daSmrg	AC_MSG_CHECKING([options to font compression command])
1307111ba1daSmrg	AC_MSG_RESULT([${COMPRESS_FLAGS:-none}])
1308111ba1daSmrg	AC_SUBST([COMPRESS_FLAGS])
1309111ba1daSmrg	AC_SUBST([COMPRESS_SUFFIX])
1310111ba1daSmrg])
13118ff16396Smrg
1312111ba1daSmrg# XORG_FONT_UCS2ANY()
1313111ba1daSmrg# -------------------
1314111ba1daSmrg# Minimum version: 1.1.0
1315111ba1daSmrg#
1316111ba1daSmrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
1317111ba1daSmrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
1318111ba1daSmrg# Also call pkg-config to find the directory with the encoding files needed
1319111ba1daSmrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
13208ff16396Smrg
1321111ba1daSmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
1322111ba1daSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1323111ba1daSmrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
1324111ba1daSmrg	PKG_CHECK_MODULES(MAPS, [fontutil])
1325111ba1daSmrg	AC_MSG_CHECKING([for ucs2any encoding data files])
1326111ba1daSmrg	MAPFILES_PATH=`$PKG_CONFIG --variable=mapdir fontutil`
1327111ba1daSmrg	AC_SUBST(MAPFILES_PATH)
1328111ba1daSmrg	AC_MSG_RESULT([${MAPFILES_PATH}])
1329111ba1daSmrg])
13308ff16396Smrg
13318ff16396Smrg
13328ff16396Smrg
1333111ba1daSmrg# XORG_FONT_FC_CONFDIR()
1334111ba1daSmrg# --------------------
1335111ba1daSmrg# Minimum version: 1.2.0
1336111ba1daSmrg#
1337111ba1daSmrg# Sets FC_CONFDIR to the fontconfig config directory
1338111ba1daSmrg# (which should be --with-confdir=... when building fontconfig)
1339111ba1daSmrg# found from:
1340111ba1daSmrg#	--with-fc-confdir=...
1341111ba1daSmrg#	pkg-config --variable=confdir fontconfig
1342111ba1daSmrg#	${sysconfdir}/fonts
13438ff16396Smrg
1344111ba1daSmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
1345111ba1daSmrg	dnl Ensure $PKG_CONFIG is set first
1346111ba1daSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
13478ff16396Smrg
1348111ba1daSmrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
1349111ba1daSmrg	AC_ARG_WITH(fc-confdir,
1350111ba1daSmrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
1351111ba1daSmrg			   [Path to fontconfig's configuration directory]),
1352111ba1daSmrg		    [FC_CONFDIR="$withval"])
1353111ba1daSmrg	# if --with-fc-confdir was not specified
1354111ba1daSmrg	if test "x${FC_CONFDIR}" = "x"; then
1355111ba1daSmrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
1356111ba1daSmrg	fi
1357111ba1daSmrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
1358111ba1daSmrg	if test "x${FC_CONFDIR}" = "x"; then
1359111ba1daSmrg		FC_CONFDIR="${sysconfdir}/fonts"
1360111ba1daSmrg	fi
1361111ba1daSmrg	AC_SUBST(FC_CONFDIR)
1362111ba1daSmrg	AC_MSG_RESULT([${FC_CONFDIR}])
1363111ba1daSmrg])
13648ff16396Smrg
13658ff16396Smrg
13668ff16396Smrg
1367111ba1daSmrg# XORG_FONTROOTDIR()
1368111ba1daSmrg# --------------------
1369111ba1daSmrg# Minimum version: 1.1.0
1370111ba1daSmrg#
1371111ba1daSmrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
1372111ba1daSmrg# found from:
1373111ba1daSmrg#	--with-fontrootdir
1374111ba1daSmrg#	pkg-config --variable=fontrootdir fontutil
1375111ba1daSmrg#	${datadir}/fonts/X11
13768ff16396Smrg
1377111ba1daSmrgAC_DEFUN([XORG_FONTROOTDIR],[
1378111ba1daSmrg	dnl Ensure $PKG_CONFIG is set first
1379111ba1daSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
13808ff16396Smrg
1381111ba1daSmrg	AC_MSG_CHECKING([for root directory for font files])
1382111ba1daSmrg	AC_ARG_WITH(fontrootdir,
1383111ba1daSmrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
1384111ba1daSmrg			   [Path to root directory for font files]),
1385111ba1daSmrg		    [FONTROOTDIR="$withval"])
1386111ba1daSmrg	# if --with-fontrootdir not specified...
1387111ba1daSmrg	if test "x${FONTROOTDIR}" = "x"; then
1388111ba1daSmrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
1389111ba1daSmrg	fi
1390111ba1daSmrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
1391111ba1daSmrg	if test "x${FONTROOTDIR}" = "x"; then
1392111ba1daSmrg		FONTROOTDIR="${datadir}/fonts/X11"
1393111ba1daSmrg	fi
1394111ba1daSmrg	AC_SUBST(FONTROOTDIR)
1395111ba1daSmrg	AC_MSG_RESULT([${FONTROOTDIR}])
1396111ba1daSmrg])
13978ff16396Smrg
1398111ba1daSmrg# XORG_FONTSUBDIR(variable, flag, subdir)
1399111ba1daSmrg# ---------------------------------------
1400111ba1daSmrg# Minimum version: 1.1.0
1401111ba1daSmrg#
1402111ba1daSmrg# Offer a --with-<flag> flag to control directory for font installation
1403111ba1daSmrg# Default is the specified <subdir> of the font root directory.
1404111ba1daSmrg# Sets <variable> to the selected directory
14058ff16396Smrg
1406111ba1daSmrgAC_DEFUN([XORG_FONTSUBDIR],[
1407111ba1daSmrg	AC_REQUIRE([XORG_FONTROOTDIR])
14088ff16396Smrg
1409111ba1daSmrg	AC_MSG_CHECKING([for directory for $3 files])
1410111ba1daSmrg	AC_ARG_WITH($2,
1411111ba1daSmrg		    [AS_HELP_STRING([--with-$2=DIR],
1412111ba1daSmrg				    [Path to $3 files [FONTROOTDIR/$3]])],
1413111ba1daSmrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
1414111ba1daSmrg	AC_SUBST($1)
1415111ba1daSmrg	AC_MSG_RESULT([${$1}])
1416111ba1daSmrg]) # XORG_FONTSUBDIR
1417d5d8cc55Smrg
1418111ba1daSmrg# XORG_FONTDIR(subdir)
1419111ba1daSmrg# --------------------
1420111ba1daSmrg# Minimum version: 1.1.0
1421111ba1daSmrg#
1422111ba1daSmrg# Offer a --with-fontdir flag to control directory for font installation
1423111ba1daSmrg# Default is the specified subdir of the font root directory.
1424111ba1daSmrg# Sets FONTDIR to the selected directory
14258ff16396Smrg
1426111ba1daSmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
14278ff16396Smrg
1428111ba1daSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1429111ba1daSmrgdnl
1430111ba1daSmrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
1431111ba1daSmrgdnl
1432111ba1daSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1433111ba1daSmrgdnl copy of this software and associated documentation files (the "Software"),
1434111ba1daSmrgdnl to deal in the Software without restriction, including without limitation
1435111ba1daSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1436111ba1daSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1437111ba1daSmrgdnl Software is furnished to do so, subject to the following conditions:
1438111ba1daSmrgdnl
1439111ba1daSmrgdnl The above copyright notice and this permission notice (including the next
1440111ba1daSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1441111ba1daSmrgdnl Software.
1442111ba1daSmrgdnl
1443111ba1daSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1444111ba1daSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1445111ba1daSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1446111ba1daSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1447111ba1daSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1448111ba1daSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1449111ba1daSmrgdnl DEALINGS IN THE SOFTWARE.
1450111ba1daSmrg
1451111ba1daSmrg# XORG_MACROS_VERSION(required-version)
1452111ba1daSmrg# -------------------------------------
1453111ba1daSmrg# Minimum version: 1.1.0
1454d5d8cc55Smrg#
1455111ba1daSmrg# If you're using a macro added in Version 1.1 or newer, include this in
1456111ba1daSmrg# your configure.ac with the minimum required version, such as:
1457111ba1daSmrg# XORG_MACROS_VERSION(1.1)
1458d5d8cc55Smrg#
1459111ba1daSmrg# To ensure that this macro is defined, also add:
1460111ba1daSmrg# m4_ifndef([XORG_MACROS_VERSION],
1461111ba1daSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1462d5d8cc55Smrg#
1463d5d8cc55Smrg#
1464111ba1daSmrg# See the "minimum version" comment for each macro you use to see what
1465111ba1daSmrg# version you require.
1466111ba1daSmrgm4_defun([XORG_MACROS_VERSION],[
1467111ba1daSmrgm4_define([vers_have], [1.20.0])
1468111ba1daSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1469111ba1daSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1470111ba1daSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1471111ba1daSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1472111ba1daSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1473111ba1daSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1474111ba1daSmrgm4_undefine([vers_have])
1475111ba1daSmrgm4_undefine([maj_have])
1476111ba1daSmrgm4_undefine([maj_needed])
1477111ba1daSmrg]) # XORG_MACROS_VERSION
1478d5d8cc55Smrg
1479111ba1daSmrg# XORG_PROG_RAWCPP()
1480111ba1daSmrg# ------------------
1481111ba1daSmrg# Minimum version: 1.0.0
1482111ba1daSmrg#
1483111ba1daSmrg# Find cpp program and necessary flags for use in pre-processing text files
1484111ba1daSmrg# such as man pages and config files
1485111ba1daSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1486111ba1daSmrgAC_REQUIRE([AC_PROG_CPP])
1487111ba1daSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1488111ba1daSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1489111ba1daSmrg
1490111ba1daSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1491111ba1daSmrg# which is not the best choice for supporting other OS'es, but covers most
1492111ba1daSmrg# of the ones we need for now.
1493111ba1daSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1494111ba1daSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1495111ba1daSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1496111ba1daSmrg	AC_MSG_RESULT([no])
1497d5d8cc55Smrgelse
1498111ba1daSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1499111ba1daSmrg		RAWCPPFLAGS=-undef
1500111ba1daSmrg		AC_MSG_RESULT([yes])
1501111ba1daSmrg	# under Cygwin unix is still defined even with -undef
1502111ba1daSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1503111ba1daSmrg		RAWCPPFLAGS="-undef -ansi"
1504111ba1daSmrg		AC_MSG_RESULT([yes, with -ansi])
1505111ba1daSmrg	else
1506111ba1daSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1507111ba1daSmrg	fi
15088ff16396Smrgfi
1509111ba1daSmrgrm -f conftest.$ac_ext
15108ff16396Smrg
1511111ba1daSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1512111ba1daSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1513111ba1daSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1514111ba1daSmrg	AC_MSG_RESULT([no])
1515d5d8cc55Smrgelse
1516111ba1daSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1517111ba1daSmrg		TRADITIONALCPPFLAGS="-traditional"
1518111ba1daSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1519111ba1daSmrg		AC_MSG_RESULT([yes])
1520111ba1daSmrg	else
1521111ba1daSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1522111ba1daSmrg	fi
1523d5d8cc55Smrgfi
1524111ba1daSmrgrm -f conftest.$ac_ext
1525111ba1daSmrgAC_SUBST(RAWCPPFLAGS)
1526111ba1daSmrgAC_SUBST(TRADITIONALCPPFLAGS)
1527111ba1daSmrg]) # XORG_PROG_RAWCPP
1528d5d8cc55Smrg
1529111ba1daSmrg# XORG_MANPAGE_SECTIONS()
1530111ba1daSmrg# -----------------------
1531111ba1daSmrg# Minimum version: 1.0.0
1532d5d8cc55Smrg#
1533111ba1daSmrg# Determine which sections man pages go in for the different man page types
1534111ba1daSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1535111ba1daSmrg# Not sure if there's any better way than just hardcoding by OS name.
1536111ba1daSmrg# Override default settings by setting environment variables
1537111ba1daSmrg# Added MAN_SUBSTS in version 1.8
1538111ba1daSmrg# Added AC_PROG_SED in version 1.8
1539d5d8cc55Smrg
1540111ba1daSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1541111ba1daSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1542111ba1daSmrgAC_REQUIRE([AC_PROG_SED])
15438ff16396Smrg
1544111ba1daSmrgcase $host_os in
1545111ba1daSmrg    solaris*)
1546111ba1daSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1547111ba1daSmrg        # check for a man page file found in later versions that use
1548111ba1daSmrg        # traditional section numbers instead
1549111ba1daSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1550111ba1daSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1551111ba1daSmrg        ;;
1552111ba1daSmrg    *) SYSV_MAN_SECTIONS=false ;;
1553111ba1daSmrgesac
1554d5d8cc55Smrg
1555111ba1daSmrgif test x$APP_MAN_SUFFIX = x    ; then
1556111ba1daSmrg    APP_MAN_SUFFIX=1
1557111ba1daSmrgfi
1558111ba1daSmrgif test x$APP_MAN_DIR = x    ; then
1559111ba1daSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1560d5d8cc55Smrgfi
15618ff16396Smrg
1562111ba1daSmrgif test x$LIB_MAN_SUFFIX = x    ; then
1563111ba1daSmrg    LIB_MAN_SUFFIX=3
1564111ba1daSmrgfi
1565111ba1daSmrgif test x$LIB_MAN_DIR = x    ; then
1566111ba1daSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1567d5d8cc55Smrgfi
15688ff16396Smrg
1569111ba1daSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1570111ba1daSmrg    case $SYSV_MAN_SECTIONS in
1571111ba1daSmrg	true)				FILE_MAN_SUFFIX=4  ;;
1572111ba1daSmrg	*)				FILE_MAN_SUFFIX=5  ;;
1573111ba1daSmrg    esac
1574111ba1daSmrgfi
1575111ba1daSmrgif test x$FILE_MAN_DIR = x    ; then
1576111ba1daSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1577d5d8cc55Smrgfi
15788ff16396Smrg
1579111ba1daSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1580111ba1daSmrg    case $SYSV_MAN_SECTIONS in
1581111ba1daSmrg	true)				MISC_MAN_SUFFIX=5  ;;
1582111ba1daSmrg	*)				MISC_MAN_SUFFIX=7  ;;
1583111ba1daSmrg    esac
1584111ba1daSmrgfi
1585111ba1daSmrgif test x$MISC_MAN_DIR = x    ; then
1586111ba1daSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1587111ba1daSmrgfi
15888ff16396Smrg
1589111ba1daSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1590111ba1daSmrg    case $SYSV_MAN_SECTIONS in
1591111ba1daSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1592111ba1daSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1593111ba1daSmrg    esac
1594111ba1daSmrgfi
1595111ba1daSmrgif test x$DRIVER_MAN_DIR = x    ; then
1596111ba1daSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1597111ba1daSmrgfi
1598d5d8cc55Smrg
1599111ba1daSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1600111ba1daSmrg    case $SYSV_MAN_SECTIONS in
1601111ba1daSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1602111ba1daSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
1603111ba1daSmrg    esac
1604111ba1daSmrgfi
1605111ba1daSmrgif test x$ADMIN_MAN_DIR = x    ; then
1606111ba1daSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1607d5d8cc55Smrgfi
16088ff16396Smrg
1609d5d8cc55Smrg
1610111ba1daSmrgAC_SUBST([APP_MAN_SUFFIX])
1611111ba1daSmrgAC_SUBST([LIB_MAN_SUFFIX])
1612111ba1daSmrgAC_SUBST([FILE_MAN_SUFFIX])
1613111ba1daSmrgAC_SUBST([MISC_MAN_SUFFIX])
1614111ba1daSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1615111ba1daSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1616111ba1daSmrgAC_SUBST([APP_MAN_DIR])
1617111ba1daSmrgAC_SUBST([LIB_MAN_DIR])
1618111ba1daSmrgAC_SUBST([FILE_MAN_DIR])
1619111ba1daSmrgAC_SUBST([MISC_MAN_DIR])
1620111ba1daSmrgAC_SUBST([DRIVER_MAN_DIR])
1621111ba1daSmrgAC_SUBST([ADMIN_MAN_DIR])
16228ff16396Smrg
1623111ba1daSmrgXORG_MAN_PAGE="X Version 11"
1624111ba1daSmrgAC_SUBST([XORG_MAN_PAGE])
1625111ba1daSmrgMAN_SUBSTS="\
1626111ba1daSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1627111ba1daSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1628111ba1daSmrg	-e 's|__xservername__|Xorg|g' \
1629111ba1daSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
1630111ba1daSmrg	-e 's|__projectroot__|\$(prefix)|g' \
1631111ba1daSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1632111ba1daSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1633111ba1daSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1634111ba1daSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1635111ba1daSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1636111ba1daSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1637111ba1daSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1638111ba1daSmrgAC_SUBST([MAN_SUBSTS])
1639d5d8cc55Smrg
1640111ba1daSmrg]) # XORG_MANPAGE_SECTIONS
1641d5d8cc55Smrg
1642111ba1daSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1643111ba1daSmrg# ------------------------
1644111ba1daSmrg# Minimum version: 1.7.0
1645d5d8cc55Smrg#
1646111ba1daSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1647111ba1daSmrg# provided by xorg-sgml-doctools, if installed.
1648111ba1daSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1649111ba1daSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1650111ba1daSmrgXORG_SGML_PATH=
1651111ba1daSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1652111ba1daSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1653111ba1daSmrg    [m4_ifval([$1],[:],
1654111ba1daSmrg        [if test x"$cross_compiling" != x"yes" ; then
1655111ba1daSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1656111ba1daSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1657111ba1daSmrg         fi])
1658111ba1daSmrg    ])
1659111ba1daSmrg
1660111ba1daSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1661111ba1daSmrg# the path and the name of the doc stylesheet
1662111ba1daSmrgif test "x$XORG_SGML_PATH" != "x" ; then
1663111ba1daSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1664111ba1daSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1665111ba1daSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1666111ba1daSmrgelse
1667111ba1daSmrg   AC_MSG_RESULT([no])
1668111ba1daSmrgfi
1669111ba1daSmrg
1670111ba1daSmrgAC_SUBST(XORG_SGML_PATH)
1671111ba1daSmrgAC_SUBST(STYLESHEET_SRCDIR)
1672111ba1daSmrgAC_SUBST(XSL_STYLESHEET)
1673111ba1daSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1674111ba1daSmrg]) # XORG_CHECK_SGML_DOCTOOLS
16758ff16396Smrg
1676111ba1daSmrg# XORG_CHECK_LINUXDOC
1677111ba1daSmrg# -------------------
1678d5d8cc55Smrg# Minimum version: 1.0.0
1679d5d8cc55Smrg#
1680111ba1daSmrg# Defines the variable MAKE_TEXT if the necessary tools and
1681111ba1daSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1682111ba1daSmrg# Whether or not the necessary tools and files are found can be checked
1683111ba1daSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1684111ba1daSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1685111ba1daSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1686111ba1daSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
16878ff16396Smrg
1688111ba1daSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1689111ba1daSmrg
1690111ba1daSmrgAC_MSG_CHECKING([whether to build documentation])
1691111ba1daSmrg
1692111ba1daSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1693111ba1daSmrg   BUILDDOC=yes
1694111ba1daSmrgelse
1695111ba1daSmrg   BUILDDOC=no
1696d5d8cc55Smrgfi
16978ff16396Smrg
1698111ba1daSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1699111ba1daSmrg
1700111ba1daSmrgAC_MSG_RESULT([$BUILDDOC])
1701111ba1daSmrg
1702111ba1daSmrgAC_MSG_CHECKING([whether to build pdf documentation])
1703111ba1daSmrg
1704111ba1daSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1705111ba1daSmrg   BUILDPDFDOC=yes
1706d5d8cc55Smrgelse
1707111ba1daSmrg   BUILDPDFDOC=no
1708d5d8cc55Smrgfi
1709d5d8cc55Smrg
1710111ba1daSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17118ff16396Smrg
1712111ba1daSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1713111ba1daSmrg
1714111ba1daSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1715111ba1daSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1716111ba1daSmrgMAKE_PDF="$PS2PDF"
1717111ba1daSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1718111ba1daSmrg
1719111ba1daSmrgAC_SUBST(MAKE_TEXT)
1720111ba1daSmrgAC_SUBST(MAKE_PS)
1721111ba1daSmrgAC_SUBST(MAKE_PDF)
1722111ba1daSmrgAC_SUBST(MAKE_HTML)
1723111ba1daSmrg]) # XORG_CHECK_LINUXDOC
1724111ba1daSmrg
1725111ba1daSmrg# XORG_CHECK_DOCBOOK
1726111ba1daSmrg# -------------------
1727111ba1daSmrg# Minimum version: 1.0.0
1728111ba1daSmrg#
1729111ba1daSmrg# Checks for the ability to build output formats from SGML DocBook source.
1730111ba1daSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1731111ba1daSmrg# indicates whether the necessary tools and files are found and, if set,
1732111ba1daSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1733111ba1daSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1734111ba1daSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1735111ba1daSmrg
1736111ba1daSmrgBUILDTXTDOC=no
1737111ba1daSmrgBUILDPDFDOC=no
1738111ba1daSmrgBUILDPSDOC=no
1739111ba1daSmrgBUILDHTMLDOC=no
1740111ba1daSmrg
1741111ba1daSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1742111ba1daSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1743111ba1daSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1744111ba1daSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1745111ba1daSmrg
1746111ba1daSmrgAC_MSG_CHECKING([whether to build text documentation])
1747111ba1daSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1748111ba1daSmrg   test x$BUILD_TXTDOC != xno; then
1749111ba1daSmrg	BUILDTXTDOC=yes
1750111ba1daSmrgfi
1751111ba1daSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1752111ba1daSmrgAC_MSG_RESULT([$BUILDTXTDOC])
1753111ba1daSmrg
1754111ba1daSmrgAC_MSG_CHECKING([whether to build PDF documentation])
1755111ba1daSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1756111ba1daSmrg   test x$BUILD_PDFDOC != xno; then
1757111ba1daSmrg	BUILDPDFDOC=yes
1758111ba1daSmrgfi
1759111ba1daSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1760111ba1daSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1761111ba1daSmrg
1762111ba1daSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1763111ba1daSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1764111ba1daSmrg   test x$BUILD_PSDOC != xno; then
1765111ba1daSmrg	BUILDPSDOC=yes
1766111ba1daSmrgfi
1767111ba1daSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1768111ba1daSmrgAC_MSG_RESULT([$BUILDPSDOC])
1769111ba1daSmrg
1770111ba1daSmrgAC_MSG_CHECKING([whether to build HTML documentation])
1771111ba1daSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1772111ba1daSmrg   test x$BUILD_HTMLDOC != xno; then
1773111ba1daSmrg	BUILDHTMLDOC=yes
1774111ba1daSmrgfi
1775111ba1daSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1776111ba1daSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1777111ba1daSmrg
1778111ba1daSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1779111ba1daSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1780111ba1daSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1781111ba1daSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1782111ba1daSmrg
1783111ba1daSmrgAC_SUBST(MAKE_TEXT)
1784111ba1daSmrgAC_SUBST(MAKE_PS)
1785111ba1daSmrgAC_SUBST(MAKE_PDF)
1786111ba1daSmrgAC_SUBST(MAKE_HTML)
1787111ba1daSmrg]) # XORG_CHECK_DOCBOOK
1788111ba1daSmrg
1789111ba1daSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1790d5d8cc55Smrg# ----------------
1791111ba1daSmrg# Minimum version: 1.5.0
1792111ba1daSmrg# Minimum version for optional DEFAULT argument: 1.11.0
17938ff16396Smrg#
1794111ba1daSmrg# Documentation tools are not always available on all platforms and sometimes
1795111ba1daSmrg# not at the appropriate level. This macro enables a module to test for the
1796111ba1daSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1797111ba1daSmrg# the --with-xmlto option, it allows maximum flexibility in making decisions
1798111ba1daSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1799111ba1daSmrg# --with-xmlto assumes 'auto'.
18008ff16396Smrg#
1801d5d8cc55Smrg# Interface to module:
1802111ba1daSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1803111ba1daSmrg# XMLTO:	returns the path of the xmlto program found
1804111ba1daSmrg#		returns the path set by the user in the environment
1805111ba1daSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1806111ba1daSmrg#		'no' user instructs the module not to use xmlto
18078ff16396Smrg#
1808111ba1daSmrg# Added in version 1.10.0
1809111ba1daSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1810111ba1daSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
18118ff16396Smrg#
1812111ba1daSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1813d5d8cc55Smrg#
1814111ba1daSmrgAC_DEFUN([XORG_WITH_XMLTO],[
1815111ba1daSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1816111ba1daSmrgm4_define([_defopt], m4_default([$2], [auto]))
1817111ba1daSmrgAC_ARG_WITH(xmlto,
1818111ba1daSmrg	AS_HELP_STRING([--with-xmlto],
1819111ba1daSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1820111ba1daSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1821111ba1daSmrgm4_undefine([_defopt])
18228ff16396Smrg
1823111ba1daSmrgif test "x$use_xmlto" = x"auto"; then
1824111ba1daSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1825111ba1daSmrg   if test "x$XMLTO" = "x"; then
1826111ba1daSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1827111ba1daSmrg	have_xmlto=no
1828111ba1daSmrg   else
1829111ba1daSmrg        have_xmlto=yes
1830d5d8cc55Smrg   fi
1831111ba1daSmrgelif test "x$use_xmlto" = x"yes" ; then
1832111ba1daSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1833111ba1daSmrg   if test "x$XMLTO" = "x"; then
1834111ba1daSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1835d5d8cc55Smrg   fi
1836111ba1daSmrg   have_xmlto=yes
1837111ba1daSmrgelif test "x$use_xmlto" = x"no" ; then
1838111ba1daSmrg   if test "x$XMLTO" != "x"; then
1839111ba1daSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1840111ba1daSmrg   fi
1841111ba1daSmrg   have_xmlto=no
1842d5d8cc55Smrgelse
1843111ba1daSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1844d5d8cc55Smrgfi
18458ff16396Smrg
1846111ba1daSmrg# Test for a minimum version of xmlto, if provided.
1847111ba1daSmrgm4_ifval([$1],
1848111ba1daSmrg[if test "$have_xmlto" = yes; then
1849111ba1daSmrg    # scrape the xmlto version
1850111ba1daSmrg    AC_MSG_CHECKING([the xmlto version])
1851111ba1daSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1852111ba1daSmrg    AC_MSG_RESULT([$xmlto_version])
1853111ba1daSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1854111ba1daSmrg        [if test "x$use_xmlto" = xauto; then
1855111ba1daSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1856111ba1daSmrg            have_xmlto=no
1857111ba1daSmrg        else
1858111ba1daSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1859111ba1daSmrg        fi])
1860111ba1daSmrgfi])
18618ff16396Smrg
1862111ba1daSmrg# Test for the ability of xmlto to generate a text target
1863111ba1daSmrg#
1864111ba1daSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
1865111ba1daSmrg# following test for empty XML docbook files.
1866111ba1daSmrg# For compatibility reasons use the following empty XML docbook file and if
1867111ba1daSmrg# it fails try it again with a non-empty XML file.
1868111ba1daSmrghave_xmlto_text=no
1869111ba1daSmrgcat > conftest.xml << "EOF"
1870111ba1daSmrgEOF
1871111ba1daSmrgAS_IF([test "$have_xmlto" = yes],
1872111ba1daSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1873111ba1daSmrg             [have_xmlto_text=yes],
1874111ba1daSmrg             [# Try it again with a non-empty XML file.
1875111ba1daSmrg              cat > conftest.xml << "EOF"
1876111ba1daSmrg<x></x>
1877111ba1daSmrgEOF
1878111ba1daSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1879111ba1daSmrg                    [have_xmlto_text=yes],
1880111ba1daSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
1881111ba1daSmrgrm -f conftest.xml
1882111ba1daSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1883111ba1daSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1884111ba1daSmrg]) # XORG_WITH_XMLTO
18858ff16396Smrg
1886111ba1daSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1887111ba1daSmrg# --------------------------------------------
1888111ba1daSmrg# Minimum version: 1.12.0
1889111ba1daSmrg# Minimum version for optional DEFAULT argument: 1.12.0
18908ff16396Smrg#
1891111ba1daSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1892111ba1daSmrg# XML-based language used for the transformation of XML documents.
1893111ba1daSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1894111ba1daSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1895111ba1daSmrg# The XSLT processor is often used as a standalone tool for transformations.
1896111ba1daSmrg# It should not be assumed that this tool is used only to work with documnetation.
1897111ba1daSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
18988ff16396Smrg#
1899d5d8cc55Smrg# Interface to module:
1900111ba1daSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1901111ba1daSmrg# XSLTPROC:	 returns the path of the xsltproc program found
1902111ba1daSmrg#		 returns the path set by the user in the environment
1903111ba1daSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1904111ba1daSmrg#		  'no' user instructs the module not to use xsltproc
1905111ba1daSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
19068ff16396Smrg#
1907111ba1daSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1908111ba1daSmrg#
1909111ba1daSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1910111ba1daSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1911111ba1daSmrg# Preserves the interface, should it be implemented later
1912111ba1daSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1913111ba1daSmrgm4_define([_defopt], m4_default([$2], [auto]))
1914111ba1daSmrgAC_ARG_WITH(xsltproc,
1915111ba1daSmrg	AS_HELP_STRING([--with-xsltproc],
1916111ba1daSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1917111ba1daSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1918111ba1daSmrgm4_undefine([_defopt])
19190bd0e222Smrg
1920111ba1daSmrgif test "x$use_xsltproc" = x"auto"; then
1921111ba1daSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1922111ba1daSmrg   if test "x$XSLTPROC" = "x"; then
1923111ba1daSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1924111ba1daSmrg	have_xsltproc=no
1925111ba1daSmrg   else
1926111ba1daSmrg        have_xsltproc=yes
1927d5d8cc55Smrg   fi
1928111ba1daSmrgelif test "x$use_xsltproc" = x"yes" ; then
1929111ba1daSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1930111ba1daSmrg   if test "x$XSLTPROC" = "x"; then
1931111ba1daSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1932111ba1daSmrg   fi
1933111ba1daSmrg   have_xsltproc=yes
1934111ba1daSmrgelif test "x$use_xsltproc" = x"no" ; then
1935111ba1daSmrg   if test "x$XSLTPROC" != "x"; then
1936111ba1daSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1937111ba1daSmrg   fi
1938111ba1daSmrg   have_xsltproc=no
1939111ba1daSmrgelse
1940111ba1daSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1941d5d8cc55Smrgfi
19420bd0e222Smrg
1943111ba1daSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1944111ba1daSmrg]) # XORG_WITH_XSLTPROC
19450bd0e222Smrg
1946111ba1daSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1947111ba1daSmrg# ----------------------------------------
1948111ba1daSmrg# Minimum version: 1.15.0
19498ff16396Smrg#
1950111ba1daSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
1951111ba1daSmrg# scanning arbitrary text files, extracting information from those text files,
1952111ba1daSmrg# and printing reports based on that information.
19538ff16396Smrg#
1954111ba1daSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
19558ff16396Smrg#
1956111ba1daSmrg# Interface to module:
1957111ba1daSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
1958111ba1daSmrg# PERL:	     returns the path of the perl program found
1959111ba1daSmrg#	     returns the path set by the user in the environment
1960111ba1daSmrg# --with-perl: 'yes' user instructs the module to use perl
1961111ba1daSmrg#	       'no' user instructs the module not to use perl
1962111ba1daSmrg# have_perl: returns yes if perl found in PATH or no
1963111ba1daSmrg#
1964111ba1daSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1965111ba1daSmrg#
1966111ba1daSmrgAC_DEFUN([XORG_WITH_PERL],[
1967111ba1daSmrgAC_ARG_VAR([PERL], [Path to perl command])
1968111ba1daSmrg# Preserves the interface, should it be implemented later
1969111ba1daSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1970111ba1daSmrgm4_define([_defopt], m4_default([$2], [auto]))
1971111ba1daSmrgAC_ARG_WITH(perl,
1972111ba1daSmrg	AS_HELP_STRING([--with-perl],
1973111ba1daSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1974111ba1daSmrg	   [use_perl=$withval], [use_perl=]_defopt)
1975111ba1daSmrgm4_undefine([_defopt])
19760bd0e222Smrg
1977111ba1daSmrgif test "x$use_perl" = x"auto"; then
1978111ba1daSmrg   AC_PATH_PROG([PERL], [perl])
1979111ba1daSmrg   if test "x$PERL" = "x"; then
1980111ba1daSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1981111ba1daSmrg	have_perl=no
1982111ba1daSmrg   else
1983111ba1daSmrg        have_perl=yes
1984111ba1daSmrg   fi
1985111ba1daSmrgelif test "x$use_perl" = x"yes" ; then
1986111ba1daSmrg   AC_PATH_PROG([PERL], [perl])
1987111ba1daSmrg   if test "x$PERL" = "x"; then
1988111ba1daSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1989111ba1daSmrg   fi
1990111ba1daSmrg   have_perl=yes
1991111ba1daSmrgelif test "x$use_perl" = x"no" ; then
1992111ba1daSmrg   if test "x$PERL" != "x"; then
1993111ba1daSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1994111ba1daSmrg   fi
1995111ba1daSmrg   have_perl=no
1996111ba1daSmrgelse
1997111ba1daSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1998d5d8cc55Smrgfi
19990bd0e222Smrg
2000111ba1daSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2001111ba1daSmrg]) # XORG_WITH_PERL
20028ff16396Smrg
2003111ba1daSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2004d5d8cc55Smrg# ----------------
2005111ba1daSmrg# Minimum version: 1.5.0
2006111ba1daSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2007d5d8cc55Smrg#
2008111ba1daSmrg# Documentation tools are not always available on all platforms and sometimes
2009111ba1daSmrg# not at the appropriate level. This macro enables a module to test for the
2010111ba1daSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2011111ba1daSmrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
2012111ba1daSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2013111ba1daSmrg# --with-asciidoc assumes 'auto'.
2014d5d8cc55Smrg#
2015111ba1daSmrg# Interface to module:
2016111ba1daSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2017111ba1daSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
2018111ba1daSmrg#		 returns the path set by the user in the environment
2019111ba1daSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2020111ba1daSmrg#		  'no' user instructs the module not to use asciidoc
2021111ba1daSmrg#
2022111ba1daSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2023111ba1daSmrg#
2024111ba1daSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2025111ba1daSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2026111ba1daSmrgm4_define([_defopt], m4_default([$2], [auto]))
2027111ba1daSmrgAC_ARG_WITH(asciidoc,
2028111ba1daSmrg	AS_HELP_STRING([--with-asciidoc],
2029111ba1daSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2030111ba1daSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2031111ba1daSmrgm4_undefine([_defopt])
20328ff16396Smrg
2033111ba1daSmrgif test "x$use_asciidoc" = x"auto"; then
2034111ba1daSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2035111ba1daSmrg   if test "x$ASCIIDOC" = "x"; then
2036111ba1daSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2037111ba1daSmrg	have_asciidoc=no
2038111ba1daSmrg   else
2039111ba1daSmrg        have_asciidoc=yes
2040111ba1daSmrg   fi
2041111ba1daSmrgelif test "x$use_asciidoc" = x"yes" ; then
2042111ba1daSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2043111ba1daSmrg   if test "x$ASCIIDOC" = "x"; then
2044111ba1daSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2045111ba1daSmrg   fi
2046111ba1daSmrg   have_asciidoc=yes
2047111ba1daSmrgelif test "x$use_asciidoc" = x"no" ; then
2048111ba1daSmrg   if test "x$ASCIIDOC" != "x"; then
2049111ba1daSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2050111ba1daSmrg   fi
2051111ba1daSmrg   have_asciidoc=no
2052111ba1daSmrgelse
2053111ba1daSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2054111ba1daSmrgfi
2055111ba1daSmrgm4_ifval([$1],
2056111ba1daSmrg[if test "$have_asciidoc" = yes; then
2057111ba1daSmrg    # scrape the asciidoc version
2058111ba1daSmrg    AC_MSG_CHECKING([the asciidoc version])
2059111ba1daSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2060111ba1daSmrg    AC_MSG_RESULT([$asciidoc_version])
2061111ba1daSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2062111ba1daSmrg        [if test "x$use_asciidoc" = xauto; then
2063111ba1daSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2064111ba1daSmrg            have_asciidoc=no
2065111ba1daSmrg        else
2066111ba1daSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2067111ba1daSmrg        fi])
2068111ba1daSmrgfi])
2069111ba1daSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2070111ba1daSmrg]) # XORG_WITH_ASCIIDOC
20710bd0e222Smrg
2072111ba1daSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
2073111ba1daSmrg# -------------------------------------------
2074111ba1daSmrg# Minimum version: 1.5.0
2075111ba1daSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2076111ba1daSmrg# Minimum version for optional DOT checking: 1.18.0
20778ff16396Smrg#
2078111ba1daSmrg# Documentation tools are not always available on all platforms and sometimes
2079111ba1daSmrg# not at the appropriate level. This macro enables a module to test for the
2080111ba1daSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2081111ba1daSmrg# the --with-doxygen option, it allows maximum flexibility in making decisions
2082111ba1daSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2083111ba1daSmrg# --with-doxygen assumes 'auto'.
2084d5d8cc55Smrg#
2085111ba1daSmrg# Interface to module:
2086111ba1daSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2087111ba1daSmrg# DOXYGEN:	 returns the path of the doxygen program found
2088111ba1daSmrg#		 returns the path set by the user in the environment
2089111ba1daSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2090111ba1daSmrg#		  'no' user instructs the module not to use doxygen
2091d5d8cc55Smrg#
2092111ba1daSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2093d5d8cc55Smrg#
2094111ba1daSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2095111ba1daSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2096111ba1daSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
2097111ba1daSmrgm4_define([_defopt], m4_default([$2], [auto]))
2098111ba1daSmrgAC_ARG_WITH(doxygen,
2099111ba1daSmrg	AS_HELP_STRING([--with-doxygen],
2100111ba1daSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2101111ba1daSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2102111ba1daSmrgm4_undefine([_defopt])
21030bd0e222Smrg
2104111ba1daSmrgif test "x$use_doxygen" = x"auto"; then
2105111ba1daSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2106111ba1daSmrg   if test "x$DOXYGEN" = "x"; then
2107111ba1daSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2108111ba1daSmrg	have_doxygen=no
2109111ba1daSmrg   else
2110111ba1daSmrg        have_doxygen=yes
2111111ba1daSmrg   fi
2112111ba1daSmrgelif test "x$use_doxygen" = x"yes" ; then
2113111ba1daSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2114111ba1daSmrg   if test "x$DOXYGEN" = "x"; then
2115111ba1daSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2116111ba1daSmrg   fi
2117111ba1daSmrg   have_doxygen=yes
2118111ba1daSmrgelif test "x$use_doxygen" = x"no" ; then
2119111ba1daSmrg   if test "x$DOXYGEN" != "x"; then
2120111ba1daSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2121111ba1daSmrg   fi
2122111ba1daSmrg   have_doxygen=no
2123111ba1daSmrgelse
2124111ba1daSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2125111ba1daSmrgfi
2126111ba1daSmrgm4_ifval([$1],
2127111ba1daSmrg[if test "$have_doxygen" = yes; then
2128111ba1daSmrg    # scrape the doxygen version
2129111ba1daSmrg    AC_MSG_CHECKING([the doxygen version])
2130111ba1daSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2131111ba1daSmrg    AC_MSG_RESULT([$doxygen_version])
2132111ba1daSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2133111ba1daSmrg        [if test "x$use_doxygen" = xauto; then
2134111ba1daSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2135111ba1daSmrg            have_doxygen=no
2136111ba1daSmrg        else
2137111ba1daSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2138111ba1daSmrg        fi])
2139111ba1daSmrgfi])
21400bd0e222Smrg
2141111ba1daSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2142111ba1daSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2143111ba1daSmrgdnl 	HAVE_DOT = @HAVE_DOT@
2144111ba1daSmrgHAVE_DOT=no
2145111ba1daSmrgif test "x$have_doxygen" = "xyes"; then
2146111ba1daSmrg  AC_PATH_PROG([DOT], [dot])
2147111ba1daSmrg    if test "x$DOT" != "x"; then
2148111ba1daSmrg      HAVE_DOT=yes
2149111ba1daSmrg    fi
2150111ba1daSmrgfi
21518ff16396Smrg
2152111ba1daSmrgAC_SUBST([HAVE_DOT])
2153111ba1daSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2154111ba1daSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2155111ba1daSmrg]) # XORG_WITH_DOXYGEN
2156d5d8cc55Smrg
2157111ba1daSmrg# XORG_WITH_GROFF([DEFAULT])
2158111ba1daSmrg# ----------------
2159111ba1daSmrg# Minimum version: 1.6.0
2160111ba1daSmrg# Minimum version for optional DEFAULT argument: 1.11.0
21618ff16396Smrg#
2162111ba1daSmrg# Documentation tools are not always available on all platforms and sometimes
2163111ba1daSmrg# not at the appropriate level. This macro enables a module to test for the
2164111ba1daSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2165111ba1daSmrg# the --with-groff option, it allows maximum flexibility in making decisions
2166111ba1daSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
2167111ba1daSmrg# --with-groff assumes 'auto'.
21688ff16396Smrg#
2169111ba1daSmrg# Interface to module:
2170111ba1daSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2171111ba1daSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2172111ba1daSmrg# HAVE_GROFF_MS: the -ms macros package
2173111ba1daSmrg# GROFF:	 returns the path of the groff program found
2174111ba1daSmrg#		 returns the path set by the user in the environment
2175111ba1daSmrg# --with-groff:	 'yes' user instructs the module to use groff
2176111ba1daSmrg#		 'no' user instructs the module not to use groff
21778ff16396Smrg#
2178111ba1daSmrg# Added in version 1.9.0:
2179111ba1daSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2180111ba1daSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2181111ba1daSmrg#		   psselect from the psutils package.
2182111ba1daSmrg#		   the ghostcript package. Refer to the grohtml man pages
21838ff16396Smrg#
2184111ba1daSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2185d5d8cc55Smrg#
2186111ba1daSmrg# OS and distros often splits groff in a basic and full package, the former
2187111ba1daSmrg# having the groff program and the later having devices, fonts and macros
2188111ba1daSmrg# Checking for the groff executable is not enough.
2189d5d8cc55Smrg#
2190111ba1daSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
2191111ba1daSmrg# unset HAVE_GROFF or GROFF env variables.
2192111ba1daSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2193111ba1daSmrg#
2194111ba1daSmrgAC_DEFUN([XORG_WITH_GROFF],[
2195111ba1daSmrgAC_ARG_VAR([GROFF], [Path to groff command])
2196111ba1daSmrgm4_define([_defopt], m4_default([$1], [auto]))
2197111ba1daSmrgAC_ARG_WITH(groff,
2198111ba1daSmrg	AS_HELP_STRING([--with-groff],
2199111ba1daSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2200111ba1daSmrg	   [use_groff=$withval], [use_groff=]_defopt)
2201111ba1daSmrgm4_undefine([_defopt])
2202d5d8cc55Smrg
2203111ba1daSmrgif test "x$use_groff" = x"auto"; then
2204111ba1daSmrg   AC_PATH_PROG([GROFF], [groff])
2205111ba1daSmrg   if test "x$GROFF" = "x"; then
2206111ba1daSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2207111ba1daSmrg	have_groff=no
2208111ba1daSmrg   else
2209111ba1daSmrg        have_groff=yes
2210111ba1daSmrg   fi
2211111ba1daSmrgelif test "x$use_groff" = x"yes" ; then
2212111ba1daSmrg   AC_PATH_PROG([GROFF], [groff])
2213111ba1daSmrg   if test "x$GROFF" = "x"; then
2214111ba1daSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2215111ba1daSmrg   fi
2216111ba1daSmrg   have_groff=yes
2217111ba1daSmrgelif test "x$use_groff" = x"no" ; then
2218111ba1daSmrg   if test "x$GROFF" != "x"; then
2219111ba1daSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2220111ba1daSmrg   fi
2221111ba1daSmrg   have_groff=no
22228ff16396Smrgelse
2223111ba1daSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
22248ff16396Smrgfi
22250bd0e222Smrg
2226111ba1daSmrg# We have groff, test for the presence of the macro packages
2227111ba1daSmrgif test "x$have_groff" = x"yes"; then
2228111ba1daSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2229111ba1daSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2230111ba1daSmrg        groff_ms_works=yes
2231111ba1daSmrg    else
2232111ba1daSmrg        groff_ms_works=no
2233d5d8cc55Smrg    fi
2234111ba1daSmrg    AC_MSG_RESULT([$groff_ms_works])
2235111ba1daSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2236111ba1daSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2237111ba1daSmrg        groff_mm_works=yes
2238111ba1daSmrg    else
2239111ba1daSmrg        groff_mm_works=no
2240111ba1daSmrg    fi
2241111ba1daSmrg    AC_MSG_RESULT([$groff_mm_works])
22428ff16396Smrgfi
2243d5d8cc55Smrg
2244111ba1daSmrg# We have groff, test for HTML dependencies, one command per package
2245111ba1daSmrgif test "x$have_groff" = x"yes"; then
2246111ba1daSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2247111ba1daSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2248111ba1daSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2249111ba1daSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2250111ba1daSmrg      have_groff_html=yes
2251111ba1daSmrg   else
2252111ba1daSmrg      have_groff_html=no
2253111ba1daSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2254111ba1daSmrg   fi
2255111ba1daSmrgfi
2256d5d8cc55Smrg
2257111ba1daSmrg# Set Automake conditionals for Makefiles
2258111ba1daSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2259111ba1daSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2260111ba1daSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2261111ba1daSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2262111ba1daSmrg]) # XORG_WITH_GROFF
2263d5d8cc55Smrg
2264111ba1daSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2265111ba1daSmrg# ---------------------------------------
2266111ba1daSmrg# Minimum version: 1.6.0
2267111ba1daSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2268111ba1daSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2269111ba1daSmrg#
2270111ba1daSmrg# Documentation tools are not always available on all platforms and sometimes
2271111ba1daSmrg# not at the appropriate level. This macro enables a module to test for the
2272111ba1daSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2273111ba1daSmrg# the --with-fop option, it allows maximum flexibility in making decisions
2274111ba1daSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
2275111ba1daSmrg# --with-fop assumes 'auto'.
2276111ba1daSmrg#
2277111ba1daSmrg# Interface to module:
2278111ba1daSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2279111ba1daSmrg# FOP:	 	returns the path of the fop program found
2280111ba1daSmrg#		returns the path set by the user in the environment
2281111ba1daSmrg# --with-fop: 	'yes' user instructs the module to use fop
2282111ba1daSmrg#		'no' user instructs the module not to use fop
2283111ba1daSmrg#
2284111ba1daSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2285111ba1daSmrg#
2286111ba1daSmrgAC_DEFUN([XORG_WITH_FOP],[
2287111ba1daSmrgAC_ARG_VAR([FOP], [Path to fop command])
2288111ba1daSmrgm4_define([_defopt], m4_default([$2], [auto]))
2289111ba1daSmrgAC_ARG_WITH(fop,
2290111ba1daSmrg	AS_HELP_STRING([--with-fop],
2291111ba1daSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2292111ba1daSmrg	   [use_fop=$withval], [use_fop=]_defopt)
2293111ba1daSmrgm4_undefine([_defopt])
2294d5d8cc55Smrg
2295111ba1daSmrgif test "x$use_fop" = x"auto"; then
2296111ba1daSmrg   AC_PATH_PROG([FOP], [fop])
2297111ba1daSmrg   if test "x$FOP" = "x"; then
2298111ba1daSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2299111ba1daSmrg	have_fop=no
2300111ba1daSmrg   else
2301111ba1daSmrg        have_fop=yes
2302111ba1daSmrg   fi
2303111ba1daSmrgelif test "x$use_fop" = x"yes" ; then
2304111ba1daSmrg   AC_PATH_PROG([FOP], [fop])
2305111ba1daSmrg   if test "x$FOP" = "x"; then
2306111ba1daSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2307111ba1daSmrg   fi
2308111ba1daSmrg   have_fop=yes
2309111ba1daSmrgelif test "x$use_fop" = x"no" ; then
2310111ba1daSmrg   if test "x$FOP" != "x"; then
2311111ba1daSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2312111ba1daSmrg   fi
2313111ba1daSmrg   have_fop=no
2314111ba1daSmrgelse
2315111ba1daSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
23168ff16396Smrgfi
23170bd0e222Smrg
2318111ba1daSmrg# Test for a minimum version of fop, if provided.
2319111ba1daSmrgm4_ifval([$1],
2320111ba1daSmrg[if test "$have_fop" = yes; then
2321111ba1daSmrg    # scrape the fop version
2322111ba1daSmrg    AC_MSG_CHECKING([for fop minimum version])
2323111ba1daSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2324111ba1daSmrg    AC_MSG_RESULT([$fop_version])
2325111ba1daSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
2326111ba1daSmrg        [if test "x$use_fop" = xauto; then
2327111ba1daSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2328111ba1daSmrg            have_fop=no
2329111ba1daSmrg        else
2330111ba1daSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2331111ba1daSmrg        fi])
2332111ba1daSmrgfi])
2333111ba1daSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2334111ba1daSmrg]) # XORG_WITH_FOP
23350bd0e222Smrg
2336111ba1daSmrg# XORG_WITH_M4([MIN-VERSION])
2337111ba1daSmrg# ---------------------------
2338111ba1daSmrg# Minimum version: 1.19.0
23398ff16396Smrg#
2340111ba1daSmrg# This macro attempts to locate an m4 macro processor which supports
2341111ba1daSmrg# -I option and is only useful for modules relying on M4 in order to
2342111ba1daSmrg# expand macros in source code files.
2343d5d8cc55Smrg#
2344111ba1daSmrg# Interface to module:
2345111ba1daSmrg# M4:	 	returns the path of the m4 program found
2346111ba1daSmrg#		returns the path set by the user in the environment
2347111ba1daSmrg#
2348111ba1daSmrgAC_DEFUN([XORG_WITH_M4], [
2349111ba1daSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2350111ba1daSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2351111ba1daSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2352111ba1daSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2353111ba1daSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2354111ba1daSmrg   [$PATH:/usr/gnu/bin])])
23550bd0e222Smrg
2356111ba1daSmrgAC_SUBST([M4], [$ac_cv_path_M4])
2357111ba1daSmrg]) # XORG_WITH_M4
23580bd0e222Smrg
2359111ba1daSmrg# XORG_WITH_PS2PDF([DEFAULT])
2360111ba1daSmrg# ----------------
2361111ba1daSmrg# Minimum version: 1.6.0
2362111ba1daSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2363111ba1daSmrg#
2364111ba1daSmrg# Documentation tools are not always available on all platforms and sometimes
2365111ba1daSmrg# not at the appropriate level. This macro enables a module to test for the
2366111ba1daSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2367111ba1daSmrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
2368111ba1daSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2369111ba1daSmrg# --with-ps2pdf assumes 'auto'.
2370111ba1daSmrg#
2371111ba1daSmrg# Interface to module:
2372111ba1daSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2373111ba1daSmrg# PS2PDF:	returns the path of the ps2pdf program found
2374111ba1daSmrg#		returns the path set by the user in the environment
2375111ba1daSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2376111ba1daSmrg#		 'no' user instructs the module not to use ps2pdf
2377111ba1daSmrg#
2378111ba1daSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2379111ba1daSmrg#
2380111ba1daSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2381111ba1daSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2382111ba1daSmrgm4_define([_defopt], m4_default([$1], [auto]))
2383111ba1daSmrgAC_ARG_WITH(ps2pdf,
2384111ba1daSmrg	AS_HELP_STRING([--with-ps2pdf],
2385111ba1daSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2386111ba1daSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2387111ba1daSmrgm4_undefine([_defopt])
23880bd0e222Smrg
2389111ba1daSmrgif test "x$use_ps2pdf" = x"auto"; then
2390111ba1daSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2391111ba1daSmrg   if test "x$PS2PDF" = "x"; then
2392111ba1daSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2393111ba1daSmrg	have_ps2pdf=no
2394111ba1daSmrg   else
2395111ba1daSmrg        have_ps2pdf=yes
2396111ba1daSmrg   fi
2397111ba1daSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2398111ba1daSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2399111ba1daSmrg   if test "x$PS2PDF" = "x"; then
2400111ba1daSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2401111ba1daSmrg   fi
2402111ba1daSmrg   have_ps2pdf=yes
2403111ba1daSmrgelif test "x$use_ps2pdf" = x"no" ; then
2404111ba1daSmrg   if test "x$PS2PDF" != "x"; then
2405111ba1daSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2406111ba1daSmrg   fi
2407111ba1daSmrg   have_ps2pdf=no
2408111ba1daSmrgelse
2409111ba1daSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2410d5d8cc55Smrgfi
2411111ba1daSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2412111ba1daSmrg]) # XORG_WITH_PS2PDF
24130bd0e222Smrg
2414111ba1daSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2415111ba1daSmrg# ----------------
2416111ba1daSmrg# Minimum version: 1.6.0
2417111ba1daSmrg#
2418111ba1daSmrg# Documentation tools are not always available on all platforms and sometimes
2419111ba1daSmrg# not at the appropriate level. This macro enables a builder to skip all
2420111ba1daSmrg# documentation targets except traditional man pages.
2421111ba1daSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2422111ba1daSmrg# maximum flexibility in controlling documentation building.
2423111ba1daSmrg# Refer to:
2424111ba1daSmrg# XORG_WITH_XMLTO         --with-xmlto
2425111ba1daSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2426111ba1daSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2427111ba1daSmrg# XORG_WITH_FOP           --with-fop
2428111ba1daSmrg# XORG_WITH_GROFF         --with-groff
2429111ba1daSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2430111ba1daSmrg#
2431111ba1daSmrg# Interface to module:
2432111ba1daSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2433111ba1daSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2434111ba1daSmrg#		 'no' user instructs the module not to generate docs
2435111ba1daSmrg# parm1:	specify the default value, yes or no.
2436111ba1daSmrg#
2437111ba1daSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2438111ba1daSmrgm4_define([docs_default], m4_default([$1], [yes]))
2439111ba1daSmrgAC_ARG_ENABLE(docs,
2440111ba1daSmrg	AS_HELP_STRING([--enable-docs],
2441111ba1daSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2442111ba1daSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2443111ba1daSmrgm4_undefine([docs_default])
2444111ba1daSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2445111ba1daSmrgAC_MSG_CHECKING([whether to build documentation])
2446111ba1daSmrgAC_MSG_RESULT([$build_docs])
2447111ba1daSmrg]) # XORG_ENABLE_DOCS
24480bd0e222Smrg
2449111ba1daSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2450111ba1daSmrg# ----------------
2451111ba1daSmrg# Minimum version: 1.6.0
2452111ba1daSmrg#
2453111ba1daSmrg# This macro enables a builder to skip all developer documentation.
2454111ba1daSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2455111ba1daSmrg# maximum flexibility in controlling documentation building.
2456111ba1daSmrg# Refer to:
2457111ba1daSmrg# XORG_WITH_XMLTO         --with-xmlto
2458111ba1daSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2459111ba1daSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2460111ba1daSmrg# XORG_WITH_FOP           --with-fop
2461111ba1daSmrg# XORG_WITH_GROFF         --with-groff
2462111ba1daSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2463111ba1daSmrg#
2464111ba1daSmrg# Interface to module:
2465111ba1daSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2466111ba1daSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2467111ba1daSmrg#			'no' user instructs the module not to generate developer docs
2468111ba1daSmrg# parm1:		specify the default value, yes or no.
2469111ba1daSmrg#
2470111ba1daSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2471111ba1daSmrgm4_define([devel_default], m4_default([$1], [yes]))
2472111ba1daSmrgAC_ARG_ENABLE(devel-docs,
2473111ba1daSmrg	AS_HELP_STRING([--enable-devel-docs],
2474111ba1daSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2475111ba1daSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2476111ba1daSmrgm4_undefine([devel_default])
2477111ba1daSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2478111ba1daSmrgAC_MSG_CHECKING([whether to build developer documentation])
2479111ba1daSmrgAC_MSG_RESULT([$build_devel_docs])
2480111ba1daSmrg]) # XORG_ENABLE_DEVEL_DOCS
24810bd0e222Smrg
2482111ba1daSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
2483111ba1daSmrg# ----------------
2484111ba1daSmrg# Minimum version: 1.6.0
2485111ba1daSmrg#
2486111ba1daSmrg# This macro enables a builder to skip all functional specification targets.
2487111ba1daSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2488111ba1daSmrg# maximum flexibility in controlling documentation building.
2489111ba1daSmrg# Refer to:
2490111ba1daSmrg# XORG_WITH_XMLTO         --with-xmlto
2491111ba1daSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2492111ba1daSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2493111ba1daSmrg# XORG_WITH_FOP           --with-fop
2494111ba1daSmrg# XORG_WITH_GROFF         --with-groff
2495111ba1daSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2496111ba1daSmrg#
2497111ba1daSmrg# Interface to module:
2498111ba1daSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2499111ba1daSmrg# --enable-specs:	'yes' user instructs the module to generate specs
2500111ba1daSmrg#			'no' user instructs the module not to generate specs
2501111ba1daSmrg# parm1:		specify the default value, yes or no.
2502111ba1daSmrg#
2503111ba1daSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2504111ba1daSmrgm4_define([spec_default], m4_default([$1], [yes]))
2505111ba1daSmrgAC_ARG_ENABLE(specs,
2506111ba1daSmrg	AS_HELP_STRING([--enable-specs],
2507111ba1daSmrg	   [Enable building the specs (default: ]spec_default[)]),
2508111ba1daSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
2509111ba1daSmrgm4_undefine([spec_default])
2510111ba1daSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2511111ba1daSmrgAC_MSG_CHECKING([whether to build functional specifications])
2512111ba1daSmrgAC_MSG_RESULT([$build_specs])
2513111ba1daSmrg]) # XORG_ENABLE_SPECS
25148ff16396Smrg
2515111ba1daSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2516111ba1daSmrg# ----------------------------------------------
2517111ba1daSmrg# Minimum version: 1.13.0
2518111ba1daSmrg#
2519111ba1daSmrg# This macro enables a builder to enable/disable unit testing
2520111ba1daSmrg# It makes no assumption about the test cases implementation
2521111ba1daSmrg# Test cases may or may not use Automake "Support for test suites"
2522111ba1daSmrg# They may or may not use the software utility library GLib
2523111ba1daSmrg#
2524111ba1daSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2525111ba1daSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2526111ba1daSmrg# The variable enable_unit_tests is used by other macros in this file.
2527111ba1daSmrg#
2528111ba1daSmrg# Interface to module:
2529111ba1daSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2530111ba1daSmrg# enable_unit_tests:    used in configure.ac for additional configuration
2531111ba1daSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2532111ba1daSmrg#			'no' user instructs the module not to build tests
2533111ba1daSmrg# parm1:		specify the default value, yes or no.
2534111ba1daSmrg#
2535111ba1daSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2536111ba1daSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2537111ba1daSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2538111ba1daSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2539111ba1daSmrgm4_define([_defopt], m4_default([$1], [auto]))
2540111ba1daSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2541111ba1daSmrg	[Enable building unit test cases (default: ]_defopt[)]),
2542111ba1daSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2543111ba1daSmrgm4_undefine([_defopt])
2544111ba1daSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2545111ba1daSmrgAC_MSG_CHECKING([whether to build unit test cases])
2546111ba1daSmrgAC_MSG_RESULT([$enable_unit_tests])
2547111ba1daSmrg]) # XORG_ENABLE_UNIT_TESTS
2548d5d8cc55Smrg
2549111ba1daSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2550111ba1daSmrg# ------------------------------------------------------
2551111ba1daSmrg# Minimum version: 1.17.0
2552111ba1daSmrg#
2553111ba1daSmrg# This macro enables a builder to enable/disable integration testing
2554111ba1daSmrg# It makes no assumption about the test cases' implementation
2555111ba1daSmrg# Test cases may or may not use Automake "Support for test suites"
2556111ba1daSmrg#
2557111ba1daSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2558111ba1daSmrg# usually requires less dependencies and may be built and run under less
2559111ba1daSmrg# stringent environments than integration tests.
2560111ba1daSmrg#
2561111ba1daSmrg# Interface to module:
2562111ba1daSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2563111ba1daSmrg# enable_integration_tests:   used in configure.ac for additional configuration
2564111ba1daSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2565111ba1daSmrg#                             'no' user instructs the module not to build tests
2566111ba1daSmrg# parm1:                      specify the default value, yes or no.
2567111ba1daSmrg#
2568111ba1daSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2569111ba1daSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2570111ba1daSmrgm4_define([_defopt], m4_default([$1], [auto]))
2571111ba1daSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2572111ba1daSmrg	[Enable building integration test cases (default: ]_defopt[)]),
2573111ba1daSmrg	[enable_integration_tests=$enableval],
2574111ba1daSmrg	[enable_integration_tests=]_defopt)
2575111ba1daSmrgm4_undefine([_defopt])
2576111ba1daSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2577111ba1daSmrg	[test "x$enable_integration_tests" != xno])
2578111ba1daSmrgAC_MSG_CHECKING([whether to build unit test cases])
2579111ba1daSmrgAC_MSG_RESULT([$enable_integration_tests])
2580111ba1daSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
2581d5d8cc55Smrg
2582111ba1daSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2583111ba1daSmrg# ----------------------------------------
2584111ba1daSmrg# Minimum version: 1.13.0
2585111ba1daSmrg#
2586111ba1daSmrg# GLib is a library which provides advanced data structures and functions.
2587111ba1daSmrg# This macro enables a module to test for the presence of Glib.
2588111ba1daSmrg#
2589111ba1daSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2590111ba1daSmrg# Otherwise the value of $enable_unit_tests is blank.
2591111ba1daSmrg#
2592111ba1daSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2593111ba1daSmrg# test support usually requires less dependencies and may be built and run under
2594111ba1daSmrg# less stringent environments than integration tests.
2595111ba1daSmrg#
2596111ba1daSmrg# Interface to module:
2597111ba1daSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
2598111ba1daSmrg# with_glib: used in configure.ac to know if GLib has been found
2599111ba1daSmrg# --with-glib:	'yes' user instructs the module to use glib
2600111ba1daSmrg#		'no' user instructs the module not to use glib
2601111ba1daSmrg#
2602111ba1daSmrgAC_DEFUN([XORG_WITH_GLIB],[
2603111ba1daSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2604111ba1daSmrgm4_define([_defopt], m4_default([$2], [auto]))
2605111ba1daSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2606111ba1daSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2607111ba1daSmrg	[with_glib=$withval], [with_glib=]_defopt)
2608111ba1daSmrgm4_undefine([_defopt])
2609d5d8cc55Smrg
2610111ba1daSmrghave_glib=no
2611111ba1daSmrg# Do not probe GLib if user explicitly disabled unit testing
2612111ba1daSmrgif test "x$enable_unit_tests" != x"no"; then
2613111ba1daSmrg  # Do not probe GLib if user explicitly disabled it
2614111ba1daSmrg  if test "x$with_glib" != x"no"; then
2615111ba1daSmrg    m4_ifval(
2616111ba1daSmrg      [$1],
2617111ba1daSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2618111ba1daSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2619111ba1daSmrg    )
2620111ba1daSmrg  fi
2621111ba1daSmrgfi
2622d5d8cc55Smrg
2623111ba1daSmrg# Not having GLib when unit testing has been explicitly requested is an error
2624111ba1daSmrgif test "x$enable_unit_tests" = x"yes"; then
2625111ba1daSmrg  if test "x$have_glib" = x"no"; then
2626111ba1daSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2627111ba1daSmrg  fi
2628111ba1daSmrgfi
2629d5d8cc55Smrg
2630111ba1daSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
2631111ba1daSmrgif test "x$enable_unit_tests" = x"no"; then
2632111ba1daSmrg  if test "x$with_glib" = x"yes"; then
2633111ba1daSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2634111ba1daSmrg  fi
26358ff16396Smrgfi
26368ff16396Smrg
2637111ba1daSmrg# Not having GLib when it has been explicitly requested is an error
2638111ba1daSmrgif test "x$with_glib" = x"yes"; then
2639111ba1daSmrg  if test "x$have_glib" = x"no"; then
2640111ba1daSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2641111ba1daSmrg  fi
2642111ba1daSmrgfi
26438ff16396Smrg
2644111ba1daSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2645111ba1daSmrg]) # XORG_WITH_GLIB
26468ff16396Smrg
2647111ba1daSmrg# XORG_LD_WRAP([required|optional])
2648111ba1daSmrg# ---------------------------------
2649111ba1daSmrg# Minimum version: 1.13.0
2650111ba1daSmrg#
2651111ba1daSmrg# Check if linker supports -wrap, passed via compiler flags
2652111ba1daSmrg#
2653111ba1daSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2654111ba1daSmrg# Otherwise the value of $enable_unit_tests is blank.
2655111ba1daSmrg#
2656111ba1daSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2657111ba1daSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2658111ba1daSmrg# available, an argument of "optional" allows use when some unit tests require
2659111ba1daSmrg# ld -wrap and others do not.
2660111ba1daSmrg#
2661111ba1daSmrgAC_DEFUN([XORG_LD_WRAP],[
2662111ba1daSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2663111ba1daSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2664111ba1daSmrg                      void __wrap_exit(int status) { return; }],
2665111ba1daSmrg                     [exit(0);])])
2666111ba1daSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
2667111ba1daSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2668111ba1daSmrg  if test "x$have_ld_wrap" = x"no"; then
2669111ba1daSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2670111ba1daSmrg  fi
26718ff16396Smrgfi
2672111ba1daSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2673111ba1daSmrg#
2674111ba1daSmrg]) # XORG_LD_WRAP
26758ff16396Smrg
2676111ba1daSmrg# XORG_CHECK_LINKER_FLAGS
2677111ba1daSmrg# -----------------------
2678111ba1daSmrg# SYNOPSIS
2679111ba1daSmrg#
2680111ba1daSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2681111ba1daSmrg#
2682111ba1daSmrg# DESCRIPTION
2683111ba1daSmrg#
2684111ba1daSmrg#   Check whether the given linker FLAGS work with the current language's
2685111ba1daSmrg#   linker, or whether they give an error.
2686111ba1daSmrg#
2687111ba1daSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2688111ba1daSmrg#   success/failure.
2689111ba1daSmrg#
2690111ba1daSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
2691111ba1daSmrg#
2692111ba1daSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2693111ba1daSmrg#
2694111ba1daSmrg# LICENSE
2695111ba1daSmrg#
2696111ba1daSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2697111ba1daSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2698111ba1daSmrg#   Copyright (c) 2009 Matteo Frigo
2699111ba1daSmrg#
2700111ba1daSmrg#   This program is free software: you can redistribute it and/or modify it
2701111ba1daSmrg#   under the terms of the GNU General Public License as published by the
2702111ba1daSmrg#   Free Software Foundation, either version 3 of the License, or (at your
2703111ba1daSmrg#   option) any later version.
2704111ba1daSmrg#
2705111ba1daSmrg#   This program is distributed in the hope that it will be useful, but
2706111ba1daSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2707111ba1daSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2708111ba1daSmrg#   Public License for more details.
2709111ba1daSmrg#
2710111ba1daSmrg#   You should have received a copy of the GNU General Public License along
2711111ba1daSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2712111ba1daSmrg#
2713111ba1daSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
2714111ba1daSmrg#   gives unlimited permission to copy, distribute and modify the configure
2715111ba1daSmrg#   scripts that are the output of Autoconf when processing the Macro. You
2716111ba1daSmrg#   need not follow the terms of the GNU General Public License when using
2717111ba1daSmrg#   or distributing such scripts, even though portions of the text of the
2718111ba1daSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2719111ba1daSmrg#   all other use of the material that constitutes the Autoconf Macro.
2720111ba1daSmrg#
2721111ba1daSmrg#   This special exception to the GPL applies to versions of the Autoconf
2722111ba1daSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
2723111ba1daSmrg#   modified version of the Autoconf Macro, you may extend this special
2724111ba1daSmrg#   exception to the GPL to apply to your modified version as well.#
2725111ba1daSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2726111ba1daSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
2727111ba1daSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2728111ba1daSmrgAS_LITERAL_IF([$1],
2729111ba1daSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2730111ba1daSmrg      ax_save_FLAGS=$LDFLAGS
2731111ba1daSmrg      LDFLAGS="$1"
2732111ba1daSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2733111ba1daSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2734111ba1daSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2735111ba1daSmrg      LDFLAGS=$ax_save_FLAGS])],
2736111ba1daSmrg  [ax_save_FLAGS=$LDFLAGS
2737111ba1daSmrg   LDFLAGS="$1"
2738111ba1daSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2739111ba1daSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2740111ba1daSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2741111ba1daSmrg   LDFLAGS=$ax_save_FLAGS])
2742111ba1daSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2743111ba1daSmrgAC_MSG_RESULT($xorg_check_linker_flags)
2744111ba1daSmrgif test "x$xorg_check_linker_flags" = xyes; then
2745111ba1daSmrg	m4_default([$2], :)
2746111ba1daSmrgelse
2747111ba1daSmrg	m4_default([$3], :)
2748111ba1daSmrgfi
2749111ba1daSmrg]) # XORG_CHECK_LINKER_FLAGS
27508ff16396Smrg
2751111ba1daSmrg# XORG_MEMORY_CHECK_FLAGS
2752111ba1daSmrg# -----------------------
2753111ba1daSmrg# Minimum version: 1.16.0
2754d5d8cc55Smrg#
2755111ba1daSmrg# This macro attempts to find appropriate memory checking functionality
2756111ba1daSmrg# for various platforms which unit testing code may use to catch various
2757111ba1daSmrg# forms of memory allocation and access errors in testing.
2758111ba1daSmrg#
2759111ba1daSmrg# Interface to module:
2760111ba1daSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2761111ba1daSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2762111ba1daSmrg#
2763111ba1daSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2764111ba1daSmrg#
2765111ba1daSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
27668ff16396Smrg
2767111ba1daSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2768111ba1daSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2769111ba1daSmrg           [Environment variables to enable memory checking in tests])
27708ff16396Smrg
2771111ba1daSmrg# Check for different types of support on different platforms
2772111ba1daSmrgcase $host_os in
2773111ba1daSmrg    solaris*)
2774111ba1daSmrg        AC_CHECK_LIB([umem], [umem_alloc],
2775111ba1daSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2776111ba1daSmrg        ;;
2777111ba1daSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2778111ba1daSmrg        # both directly and inverted, so should not be 0 or 255.
2779111ba1daSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
2780111ba1daSmrg        ;;
2781111ba1daSmrg    darwin*)
2782111ba1daSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2783111ba1daSmrg        ;;
2784111ba1daSmrg    *bsd*)
2785111ba1daSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2786111ba1daSmrg        ;;
2787111ba1daSmrgesac
27888ff16396Smrg
2789111ba1daSmrg# User supplied flags override default flags
2790111ba1daSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2791111ba1daSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2792111ba1daSmrgfi
27938ff16396Smrg
2794111ba1daSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2795111ba1daSmrg]) # XORG_WITH_LINT
2796d5d8cc55Smrg
2797111ba1daSmrg# XORG_CHECK_MALLOC_ZERO
2798111ba1daSmrg# ----------------------
2799111ba1daSmrg# Minimum version: 1.0.0
28008ff16396Smrg#
2801111ba1daSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2802111ba1daSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2803111ba1daSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2804111ba1daSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2805111ba1daSmrgAC_ARG_ENABLE(malloc0returnsnull,
2806111ba1daSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2807111ba1daSmrg		       [malloc(0) returns NULL (default: auto)]),
2808111ba1daSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2809111ba1daSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
28108ff16396Smrg
2811111ba1daSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2812111ba1daSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2813111ba1daSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
2814111ba1daSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2815111ba1daSmrg#include <stdlib.h>
2816111ba1daSmrg],[
2817111ba1daSmrg    char *m0, *r0, *c0, *p;
2818111ba1daSmrg    m0 = malloc(0);
2819111ba1daSmrg    p = malloc(10);
2820111ba1daSmrg    r0 = realloc(p,0);
2821111ba1daSmrg    c0 = calloc(0,10);
2822111ba1daSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2823111ba1daSmrg])],
2824111ba1daSmrg		[xorg_cv_malloc0_returns_null=yes],
2825111ba1daSmrg		[xorg_cv_malloc0_returns_null=no])])
2826111ba1daSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2827111ba1daSmrgfi
2828111ba1daSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
28298ff16396Smrg
2830111ba1daSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2831111ba1daSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2832111ba1daSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2833111ba1daSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2834111ba1daSmrgelse
2835111ba1daSmrg	MALLOC_ZERO_CFLAGS=""
2836111ba1daSmrg	XMALLOC_ZERO_CFLAGS=""
2837111ba1daSmrg	XTMALLOC_ZERO_CFLAGS=""
2838111ba1daSmrgfi
28398ff16396Smrg
2840111ba1daSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2841111ba1daSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2842111ba1daSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2843111ba1daSmrg]) # XORG_CHECK_MALLOC_ZERO
28440bd0e222Smrg
2845111ba1daSmrg# XORG_WITH_LINT()
2846111ba1daSmrg# ----------------
2847111ba1daSmrg# Minimum version: 1.1.0
28488ff16396Smrg#
2849111ba1daSmrg# This macro enables the use of a tool that flags some suspicious and
2850111ba1daSmrg# non-portable constructs (likely to be bugs) in C language source code.
2851111ba1daSmrg# It will attempt to locate the tool and use appropriate options.
2852111ba1daSmrg# There are various lint type tools on different platforms.
2853111ba1daSmrg#
2854111ba1daSmrg# Interface to module:
2855111ba1daSmrg# LINT:		returns the path to the tool found on the platform
2856111ba1daSmrg#		or the value set to LINT on the configure cmd line
2857111ba1daSmrg#		also an Automake conditional
2858111ba1daSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
2859111ba1daSmrg#
2860111ba1daSmrg# --with-lint:	'yes' user instructs the module to use lint
2861111ba1daSmrg#		'no' user instructs the module not to use lint (default)
2862111ba1daSmrg#
2863111ba1daSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2864111ba1daSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2865111ba1daSmrg#
2866111ba1daSmrgAC_DEFUN([XORG_WITH_LINT],[
28678ff16396Smrg
2868111ba1daSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2869111ba1daSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2870111ba1daSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2871111ba1daSmrg		[Use a lint-style source code checker (default: disabled)])],
2872111ba1daSmrg		[use_lint=$withval], [use_lint=no])
28738ff16396Smrg
2874111ba1daSmrg# Obtain platform specific info like program name and options
2875111ba1daSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2876111ba1daSmrgcase $host_os in
2877111ba1daSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2878111ba1daSmrg	lint_name=splint
2879111ba1daSmrg	lint_options="-badflag"
2880111ba1daSmrg	;;
2881111ba1daSmrg  *freebsd* | *netbsd*)
2882111ba1daSmrg	lint_name=lint
2883111ba1daSmrg	lint_options="-u -b"
2884111ba1daSmrg	;;
2885111ba1daSmrg  *solaris*)
2886111ba1daSmrg	lint_name=lint
2887111ba1daSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2888111ba1daSmrg	;;
2889111ba1daSmrgesac
28908ff16396Smrg
2891111ba1daSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2892111ba1daSmrgif test "x$use_lint" = x"yes" ; then
2893111ba1daSmrg   AC_PATH_PROG([LINT], [$lint_name])
2894111ba1daSmrg   if test "x$LINT" = "x"; then
2895111ba1daSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2896111ba1daSmrg   fi
2897111ba1daSmrgelif test "x$use_lint" = x"no" ; then
2898111ba1daSmrg   if test "x$LINT" != "x"; then
2899111ba1daSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2900111ba1daSmrg   fi
2901d5d8cc55Smrgelse
2902111ba1daSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2903d5d8cc55Smrgfi
29048ff16396Smrg
2905111ba1daSmrg# User supplied flags override default flags
2906111ba1daSmrgif test "x$LINT_FLAGS" != "x"; then
2907111ba1daSmrg   lint_options=$LINT_FLAGS
2908111ba1daSmrgfi
29098ff16396Smrg
2910111ba1daSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2911111ba1daSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2912d5d8cc55Smrg
2913111ba1daSmrg]) # XORG_WITH_LINT
2914d5d8cc55Smrg
2915111ba1daSmrg# XORG_LINT_LIBRARY(LIBNAME)
2916111ba1daSmrg# --------------------------
2917111ba1daSmrg# Minimum version: 1.1.0
29188ff16396Smrg#
2919111ba1daSmrg# Sets up flags for building lint libraries for checking programs that call
2920111ba1daSmrg# functions in the library.
2921111ba1daSmrg#
2922111ba1daSmrg# Interface to module:
2923111ba1daSmrg# LINTLIB		- Automake variable with the name of lint library file to make
2924111ba1daSmrg# MAKE_LINT_LIB		- Automake conditional
2925111ba1daSmrg#
2926111ba1daSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2927111ba1daSmrg#			  - 'no' user instructs the module not to create a lint library (default)
2928d5d8cc55Smrg
2929111ba1daSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2930111ba1daSmrgAC_REQUIRE([XORG_WITH_LINT])
2931111ba1daSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2932111ba1daSmrg	[Create lint library (default: disabled)])],
2933111ba1daSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
29348ff16396Smrg
2935111ba1daSmrgif test "x$make_lint_lib" = x"yes" ; then
2936111ba1daSmrg   LINTLIB=llib-l$1.ln
2937111ba1daSmrg   if test "x$LINT" = "x"; then
2938111ba1daSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2939111ba1daSmrg   fi
2940111ba1daSmrgelif test "x$make_lint_lib" != x"no" ; then
2941111ba1daSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2942111ba1daSmrgfi
29438ff16396Smrg
2944111ba1daSmrgAC_SUBST(LINTLIB)
2945111ba1daSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
29460bd0e222Smrg
2947111ba1daSmrg]) # XORG_LINT_LIBRARY
29480bd0e222Smrg
2949111ba1daSmrg# XORG_COMPILER_BRAND
2950111ba1daSmrg# -------------------
2951111ba1daSmrg# Minimum version: 1.14.0
2952111ba1daSmrg#
2953111ba1daSmrg# Checks for various brands of compilers and sets flags as appropriate:
2954111ba1daSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2955111ba1daSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2956111ba1daSmrg#   clang compiler - sets CLANGCC to "yes"
2957111ba1daSmrg#   Intel compiler - sets INTELCC to "yes"
2958111ba1daSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2959111ba1daSmrg#
2960111ba1daSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2961111ba1daSmrgAC_LANG_CASE(
2962111ba1daSmrg	[C], [
2963111ba1daSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
2964111ba1daSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
2965111ba1daSmrg		m4_version_prereq([2.70],
2966111ba1daSmrg			[AC_REQUIRE([AC_PROG_CC])],
2967111ba1daSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
2968111ba1daSmrg	],
2969111ba1daSmrg	[C++], [
2970111ba1daSmrg		AC_REQUIRE([AC_PROG_CXX])
2971111ba1daSmrg	]
2972111ba1daSmrg)
2973111ba1daSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2974111ba1daSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2975111ba1daSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2976111ba1daSmrg]) # XORG_COMPILER_BRAND
29778ff16396Smrg
2978111ba1daSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2979111ba1daSmrg# ---------------
2980111ba1daSmrg# Minimum version: 1.16.0
2981111ba1daSmrg#
2982111ba1daSmrg# Test if the compiler works when passed the given flag as a command line argument.
2983111ba1daSmrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
2984111ba1daSmrg# next flag in the list until there are no more options.
2985111ba1daSmrg#
2986111ba1daSmrg# Note that this does not guarantee that the compiler supports the flag as some
2987111ba1daSmrg# compilers will simply ignore arguments that they do not understand, but we do
2988111ba1daSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2989111ba1daSmrg# -Werror=unused-command-line-argument
2990111ba1daSmrg#
2991111ba1daSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2992111ba1daSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2993111ba1daSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2994111ba1daSmrg
2995111ba1daSmrgAC_LANG_COMPILER_REQUIRE
2996111ba1daSmrg
2997111ba1daSmrgAC_LANG_CASE(
2998111ba1daSmrg	[C], [
2999111ba1daSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
3000111ba1daSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3001111ba1daSmrg		m4_version_prereq([2.70],
3002111ba1daSmrg			[AC_REQUIRE([AC_PROG_CC])],
3003111ba1daSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3004111ba1daSmrg		define([PREFIX], [C])
3005111ba1daSmrg		define([CACHE_PREFIX], [cc])
3006111ba1daSmrg		define([COMPILER], [$CC])
3007111ba1daSmrg	],
3008111ba1daSmrg	[C++], [
3009111ba1daSmrg		define([PREFIX], [CXX])
3010111ba1daSmrg		define([CACHE_PREFIX], [cxx])
3011111ba1daSmrg		define([COMPILER], [$CXX])
3012111ba1daSmrg	]
3013111ba1daSmrg)
30148ff16396Smrg
3015111ba1daSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
3016111ba1daSmrg
3017111ba1daSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
3018111ba1daSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3019111ba1daSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
3020111ba1daSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3021111ba1daSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3022111ba1daSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
3023111ba1daSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
3024111ba1daSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
3025111ba1daSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3026111ba1daSmrgfi
3027d5d8cc55Smrg
3028111ba1daSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
3029111ba1daSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
3030111ba1daSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3031111ba1daSmrg	fi
3032111ba1daSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3033111ba1daSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
3034111ba1daSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3035111ba1daSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3036111ba1daSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
3037111ba1daSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
3038111ba1daSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
3039111ba1daSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3040111ba1daSmrgfi
3041d5d8cc55Smrg
3042111ba1daSmrgfound="no"
3043111ba1daSmrgm4_foreach([flag], m4_cdr($@), [
3044111ba1daSmrg	if test $found = "no" ; then
3045111ba1daSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
3046111ba1daSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3047111ba1daSmrg		fi
3048111ba1daSmrg
3049111ba1daSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
3050111ba1daSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3051111ba1daSmrg		fi
3052111ba1daSmrg
3053111ba1daSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
3054111ba1daSmrg
3055111ba1daSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
3056111ba1daSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
3057111ba1daSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
3058111ba1daSmrg		AC_CACHE_VAL($cacheid,
3059111ba1daSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3060111ba1daSmrg					     [eval $cacheid=yes],
3061111ba1daSmrg					     [eval $cacheid=no])])
3062111ba1daSmrg
3063111ba1daSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3064111ba1daSmrg
3065111ba1daSmrg		eval supported=\$$cacheid
3066111ba1daSmrg		AC_MSG_RESULT([$supported])
3067111ba1daSmrg		if test "$supported" = "yes" ; then
3068111ba1daSmrg			$1="$$1 ]flag["
3069111ba1daSmrg			found="yes"
3070111ba1daSmrg		fi
3071111ba1daSmrg	fi
3072111ba1daSmrg])
3073111ba1daSmrg]) # XORG_TESTSET_CFLAG
3074d5d8cc55Smrg
3075111ba1daSmrg# XORG_COMPILER_FLAGS
3076111ba1daSmrg# ---------------
3077111ba1daSmrg# Minimum version: 1.16.0
3078111ba1daSmrg#
3079111ba1daSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
3080111ba1daSmrg# arguments supported by the selected compiler which do NOT alter the generated
3081111ba1daSmrg# code.  These arguments will cause the compiler to print various warnings
3082111ba1daSmrg# during compilation AND turn a conservative set of warnings into errors.
3083111ba1daSmrg#
3084111ba1daSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
3085111ba1daSmrg# future versions of util-macros as options are added to new compilers.
3086111ba1daSmrg#
3087111ba1daSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
3088111ba1daSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3089111ba1daSmrg
3090111ba1daSmrgAC_ARG_ENABLE(selective-werror,
3091111ba1daSmrg              AS_HELP_STRING([--disable-selective-werror],
3092111ba1daSmrg                             [Turn off selective compiler errors. (default: enabled)]),
3093111ba1daSmrg              [SELECTIVE_WERROR=$enableval],
3094111ba1daSmrg              [SELECTIVE_WERROR=yes])
3095111ba1daSmrg
3096111ba1daSmrgAC_LANG_CASE(
3097111ba1daSmrg        [C], [
3098111ba1daSmrg                define([PREFIX], [C])
3099111ba1daSmrg        ],
3100111ba1daSmrg        [C++], [
3101111ba1daSmrg                define([PREFIX], [CXX])
3102111ba1daSmrg        ]
3103111ba1daSmrg)
3104111ba1daSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
3105111ba1daSmrgif test "x$SUNCC" = "xyes"; then
3106111ba1daSmrg    [BASE_]PREFIX[FLAGS]="-v"
3107d5d8cc55Smrgelse
3108111ba1daSmrg    [BASE_]PREFIX[FLAGS]=""
31098ff16396Smrgfi
31108ff16396Smrg
3111111ba1daSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3112111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
3113111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
3114111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
3115111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3116111ba1daSmrg
3117111ba1daSmrgAC_LANG_CASE(
3118111ba1daSmrg	[C], [
3119111ba1daSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
3120111ba1daSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
3121111ba1daSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
3122111ba1daSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
3123111ba1daSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
3124111ba1daSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
3125111ba1daSmrg	]
3126111ba1daSmrg)
31278ff16396Smrg
3128111ba1daSmrg# This chunk adds additional warnings that could catch undesired effects.
3129111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
3130111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
3131111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
3132111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
3133111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
3134111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
3135111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3136111ba1daSmrg
3137111ba1daSmrg# These are currently disabled because they are noisy.  They will be enabled
3138111ba1daSmrg# in the future once the codebase is sufficiently modernized to silence
3139111ba1daSmrg# them.  For now, I don't want them to drown out the other warnings.
3140111ba1daSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3141111ba1daSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3142111ba1daSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3143111ba1daSmrg
3144111ba1daSmrg# Turn some warnings into errors, so we don't accidentally get successful builds
3145111ba1daSmrg# when there are problems that should be fixed.
3146111ba1daSmrg
3147111ba1daSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3148111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3149111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3150111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3151111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3152111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3153111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3154111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3155111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3156111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3157111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3158111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3159111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3160111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3161111ba1daSmrgelse
3162111ba1daSmrgAC_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])
3163111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3164111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3165111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3166111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3167111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3168111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3169111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3170111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3171111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3172111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3173111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3174111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3175111ba1daSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3176111ba1daSmrgfi
31778ff16396Smrg
3178111ba1daSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3179111ba1daSmrg]) # XORG_COMPILER_FLAGS
31808ff16396Smrg
3181111ba1daSmrg# XORG_CWARNFLAGS
3182111ba1daSmrg# ---------------
3183111ba1daSmrg# Minimum version: 1.2.0
3184111ba1daSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3185d5d8cc55Smrg#
3186111ba1daSmrg# Defines CWARNFLAGS to enable C compiler warnings.
3187111ba1daSmrg#
3188111ba1daSmrg# This function is deprecated because it defines -fno-strict-aliasing
3189111ba1daSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3190111ba1daSmrg# is needed, then it should be added explicitly in the module when
3191111ba1daSmrg# it is updated to use BASE_CFLAGS.
3192111ba1daSmrg#
3193111ba1daSmrgAC_DEFUN([XORG_CWARNFLAGS], [
3194111ba1daSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3195111ba1daSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3196111ba1daSmrgAC_LANG_CASE(
3197111ba1daSmrg	[C], [
3198111ba1daSmrg		CWARNFLAGS="$BASE_CFLAGS"
3199111ba1daSmrg		if  test "x$GCC" = xyes ; then
3200111ba1daSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3201111ba1daSmrg		fi
3202111ba1daSmrg		AC_SUBST(CWARNFLAGS)
3203111ba1daSmrg	]
3204111ba1daSmrg)
3205111ba1daSmrg]) # XORG_CWARNFLAGS
32068ff16396Smrg
3207111ba1daSmrg# XORG_STRICT_OPTION
3208111ba1daSmrg# -----------------------
3209111ba1daSmrg# Minimum version: 1.3.0
32108ff16396Smrg#
3211111ba1daSmrg# Add configure option to enable strict compilation flags, such as treating
3212111ba1daSmrg# warnings as fatal errors.
3213111ba1daSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3214111ba1daSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3215111ba1daSmrg#
3216111ba1daSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3217111ba1daSmrg# when strict compilation is unconditionally desired.
3218111ba1daSmrgAC_DEFUN([XORG_STRICT_OPTION], [
3219111ba1daSmrgAC_REQUIRE([XORG_CWARNFLAGS])
3220111ba1daSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3221111ba1daSmrg
3222111ba1daSmrgAC_ARG_ENABLE(strict-compilation,
3223111ba1daSmrg			  AS_HELP_STRING([--enable-strict-compilation],
3224111ba1daSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3225111ba1daSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
32268ff16396Smrg
3227111ba1daSmrgAC_LANG_CASE(
3228111ba1daSmrg        [C], [
3229111ba1daSmrg                define([PREFIX], [C])
3230111ba1daSmrg        ],
3231111ba1daSmrg        [C++], [
3232111ba1daSmrg                define([PREFIX], [CXX])
3233111ba1daSmrg        ]
3234111ba1daSmrg)
32358ff16396Smrg
3236111ba1daSmrg[STRICT_]PREFIX[FLAGS]=""
3237111ba1daSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3238111ba1daSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
32398ff16396Smrg
3240111ba1daSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3241111ba1daSmrg# activate it with -Werror, so we add it here explicitly.
3242111ba1daSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
32438ff16396Smrg
3244111ba1daSmrgif test "x$STRICT_COMPILE" = "xyes"; then
3245111ba1daSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3246111ba1daSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3247111ba1daSmrgfi
3248111ba1daSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3249111ba1daSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3250111ba1daSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3251111ba1daSmrg]) # XORG_STRICT_OPTION
32528ff16396Smrg
3253111ba1daSmrg# XORG_DEFAULT_NOCODE_OPTIONS
3254111ba1daSmrg# ---------------------------
3255111ba1daSmrg# Minimum version: 1.20.0
3256d5d8cc55Smrg#
3257111ba1daSmrg# Defines default options for X.Org modules which don't compile code,
3258111ba1daSmrg# such as fonts, bitmaps, cursors, and docs.
3259111ba1daSmrg#
3260111ba1daSmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
3261111ba1daSmrgAC_REQUIRE([AC_PROG_INSTALL])
3262111ba1daSmrgXORG_RELEASE_VERSION
3263111ba1daSmrgXORG_CHANGELOG
3264111ba1daSmrgXORG_INSTALL
3265111ba1daSmrgXORG_MANPAGE_SECTIONS
3266111ba1daSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3267111ba1daSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3268111ba1daSmrg]) # XORG_DEFAULT_NOCODE_OPTIONS
32698ff16396Smrg
3270111ba1daSmrg# XORG_DEFAULT_OPTIONS
3271d5d8cc55Smrg# --------------------
3272111ba1daSmrg# Minimum version: 1.3.0
3273d5d8cc55Smrg#
3274111ba1daSmrg# Defines default options for X.Org modules which compile code.
3275d5d8cc55Smrg#
3276111ba1daSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3277111ba1daSmrgAC_REQUIRE([AC_PROG_INSTALL])
3278111ba1daSmrgXORG_COMPILER_FLAGS
3279111ba1daSmrgXORG_CWARNFLAGS
3280111ba1daSmrgXORG_STRICT_OPTION
3281111ba1daSmrgXORG_DEFAULT_NOCODE_OPTIONS
3282111ba1daSmrg]) # XORG_DEFAULT_OPTIONS
3283111ba1daSmrg
3284111ba1daSmrg# XORG_INSTALL()
3285111ba1daSmrg# ----------------
3286111ba1daSmrg# Minimum version: 1.4.0
3287111ba1daSmrg#
3288111ba1daSmrg# Defines the variable INSTALL_CMD as the command to copy
3289111ba1daSmrg# INSTALL from $prefix/share/util-macros.
3290111ba1daSmrg#
3291111ba1daSmrgAC_DEFUN([XORG_INSTALL], [
3292111ba1daSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3293111ba1daSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3294111ba1daSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3295111ba1daSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3296111ba1daSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3297111ba1daSmrgtouch \$(top_srcdir)/INSTALL; \
3298111ba1daSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3299111ba1daSmrgAC_SUBST([INSTALL_CMD])
3300111ba1daSmrg]) # XORG_INSTALL
3301111ba1daSmrgdnl Copyright 2005 Red Hat, Inc
3302111ba1daSmrgdnl
3303111ba1daSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3304111ba1daSmrgdnl documentation for any purpose is hereby granted without fee, provided that
3305111ba1daSmrgdnl the above copyright notice appear in all copies and that both that
3306111ba1daSmrgdnl copyright notice and this permission notice appear in supporting
3307111ba1daSmrgdnl documentation.
3308111ba1daSmrgdnl
3309111ba1daSmrgdnl The above copyright notice and this permission notice shall be included
3310111ba1daSmrgdnl in all copies or substantial portions of the Software.
3311111ba1daSmrgdnl
3312111ba1daSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3313111ba1daSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3314111ba1daSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3315111ba1daSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3316111ba1daSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3317111ba1daSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3318111ba1daSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
3319111ba1daSmrgdnl
3320111ba1daSmrgdnl Except as contained in this notice, the name of the copyright holders shall
3321111ba1daSmrgdnl not be used in advertising or otherwise to promote the sale, use or
3322111ba1daSmrgdnl other dealings in this Software without prior written authorization
3323111ba1daSmrgdnl from the copyright holders.
3324111ba1daSmrgdnl
33258ff16396Smrg
3326111ba1daSmrg# XORG_RELEASE_VERSION
3327111ba1daSmrg# --------------------
3328111ba1daSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
33298ff16396Smrg
3330111ba1daSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3331111ba1daSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3332111ba1daSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3333111ba1daSmrg		[Major version of this package])
3334111ba1daSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3335111ba1daSmrg	if test "x$PVM" = "x"; then
3336111ba1daSmrg		PVM="0"
3337111ba1daSmrg	fi
3338111ba1daSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3339111ba1daSmrg		[$PVM],
3340111ba1daSmrg		[Minor version of this package])
3341111ba1daSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3342111ba1daSmrg	if test "x$PVP" = "x"; then
3343111ba1daSmrg		PVP="0"
3344111ba1daSmrg	fi
3345111ba1daSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3346111ba1daSmrg		[$PVP],
3347111ba1daSmrg		[Patch version of this package])
3348111ba1daSmrg])
33498ff16396Smrg
3350111ba1daSmrg# XORG_CHANGELOG()
3351111ba1daSmrg# ----------------
3352111ba1daSmrg# Minimum version: 1.2.0
3353111ba1daSmrg#
3354111ba1daSmrg# Defines the variable CHANGELOG_CMD as the command to generate
3355111ba1daSmrg# ChangeLog from git.
3356111ba1daSmrg#
3357111ba1daSmrg#
3358111ba1daSmrgAC_DEFUN([XORG_CHANGELOG], [
3359111ba1daSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3360111ba1daSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3361111ba1daSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3362111ba1daSmrgtouch \$(top_srcdir)/ChangeLog; \
3363111ba1daSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3364111ba1daSmrgAC_SUBST([CHANGELOG_CMD])
3365111ba1daSmrg]) # XORG_CHANGELOG
33668ff16396Smrg
3367