19dd7914aSmrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
25eeb4e8fSmrg
39dd7914aSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4972599cfSmrg
5972599cfSmrg# This file is free software; the Free Software Foundation
6972599cfSmrg# gives unlimited permission to copy and/or distribute it,
7972599cfSmrg# with or without modifications, as long as this notice is preserved.
8972599cfSmrg
9972599cfSmrg# This program is distributed in the hope that it will be useful,
10972599cfSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11972599cfSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12972599cfSmrg# PARTICULAR PURPOSE.
13972599cfSmrg
145eeb4e8fSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15972599cfSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16972599cfSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
179dd7914aSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
189dd7914aSmrg[m4_warning([this file was generated for autoconf 2.72.
19972599cfSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20972599cfSmrgIf you have problems, you may need to regenerate the build system entirely.
215eeb4e8fSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22972599cfSmrg
239dd7914aSmrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
24972599cfSmrg#
25972599cfSmrg# This file is free software; the Free Software Foundation
26972599cfSmrg# gives unlimited permission to copy and/or distribute it,
27972599cfSmrg# with or without modifications, as long as this notice is preserved.
28972599cfSmrg
29972599cfSmrg# AM_AUTOMAKE_VERSION(VERSION)
30972599cfSmrg# ----------------------------
31972599cfSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32972599cfSmrg# generated from the m4 files accompanying Automake X.Y.
33972599cfSmrg# (This private macro should not be called outside this file.)
34972599cfSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
359dd7914aSmrg[am__api_version='1.16'
36972599cfSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37972599cfSmrgdnl require some minimum version.  Point them to the right macro.
389dd7914aSmrgm4_if([$1], [1.16.5], [],
39972599cfSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40972599cfSmrg])
41972599cfSmrg
42972599cfSmrg# _AM_AUTOCONF_VERSION(VERSION)
43972599cfSmrg# -----------------------------
44972599cfSmrg# aclocal traces this macro to find the Autoconf version.
45972599cfSmrg# This is a private macro too.  Using m4_define simplifies
46972599cfSmrg# the logic in aclocal, which can simply ignore this definition.
47972599cfSmrgm4_define([_AM_AUTOCONF_VERSION], [])
48972599cfSmrg
49972599cfSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50972599cfSmrg# -------------------------------
51972599cfSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52972599cfSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53972599cfSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
549dd7914aSmrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
55972599cfSmrgm4_ifndef([AC_AUTOCONF_VERSION],
56972599cfSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57972599cfSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58972599cfSmrg
59972599cfSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60972599cfSmrg
619dd7914aSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
62972599cfSmrg#
63972599cfSmrg# This file is free software; the Free Software Foundation
64972599cfSmrg# gives unlimited permission to copy and/or distribute it,
65972599cfSmrg# with or without modifications, as long as this notice is preserved.
66972599cfSmrg
67972599cfSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
685eeb4e8fSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
695eeb4e8fSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70972599cfSmrg#
71972599cfSmrg# Of course, Automake must honor this variable whenever it calls a
72972599cfSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73972599cfSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74972599cfSmrg# depending on how configure is run.  This is pretty annoying, since
75972599cfSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76972599cfSmrg# source directory, any form will work fine, but in subdirectories a
77972599cfSmrg# relative path needs to be adjusted first.
78972599cfSmrg#
79972599cfSmrg# $ac_aux_dir/missing
80972599cfSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81972599cfSmrg# $top_srcdir/$ac_aux_dir/missing
82972599cfSmrg#    fails if $ac_aux_dir is absolute,
83972599cfSmrg#    fails when called from a subdirectory in a VPATH build with
84972599cfSmrg#          a relative $ac_aux_dir
85972599cfSmrg#
86972599cfSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87972599cfSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
885eeb4e8fSmrg# harmless because $srcdir is '.', but things will broke when you
89972599cfSmrg# start a VPATH build or use an absolute $srcdir.
90972599cfSmrg#
91972599cfSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92972599cfSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93972599cfSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94972599cfSmrg# and then we would define $MISSING as
95972599cfSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96972599cfSmrg# This will work as long as MISSING is not called from configure, because
97972599cfSmrg# unfortunately $(top_srcdir) has no meaning in configure.
98972599cfSmrg# However there are other variables, like CC, which are often used in
99972599cfSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100972599cfSmrg#
101972599cfSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
102972599cfSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
103972599cfSmrg# configured tree to be moved without reconfiguration.
104972599cfSmrg
105972599cfSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1065eeb4e8fSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1075eeb4e8fSmrg# Expand $ac_aux_dir to an absolute path.
1085eeb4e8fSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109972599cfSmrg])
110972599cfSmrg
111972599cfSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112972599cfSmrg
1139dd7914aSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
114972599cfSmrg#
115972599cfSmrg# This file is free software; the Free Software Foundation
116972599cfSmrg# gives unlimited permission to copy and/or distribute it,
117972599cfSmrg# with or without modifications, as long as this notice is preserved.
118972599cfSmrg
119972599cfSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120972599cfSmrg# -------------------------------------
121972599cfSmrg# Define a conditional.
122972599cfSmrgAC_DEFUN([AM_CONDITIONAL],
1235eeb4e8fSmrg[AC_PREREQ([2.52])dnl
1245eeb4e8fSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1255eeb4e8fSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126972599cfSmrgAC_SUBST([$1_TRUE])dnl
127972599cfSmrgAC_SUBST([$1_FALSE])dnl
128972599cfSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129972599cfSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130972599cfSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131972599cfSmrgif $2; then
132972599cfSmrg  $1_TRUE=
133972599cfSmrg  $1_FALSE='#'
134972599cfSmrgelse
135972599cfSmrg  $1_TRUE='#'
136972599cfSmrg  $1_FALSE=
137972599cfSmrgfi
138972599cfSmrgAC_CONFIG_COMMANDS_PRE(
139972599cfSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140972599cfSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141972599cfSmrgUsually this means the macro was only invoked conditionally.]])
142972599cfSmrgfi])])
143972599cfSmrg
144972599cfSmrg# Do all the work for Automake.                             -*- Autoconf -*-
145972599cfSmrg
1469dd7914aSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
147972599cfSmrg#
148972599cfSmrg# This file is free software; the Free Software Foundation
149972599cfSmrg# gives unlimited permission to copy and/or distribute it,
150972599cfSmrg# with or without modifications, as long as this notice is preserved.
151972599cfSmrg
152972599cfSmrg# This macro actually does too much.  Some checks are only needed if
153972599cfSmrg# your package does certain things.  But this isn't really a big deal.
154972599cfSmrg
1555eeb4e8fSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
1565eeb4e8fSmrgm4_define([AC_PROG_CC],
1575eeb4e8fSmrgm4_defn([AC_PROG_CC])
1585eeb4e8fSmrg[_AM_PROG_CC_C_O
1595eeb4e8fSmrg])
1605eeb4e8fSmrg
161972599cfSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
162972599cfSmrg# AM_INIT_AUTOMAKE([OPTIONS])
163972599cfSmrg# -----------------------------------------------
164972599cfSmrg# The call with PACKAGE and VERSION arguments is the old style
165972599cfSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
166972599cfSmrg# and VERSION should now be passed to AC_INIT and removed from
167972599cfSmrg# the call to AM_INIT_AUTOMAKE.
168972599cfSmrg# We support both call styles for the transition.  After
169972599cfSmrg# the next Automake release, Autoconf can make the AC_INIT
170972599cfSmrg# arguments mandatory, and then we can depend on a new Autoconf
171972599cfSmrg# release and drop the old call support.
172972599cfSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
1735eeb4e8fSmrg[AC_PREREQ([2.65])dnl
1749dd7914aSmrgm4_ifdef([_$0_ALREADY_INIT],
1759dd7914aSmrg  [m4_fatal([$0 expanded multiple times
1769dd7914aSmrg]m4_defn([_$0_ALREADY_INIT]))],
1779dd7914aSmrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
178972599cfSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
179972599cfSmrgdnl the ones we care about.
180972599cfSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
181972599cfSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
182972599cfSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
183972599cfSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
184972599cfSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
185972599cfSmrg  # is not polluted with repeated "-I."
186972599cfSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
187972599cfSmrg  # test to see if srcdir already configured
188972599cfSmrg  if test -f $srcdir/config.status; then
189972599cfSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
190972599cfSmrg  fi
191972599cfSmrgfi
192972599cfSmrg
193972599cfSmrg# test whether we have cygpath
194972599cfSmrgif test -z "$CYGPATH_W"; then
195972599cfSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
196972599cfSmrg    CYGPATH_W='cygpath -w'
197972599cfSmrg  else
198972599cfSmrg    CYGPATH_W=echo
199972599cfSmrg  fi
200972599cfSmrgfi
201972599cfSmrgAC_SUBST([CYGPATH_W])
202972599cfSmrg
203972599cfSmrg# Define the identity of the package.
204972599cfSmrgdnl Distinguish between old-style and new-style calls.
205972599cfSmrgm4_ifval([$2],
2065eeb4e8fSmrg[AC_DIAGNOSE([obsolete],
2075eeb4e8fSmrg             [$0: two- and three-arguments forms are deprecated.])
2085eeb4e8fSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
209972599cfSmrg AC_SUBST([PACKAGE], [$1])dnl
210972599cfSmrg AC_SUBST([VERSION], [$2])],
211972599cfSmrg[_AM_SET_OPTIONS([$1])dnl
212972599cfSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
2135eeb4e8fSmrgm4_if(
2149dd7914aSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
2155eeb4e8fSmrg  [ok:ok],,
216972599cfSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
217972599cfSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
218972599cfSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
219972599cfSmrg
220972599cfSmrg_AM_IF_OPTION([no-define],,
2215eeb4e8fSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
2225eeb4e8fSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
223972599cfSmrg
224972599cfSmrg# Some tools Automake needs.
225972599cfSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
226972599cfSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
2275eeb4e8fSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
2285eeb4e8fSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
2295eeb4e8fSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
2305eeb4e8fSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
2315eeb4e8fSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
232972599cfSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
233972599cfSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
2345eeb4e8fSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
2355eeb4e8fSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
2365eeb4e8fSmrg# dies out for good.  For more background, see:
2379dd7914aSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
2389dd7914aSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
2395eeb4e8fSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
2405eeb4e8fSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
2415eeb4e8fSmrg# system "awk" is bad on some platforms.
242972599cfSmrgAC_REQUIRE([AC_PROG_AWK])dnl
243972599cfSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
244972599cfSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
245972599cfSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
246972599cfSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
247972599cfSmrg			     [_AM_PROG_TAR([v7])])])
248972599cfSmrg_AM_IF_OPTION([no-dependencies],,
249972599cfSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
2505eeb4e8fSmrg		  [_AM_DEPENDENCIES([CC])],
2515eeb4e8fSmrg		  [m4_define([AC_PROG_CC],
2525eeb4e8fSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
253972599cfSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
2545eeb4e8fSmrg		  [_AM_DEPENDENCIES([CXX])],
2555eeb4e8fSmrg		  [m4_define([AC_PROG_CXX],
2565eeb4e8fSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
257972599cfSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
2585eeb4e8fSmrg		  [_AM_DEPENDENCIES([OBJC])],
2595eeb4e8fSmrg		  [m4_define([AC_PROG_OBJC],
2605eeb4e8fSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
2615eeb4e8fSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
2625eeb4e8fSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
2635eeb4e8fSmrg		  [m4_define([AC_PROG_OBJCXX],
2645eeb4e8fSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
265972599cfSmrg])
2669dd7914aSmrg# Variables for tags utilities; see am/tags.am
2679dd7914aSmrgif test -z "$CTAGS"; then
2689dd7914aSmrg  CTAGS=ctags
2699dd7914aSmrgfi
2709dd7914aSmrgAC_SUBST([CTAGS])
2719dd7914aSmrgif test -z "$ETAGS"; then
2729dd7914aSmrg  ETAGS=etags
2739dd7914aSmrgfi
2749dd7914aSmrgAC_SUBST([ETAGS])
2759dd7914aSmrgif test -z "$CSCOPE"; then
2769dd7914aSmrg  CSCOPE=cscope
2779dd7914aSmrgfi
2789dd7914aSmrgAC_SUBST([CSCOPE])
2799dd7914aSmrg
2805eeb4e8fSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
2815eeb4e8fSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
2825eeb4e8fSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
2835eeb4e8fSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
284972599cfSmrgAC_CONFIG_COMMANDS_PRE(dnl
285972599cfSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
286972599cfSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2875eeb4e8fSmrg
2885eeb4e8fSmrg# POSIX will say in a future version that running "rm -f" with no argument
2895eeb4e8fSmrg# is OK; and we want to be able to make that assumption in our Makefile
2905eeb4e8fSmrg# recipes.  So use an aggressive probe to check that the usage we want is
2915eeb4e8fSmrg# actually supported "in the wild" to an acceptable degree.
2925eeb4e8fSmrg# See automake bug#10828.
2935eeb4e8fSmrg# To make any issue more visible, cause the running configure to be aborted
2945eeb4e8fSmrg# by default if the 'rm' program in use doesn't match our expectations; the
2955eeb4e8fSmrg# user can still override this though.
2965eeb4e8fSmrgif rm -f && rm -fr && rm -rf; then : OK; else
2975eeb4e8fSmrg  cat >&2 <<'END'
2985eeb4e8fSmrgOops!
2995eeb4e8fSmrg
3005eeb4e8fSmrgYour 'rm' program seems unable to run without file operands specified
3015eeb4e8fSmrgon the command line, even when the '-f' option is present.  This is contrary
3025eeb4e8fSmrgto the behaviour of most rm programs out there, and not conforming with
3035eeb4e8fSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
3045eeb4e8fSmrg
3055eeb4e8fSmrgPlease tell bug-automake@gnu.org about your system, including the value
3065eeb4e8fSmrgof your $PATH and any error possibly output before this message.  This
3075eeb4e8fSmrgcan help us improve future automake versions.
3085eeb4e8fSmrg
3095eeb4e8fSmrgEND
3105eeb4e8fSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
3115eeb4e8fSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
3125eeb4e8fSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
3135eeb4e8fSmrg    echo >&2
3145eeb4e8fSmrg  else
3155eeb4e8fSmrg    cat >&2 <<'END'
3165eeb4e8fSmrgAborting the configuration process, to ensure you take notice of the issue.
3175eeb4e8fSmrg
3185eeb4e8fSmrgYou can download and install GNU coreutils to get an 'rm' implementation
3199dd7914aSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
3205eeb4e8fSmrg
3215eeb4e8fSmrgIf you want to complete the configuration process using your problematic
3225eeb4e8fSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
3235eeb4e8fSmrgto "yes", and re-run configure.
3245eeb4e8fSmrg
3255eeb4e8fSmrgEND
3265eeb4e8fSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
3275eeb4e8fSmrg  fi
3285eeb4e8fSmrgfi
3295eeb4e8fSmrgdnl The trailing newline in this macro's definition is deliberate, for
3305eeb4e8fSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
3315eeb4e8fSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
332972599cfSmrg])
333972599cfSmrg
3345eeb4e8fSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
335972599cfSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
336972599cfSmrgdnl mangled by Autoconf and run in a shell conditional statement.
337972599cfSmrgm4_define([_AC_COMPILER_EXEEXT],
338972599cfSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
339972599cfSmrg
340972599cfSmrg# When config.status generates a header, we must update the stamp-h file.
341972599cfSmrg# This file resides in the same directory as the config header
342972599cfSmrg# that is generated.  The stamp files are numbered to have different names.
343972599cfSmrg
344972599cfSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
345972599cfSmrg# loop where config.status creates the headers, so we can generate
346972599cfSmrg# our stamp files there.
347972599cfSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
348972599cfSmrg[# Compute $1's index in $config_headers.
349972599cfSmrg_am_arg=$1
350972599cfSmrg_am_stamp_count=1
351972599cfSmrgfor _am_header in $config_headers :; do
352972599cfSmrg  case $_am_header in
353972599cfSmrg    $_am_arg | $_am_arg:* )
354972599cfSmrg      break ;;
355972599cfSmrg    * )
356972599cfSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
357972599cfSmrg  esac
358972599cfSmrgdone
359972599cfSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
360972599cfSmrg
3619dd7914aSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
362972599cfSmrg#
363972599cfSmrg# This file is free software; the Free Software Foundation
364972599cfSmrg# gives unlimited permission to copy and/or distribute it,
365972599cfSmrg# with or without modifications, as long as this notice is preserved.
366972599cfSmrg
367972599cfSmrg# AM_PROG_INSTALL_SH
368972599cfSmrg# ------------------
369972599cfSmrg# Define $install_sh.
370972599cfSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
371972599cfSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
3725eeb4e8fSmrgif test x"${install_sh+set}" != xset; then
373972599cfSmrg  case $am_aux_dir in
374972599cfSmrg  *\ * | *\	*)
375972599cfSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
376972599cfSmrg  *)
377972599cfSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
378972599cfSmrg  esac
379972599cfSmrgfi
3805eeb4e8fSmrgAC_SUBST([install_sh])])
381972599cfSmrg
3829dd7914aSmrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
383972599cfSmrg#
384972599cfSmrg# This file is free software; the Free Software Foundation
385972599cfSmrg# gives unlimited permission to copy and/or distribute it,
386972599cfSmrg# with or without modifications, as long as this notice is preserved.
387972599cfSmrg
388972599cfSmrg# Check whether the underlying file-system supports filenames
389972599cfSmrg# with a leading dot.  For instance MS-DOS doesn't.
390972599cfSmrgAC_DEFUN([AM_SET_LEADING_DOT],
391972599cfSmrg[rm -rf .tst 2>/dev/null
392972599cfSmrgmkdir .tst 2>/dev/null
393972599cfSmrgif test -d .tst; then
394972599cfSmrg  am__leading_dot=.
395972599cfSmrgelse
396972599cfSmrg  am__leading_dot=_
397972599cfSmrgfi
398972599cfSmrgrmdir .tst 2>/dev/null
399972599cfSmrgAC_SUBST([am__leading_dot])])
400972599cfSmrg
401972599cfSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
402972599cfSmrg
4039dd7914aSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
404972599cfSmrg#
405972599cfSmrg# This file is free software; the Free Software Foundation
406972599cfSmrg# gives unlimited permission to copy and/or distribute it,
407972599cfSmrg# with or without modifications, as long as this notice is preserved.
408972599cfSmrg
409972599cfSmrg# AM_MISSING_PROG(NAME, PROGRAM)
410972599cfSmrg# ------------------------------
411972599cfSmrgAC_DEFUN([AM_MISSING_PROG],
412972599cfSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
413972599cfSmrg$1=${$1-"${am_missing_run}$2"}
414972599cfSmrgAC_SUBST($1)])
415972599cfSmrg
416972599cfSmrg# AM_MISSING_HAS_RUN
417972599cfSmrg# ------------------
4185eeb4e8fSmrg# Define MISSING if not defined so far and test if it is modern enough.
4195eeb4e8fSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
420972599cfSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
421972599cfSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
422972599cfSmrgAC_REQUIRE_AUX_FILE([missing])dnl
423972599cfSmrgif test x"${MISSING+set}" != xset; then
4249dd7914aSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
425972599cfSmrgfi
426972599cfSmrg# Use eval to expand $SHELL
4275eeb4e8fSmrgif eval "$MISSING --is-lightweight"; then
4285eeb4e8fSmrg  am_missing_run="$MISSING "
429972599cfSmrgelse
430972599cfSmrg  am_missing_run=
4315eeb4e8fSmrg  AC_MSG_WARN(['missing' script is too old or missing])
432972599cfSmrgfi
433972599cfSmrg])
434972599cfSmrg
435972599cfSmrg# Helper functions for option handling.                     -*- Autoconf -*-
436972599cfSmrg
4379dd7914aSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
438972599cfSmrg#
439972599cfSmrg# This file is free software; the Free Software Foundation
440972599cfSmrg# gives unlimited permission to copy and/or distribute it,
441972599cfSmrg# with or without modifications, as long as this notice is preserved.
442972599cfSmrg
443972599cfSmrg# _AM_MANGLE_OPTION(NAME)
444972599cfSmrg# -----------------------
445972599cfSmrgAC_DEFUN([_AM_MANGLE_OPTION],
446972599cfSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
447972599cfSmrg
448972599cfSmrg# _AM_SET_OPTION(NAME)
449972599cfSmrg# --------------------
450972599cfSmrg# Set option NAME.  Presently that only means defining a flag for this option.
451972599cfSmrgAC_DEFUN([_AM_SET_OPTION],
4525eeb4e8fSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
453972599cfSmrg
454972599cfSmrg# _AM_SET_OPTIONS(OPTIONS)
455972599cfSmrg# ------------------------
456972599cfSmrg# OPTIONS is a space-separated list of Automake options.
457972599cfSmrgAC_DEFUN([_AM_SET_OPTIONS],
458972599cfSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
459972599cfSmrg
460972599cfSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
461972599cfSmrg# -------------------------------------------
462972599cfSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
463972599cfSmrgAC_DEFUN([_AM_IF_OPTION],
464972599cfSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
465972599cfSmrg
4665eeb4e8fSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
4675eeb4e8fSmrg
4689dd7914aSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4695eeb4e8fSmrg#
4705eeb4e8fSmrg# This file is free software; the Free Software Foundation
4715eeb4e8fSmrg# gives unlimited permission to copy and/or distribute it,
4725eeb4e8fSmrg# with or without modifications, as long as this notice is preserved.
473972599cfSmrg
474972599cfSmrg# AM_SANITY_CHECK
475972599cfSmrg# ---------------
476972599cfSmrgAC_DEFUN([AM_SANITY_CHECK],
477972599cfSmrg[AC_MSG_CHECKING([whether build environment is sane])
478972599cfSmrg# Reject unsafe characters in $srcdir or the absolute working directory
479972599cfSmrg# name.  Accept space and tab only in the latter.
480972599cfSmrgam_lf='
481972599cfSmrg'
482972599cfSmrgcase `pwd` in
483972599cfSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
484972599cfSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
485972599cfSmrgesac
486972599cfSmrgcase $srcdir in
487972599cfSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
4885eeb4e8fSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
489972599cfSmrgesac
490972599cfSmrg
4915eeb4e8fSmrg# Do 'set' in a subshell so we don't clobber the current shell's
492972599cfSmrg# arguments.  Must try -L first in case configure is actually a
493972599cfSmrg# symlink; some systems play weird games with the mod time of symlinks
494972599cfSmrg# (eg FreeBSD returns the mod time of the symlink's containing
495972599cfSmrg# directory).
496972599cfSmrgif (
4975eeb4e8fSmrg   am_has_slept=no
4985eeb4e8fSmrg   for am_try in 1 2; do
4995eeb4e8fSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
5005eeb4e8fSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
5015eeb4e8fSmrg     if test "$[*]" = "X"; then
5025eeb4e8fSmrg	# -L didn't work.
5035eeb4e8fSmrg	set X `ls -t "$srcdir/configure" conftest.file`
5045eeb4e8fSmrg     fi
5055eeb4e8fSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
5065eeb4e8fSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
5075eeb4e8fSmrg
5085eeb4e8fSmrg	# If neither matched, then we have a broken ls.  This can happen
5095eeb4e8fSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
5105eeb4e8fSmrg	# broken ls alias from the environment.  This has actually
5115eeb4e8fSmrg	# happened.  Such a system could not be considered "sane".
5125eeb4e8fSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
5135eeb4e8fSmrg  alias in your environment])
5145eeb4e8fSmrg     fi
5155eeb4e8fSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
5165eeb4e8fSmrg       break
5175eeb4e8fSmrg     fi
5185eeb4e8fSmrg     # Just in case.
5195eeb4e8fSmrg     sleep 1
5205eeb4e8fSmrg     am_has_slept=yes
5215eeb4e8fSmrg   done
522972599cfSmrg   test "$[2]" = conftest.file
523972599cfSmrg   )
524972599cfSmrgthen
525972599cfSmrg   # Ok.
526972599cfSmrg   :
527972599cfSmrgelse
528972599cfSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
529972599cfSmrgCheck your system clock])
530972599cfSmrgfi
5315eeb4e8fSmrgAC_MSG_RESULT([yes])
5325eeb4e8fSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
5335eeb4e8fSmrg# generated files are strictly newer.
5345eeb4e8fSmrgam_sleep_pid=
5355eeb4e8fSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
5365eeb4e8fSmrg  ( sleep 1 ) &
5375eeb4e8fSmrg  am_sleep_pid=$!
5385eeb4e8fSmrgfi
5395eeb4e8fSmrgAC_CONFIG_COMMANDS_PRE(
5405eeb4e8fSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
5415eeb4e8fSmrg   if test -n "$am_sleep_pid"; then
5425eeb4e8fSmrg     # Hide warnings about reused PIDs.
5435eeb4e8fSmrg     wait $am_sleep_pid 2>/dev/null
5445eeb4e8fSmrg   fi
5455eeb4e8fSmrg   AC_MSG_RESULT([done])])
5465eeb4e8fSmrgrm -f conftest.file
5475eeb4e8fSmrg])
548972599cfSmrg
5499dd7914aSmrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
550972599cfSmrg#
551972599cfSmrg# This file is free software; the Free Software Foundation
552972599cfSmrg# gives unlimited permission to copy and/or distribute it,
553972599cfSmrg# with or without modifications, as long as this notice is preserved.
554972599cfSmrg
555972599cfSmrg# AM_SILENT_RULES([DEFAULT])
556972599cfSmrg# --------------------------
557972599cfSmrg# Enable less verbose build rules; with the default set to DEFAULT
5585eeb4e8fSmrg# ("yes" being less verbose, "no" or empty being verbose).
559972599cfSmrgAC_DEFUN([AM_SILENT_RULES],
5605eeb4e8fSmrg[AC_ARG_ENABLE([silent-rules], [dnl
5615eeb4e8fSmrgAS_HELP_STRING(
5625eeb4e8fSmrg  [--enable-silent-rules],
5635eeb4e8fSmrg  [less verbose build output (undo: "make V=1")])
5645eeb4e8fSmrgAS_HELP_STRING(
5655eeb4e8fSmrg  [--disable-silent-rules],
5665eeb4e8fSmrg  [verbose build output (undo: "make V=0")])dnl
5675eeb4e8fSmrg])
5685eeb4e8fSmrgcase $enable_silent_rules in @%:@ (((
5695eeb4e8fSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
5705eeb4e8fSmrg   no) AM_DEFAULT_VERBOSITY=1;;
5715eeb4e8fSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
572972599cfSmrgesac
5735eeb4e8fSmrgdnl
5745eeb4e8fSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
5755eeb4e8fSmrgdnl do not support nested variable expansions.
5765eeb4e8fSmrgdnl See automake bug#9928 and bug#10237.
5775eeb4e8fSmrgam_make=${MAKE-make}
5785eeb4e8fSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
5795eeb4e8fSmrg   [am_cv_make_support_nested_variables],
5805eeb4e8fSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
5815eeb4e8fSmrgBAR0=false
5825eeb4e8fSmrgBAR1=true
5835eeb4e8fSmrgV=1
5845eeb4e8fSmrgam__doit:
5855eeb4e8fSmrg	@$(TRUE)
5865eeb4e8fSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
5875eeb4e8fSmrg  am_cv_make_support_nested_variables=yes
5885eeb4e8fSmrgelse
5895eeb4e8fSmrg  am_cv_make_support_nested_variables=no
5905eeb4e8fSmrgfi])
5915eeb4e8fSmrgif test $am_cv_make_support_nested_variables = yes; then
5925eeb4e8fSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
5935eeb4e8fSmrg  AM_V='$(V)'
5945eeb4e8fSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
5955eeb4e8fSmrgelse
5965eeb4e8fSmrg  AM_V=$AM_DEFAULT_VERBOSITY
5975eeb4e8fSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
5985eeb4e8fSmrgfi
5995eeb4e8fSmrgAC_SUBST([AM_V])dnl
6005eeb4e8fSmrgAM_SUBST_NOTMAKE([AM_V])dnl
6015eeb4e8fSmrgAC_SUBST([AM_DEFAULT_V])dnl
6025eeb4e8fSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
603972599cfSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
604972599cfSmrgAM_BACKSLASH='\'
605972599cfSmrgAC_SUBST([AM_BACKSLASH])dnl
606972599cfSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
607972599cfSmrg])
608972599cfSmrg
6099dd7914aSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
610972599cfSmrg#
611972599cfSmrg# This file is free software; the Free Software Foundation
612972599cfSmrg# gives unlimited permission to copy and/or distribute it,
613972599cfSmrg# with or without modifications, as long as this notice is preserved.
614972599cfSmrg
615972599cfSmrg# AM_PROG_INSTALL_STRIP
616972599cfSmrg# ---------------------
6175eeb4e8fSmrg# One issue with vendor 'install' (even GNU) is that you can't
618972599cfSmrg# specify the program used to strip binaries.  This is especially
619972599cfSmrg# annoying in cross-compiling environments, where the build's strip
620972599cfSmrg# is unlikely to handle the host's binaries.
621972599cfSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
6225eeb4e8fSmrg# always use install-sh in "make install-strip", and initialize
623972599cfSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
624972599cfSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
625972599cfSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
6265eeb4e8fSmrg# Installed binaries are usually stripped using 'strip' when the user
6275eeb4e8fSmrg# run "make install-strip".  However 'strip' might not be the right
628972599cfSmrg# tool to use in cross-compilation environments, therefore Automake
6295eeb4e8fSmrg# will honor the 'STRIP' environment variable to overrule this program.
6305eeb4e8fSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
631972599cfSmrgif test "$cross_compiling" != no; then
632972599cfSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
633972599cfSmrgfi
634972599cfSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
635972599cfSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
636972599cfSmrg
6379dd7914aSmrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
638972599cfSmrg#
639972599cfSmrg# This file is free software; the Free Software Foundation
640972599cfSmrg# gives unlimited permission to copy and/or distribute it,
641972599cfSmrg# with or without modifications, as long as this notice is preserved.
642972599cfSmrg
643972599cfSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
644972599cfSmrg# ---------------------------
645972599cfSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
646972599cfSmrg# This macro is traced by Automake.
647972599cfSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
648972599cfSmrg
649972599cfSmrg# AM_SUBST_NOTMAKE(VARIABLE)
650972599cfSmrg# --------------------------
651972599cfSmrg# Public sister of _AM_SUBST_NOTMAKE.
652972599cfSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
653972599cfSmrg
654972599cfSmrg# Check how to create a tarball.                            -*- Autoconf -*-
655972599cfSmrg
6569dd7914aSmrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
657972599cfSmrg#
658972599cfSmrg# This file is free software; the Free Software Foundation
659972599cfSmrg# gives unlimited permission to copy and/or distribute it,
660972599cfSmrg# with or without modifications, as long as this notice is preserved.
661972599cfSmrg
662972599cfSmrg# _AM_PROG_TAR(FORMAT)
663972599cfSmrg# --------------------
664972599cfSmrg# Check how to create a tarball in format FORMAT.
6655eeb4e8fSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
666972599cfSmrg#
667972599cfSmrg# Substitute a variable $(am__tar) that is a command
668972599cfSmrg# writing to stdout a FORMAT-tarball containing the directory
669972599cfSmrg# $tardir.
670972599cfSmrg#     tardir=directory && $(am__tar) > result.tar
671972599cfSmrg#
672972599cfSmrg# Substitute a variable $(am__untar) that extract such
673972599cfSmrg# a tarball read from stdin.
674972599cfSmrg#     $(am__untar) < result.tar
6755eeb4e8fSmrg#
676972599cfSmrgAC_DEFUN([_AM_PROG_TAR],
6775eeb4e8fSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
6785eeb4e8fSmrg# in the wild :-(  We should find a proper way to deprecate it ...
6795eeb4e8fSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
6805eeb4e8fSmrg
6815eeb4e8fSmrg# We'll loop over all known methods to create a tar archive until one works.
682972599cfSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
683972599cfSmrg
6845eeb4e8fSmrgm4_if([$1], [v7],
6855eeb4e8fSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
6865eeb4e8fSmrg
6875eeb4e8fSmrg  [m4_case([$1],
6885eeb4e8fSmrg    [ustar],
6895eeb4e8fSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
6905eeb4e8fSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
6915eeb4e8fSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
6925eeb4e8fSmrg      # and bug#13588).
6935eeb4e8fSmrg      am_max_uid=2097151 # 2^21 - 1
6945eeb4e8fSmrg      am_max_gid=$am_max_uid
6955eeb4e8fSmrg      # The $UID and $GID variables are not portable, so we need to resort
6965eeb4e8fSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
6975eeb4e8fSmrg      # below are definitely unexpected, so allow the users to see them
6985eeb4e8fSmrg      # (that is, avoid stderr redirection).
6995eeb4e8fSmrg      am_uid=`id -u || echo unknown`
7005eeb4e8fSmrg      am_gid=`id -g || echo unknown`
7015eeb4e8fSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
7025eeb4e8fSmrg      if test $am_uid -le $am_max_uid; then
7035eeb4e8fSmrg         AC_MSG_RESULT([yes])
7045eeb4e8fSmrg      else
7055eeb4e8fSmrg         AC_MSG_RESULT([no])
7065eeb4e8fSmrg         _am_tools=none
7075eeb4e8fSmrg      fi
7085eeb4e8fSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
7095eeb4e8fSmrg      if test $am_gid -le $am_max_gid; then
7105eeb4e8fSmrg         AC_MSG_RESULT([yes])
7115eeb4e8fSmrg      else
7125eeb4e8fSmrg        AC_MSG_RESULT([no])
7135eeb4e8fSmrg        _am_tools=none
7145eeb4e8fSmrg      fi],
7155eeb4e8fSmrg
7165eeb4e8fSmrg  [pax],
7175eeb4e8fSmrg    [],
7185eeb4e8fSmrg
7195eeb4e8fSmrg  [m4_fatal([Unknown tar format])])
7205eeb4e8fSmrg
7215eeb4e8fSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
7225eeb4e8fSmrg
7235eeb4e8fSmrg  # Go ahead even if we have the value already cached.  We do so because we
7245eeb4e8fSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
7255eeb4e8fSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
7265eeb4e8fSmrg
7275eeb4e8fSmrg  for _am_tool in $_am_tools; do
7285eeb4e8fSmrg    case $_am_tool in
7295eeb4e8fSmrg    gnutar)
7305eeb4e8fSmrg      for _am_tar in tar gnutar gtar; do
7315eeb4e8fSmrg        AM_RUN_LOG([$_am_tar --version]) && break
7325eeb4e8fSmrg      done
7335eeb4e8fSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
7345eeb4e8fSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
7355eeb4e8fSmrg      am__untar="$_am_tar -xf -"
7365eeb4e8fSmrg      ;;
7375eeb4e8fSmrg    plaintar)
7385eeb4e8fSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
7395eeb4e8fSmrg      # ustar tarball either.
7405eeb4e8fSmrg      (tar --version) >/dev/null 2>&1 && continue
7415eeb4e8fSmrg      am__tar='tar chf - "$$tardir"'
7425eeb4e8fSmrg      am__tar_='tar chf - "$tardir"'
7435eeb4e8fSmrg      am__untar='tar xf -'
7445eeb4e8fSmrg      ;;
7455eeb4e8fSmrg    pax)
7465eeb4e8fSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
7475eeb4e8fSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
7485eeb4e8fSmrg      am__untar='pax -r'
7495eeb4e8fSmrg      ;;
7505eeb4e8fSmrg    cpio)
7515eeb4e8fSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
7525eeb4e8fSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
7535eeb4e8fSmrg      am__untar='cpio -i -H $1 -d'
7545eeb4e8fSmrg      ;;
7555eeb4e8fSmrg    none)
7565eeb4e8fSmrg      am__tar=false
7575eeb4e8fSmrg      am__tar_=false
7585eeb4e8fSmrg      am__untar=false
7595eeb4e8fSmrg      ;;
7605eeb4e8fSmrg    esac
761972599cfSmrg
7625eeb4e8fSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
7635eeb4e8fSmrg    # and am__untar set.
7645eeb4e8fSmrg    test -n "${am_cv_prog_tar_$1}" && break
7655eeb4e8fSmrg
7665eeb4e8fSmrg    # tar/untar a dummy directory, and stop if the command works.
7675eeb4e8fSmrg    rm -rf conftest.dir
7685eeb4e8fSmrg    mkdir conftest.dir
7695eeb4e8fSmrg    echo GrepMe > conftest.dir/file
7705eeb4e8fSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
7715eeb4e8fSmrg    rm -rf conftest.dir
7725eeb4e8fSmrg    if test -s conftest.tar; then
7735eeb4e8fSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
7745eeb4e8fSmrg      AM_RUN_LOG([cat conftest.dir/file])
7755eeb4e8fSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
7765eeb4e8fSmrg    fi
7775eeb4e8fSmrg  done
778972599cfSmrg  rm -rf conftest.dir
779972599cfSmrg
7805eeb4e8fSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
7815eeb4e8fSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
7825eeb4e8fSmrg
783972599cfSmrgAC_SUBST([am__tar])
784972599cfSmrgAC_SUBST([am__untar])
785972599cfSmrg]) # _AM_PROG_TAR
786972599cfSmrg
7879dd7914aSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
7889dd7914aSmrgdnl serial 11 (pkg-config-0.29)
7899dd7914aSmrgdnl
7909dd7914aSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
7919dd7914aSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
7929dd7914aSmrgdnl
7939dd7914aSmrgdnl This program is free software; you can redistribute it and/or modify
7949dd7914aSmrgdnl it under the terms of the GNU General Public License as published by
7959dd7914aSmrgdnl the Free Software Foundation; either version 2 of the License, or
7969dd7914aSmrgdnl (at your option) any later version.
7979dd7914aSmrgdnl
7989dd7914aSmrgdnl This program is distributed in the hope that it will be useful, but
7999dd7914aSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
8009dd7914aSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8019dd7914aSmrgdnl General Public License for more details.
8029dd7914aSmrgdnl
8039dd7914aSmrgdnl You should have received a copy of the GNU General Public License
8049dd7914aSmrgdnl along with this program; if not, write to the Free Software
8059dd7914aSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
8069dd7914aSmrgdnl 02111-1307, USA.
8079dd7914aSmrgdnl
8089dd7914aSmrgdnl As a special exception to the GNU General Public License, if you
8099dd7914aSmrgdnl distribute this file as part of a program that contains a
8109dd7914aSmrgdnl configuration script generated by Autoconf, you may include it under
8119dd7914aSmrgdnl the same distribution terms that you use for the rest of that
8129dd7914aSmrgdnl program.
8139dd7914aSmrg
8149dd7914aSmrgdnl PKG_PREREQ(MIN-VERSION)
8159dd7914aSmrgdnl -----------------------
8169dd7914aSmrgdnl Since: 0.29
8179dd7914aSmrgdnl
8189dd7914aSmrgdnl Verify that the version of the pkg-config macros are at least
8199dd7914aSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
8209dd7914aSmrgdnl installed version of pkg-config, this checks the developer's version
8219dd7914aSmrgdnl of pkg.m4 when generating configure.
8229dd7914aSmrgdnl
8239dd7914aSmrgdnl To ensure that this macro is defined, also add:
8249dd7914aSmrgdnl m4_ifndef([PKG_PREREQ],
8259dd7914aSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
8269dd7914aSmrgdnl
8279dd7914aSmrgdnl See the "Since" comment for each macro you use to see what version
8289dd7914aSmrgdnl of the macros you require.
8299dd7914aSmrgm4_defun([PKG_PREREQ],
8309dd7914aSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
8319dd7914aSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
8329dd7914aSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
8339dd7914aSmrg])dnl PKG_PREREQ
8349dd7914aSmrg
8359dd7914aSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
8369dd7914aSmrgdnl ----------------------------------
8379dd7914aSmrgdnl Since: 0.16
8389dd7914aSmrgdnl
8399dd7914aSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
8409dd7914aSmrgdnl first found in the path. Checks that the version of pkg-config found
8419dd7914aSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
8429dd7914aSmrgdnl used since that's the first version where most current features of
8439dd7914aSmrgdnl pkg-config existed.
844972599cfSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
845972599cfSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
8469dd7914aSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
8479dd7914aSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
8489dd7914aSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
8499dd7914aSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
8509dd7914aSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
8519dd7914aSmrg
852972599cfSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
853972599cfSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
854972599cfSmrgfi
855972599cfSmrgif test -n "$PKG_CONFIG"; then
856972599cfSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
857972599cfSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
858972599cfSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
859972599cfSmrg		AC_MSG_RESULT([yes])
860972599cfSmrg	else
861972599cfSmrg		AC_MSG_RESULT([no])
862972599cfSmrg		PKG_CONFIG=""
863972599cfSmrg	fi
864972599cfSmrgfi[]dnl
8659dd7914aSmrg])dnl PKG_PROG_PKG_CONFIG
866972599cfSmrg
8679dd7914aSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
8689dd7914aSmrgdnl -------------------------------------------------------------------
8699dd7914aSmrgdnl Since: 0.18
8709dd7914aSmrgdnl
8719dd7914aSmrgdnl Check to see whether a particular set of modules exists. Similar to
8729dd7914aSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
8739dd7914aSmrgdnl
8749dd7914aSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
8759dd7914aSmrgdnl only at the first occurence in configure.ac, so if the first place
8769dd7914aSmrgdnl it's called might be skipped (such as if it is within an "if", you
8779dd7914aSmrgdnl have to call PKG_CHECK_EXISTS manually
878972599cfSmrgAC_DEFUN([PKG_CHECK_EXISTS],
879972599cfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
880972599cfSmrgif test -n "$PKG_CONFIG" && \
881972599cfSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
8829dd7914aSmrg  m4_default([$2], [:])
883972599cfSmrgm4_ifvaln([$3], [else
884972599cfSmrg  $3])dnl
885972599cfSmrgfi])
886972599cfSmrg
8879dd7914aSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
8889dd7914aSmrgdnl ---------------------------------------------
8899dd7914aSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
8909dd7914aSmrgdnl pkg_failed based on the result.
891972599cfSmrgm4_define([_PKG_CONFIG],
892972599cfSmrg[if test -n "$$1"; then
893972599cfSmrg    pkg_cv_[]$1="$$1"
894972599cfSmrg elif test -n "$PKG_CONFIG"; then
895972599cfSmrg    PKG_CHECK_EXISTS([$3],
8969dd7914aSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
8979dd7914aSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
898972599cfSmrg		     [pkg_failed=yes])
899972599cfSmrg else
900972599cfSmrg    pkg_failed=untried
901972599cfSmrgfi[]dnl
9029dd7914aSmrg])dnl _PKG_CONFIG
903972599cfSmrg
9049dd7914aSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
9059dd7914aSmrgdnl ---------------------------
9069dd7914aSmrgdnl Internal check to see if pkg-config supports short errors.
907972599cfSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
908972599cfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
909972599cfSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
910972599cfSmrg        _pkg_short_errors_supported=yes
911972599cfSmrgelse
912972599cfSmrg        _pkg_short_errors_supported=no
913972599cfSmrgfi[]dnl
9149dd7914aSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
915972599cfSmrg
916972599cfSmrg
9179dd7914aSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
9189dd7914aSmrgdnl   [ACTION-IF-NOT-FOUND])
9199dd7914aSmrgdnl --------------------------------------------------------------
9209dd7914aSmrgdnl Since: 0.4.0
9219dd7914aSmrgdnl
9229dd7914aSmrgdnl Note that if there is a possibility the first call to
9239dd7914aSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
9249dd7914aSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
925972599cfSmrgAC_DEFUN([PKG_CHECK_MODULES],
926972599cfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
927972599cfSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
928972599cfSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
929972599cfSmrg
930972599cfSmrgpkg_failed=no
931972599cfSmrgAC_MSG_CHECKING([for $1])
932972599cfSmrg
933972599cfSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
934972599cfSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
935972599cfSmrg
936972599cfSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
937972599cfSmrgand $1[]_LIBS to avoid the need to call pkg-config.
938972599cfSmrgSee the pkg-config man page for more details.])
939972599cfSmrg
940972599cfSmrgif test $pkg_failed = yes; then
9419dd7914aSmrg   	AC_MSG_RESULT([no])
942972599cfSmrg        _PKG_SHORT_ERRORS_SUPPORTED
943972599cfSmrg        if test $_pkg_short_errors_supported = yes; then
9449dd7914aSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
945972599cfSmrg        else 
9469dd7914aSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
947972599cfSmrg        fi
948972599cfSmrg	# Put the nasty error message in config.log where it belongs
949972599cfSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
950972599cfSmrg
9519dd7914aSmrg	m4_default([$4], [AC_MSG_ERROR(
952972599cfSmrg[Package requirements ($2) were not met:
953972599cfSmrg
954972599cfSmrg$$1_PKG_ERRORS
955972599cfSmrg
956972599cfSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
957972599cfSmrginstalled software in a non-standard prefix.
958972599cfSmrg
9599dd7914aSmrg_PKG_TEXT])[]dnl
9609dd7914aSmrg        ])
961972599cfSmrgelif test $pkg_failed = untried; then
9629dd7914aSmrg     	AC_MSG_RESULT([no])
9639dd7914aSmrg	m4_default([$4], [AC_MSG_FAILURE(
964972599cfSmrg[The pkg-config script could not be found or is too old.  Make sure it
965972599cfSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
966972599cfSmrgpath to pkg-config.
967972599cfSmrg
968972599cfSmrg_PKG_TEXT
969972599cfSmrg
9709dd7914aSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
9719dd7914aSmrg        ])
972972599cfSmrgelse
973972599cfSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
974972599cfSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
975972599cfSmrg        AC_MSG_RESULT([yes])
9769dd7914aSmrg	$3
977972599cfSmrgfi[]dnl
9789dd7914aSmrg])dnl PKG_CHECK_MODULES
9799dd7914aSmrg
9809dd7914aSmrg
9819dd7914aSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
9829dd7914aSmrgdnl   [ACTION-IF-NOT-FOUND])
9839dd7914aSmrgdnl ---------------------------------------------------------------------
9849dd7914aSmrgdnl Since: 0.29
9859dd7914aSmrgdnl
9869dd7914aSmrgdnl Checks for existence of MODULES and gathers its build flags with
9879dd7914aSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
9889dd7914aSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
9899dd7914aSmrgdnl
9909dd7914aSmrgdnl Note that if there is a possibility the first call to
9919dd7914aSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
9929dd7914aSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
9939dd7914aSmrgdnl configure.ac.
9949dd7914aSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
9959dd7914aSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
9969dd7914aSmrg_save_PKG_CONFIG=$PKG_CONFIG
9979dd7914aSmrgPKG_CONFIG="$PKG_CONFIG --static"
9989dd7914aSmrgPKG_CHECK_MODULES($@)
9999dd7914aSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
10009dd7914aSmrg])dnl PKG_CHECK_MODULES_STATIC
10019dd7914aSmrg
10029dd7914aSmrg
10039dd7914aSmrgdnl PKG_INSTALLDIR([DIRECTORY])
10049dd7914aSmrgdnl -------------------------
10059dd7914aSmrgdnl Since: 0.27
10069dd7914aSmrgdnl
10079dd7914aSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
10089dd7914aSmrgdnl should install pkg-config .pc files. By default the directory is
10099dd7914aSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
10109dd7914aSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
10119dd7914aSmrgdnl parameter.
10129dd7914aSmrgAC_DEFUN([PKG_INSTALLDIR],
10139dd7914aSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
10149dd7914aSmrgm4_pushdef([pkg_description],
10159dd7914aSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
10169dd7914aSmrgAC_ARG_WITH([pkgconfigdir],
10179dd7914aSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
10189dd7914aSmrg    [with_pkgconfigdir=]pkg_default)
10199dd7914aSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
10209dd7914aSmrgm4_popdef([pkg_default])
10219dd7914aSmrgm4_popdef([pkg_description])
10229dd7914aSmrg])dnl PKG_INSTALLDIR
10239dd7914aSmrg
10249dd7914aSmrg
10259dd7914aSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
10269dd7914aSmrgdnl --------------------------------
10279dd7914aSmrgdnl Since: 0.27
10289dd7914aSmrgdnl
10299dd7914aSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
10309dd7914aSmrgdnl module should install arch-independent pkg-config .pc files. By
10319dd7914aSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
10329dd7914aSmrgdnl changed by passing DIRECTORY. The user can override through the
10339dd7914aSmrgdnl --with-noarch-pkgconfigdir parameter.
10349dd7914aSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
10359dd7914aSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
10369dd7914aSmrgm4_pushdef([pkg_description],
10379dd7914aSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
10389dd7914aSmrgAC_ARG_WITH([noarch-pkgconfigdir],
10399dd7914aSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
10409dd7914aSmrg    [with_noarch_pkgconfigdir=]pkg_default)
10419dd7914aSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
10429dd7914aSmrgm4_popdef([pkg_default])
10439dd7914aSmrgm4_popdef([pkg_description])
10449dd7914aSmrg])dnl PKG_NOARCH_INSTALLDIR
10459dd7914aSmrg
10469dd7914aSmrg
10479dd7914aSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
10489dd7914aSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
10499dd7914aSmrgdnl -------------------------------------------
10509dd7914aSmrgdnl Since: 0.28
10519dd7914aSmrgdnl
10529dd7914aSmrgdnl Retrieves the value of the pkg-config variable for the given module.
10539dd7914aSmrgAC_DEFUN([PKG_CHECK_VAR],
10549dd7914aSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
10559dd7914aSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
10569dd7914aSmrg
10579dd7914aSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
10589dd7914aSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
10599dd7914aSmrg
10609dd7914aSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
10619dd7914aSmrg])dnl PKG_CHECK_VAR
1062972599cfSmrg
1063972599cfSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1064972599cfSmrgdnl
10659dd7914aSmrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
10665eeb4e8fSmrgdnl
1067972599cfSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1068972599cfSmrgdnl copy of this software and associated documentation files (the "Software"),
1069972599cfSmrgdnl to deal in the Software without restriction, including without limitation
1070972599cfSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1071972599cfSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1072972599cfSmrgdnl Software is furnished to do so, subject to the following conditions:
1073972599cfSmrgdnl
1074972599cfSmrgdnl The above copyright notice and this permission notice (including the next
1075972599cfSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1076972599cfSmrgdnl Software.
1077972599cfSmrgdnl
1078972599cfSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1079972599cfSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1080972599cfSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1081972599cfSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1082972599cfSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1083972599cfSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1084972599cfSmrgdnl DEALINGS IN THE SOFTWARE.
1085972599cfSmrg
1086972599cfSmrg# XORG_MACROS_VERSION(required-version)
1087972599cfSmrg# -------------------------------------
1088972599cfSmrg# Minimum version: 1.1.0
1089972599cfSmrg#
1090972599cfSmrg# If you're using a macro added in Version 1.1 or newer, include this in
1091972599cfSmrg# your configure.ac with the minimum required version, such as:
1092972599cfSmrg# XORG_MACROS_VERSION(1.1)
1093972599cfSmrg#
1094972599cfSmrg# To ensure that this macro is defined, also add:
1095972599cfSmrg# m4_ifndef([XORG_MACROS_VERSION],
1096972599cfSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1097972599cfSmrg#
1098972599cfSmrg#
10995eeb4e8fSmrg# See the "minimum version" comment for each macro you use to see what
1100972599cfSmrg# version you require.
1101972599cfSmrgm4_defun([XORG_MACROS_VERSION],[
11029dd7914aSmrgm4_define([vers_have], [1.20.0])
1103972599cfSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1104972599cfSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1105972599cfSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1106972599cfSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1107972599cfSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1108972599cfSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1109972599cfSmrgm4_undefine([vers_have])
1110972599cfSmrgm4_undefine([maj_have])
1111972599cfSmrgm4_undefine([maj_needed])
1112972599cfSmrg]) # XORG_MACROS_VERSION
1113972599cfSmrg
1114972599cfSmrg# XORG_PROG_RAWCPP()
1115972599cfSmrg# ------------------
1116972599cfSmrg# Minimum version: 1.0.0
1117972599cfSmrg#
1118972599cfSmrg# Find cpp program and necessary flags for use in pre-processing text files
1119972599cfSmrg# such as man pages and config files
1120972599cfSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1121972599cfSmrgAC_REQUIRE([AC_PROG_CPP])
11229dd7914aSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1123972599cfSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1124972599cfSmrg
1125972599cfSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1126972599cfSmrg# which is not the best choice for supporting other OS'es, but covers most
1127972599cfSmrg# of the ones we need for now.
1128972599cfSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1129972599cfSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1130972599cfSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1131972599cfSmrg	AC_MSG_RESULT([no])
1132972599cfSmrgelse
1133972599cfSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1134972599cfSmrg		RAWCPPFLAGS=-undef
1135972599cfSmrg		AC_MSG_RESULT([yes])
1136972599cfSmrg	# under Cygwin unix is still defined even with -undef
1137972599cfSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1138972599cfSmrg		RAWCPPFLAGS="-undef -ansi"
1139972599cfSmrg		AC_MSG_RESULT([yes, with -ansi])
1140972599cfSmrg	else
1141972599cfSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1142972599cfSmrg	fi
1143972599cfSmrgfi
1144972599cfSmrgrm -f conftest.$ac_ext
1145972599cfSmrg
1146972599cfSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1147972599cfSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
11489dd7914aSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1149972599cfSmrg	AC_MSG_RESULT([no])
1150972599cfSmrgelse
11519dd7914aSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
11525eeb4e8fSmrg		TRADITIONALCPPFLAGS="-traditional"
1153972599cfSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1154972599cfSmrg		AC_MSG_RESULT([yes])
1155972599cfSmrg	else
1156972599cfSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1157972599cfSmrg	fi
1158972599cfSmrgfi
1159972599cfSmrgrm -f conftest.$ac_ext
1160972599cfSmrgAC_SUBST(RAWCPPFLAGS)
11615eeb4e8fSmrgAC_SUBST(TRADITIONALCPPFLAGS)
1162972599cfSmrg]) # XORG_PROG_RAWCPP
1163972599cfSmrg
1164972599cfSmrg# XORG_MANPAGE_SECTIONS()
1165972599cfSmrg# -----------------------
1166972599cfSmrg# Minimum version: 1.0.0
1167972599cfSmrg#
1168972599cfSmrg# Determine which sections man pages go in for the different man page types
1169972599cfSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1170972599cfSmrg# Not sure if there's any better way than just hardcoding by OS name.
1171972599cfSmrg# Override default settings by setting environment variables
1172972599cfSmrg# Added MAN_SUBSTS in version 1.8
1173972599cfSmrg# Added AC_PROG_SED in version 1.8
1174972599cfSmrg
1175972599cfSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1176972599cfSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1177972599cfSmrgAC_REQUIRE([AC_PROG_SED])
1178972599cfSmrg
11799dd7914aSmrgcase $host_os in
11809dd7914aSmrg    solaris*)
11819dd7914aSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
11829dd7914aSmrg        # check for a man page file found in later versions that use
11839dd7914aSmrg        # traditional section numbers instead
11849dd7914aSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
11859dd7914aSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
11869dd7914aSmrg        ;;
11879dd7914aSmrg    *) SYSV_MAN_SECTIONS=false ;;
11889dd7914aSmrgesac
11899dd7914aSmrg
1190972599cfSmrgif test x$APP_MAN_SUFFIX = x    ; then
1191972599cfSmrg    APP_MAN_SUFFIX=1
1192972599cfSmrgfi
1193972599cfSmrgif test x$APP_MAN_DIR = x    ; then
1194972599cfSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1195972599cfSmrgfi
1196972599cfSmrg
1197972599cfSmrgif test x$LIB_MAN_SUFFIX = x    ; then
1198972599cfSmrg    LIB_MAN_SUFFIX=3
1199972599cfSmrgfi
1200972599cfSmrgif test x$LIB_MAN_DIR = x    ; then
1201972599cfSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1202972599cfSmrgfi
1203972599cfSmrg
1204972599cfSmrgif test x$FILE_MAN_SUFFIX = x    ; then
12059dd7914aSmrg    case $SYSV_MAN_SECTIONS in
12069dd7914aSmrg	true)				FILE_MAN_SUFFIX=4  ;;
12079dd7914aSmrg	*)				FILE_MAN_SUFFIX=5  ;;
1208972599cfSmrg    esac
1209972599cfSmrgfi
1210972599cfSmrgif test x$FILE_MAN_DIR = x    ; then
1211972599cfSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1212972599cfSmrgfi
1213972599cfSmrg
1214972599cfSmrgif test x$MISC_MAN_SUFFIX = x    ; then
12159dd7914aSmrg    case $SYSV_MAN_SECTIONS in
12169dd7914aSmrg	true)				MISC_MAN_SUFFIX=5  ;;
12179dd7914aSmrg	*)				MISC_MAN_SUFFIX=7  ;;
1218972599cfSmrg    esac
1219972599cfSmrgfi
1220972599cfSmrgif test x$MISC_MAN_DIR = x    ; then
1221972599cfSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1222972599cfSmrgfi
1223972599cfSmrg
1224972599cfSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
12259dd7914aSmrg    case $SYSV_MAN_SECTIONS in
12269dd7914aSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
12279dd7914aSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1228972599cfSmrg    esac
1229972599cfSmrgfi
1230972599cfSmrgif test x$DRIVER_MAN_DIR = x    ; then
1231972599cfSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1232972599cfSmrgfi
1233972599cfSmrg
1234972599cfSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
12359dd7914aSmrg    case $SYSV_MAN_SECTIONS in
12369dd7914aSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
12379dd7914aSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
1238972599cfSmrg    esac
1239972599cfSmrgfi
1240972599cfSmrgif test x$ADMIN_MAN_DIR = x    ; then
1241972599cfSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1242972599cfSmrgfi
1243972599cfSmrg
1244972599cfSmrg
1245972599cfSmrgAC_SUBST([APP_MAN_SUFFIX])
1246972599cfSmrgAC_SUBST([LIB_MAN_SUFFIX])
1247972599cfSmrgAC_SUBST([FILE_MAN_SUFFIX])
1248972599cfSmrgAC_SUBST([MISC_MAN_SUFFIX])
1249972599cfSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1250972599cfSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1251972599cfSmrgAC_SUBST([APP_MAN_DIR])
1252972599cfSmrgAC_SUBST([LIB_MAN_DIR])
1253972599cfSmrgAC_SUBST([FILE_MAN_DIR])
1254972599cfSmrgAC_SUBST([MISC_MAN_DIR])
1255972599cfSmrgAC_SUBST([DRIVER_MAN_DIR])
1256972599cfSmrgAC_SUBST([ADMIN_MAN_DIR])
1257972599cfSmrg
1258972599cfSmrgXORG_MAN_PAGE="X Version 11"
1259972599cfSmrgAC_SUBST([XORG_MAN_PAGE])
1260972599cfSmrgMAN_SUBSTS="\
1261972599cfSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1262972599cfSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1263972599cfSmrg	-e 's|__xservername__|Xorg|g' \
1264972599cfSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
1265972599cfSmrg	-e 's|__projectroot__|\$(prefix)|g' \
1266972599cfSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1267972599cfSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1268972599cfSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1269972599cfSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1270972599cfSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1271972599cfSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1272972599cfSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1273972599cfSmrgAC_SUBST([MAN_SUBSTS])
1274972599cfSmrg
1275972599cfSmrg]) # XORG_MANPAGE_SECTIONS
1276972599cfSmrg
1277972599cfSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1278972599cfSmrg# ------------------------
1279972599cfSmrg# Minimum version: 1.7.0
1280972599cfSmrg#
1281972599cfSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1282972599cfSmrg# provided by xorg-sgml-doctools, if installed.
1283972599cfSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1284972599cfSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1285972599cfSmrgXORG_SGML_PATH=
1286972599cfSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1287972599cfSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1288972599cfSmrg    [m4_ifval([$1],[:],
1289972599cfSmrg        [if test x"$cross_compiling" != x"yes" ; then
1290972599cfSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1291972599cfSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1292972599cfSmrg         fi])
1293972599cfSmrg    ])
1294972599cfSmrg
1295972599cfSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1296972599cfSmrg# the path and the name of the doc stylesheet
1297972599cfSmrgif test "x$XORG_SGML_PATH" != "x" ; then
1298972599cfSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1299972599cfSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1300972599cfSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1301972599cfSmrgelse
1302972599cfSmrg   AC_MSG_RESULT([no])
1303972599cfSmrgfi
1304972599cfSmrg
1305972599cfSmrgAC_SUBST(XORG_SGML_PATH)
1306972599cfSmrgAC_SUBST(STYLESHEET_SRCDIR)
1307972599cfSmrgAC_SUBST(XSL_STYLESHEET)
1308972599cfSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1309972599cfSmrg]) # XORG_CHECK_SGML_DOCTOOLS
1310972599cfSmrg
1311972599cfSmrg# XORG_CHECK_LINUXDOC
1312972599cfSmrg# -------------------
1313972599cfSmrg# Minimum version: 1.0.0
1314972599cfSmrg#
1315972599cfSmrg# Defines the variable MAKE_TEXT if the necessary tools and
1316972599cfSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1317972599cfSmrg# Whether or not the necessary tools and files are found can be checked
1318972599cfSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1319972599cfSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1320972599cfSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1321972599cfSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1322972599cfSmrg
1323972599cfSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1324972599cfSmrg
1325972599cfSmrgAC_MSG_CHECKING([whether to build documentation])
1326972599cfSmrg
1327972599cfSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1328972599cfSmrg   BUILDDOC=yes
1329972599cfSmrgelse
1330972599cfSmrg   BUILDDOC=no
1331972599cfSmrgfi
1332972599cfSmrg
1333972599cfSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1334972599cfSmrg
1335972599cfSmrgAC_MSG_RESULT([$BUILDDOC])
1336972599cfSmrg
1337972599cfSmrgAC_MSG_CHECKING([whether to build pdf documentation])
1338972599cfSmrg
1339972599cfSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1340972599cfSmrg   BUILDPDFDOC=yes
1341972599cfSmrgelse
1342972599cfSmrg   BUILDPDFDOC=no
1343972599cfSmrgfi
1344972599cfSmrg
1345972599cfSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1346972599cfSmrg
1347972599cfSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1348972599cfSmrg
1349972599cfSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1350972599cfSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1351972599cfSmrgMAKE_PDF="$PS2PDF"
1352972599cfSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1353972599cfSmrg
1354972599cfSmrgAC_SUBST(MAKE_TEXT)
1355972599cfSmrgAC_SUBST(MAKE_PS)
1356972599cfSmrgAC_SUBST(MAKE_PDF)
1357972599cfSmrgAC_SUBST(MAKE_HTML)
1358972599cfSmrg]) # XORG_CHECK_LINUXDOC
1359972599cfSmrg
1360972599cfSmrg# XORG_CHECK_DOCBOOK
1361972599cfSmrg# -------------------
1362972599cfSmrg# Minimum version: 1.0.0
1363972599cfSmrg#
1364972599cfSmrg# Checks for the ability to build output formats from SGML DocBook source.
1365972599cfSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1366972599cfSmrg# indicates whether the necessary tools and files are found and, if set,
1367972599cfSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1368972599cfSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1369972599cfSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1370972599cfSmrg
1371972599cfSmrgBUILDTXTDOC=no
1372972599cfSmrgBUILDPDFDOC=no
1373972599cfSmrgBUILDPSDOC=no
1374972599cfSmrgBUILDHTMLDOC=no
1375972599cfSmrg
1376972599cfSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1377972599cfSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1378972599cfSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1379972599cfSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1380972599cfSmrg
1381972599cfSmrgAC_MSG_CHECKING([whether to build text documentation])
1382972599cfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1383972599cfSmrg   test x$BUILD_TXTDOC != xno; then
1384972599cfSmrg	BUILDTXTDOC=yes
1385972599cfSmrgfi
1386972599cfSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1387972599cfSmrgAC_MSG_RESULT([$BUILDTXTDOC])
1388972599cfSmrg
1389972599cfSmrgAC_MSG_CHECKING([whether to build PDF documentation])
1390972599cfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1391972599cfSmrg   test x$BUILD_PDFDOC != xno; then
1392972599cfSmrg	BUILDPDFDOC=yes
1393972599cfSmrgfi
1394972599cfSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1395972599cfSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1396972599cfSmrg
1397972599cfSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1398972599cfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1399972599cfSmrg   test x$BUILD_PSDOC != xno; then
1400972599cfSmrg	BUILDPSDOC=yes
1401972599cfSmrgfi
1402972599cfSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1403972599cfSmrgAC_MSG_RESULT([$BUILDPSDOC])
1404972599cfSmrg
1405972599cfSmrgAC_MSG_CHECKING([whether to build HTML documentation])
1406972599cfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1407972599cfSmrg   test x$BUILD_HTMLDOC != xno; then
1408972599cfSmrg	BUILDHTMLDOC=yes
1409972599cfSmrgfi
1410972599cfSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1411972599cfSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1412972599cfSmrg
1413972599cfSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1414972599cfSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1415972599cfSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1416972599cfSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1417972599cfSmrg
1418972599cfSmrgAC_SUBST(MAKE_TEXT)
1419972599cfSmrgAC_SUBST(MAKE_PS)
1420972599cfSmrgAC_SUBST(MAKE_PDF)
1421972599cfSmrgAC_SUBST(MAKE_HTML)
1422972599cfSmrg]) # XORG_CHECK_DOCBOOK
1423972599cfSmrg
1424972599cfSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1425972599cfSmrg# ----------------
1426972599cfSmrg# Minimum version: 1.5.0
1427972599cfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1428972599cfSmrg#
1429972599cfSmrg# Documentation tools are not always available on all platforms and sometimes
1430972599cfSmrg# not at the appropriate level. This macro enables a module to test for the
1431972599cfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
14329dd7914aSmrg# the --with-xmlto option, it allows maximum flexibility in making decisions
1433972599cfSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1434972599cfSmrg# --with-xmlto assumes 'auto'.
1435972599cfSmrg#
1436972599cfSmrg# Interface to module:
1437972599cfSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1438972599cfSmrg# XMLTO:	returns the path of the xmlto program found
1439972599cfSmrg#		returns the path set by the user in the environment
1440972599cfSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1441972599cfSmrg#		'no' user instructs the module not to use xmlto
1442972599cfSmrg#
1443972599cfSmrg# Added in version 1.10.0
1444972599cfSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1445972599cfSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1446972599cfSmrg#
1447972599cfSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1448972599cfSmrg#
1449972599cfSmrgAC_DEFUN([XORG_WITH_XMLTO],[
1450972599cfSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1451972599cfSmrgm4_define([_defopt], m4_default([$2], [auto]))
1452972599cfSmrgAC_ARG_WITH(xmlto,
1453972599cfSmrg	AS_HELP_STRING([--with-xmlto],
1454972599cfSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1455972599cfSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1456972599cfSmrgm4_undefine([_defopt])
1457972599cfSmrg
1458972599cfSmrgif test "x$use_xmlto" = x"auto"; then
1459972599cfSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1460972599cfSmrg   if test "x$XMLTO" = "x"; then
1461972599cfSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1462972599cfSmrg	have_xmlto=no
1463972599cfSmrg   else
1464972599cfSmrg        have_xmlto=yes
1465972599cfSmrg   fi
1466972599cfSmrgelif test "x$use_xmlto" = x"yes" ; then
1467972599cfSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1468972599cfSmrg   if test "x$XMLTO" = "x"; then
1469972599cfSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1470972599cfSmrg   fi
1471972599cfSmrg   have_xmlto=yes
1472972599cfSmrgelif test "x$use_xmlto" = x"no" ; then
1473972599cfSmrg   if test "x$XMLTO" != "x"; then
1474972599cfSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1475972599cfSmrg   fi
1476972599cfSmrg   have_xmlto=no
1477972599cfSmrgelse
1478972599cfSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1479972599cfSmrgfi
1480972599cfSmrg
1481972599cfSmrg# Test for a minimum version of xmlto, if provided.
1482972599cfSmrgm4_ifval([$1],
1483972599cfSmrg[if test "$have_xmlto" = yes; then
1484972599cfSmrg    # scrape the xmlto version
1485972599cfSmrg    AC_MSG_CHECKING([the xmlto version])
1486972599cfSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1487972599cfSmrg    AC_MSG_RESULT([$xmlto_version])
1488972599cfSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1489972599cfSmrg        [if test "x$use_xmlto" = xauto; then
1490972599cfSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1491972599cfSmrg            have_xmlto=no
1492972599cfSmrg        else
1493972599cfSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1494972599cfSmrg        fi])
1495972599cfSmrgfi])
1496972599cfSmrg
1497972599cfSmrg# Test for the ability of xmlto to generate a text target
14989dd7914aSmrg#
14999dd7914aSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
15009dd7914aSmrg# following test for empty XML docbook files.
15019dd7914aSmrg# For compatibility reasons use the following empty XML docbook file and if
15029dd7914aSmrg# it fails try it again with a non-empty XML file.
1503972599cfSmrghave_xmlto_text=no
1504972599cfSmrgcat > conftest.xml << "EOF"
1505972599cfSmrgEOF
1506972599cfSmrgAS_IF([test "$have_xmlto" = yes],
1507972599cfSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1508972599cfSmrg             [have_xmlto_text=yes],
15099dd7914aSmrg             [# Try it again with a non-empty XML file.
15109dd7914aSmrg              cat > conftest.xml << "EOF"
15119dd7914aSmrg<x></x>
15129dd7914aSmrgEOF
15139dd7914aSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
15149dd7914aSmrg                    [have_xmlto_text=yes],
15159dd7914aSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
1516972599cfSmrgrm -f conftest.xml
1517972599cfSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1518972599cfSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1519972599cfSmrg]) # XORG_WITH_XMLTO
1520972599cfSmrg
1521972599cfSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1522972599cfSmrg# --------------------------------------------
1523972599cfSmrg# Minimum version: 1.12.0
1524972599cfSmrg# Minimum version for optional DEFAULT argument: 1.12.0
1525972599cfSmrg#
1526972599cfSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1527972599cfSmrg# XML-based language used for the transformation of XML documents.
1528972599cfSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1529972599cfSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1530972599cfSmrg# The XSLT processor is often used as a standalone tool for transformations.
1531972599cfSmrg# It should not be assumed that this tool is used only to work with documnetation.
1532972599cfSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1533972599cfSmrg#
1534972599cfSmrg# Interface to module:
1535972599cfSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1536972599cfSmrg# XSLTPROC:	 returns the path of the xsltproc program found
1537972599cfSmrg#		 returns the path set by the user in the environment
1538972599cfSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1539972599cfSmrg#		  'no' user instructs the module not to use xsltproc
1540972599cfSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1541972599cfSmrg#
1542972599cfSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1543972599cfSmrg#
1544972599cfSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1545972599cfSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1546972599cfSmrg# Preserves the interface, should it be implemented later
1547972599cfSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1548972599cfSmrgm4_define([_defopt], m4_default([$2], [auto]))
1549972599cfSmrgAC_ARG_WITH(xsltproc,
1550972599cfSmrg	AS_HELP_STRING([--with-xsltproc],
1551972599cfSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1552972599cfSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1553972599cfSmrgm4_undefine([_defopt])
1554972599cfSmrg
1555972599cfSmrgif test "x$use_xsltproc" = x"auto"; then
1556972599cfSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1557972599cfSmrg   if test "x$XSLTPROC" = "x"; then
1558972599cfSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1559972599cfSmrg	have_xsltproc=no
1560972599cfSmrg   else
1561972599cfSmrg        have_xsltproc=yes
1562972599cfSmrg   fi
1563972599cfSmrgelif test "x$use_xsltproc" = x"yes" ; then
1564972599cfSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1565972599cfSmrg   if test "x$XSLTPROC" = "x"; then
1566972599cfSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1567972599cfSmrg   fi
1568972599cfSmrg   have_xsltproc=yes
1569972599cfSmrgelif test "x$use_xsltproc" = x"no" ; then
1570972599cfSmrg   if test "x$XSLTPROC" != "x"; then
1571972599cfSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1572972599cfSmrg   fi
1573972599cfSmrg   have_xsltproc=no
1574972599cfSmrgelse
1575972599cfSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1576972599cfSmrgfi
1577972599cfSmrg
1578972599cfSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1579972599cfSmrg]) # XORG_WITH_XSLTPROC
1580972599cfSmrg
1581972599cfSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1582972599cfSmrg# ----------------------------------------
1583972599cfSmrg# Minimum version: 1.15.0
1584972599cfSmrg#
1585972599cfSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
1586972599cfSmrg# scanning arbitrary text files, extracting information from those text files,
1587972599cfSmrg# and printing reports based on that information.
1588972599cfSmrg#
1589972599cfSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1590972599cfSmrg#
1591972599cfSmrg# Interface to module:
1592972599cfSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
1593972599cfSmrg# PERL:	     returns the path of the perl program found
1594972599cfSmrg#	     returns the path set by the user in the environment
1595972599cfSmrg# --with-perl: 'yes' user instructs the module to use perl
1596972599cfSmrg#	       'no' user instructs the module not to use perl
1597972599cfSmrg# have_perl: returns yes if perl found in PATH or no
1598972599cfSmrg#
1599972599cfSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1600972599cfSmrg#
1601972599cfSmrgAC_DEFUN([XORG_WITH_PERL],[
1602972599cfSmrgAC_ARG_VAR([PERL], [Path to perl command])
1603972599cfSmrg# Preserves the interface, should it be implemented later
1604972599cfSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1605972599cfSmrgm4_define([_defopt], m4_default([$2], [auto]))
1606972599cfSmrgAC_ARG_WITH(perl,
1607972599cfSmrg	AS_HELP_STRING([--with-perl],
1608972599cfSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1609972599cfSmrg	   [use_perl=$withval], [use_perl=]_defopt)
1610972599cfSmrgm4_undefine([_defopt])
1611972599cfSmrg
1612972599cfSmrgif test "x$use_perl" = x"auto"; then
1613972599cfSmrg   AC_PATH_PROG([PERL], [perl])
1614972599cfSmrg   if test "x$PERL" = "x"; then
1615972599cfSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1616972599cfSmrg	have_perl=no
1617972599cfSmrg   else
1618972599cfSmrg        have_perl=yes
1619972599cfSmrg   fi
1620972599cfSmrgelif test "x$use_perl" = x"yes" ; then
1621972599cfSmrg   AC_PATH_PROG([PERL], [perl])
1622972599cfSmrg   if test "x$PERL" = "x"; then
1623972599cfSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1624972599cfSmrg   fi
1625972599cfSmrg   have_perl=yes
1626972599cfSmrgelif test "x$use_perl" = x"no" ; then
1627972599cfSmrg   if test "x$PERL" != "x"; then
1628972599cfSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1629972599cfSmrg   fi
1630972599cfSmrg   have_perl=no
1631972599cfSmrgelse
1632972599cfSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1633972599cfSmrgfi
1634972599cfSmrg
1635972599cfSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1636972599cfSmrg]) # XORG_WITH_PERL
1637972599cfSmrg
1638972599cfSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1639972599cfSmrg# ----------------
1640972599cfSmrg# Minimum version: 1.5.0
1641972599cfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1642972599cfSmrg#
1643972599cfSmrg# Documentation tools are not always available on all platforms and sometimes
1644972599cfSmrg# not at the appropriate level. This macro enables a module to test for the
1645972599cfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
16469dd7914aSmrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
1647972599cfSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1648972599cfSmrg# --with-asciidoc assumes 'auto'.
1649972599cfSmrg#
1650972599cfSmrg# Interface to module:
1651972599cfSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1652972599cfSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
1653972599cfSmrg#		 returns the path set by the user in the environment
1654972599cfSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1655972599cfSmrg#		  'no' user instructs the module not to use asciidoc
1656972599cfSmrg#
1657972599cfSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1658972599cfSmrg#
1659972599cfSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1660972599cfSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1661972599cfSmrgm4_define([_defopt], m4_default([$2], [auto]))
1662972599cfSmrgAC_ARG_WITH(asciidoc,
1663972599cfSmrg	AS_HELP_STRING([--with-asciidoc],
1664972599cfSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1665972599cfSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1666972599cfSmrgm4_undefine([_defopt])
1667972599cfSmrg
1668972599cfSmrgif test "x$use_asciidoc" = x"auto"; then
1669972599cfSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1670972599cfSmrg   if test "x$ASCIIDOC" = "x"; then
1671972599cfSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1672972599cfSmrg	have_asciidoc=no
1673972599cfSmrg   else
1674972599cfSmrg        have_asciidoc=yes
1675972599cfSmrg   fi
1676972599cfSmrgelif test "x$use_asciidoc" = x"yes" ; then
1677972599cfSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1678972599cfSmrg   if test "x$ASCIIDOC" = "x"; then
1679972599cfSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1680972599cfSmrg   fi
1681972599cfSmrg   have_asciidoc=yes
1682972599cfSmrgelif test "x$use_asciidoc" = x"no" ; then
1683972599cfSmrg   if test "x$ASCIIDOC" != "x"; then
1684972599cfSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1685972599cfSmrg   fi
1686972599cfSmrg   have_asciidoc=no
1687972599cfSmrgelse
1688972599cfSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1689972599cfSmrgfi
1690972599cfSmrgm4_ifval([$1],
1691972599cfSmrg[if test "$have_asciidoc" = yes; then
1692972599cfSmrg    # scrape the asciidoc version
1693972599cfSmrg    AC_MSG_CHECKING([the asciidoc version])
1694972599cfSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1695972599cfSmrg    AC_MSG_RESULT([$asciidoc_version])
1696972599cfSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1697972599cfSmrg        [if test "x$use_asciidoc" = xauto; then
1698972599cfSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1699972599cfSmrg            have_asciidoc=no
1700972599cfSmrg        else
1701972599cfSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1702972599cfSmrg        fi])
1703972599cfSmrgfi])
1704972599cfSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1705972599cfSmrg]) # XORG_WITH_ASCIIDOC
1706972599cfSmrg
1707972599cfSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
17085eeb4e8fSmrg# -------------------------------------------
1709972599cfSmrg# Minimum version: 1.5.0
1710972599cfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
17115eeb4e8fSmrg# Minimum version for optional DOT checking: 1.18.0
1712972599cfSmrg#
1713972599cfSmrg# Documentation tools are not always available on all platforms and sometimes
1714972599cfSmrg# not at the appropriate level. This macro enables a module to test for the
1715972599cfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
17169dd7914aSmrg# the --with-doxygen option, it allows maximum flexibility in making decisions
1717972599cfSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1718972599cfSmrg# --with-doxygen assumes 'auto'.
1719972599cfSmrg#
1720972599cfSmrg# Interface to module:
1721972599cfSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1722972599cfSmrg# DOXYGEN:	 returns the path of the doxygen program found
1723972599cfSmrg#		 returns the path set by the user in the environment
1724972599cfSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1725972599cfSmrg#		  'no' user instructs the module not to use doxygen
1726972599cfSmrg#
1727972599cfSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1728972599cfSmrg#
1729972599cfSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1730972599cfSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
17315eeb4e8fSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
1732972599cfSmrgm4_define([_defopt], m4_default([$2], [auto]))
1733972599cfSmrgAC_ARG_WITH(doxygen,
1734972599cfSmrg	AS_HELP_STRING([--with-doxygen],
1735972599cfSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1736972599cfSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1737972599cfSmrgm4_undefine([_defopt])
1738972599cfSmrg
1739972599cfSmrgif test "x$use_doxygen" = x"auto"; then
1740972599cfSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1741972599cfSmrg   if test "x$DOXYGEN" = "x"; then
1742972599cfSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1743972599cfSmrg	have_doxygen=no
1744972599cfSmrg   else
1745972599cfSmrg        have_doxygen=yes
1746972599cfSmrg   fi
1747972599cfSmrgelif test "x$use_doxygen" = x"yes" ; then
1748972599cfSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1749972599cfSmrg   if test "x$DOXYGEN" = "x"; then
1750972599cfSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1751972599cfSmrg   fi
1752972599cfSmrg   have_doxygen=yes
1753972599cfSmrgelif test "x$use_doxygen" = x"no" ; then
1754972599cfSmrg   if test "x$DOXYGEN" != "x"; then
1755972599cfSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1756972599cfSmrg   fi
1757972599cfSmrg   have_doxygen=no
1758972599cfSmrgelse
1759972599cfSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1760972599cfSmrgfi
1761972599cfSmrgm4_ifval([$1],
1762972599cfSmrg[if test "$have_doxygen" = yes; then
1763972599cfSmrg    # scrape the doxygen version
1764972599cfSmrg    AC_MSG_CHECKING([the doxygen version])
1765972599cfSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1766972599cfSmrg    AC_MSG_RESULT([$doxygen_version])
1767972599cfSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1768972599cfSmrg        [if test "x$use_doxygen" = xauto; then
1769972599cfSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1770972599cfSmrg            have_doxygen=no
1771972599cfSmrg        else
1772972599cfSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1773972599cfSmrg        fi])
1774972599cfSmrgfi])
17755eeb4e8fSmrg
17765eeb4e8fSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
17775eeb4e8fSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
17785eeb4e8fSmrgdnl 	HAVE_DOT = @HAVE_DOT@
17795eeb4e8fSmrgHAVE_DOT=no
17805eeb4e8fSmrgif test "x$have_doxygen" = "xyes"; then
17815eeb4e8fSmrg  AC_PATH_PROG([DOT], [dot])
17825eeb4e8fSmrg    if test "x$DOT" != "x"; then
17835eeb4e8fSmrg      HAVE_DOT=yes
17845eeb4e8fSmrg    fi
17855eeb4e8fSmrgfi
17865eeb4e8fSmrg
17875eeb4e8fSmrgAC_SUBST([HAVE_DOT])
17885eeb4e8fSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
1789972599cfSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
1790972599cfSmrg]) # XORG_WITH_DOXYGEN
1791972599cfSmrg
1792972599cfSmrg# XORG_WITH_GROFF([DEFAULT])
1793972599cfSmrg# ----------------
1794972599cfSmrg# Minimum version: 1.6.0
1795972599cfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1796972599cfSmrg#
1797972599cfSmrg# Documentation tools are not always available on all platforms and sometimes
1798972599cfSmrg# not at the appropriate level. This macro enables a module to test for the
1799972599cfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
18009dd7914aSmrg# the --with-groff option, it allows maximum flexibility in making decisions
1801972599cfSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
1802972599cfSmrg# --with-groff assumes 'auto'.
1803972599cfSmrg#
1804972599cfSmrg# Interface to module:
1805972599cfSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
1806972599cfSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
1807972599cfSmrg# HAVE_GROFF_MS: the -ms macros package
1808972599cfSmrg# GROFF:	 returns the path of the groff program found
1809972599cfSmrg#		 returns the path set by the user in the environment
1810972599cfSmrg# --with-groff:	 'yes' user instructs the module to use groff
1811972599cfSmrg#		 'no' user instructs the module not to use groff
1812972599cfSmrg#
1813972599cfSmrg# Added in version 1.9.0:
1814972599cfSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
1815972599cfSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
1816972599cfSmrg#		   psselect from the psutils package.
1817972599cfSmrg#		   the ghostcript package. Refer to the grohtml man pages
1818972599cfSmrg#
1819972599cfSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
1820972599cfSmrg#
1821972599cfSmrg# OS and distros often splits groff in a basic and full package, the former
1822972599cfSmrg# having the groff program and the later having devices, fonts and macros
1823972599cfSmrg# Checking for the groff executable is not enough.
1824972599cfSmrg#
1825972599cfSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
1826972599cfSmrg# unset HAVE_GROFF or GROFF env variables.
1827972599cfSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
1828972599cfSmrg#
1829972599cfSmrgAC_DEFUN([XORG_WITH_GROFF],[
1830972599cfSmrgAC_ARG_VAR([GROFF], [Path to groff command])
1831972599cfSmrgm4_define([_defopt], m4_default([$1], [auto]))
1832972599cfSmrgAC_ARG_WITH(groff,
1833972599cfSmrg	AS_HELP_STRING([--with-groff],
1834972599cfSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
1835972599cfSmrg	   [use_groff=$withval], [use_groff=]_defopt)
1836972599cfSmrgm4_undefine([_defopt])
1837972599cfSmrg
1838972599cfSmrgif test "x$use_groff" = x"auto"; then
1839972599cfSmrg   AC_PATH_PROG([GROFF], [groff])
1840972599cfSmrg   if test "x$GROFF" = "x"; then
1841972599cfSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
1842972599cfSmrg	have_groff=no
1843972599cfSmrg   else
1844972599cfSmrg        have_groff=yes
1845972599cfSmrg   fi
1846972599cfSmrgelif test "x$use_groff" = x"yes" ; then
1847972599cfSmrg   AC_PATH_PROG([GROFF], [groff])
1848972599cfSmrg   if test "x$GROFF" = "x"; then
1849972599cfSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
1850972599cfSmrg   fi
1851972599cfSmrg   have_groff=yes
1852972599cfSmrgelif test "x$use_groff" = x"no" ; then
1853972599cfSmrg   if test "x$GROFF" != "x"; then
1854972599cfSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
1855972599cfSmrg   fi
1856972599cfSmrg   have_groff=no
1857972599cfSmrgelse
1858972599cfSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1859972599cfSmrgfi
1860972599cfSmrg
1861972599cfSmrg# We have groff, test for the presence of the macro packages
1862972599cfSmrgif test "x$have_groff" = x"yes"; then
1863972599cfSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
1864972599cfSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
1865972599cfSmrg        groff_ms_works=yes
1866972599cfSmrg    else
1867972599cfSmrg        groff_ms_works=no
1868972599cfSmrg    fi
1869972599cfSmrg    AC_MSG_RESULT([$groff_ms_works])
1870972599cfSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
1871972599cfSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
1872972599cfSmrg        groff_mm_works=yes
1873972599cfSmrg    else
1874972599cfSmrg        groff_mm_works=no
1875972599cfSmrg    fi
1876972599cfSmrg    AC_MSG_RESULT([$groff_mm_works])
1877972599cfSmrgfi
1878972599cfSmrg
1879972599cfSmrg# We have groff, test for HTML dependencies, one command per package
1880972599cfSmrgif test "x$have_groff" = x"yes"; then
1881972599cfSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
1882972599cfSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
1883972599cfSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
1884972599cfSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
1885972599cfSmrg      have_groff_html=yes
1886972599cfSmrg   else
1887972599cfSmrg      have_groff_html=no
1888972599cfSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
1889972599cfSmrg   fi
1890972599cfSmrgfi
1891972599cfSmrg
1892972599cfSmrg# Set Automake conditionals for Makefiles
1893972599cfSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
1894972599cfSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
1895972599cfSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
1896972599cfSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
1897972599cfSmrg]) # XORG_WITH_GROFF
1898972599cfSmrg
1899972599cfSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
1900972599cfSmrg# ---------------------------------------
1901972599cfSmrg# Minimum version: 1.6.0
1902972599cfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1903972599cfSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
1904972599cfSmrg#
1905972599cfSmrg# Documentation tools are not always available on all platforms and sometimes
1906972599cfSmrg# not at the appropriate level. This macro enables a module to test for the
1907972599cfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
19089dd7914aSmrg# the --with-fop option, it allows maximum flexibility in making decisions
1909972599cfSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
1910972599cfSmrg# --with-fop assumes 'auto'.
1911972599cfSmrg#
1912972599cfSmrg# Interface to module:
1913972599cfSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
1914972599cfSmrg# FOP:	 	returns the path of the fop program found
1915972599cfSmrg#		returns the path set by the user in the environment
1916972599cfSmrg# --with-fop: 	'yes' user instructs the module to use fop
1917972599cfSmrg#		'no' user instructs the module not to use fop
1918972599cfSmrg#
1919972599cfSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
1920972599cfSmrg#
1921972599cfSmrgAC_DEFUN([XORG_WITH_FOP],[
1922972599cfSmrgAC_ARG_VAR([FOP], [Path to fop command])
1923972599cfSmrgm4_define([_defopt], m4_default([$2], [auto]))
1924972599cfSmrgAC_ARG_WITH(fop,
1925972599cfSmrg	AS_HELP_STRING([--with-fop],
1926972599cfSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
1927972599cfSmrg	   [use_fop=$withval], [use_fop=]_defopt)
1928972599cfSmrgm4_undefine([_defopt])
1929972599cfSmrg
1930972599cfSmrgif test "x$use_fop" = x"auto"; then
1931972599cfSmrg   AC_PATH_PROG([FOP], [fop])
1932972599cfSmrg   if test "x$FOP" = "x"; then
1933972599cfSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
1934972599cfSmrg	have_fop=no
1935972599cfSmrg   else
1936972599cfSmrg        have_fop=yes
1937972599cfSmrg   fi
1938972599cfSmrgelif test "x$use_fop" = x"yes" ; then
1939972599cfSmrg   AC_PATH_PROG([FOP], [fop])
1940972599cfSmrg   if test "x$FOP" = "x"; then
1941972599cfSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
1942972599cfSmrg   fi
1943972599cfSmrg   have_fop=yes
1944972599cfSmrgelif test "x$use_fop" = x"no" ; then
1945972599cfSmrg   if test "x$FOP" != "x"; then
1946972599cfSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
1947972599cfSmrg   fi
1948972599cfSmrg   have_fop=no
1949972599cfSmrgelse
1950972599cfSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
1951972599cfSmrgfi
1952972599cfSmrg
1953972599cfSmrg# Test for a minimum version of fop, if provided.
1954972599cfSmrgm4_ifval([$1],
1955972599cfSmrg[if test "$have_fop" = yes; then
1956972599cfSmrg    # scrape the fop version
1957972599cfSmrg    AC_MSG_CHECKING([for fop minimum version])
1958972599cfSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
1959972599cfSmrg    AC_MSG_RESULT([$fop_version])
1960972599cfSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
1961972599cfSmrg        [if test "x$use_fop" = xauto; then
1962972599cfSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
1963972599cfSmrg            have_fop=no
1964972599cfSmrg        else
1965972599cfSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
1966972599cfSmrg        fi])
1967972599cfSmrgfi])
1968972599cfSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
1969972599cfSmrg]) # XORG_WITH_FOP
1970972599cfSmrg
19715eeb4e8fSmrg# XORG_WITH_M4([MIN-VERSION])
19725eeb4e8fSmrg# ---------------------------
19735eeb4e8fSmrg# Minimum version: 1.19.0
19745eeb4e8fSmrg#
19755eeb4e8fSmrg# This macro attempts to locate an m4 macro processor which supports
19765eeb4e8fSmrg# -I option and is only useful for modules relying on M4 in order to
19775eeb4e8fSmrg# expand macros in source code files.
19785eeb4e8fSmrg#
19795eeb4e8fSmrg# Interface to module:
19805eeb4e8fSmrg# M4:	 	returns the path of the m4 program found
19815eeb4e8fSmrg#		returns the path set by the user in the environment
19825eeb4e8fSmrg#
19835eeb4e8fSmrgAC_DEFUN([XORG_WITH_M4], [
19845eeb4e8fSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
19855eeb4e8fSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
19865eeb4e8fSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
19875eeb4e8fSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
19885eeb4e8fSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
19895eeb4e8fSmrg   [$PATH:/usr/gnu/bin])])
19905eeb4e8fSmrg
19915eeb4e8fSmrgAC_SUBST([M4], [$ac_cv_path_M4])
19925eeb4e8fSmrg]) # XORG_WITH_M4
19935eeb4e8fSmrg
1994972599cfSmrg# XORG_WITH_PS2PDF([DEFAULT])
1995972599cfSmrg# ----------------
1996972599cfSmrg# Minimum version: 1.6.0
1997972599cfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1998972599cfSmrg#
1999972599cfSmrg# Documentation tools are not always available on all platforms and sometimes
2000972599cfSmrg# not at the appropriate level. This macro enables a module to test for the
2001972599cfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
20029dd7914aSmrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
2003972599cfSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2004972599cfSmrg# --with-ps2pdf assumes 'auto'.
2005972599cfSmrg#
2006972599cfSmrg# Interface to module:
2007972599cfSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2008972599cfSmrg# PS2PDF:	returns the path of the ps2pdf program found
2009972599cfSmrg#		returns the path set by the user in the environment
2010972599cfSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2011972599cfSmrg#		 'no' user instructs the module not to use ps2pdf
2012972599cfSmrg#
2013972599cfSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2014972599cfSmrg#
2015972599cfSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2016972599cfSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2017972599cfSmrgm4_define([_defopt], m4_default([$1], [auto]))
2018972599cfSmrgAC_ARG_WITH(ps2pdf,
2019972599cfSmrg	AS_HELP_STRING([--with-ps2pdf],
2020972599cfSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2021972599cfSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2022972599cfSmrgm4_undefine([_defopt])
2023972599cfSmrg
2024972599cfSmrgif test "x$use_ps2pdf" = x"auto"; then
2025972599cfSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2026972599cfSmrg   if test "x$PS2PDF" = "x"; then
2027972599cfSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2028972599cfSmrg	have_ps2pdf=no
2029972599cfSmrg   else
2030972599cfSmrg        have_ps2pdf=yes
2031972599cfSmrg   fi
2032972599cfSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2033972599cfSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2034972599cfSmrg   if test "x$PS2PDF" = "x"; then
2035972599cfSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2036972599cfSmrg   fi
2037972599cfSmrg   have_ps2pdf=yes
2038972599cfSmrgelif test "x$use_ps2pdf" = x"no" ; then
2039972599cfSmrg   if test "x$PS2PDF" != "x"; then
2040972599cfSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2041972599cfSmrg   fi
2042972599cfSmrg   have_ps2pdf=no
2043972599cfSmrgelse
2044972599cfSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2045972599cfSmrgfi
2046972599cfSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2047972599cfSmrg]) # XORG_WITH_PS2PDF
2048972599cfSmrg
2049972599cfSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2050972599cfSmrg# ----------------
2051972599cfSmrg# Minimum version: 1.6.0
2052972599cfSmrg#
2053972599cfSmrg# Documentation tools are not always available on all platforms and sometimes
2054972599cfSmrg# not at the appropriate level. This macro enables a builder to skip all
2055972599cfSmrg# documentation targets except traditional man pages.
2056972599cfSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
20579dd7914aSmrg# maximum flexibility in controlling documentation building.
2058972599cfSmrg# Refer to:
2059972599cfSmrg# XORG_WITH_XMLTO         --with-xmlto
2060972599cfSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2061972599cfSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2062972599cfSmrg# XORG_WITH_FOP           --with-fop
2063972599cfSmrg# XORG_WITH_GROFF         --with-groff
2064972599cfSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2065972599cfSmrg#
2066972599cfSmrg# Interface to module:
2067972599cfSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2068972599cfSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2069972599cfSmrg#		 'no' user instructs the module not to generate docs
2070972599cfSmrg# parm1:	specify the default value, yes or no.
2071972599cfSmrg#
2072972599cfSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2073972599cfSmrgm4_define([docs_default], m4_default([$1], [yes]))
2074972599cfSmrgAC_ARG_ENABLE(docs,
2075972599cfSmrg	AS_HELP_STRING([--enable-docs],
2076972599cfSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2077972599cfSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2078972599cfSmrgm4_undefine([docs_default])
2079972599cfSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2080972599cfSmrgAC_MSG_CHECKING([whether to build documentation])
2081972599cfSmrgAC_MSG_RESULT([$build_docs])
2082972599cfSmrg]) # XORG_ENABLE_DOCS
2083972599cfSmrg
2084972599cfSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2085972599cfSmrg# ----------------
2086972599cfSmrg# Minimum version: 1.6.0
2087972599cfSmrg#
2088972599cfSmrg# This macro enables a builder to skip all developer documentation.
2089972599cfSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
20909dd7914aSmrg# maximum flexibility in controlling documentation building.
2091972599cfSmrg# Refer to:
2092972599cfSmrg# XORG_WITH_XMLTO         --with-xmlto
2093972599cfSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2094972599cfSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2095972599cfSmrg# XORG_WITH_FOP           --with-fop
2096972599cfSmrg# XORG_WITH_GROFF         --with-groff
2097972599cfSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2098972599cfSmrg#
2099972599cfSmrg# Interface to module:
2100972599cfSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2101972599cfSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2102972599cfSmrg#			'no' user instructs the module not to generate developer docs
2103972599cfSmrg# parm1:		specify the default value, yes or no.
2104972599cfSmrg#
2105972599cfSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2106972599cfSmrgm4_define([devel_default], m4_default([$1], [yes]))
2107972599cfSmrgAC_ARG_ENABLE(devel-docs,
2108972599cfSmrg	AS_HELP_STRING([--enable-devel-docs],
2109972599cfSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2110972599cfSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2111972599cfSmrgm4_undefine([devel_default])
2112972599cfSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2113972599cfSmrgAC_MSG_CHECKING([whether to build developer documentation])
2114972599cfSmrgAC_MSG_RESULT([$build_devel_docs])
2115972599cfSmrg]) # XORG_ENABLE_DEVEL_DOCS
2116972599cfSmrg
2117972599cfSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
2118972599cfSmrg# ----------------
2119972599cfSmrg# Minimum version: 1.6.0
2120972599cfSmrg#
2121972599cfSmrg# This macro enables a builder to skip all functional specification targets.
2122972599cfSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
21239dd7914aSmrg# maximum flexibility in controlling documentation building.
2124972599cfSmrg# Refer to:
2125972599cfSmrg# XORG_WITH_XMLTO         --with-xmlto
2126972599cfSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2127972599cfSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2128972599cfSmrg# XORG_WITH_FOP           --with-fop
2129972599cfSmrg# XORG_WITH_GROFF         --with-groff
2130972599cfSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2131972599cfSmrg#
2132972599cfSmrg# Interface to module:
2133972599cfSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2134972599cfSmrg# --enable-specs:	'yes' user instructs the module to generate specs
2135972599cfSmrg#			'no' user instructs the module not to generate specs
2136972599cfSmrg# parm1:		specify the default value, yes or no.
2137972599cfSmrg#
2138972599cfSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2139972599cfSmrgm4_define([spec_default], m4_default([$1], [yes]))
2140972599cfSmrgAC_ARG_ENABLE(specs,
2141972599cfSmrg	AS_HELP_STRING([--enable-specs],
2142972599cfSmrg	   [Enable building the specs (default: ]spec_default[)]),
2143972599cfSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
2144972599cfSmrgm4_undefine([spec_default])
2145972599cfSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2146972599cfSmrgAC_MSG_CHECKING([whether to build functional specifications])
2147972599cfSmrgAC_MSG_RESULT([$build_specs])
2148972599cfSmrg]) # XORG_ENABLE_SPECS
2149972599cfSmrg
2150972599cfSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2151972599cfSmrg# ----------------------------------------------
2152972599cfSmrg# Minimum version: 1.13.0
2153972599cfSmrg#
2154972599cfSmrg# This macro enables a builder to enable/disable unit testing
2155972599cfSmrg# It makes no assumption about the test cases implementation
2156972599cfSmrg# Test cases may or may not use Automake "Support for test suites"
2157972599cfSmrg# They may or may not use the software utility library GLib
2158972599cfSmrg#
2159972599cfSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2160972599cfSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2161972599cfSmrg# The variable enable_unit_tests is used by other macros in this file.
2162972599cfSmrg#
2163972599cfSmrg# Interface to module:
2164972599cfSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2165972599cfSmrg# enable_unit_tests:    used in configure.ac for additional configuration
2166972599cfSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2167972599cfSmrg#			'no' user instructs the module not to build tests
2168972599cfSmrg# parm1:		specify the default value, yes or no.
2169972599cfSmrg#
2170972599cfSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2171972599cfSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2172972599cfSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2173972599cfSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2174972599cfSmrgm4_define([_defopt], m4_default([$1], [auto]))
2175972599cfSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2176972599cfSmrg	[Enable building unit test cases (default: ]_defopt[)]),
2177972599cfSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2178972599cfSmrgm4_undefine([_defopt])
2179972599cfSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2180972599cfSmrgAC_MSG_CHECKING([whether to build unit test cases])
2181972599cfSmrgAC_MSG_RESULT([$enable_unit_tests])
2182972599cfSmrg]) # XORG_ENABLE_UNIT_TESTS
2183972599cfSmrg
2184972599cfSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2185972599cfSmrg# ------------------------------------------------------
2186972599cfSmrg# Minimum version: 1.17.0
2187972599cfSmrg#
2188972599cfSmrg# This macro enables a builder to enable/disable integration testing
2189972599cfSmrg# It makes no assumption about the test cases' implementation
2190972599cfSmrg# Test cases may or may not use Automake "Support for test suites"
2191972599cfSmrg#
2192972599cfSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2193972599cfSmrg# usually requires less dependencies and may be built and run under less
2194972599cfSmrg# stringent environments than integration tests.
2195972599cfSmrg#
2196972599cfSmrg# Interface to module:
2197972599cfSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2198972599cfSmrg# enable_integration_tests:   used in configure.ac for additional configuration
2199972599cfSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2200972599cfSmrg#                             'no' user instructs the module not to build tests
2201972599cfSmrg# parm1:                      specify the default value, yes or no.
2202972599cfSmrg#
2203972599cfSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2204972599cfSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2205972599cfSmrgm4_define([_defopt], m4_default([$1], [auto]))
2206972599cfSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2207972599cfSmrg	[Enable building integration test cases (default: ]_defopt[)]),
2208972599cfSmrg	[enable_integration_tests=$enableval],
2209972599cfSmrg	[enable_integration_tests=]_defopt)
2210972599cfSmrgm4_undefine([_defopt])
2211972599cfSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2212972599cfSmrg	[test "x$enable_integration_tests" != xno])
2213972599cfSmrgAC_MSG_CHECKING([whether to build unit test cases])
2214972599cfSmrgAC_MSG_RESULT([$enable_integration_tests])
2215972599cfSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
2216972599cfSmrg
2217972599cfSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2218972599cfSmrg# ----------------------------------------
2219972599cfSmrg# Minimum version: 1.13.0
2220972599cfSmrg#
2221972599cfSmrg# GLib is a library which provides advanced data structures and functions.
2222972599cfSmrg# This macro enables a module to test for the presence of Glib.
2223972599cfSmrg#
2224972599cfSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2225972599cfSmrg# Otherwise the value of $enable_unit_tests is blank.
2226972599cfSmrg#
2227972599cfSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2228972599cfSmrg# test support usually requires less dependencies and may be built and run under
2229972599cfSmrg# less stringent environments than integration tests.
2230972599cfSmrg#
2231972599cfSmrg# Interface to module:
2232972599cfSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
2233972599cfSmrg# with_glib: used in configure.ac to know if GLib has been found
2234972599cfSmrg# --with-glib:	'yes' user instructs the module to use glib
2235972599cfSmrg#		'no' user instructs the module not to use glib
2236972599cfSmrg#
2237972599cfSmrgAC_DEFUN([XORG_WITH_GLIB],[
2238972599cfSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2239972599cfSmrgm4_define([_defopt], m4_default([$2], [auto]))
2240972599cfSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2241972599cfSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2242972599cfSmrg	[with_glib=$withval], [with_glib=]_defopt)
2243972599cfSmrgm4_undefine([_defopt])
2244972599cfSmrg
2245972599cfSmrghave_glib=no
2246972599cfSmrg# Do not probe GLib if user explicitly disabled unit testing
2247972599cfSmrgif test "x$enable_unit_tests" != x"no"; then
2248972599cfSmrg  # Do not probe GLib if user explicitly disabled it
2249972599cfSmrg  if test "x$with_glib" != x"no"; then
2250972599cfSmrg    m4_ifval(
2251972599cfSmrg      [$1],
2252972599cfSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2253972599cfSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2254972599cfSmrg    )
2255972599cfSmrg  fi
2256972599cfSmrgfi
2257972599cfSmrg
2258972599cfSmrg# Not having GLib when unit testing has been explicitly requested is an error
2259972599cfSmrgif test "x$enable_unit_tests" = x"yes"; then
2260972599cfSmrg  if test "x$have_glib" = x"no"; then
2261972599cfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2262972599cfSmrg  fi
2263972599cfSmrgfi
2264972599cfSmrg
2265972599cfSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
2266972599cfSmrgif test "x$enable_unit_tests" = x"no"; then
2267972599cfSmrg  if test "x$with_glib" = x"yes"; then
2268972599cfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2269972599cfSmrg  fi
2270972599cfSmrgfi
2271972599cfSmrg
2272972599cfSmrg# Not having GLib when it has been explicitly requested is an error
2273972599cfSmrgif test "x$with_glib" = x"yes"; then
2274972599cfSmrg  if test "x$have_glib" = x"no"; then
2275972599cfSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2276972599cfSmrg  fi
2277972599cfSmrgfi
2278972599cfSmrg
2279972599cfSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2280972599cfSmrg]) # XORG_WITH_GLIB
2281972599cfSmrg
2282972599cfSmrg# XORG_LD_WRAP([required|optional])
2283972599cfSmrg# ---------------------------------
2284972599cfSmrg# Minimum version: 1.13.0
2285972599cfSmrg#
2286972599cfSmrg# Check if linker supports -wrap, passed via compiler flags
2287972599cfSmrg#
2288972599cfSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2289972599cfSmrg# Otherwise the value of $enable_unit_tests is blank.
2290972599cfSmrg#
2291972599cfSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2292972599cfSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2293972599cfSmrg# available, an argument of "optional" allows use when some unit tests require
2294972599cfSmrg# ld -wrap and others do not.
2295972599cfSmrg#
2296972599cfSmrgAC_DEFUN([XORG_LD_WRAP],[
2297972599cfSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2298972599cfSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2299972599cfSmrg                      void __wrap_exit(int status) { return; }],
2300972599cfSmrg                     [exit(0);])])
2301972599cfSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
2302972599cfSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2303972599cfSmrg  if test "x$have_ld_wrap" = x"no"; then
2304972599cfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2305972599cfSmrg  fi
2306972599cfSmrgfi
2307972599cfSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2308972599cfSmrg#
2309972599cfSmrg]) # XORG_LD_WRAP
2310972599cfSmrg
2311972599cfSmrg# XORG_CHECK_LINKER_FLAGS
2312972599cfSmrg# -----------------------
2313972599cfSmrg# SYNOPSIS
2314972599cfSmrg#
2315972599cfSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2316972599cfSmrg#
2317972599cfSmrg# DESCRIPTION
2318972599cfSmrg#
2319972599cfSmrg#   Check whether the given linker FLAGS work with the current language's
2320972599cfSmrg#   linker, or whether they give an error.
2321972599cfSmrg#
2322972599cfSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2323972599cfSmrg#   success/failure.
2324972599cfSmrg#
2325972599cfSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
2326972599cfSmrg#
2327972599cfSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2328972599cfSmrg#
2329972599cfSmrg# LICENSE
2330972599cfSmrg#
2331972599cfSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2332972599cfSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2333972599cfSmrg#   Copyright (c) 2009 Matteo Frigo
2334972599cfSmrg#
2335972599cfSmrg#   This program is free software: you can redistribute it and/or modify it
2336972599cfSmrg#   under the terms of the GNU General Public License as published by the
2337972599cfSmrg#   Free Software Foundation, either version 3 of the License, or (at your
2338972599cfSmrg#   option) any later version.
2339972599cfSmrg#
2340972599cfSmrg#   This program is distributed in the hope that it will be useful, but
2341972599cfSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2342972599cfSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2343972599cfSmrg#   Public License for more details.
2344972599cfSmrg#
2345972599cfSmrg#   You should have received a copy of the GNU General Public License along
2346972599cfSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2347972599cfSmrg#
2348972599cfSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
2349972599cfSmrg#   gives unlimited permission to copy, distribute and modify the configure
2350972599cfSmrg#   scripts that are the output of Autoconf when processing the Macro. You
2351972599cfSmrg#   need not follow the terms of the GNU General Public License when using
2352972599cfSmrg#   or distributing such scripts, even though portions of the text of the
2353972599cfSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2354972599cfSmrg#   all other use of the material that constitutes the Autoconf Macro.
2355972599cfSmrg#
2356972599cfSmrg#   This special exception to the GPL applies to versions of the Autoconf
2357972599cfSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
2358972599cfSmrg#   modified version of the Autoconf Macro, you may extend this special
2359972599cfSmrg#   exception to the GPL to apply to your modified version as well.#
2360972599cfSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2361972599cfSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
2362972599cfSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2363972599cfSmrgAS_LITERAL_IF([$1],
2364972599cfSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2365972599cfSmrg      ax_save_FLAGS=$LDFLAGS
2366972599cfSmrg      LDFLAGS="$1"
2367972599cfSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2368972599cfSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2369972599cfSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2370972599cfSmrg      LDFLAGS=$ax_save_FLAGS])],
2371972599cfSmrg  [ax_save_FLAGS=$LDFLAGS
2372972599cfSmrg   LDFLAGS="$1"
2373972599cfSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2374972599cfSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2375972599cfSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2376972599cfSmrg   LDFLAGS=$ax_save_FLAGS])
2377972599cfSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2378972599cfSmrgAC_MSG_RESULT($xorg_check_linker_flags)
2379972599cfSmrgif test "x$xorg_check_linker_flags" = xyes; then
2380972599cfSmrg	m4_default([$2], :)
2381972599cfSmrgelse
2382972599cfSmrg	m4_default([$3], :)
2383972599cfSmrgfi
2384972599cfSmrg]) # XORG_CHECK_LINKER_FLAGS
2385972599cfSmrg
2386972599cfSmrg# XORG_MEMORY_CHECK_FLAGS
2387972599cfSmrg# -----------------------
2388972599cfSmrg# Minimum version: 1.16.0
2389972599cfSmrg#
2390972599cfSmrg# This macro attempts to find appropriate memory checking functionality
2391972599cfSmrg# for various platforms which unit testing code may use to catch various
2392972599cfSmrg# forms of memory allocation and access errors in testing.
2393972599cfSmrg#
2394972599cfSmrg# Interface to module:
2395972599cfSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2396972599cfSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2397972599cfSmrg#
2398972599cfSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2399972599cfSmrg#
2400972599cfSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2401972599cfSmrg
2402972599cfSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2403972599cfSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2404972599cfSmrg           [Environment variables to enable memory checking in tests])
2405972599cfSmrg
2406972599cfSmrg# Check for different types of support on different platforms
2407972599cfSmrgcase $host_os in
2408972599cfSmrg    solaris*)
2409972599cfSmrg        AC_CHECK_LIB([umem], [umem_alloc],
2410972599cfSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2411972599cfSmrg        ;;
2412972599cfSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2413972599cfSmrg        # both directly and inverted, so should not be 0 or 255.
2414972599cfSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
2415972599cfSmrg        ;;
2416972599cfSmrg    darwin*)
2417972599cfSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2418972599cfSmrg        ;;
2419972599cfSmrg    *bsd*)
2420972599cfSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2421972599cfSmrg        ;;
2422972599cfSmrgesac
2423972599cfSmrg
2424972599cfSmrg# User supplied flags override default flags
2425972599cfSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2426972599cfSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2427972599cfSmrgfi
2428972599cfSmrg
2429972599cfSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2430972599cfSmrg]) # XORG_WITH_LINT
2431972599cfSmrg
2432972599cfSmrg# XORG_CHECK_MALLOC_ZERO
2433972599cfSmrg# ----------------------
2434972599cfSmrg# Minimum version: 1.0.0
2435972599cfSmrg#
2436972599cfSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2437972599cfSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2438972599cfSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2439972599cfSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2440972599cfSmrgAC_ARG_ENABLE(malloc0returnsnull,
2441972599cfSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2442972599cfSmrg		       [malloc(0) returns NULL (default: auto)]),
2443972599cfSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2444972599cfSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2445972599cfSmrg
2446972599cfSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2447972599cfSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
24485eeb4e8fSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
24495eeb4e8fSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2450972599cfSmrg#include <stdlib.h>
2451972599cfSmrg],[
2452972599cfSmrg    char *m0, *r0, *c0, *p;
2453972599cfSmrg    m0 = malloc(0);
2454972599cfSmrg    p = malloc(10);
2455972599cfSmrg    r0 = realloc(p,0);
2456972599cfSmrg    c0 = calloc(0,10);
2457972599cfSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2458972599cfSmrg])],
24595eeb4e8fSmrg		[xorg_cv_malloc0_returns_null=yes],
24605eeb4e8fSmrg		[xorg_cv_malloc0_returns_null=no])])
24615eeb4e8fSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2462972599cfSmrgfi
2463972599cfSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2464972599cfSmrg
2465972599cfSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2466972599cfSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2467972599cfSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2468972599cfSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2469972599cfSmrgelse
2470972599cfSmrg	MALLOC_ZERO_CFLAGS=""
2471972599cfSmrg	XMALLOC_ZERO_CFLAGS=""
2472972599cfSmrg	XTMALLOC_ZERO_CFLAGS=""
2473972599cfSmrgfi
2474972599cfSmrg
2475972599cfSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2476972599cfSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2477972599cfSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2478972599cfSmrg]) # XORG_CHECK_MALLOC_ZERO
2479972599cfSmrg
2480972599cfSmrg# XORG_WITH_LINT()
2481972599cfSmrg# ----------------
2482972599cfSmrg# Minimum version: 1.1.0
2483972599cfSmrg#
2484972599cfSmrg# This macro enables the use of a tool that flags some suspicious and
2485972599cfSmrg# non-portable constructs (likely to be bugs) in C language source code.
2486972599cfSmrg# It will attempt to locate the tool and use appropriate options.
2487972599cfSmrg# There are various lint type tools on different platforms.
2488972599cfSmrg#
2489972599cfSmrg# Interface to module:
2490972599cfSmrg# LINT:		returns the path to the tool found on the platform
2491972599cfSmrg#		or the value set to LINT on the configure cmd line
2492972599cfSmrg#		also an Automake conditional
2493972599cfSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
2494972599cfSmrg#
2495972599cfSmrg# --with-lint:	'yes' user instructs the module to use lint
2496972599cfSmrg#		'no' user instructs the module not to use lint (default)
2497972599cfSmrg#
2498972599cfSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2499972599cfSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2500972599cfSmrg#
2501972599cfSmrgAC_DEFUN([XORG_WITH_LINT],[
2502972599cfSmrg
2503972599cfSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2504972599cfSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2505972599cfSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2506972599cfSmrg		[Use a lint-style source code checker (default: disabled)])],
2507972599cfSmrg		[use_lint=$withval], [use_lint=no])
2508972599cfSmrg
2509972599cfSmrg# Obtain platform specific info like program name and options
2510972599cfSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2511972599cfSmrgcase $host_os in
2512972599cfSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2513972599cfSmrg	lint_name=splint
2514972599cfSmrg	lint_options="-badflag"
2515972599cfSmrg	;;
2516972599cfSmrg  *freebsd* | *netbsd*)
2517972599cfSmrg	lint_name=lint
2518972599cfSmrg	lint_options="-u -b"
2519972599cfSmrg	;;
2520972599cfSmrg  *solaris*)
2521972599cfSmrg	lint_name=lint
2522972599cfSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2523972599cfSmrg	;;
2524972599cfSmrgesac
2525972599cfSmrg
2526972599cfSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2527972599cfSmrgif test "x$use_lint" = x"yes" ; then
2528972599cfSmrg   AC_PATH_PROG([LINT], [$lint_name])
2529972599cfSmrg   if test "x$LINT" = "x"; then
2530972599cfSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2531972599cfSmrg   fi
2532972599cfSmrgelif test "x$use_lint" = x"no" ; then
2533972599cfSmrg   if test "x$LINT" != "x"; then
2534972599cfSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2535972599cfSmrg   fi
2536972599cfSmrgelse
2537972599cfSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2538972599cfSmrgfi
2539972599cfSmrg
2540972599cfSmrg# User supplied flags override default flags
2541972599cfSmrgif test "x$LINT_FLAGS" != "x"; then
2542972599cfSmrg   lint_options=$LINT_FLAGS
2543972599cfSmrgfi
2544972599cfSmrg
2545972599cfSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2546972599cfSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2547972599cfSmrg
2548972599cfSmrg]) # XORG_WITH_LINT
2549972599cfSmrg
2550972599cfSmrg# XORG_LINT_LIBRARY(LIBNAME)
2551972599cfSmrg# --------------------------
2552972599cfSmrg# Minimum version: 1.1.0
2553972599cfSmrg#
2554972599cfSmrg# Sets up flags for building lint libraries for checking programs that call
2555972599cfSmrg# functions in the library.
2556972599cfSmrg#
2557972599cfSmrg# Interface to module:
2558972599cfSmrg# LINTLIB		- Automake variable with the name of lint library file to make
2559972599cfSmrg# MAKE_LINT_LIB		- Automake conditional
2560972599cfSmrg#
2561972599cfSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2562972599cfSmrg#			  - 'no' user instructs the module not to create a lint library (default)
2563972599cfSmrg
2564972599cfSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2565972599cfSmrgAC_REQUIRE([XORG_WITH_LINT])
2566972599cfSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2567972599cfSmrg	[Create lint library (default: disabled)])],
2568972599cfSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2569972599cfSmrg
2570972599cfSmrgif test "x$make_lint_lib" = x"yes" ; then
2571972599cfSmrg   LINTLIB=llib-l$1.ln
2572972599cfSmrg   if test "x$LINT" = "x"; then
2573972599cfSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2574972599cfSmrg   fi
2575972599cfSmrgelif test "x$make_lint_lib" != x"no" ; then
2576972599cfSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2577972599cfSmrgfi
2578972599cfSmrg
2579972599cfSmrgAC_SUBST(LINTLIB)
2580972599cfSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2581972599cfSmrg
2582972599cfSmrg]) # XORG_LINT_LIBRARY
2583972599cfSmrg
2584972599cfSmrg# XORG_COMPILER_BRAND
2585972599cfSmrg# -------------------
2586972599cfSmrg# Minimum version: 1.14.0
2587972599cfSmrg#
2588972599cfSmrg# Checks for various brands of compilers and sets flags as appropriate:
2589972599cfSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2590972599cfSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2591972599cfSmrg#   clang compiler - sets CLANGCC to "yes"
2592972599cfSmrg#   Intel compiler - sets INTELCC to "yes"
2593972599cfSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2594972599cfSmrg#
2595972599cfSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2596972599cfSmrgAC_LANG_CASE(
2597972599cfSmrg	[C], [
25989dd7914aSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
25999dd7914aSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
26009dd7914aSmrg		m4_version_prereq([2.70],
26019dd7914aSmrg			[AC_REQUIRE([AC_PROG_CC])],
26029dd7914aSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
2603972599cfSmrg	],
2604972599cfSmrg	[C++], [
2605972599cfSmrg		AC_REQUIRE([AC_PROG_CXX])
2606972599cfSmrg	]
2607972599cfSmrg)
2608972599cfSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2609972599cfSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2610972599cfSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2611972599cfSmrg]) # XORG_COMPILER_BRAND
2612972599cfSmrg
2613972599cfSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2614972599cfSmrg# ---------------
2615972599cfSmrg# Minimum version: 1.16.0
2616972599cfSmrg#
2617972599cfSmrg# Test if the compiler works when passed the given flag as a command line argument.
26189dd7914aSmrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
2619972599cfSmrg# next flag in the list until there are no more options.
2620972599cfSmrg#
2621972599cfSmrg# Note that this does not guarantee that the compiler supports the flag as some
2622972599cfSmrg# compilers will simply ignore arguments that they do not understand, but we do
2623972599cfSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2624972599cfSmrg# -Werror=unused-command-line-argument
2625972599cfSmrg#
2626972599cfSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2627972599cfSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2628972599cfSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2629972599cfSmrg
2630972599cfSmrgAC_LANG_COMPILER_REQUIRE
2631972599cfSmrg
2632972599cfSmrgAC_LANG_CASE(
2633972599cfSmrg	[C], [
26349dd7914aSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
26359dd7914aSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
26369dd7914aSmrg		m4_version_prereq([2.70],
26379dd7914aSmrg			[AC_REQUIRE([AC_PROG_CC])],
26389dd7914aSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
2639972599cfSmrg		define([PREFIX], [C])
2640972599cfSmrg		define([CACHE_PREFIX], [cc])
2641972599cfSmrg		define([COMPILER], [$CC])
2642972599cfSmrg	],
2643972599cfSmrg	[C++], [
2644972599cfSmrg		define([PREFIX], [CXX])
2645972599cfSmrg		define([CACHE_PREFIX], [cxx])
2646972599cfSmrg		define([COMPILER], [$CXX])
2647972599cfSmrg	]
2648972599cfSmrg)
2649972599cfSmrg
2650972599cfSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2651972599cfSmrg
2652972599cfSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
2653972599cfSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2654972599cfSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
2655972599cfSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2656972599cfSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2657972599cfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
2658972599cfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
2659972599cfSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
2660972599cfSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2661972599cfSmrgfi
2662972599cfSmrg
2663972599cfSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
2664972599cfSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
2665972599cfSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2666972599cfSmrg	fi
2667972599cfSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2668972599cfSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
2669972599cfSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2670972599cfSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2671972599cfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
2672972599cfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
2673972599cfSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
2674972599cfSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2675972599cfSmrgfi
2676972599cfSmrg
2677972599cfSmrgfound="no"
2678972599cfSmrgm4_foreach([flag], m4_cdr($@), [
2679972599cfSmrg	if test $found = "no" ; then
26805eeb4e8fSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
2681972599cfSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2682972599cfSmrg		fi
2683972599cfSmrg
26845eeb4e8fSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
2685972599cfSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2686972599cfSmrg		fi
2687972599cfSmrg
2688972599cfSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2689972599cfSmrg
2690972599cfSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2691972599cfSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
2692972599cfSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
2693972599cfSmrg		AC_CACHE_VAL($cacheid,
2694972599cfSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2695972599cfSmrg					     [eval $cacheid=yes],
2696972599cfSmrg					     [eval $cacheid=no])])
2697972599cfSmrg
2698972599cfSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2699972599cfSmrg
2700972599cfSmrg		eval supported=\$$cacheid
2701972599cfSmrg		AC_MSG_RESULT([$supported])
2702972599cfSmrg		if test "$supported" = "yes" ; then
2703972599cfSmrg			$1="$$1 ]flag["
2704972599cfSmrg			found="yes"
2705972599cfSmrg		fi
2706972599cfSmrg	fi
2707972599cfSmrg])
2708972599cfSmrg]) # XORG_TESTSET_CFLAG
2709972599cfSmrg
2710972599cfSmrg# XORG_COMPILER_FLAGS
2711972599cfSmrg# ---------------
2712972599cfSmrg# Minimum version: 1.16.0
2713972599cfSmrg#
2714972599cfSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2715972599cfSmrg# arguments supported by the selected compiler which do NOT alter the generated
2716972599cfSmrg# code.  These arguments will cause the compiler to print various warnings
2717972599cfSmrg# during compilation AND turn a conservative set of warnings into errors.
2718972599cfSmrg#
2719972599cfSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2720972599cfSmrg# future versions of util-macros as options are added to new compilers.
2721972599cfSmrg#
2722972599cfSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2723972599cfSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2724972599cfSmrg
2725972599cfSmrgAC_ARG_ENABLE(selective-werror,
2726972599cfSmrg              AS_HELP_STRING([--disable-selective-werror],
2727972599cfSmrg                             [Turn off selective compiler errors. (default: enabled)]),
2728972599cfSmrg              [SELECTIVE_WERROR=$enableval],
2729972599cfSmrg              [SELECTIVE_WERROR=yes])
2730972599cfSmrg
2731972599cfSmrgAC_LANG_CASE(
2732972599cfSmrg        [C], [
2733972599cfSmrg                define([PREFIX], [C])
2734972599cfSmrg        ],
2735972599cfSmrg        [C++], [
2736972599cfSmrg                define([PREFIX], [CXX])
2737972599cfSmrg        ]
2738972599cfSmrg)
2739972599cfSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2740972599cfSmrgif test "x$SUNCC" = "xyes"; then
2741972599cfSmrg    [BASE_]PREFIX[FLAGS]="-v"
2742972599cfSmrgelse
2743972599cfSmrg    [BASE_]PREFIX[FLAGS]=""
2744972599cfSmrgfi
2745972599cfSmrg
2746972599cfSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2747972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2748972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2749972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2750972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2751972599cfSmrg
2752972599cfSmrgAC_LANG_CASE(
2753972599cfSmrg	[C], [
2754972599cfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2755972599cfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2756972599cfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2757972599cfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
27585eeb4e8fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
2759972599cfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2760972599cfSmrg	]
2761972599cfSmrg)
2762972599cfSmrg
2763972599cfSmrg# This chunk adds additional warnings that could catch undesired effects.
2764972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2765972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2766972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2767972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2768972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2769972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
27705eeb4e8fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2771972599cfSmrg
2772972599cfSmrg# These are currently disabled because they are noisy.  They will be enabled
2773972599cfSmrg# in the future once the codebase is sufficiently modernized to silence
2774972599cfSmrg# them.  For now, I don't want them to drown out the other warnings.
2775972599cfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
2776972599cfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
27775eeb4e8fSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2778972599cfSmrg
27799dd7914aSmrg# Turn some warnings into errors, so we don't accidentally get successful builds
2780972599cfSmrg# when there are problems that should be fixed.
2781972599cfSmrg
2782972599cfSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
2783972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
2784972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
2785972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
2786972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
2787972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
2788972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
2789972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
2790972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
2791972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
2792972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
2793972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
2794972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
2795972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
2796972599cfSmrgelse
2797972599cfSmrgAC_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])
2798972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
2799972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
2800972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
2801972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
2802972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
2803972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
2804972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
2805972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
2806972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
2807972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
2808972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
2809972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
2810972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
2811972599cfSmrgfi
2812972599cfSmrg
2813972599cfSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2814972599cfSmrg]) # XORG_COMPILER_FLAGS
2815972599cfSmrg
2816972599cfSmrg# XORG_CWARNFLAGS
2817972599cfSmrg# ---------------
2818972599cfSmrg# Minimum version: 1.2.0
2819972599cfSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2820972599cfSmrg#
2821972599cfSmrg# Defines CWARNFLAGS to enable C compiler warnings.
2822972599cfSmrg#
2823972599cfSmrg# This function is deprecated because it defines -fno-strict-aliasing
2824972599cfSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
2825972599cfSmrg# is needed, then it should be added explicitly in the module when
2826972599cfSmrg# it is updated to use BASE_CFLAGS.
2827972599cfSmrg#
2828972599cfSmrgAC_DEFUN([XORG_CWARNFLAGS], [
2829972599cfSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2830972599cfSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2831972599cfSmrgAC_LANG_CASE(
2832972599cfSmrg	[C], [
2833972599cfSmrg		CWARNFLAGS="$BASE_CFLAGS"
2834972599cfSmrg		if  test "x$GCC" = xyes ; then
2835972599cfSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
2836972599cfSmrg		fi
2837972599cfSmrg		AC_SUBST(CWARNFLAGS)
2838972599cfSmrg	]
2839972599cfSmrg)
2840972599cfSmrg]) # XORG_CWARNFLAGS
2841972599cfSmrg
2842972599cfSmrg# XORG_STRICT_OPTION
2843972599cfSmrg# -----------------------
2844972599cfSmrg# Minimum version: 1.3.0
2845972599cfSmrg#
2846972599cfSmrg# Add configure option to enable strict compilation flags, such as treating
2847972599cfSmrg# warnings as fatal errors.
2848972599cfSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
2849972599cfSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
2850972599cfSmrg#
2851972599cfSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
2852972599cfSmrg# when strict compilation is unconditionally desired.
2853972599cfSmrgAC_DEFUN([XORG_STRICT_OPTION], [
2854972599cfSmrgAC_REQUIRE([XORG_CWARNFLAGS])
2855972599cfSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2856972599cfSmrg
2857972599cfSmrgAC_ARG_ENABLE(strict-compilation,
2858972599cfSmrg			  AS_HELP_STRING([--enable-strict-compilation],
2859972599cfSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2860972599cfSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2861972599cfSmrg
2862972599cfSmrgAC_LANG_CASE(
2863972599cfSmrg        [C], [
2864972599cfSmrg                define([PREFIX], [C])
2865972599cfSmrg        ],
2866972599cfSmrg        [C++], [
2867972599cfSmrg                define([PREFIX], [CXX])
2868972599cfSmrg        ]
2869972599cfSmrg)
2870972599cfSmrg
2871972599cfSmrg[STRICT_]PREFIX[FLAGS]=""
2872972599cfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
2873972599cfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
2874972599cfSmrg
2875972599cfSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
2876972599cfSmrg# activate it with -Werror, so we add it here explicitly.
2877972599cfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
2878972599cfSmrg
2879972599cfSmrgif test "x$STRICT_COMPILE" = "xyes"; then
2880972599cfSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
2881972599cfSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
2882972599cfSmrgfi
2883972599cfSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
2884972599cfSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2885972599cfSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
2886972599cfSmrg]) # XORG_STRICT_OPTION
2887972599cfSmrg
28889dd7914aSmrg# XORG_DEFAULT_NOCODE_OPTIONS
28899dd7914aSmrg# ---------------------------
28909dd7914aSmrg# Minimum version: 1.20.0
28919dd7914aSmrg#
28929dd7914aSmrg# Defines default options for X.Org modules which don't compile code,
28939dd7914aSmrg# such as fonts, bitmaps, cursors, and docs.
28949dd7914aSmrg#
28959dd7914aSmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
28969dd7914aSmrgAC_REQUIRE([AC_PROG_INSTALL])
28979dd7914aSmrgXORG_RELEASE_VERSION
28989dd7914aSmrgXORG_CHANGELOG
28999dd7914aSmrgXORG_INSTALL
29009dd7914aSmrgXORG_MANPAGE_SECTIONS
29019dd7914aSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
29029dd7914aSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
29039dd7914aSmrg]) # XORG_DEFAULT_NOCODE_OPTIONS
29049dd7914aSmrg
2905972599cfSmrg# XORG_DEFAULT_OPTIONS
2906972599cfSmrg# --------------------
2907972599cfSmrg# Minimum version: 1.3.0
2908972599cfSmrg#
29099dd7914aSmrg# Defines default options for X.Org modules which compile code.
2910972599cfSmrg#
2911972599cfSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
2912972599cfSmrgAC_REQUIRE([AC_PROG_INSTALL])
2913972599cfSmrgXORG_COMPILER_FLAGS
2914972599cfSmrgXORG_CWARNFLAGS
2915972599cfSmrgXORG_STRICT_OPTION
29169dd7914aSmrgXORG_DEFAULT_NOCODE_OPTIONS
2917972599cfSmrg]) # XORG_DEFAULT_OPTIONS
2918972599cfSmrg
2919972599cfSmrg# XORG_INSTALL()
2920972599cfSmrg# ----------------
2921972599cfSmrg# Minimum version: 1.4.0
2922972599cfSmrg#
2923972599cfSmrg# Defines the variable INSTALL_CMD as the command to copy
2924972599cfSmrg# INSTALL from $prefix/share/util-macros.
2925972599cfSmrg#
2926972599cfSmrgAC_DEFUN([XORG_INSTALL], [
2927972599cfSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2928972599cfSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
2929972599cfSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
2930972599cfSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
29319dd7914aSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
29329dd7914aSmrgtouch \$(top_srcdir)/INSTALL; \
29339dd7914aSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
2934972599cfSmrgAC_SUBST([INSTALL_CMD])
2935972599cfSmrg]) # XORG_INSTALL
2936972599cfSmrgdnl Copyright 2005 Red Hat, Inc
2937972599cfSmrgdnl
2938972599cfSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
2939972599cfSmrgdnl documentation for any purpose is hereby granted without fee, provided that
2940972599cfSmrgdnl the above copyright notice appear in all copies and that both that
2941972599cfSmrgdnl copyright notice and this permission notice appear in supporting
2942972599cfSmrgdnl documentation.
2943972599cfSmrgdnl
2944972599cfSmrgdnl The above copyright notice and this permission notice shall be included
2945972599cfSmrgdnl in all copies or substantial portions of the Software.
2946972599cfSmrgdnl
2947972599cfSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2948972599cfSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2949972599cfSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2950972599cfSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2951972599cfSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2952972599cfSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2953972599cfSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
2954972599cfSmrgdnl
2955972599cfSmrgdnl Except as contained in this notice, the name of the copyright holders shall
2956972599cfSmrgdnl not be used in advertising or otherwise to promote the sale, use or
2957972599cfSmrgdnl other dealings in this Software without prior written authorization
2958972599cfSmrgdnl from the copyright holders.
2959972599cfSmrgdnl
2960972599cfSmrg
2961972599cfSmrg# XORG_RELEASE_VERSION
2962972599cfSmrg# --------------------
2963972599cfSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
29645eeb4e8fSmrg
2965972599cfSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
2966972599cfSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
2967972599cfSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
2968972599cfSmrg		[Major version of this package])
2969972599cfSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
2970972599cfSmrg	if test "x$PVM" = "x"; then
2971972599cfSmrg		PVM="0"
2972972599cfSmrg	fi
2973972599cfSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
2974972599cfSmrg		[$PVM],
2975972599cfSmrg		[Minor version of this package])
2976972599cfSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
2977972599cfSmrg	if test "x$PVP" = "x"; then
2978972599cfSmrg		PVP="0"
2979972599cfSmrg	fi
2980972599cfSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
2981972599cfSmrg		[$PVP],
2982972599cfSmrg		[Patch version of this package])
2983972599cfSmrg])
2984972599cfSmrg
2985972599cfSmrg# XORG_CHANGELOG()
2986972599cfSmrg# ----------------
2987972599cfSmrg# Minimum version: 1.2.0
2988972599cfSmrg#
2989972599cfSmrg# Defines the variable CHANGELOG_CMD as the command to generate
2990972599cfSmrg# ChangeLog from git.
2991972599cfSmrg#
2992972599cfSmrg#
2993972599cfSmrgAC_DEFUN([XORG_CHANGELOG], [
29949dd7914aSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
2995972599cfSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
29969dd7914aSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
29979dd7914aSmrgtouch \$(top_srcdir)/ChangeLog; \
29989dd7914aSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
2999972599cfSmrgAC_SUBST([CHANGELOG_CMD])
3000972599cfSmrg]) # XORG_CHANGELOG
3001972599cfSmrg
3002