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