aclocal.m4 revision 3fb1fa07
13fb1fa07Smrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
2c82dfdfbSmrg
33fb1fa07Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
4f46a6179Smrg
5f46a6179Smrg# This file is free software; the Free Software Foundation
6f46a6179Smrg# gives unlimited permission to copy and/or distribute it,
7f46a6179Smrg# with or without modifications, as long as this notice is preserved.
8f46a6179Smrg
9f46a6179Smrg# This program is distributed in the hope that it will be useful,
10f46a6179Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11f46a6179Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12f46a6179Smrg# PARTICULAR PURPOSE.
13f46a6179Smrg
14c82dfdfbSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15f46a6179Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16f46a6179Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17c82dfdfbSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
18c82dfdfbSmrg[m4_warning([this file was generated for autoconf 2.69.
19f46a6179SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20f46a6179SmrgIf you have problems, you may need to regenerate the build system entirely.
21c82dfdfbSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22c82dfdfbSmrg
23c82dfdfbSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
24c82dfdfbSmrg# serial 1 (pkg-config-0.24)
25c82dfdfbSmrg# 
26c82dfdfbSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
27c82dfdfbSmrg#
28c82dfdfbSmrg# This program is free software; you can redistribute it and/or modify
29c82dfdfbSmrg# it under the terms of the GNU General Public License as published by
30c82dfdfbSmrg# the Free Software Foundation; either version 2 of the License, or
31c82dfdfbSmrg# (at your option) any later version.
32c82dfdfbSmrg#
33c82dfdfbSmrg# This program is distributed in the hope that it will be useful, but
34c82dfdfbSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
35c82dfdfbSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
36c82dfdfbSmrg# General Public License for more details.
37c82dfdfbSmrg#
38c82dfdfbSmrg# You should have received a copy of the GNU General Public License
39c82dfdfbSmrg# along with this program; if not, write to the Free Software
40c82dfdfbSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
41c82dfdfbSmrg#
42c82dfdfbSmrg# As a special exception to the GNU General Public License, if you
43c82dfdfbSmrg# distribute this file as part of a program that contains a
44c82dfdfbSmrg# configuration script generated by Autoconf, you may include it under
45c82dfdfbSmrg# the same distribution terms that you use for the rest of that program.
46c82dfdfbSmrg
47c82dfdfbSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
48c82dfdfbSmrg# ----------------------------------
49c82dfdfbSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
50c82dfdfbSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
51c82dfdfbSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
52c82dfdfbSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
53c82dfdfbSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
54c82dfdfbSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
55c82dfdfbSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
56c82dfdfbSmrg
57c82dfdfbSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
58c82dfdfbSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
59c82dfdfbSmrgfi
60c82dfdfbSmrgif test -n "$PKG_CONFIG"; then
61c82dfdfbSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
62c82dfdfbSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
63c82dfdfbSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
64c82dfdfbSmrg		AC_MSG_RESULT([yes])
65c82dfdfbSmrg	else
66c82dfdfbSmrg		AC_MSG_RESULT([no])
67c82dfdfbSmrg		PKG_CONFIG=""
68c82dfdfbSmrg	fi
69c82dfdfbSmrgfi[]dnl
70c82dfdfbSmrg])# PKG_PROG_PKG_CONFIG
71c82dfdfbSmrg
72c82dfdfbSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
73c82dfdfbSmrg#
74c82dfdfbSmrg# Check to see whether a particular set of modules exists.  Similar
75c82dfdfbSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
76c82dfdfbSmrg#
77c82dfdfbSmrg# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
78c82dfdfbSmrg# only at the first occurence in configure.ac, so if the first place
79c82dfdfbSmrg# it's called might be skipped (such as if it is within an "if", you
80c82dfdfbSmrg# have to call PKG_CHECK_EXISTS manually
81c82dfdfbSmrg# --------------------------------------------------------------
82c82dfdfbSmrgAC_DEFUN([PKG_CHECK_EXISTS],
83c82dfdfbSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
84c82dfdfbSmrgif test -n "$PKG_CONFIG" && \
85c82dfdfbSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
86c82dfdfbSmrg  m4_default([$2], [:])
87c82dfdfbSmrgm4_ifvaln([$3], [else
88c82dfdfbSmrg  $3])dnl
89c82dfdfbSmrgfi])
90c82dfdfbSmrg
91c82dfdfbSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
92c82dfdfbSmrg# ---------------------------------------------
93c82dfdfbSmrgm4_define([_PKG_CONFIG],
94c82dfdfbSmrg[if test -n "$$1"; then
95c82dfdfbSmrg    pkg_cv_[]$1="$$1"
96c82dfdfbSmrg elif test -n "$PKG_CONFIG"; then
97c82dfdfbSmrg    PKG_CHECK_EXISTS([$3],
98c82dfdfbSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
99c82dfdfbSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
100c82dfdfbSmrg		     [pkg_failed=yes])
101c82dfdfbSmrg else
102c82dfdfbSmrg    pkg_failed=untried
103c82dfdfbSmrgfi[]dnl
104c82dfdfbSmrg])# _PKG_CONFIG
105c82dfdfbSmrg
106c82dfdfbSmrg# _PKG_SHORT_ERRORS_SUPPORTED
107c82dfdfbSmrg# -----------------------------
108c82dfdfbSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
109c82dfdfbSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
110c82dfdfbSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
111c82dfdfbSmrg        _pkg_short_errors_supported=yes
112c82dfdfbSmrgelse
113c82dfdfbSmrg        _pkg_short_errors_supported=no
114c82dfdfbSmrgfi[]dnl
115c82dfdfbSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
116c82dfdfbSmrg
117c82dfdfbSmrg
118c82dfdfbSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
119c82dfdfbSmrg# [ACTION-IF-NOT-FOUND])
120c82dfdfbSmrg#
121c82dfdfbSmrg#
122c82dfdfbSmrg# Note that if there is a possibility the first call to
123c82dfdfbSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
124c82dfdfbSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
125c82dfdfbSmrg#
126c82dfdfbSmrg#
127c82dfdfbSmrg# --------------------------------------------------------------
128c82dfdfbSmrgAC_DEFUN([PKG_CHECK_MODULES],
129c82dfdfbSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
130c82dfdfbSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
131c82dfdfbSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
132c82dfdfbSmrg
133c82dfdfbSmrgpkg_failed=no
134c82dfdfbSmrgAC_MSG_CHECKING([for $1])
135c82dfdfbSmrg
136c82dfdfbSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
137c82dfdfbSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
138c82dfdfbSmrg
139c82dfdfbSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
140c82dfdfbSmrgand $1[]_LIBS to avoid the need to call pkg-config.
141c82dfdfbSmrgSee the pkg-config man page for more details.])
142c82dfdfbSmrg
143c82dfdfbSmrgif test $pkg_failed = yes; then
144c82dfdfbSmrg   	AC_MSG_RESULT([no])
145c82dfdfbSmrg        _PKG_SHORT_ERRORS_SUPPORTED
146c82dfdfbSmrg        if test $_pkg_short_errors_supported = yes; then
147c82dfdfbSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
148c82dfdfbSmrg        else 
149c82dfdfbSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
150c82dfdfbSmrg        fi
151c82dfdfbSmrg	# Put the nasty error message in config.log where it belongs
152c82dfdfbSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
153c82dfdfbSmrg
154c82dfdfbSmrg	m4_default([$4], [AC_MSG_ERROR(
155c82dfdfbSmrg[Package requirements ($2) were not met:
156c82dfdfbSmrg
157c82dfdfbSmrg$$1_PKG_ERRORS
158c82dfdfbSmrg
159c82dfdfbSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
160c82dfdfbSmrginstalled software in a non-standard prefix.
161c82dfdfbSmrg
162c82dfdfbSmrg_PKG_TEXT])[]dnl
163c82dfdfbSmrg        ])
164c82dfdfbSmrgelif test $pkg_failed = untried; then
165c82dfdfbSmrg     	AC_MSG_RESULT([no])
166c82dfdfbSmrg	m4_default([$4], [AC_MSG_FAILURE(
167c82dfdfbSmrg[The pkg-config script could not be found or is too old.  Make sure it
168c82dfdfbSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
169c82dfdfbSmrgpath to pkg-config.
170f46a6179Smrg
171c82dfdfbSmrg_PKG_TEXT
172c82dfdfbSmrg
173c82dfdfbSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
174c82dfdfbSmrg        ])
175c82dfdfbSmrgelse
176c82dfdfbSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
177c82dfdfbSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
178c82dfdfbSmrg        AC_MSG_RESULT([yes])
179c82dfdfbSmrg	$3
180c82dfdfbSmrgfi[]dnl
181c82dfdfbSmrg])# PKG_CHECK_MODULES
182c82dfdfbSmrg
183c82dfdfbSmrg
184c82dfdfbSmrg# PKG_INSTALLDIR(DIRECTORY)
185c82dfdfbSmrg# -------------------------
186c82dfdfbSmrg# Substitutes the variable pkgconfigdir as the location where a module
187c82dfdfbSmrg# should install pkg-config .pc files. By default the directory is
188c82dfdfbSmrg# $libdir/pkgconfig, but the default can be changed by passing
189c82dfdfbSmrg# DIRECTORY. The user can override through the --with-pkgconfigdir
190c82dfdfbSmrg# parameter.
191c82dfdfbSmrgAC_DEFUN([PKG_INSTALLDIR],
192c82dfdfbSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
193c82dfdfbSmrgm4_pushdef([pkg_description],
194c82dfdfbSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
195c82dfdfbSmrgAC_ARG_WITH([pkgconfigdir],
196c82dfdfbSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
197c82dfdfbSmrg    [with_pkgconfigdir=]pkg_default)
198c82dfdfbSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
199c82dfdfbSmrgm4_popdef([pkg_default])
200c82dfdfbSmrgm4_popdef([pkg_description])
201c82dfdfbSmrg]) dnl PKG_INSTALLDIR
202c82dfdfbSmrg
203c82dfdfbSmrg
204c82dfdfbSmrg# PKG_NOARCH_INSTALLDIR(DIRECTORY)
205c82dfdfbSmrg# -------------------------
206c82dfdfbSmrg# Substitutes the variable noarch_pkgconfigdir as the location where a
207c82dfdfbSmrg# module should install arch-independent pkg-config .pc files. By
208c82dfdfbSmrg# default the directory is $datadir/pkgconfig, but the default can be
209c82dfdfbSmrg# changed by passing DIRECTORY. The user can override through the
210c82dfdfbSmrg# --with-noarch-pkgconfigdir parameter.
211c82dfdfbSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
212c82dfdfbSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
213c82dfdfbSmrgm4_pushdef([pkg_description],
214c82dfdfbSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
215c82dfdfbSmrgAC_ARG_WITH([noarch-pkgconfigdir],
216c82dfdfbSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
217c82dfdfbSmrg    [with_noarch_pkgconfigdir=]pkg_default)
218c82dfdfbSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
219c82dfdfbSmrgm4_popdef([pkg_default])
220c82dfdfbSmrgm4_popdef([pkg_description])
221c82dfdfbSmrg]) dnl PKG_NOARCH_INSTALLDIR
222c82dfdfbSmrg
223c82dfdfbSmrg
224c82dfdfbSmrg# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
225c82dfdfbSmrg# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
226c82dfdfbSmrg# -------------------------------------------
227c82dfdfbSmrg# Retrieves the value of the pkg-config variable for the given module.
228c82dfdfbSmrgAC_DEFUN([PKG_CHECK_VAR],
229c82dfdfbSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
230c82dfdfbSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
231c82dfdfbSmrg
232c82dfdfbSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
233c82dfdfbSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
234c82dfdfbSmrg
235c82dfdfbSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
236c82dfdfbSmrg])# PKG_CHECK_VAR
237c82dfdfbSmrg
2383fb1fa07Smrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
23907d2e718Smrg#
2401d8c7986Smrg# This file is free software; the Free Software Foundation
2411d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
2421d8c7986Smrg# with or without modifications, as long as this notice is preserved.
24307d2e718Smrg
2441d8c7986Smrg# AM_AUTOMAKE_VERSION(VERSION)
2451d8c7986Smrg# ----------------------------
2461d8c7986Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
2471d8c7986Smrg# generated from the m4 files accompanying Automake X.Y.
2481d8c7986Smrg# (This private macro should not be called outside this file.)
2491d8c7986SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
2503fb1fa07Smrg[am__api_version='1.15'
2511d8c7986Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
2521d8c7986Smrgdnl require some minimum version.  Point them to the right macro.
2533fb1fa07Smrgm4_if([$1], [1.15], [],
2541d8c7986Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
2551d8c7986Smrg])
25607d2e718Smrg
2571d8c7986Smrg# _AM_AUTOCONF_VERSION(VERSION)
2581d8c7986Smrg# -----------------------------
2591d8c7986Smrg# aclocal traces this macro to find the Autoconf version.
2601d8c7986Smrg# This is a private macro too.  Using m4_define simplifies
2611d8c7986Smrg# the logic in aclocal, which can simply ignore this definition.
2621d8c7986Smrgm4_define([_AM_AUTOCONF_VERSION], [])
26307d2e718Smrg
2641d8c7986Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
2651d8c7986Smrg# -------------------------------
2661d8c7986Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
2671d8c7986Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
2681d8c7986SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
2693fb1fa07Smrg[AM_AUTOMAKE_VERSION([1.15])dnl
2701d8c7986Smrgm4_ifndef([AC_AUTOCONF_VERSION],
2711d8c7986Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
2721d8c7986Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
27307d2e718Smrg
2741d8c7986Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
27507d2e718Smrg
2763fb1fa07Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
2771d8c7986Smrg#
2781d8c7986Smrg# This file is free software; the Free Software Foundation
2791d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
2801d8c7986Smrg# with or without modifications, as long as this notice is preserved.
28107d2e718Smrg
2821d8c7986Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
283c82dfdfbSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
284c82dfdfbSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
28507d2e718Smrg#
2861d8c7986Smrg# Of course, Automake must honor this variable whenever it calls a
2871d8c7986Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
2881d8c7986Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
2891d8c7986Smrg# depending on how configure is run.  This is pretty annoying, since
2901d8c7986Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
2911d8c7986Smrg# source directory, any form will work fine, but in subdirectories a
2921d8c7986Smrg# relative path needs to be adjusted first.
29307d2e718Smrg#
2941d8c7986Smrg# $ac_aux_dir/missing
2951d8c7986Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
2961d8c7986Smrg# $top_srcdir/$ac_aux_dir/missing
2971d8c7986Smrg#    fails if $ac_aux_dir is absolute,
2981d8c7986Smrg#    fails when called from a subdirectory in a VPATH build with
2991d8c7986Smrg#          a relative $ac_aux_dir
30007d2e718Smrg#
3011d8c7986Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
3021d8c7986Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
303c82dfdfbSmrg# harmless because $srcdir is '.', but things will broke when you
3041d8c7986Smrg# start a VPATH build or use an absolute $srcdir.
30507d2e718Smrg#
3061d8c7986Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
3071d8c7986Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
3081d8c7986Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
3091d8c7986Smrg# and then we would define $MISSING as
3101d8c7986Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
3111d8c7986Smrg# This will work as long as MISSING is not called from configure, because
3121d8c7986Smrg# unfortunately $(top_srcdir) has no meaning in configure.
3131d8c7986Smrg# However there are other variables, like CC, which are often used in
3141d8c7986Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
3151d8c7986Smrg#
3161d8c7986Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
3171d8c7986Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
3181d8c7986Smrg# configured tree to be moved without reconfiguration.
31907d2e718Smrg
3201d8c7986SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
3213fb1fa07Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
3223fb1fa07Smrg# Expand $ac_aux_dir to an absolute path.
3233fb1fa07Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
3241d8c7986Smrg])
32507d2e718Smrg
3261d8c7986Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
32707d2e718Smrg
3283fb1fa07Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
3291d8c7986Smrg#
3301d8c7986Smrg# This file is free software; the Free Software Foundation
3311d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
3321d8c7986Smrg# with or without modifications, as long as this notice is preserved.
33307d2e718Smrg
3341d8c7986Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
3351d8c7986Smrg# -------------------------------------
3361d8c7986Smrg# Define a conditional.
3371d8c7986SmrgAC_DEFUN([AM_CONDITIONAL],
338c82dfdfbSmrg[AC_PREREQ([2.52])dnl
339c82dfdfbSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
340c82dfdfbSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
3411d8c7986SmrgAC_SUBST([$1_TRUE])dnl
3421d8c7986SmrgAC_SUBST([$1_FALSE])dnl
3431d8c7986Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
3441d8c7986Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
3451d8c7986Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
3461d8c7986Smrgif $2; then
3471d8c7986Smrg  $1_TRUE=
3481d8c7986Smrg  $1_FALSE='#'
3491d8c7986Smrgelse
3501d8c7986Smrg  $1_TRUE='#'
3511d8c7986Smrg  $1_FALSE=
3521d8c7986Smrgfi
3531d8c7986SmrgAC_CONFIG_COMMANDS_PRE(
3541d8c7986Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
3551d8c7986Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
3561d8c7986SmrgUsually this means the macro was only invoked conditionally.]])
3571d8c7986Smrgfi])])
35807d2e718Smrg
3593fb1fa07Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
3601d8c7986Smrg#
3611d8c7986Smrg# This file is free software; the Free Software Foundation
3621d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
3631d8c7986Smrg# with or without modifications, as long as this notice is preserved.
36407d2e718Smrg
36507d2e718Smrg
366c82dfdfbSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
3671d8c7986Smrg# written in clear, in which case automake, when reading aclocal.m4,
3681d8c7986Smrg# will think it sees a *use*, and therefore will trigger all it's
3691d8c7986Smrg# C support machinery.  Also note that it means that autoscan, seeing
3701d8c7986Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
37107d2e718Smrg
37207d2e718Smrg
3731d8c7986Smrg# _AM_DEPENDENCIES(NAME)
3741d8c7986Smrg# ----------------------
3751d8c7986Smrg# See how the compiler implements dependency checking.
376c82dfdfbSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
3771d8c7986Smrg# We try a few techniques and use that to set a single cache variable.
3781d8c7986Smrg#
3791d8c7986Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
3801d8c7986Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
3811d8c7986Smrg# dependency, and given that the user is not expected to run this macro,
3821d8c7986Smrg# just rely on AC_PROG_CC.
3831d8c7986SmrgAC_DEFUN([_AM_DEPENDENCIES],
3841d8c7986Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
3851d8c7986SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
3861d8c7986SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
3871d8c7986SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
38807d2e718Smrg
389c82dfdfbSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
390c82dfdfbSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
391c82dfdfbSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
392c82dfdfbSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
393c82dfdfbSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
394c82dfdfbSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
395c82dfdfbSmrg                    [depcc="$$1"   am_compiler_list=])
3965fac8b10Smrg
3971d8c7986SmrgAC_CACHE_CHECK([dependency style of $depcc],
3981d8c7986Smrg               [am_cv_$1_dependencies_compiler_type],
3991d8c7986Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
4001d8c7986Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
4011d8c7986Smrg  # making bogus files that we don't know about and never remove.  For
4021d8c7986Smrg  # instance it was reported that on HP-UX the gcc test will end up
403c82dfdfbSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
404c82dfdfbSmrg  # in D".
405c82dfdfbSmrg  rm -rf conftest.dir
4061d8c7986Smrg  mkdir conftest.dir
4071d8c7986Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
4081d8c7986Smrg  # using a relative directory.
4091d8c7986Smrg  cp "$am_depcomp" conftest.dir
4101d8c7986Smrg  cd conftest.dir
4111d8c7986Smrg  # We will build objects and dependencies in a subdirectory because
4121d8c7986Smrg  # it helps to detect inapplicable dependency modes.  For instance
4131d8c7986Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
4141d8c7986Smrg  # side effect of compilation, but ICC will put the dependencies in
4151d8c7986Smrg  # the current directory while Tru64 will put them in the object
4161d8c7986Smrg  # directory.
4171d8c7986Smrg  mkdir sub
418f46a6179Smrg
4191d8c7986Smrg  am_cv_$1_dependencies_compiler_type=none
4201d8c7986Smrg  if test "$am_compiler_list" = ""; then
4211d8c7986Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
4221d8c7986Smrg  fi
4231d8c7986Smrg  am__universal=false
4241d8c7986Smrg  m4_case([$1], [CC],
4251d8c7986Smrg    [case " $depcc " in #(
4261d8c7986Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
4271d8c7986Smrg     esac],
4281d8c7986Smrg    [CXX],
4291d8c7986Smrg    [case " $depcc " in #(
4301d8c7986Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
4311d8c7986Smrg     esac])
432f46a6179Smrg
4331d8c7986Smrg  for depmode in $am_compiler_list; do
4341d8c7986Smrg    # Setup a source with many dependencies, because some compilers
4351d8c7986Smrg    # like to wrap large dependency lists on column 80 (with \), and
4361d8c7986Smrg    # we should not choose a depcomp mode which is confused by this.
4371d8c7986Smrg    #
4381d8c7986Smrg    # We need to recreate these files for each test, as the compiler may
4391d8c7986Smrg    # overwrite some of them when testing with obscure command lines.
4401d8c7986Smrg    # This happens at least with the AIX C compiler.
4411d8c7986Smrg    : > sub/conftest.c
4421d8c7986Smrg    for i in 1 2 3 4 5 6; do
4431d8c7986Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
444c82dfdfbSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
445c82dfdfbSmrg      # Solaris 10 /bin/sh.
446c82dfdfbSmrg      echo '/* dummy */' > sub/conftst$i.h
4471d8c7986Smrg    done
4481d8c7986Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
449f46a6179Smrg
450c82dfdfbSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
4511d8c7986Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
452c82dfdfbSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
453c82dfdfbSmrg    # versions had trouble with output in subdirs.
4541d8c7986Smrg    am__obj=sub/conftest.${OBJEXT-o}
4551d8c7986Smrg    am__minus_obj="-o $am__obj"
4561d8c7986Smrg    case $depmode in
4571d8c7986Smrg    gcc)
4581d8c7986Smrg      # This depmode causes a compiler race in universal mode.
4591d8c7986Smrg      test "$am__universal" = false || continue
4601d8c7986Smrg      ;;
4611d8c7986Smrg    nosideeffect)
462c82dfdfbSmrg      # After this tag, mechanisms are not by side-effect, so they'll
463c82dfdfbSmrg      # only be used when explicitly requested.
4641d8c7986Smrg      if test "x$enable_dependency_tracking" = xyes; then
4651d8c7986Smrg	continue
4661d8c7986Smrg      else
4671d8c7986Smrg	break
4681d8c7986Smrg      fi
4691d8c7986Smrg      ;;
470c82dfdfbSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
471c82dfdfbSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
4721d8c7986Smrg      # not run yet.  These depmodes are late enough in the game, and
4731d8c7986Smrg      # so weak that their functioning should not be impacted.
4741d8c7986Smrg      am__obj=conftest.${OBJEXT-o}
4751d8c7986Smrg      am__minus_obj=
4761d8c7986Smrg      ;;
4771d8c7986Smrg    none) break ;;
4781d8c7986Smrg    esac
4791d8c7986Smrg    if depmode=$depmode \
4801d8c7986Smrg       source=sub/conftest.c object=$am__obj \
4811d8c7986Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
4821d8c7986Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
4831d8c7986Smrg         >/dev/null 2>conftest.err &&
4841d8c7986Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
4851d8c7986Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
4861d8c7986Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
4871d8c7986Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
4881d8c7986Smrg      # icc doesn't choke on unknown options, it will just issue warnings
4891d8c7986Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
4901d8c7986Smrg      # that says an option was ignored or not supported.
4911d8c7986Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
4921d8c7986Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
4931d8c7986Smrg      # The diagnosis changed in icc 8.0:
4941d8c7986Smrg      #   icc: Command line remark: option '-MP' not supported
4951d8c7986Smrg      if (grep 'ignoring option' conftest.err ||
4961d8c7986Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
4971d8c7986Smrg        am_cv_$1_dependencies_compiler_type=$depmode
4981d8c7986Smrg        break
4991d8c7986Smrg      fi
5001d8c7986Smrg    fi
5011d8c7986Smrg  done
5021d8c7986Smrg
5031d8c7986Smrg  cd ..
5041d8c7986Smrg  rm -rf conftest.dir
5055fac8b10Smrgelse
5061d8c7986Smrg  am_cv_$1_dependencies_compiler_type=none
507f46a6179Smrgfi
5081d8c7986Smrg])
5091d8c7986SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
5101d8c7986SmrgAM_CONDITIONAL([am__fastdep$1], [
5111d8c7986Smrg  test "x$enable_dependency_tracking" != xno \
5121d8c7986Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
5131d8c7986Smrg])
514f46a6179Smrg
515f46a6179Smrg
5161d8c7986Smrg# AM_SET_DEPDIR
5171d8c7986Smrg# -------------
5181d8c7986Smrg# Choose a directory name for dependency files.
519c82dfdfbSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
5201d8c7986SmrgAC_DEFUN([AM_SET_DEPDIR],
5211d8c7986Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
5221d8c7986SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
5231d8c7986Smrg])
524f46a6179Smrg
525f46a6179Smrg
5261d8c7986Smrg# AM_DEP_TRACK
5271d8c7986Smrg# ------------
5281d8c7986SmrgAC_DEFUN([AM_DEP_TRACK],
529c82dfdfbSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
530c82dfdfbSmrgAS_HELP_STRING(
531c82dfdfbSmrg  [--enable-dependency-tracking],
532c82dfdfbSmrg  [do not reject slow dependency extractors])
533c82dfdfbSmrgAS_HELP_STRING(
534c82dfdfbSmrg  [--disable-dependency-tracking],
535c82dfdfbSmrg  [speeds up one-time build])])
5361d8c7986Smrgif test "x$enable_dependency_tracking" != xno; then
5371d8c7986Smrg  am_depcomp="$ac_aux_dir/depcomp"
5381d8c7986Smrg  AMDEPBACKSLASH='\'
539c82dfdfbSmrg  am__nodep='_no'
540690143ccSmrgfi
5411d8c7986SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
5421d8c7986SmrgAC_SUBST([AMDEPBACKSLASH])dnl
5431d8c7986Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
544c82dfdfbSmrgAC_SUBST([am__nodep])dnl
545c82dfdfbSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
5461d8c7986Smrg])
547f46a6179Smrg
5481d8c7986Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
549f46a6179Smrg
5503fb1fa07Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
5511d8c7986Smrg#
5521d8c7986Smrg# This file is free software; the Free Software Foundation
5531d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
5541d8c7986Smrg# with or without modifications, as long as this notice is preserved.
555f46a6179Smrg
556f46a6179Smrg
5571d8c7986Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
5581d8c7986Smrg# ------------------------------
5591d8c7986SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
5601d8c7986Smrg[{
561c82dfdfbSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
5621d8c7986Smrg  # are listed without --file.  Let's play safe and only enable the eval
5631d8c7986Smrg  # if we detect the quoting.
5641d8c7986Smrg  case $CONFIG_FILES in
5651d8c7986Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
5661d8c7986Smrg  *)   set x $CONFIG_FILES ;;
5671d8c7986Smrg  esac
5681d8c7986Smrg  shift
5691d8c7986Smrg  for mf
5701d8c7986Smrg  do
5711d8c7986Smrg    # Strip MF so we end up with the name of the file.
5721d8c7986Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
5731d8c7986Smrg    # Check whether this is an Automake generated Makefile or not.
574c82dfdfbSmrg    # We used to match only the files named 'Makefile.in', but
5751d8c7986Smrg    # some people rename them; so instead we look at the file content.
5761d8c7986Smrg    # Grep'ing the first line is not enough: some people post-process
5771d8c7986Smrg    # each Makefile.in and add a new line on top of each file to say so.
5781d8c7986Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
5791d8c7986Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
5801d8c7986Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
5811d8c7986Smrg      dirpart=`AS_DIRNAME("$mf")`
5821d8c7986Smrg    else
5831d8c7986Smrg      continue
5841d8c7986Smrg    fi
5851d8c7986Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
586c82dfdfbSmrg    # from the Makefile without running 'make'.
5871d8c7986Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
5881d8c7986Smrg    test -z "$DEPDIR" && continue
5891d8c7986Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
590c82dfdfbSmrg    test -z "$am__include" && continue
5911d8c7986Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
5921d8c7986Smrg    # Find all dependency output files, they are included files with
5931d8c7986Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
5941d8c7986Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
5951d8c7986Smrg    # expansion.
5961d8c7986Smrg    for file in `sed -n "
5971d8c7986Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
598c82dfdfbSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
5991d8c7986Smrg      # Make sure the directory exists.
6001d8c7986Smrg      test -f "$dirpart/$file" && continue
6011d8c7986Smrg      fdir=`AS_DIRNAME(["$file"])`
6021d8c7986Smrg      AS_MKDIR_P([$dirpart/$fdir])
6031d8c7986Smrg      # echo "creating $dirpart/$file"
6041d8c7986Smrg      echo '# dummy' > "$dirpart/$file"
6051d8c7986Smrg    done
6061d8c7986Smrg  done
6071d8c7986Smrg}
6081d8c7986Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
609690143ccSmrg
610690143ccSmrg
6111d8c7986Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
6121d8c7986Smrg# -----------------------------
6131d8c7986Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
614690143ccSmrg#
6151d8c7986Smrg# This code is only required when automatic dependency tracking
616c82dfdfbSmrg# is enabled.  FIXME.  This creates each '.P' file that we will
6171d8c7986Smrg# need in order to bootstrap the dependency handling code.
6181d8c7986SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
6191d8c7986Smrg[AC_CONFIG_COMMANDS([depfiles],
6201d8c7986Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
6211d8c7986Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
6221d8c7986Smrg])
623f46a6179Smrg
6241d8c7986Smrg# Do all the work for Automake.                             -*- Autoconf -*-
625f46a6179Smrg
6263fb1fa07Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
627690143ccSmrg#
6281d8c7986Smrg# This file is free software; the Free Software Foundation
6291d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
6301d8c7986Smrg# with or without modifications, as long as this notice is preserved.
631690143ccSmrg
6321d8c7986Smrg# This macro actually does too much.  Some checks are only needed if
6331d8c7986Smrg# your package does certain things.  But this isn't really a big deal.
634f46a6179Smrg
635c82dfdfbSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
636c82dfdfbSmrgm4_define([AC_PROG_CC],
637c82dfdfbSmrgm4_defn([AC_PROG_CC])
638c82dfdfbSmrg[_AM_PROG_CC_C_O
639c82dfdfbSmrg])
640c82dfdfbSmrg
6411d8c7986Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
6421d8c7986Smrg# AM_INIT_AUTOMAKE([OPTIONS])
6431d8c7986Smrg# -----------------------------------------------
6441d8c7986Smrg# The call with PACKAGE and VERSION arguments is the old style
6451d8c7986Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
6461d8c7986Smrg# and VERSION should now be passed to AC_INIT and removed from
6471d8c7986Smrg# the call to AM_INIT_AUTOMAKE.
6481d8c7986Smrg# We support both call styles for the transition.  After
6491d8c7986Smrg# the next Automake release, Autoconf can make the AC_INIT
6501d8c7986Smrg# arguments mandatory, and then we can depend on a new Autoconf
6511d8c7986Smrg# release and drop the old call support.
6521d8c7986SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
653c82dfdfbSmrg[AC_PREREQ([2.65])dnl
6541d8c7986Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
6551d8c7986Smrgdnl the ones we care about.
6561d8c7986Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
6571d8c7986SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
6581d8c7986SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
6591d8c7986Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
6601d8c7986Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
6611d8c7986Smrg  # is not polluted with repeated "-I."
6621d8c7986Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
6631d8c7986Smrg  # test to see if srcdir already configured
6641d8c7986Smrg  if test -f $srcdir/config.status; then
6651d8c7986Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
6661d8c7986Smrg  fi
66734345a63Smrgfi
668f46a6179Smrg
6691d8c7986Smrg# test whether we have cygpath
6701d8c7986Smrgif test -z "$CYGPATH_W"; then
6711d8c7986Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
6721d8c7986Smrg    CYGPATH_W='cygpath -w'
6731d8c7986Smrg  else
6741d8c7986Smrg    CYGPATH_W=echo
6751d8c7986Smrg  fi
676690143ccSmrgfi
6771d8c7986SmrgAC_SUBST([CYGPATH_W])
678f46a6179Smrg
6791d8c7986Smrg# Define the identity of the package.
6801d8c7986Smrgdnl Distinguish between old-style and new-style calls.
6811d8c7986Smrgm4_ifval([$2],
682c82dfdfbSmrg[AC_DIAGNOSE([obsolete],
683c82dfdfbSmrg             [$0: two- and three-arguments forms are deprecated.])
684c82dfdfbSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
6851d8c7986Smrg AC_SUBST([PACKAGE], [$1])dnl
6861d8c7986Smrg AC_SUBST([VERSION], [$2])],
6871d8c7986Smrg[_AM_SET_OPTIONS([$1])dnl
6881d8c7986Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
689c82dfdfbSmrgm4_if(
690c82dfdfbSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
691c82dfdfbSmrg  [ok:ok],,
6921d8c7986Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
6931d8c7986Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
6941d8c7986Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
695f46a6179Smrg
6961d8c7986Smrg_AM_IF_OPTION([no-define],,
697c82dfdfbSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
698c82dfdfbSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
699f46a6179Smrg
7001d8c7986Smrg# Some tools Automake needs.
7011d8c7986SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
7021d8c7986SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
703c82dfdfbSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
704c82dfdfbSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
705c82dfdfbSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
706c82dfdfbSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
707c82dfdfbSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
7081d8c7986SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
7091d8c7986SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
710c82dfdfbSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
711c82dfdfbSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
712c82dfdfbSmrg# dies out for good.  For more background, see:
713c82dfdfbSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
714c82dfdfbSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
715c82dfdfbSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
7163fb1fa07Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
7173fb1fa07Smrg# system "awk" is bad on some platforms.
7181d8c7986SmrgAC_REQUIRE([AC_PROG_AWK])dnl
7191d8c7986SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
7201d8c7986SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
7211d8c7986Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
7221d8c7986Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
7231d8c7986Smrg			     [_AM_PROG_TAR([v7])])])
7241d8c7986Smrg_AM_IF_OPTION([no-dependencies],,
7251d8c7986Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
726c82dfdfbSmrg		  [_AM_DEPENDENCIES([CC])],
727c82dfdfbSmrg		  [m4_define([AC_PROG_CC],
728c82dfdfbSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
7291d8c7986SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
730c82dfdfbSmrg		  [_AM_DEPENDENCIES([CXX])],
731c82dfdfbSmrg		  [m4_define([AC_PROG_CXX],
732c82dfdfbSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
7331d8c7986SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
734c82dfdfbSmrg		  [_AM_DEPENDENCIES([OBJC])],
735c82dfdfbSmrg		  [m4_define([AC_PROG_OBJC],
736c82dfdfbSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
737c82dfdfbSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
738c82dfdfbSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
739c82dfdfbSmrg		  [m4_define([AC_PROG_OBJCXX],
740c82dfdfbSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
7411d8c7986Smrg])
742c82dfdfbSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
743c82dfdfbSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
744c82dfdfbSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
745c82dfdfbSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
7461d8c7986SmrgAC_CONFIG_COMMANDS_PRE(dnl
7471d8c7986Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
7481d8c7986Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
749f46a6179Smrg
750c82dfdfbSmrg# POSIX will say in a future version that running "rm -f" with no argument
751c82dfdfbSmrg# is OK; and we want to be able to make that assumption in our Makefile
752c82dfdfbSmrg# recipes.  So use an aggressive probe to check that the usage we want is
753c82dfdfbSmrg# actually supported "in the wild" to an acceptable degree.
754c82dfdfbSmrg# See automake bug#10828.
755c82dfdfbSmrg# To make any issue more visible, cause the running configure to be aborted
756c82dfdfbSmrg# by default if the 'rm' program in use doesn't match our expectations; the
757c82dfdfbSmrg# user can still override this though.
758c82dfdfbSmrgif rm -f && rm -fr && rm -rf; then : OK; else
759c82dfdfbSmrg  cat >&2 <<'END'
760c82dfdfbSmrgOops!
761c82dfdfbSmrg
762c82dfdfbSmrgYour 'rm' program seems unable to run without file operands specified
763c82dfdfbSmrgon the command line, even when the '-f' option is present.  This is contrary
764c82dfdfbSmrgto the behaviour of most rm programs out there, and not conforming with
765c82dfdfbSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
766c82dfdfbSmrg
767c82dfdfbSmrgPlease tell bug-automake@gnu.org about your system, including the value
768c82dfdfbSmrgof your $PATH and any error possibly output before this message.  This
769c82dfdfbSmrgcan help us improve future automake versions.
770c82dfdfbSmrg
771c82dfdfbSmrgEND
772c82dfdfbSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
773c82dfdfbSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
774c82dfdfbSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
775c82dfdfbSmrg    echo >&2
776c82dfdfbSmrg  else
777c82dfdfbSmrg    cat >&2 <<'END'
778c82dfdfbSmrgAborting the configuration process, to ensure you take notice of the issue.
779c82dfdfbSmrg
780c82dfdfbSmrgYou can download and install GNU coreutils to get an 'rm' implementation
781c82dfdfbSmrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
782c82dfdfbSmrg
783c82dfdfbSmrgIf you want to complete the configuration process using your problematic
784c82dfdfbSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
785c82dfdfbSmrgto "yes", and re-run configure.
786c82dfdfbSmrg
787c82dfdfbSmrgEND
788c82dfdfbSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
789c82dfdfbSmrg  fi
7903fb1fa07Smrgfi
7913fb1fa07Smrgdnl The trailing newline in this macro's definition is deliberate, for
7923fb1fa07Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
7933fb1fa07Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
7943fb1fa07Smrg])
795c82dfdfbSmrg
796c82dfdfbSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
7971d8c7986Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
7981d8c7986Smrgdnl mangled by Autoconf and run in a shell conditional statement.
7991d8c7986Smrgm4_define([_AC_COMPILER_EXEEXT],
8001d8c7986Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
801f46a6179Smrg
8021d8c7986Smrg# When config.status generates a header, we must update the stamp-h file.
8031d8c7986Smrg# This file resides in the same directory as the config header
8041d8c7986Smrg# that is generated.  The stamp files are numbered to have different names.
805f46a6179Smrg
8061d8c7986Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
8071d8c7986Smrg# loop where config.status creates the headers, so we can generate
8081d8c7986Smrg# our stamp files there.
8091d8c7986SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
8101d8c7986Smrg[# Compute $1's index in $config_headers.
8111d8c7986Smrg_am_arg=$1
8121d8c7986Smrg_am_stamp_count=1
8131d8c7986Smrgfor _am_header in $config_headers :; do
8141d8c7986Smrg  case $_am_header in
8151d8c7986Smrg    $_am_arg | $_am_arg:* )
8161d8c7986Smrg      break ;;
8171d8c7986Smrg    * )
8181d8c7986Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
8191d8c7986Smrg  esac
8201d8c7986Smrgdone
8211d8c7986Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
8225fac8b10Smrg
8233fb1fa07Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
8241d8c7986Smrg#
8251d8c7986Smrg# This file is free software; the Free Software Foundation
8261d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
8271d8c7986Smrg# with or without modifications, as long as this notice is preserved.
828f46a6179Smrg
8291d8c7986Smrg# AM_PROG_INSTALL_SH
8301d8c7986Smrg# ------------------
8311d8c7986Smrg# Define $install_sh.
8321d8c7986SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
8331d8c7986Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
8343fb1fa07Smrgif test x"${install_sh+set}" != xset; then
8351d8c7986Smrg  case $am_aux_dir in
8361d8c7986Smrg  *\ * | *\	*)
8371d8c7986Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
8381d8c7986Smrg  *)
8391d8c7986Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
8401d8c7986Smrg  esac
841690143ccSmrgfi
842c82dfdfbSmrgAC_SUBST([install_sh])])
8435fac8b10Smrg
8443fb1fa07Smrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
845690143ccSmrg#
8461d8c7986Smrg# This file is free software; the Free Software Foundation
8471d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
8481d8c7986Smrg# with or without modifications, as long as this notice is preserved.
849f46a6179Smrg
8501d8c7986Smrg# Check whether the underlying file-system supports filenames
8511d8c7986Smrg# with a leading dot.  For instance MS-DOS doesn't.
8521d8c7986SmrgAC_DEFUN([AM_SET_LEADING_DOT],
8531d8c7986Smrg[rm -rf .tst 2>/dev/null
8541d8c7986Smrgmkdir .tst 2>/dev/null
8551d8c7986Smrgif test -d .tst; then
8561d8c7986Smrg  am__leading_dot=.
857690143ccSmrgelse
8581d8c7986Smrg  am__leading_dot=_
8595fac8b10Smrgfi
8601d8c7986Smrgrmdir .tst 2>/dev/null
8611d8c7986SmrgAC_SUBST([am__leading_dot])])
862f46a6179Smrg
8631d8c7986Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
8645fac8b10Smrg
8653fb1fa07Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
866690143ccSmrg#
8671d8c7986Smrg# This file is free software; the Free Software Foundation
8681d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
8691d8c7986Smrg# with or without modifications, as long as this notice is preserved.
8701d8c7986Smrg
8711d8c7986Smrg# AM_MAKE_INCLUDE()
8721d8c7986Smrg# -----------------
8731d8c7986Smrg# Check to see how make treats includes.
8741d8c7986SmrgAC_DEFUN([AM_MAKE_INCLUDE],
8751d8c7986Smrg[am_make=${MAKE-make}
8761d8c7986Smrgcat > confinc << 'END'
8771d8c7986Smrgam__doit:
8781d8c7986Smrg	@echo this is the am__doit target
8791d8c7986Smrg.PHONY: am__doit
8801d8c7986SmrgEND
8811d8c7986Smrg# If we don't find an include directive, just comment out the code.
8821d8c7986SmrgAC_MSG_CHECKING([for style of include used by $am_make])
8831d8c7986Smrgam__include="#"
8841d8c7986Smrgam__quote=
8851d8c7986Smrg_am_result=none
8861d8c7986Smrg# First try GNU make style include.
8871d8c7986Smrgecho "include confinc" > confmf
888c82dfdfbSmrg# Ignore all kinds of additional output from 'make'.
8891d8c7986Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
8901d8c7986Smrg*the\ am__doit\ target*)
8911d8c7986Smrg  am__include=include
8921d8c7986Smrg  am__quote=
8931d8c7986Smrg  _am_result=GNU
8941d8c7986Smrg  ;;
8951d8c7986Smrgesac
8961d8c7986Smrg# Now try BSD make style include.
8971d8c7986Smrgif test "$am__include" = "#"; then
8981d8c7986Smrg   echo '.include "confinc"' > confmf
8991d8c7986Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
9001d8c7986Smrg   *the\ am__doit\ target*)
9011d8c7986Smrg     am__include=.include
9021d8c7986Smrg     am__quote="\""
9031d8c7986Smrg     _am_result=BSD
9041d8c7986Smrg     ;;
9051d8c7986Smrg   esac
9061d8c7986Smrgfi
9071d8c7986SmrgAC_SUBST([am__include])
9081d8c7986SmrgAC_SUBST([am__quote])
9091d8c7986SmrgAC_MSG_RESULT([$_am_result])
9101d8c7986Smrgrm -f confinc confmf
9111d8c7986Smrg])
9121d8c7986Smrg
9131d8c7986Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
9141d8c7986Smrg
9153fb1fa07Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
916690143ccSmrg#
9171d8c7986Smrg# This file is free software; the Free Software Foundation
9181d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
9191d8c7986Smrg# with or without modifications, as long as this notice is preserved.
9205fac8b10Smrg
9211d8c7986Smrg# AM_MISSING_PROG(NAME, PROGRAM)
9221d8c7986Smrg# ------------------------------
9231d8c7986SmrgAC_DEFUN([AM_MISSING_PROG],
9241d8c7986Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
9251d8c7986Smrg$1=${$1-"${am_missing_run}$2"}
9261d8c7986SmrgAC_SUBST($1)])
9271d8c7986Smrg
9281d8c7986Smrg# AM_MISSING_HAS_RUN
9291d8c7986Smrg# ------------------
930c82dfdfbSmrg# Define MISSING if not defined so far and test if it is modern enough.
931c82dfdfbSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
9321d8c7986SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
9331d8c7986Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
9341d8c7986SmrgAC_REQUIRE_AUX_FILE([missing])dnl
9351d8c7986Smrgif test x"${MISSING+set}" != xset; then
9361d8c7986Smrg  case $am_aux_dir in
9371d8c7986Smrg  *\ * | *\	*)
9381d8c7986Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
9391d8c7986Smrg  *)
9401d8c7986Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
9411d8c7986Smrg  esac
9421d8c7986Smrgfi
9431d8c7986Smrg# Use eval to expand $SHELL
944c82dfdfbSmrgif eval "$MISSING --is-lightweight"; then
945c82dfdfbSmrg  am_missing_run="$MISSING "
946690143ccSmrgelse
9471d8c7986Smrg  am_missing_run=
948c82dfdfbSmrg  AC_MSG_WARN(['missing' script is too old or missing])
949690143ccSmrgfi
9501d8c7986Smrg])
9515fac8b10Smrg
9521d8c7986Smrg# Helper functions for option handling.                     -*- Autoconf -*-
9531d8c7986Smrg
9543fb1fa07Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
955690143ccSmrg#
9561d8c7986Smrg# This file is free software; the Free Software Foundation
9571d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
9581d8c7986Smrg# with or without modifications, as long as this notice is preserved.
9591d8c7986Smrg
9601d8c7986Smrg# _AM_MANGLE_OPTION(NAME)
9611d8c7986Smrg# -----------------------
9621d8c7986SmrgAC_DEFUN([_AM_MANGLE_OPTION],
9631d8c7986Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
9641d8c7986Smrg
9651d8c7986Smrg# _AM_SET_OPTION(NAME)
966c82dfdfbSmrg# --------------------
9671d8c7986Smrg# Set option NAME.  Presently that only means defining a flag for this option.
9681d8c7986SmrgAC_DEFUN([_AM_SET_OPTION],
969c82dfdfbSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
9701d8c7986Smrg
9711d8c7986Smrg# _AM_SET_OPTIONS(OPTIONS)
972c82dfdfbSmrg# ------------------------
9731d8c7986Smrg# OPTIONS is a space-separated list of Automake options.
9741d8c7986SmrgAC_DEFUN([_AM_SET_OPTIONS],
9751d8c7986Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
9761d8c7986Smrg
9771d8c7986Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
9781d8c7986Smrg# -------------------------------------------
9791d8c7986Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
9801d8c7986SmrgAC_DEFUN([_AM_IF_OPTION],
9811d8c7986Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
9821d8c7986Smrg
9833fb1fa07Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
984c82dfdfbSmrg#
985c82dfdfbSmrg# This file is free software; the Free Software Foundation
986c82dfdfbSmrg# gives unlimited permission to copy and/or distribute it,
987c82dfdfbSmrg# with or without modifications, as long as this notice is preserved.
988c82dfdfbSmrg
989c82dfdfbSmrg# _AM_PROG_CC_C_O
990c82dfdfbSmrg# ---------------
991c82dfdfbSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
992c82dfdfbSmrg# to automatically call this.
993c82dfdfbSmrgAC_DEFUN([_AM_PROG_CC_C_O],
994c82dfdfbSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
995c82dfdfbSmrgAC_REQUIRE_AUX_FILE([compile])dnl
996c82dfdfbSmrgAC_LANG_PUSH([C])dnl
997c82dfdfbSmrgAC_CACHE_CHECK(
998c82dfdfbSmrg  [whether $CC understands -c and -o together],
999c82dfdfbSmrg  [am_cv_prog_cc_c_o],
1000c82dfdfbSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
1001c82dfdfbSmrg  # Make sure it works both with $CC and with simple cc.
1002c82dfdfbSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
1003c82dfdfbSmrg  # compilers refuse to overwrite an existing .o file with -o,
1004c82dfdfbSmrg  # though they will create one.
1005c82dfdfbSmrg  am_cv_prog_cc_c_o=yes
1006c82dfdfbSmrg  for am_i in 1 2; do
1007c82dfdfbSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
1008c82dfdfbSmrg         && test -f conftest2.$ac_objext; then
1009c82dfdfbSmrg      : OK
1010c82dfdfbSmrg    else
1011c82dfdfbSmrg      am_cv_prog_cc_c_o=no
1012c82dfdfbSmrg      break
1013c82dfdfbSmrg    fi
1014c82dfdfbSmrg  done
1015c82dfdfbSmrg  rm -f core conftest*
1016c82dfdfbSmrg  unset am_i])
1017c82dfdfbSmrgif test "$am_cv_prog_cc_c_o" != yes; then
1018c82dfdfbSmrg   # Losing compiler, so override with the script.
1019c82dfdfbSmrg   # FIXME: It is wrong to rewrite CC.
1020c82dfdfbSmrg   # But if we don't then we get into trouble of one sort or another.
1021c82dfdfbSmrg   # A longer-term fix would be to have automake use am__CC in this case,
1022c82dfdfbSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
1023c82dfdfbSmrg   CC="$am_aux_dir/compile $CC"
1024c82dfdfbSmrgfi
1025c82dfdfbSmrgAC_LANG_POP([C])])
1026c82dfdfbSmrg
1027c82dfdfbSmrg# For backward compatibility.
1028c82dfdfbSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
10291d8c7986Smrg
10303fb1fa07Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
1031690143ccSmrg#
10321d8c7986Smrg# This file is free software; the Free Software Foundation
10331d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
10341d8c7986Smrg# with or without modifications, as long as this notice is preserved.
10355fac8b10Smrg
1036c82dfdfbSmrg# AM_RUN_LOG(COMMAND)
1037c82dfdfbSmrg# -------------------
1038c82dfdfbSmrg# Run COMMAND, save the exit status in ac_status, and log it.
1039c82dfdfbSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
1040c82dfdfbSmrgAC_DEFUN([AM_RUN_LOG],
1041c82dfdfbSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
1042c82dfdfbSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
1043c82dfdfbSmrg   ac_status=$?
1044c82dfdfbSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
1045c82dfdfbSmrg   (exit $ac_status); }])
1046c82dfdfbSmrg
1047c82dfdfbSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
1048c82dfdfbSmrg
10493fb1fa07Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
1050c82dfdfbSmrg#
1051c82dfdfbSmrg# This file is free software; the Free Software Foundation
1052c82dfdfbSmrg# gives unlimited permission to copy and/or distribute it,
1053c82dfdfbSmrg# with or without modifications, as long as this notice is preserved.
10541d8c7986Smrg
10551d8c7986Smrg# AM_SANITY_CHECK
10561d8c7986Smrg# ---------------
10571d8c7986SmrgAC_DEFUN([AM_SANITY_CHECK],
10581d8c7986Smrg[AC_MSG_CHECKING([whether build environment is sane])
10591d8c7986Smrg# Reject unsafe characters in $srcdir or the absolute working directory
10601d8c7986Smrg# name.  Accept space and tab only in the latter.
10611d8c7986Smrgam_lf='
10621d8c7986Smrg'
10631d8c7986Smrgcase `pwd` in
10641d8c7986Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
10651d8c7986Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
10661d8c7986Smrgesac
10671d8c7986Smrgcase $srcdir in
10681d8c7986Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
1069c82dfdfbSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
10701d8c7986Smrgesac
10711d8c7986Smrg
1072c82dfdfbSmrg# Do 'set' in a subshell so we don't clobber the current shell's
10731d8c7986Smrg# arguments.  Must try -L first in case configure is actually a
10741d8c7986Smrg# symlink; some systems play weird games with the mod time of symlinks
10751d8c7986Smrg# (eg FreeBSD returns the mod time of the symlink's containing
10761d8c7986Smrg# directory).
10771d8c7986Smrgif (
1078c82dfdfbSmrg   am_has_slept=no
1079c82dfdfbSmrg   for am_try in 1 2; do
1080c82dfdfbSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
1081c82dfdfbSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
1082c82dfdfbSmrg     if test "$[*]" = "X"; then
1083c82dfdfbSmrg	# -L didn't work.
1084c82dfdfbSmrg	set X `ls -t "$srcdir/configure" conftest.file`
1085c82dfdfbSmrg     fi
1086c82dfdfbSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
1087c82dfdfbSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
1088c82dfdfbSmrg
1089c82dfdfbSmrg	# If neither matched, then we have a broken ls.  This can happen
1090c82dfdfbSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
1091c82dfdfbSmrg	# broken ls alias from the environment.  This has actually
1092c82dfdfbSmrg	# happened.  Such a system could not be considered "sane".
1093c82dfdfbSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
1094c82dfdfbSmrg  alias in your environment])
1095c82dfdfbSmrg     fi
1096c82dfdfbSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
1097c82dfdfbSmrg       break
1098c82dfdfbSmrg     fi
1099c82dfdfbSmrg     # Just in case.
1100c82dfdfbSmrg     sleep 1
1101c82dfdfbSmrg     am_has_slept=yes
1102c82dfdfbSmrg   done
11031d8c7986Smrg   test "$[2]" = conftest.file
11041d8c7986Smrg   )
11051d8c7986Smrgthen
11061d8c7986Smrg   # Ok.
11071d8c7986Smrg   :
11081d8c7986Smrgelse
11091d8c7986Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
11101d8c7986SmrgCheck your system clock])
1111690143ccSmrgfi
1112c82dfdfbSmrgAC_MSG_RESULT([yes])
1113c82dfdfbSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
1114c82dfdfbSmrg# generated files are strictly newer.
1115c82dfdfbSmrgam_sleep_pid=
1116c82dfdfbSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
1117c82dfdfbSmrg  ( sleep 1 ) &
1118c82dfdfbSmrg  am_sleep_pid=$!
1119c82dfdfbSmrgfi
1120c82dfdfbSmrgAC_CONFIG_COMMANDS_PRE(
1121c82dfdfbSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
1122c82dfdfbSmrg   if test -n "$am_sleep_pid"; then
1123c82dfdfbSmrg     # Hide warnings about reused PIDs.
1124c82dfdfbSmrg     wait $am_sleep_pid 2>/dev/null
1125c82dfdfbSmrg   fi
1126c82dfdfbSmrg   AC_MSG_RESULT([done])])
1127c82dfdfbSmrgrm -f conftest.file
1128c82dfdfbSmrg])
1129f46a6179Smrg
11303fb1fa07Smrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
11311d8c7986Smrg#
11321d8c7986Smrg# This file is free software; the Free Software Foundation
11331d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
11341d8c7986Smrg# with or without modifications, as long as this notice is preserved.
1135f46a6179Smrg
11361d8c7986Smrg# AM_SILENT_RULES([DEFAULT])
11371d8c7986Smrg# --------------------------
11381d8c7986Smrg# Enable less verbose build rules; with the default set to DEFAULT
1139c82dfdfbSmrg# ("yes" being less verbose, "no" or empty being verbose).
11401d8c7986SmrgAC_DEFUN([AM_SILENT_RULES],
1141c82dfdfbSmrg[AC_ARG_ENABLE([silent-rules], [dnl
1142c82dfdfbSmrgAS_HELP_STRING(
1143c82dfdfbSmrg  [--enable-silent-rules],
1144c82dfdfbSmrg  [less verbose build output (undo: "make V=1")])
1145c82dfdfbSmrgAS_HELP_STRING(
1146c82dfdfbSmrg  [--disable-silent-rules],
1147c82dfdfbSmrg  [verbose build output (undo: "make V=0")])dnl
1148c82dfdfbSmrg])
1149c82dfdfbSmrgcase $enable_silent_rules in @%:@ (((
1150c82dfdfbSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
1151c82dfdfbSmrg   no) AM_DEFAULT_VERBOSITY=1;;
1152c82dfdfbSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
11531d8c7986Smrgesac
1154c82dfdfbSmrgdnl
1155c82dfdfbSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
1156c82dfdfbSmrgdnl do not support nested variable expansions.
1157c82dfdfbSmrgdnl See automake bug#9928 and bug#10237.
1158c82dfdfbSmrgam_make=${MAKE-make}
1159c82dfdfbSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
1160c82dfdfbSmrg   [am_cv_make_support_nested_variables],
1161c82dfdfbSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
1162c82dfdfbSmrgBAR0=false
1163c82dfdfbSmrgBAR1=true
1164c82dfdfbSmrgV=1
1165c82dfdfbSmrgam__doit:
1166c82dfdfbSmrg	@$(TRUE)
1167c82dfdfbSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
1168c82dfdfbSmrg  am_cv_make_support_nested_variables=yes
1169c82dfdfbSmrgelse
1170c82dfdfbSmrg  am_cv_make_support_nested_variables=no
1171c82dfdfbSmrgfi])
1172c82dfdfbSmrgif test $am_cv_make_support_nested_variables = yes; then
1173c82dfdfbSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
1174c82dfdfbSmrg  AM_V='$(V)'
1175c82dfdfbSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
1176c82dfdfbSmrgelse
1177c82dfdfbSmrg  AM_V=$AM_DEFAULT_VERBOSITY
1178c82dfdfbSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
1179c82dfdfbSmrgfi
1180c82dfdfbSmrgAC_SUBST([AM_V])dnl
1181c82dfdfbSmrgAM_SUBST_NOTMAKE([AM_V])dnl
1182c82dfdfbSmrgAC_SUBST([AM_DEFAULT_V])dnl
1183c82dfdfbSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
11841d8c7986SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
11851d8c7986SmrgAM_BACKSLASH='\'
11861d8c7986SmrgAC_SUBST([AM_BACKSLASH])dnl
11871d8c7986Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
11881d8c7986Smrg])
11891d8c7986Smrg
11903fb1fa07Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
1191690143ccSmrg#
11921d8c7986Smrg# This file is free software; the Free Software Foundation
11931d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
11941d8c7986Smrg# with or without modifications, as long as this notice is preserved.
1195f46a6179Smrg
11961d8c7986Smrg# AM_PROG_INSTALL_STRIP
11971d8c7986Smrg# ---------------------
1198c82dfdfbSmrg# One issue with vendor 'install' (even GNU) is that you can't
11991d8c7986Smrg# specify the program used to strip binaries.  This is especially
12001d8c7986Smrg# annoying in cross-compiling environments, where the build's strip
12011d8c7986Smrg# is unlikely to handle the host's binaries.
12021d8c7986Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
1203c82dfdfbSmrg# always use install-sh in "make install-strip", and initialize
12041d8c7986Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
12051d8c7986SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
12061d8c7986Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
1207c82dfdfbSmrg# Installed binaries are usually stripped using 'strip' when the user
1208c82dfdfbSmrg# run "make install-strip".  However 'strip' might not be the right
12091d8c7986Smrg# tool to use in cross-compilation environments, therefore Automake
1210c82dfdfbSmrg# will honor the 'STRIP' environment variable to overrule this program.
1211c82dfdfbSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
12121d8c7986Smrgif test "$cross_compiling" != no; then
12131d8c7986Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
12145fac8b10Smrgfi
12151d8c7986SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
12161d8c7986SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1217f46a6179Smrg
12183fb1fa07Smrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
1219690143ccSmrg#
12201d8c7986Smrg# This file is free software; the Free Software Foundation
12211d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
12221d8c7986Smrg# with or without modifications, as long as this notice is preserved.
1223f46a6179Smrg
12241d8c7986Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
12251d8c7986Smrg# ---------------------------
12261d8c7986Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
12271d8c7986Smrg# This macro is traced by Automake.
12281d8c7986SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1229f46a6179Smrg
12301d8c7986Smrg# AM_SUBST_NOTMAKE(VARIABLE)
1231c82dfdfbSmrg# --------------------------
12321d8c7986Smrg# Public sister of _AM_SUBST_NOTMAKE.
12331d8c7986SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1234f46a6179Smrg
12351d8c7986Smrg# Check how to create a tarball.                            -*- Autoconf -*-
12361d8c7986Smrg
12373fb1fa07Smrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
1238690143ccSmrg#
12391d8c7986Smrg# This file is free software; the Free Software Foundation
12401d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
12411d8c7986Smrg# with or without modifications, as long as this notice is preserved.
12421d8c7986Smrg
12431d8c7986Smrg# _AM_PROG_TAR(FORMAT)
12441d8c7986Smrg# --------------------
12451d8c7986Smrg# Check how to create a tarball in format FORMAT.
1246c82dfdfbSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1247690143ccSmrg#
12481d8c7986Smrg# Substitute a variable $(am__tar) that is a command
12491d8c7986Smrg# writing to stdout a FORMAT-tarball containing the directory
12501d8c7986Smrg# $tardir.
12511d8c7986Smrg#     tardir=directory && $(am__tar) > result.tar
1252690143ccSmrg#
12531d8c7986Smrg# Substitute a variable $(am__untar) that extract such
12541d8c7986Smrg# a tarball read from stdin.
12551d8c7986Smrg#     $(am__untar) < result.tar
1256c82dfdfbSmrg#
12571d8c7986SmrgAC_DEFUN([_AM_PROG_TAR],
1258c82dfdfbSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1259c82dfdfbSmrg# in the wild :-(  We should find a proper way to deprecate it ...
1260c82dfdfbSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1261c82dfdfbSmrg
1262c82dfdfbSmrg# We'll loop over all known methods to create a tar archive until one works.
12631d8c7986Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
126434345a63Smrg
1265c82dfdfbSmrgm4_if([$1], [v7],
1266c82dfdfbSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1267c82dfdfbSmrg
1268c82dfdfbSmrg  [m4_case([$1],
1269c82dfdfbSmrg    [ustar],
1270c82dfdfbSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1271c82dfdfbSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1272c82dfdfbSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1273c82dfdfbSmrg      # and bug#13588).
1274c82dfdfbSmrg      am_max_uid=2097151 # 2^21 - 1
1275c82dfdfbSmrg      am_max_gid=$am_max_uid
1276c82dfdfbSmrg      # The $UID and $GID variables are not portable, so we need to resort
1277c82dfdfbSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1278c82dfdfbSmrg      # below are definitely unexpected, so allow the users to see them
1279c82dfdfbSmrg      # (that is, avoid stderr redirection).
1280c82dfdfbSmrg      am_uid=`id -u || echo unknown`
1281c82dfdfbSmrg      am_gid=`id -g || echo unknown`
1282c82dfdfbSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1283c82dfdfbSmrg      if test $am_uid -le $am_max_uid; then
1284c82dfdfbSmrg         AC_MSG_RESULT([yes])
1285c82dfdfbSmrg      else
1286c82dfdfbSmrg         AC_MSG_RESULT([no])
1287c82dfdfbSmrg         _am_tools=none
1288c82dfdfbSmrg      fi
1289c82dfdfbSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1290c82dfdfbSmrg      if test $am_gid -le $am_max_gid; then
1291c82dfdfbSmrg         AC_MSG_RESULT([yes])
1292c82dfdfbSmrg      else
1293c82dfdfbSmrg        AC_MSG_RESULT([no])
1294c82dfdfbSmrg        _am_tools=none
1295c82dfdfbSmrg      fi],
1296c82dfdfbSmrg
1297c82dfdfbSmrg  [pax],
1298c82dfdfbSmrg    [],
1299c82dfdfbSmrg
1300c82dfdfbSmrg  [m4_fatal([Unknown tar format])])
1301c82dfdfbSmrg
1302c82dfdfbSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1303c82dfdfbSmrg
1304c82dfdfbSmrg  # Go ahead even if we have the value already cached.  We do so because we
1305c82dfdfbSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1306c82dfdfbSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1307c82dfdfbSmrg
1308c82dfdfbSmrg  for _am_tool in $_am_tools; do
1309c82dfdfbSmrg    case $_am_tool in
1310c82dfdfbSmrg    gnutar)
1311c82dfdfbSmrg      for _am_tar in tar gnutar gtar; do
1312c82dfdfbSmrg        AM_RUN_LOG([$_am_tar --version]) && break
1313c82dfdfbSmrg      done
1314c82dfdfbSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1315c82dfdfbSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1316c82dfdfbSmrg      am__untar="$_am_tar -xf -"
1317c82dfdfbSmrg      ;;
1318c82dfdfbSmrg    plaintar)
1319c82dfdfbSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1320c82dfdfbSmrg      # ustar tarball either.
1321c82dfdfbSmrg      (tar --version) >/dev/null 2>&1 && continue
1322c82dfdfbSmrg      am__tar='tar chf - "$$tardir"'
1323c82dfdfbSmrg      am__tar_='tar chf - "$tardir"'
1324c82dfdfbSmrg      am__untar='tar xf -'
1325c82dfdfbSmrg      ;;
1326c82dfdfbSmrg    pax)
1327c82dfdfbSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
1328c82dfdfbSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
1329c82dfdfbSmrg      am__untar='pax -r'
1330c82dfdfbSmrg      ;;
1331c82dfdfbSmrg    cpio)
1332c82dfdfbSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1333c82dfdfbSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1334c82dfdfbSmrg      am__untar='cpio -i -H $1 -d'
1335c82dfdfbSmrg      ;;
1336c82dfdfbSmrg    none)
1337c82dfdfbSmrg      am__tar=false
1338c82dfdfbSmrg      am__tar_=false
1339c82dfdfbSmrg      am__untar=false
1340c82dfdfbSmrg      ;;
1341c82dfdfbSmrg    esac
13421d8c7986Smrg
1343c82dfdfbSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
1344c82dfdfbSmrg    # and am__untar set.
1345c82dfdfbSmrg    test -n "${am_cv_prog_tar_$1}" && break
1346c82dfdfbSmrg
1347c82dfdfbSmrg    # tar/untar a dummy directory, and stop if the command works.
1348c82dfdfbSmrg    rm -rf conftest.dir
1349c82dfdfbSmrg    mkdir conftest.dir
1350c82dfdfbSmrg    echo GrepMe > conftest.dir/file
1351c82dfdfbSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1352c82dfdfbSmrg    rm -rf conftest.dir
1353c82dfdfbSmrg    if test -s conftest.tar; then
1354c82dfdfbSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
1355c82dfdfbSmrg      AM_RUN_LOG([cat conftest.dir/file])
1356c82dfdfbSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1357c82dfdfbSmrg    fi
1358c82dfdfbSmrg  done
13591d8c7986Smrg  rm -rf conftest.dir
13601d8c7986Smrg
1361c82dfdfbSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1362c82dfdfbSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1363c82dfdfbSmrg
13641d8c7986SmrgAC_SUBST([am__tar])
13651d8c7986SmrgAC_SUBST([am__untar])
13661d8c7986Smrg]) # _AM_PROG_TAR
13671d8c7986Smrg
13681d8c7986Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
13691d8c7986Smrgdnl
13701d8c7986Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1371c82dfdfbSmrgdnl
13721d8c7986Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
13731d8c7986Smrgdnl copy of this software and associated documentation files (the "Software"),
13741d8c7986Smrgdnl to deal in the Software without restriction, including without limitation
13751d8c7986Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
13761d8c7986Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
13771d8c7986Smrgdnl Software is furnished to do so, subject to the following conditions:
13781d8c7986Smrgdnl
13791d8c7986Smrgdnl The above copyright notice and this permission notice (including the next
13801d8c7986Smrgdnl paragraph) shall be included in all copies or substantial portions of the
13811d8c7986Smrgdnl Software.
13821d8c7986Smrgdnl
13831d8c7986Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13841d8c7986Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13851d8c7986Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
13861d8c7986Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
13871d8c7986Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
13881d8c7986Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
13891d8c7986Smrgdnl DEALINGS IN THE SOFTWARE.
1390f46a6179Smrg
13911d8c7986Smrg# XORG_MACROS_VERSION(required-version)
13921d8c7986Smrg# -------------------------------------
1393690143ccSmrg# Minimum version: 1.1.0
1394690143ccSmrg#
13951d8c7986Smrg# If you're using a macro added in Version 1.1 or newer, include this in
13961d8c7986Smrg# your configure.ac with the minimum required version, such as:
13971d8c7986Smrg# XORG_MACROS_VERSION(1.1)
1398690143ccSmrg#
13991d8c7986Smrg# To ensure that this macro is defined, also add:
14001d8c7986Smrg# m4_ifndef([XORG_MACROS_VERSION],
14011d8c7986Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1402690143ccSmrg#
1403690143ccSmrg#
1404c82dfdfbSmrg# See the "minimum version" comment for each macro you use to see what
14051d8c7986Smrg# version you require.
14061d8c7986Smrgm4_defun([XORG_MACROS_VERSION],[
1407c82dfdfbSmrgm4_define([vers_have], [1.19.0])
14081d8c7986Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
14091d8c7986Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
14101d8c7986Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
14111d8c7986Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
14121d8c7986Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
14131d8c7986Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
14141d8c7986Smrgm4_undefine([vers_have])
14151d8c7986Smrgm4_undefine([maj_have])
14161d8c7986Smrgm4_undefine([maj_needed])
14171d8c7986Smrg]) # XORG_MACROS_VERSION
141883e5f723Smrg
14191d8c7986Smrg# XORG_PROG_RAWCPP()
14201d8c7986Smrg# ------------------
14211d8c7986Smrg# Minimum version: 1.0.0
1422690143ccSmrg#
14231d8c7986Smrg# Find cpp program and necessary flags for use in pre-processing text files
14241d8c7986Smrg# such as man pages and config files
14251d8c7986SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
14261d8c7986SmrgAC_REQUIRE([AC_PROG_CPP])
1427c82dfdfbSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
14281d8c7986Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
14291d8c7986Smrg
14301d8c7986Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
14311d8c7986Smrg# which is not the best choice for supporting other OS'es, but covers most
14321d8c7986Smrg# of the ones we need for now.
14331d8c7986SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
14341d8c7986SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
14351d8c7986Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14361d8c7986Smrg	AC_MSG_RESULT([no])
143783e5f723Smrgelse
14381d8c7986Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14391d8c7986Smrg		RAWCPPFLAGS=-undef
14401d8c7986Smrg		AC_MSG_RESULT([yes])
14411d8c7986Smrg	# under Cygwin unix is still defined even with -undef
14421d8c7986Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14431d8c7986Smrg		RAWCPPFLAGS="-undef -ansi"
14441d8c7986Smrg		AC_MSG_RESULT([yes, with -ansi])
14451d8c7986Smrg	else
14461d8c7986Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
14471d8c7986Smrg	fi
144883e5f723Smrgfi
14491d8c7986Smrgrm -f conftest.$ac_ext
145083e5f723Smrg
14511d8c7986SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
14521d8c7986SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
14531d8c7986Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
14541d8c7986Smrg	AC_MSG_RESULT([no])
14551d8c7986Smrgelse
14561d8c7986Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1457c82dfdfbSmrg		TRADITIONALCPPFLAGS="-traditional"
14581d8c7986Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
14591d8c7986Smrg		AC_MSG_RESULT([yes])
14601d8c7986Smrg	else
14611d8c7986Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
14621d8c7986Smrg	fi
14631d8c7986Smrgfi
14641d8c7986Smrgrm -f conftest.$ac_ext
14651d8c7986SmrgAC_SUBST(RAWCPPFLAGS)
1466c82dfdfbSmrgAC_SUBST(TRADITIONALCPPFLAGS)
14671d8c7986Smrg]) # XORG_PROG_RAWCPP
14681d8c7986Smrg
14691d8c7986Smrg# XORG_MANPAGE_SECTIONS()
1470690143ccSmrg# -----------------------
14711d8c7986Smrg# Minimum version: 1.0.0
1472690143ccSmrg#
14731d8c7986Smrg# Determine which sections man pages go in for the different man page types
14741d8c7986Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
14751d8c7986Smrg# Not sure if there's any better way than just hardcoding by OS name.
14761d8c7986Smrg# Override default settings by setting environment variables
14771d8c7986Smrg# Added MAN_SUBSTS in version 1.8
14781d8c7986Smrg# Added AC_PROG_SED in version 1.8
1479f46a6179Smrg
14801d8c7986SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
14811d8c7986SmrgAC_REQUIRE([AC_CANONICAL_HOST])
14821d8c7986SmrgAC_REQUIRE([AC_PROG_SED])
14831d8c7986Smrg
14841d8c7986Smrgif test x$APP_MAN_SUFFIX = x    ; then
14851d8c7986Smrg    APP_MAN_SUFFIX=1
14865fac8b10Smrgfi
14871d8c7986Smrgif test x$APP_MAN_DIR = x    ; then
14881d8c7986Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1489690143ccSmrgfi
1490f46a6179Smrg
14911d8c7986Smrgif test x$LIB_MAN_SUFFIX = x    ; then
14921d8c7986Smrg    LIB_MAN_SUFFIX=3
14931d8c7986Smrgfi
14941d8c7986Smrgif test x$LIB_MAN_DIR = x    ; then
14951d8c7986Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
14961d8c7986Smrgfi
149783e5f723Smrg
14981d8c7986Smrgif test x$FILE_MAN_SUFFIX = x    ; then
14991d8c7986Smrg    case $host_os in
15001d8c7986Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
15011d8c7986Smrg	*)		FILE_MAN_SUFFIX=5  ;;
15021d8c7986Smrg    esac
15031d8c7986Smrgfi
15041d8c7986Smrgif test x$FILE_MAN_DIR = x    ; then
15051d8c7986Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
15061d8c7986Smrgfi
1507f46a6179Smrg
15081d8c7986Smrgif test x$MISC_MAN_SUFFIX = x    ; then
15091d8c7986Smrg    case $host_os in
15101d8c7986Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
15111d8c7986Smrg	*)		MISC_MAN_SUFFIX=7  ;;
15121d8c7986Smrg    esac
15131d8c7986Smrgfi
15141d8c7986Smrgif test x$MISC_MAN_DIR = x    ; then
15151d8c7986Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
15161d8c7986Smrgfi
1517f46a6179Smrg
15181d8c7986Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
15191d8c7986Smrg    case $host_os in
15201d8c7986Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
15211d8c7986Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
15221d8c7986Smrg    esac
15231d8c7986Smrgfi
15241d8c7986Smrgif test x$DRIVER_MAN_DIR = x    ; then
15251d8c7986Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
15261d8c7986Smrgfi
1527f46a6179Smrg
15281d8c7986Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
15291d8c7986Smrg    case $host_os in
15301d8c7986Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
15311d8c7986Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
15321d8c7986Smrg    esac
15331d8c7986Smrgfi
15341d8c7986Smrgif test x$ADMIN_MAN_DIR = x    ; then
15351d8c7986Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
15361d8c7986Smrgfi
1537f46a6179Smrg
1538f46a6179Smrg
15391d8c7986SmrgAC_SUBST([APP_MAN_SUFFIX])
15401d8c7986SmrgAC_SUBST([LIB_MAN_SUFFIX])
15411d8c7986SmrgAC_SUBST([FILE_MAN_SUFFIX])
15421d8c7986SmrgAC_SUBST([MISC_MAN_SUFFIX])
15431d8c7986SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
15441d8c7986SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
15451d8c7986SmrgAC_SUBST([APP_MAN_DIR])
15461d8c7986SmrgAC_SUBST([LIB_MAN_DIR])
15471d8c7986SmrgAC_SUBST([FILE_MAN_DIR])
15481d8c7986SmrgAC_SUBST([MISC_MAN_DIR])
15491d8c7986SmrgAC_SUBST([DRIVER_MAN_DIR])
15501d8c7986SmrgAC_SUBST([ADMIN_MAN_DIR])
1551f46a6179Smrg
15521d8c7986SmrgXORG_MAN_PAGE="X Version 11"
15531d8c7986SmrgAC_SUBST([XORG_MAN_PAGE])
15541d8c7986SmrgMAN_SUBSTS="\
15551d8c7986Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
15561d8c7986Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
15571d8c7986Smrg	-e 's|__xservername__|Xorg|g' \
15581d8c7986Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1559c82dfdfbSmrg	-e 's|__xorgconfdir__|xorg.conf.d|g' \
15601d8c7986Smrg	-e 's|__projectroot__|\$(prefix)|g' \
15611d8c7986Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
15621d8c7986Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
15631d8c7986Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
15641d8c7986Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
15651d8c7986Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
15661d8c7986Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
15671d8c7986Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
15681d8c7986SmrgAC_SUBST([MAN_SUBSTS])
1569f46a6179Smrg
15701d8c7986Smrg]) # XORG_MANPAGE_SECTIONS
157134345a63Smrg
15721d8c7986Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
15731d8c7986Smrg# ------------------------
15741d8c7986Smrg# Minimum version: 1.7.0
157583e5f723Smrg#
15761d8c7986Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
15771d8c7986Smrg# provided by xorg-sgml-doctools, if installed.
15781d8c7986SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
15791d8c7986SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
15801d8c7986SmrgXORG_SGML_PATH=
15811d8c7986SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
15821d8c7986Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
15831d8c7986Smrg    [m4_ifval([$1],[:],
15841d8c7986Smrg        [if test x"$cross_compiling" != x"yes" ; then
15851d8c7986Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
15861d8c7986Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
15871d8c7986Smrg         fi])
15881d8c7986Smrg    ])
1589690143ccSmrg
15901d8c7986Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
15911d8c7986Smrg# the path and the name of the doc stylesheet
15921d8c7986Smrgif test "x$XORG_SGML_PATH" != "x" ; then
15931d8c7986Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
15941d8c7986Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
15951d8c7986Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
15961d8c7986Smrgelse
15971d8c7986Smrg   AC_MSG_RESULT([no])
15981d8c7986Smrgfi
15991d8c7986Smrg
16001d8c7986SmrgAC_SUBST(XORG_SGML_PATH)
16011d8c7986SmrgAC_SUBST(STYLESHEET_SRCDIR)
16021d8c7986SmrgAC_SUBST(XSL_STYLESHEET)
16031d8c7986SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
16041d8c7986Smrg]) # XORG_CHECK_SGML_DOCTOOLS
16051d8c7986Smrg
16061d8c7986Smrg# XORG_CHECK_LINUXDOC
16071d8c7986Smrg# -------------------
16081d8c7986Smrg# Minimum version: 1.0.0
1609690143ccSmrg#
16101d8c7986Smrg# Defines the variable MAKE_TEXT if the necessary tools and
16111d8c7986Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
16121d8c7986Smrg# Whether or not the necessary tools and files are found can be checked
16131d8c7986Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
16141d8c7986SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
16151d8c7986SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
16161d8c7986SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1617690143ccSmrg
16181d8c7986SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1619690143ccSmrg
16201d8c7986SmrgAC_MSG_CHECKING([whether to build documentation])
1621690143ccSmrg
16221d8c7986Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
16231d8c7986Smrg   BUILDDOC=yes
16241d8c7986Smrgelse
16251d8c7986Smrg   BUILDDOC=no
16261d8c7986Smrgfi
1627690143ccSmrg
16281d8c7986SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1629690143ccSmrg
16301d8c7986SmrgAC_MSG_RESULT([$BUILDDOC])
16311d8c7986Smrg
16321d8c7986SmrgAC_MSG_CHECKING([whether to build pdf documentation])
16331d8c7986Smrg
16341d8c7986Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
16351d8c7986Smrg   BUILDPDFDOC=yes
163683e5f723Smrgelse
16371d8c7986Smrg   BUILDPDFDOC=no
163883e5f723Smrgfi
163983e5f723Smrg
16401d8c7986SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
164183e5f723Smrg
16421d8c7986SmrgAC_MSG_RESULT([$BUILDPDFDOC])
164383e5f723Smrg
16441d8c7986SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
16451d8c7986SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
16461d8c7986SmrgMAKE_PDF="$PS2PDF"
16471d8c7986SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1648690143ccSmrg
16491d8c7986SmrgAC_SUBST(MAKE_TEXT)
16501d8c7986SmrgAC_SUBST(MAKE_PS)
16511d8c7986SmrgAC_SUBST(MAKE_PDF)
16521d8c7986SmrgAC_SUBST(MAKE_HTML)
16531d8c7986Smrg]) # XORG_CHECK_LINUXDOC
1654690143ccSmrg
16551d8c7986Smrg# XORG_CHECK_DOCBOOK
16561d8c7986Smrg# -------------------
16571d8c7986Smrg# Minimum version: 1.0.0
165883e5f723Smrg#
16591d8c7986Smrg# Checks for the ability to build output formats from SGML DocBook source.
16601d8c7986Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
16611d8c7986Smrg# indicates whether the necessary tools and files are found and, if set,
16621d8c7986Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
16631d8c7986SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
16641d8c7986SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1665690143ccSmrg
16661d8c7986SmrgBUILDTXTDOC=no
16671d8c7986SmrgBUILDPDFDOC=no
16681d8c7986SmrgBUILDPSDOC=no
16691d8c7986SmrgBUILDHTMLDOC=no
1670690143ccSmrg
16711d8c7986SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
16721d8c7986SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
16731d8c7986SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
16741d8c7986SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1675690143ccSmrg
16761d8c7986SmrgAC_MSG_CHECKING([whether to build text documentation])
16771d8c7986Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
16781d8c7986Smrg   test x$BUILD_TXTDOC != xno; then
16791d8c7986Smrg	BUILDTXTDOC=yes
1680690143ccSmrgfi
16811d8c7986SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
16821d8c7986SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1683690143ccSmrg
16841d8c7986SmrgAC_MSG_CHECKING([whether to build PDF documentation])
16851d8c7986Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
16861d8c7986Smrg   test x$BUILD_PDFDOC != xno; then
16871d8c7986Smrg	BUILDPDFDOC=yes
16881d8c7986Smrgfi
16891d8c7986SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
16901d8c7986SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1691690143ccSmrg
16921d8c7986SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
16931d8c7986Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
16941d8c7986Smrg   test x$BUILD_PSDOC != xno; then
16951d8c7986Smrg	BUILDPSDOC=yes
16961d8c7986Smrgfi
16971d8c7986SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
16981d8c7986SmrgAC_MSG_RESULT([$BUILDPSDOC])
1699690143ccSmrg
17001d8c7986SmrgAC_MSG_CHECKING([whether to build HTML documentation])
17011d8c7986Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
17021d8c7986Smrg   test x$BUILD_HTMLDOC != xno; then
17031d8c7986Smrg	BUILDHTMLDOC=yes
1704690143ccSmrgfi
17051d8c7986SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
17061d8c7986SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1707690143ccSmrg
17081d8c7986SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
17091d8c7986SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
17101d8c7986SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
17111d8c7986SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1712690143ccSmrg
17131d8c7986SmrgAC_SUBST(MAKE_TEXT)
17141d8c7986SmrgAC_SUBST(MAKE_PS)
17151d8c7986SmrgAC_SUBST(MAKE_PDF)
17161d8c7986SmrgAC_SUBST(MAKE_HTML)
17171d8c7986Smrg]) # XORG_CHECK_DOCBOOK
17181d8c7986Smrg
17191d8c7986Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
17201d8c7986Smrg# ----------------
17211d8c7986Smrg# Minimum version: 1.5.0
17221d8c7986Smrg# Minimum version for optional DEFAULT argument: 1.11.0
172383e5f723Smrg#
17241d8c7986Smrg# Documentation tools are not always available on all platforms and sometimes
17251d8c7986Smrg# not at the appropriate level. This macro enables a module to test for the
17261d8c7986Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
17271d8c7986Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
17281d8c7986Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
17291d8c7986Smrg# --with-xmlto assumes 'auto'.
17301d8c7986Smrg#
17311d8c7986Smrg# Interface to module:
17321d8c7986Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
17331d8c7986Smrg# XMLTO:	returns the path of the xmlto program found
17341d8c7986Smrg#		returns the path set by the user in the environment
17351d8c7986Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
17361d8c7986Smrg#		'no' user instructs the module not to use xmlto
17371d8c7986Smrg#
17381d8c7986Smrg# Added in version 1.10.0
17391d8c7986Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
17401d8c7986Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
17411d8c7986Smrg#
17421d8c7986Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
17431d8c7986Smrg#
17441d8c7986SmrgAC_DEFUN([XORG_WITH_XMLTO],[
17451d8c7986SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
17461d8c7986Smrgm4_define([_defopt], m4_default([$2], [auto]))
17471d8c7986SmrgAC_ARG_WITH(xmlto,
17481d8c7986Smrg	AS_HELP_STRING([--with-xmlto],
17491d8c7986Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
17501d8c7986Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
17511d8c7986Smrgm4_undefine([_defopt])
1752690143ccSmrg
17531d8c7986Smrgif test "x$use_xmlto" = x"auto"; then
17541d8c7986Smrg   AC_PATH_PROG([XMLTO], [xmlto])
17551d8c7986Smrg   if test "x$XMLTO" = "x"; then
17561d8c7986Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
17571d8c7986Smrg	have_xmlto=no
17581d8c7986Smrg   else
17591d8c7986Smrg        have_xmlto=yes
17601d8c7986Smrg   fi
17611d8c7986Smrgelif test "x$use_xmlto" = x"yes" ; then
17621d8c7986Smrg   AC_PATH_PROG([XMLTO], [xmlto])
17631d8c7986Smrg   if test "x$XMLTO" = "x"; then
17641d8c7986Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
17651d8c7986Smrg   fi
17661d8c7986Smrg   have_xmlto=yes
17671d8c7986Smrgelif test "x$use_xmlto" = x"no" ; then
17681d8c7986Smrg   if test "x$XMLTO" != "x"; then
17691d8c7986Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
17701d8c7986Smrg   fi
17711d8c7986Smrg   have_xmlto=no
17721d8c7986Smrgelse
17731d8c7986Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
17741d8c7986Smrgfi
1775690143ccSmrg
17761d8c7986Smrg# Test for a minimum version of xmlto, if provided.
17771d8c7986Smrgm4_ifval([$1],
17781d8c7986Smrg[if test "$have_xmlto" = yes; then
17791d8c7986Smrg    # scrape the xmlto version
17801d8c7986Smrg    AC_MSG_CHECKING([the xmlto version])
17811d8c7986Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
17821d8c7986Smrg    AC_MSG_RESULT([$xmlto_version])
17831d8c7986Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
17841d8c7986Smrg        [if test "x$use_xmlto" = xauto; then
17851d8c7986Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
17861d8c7986Smrg            have_xmlto=no
17871d8c7986Smrg        else
17881d8c7986Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
17891d8c7986Smrg        fi])
17901d8c7986Smrgfi])
17911d8c7986Smrg
17921d8c7986Smrg# Test for the ability of xmlto to generate a text target
17931d8c7986Smrghave_xmlto_text=no
17941d8c7986Smrgcat > conftest.xml << "EOF"
17951d8c7986SmrgEOF
17961d8c7986SmrgAS_IF([test "$have_xmlto" = yes],
17971d8c7986Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
17981d8c7986Smrg             [have_xmlto_text=yes],
17991d8c7986Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
18001d8c7986Smrgrm -f conftest.xml
18011d8c7986SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
18021d8c7986SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
18031d8c7986Smrg]) # XORG_WITH_XMLTO
18041d8c7986Smrg
18051d8c7986Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
18061d8c7986Smrg# --------------------------------------------
18071d8c7986Smrg# Minimum version: 1.12.0
18081d8c7986Smrg# Minimum version for optional DEFAULT argument: 1.12.0
18091d8c7986Smrg#
18101d8c7986Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
18111d8c7986Smrg# XML-based language used for the transformation of XML documents.
18121d8c7986Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
18131d8c7986Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
18141d8c7986Smrg# The XSLT processor is often used as a standalone tool for transformations.
18151d8c7986Smrg# It should not be assumed that this tool is used only to work with documnetation.
18161d8c7986Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
18171d8c7986Smrg#
18181d8c7986Smrg# Interface to module:
18191d8c7986Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
18201d8c7986Smrg# XSLTPROC:	 returns the path of the xsltproc program found
18211d8c7986Smrg#		 returns the path set by the user in the environment
18221d8c7986Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
18231d8c7986Smrg#		  'no' user instructs the module not to use xsltproc
18241d8c7986Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
18251d8c7986Smrg#
18261d8c7986Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
18271d8c7986Smrg#
18281d8c7986SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
18291d8c7986SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
18301d8c7986Smrg# Preserves the interface, should it be implemented later
18311d8c7986Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
18321d8c7986Smrgm4_define([_defopt], m4_default([$2], [auto]))
18331d8c7986SmrgAC_ARG_WITH(xsltproc,
18341d8c7986Smrg	AS_HELP_STRING([--with-xsltproc],
18351d8c7986Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
18361d8c7986Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
18371d8c7986Smrgm4_undefine([_defopt])
18381d8c7986Smrg
18391d8c7986Smrgif test "x$use_xsltproc" = x"auto"; then
18401d8c7986Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
18411d8c7986Smrg   if test "x$XSLTPROC" = "x"; then
18421d8c7986Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
18431d8c7986Smrg	have_xsltproc=no
18441d8c7986Smrg   else
18451d8c7986Smrg        have_xsltproc=yes
18461d8c7986Smrg   fi
18471d8c7986Smrgelif test "x$use_xsltproc" = x"yes" ; then
18481d8c7986Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
18491d8c7986Smrg   if test "x$XSLTPROC" = "x"; then
18501d8c7986Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
18511d8c7986Smrg   fi
18521d8c7986Smrg   have_xsltproc=yes
18531d8c7986Smrgelif test "x$use_xsltproc" = x"no" ; then
18541d8c7986Smrg   if test "x$XSLTPROC" != "x"; then
18551d8c7986Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
18561d8c7986Smrg   fi
18571d8c7986Smrg   have_xsltproc=no
18581d8c7986Smrgelse
18591d8c7986Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
18601d8c7986Smrgfi
18611d8c7986Smrg
18621d8c7986SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
18631d8c7986Smrg]) # XORG_WITH_XSLTPROC
18641d8c7986Smrg
18651d8c7986Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
18661d8c7986Smrg# ----------------------------------------
18671d8c7986Smrg# Minimum version: 1.15.0
18681d8c7986Smrg#
18691d8c7986Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
18701d8c7986Smrg# scanning arbitrary text files, extracting information from those text files,
18711d8c7986Smrg# and printing reports based on that information.
18721d8c7986Smrg#
18731d8c7986Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
18741d8c7986Smrg#
18751d8c7986Smrg# Interface to module:
18761d8c7986Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
18771d8c7986Smrg# PERL:	     returns the path of the perl program found
18781d8c7986Smrg#	     returns the path set by the user in the environment
18791d8c7986Smrg# --with-perl: 'yes' user instructs the module to use perl
18801d8c7986Smrg#	       'no' user instructs the module not to use perl
18811d8c7986Smrg# have_perl: returns yes if perl found in PATH or no
18821d8c7986Smrg#
18831d8c7986Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
18841d8c7986Smrg#
18851d8c7986SmrgAC_DEFUN([XORG_WITH_PERL],[
18861d8c7986SmrgAC_ARG_VAR([PERL], [Path to perl command])
18871d8c7986Smrg# Preserves the interface, should it be implemented later
18881d8c7986Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
18891d8c7986Smrgm4_define([_defopt], m4_default([$2], [auto]))
18901d8c7986SmrgAC_ARG_WITH(perl,
18911d8c7986Smrg	AS_HELP_STRING([--with-perl],
18921d8c7986Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
18931d8c7986Smrg	   [use_perl=$withval], [use_perl=]_defopt)
18941d8c7986Smrgm4_undefine([_defopt])
18951d8c7986Smrg
18961d8c7986Smrgif test "x$use_perl" = x"auto"; then
18971d8c7986Smrg   AC_PATH_PROG([PERL], [perl])
18981d8c7986Smrg   if test "x$PERL" = "x"; then
18991d8c7986Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
19001d8c7986Smrg	have_perl=no
19011d8c7986Smrg   else
19021d8c7986Smrg        have_perl=yes
19031d8c7986Smrg   fi
19041d8c7986Smrgelif test "x$use_perl" = x"yes" ; then
19051d8c7986Smrg   AC_PATH_PROG([PERL], [perl])
19061d8c7986Smrg   if test "x$PERL" = "x"; then
19071d8c7986Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
19081d8c7986Smrg   fi
19091d8c7986Smrg   have_perl=yes
19101d8c7986Smrgelif test "x$use_perl" = x"no" ; then
19111d8c7986Smrg   if test "x$PERL" != "x"; then
19121d8c7986Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
19131d8c7986Smrg   fi
19141d8c7986Smrg   have_perl=no
19151d8c7986Smrgelse
19161d8c7986Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
19171d8c7986Smrgfi
19181d8c7986Smrg
19191d8c7986SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
19201d8c7986Smrg]) # XORG_WITH_PERL
19211d8c7986Smrg
19221d8c7986Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
19231d8c7986Smrg# ----------------
19241d8c7986Smrg# Minimum version: 1.5.0
19251d8c7986Smrg# Minimum version for optional DEFAULT argument: 1.11.0
19261d8c7986Smrg#
19271d8c7986Smrg# Documentation tools are not always available on all platforms and sometimes
19281d8c7986Smrg# not at the appropriate level. This macro enables a module to test for the
19291d8c7986Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
19301d8c7986Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
19311d8c7986Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
19321d8c7986Smrg# --with-asciidoc assumes 'auto'.
19331d8c7986Smrg#
19341d8c7986Smrg# Interface to module:
19351d8c7986Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
19361d8c7986Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
19371d8c7986Smrg#		 returns the path set by the user in the environment
19381d8c7986Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
19391d8c7986Smrg#		  'no' user instructs the module not to use asciidoc
19401d8c7986Smrg#
19411d8c7986Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
19421d8c7986Smrg#
19431d8c7986SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
19441d8c7986SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
19451d8c7986Smrgm4_define([_defopt], m4_default([$2], [auto]))
19461d8c7986SmrgAC_ARG_WITH(asciidoc,
19471d8c7986Smrg	AS_HELP_STRING([--with-asciidoc],
19481d8c7986Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
19491d8c7986Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
19501d8c7986Smrgm4_undefine([_defopt])
19511d8c7986Smrg
19521d8c7986Smrgif test "x$use_asciidoc" = x"auto"; then
19531d8c7986Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
19541d8c7986Smrg   if test "x$ASCIIDOC" = "x"; then
19551d8c7986Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
19561d8c7986Smrg	have_asciidoc=no
19571d8c7986Smrg   else
19581d8c7986Smrg        have_asciidoc=yes
19591d8c7986Smrg   fi
19601d8c7986Smrgelif test "x$use_asciidoc" = x"yes" ; then
19611d8c7986Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
19621d8c7986Smrg   if test "x$ASCIIDOC" = "x"; then
19631d8c7986Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
19641d8c7986Smrg   fi
19651d8c7986Smrg   have_asciidoc=yes
19661d8c7986Smrgelif test "x$use_asciidoc" = x"no" ; then
19671d8c7986Smrg   if test "x$ASCIIDOC" != "x"; then
19681d8c7986Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
19691d8c7986Smrg   fi
19701d8c7986Smrg   have_asciidoc=no
19711d8c7986Smrgelse
19721d8c7986Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
19731d8c7986Smrgfi
19741d8c7986Smrgm4_ifval([$1],
19751d8c7986Smrg[if test "$have_asciidoc" = yes; then
19761d8c7986Smrg    # scrape the asciidoc version
19771d8c7986Smrg    AC_MSG_CHECKING([the asciidoc version])
19781d8c7986Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
19791d8c7986Smrg    AC_MSG_RESULT([$asciidoc_version])
19801d8c7986Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
19811d8c7986Smrg        [if test "x$use_asciidoc" = xauto; then
19821d8c7986Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
19831d8c7986Smrg            have_asciidoc=no
19841d8c7986Smrg        else
19851d8c7986Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
19861d8c7986Smrg        fi])
19871d8c7986Smrgfi])
19881d8c7986SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
19891d8c7986Smrg]) # XORG_WITH_ASCIIDOC
19901d8c7986Smrg
19911d8c7986Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1992c82dfdfbSmrg# -------------------------------------------
19931d8c7986Smrg# Minimum version: 1.5.0
19941d8c7986Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1995c82dfdfbSmrg# Minimum version for optional DOT checking: 1.18.0
19961d8c7986Smrg#
19971d8c7986Smrg# Documentation tools are not always available on all platforms and sometimes
19981d8c7986Smrg# not at the appropriate level. This macro enables a module to test for the
19991d8c7986Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
20001d8c7986Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
20011d8c7986Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
20021d8c7986Smrg# --with-doxygen assumes 'auto'.
20031d8c7986Smrg#
20041d8c7986Smrg# Interface to module:
20051d8c7986Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
20061d8c7986Smrg# DOXYGEN:	 returns the path of the doxygen program found
20071d8c7986Smrg#		 returns the path set by the user in the environment
20081d8c7986Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
20091d8c7986Smrg#		  'no' user instructs the module not to use doxygen
20101d8c7986Smrg#
20111d8c7986Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
20121d8c7986Smrg#
20131d8c7986SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
20141d8c7986SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2015c82dfdfbSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
20161d8c7986Smrgm4_define([_defopt], m4_default([$2], [auto]))
20171d8c7986SmrgAC_ARG_WITH(doxygen,
20181d8c7986Smrg	AS_HELP_STRING([--with-doxygen],
20191d8c7986Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
20201d8c7986Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
20211d8c7986Smrgm4_undefine([_defopt])
20221d8c7986Smrg
20231d8c7986Smrgif test "x$use_doxygen" = x"auto"; then
20241d8c7986Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
20251d8c7986Smrg   if test "x$DOXYGEN" = "x"; then
20261d8c7986Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
20271d8c7986Smrg	have_doxygen=no
20281d8c7986Smrg   else
20291d8c7986Smrg        have_doxygen=yes
20301d8c7986Smrg   fi
20311d8c7986Smrgelif test "x$use_doxygen" = x"yes" ; then
20321d8c7986Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
20331d8c7986Smrg   if test "x$DOXYGEN" = "x"; then
20341d8c7986Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
20351d8c7986Smrg   fi
20361d8c7986Smrg   have_doxygen=yes
20371d8c7986Smrgelif test "x$use_doxygen" = x"no" ; then
20381d8c7986Smrg   if test "x$DOXYGEN" != "x"; then
20391d8c7986Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
20401d8c7986Smrg   fi
20411d8c7986Smrg   have_doxygen=no
20421d8c7986Smrgelse
20431d8c7986Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
20441d8c7986Smrgfi
20451d8c7986Smrgm4_ifval([$1],
20461d8c7986Smrg[if test "$have_doxygen" = yes; then
20471d8c7986Smrg    # scrape the doxygen version
20481d8c7986Smrg    AC_MSG_CHECKING([the doxygen version])
20491d8c7986Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
20501d8c7986Smrg    AC_MSG_RESULT([$doxygen_version])
20511d8c7986Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
20521d8c7986Smrg        [if test "x$use_doxygen" = xauto; then
20531d8c7986Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
20541d8c7986Smrg            have_doxygen=no
20551d8c7986Smrg        else
20561d8c7986Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
20571d8c7986Smrg        fi])
20581d8c7986Smrgfi])
2059c82dfdfbSmrg
2060c82dfdfbSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2061c82dfdfbSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2062c82dfdfbSmrgdnl 	HAVE_DOT = @HAVE_DOT@
2063c82dfdfbSmrgHAVE_DOT=no
2064c82dfdfbSmrgif test "x$have_doxygen" = "xyes"; then
2065c82dfdfbSmrg  AC_PATH_PROG([DOT], [dot])
2066c82dfdfbSmrg    if test "x$DOT" != "x"; then
2067c82dfdfbSmrg      HAVE_DOT=yes
2068c82dfdfbSmrg    fi
2069c82dfdfbSmrgfi
2070c82dfdfbSmrg
2071c82dfdfbSmrgAC_SUBST([HAVE_DOT])
2072c82dfdfbSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
20731d8c7986SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
20741d8c7986Smrg]) # XORG_WITH_DOXYGEN
20751d8c7986Smrg
20761d8c7986Smrg# XORG_WITH_GROFF([DEFAULT])
20771d8c7986Smrg# ----------------
20781d8c7986Smrg# Minimum version: 1.6.0
20791d8c7986Smrg# Minimum version for optional DEFAULT argument: 1.11.0
20801d8c7986Smrg#
20811d8c7986Smrg# Documentation tools are not always available on all platforms and sometimes
20821d8c7986Smrg# not at the appropriate level. This macro enables a module to test for the
20831d8c7986Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
20841d8c7986Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
20851d8c7986Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
20861d8c7986Smrg# --with-groff assumes 'auto'.
20871d8c7986Smrg#
20881d8c7986Smrg# Interface to module:
20891d8c7986Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
20901d8c7986Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
20911d8c7986Smrg# HAVE_GROFF_MS: the -ms macros package
20921d8c7986Smrg# GROFF:	 returns the path of the groff program found
20931d8c7986Smrg#		 returns the path set by the user in the environment
20941d8c7986Smrg# --with-groff:	 'yes' user instructs the module to use groff
20951d8c7986Smrg#		 'no' user instructs the module not to use groff
20961d8c7986Smrg#
20971d8c7986Smrg# Added in version 1.9.0:
20981d8c7986Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
20991d8c7986Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
21001d8c7986Smrg#		   psselect from the psutils package.
21011d8c7986Smrg#		   the ghostcript package. Refer to the grohtml man pages
21021d8c7986Smrg#
21031d8c7986Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
21041d8c7986Smrg#
21051d8c7986Smrg# OS and distros often splits groff in a basic and full package, the former
21061d8c7986Smrg# having the groff program and the later having devices, fonts and macros
21071d8c7986Smrg# Checking for the groff executable is not enough.
21081d8c7986Smrg#
21091d8c7986Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
21101d8c7986Smrg# unset HAVE_GROFF or GROFF env variables.
21111d8c7986Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
21121d8c7986Smrg#
21131d8c7986SmrgAC_DEFUN([XORG_WITH_GROFF],[
21141d8c7986SmrgAC_ARG_VAR([GROFF], [Path to groff command])
21151d8c7986Smrgm4_define([_defopt], m4_default([$1], [auto]))
21161d8c7986SmrgAC_ARG_WITH(groff,
21171d8c7986Smrg	AS_HELP_STRING([--with-groff],
21181d8c7986Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
21191d8c7986Smrg	   [use_groff=$withval], [use_groff=]_defopt)
21201d8c7986Smrgm4_undefine([_defopt])
21211d8c7986Smrg
21221d8c7986Smrgif test "x$use_groff" = x"auto"; then
21231d8c7986Smrg   AC_PATH_PROG([GROFF], [groff])
21241d8c7986Smrg   if test "x$GROFF" = "x"; then
21251d8c7986Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
21261d8c7986Smrg	have_groff=no
21271d8c7986Smrg   else
21281d8c7986Smrg        have_groff=yes
21291d8c7986Smrg   fi
21301d8c7986Smrgelif test "x$use_groff" = x"yes" ; then
21311d8c7986Smrg   AC_PATH_PROG([GROFF], [groff])
21321d8c7986Smrg   if test "x$GROFF" = "x"; then
21331d8c7986Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
21341d8c7986Smrg   fi
21351d8c7986Smrg   have_groff=yes
21361d8c7986Smrgelif test "x$use_groff" = x"no" ; then
21371d8c7986Smrg   if test "x$GROFF" != "x"; then
21381d8c7986Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
21391d8c7986Smrg   fi
21401d8c7986Smrg   have_groff=no
21411d8c7986Smrgelse
21421d8c7986Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
21431d8c7986Smrgfi
21441d8c7986Smrg
21451d8c7986Smrg# We have groff, test for the presence of the macro packages
21461d8c7986Smrgif test "x$have_groff" = x"yes"; then
21471d8c7986Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
21481d8c7986Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
21491d8c7986Smrg        groff_ms_works=yes
21501d8c7986Smrg    else
21511d8c7986Smrg        groff_ms_works=no
21521d8c7986Smrg    fi
21531d8c7986Smrg    AC_MSG_RESULT([$groff_ms_works])
21541d8c7986Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
21551d8c7986Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
21561d8c7986Smrg        groff_mm_works=yes
2157690143ccSmrg    else
21581d8c7986Smrg        groff_mm_works=no
2159690143ccSmrg    fi
21601d8c7986Smrg    AC_MSG_RESULT([$groff_mm_works])
21611d8c7986Smrgfi
2162690143ccSmrg
21631d8c7986Smrg# We have groff, test for HTML dependencies, one command per package
21641d8c7986Smrgif test "x$have_groff" = x"yes"; then
21651d8c7986Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
21661d8c7986Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
21671d8c7986Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
21681d8c7986Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
21691d8c7986Smrg      have_groff_html=yes
21701d8c7986Smrg   else
21711d8c7986Smrg      have_groff_html=no
21721d8c7986Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
21731d8c7986Smrg   fi
21741d8c7986Smrgfi
2175690143ccSmrg
21761d8c7986Smrg# Set Automake conditionals for Makefiles
21771d8c7986SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
21781d8c7986SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
21791d8c7986SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
21801d8c7986SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
21811d8c7986Smrg]) # XORG_WITH_GROFF
21821d8c7986Smrg
21831d8c7986Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
21841d8c7986Smrg# ---------------------------------------
21851d8c7986Smrg# Minimum version: 1.6.0
21861d8c7986Smrg# Minimum version for optional DEFAULT argument: 1.11.0
21871d8c7986Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
21881d8c7986Smrg#
21891d8c7986Smrg# Documentation tools are not always available on all platforms and sometimes
21901d8c7986Smrg# not at the appropriate level. This macro enables a module to test for the
21911d8c7986Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
21921d8c7986Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
21931d8c7986Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
21941d8c7986Smrg# --with-fop assumes 'auto'.
21951d8c7986Smrg#
21961d8c7986Smrg# Interface to module:
21971d8c7986Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
21981d8c7986Smrg# FOP:	 	returns the path of the fop program found
21991d8c7986Smrg#		returns the path set by the user in the environment
22001d8c7986Smrg# --with-fop: 	'yes' user instructs the module to use fop
22011d8c7986Smrg#		'no' user instructs the module not to use fop
22021d8c7986Smrg#
22031d8c7986Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
22041d8c7986Smrg#
22051d8c7986SmrgAC_DEFUN([XORG_WITH_FOP],[
22061d8c7986SmrgAC_ARG_VAR([FOP], [Path to fop command])
22071d8c7986Smrgm4_define([_defopt], m4_default([$2], [auto]))
22081d8c7986SmrgAC_ARG_WITH(fop,
22091d8c7986Smrg	AS_HELP_STRING([--with-fop],
22101d8c7986Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
22111d8c7986Smrg	   [use_fop=$withval], [use_fop=]_defopt)
22121d8c7986Smrgm4_undefine([_defopt])
22131d8c7986Smrg
22141d8c7986Smrgif test "x$use_fop" = x"auto"; then
22151d8c7986Smrg   AC_PATH_PROG([FOP], [fop])
22161d8c7986Smrg   if test "x$FOP" = "x"; then
22171d8c7986Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
22181d8c7986Smrg	have_fop=no
22191d8c7986Smrg   else
22201d8c7986Smrg        have_fop=yes
22211d8c7986Smrg   fi
22221d8c7986Smrgelif test "x$use_fop" = x"yes" ; then
22231d8c7986Smrg   AC_PATH_PROG([FOP], [fop])
22241d8c7986Smrg   if test "x$FOP" = "x"; then
22251d8c7986Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
22261d8c7986Smrg   fi
22271d8c7986Smrg   have_fop=yes
22281d8c7986Smrgelif test "x$use_fop" = x"no" ; then
22291d8c7986Smrg   if test "x$FOP" != "x"; then
22301d8c7986Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
22311d8c7986Smrg   fi
22321d8c7986Smrg   have_fop=no
22331d8c7986Smrgelse
22341d8c7986Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
22351d8c7986Smrgfi
22361d8c7986Smrg
22371d8c7986Smrg# Test for a minimum version of fop, if provided.
22381d8c7986Smrgm4_ifval([$1],
22391d8c7986Smrg[if test "$have_fop" = yes; then
22401d8c7986Smrg    # scrape the fop version
22411d8c7986Smrg    AC_MSG_CHECKING([for fop minimum version])
22421d8c7986Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
22431d8c7986Smrg    AC_MSG_RESULT([$fop_version])
22441d8c7986Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
22451d8c7986Smrg        [if test "x$use_fop" = xauto; then
22461d8c7986Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
22471d8c7986Smrg            have_fop=no
22481d8c7986Smrg        else
22491d8c7986Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
22501d8c7986Smrg        fi])
22511d8c7986Smrgfi])
22521d8c7986SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
22531d8c7986Smrg]) # XORG_WITH_FOP
22541d8c7986Smrg
2255c82dfdfbSmrg# XORG_WITH_M4([MIN-VERSION])
2256c82dfdfbSmrg# ---------------------------
2257c82dfdfbSmrg# Minimum version: 1.19.0
2258c82dfdfbSmrg#
2259c82dfdfbSmrg# This macro attempts to locate an m4 macro processor which supports
2260c82dfdfbSmrg# -I option and is only useful for modules relying on M4 in order to
2261c82dfdfbSmrg# expand macros in source code files.
2262c82dfdfbSmrg#
2263c82dfdfbSmrg# Interface to module:
2264c82dfdfbSmrg# M4:	 	returns the path of the m4 program found
2265c82dfdfbSmrg#		returns the path set by the user in the environment
2266c82dfdfbSmrg#
2267c82dfdfbSmrgAC_DEFUN([XORG_WITH_M4], [
2268c82dfdfbSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2269c82dfdfbSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2270c82dfdfbSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2271c82dfdfbSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2272c82dfdfbSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2273c82dfdfbSmrg   [$PATH:/usr/gnu/bin])])
2274c82dfdfbSmrg
2275c82dfdfbSmrgAC_SUBST([M4], [$ac_cv_path_M4])
2276c82dfdfbSmrg]) # XORG_WITH_M4
2277c82dfdfbSmrg
22781d8c7986Smrg# XORG_WITH_PS2PDF([DEFAULT])
22791d8c7986Smrg# ----------------
22801d8c7986Smrg# Minimum version: 1.6.0
22811d8c7986Smrg# Minimum version for optional DEFAULT argument: 1.11.0
22821d8c7986Smrg#
22831d8c7986Smrg# Documentation tools are not always available on all platforms and sometimes
22841d8c7986Smrg# not at the appropriate level. This macro enables a module to test for the
22851d8c7986Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
22861d8c7986Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
22871d8c7986Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
22881d8c7986Smrg# --with-ps2pdf assumes 'auto'.
22891d8c7986Smrg#
22901d8c7986Smrg# Interface to module:
22911d8c7986Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
22921d8c7986Smrg# PS2PDF:	returns the path of the ps2pdf program found
22931d8c7986Smrg#		returns the path set by the user in the environment
22941d8c7986Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
22951d8c7986Smrg#		 'no' user instructs the module not to use ps2pdf
22961d8c7986Smrg#
22971d8c7986Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
22981d8c7986Smrg#
22991d8c7986SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
23001d8c7986SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
23011d8c7986Smrgm4_define([_defopt], m4_default([$1], [auto]))
23021d8c7986SmrgAC_ARG_WITH(ps2pdf,
23031d8c7986Smrg	AS_HELP_STRING([--with-ps2pdf],
23041d8c7986Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
23051d8c7986Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
23061d8c7986Smrgm4_undefine([_defopt])
23071d8c7986Smrg
23081d8c7986Smrgif test "x$use_ps2pdf" = x"auto"; then
23091d8c7986Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23101d8c7986Smrg   if test "x$PS2PDF" = "x"; then
23111d8c7986Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
23121d8c7986Smrg	have_ps2pdf=no
23131d8c7986Smrg   else
23141d8c7986Smrg        have_ps2pdf=yes
23151d8c7986Smrg   fi
23161d8c7986Smrgelif test "x$use_ps2pdf" = x"yes" ; then
23171d8c7986Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23181d8c7986Smrg   if test "x$PS2PDF" = "x"; then
23191d8c7986Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
23201d8c7986Smrg   fi
23211d8c7986Smrg   have_ps2pdf=yes
23221d8c7986Smrgelif test "x$use_ps2pdf" = x"no" ; then
23231d8c7986Smrg   if test "x$PS2PDF" != "x"; then
23241d8c7986Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
23251d8c7986Smrg   fi
23261d8c7986Smrg   have_ps2pdf=no
23271d8c7986Smrgelse
23281d8c7986Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
23291d8c7986Smrgfi
23301d8c7986SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
23311d8c7986Smrg]) # XORG_WITH_PS2PDF
23321d8c7986Smrg
23331d8c7986Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
23341d8c7986Smrg# ----------------
23351d8c7986Smrg# Minimum version: 1.6.0
23361d8c7986Smrg#
23371d8c7986Smrg# Documentation tools are not always available on all platforms and sometimes
23381d8c7986Smrg# not at the appropriate level. This macro enables a builder to skip all
23391d8c7986Smrg# documentation targets except traditional man pages.
23401d8c7986Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
23411d8c7986Smrg# maximum flexibilty in controlling documentation building.
23421d8c7986Smrg# Refer to:
23431d8c7986Smrg# XORG_WITH_XMLTO         --with-xmlto
23441d8c7986Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
23451d8c7986Smrg# XORG_WITH_DOXYGEN       --with-doxygen
23461d8c7986Smrg# XORG_WITH_FOP           --with-fop
23471d8c7986Smrg# XORG_WITH_GROFF         --with-groff
23481d8c7986Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
23491d8c7986Smrg#
23501d8c7986Smrg# Interface to module:
23511d8c7986Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
23521d8c7986Smrg# --enable-docs: 'yes' user instructs the module to generate docs
23531d8c7986Smrg#		 'no' user instructs the module not to generate docs
23541d8c7986Smrg# parm1:	specify the default value, yes or no.
23551d8c7986Smrg#
23561d8c7986SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
23571d8c7986Smrgm4_define([docs_default], m4_default([$1], [yes]))
23581d8c7986SmrgAC_ARG_ENABLE(docs,
23591d8c7986Smrg	AS_HELP_STRING([--enable-docs],
23601d8c7986Smrg	   [Enable building the documentation (default: ]docs_default[)]),
23611d8c7986Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
23621d8c7986Smrgm4_undefine([docs_default])
23631d8c7986SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
23641d8c7986SmrgAC_MSG_CHECKING([whether to build documentation])
23651d8c7986SmrgAC_MSG_RESULT([$build_docs])
23661d8c7986Smrg]) # XORG_ENABLE_DOCS
23671d8c7986Smrg
23681d8c7986Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
23691d8c7986Smrg# ----------------
23701d8c7986Smrg# Minimum version: 1.6.0
23711d8c7986Smrg#
23721d8c7986Smrg# This macro enables a builder to skip all developer documentation.
23731d8c7986Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
23741d8c7986Smrg# maximum flexibilty in controlling documentation building.
23751d8c7986Smrg# Refer to:
23761d8c7986Smrg# XORG_WITH_XMLTO         --with-xmlto
23771d8c7986Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
23781d8c7986Smrg# XORG_WITH_DOXYGEN       --with-doxygen
23791d8c7986Smrg# XORG_WITH_FOP           --with-fop
23801d8c7986Smrg# XORG_WITH_GROFF         --with-groff
23811d8c7986Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
23821d8c7986Smrg#
23831d8c7986Smrg# Interface to module:
23841d8c7986Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
23851d8c7986Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
23861d8c7986Smrg#			'no' user instructs the module not to generate developer docs
23871d8c7986Smrg# parm1:		specify the default value, yes or no.
23881d8c7986Smrg#
23891d8c7986SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
23901d8c7986Smrgm4_define([devel_default], m4_default([$1], [yes]))
23911d8c7986SmrgAC_ARG_ENABLE(devel-docs,
23921d8c7986Smrg	AS_HELP_STRING([--enable-devel-docs],
23931d8c7986Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
23941d8c7986Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
23951d8c7986Smrgm4_undefine([devel_default])
23961d8c7986SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
23971d8c7986SmrgAC_MSG_CHECKING([whether to build developer documentation])
23981d8c7986SmrgAC_MSG_RESULT([$build_devel_docs])
23991d8c7986Smrg]) # XORG_ENABLE_DEVEL_DOCS
24001d8c7986Smrg
24011d8c7986Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
24021d8c7986Smrg# ----------------
24031d8c7986Smrg# Minimum version: 1.6.0
24041d8c7986Smrg#
24051d8c7986Smrg# This macro enables a builder to skip all functional specification targets.
24061d8c7986Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24071d8c7986Smrg# maximum flexibilty in controlling documentation building.
24081d8c7986Smrg# Refer to:
24091d8c7986Smrg# XORG_WITH_XMLTO         --with-xmlto
24101d8c7986Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24111d8c7986Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24121d8c7986Smrg# XORG_WITH_FOP           --with-fop
24131d8c7986Smrg# XORG_WITH_GROFF         --with-groff
24141d8c7986Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24151d8c7986Smrg#
24161d8c7986Smrg# Interface to module:
24171d8c7986Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
24181d8c7986Smrg# --enable-specs:	'yes' user instructs the module to generate specs
24191d8c7986Smrg#			'no' user instructs the module not to generate specs
24201d8c7986Smrg# parm1:		specify the default value, yes or no.
242183e5f723Smrg#
24221d8c7986SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
24231d8c7986Smrgm4_define([spec_default], m4_default([$1], [yes]))
24241d8c7986SmrgAC_ARG_ENABLE(specs,
24251d8c7986Smrg	AS_HELP_STRING([--enable-specs],
24261d8c7986Smrg	   [Enable building the specs (default: ]spec_default[)]),
24271d8c7986Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
24281d8c7986Smrgm4_undefine([spec_default])
24291d8c7986SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
24301d8c7986SmrgAC_MSG_CHECKING([whether to build functional specifications])
24311d8c7986SmrgAC_MSG_RESULT([$build_specs])
24321d8c7986Smrg]) # XORG_ENABLE_SPECS
2433690143ccSmrg
24341d8c7986Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
24351d8c7986Smrg# ----------------------------------------------
24361d8c7986Smrg# Minimum version: 1.13.0
243783e5f723Smrg#
24381d8c7986Smrg# This macro enables a builder to enable/disable unit testing
24391d8c7986Smrg# It makes no assumption about the test cases implementation
24401d8c7986Smrg# Test cases may or may not use Automake "Support for test suites"
24411d8c7986Smrg# They may or may not use the software utility library GLib
24421d8c7986Smrg#
24431d8c7986Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
24441d8c7986Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
24451d8c7986Smrg# The variable enable_unit_tests is used by other macros in this file.
24461d8c7986Smrg#
24471d8c7986Smrg# Interface to module:
24481d8c7986Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
24491d8c7986Smrg# enable_unit_tests:    used in configure.ac for additional configuration
24501d8c7986Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
24511d8c7986Smrg#			'no' user instructs the module not to build tests
24521d8c7986Smrg# parm1:		specify the default value, yes or no.
24531d8c7986Smrg#
24541d8c7986SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
24551d8c7986SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
24561d8c7986SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
24571d8c7986SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
24581d8c7986Smrgm4_define([_defopt], m4_default([$1], [auto]))
24591d8c7986SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
24601d8c7986Smrg	[Enable building unit test cases (default: ]_defopt[)]),
24611d8c7986Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
24621d8c7986Smrgm4_undefine([_defopt])
24631d8c7986SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
24641d8c7986SmrgAC_MSG_CHECKING([whether to build unit test cases])
24651d8c7986SmrgAC_MSG_RESULT([$enable_unit_tests])
24661d8c7986Smrg]) # XORG_ENABLE_UNIT_TESTS
246783e5f723Smrg
24681d8c7986Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
24691d8c7986Smrg# ------------------------------------------------------
24701d8c7986Smrg# Minimum version: 1.17.0
24711d8c7986Smrg#
24721d8c7986Smrg# This macro enables a builder to enable/disable integration testing
24731d8c7986Smrg# It makes no assumption about the test cases' implementation
24741d8c7986Smrg# Test cases may or may not use Automake "Support for test suites"
24751d8c7986Smrg#
24761d8c7986Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
24771d8c7986Smrg# usually requires less dependencies and may be built and run under less
24781d8c7986Smrg# stringent environments than integration tests.
24791d8c7986Smrg#
24801d8c7986Smrg# Interface to module:
24811d8c7986Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
24821d8c7986Smrg# enable_integration_tests:   used in configure.ac for additional configuration
24831d8c7986Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
24841d8c7986Smrg#                             'no' user instructs the module not to build tests
24851d8c7986Smrg# parm1:                      specify the default value, yes or no.
24861d8c7986Smrg#
24871d8c7986SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
24881d8c7986SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
24891d8c7986Smrgm4_define([_defopt], m4_default([$1], [auto]))
24901d8c7986SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
24911d8c7986Smrg	[Enable building integration test cases (default: ]_defopt[)]),
24921d8c7986Smrg	[enable_integration_tests=$enableval],
24931d8c7986Smrg	[enable_integration_tests=]_defopt)
24941d8c7986Smrgm4_undefine([_defopt])
24951d8c7986SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
24961d8c7986Smrg	[test "x$enable_integration_tests" != xno])
24971d8c7986SmrgAC_MSG_CHECKING([whether to build unit test cases])
24981d8c7986SmrgAC_MSG_RESULT([$enable_integration_tests])
24991d8c7986Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2500690143ccSmrg
25011d8c7986Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
25021d8c7986Smrg# ----------------------------------------
25031d8c7986Smrg# Minimum version: 1.13.0
25041d8c7986Smrg#
25051d8c7986Smrg# GLib is a library which provides advanced data structures and functions.
25061d8c7986Smrg# This macro enables a module to test for the presence of Glib.
25071d8c7986Smrg#
25081d8c7986Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
25091d8c7986Smrg# Otherwise the value of $enable_unit_tests is blank.
25101d8c7986Smrg#
25111d8c7986Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
25121d8c7986Smrg# test support usually requires less dependencies and may be built and run under
25131d8c7986Smrg# less stringent environments than integration tests.
25141d8c7986Smrg#
25151d8c7986Smrg# Interface to module:
25161d8c7986Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
25171d8c7986Smrg# with_glib: used in configure.ac to know if GLib has been found
25181d8c7986Smrg# --with-glib:	'yes' user instructs the module to use glib
25191d8c7986Smrg#		'no' user instructs the module not to use glib
25201d8c7986Smrg#
25211d8c7986SmrgAC_DEFUN([XORG_WITH_GLIB],[
25221d8c7986SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
25231d8c7986Smrgm4_define([_defopt], m4_default([$2], [auto]))
25241d8c7986SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
25251d8c7986Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
25261d8c7986Smrg	[with_glib=$withval], [with_glib=]_defopt)
25271d8c7986Smrgm4_undefine([_defopt])
2528690143ccSmrg
25291d8c7986Smrghave_glib=no
25301d8c7986Smrg# Do not probe GLib if user explicitly disabled unit testing
25311d8c7986Smrgif test "x$enable_unit_tests" != x"no"; then
25321d8c7986Smrg  # Do not probe GLib if user explicitly disabled it
25331d8c7986Smrg  if test "x$with_glib" != x"no"; then
25341d8c7986Smrg    m4_ifval(
25351d8c7986Smrg      [$1],
25361d8c7986Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
25371d8c7986Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
25381d8c7986Smrg    )
2539690143ccSmrg  fi
254083e5f723Smrgfi
254183e5f723Smrg
25421d8c7986Smrg# Not having GLib when unit testing has been explicitly requested is an error
25431d8c7986Smrgif test "x$enable_unit_tests" = x"yes"; then
25441d8c7986Smrg  if test "x$have_glib" = x"no"; then
25451d8c7986Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2546690143ccSmrg  fi
2547690143ccSmrgfi
2548690143ccSmrg
25491d8c7986Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
25501d8c7986Smrgif test "x$enable_unit_tests" = x"no"; then
25511d8c7986Smrg  if test "x$with_glib" = x"yes"; then
25521d8c7986Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
25531d8c7986Smrg  fi
25541d8c7986Smrgfi
255583e5f723Smrg
25561d8c7986Smrg# Not having GLib when it has been explicitly requested is an error
25571d8c7986Smrgif test "x$with_glib" = x"yes"; then
25581d8c7986Smrg  if test "x$have_glib" = x"no"; then
25591d8c7986Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
25601d8c7986Smrg  fi
256183e5f723Smrgfi
256283e5f723Smrg
25631d8c7986SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
25641d8c7986Smrg]) # XORG_WITH_GLIB
25651d8c7986Smrg
25661d8c7986Smrg# XORG_LD_WRAP([required|optional])
25671d8c7986Smrg# ---------------------------------
25681d8c7986Smrg# Minimum version: 1.13.0
256983e5f723Smrg#
25701d8c7986Smrg# Check if linker supports -wrap, passed via compiler flags
25711d8c7986Smrg#
25721d8c7986Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
25731d8c7986Smrg# Otherwise the value of $enable_unit_tests is blank.
25741d8c7986Smrg#
25751d8c7986Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
25761d8c7986Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
25771d8c7986Smrg# available, an argument of "optional" allows use when some unit tests require
25781d8c7986Smrg# ld -wrap and others do not.
25791d8c7986Smrg#
25801d8c7986SmrgAC_DEFUN([XORG_LD_WRAP],[
25811d8c7986SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
25821d8c7986Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
25831d8c7986Smrg                      void __wrap_exit(int status) { return; }],
25841d8c7986Smrg                     [exit(0);])])
25851d8c7986Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
25861d8c7986Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
25871d8c7986Smrg  if test "x$have_ld_wrap" = x"no"; then
25881d8c7986Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
25891d8c7986Smrg  fi
25901d8c7986Smrgfi
25911d8c7986SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
25921d8c7986Smrg#
25931d8c7986Smrg]) # XORG_LD_WRAP
2594690143ccSmrg
25951d8c7986Smrg# XORG_CHECK_LINKER_FLAGS
25961d8c7986Smrg# -----------------------
25971d8c7986Smrg# SYNOPSIS
25981d8c7986Smrg#
25991d8c7986Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
26001d8c7986Smrg#
26011d8c7986Smrg# DESCRIPTION
26021d8c7986Smrg#
26031d8c7986Smrg#   Check whether the given linker FLAGS work with the current language's
26041d8c7986Smrg#   linker, or whether they give an error.
26051d8c7986Smrg#
26061d8c7986Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
26071d8c7986Smrg#   success/failure.
26081d8c7986Smrg#
26091d8c7986Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
26101d8c7986Smrg#
26111d8c7986Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
26121d8c7986Smrg#
26131d8c7986Smrg# LICENSE
26141d8c7986Smrg#
26151d8c7986Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
26161d8c7986Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
26171d8c7986Smrg#   Copyright (c) 2009 Matteo Frigo
26181d8c7986Smrg#
26191d8c7986Smrg#   This program is free software: you can redistribute it and/or modify it
26201d8c7986Smrg#   under the terms of the GNU General Public License as published by the
26211d8c7986Smrg#   Free Software Foundation, either version 3 of the License, or (at your
26221d8c7986Smrg#   option) any later version.
26231d8c7986Smrg#
26241d8c7986Smrg#   This program is distributed in the hope that it will be useful, but
26251d8c7986Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
26261d8c7986Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
26271d8c7986Smrg#   Public License for more details.
26281d8c7986Smrg#
26291d8c7986Smrg#   You should have received a copy of the GNU General Public License along
26301d8c7986Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
26311d8c7986Smrg#
26321d8c7986Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
26331d8c7986Smrg#   gives unlimited permission to copy, distribute and modify the configure
26341d8c7986Smrg#   scripts that are the output of Autoconf when processing the Macro. You
26351d8c7986Smrg#   need not follow the terms of the GNU General Public License when using
26361d8c7986Smrg#   or distributing such scripts, even though portions of the text of the
26371d8c7986Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
26381d8c7986Smrg#   all other use of the material that constitutes the Autoconf Macro.
26391d8c7986Smrg#
26401d8c7986Smrg#   This special exception to the GPL applies to versions of the Autoconf
26411d8c7986Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
26421d8c7986Smrg#   modified version of the Autoconf Macro, you may extend this special
26431d8c7986Smrg#   exception to the GPL to apply to your modified version as well.#
26441d8c7986SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
26451d8c7986Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
26461d8c7986Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
26471d8c7986SmrgAS_LITERAL_IF([$1],
26481d8c7986Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
26491d8c7986Smrg      ax_save_FLAGS=$LDFLAGS
26501d8c7986Smrg      LDFLAGS="$1"
26511d8c7986Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
26521d8c7986Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
26531d8c7986Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
26541d8c7986Smrg      LDFLAGS=$ax_save_FLAGS])],
26551d8c7986Smrg  [ax_save_FLAGS=$LDFLAGS
26561d8c7986Smrg   LDFLAGS="$1"
26571d8c7986Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
26581d8c7986Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
26591d8c7986Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
26601d8c7986Smrg   LDFLAGS=$ax_save_FLAGS])
26611d8c7986Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
26621d8c7986SmrgAC_MSG_RESULT($xorg_check_linker_flags)
26631d8c7986Smrgif test "x$xorg_check_linker_flags" = xyes; then
26641d8c7986Smrg	m4_default([$2], :)
266583e5f723Smrgelse
26661d8c7986Smrg	m4_default([$3], :)
266783e5f723Smrgfi
26681d8c7986Smrg]) # XORG_CHECK_LINKER_FLAGS
266983e5f723Smrg
26701d8c7986Smrg# XORG_MEMORY_CHECK_FLAGS
26711d8c7986Smrg# -----------------------
26721d8c7986Smrg# Minimum version: 1.16.0
2673690143ccSmrg#
26741d8c7986Smrg# This macro attempts to find appropriate memory checking functionality
26751d8c7986Smrg# for various platforms which unit testing code may use to catch various
26761d8c7986Smrg# forms of memory allocation and access errors in testing.
26771d8c7986Smrg#
26781d8c7986Smrg# Interface to module:
26791d8c7986Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
26801d8c7986Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
26811d8c7986Smrg#
26821d8c7986Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
26831d8c7986Smrg#
26841d8c7986SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
268583e5f723Smrg
26861d8c7986SmrgAC_REQUIRE([AC_CANONICAL_HOST])
26871d8c7986SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
26881d8c7986Smrg           [Environment variables to enable memory checking in tests])
2689690143ccSmrg
26901d8c7986Smrg# Check for different types of support on different platforms
26911d8c7986Smrgcase $host_os in
26921d8c7986Smrg    solaris*)
26931d8c7986Smrg        AC_CHECK_LIB([umem], [umem_alloc],
26941d8c7986Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
26951d8c7986Smrg        ;;
26961d8c7986Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
26971d8c7986Smrg        # both directly and inverted, so should not be 0 or 255.
26981d8c7986Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
26991d8c7986Smrg        ;;
27001d8c7986Smrg    darwin*)
27011d8c7986Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
27021d8c7986Smrg        ;;
27031d8c7986Smrg    *bsd*)
27041d8c7986Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
27051d8c7986Smrg        ;;
27061d8c7986Smrgesac
2707690143ccSmrg
27081d8c7986Smrg# User supplied flags override default flags
27091d8c7986Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
27101d8c7986Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
27111d8c7986Smrgfi
271283e5f723Smrg
27131d8c7986SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
27141d8c7986Smrg]) # XORG_WITH_LINT
2715690143ccSmrg
27161d8c7986Smrg# XORG_CHECK_MALLOC_ZERO
27171d8c7986Smrg# ----------------------
27181d8c7986Smrg# Minimum version: 1.0.0
271983e5f723Smrg#
27201d8c7986Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
27211d8c7986Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
27221d8c7986Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
27231d8c7986SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
27241d8c7986SmrgAC_ARG_ENABLE(malloc0returnsnull,
27251d8c7986Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
27261d8c7986Smrg		       [malloc(0) returns NULL (default: auto)]),
27271d8c7986Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
27281d8c7986Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
272983e5f723Smrg
27301d8c7986SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
27311d8c7986Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2732c82dfdfbSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
2733c82dfdfbSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
27341d8c7986Smrg#include <stdlib.h>
27351d8c7986Smrg],[
27361d8c7986Smrg    char *m0, *r0, *c0, *p;
27371d8c7986Smrg    m0 = malloc(0);
27381d8c7986Smrg    p = malloc(10);
27391d8c7986Smrg    r0 = realloc(p,0);
27401d8c7986Smrg    c0 = calloc(0,10);
27411d8c7986Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
27421d8c7986Smrg])],
2743c82dfdfbSmrg		[xorg_cv_malloc0_returns_null=yes],
2744c82dfdfbSmrg		[xorg_cv_malloc0_returns_null=no])])
2745c82dfdfbSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
27461d8c7986Smrgfi
27471d8c7986SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2748690143ccSmrg
27491d8c7986Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
27501d8c7986Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
27511d8c7986Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
27521d8c7986Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
27531d8c7986Smrgelse
27541d8c7986Smrg	MALLOC_ZERO_CFLAGS=""
27551d8c7986Smrg	XMALLOC_ZERO_CFLAGS=""
27561d8c7986Smrg	XTMALLOC_ZERO_CFLAGS=""
275783e5f723Smrgfi
275883e5f723Smrg
27591d8c7986SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
27601d8c7986SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
27611d8c7986SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
27621d8c7986Smrg]) # XORG_CHECK_MALLOC_ZERO
2763690143ccSmrg
27641d8c7986Smrg# XORG_WITH_LINT()
27651d8c7986Smrg# ----------------
27661d8c7986Smrg# Minimum version: 1.1.0
27671d8c7986Smrg#
27681d8c7986Smrg# This macro enables the use of a tool that flags some suspicious and
27691d8c7986Smrg# non-portable constructs (likely to be bugs) in C language source code.
27701d8c7986Smrg# It will attempt to locate the tool and use appropriate options.
27711d8c7986Smrg# There are various lint type tools on different platforms.
27721d8c7986Smrg#
27731d8c7986Smrg# Interface to module:
27741d8c7986Smrg# LINT:		returns the path to the tool found on the platform
27751d8c7986Smrg#		or the value set to LINT on the configure cmd line
27761d8c7986Smrg#		also an Automake conditional
27771d8c7986Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
27781d8c7986Smrg#
27791d8c7986Smrg# --with-lint:	'yes' user instructs the module to use lint
27801d8c7986Smrg#		'no' user instructs the module not to use lint (default)
27811d8c7986Smrg#
27821d8c7986Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
27831d8c7986Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
278483e5f723Smrg#
27851d8c7986SmrgAC_DEFUN([XORG_WITH_LINT],[
2786690143ccSmrg
27871d8c7986SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
27881d8c7986SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
27891d8c7986SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
27901d8c7986Smrg		[Use a lint-style source code checker (default: disabled)])],
27911d8c7986Smrg		[use_lint=$withval], [use_lint=no])
2792690143ccSmrg
27931d8c7986Smrg# Obtain platform specific info like program name and options
27941d8c7986Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
27951d8c7986Smrgcase $host_os in
27961d8c7986Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
27971d8c7986Smrg	lint_name=splint
27981d8c7986Smrg	lint_options="-badflag"
27991d8c7986Smrg	;;
28001d8c7986Smrg  *freebsd* | *netbsd*)
28011d8c7986Smrg	lint_name=lint
28021d8c7986Smrg	lint_options="-u -b"
28031d8c7986Smrg	;;
28041d8c7986Smrg  *solaris*)
28051d8c7986Smrg	lint_name=lint
28061d8c7986Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
28071d8c7986Smrg	;;
28081d8c7986Smrgesac
2809690143ccSmrg
28101d8c7986Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
28111d8c7986Smrgif test "x$use_lint" = x"yes" ; then
28121d8c7986Smrg   AC_PATH_PROG([LINT], [$lint_name])
28131d8c7986Smrg   if test "x$LINT" = "x"; then
28141d8c7986Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
28151d8c7986Smrg   fi
28161d8c7986Smrgelif test "x$use_lint" = x"no" ; then
28171d8c7986Smrg   if test "x$LINT" != "x"; then
28181d8c7986Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
28191d8c7986Smrg   fi
282083e5f723Smrgelse
28211d8c7986Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
282283e5f723Smrgfi
282383e5f723Smrg
28241d8c7986Smrg# User supplied flags override default flags
28251d8c7986Smrgif test "x$LINT_FLAGS" != "x"; then
28261d8c7986Smrg   lint_options=$LINT_FLAGS
28271d8c7986Smrgfi
282883e5f723Smrg
28291d8c7986SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
28301d8c7986SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2831690143ccSmrg
28321d8c7986Smrg]) # XORG_WITH_LINT
283383e5f723Smrg
28341d8c7986Smrg# XORG_LINT_LIBRARY(LIBNAME)
28351d8c7986Smrg# --------------------------
28361d8c7986Smrg# Minimum version: 1.1.0
283783e5f723Smrg#
28381d8c7986Smrg# Sets up flags for building lint libraries for checking programs that call
28391d8c7986Smrg# functions in the library.
28401d8c7986Smrg#
28411d8c7986Smrg# Interface to module:
28421d8c7986Smrg# LINTLIB		- Automake variable with the name of lint library file to make
28431d8c7986Smrg# MAKE_LINT_LIB		- Automake conditional
28441d8c7986Smrg#
28451d8c7986Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
28461d8c7986Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2847f46a6179Smrg
28481d8c7986SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
28491d8c7986SmrgAC_REQUIRE([XORG_WITH_LINT])
28501d8c7986SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
28511d8c7986Smrg	[Create lint library (default: disabled)])],
28521d8c7986Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2853f46a6179Smrg
28541d8c7986Smrgif test "x$make_lint_lib" = x"yes" ; then
28551d8c7986Smrg   LINTLIB=llib-l$1.ln
28561d8c7986Smrg   if test "x$LINT" = "x"; then
28571d8c7986Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
28581d8c7986Smrg   fi
28591d8c7986Smrgelif test "x$make_lint_lib" != x"no" ; then
28601d8c7986Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
28611d8c7986Smrgfi
28625fac8b10Smrg
28631d8c7986SmrgAC_SUBST(LINTLIB)
28641d8c7986SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2865690143ccSmrg
28661d8c7986Smrg]) # XORG_LINT_LIBRARY
2867690143ccSmrg
28681d8c7986Smrg# XORG_COMPILER_BRAND
28691d8c7986Smrg# -------------------
28701d8c7986Smrg# Minimum version: 1.14.0
28715fac8b10Smrg#
28721d8c7986Smrg# Checks for various brands of compilers and sets flags as appropriate:
28731d8c7986Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
28741d8c7986Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
28751d8c7986Smrg#   clang compiler - sets CLANGCC to "yes"
28761d8c7986Smrg#   Intel compiler - sets INTELCC to "yes"
28771d8c7986Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
28781d8c7986Smrg#
28791d8c7986SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
28801d8c7986SmrgAC_LANG_CASE(
28811d8c7986Smrg	[C], [
28821d8c7986Smrg		AC_REQUIRE([AC_PROG_CC_C99])
28831d8c7986Smrg	],
28841d8c7986Smrg	[C++], [
28851d8c7986Smrg		AC_REQUIRE([AC_PROG_CXX])
28861d8c7986Smrg	]
28871d8c7986Smrg)
28881d8c7986SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
28891d8c7986SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
28901d8c7986SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
28911d8c7986Smrg]) # XORG_COMPILER_BRAND
289283e5f723Smrg
28931d8c7986Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2894690143ccSmrg# ---------------
28951d8c7986Smrg# Minimum version: 1.16.0
28961d8c7986Smrg#
28971d8c7986Smrg# Test if the compiler works when passed the given flag as a command line argument.
28981d8c7986Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
28991d8c7986Smrg# next flag in the list until there are no more options.
29001d8c7986Smrg#
29011d8c7986Smrg# Note that this does not guarantee that the compiler supports the flag as some
29021d8c7986Smrg# compilers will simply ignore arguments that they do not understand, but we do
29031d8c7986Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
29041d8c7986Smrg# -Werror=unused-command-line-argument
29051d8c7986Smrg#
29061d8c7986SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
29071d8c7986Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29081d8c7986Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29091d8c7986Smrg
29101d8c7986SmrgAC_LANG_COMPILER_REQUIRE
29111d8c7986Smrg
29121d8c7986SmrgAC_LANG_CASE(
29131d8c7986Smrg	[C], [
29141d8c7986Smrg		AC_REQUIRE([AC_PROG_CC_C99])
29151d8c7986Smrg		define([PREFIX], [C])
29161d8c7986Smrg		define([CACHE_PREFIX], [cc])
29171d8c7986Smrg		define([COMPILER], [$CC])
29181d8c7986Smrg	],
29191d8c7986Smrg	[C++], [
29201d8c7986Smrg		define([PREFIX], [CXX])
29211d8c7986Smrg		define([CACHE_PREFIX], [cxx])
29221d8c7986Smrg		define([COMPILER], [$CXX])
29231d8c7986Smrg	]
29241d8c7986Smrg)
292583e5f723Smrg
29261d8c7986Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
29271d8c7986Smrg
29281d8c7986Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
29291d8c7986Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
29301d8c7986Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
29311d8c7986Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
29321d8c7986Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
29331d8c7986Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
29341d8c7986Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
29351d8c7986Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
29361d8c7986Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2937f46a6179Smrgfi
2938f46a6179Smrg
29391d8c7986Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
29401d8c7986Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
29411d8c7986Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
29421d8c7986Smrg	fi
29431d8c7986Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
29441d8c7986Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
29451d8c7986Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
29461d8c7986Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
29471d8c7986Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
29481d8c7986Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
29491d8c7986Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
29501d8c7986Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
29511d8c7986Smrgfi
295234345a63Smrg
29531d8c7986Smrgfound="no"
29541d8c7986Smrgm4_foreach([flag], m4_cdr($@), [
29551d8c7986Smrg	if test $found = "no" ; then
2956c82dfdfbSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
29571d8c7986Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
29581d8c7986Smrg		fi
29591d8c7986Smrg
2960c82dfdfbSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
29611d8c7986Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
29621d8c7986Smrg		fi
29631d8c7986Smrg
29641d8c7986Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
29651d8c7986Smrg
29661d8c7986Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2967c82dfdfbSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
29681d8c7986Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
29691d8c7986Smrg		AC_CACHE_VAL($cacheid,
29701d8c7986Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
29711d8c7986Smrg					     [eval $cacheid=yes],
29721d8c7986Smrg					     [eval $cacheid=no])])
29731d8c7986Smrg
29741d8c7986Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
29751d8c7986Smrg
29761d8c7986Smrg		eval supported=\$$cacheid
29771d8c7986Smrg		AC_MSG_RESULT([$supported])
29781d8c7986Smrg		if test "$supported" = "yes" ; then
29791d8c7986Smrg			$1="$$1 ]flag["
29801d8c7986Smrg			found="yes"
29811d8c7986Smrg		fi
29821d8c7986Smrg	fi
2983690143ccSmrg])
29841d8c7986Smrg]) # XORG_TESTSET_CFLAG
2985690143ccSmrg
29861d8c7986Smrg# XORG_COMPILER_FLAGS
29871d8c7986Smrg# ---------------
29881d8c7986Smrg# Minimum version: 1.16.0
298983e5f723Smrg#
29901d8c7986Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
29911d8c7986Smrg# arguments supported by the selected compiler which do NOT alter the generated
29921d8c7986Smrg# code.  These arguments will cause the compiler to print various warnings
29931d8c7986Smrg# during compilation AND turn a conservative set of warnings into errors.
29941d8c7986Smrg#
29951d8c7986Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
29961d8c7986Smrg# future versions of util-macros as options are added to new compilers.
29971d8c7986Smrg#
29981d8c7986SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
29991d8c7986SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3000690143ccSmrg
30011d8c7986SmrgAC_ARG_ENABLE(selective-werror,
30021d8c7986Smrg              AS_HELP_STRING([--disable-selective-werror],
30031d8c7986Smrg                             [Turn off selective compiler errors. (default: enabled)]),
30041d8c7986Smrg              [SELECTIVE_WERROR=$enableval],
30051d8c7986Smrg              [SELECTIVE_WERROR=yes])
30061d8c7986Smrg
30071d8c7986SmrgAC_LANG_CASE(
30081d8c7986Smrg        [C], [
30091d8c7986Smrg                define([PREFIX], [C])
30101d8c7986Smrg        ],
30111d8c7986Smrg        [C++], [
30121d8c7986Smrg                define([PREFIX], [CXX])
30131d8c7986Smrg        ]
30141d8c7986Smrg)
30151d8c7986Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
30161d8c7986Smrgif test "x$SUNCC" = "xyes"; then
30171d8c7986Smrg    [BASE_]PREFIX[FLAGS]="-v"
30181d8c7986Smrgelse
30191d8c7986Smrg    [BASE_]PREFIX[FLAGS]=""
3020690143ccSmrgfi
3021f46a6179Smrg
30221d8c7986Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
30231d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
30241d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
30251d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
30261d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
30271d8c7986Smrg
30281d8c7986SmrgAC_LANG_CASE(
30291d8c7986Smrg	[C], [
30301d8c7986Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
30311d8c7986Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
30321d8c7986Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
30331d8c7986Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
3034c82dfdfbSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
30351d8c7986Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
30361d8c7986Smrg	]
30371d8c7986Smrg)
30381d8c7986Smrg
30391d8c7986Smrg# This chunk adds additional warnings that could catch undesired effects.
30401d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
30411d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
30421d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
30431d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
30441d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
30451d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
3046c82dfdfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
30471d8c7986Smrg
30481d8c7986Smrg# These are currently disabled because they are noisy.  They will be enabled
30491d8c7986Smrg# in the future once the codebase is sufficiently modernized to silence
30501d8c7986Smrg# them.  For now, I don't want them to drown out the other warnings.
30511d8c7986Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
30521d8c7986Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3053c82dfdfbSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
30541d8c7986Smrg
30551d8c7986Smrg# Turn some warnings into errors, so we don't accidently get successful builds
30561d8c7986Smrg# when there are problems that should be fixed.
30571d8c7986Smrg
30581d8c7986Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
30591d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
30601d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
30611d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
30621d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
30631d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
30641d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
30651d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
30661d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
30671d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
30681d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
30691d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
30701d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
30711d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
30721d8c7986Smrgelse
30731d8c7986SmrgAC_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])
30741d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
30751d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
30761d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
30771d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
30781d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
30791d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
30801d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
30811d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
30821d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
30831d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
30841d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
30851d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
30861d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
30871d8c7986Smrgfi
30881d8c7986Smrg
30891d8c7986SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
30901d8c7986Smrg]) # XORG_COMPILER_FLAGS
30911d8c7986Smrg
30921d8c7986Smrg# XORG_CWARNFLAGS
30931d8c7986Smrg# ---------------
30941d8c7986Smrg# Minimum version: 1.2.0
30951d8c7986Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3096690143ccSmrg#
30971d8c7986Smrg# Defines CWARNFLAGS to enable C compiler warnings.
30981d8c7986Smrg#
30991d8c7986Smrg# This function is deprecated because it defines -fno-strict-aliasing
31001d8c7986Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
31011d8c7986Smrg# is needed, then it should be added explicitly in the module when
31021d8c7986Smrg# it is updated to use BASE_CFLAGS.
31031d8c7986Smrg#
31041d8c7986SmrgAC_DEFUN([XORG_CWARNFLAGS], [
31051d8c7986SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
31061d8c7986SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
31071d8c7986SmrgAC_LANG_CASE(
31081d8c7986Smrg	[C], [
31091d8c7986Smrg		CWARNFLAGS="$BASE_CFLAGS"
31101d8c7986Smrg		if  test "x$GCC" = xyes ; then
31111d8c7986Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
31121d8c7986Smrg		fi
31131d8c7986Smrg		AC_SUBST(CWARNFLAGS)
31141d8c7986Smrg	]
31151d8c7986Smrg)
31161d8c7986Smrg]) # XORG_CWARNFLAGS
311783e5f723Smrg
31181d8c7986Smrg# XORG_STRICT_OPTION
31191d8c7986Smrg# -----------------------
31201d8c7986Smrg# Minimum version: 1.3.0
31211d8c7986Smrg#
31221d8c7986Smrg# Add configure option to enable strict compilation flags, such as treating
31231d8c7986Smrg# warnings as fatal errors.
31241d8c7986Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
31251d8c7986Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
31261d8c7986Smrg#
31271d8c7986Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
31281d8c7986Smrg# when strict compilation is unconditionally desired.
31291d8c7986SmrgAC_DEFUN([XORG_STRICT_OPTION], [
31301d8c7986SmrgAC_REQUIRE([XORG_CWARNFLAGS])
31311d8c7986SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
313283e5f723Smrg
31331d8c7986SmrgAC_ARG_ENABLE(strict-compilation,
31341d8c7986Smrg			  AS_HELP_STRING([--enable-strict-compilation],
31351d8c7986Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
31361d8c7986Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
313734345a63Smrg
31381d8c7986SmrgAC_LANG_CASE(
31391d8c7986Smrg        [C], [
31401d8c7986Smrg                define([PREFIX], [C])
31411d8c7986Smrg        ],
31421d8c7986Smrg        [C++], [
31431d8c7986Smrg                define([PREFIX], [CXX])
31441d8c7986Smrg        ]
31451d8c7986Smrg)
3146f46a6179Smrg
31471d8c7986Smrg[STRICT_]PREFIX[FLAGS]=""
31481d8c7986SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
31491d8c7986SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3150f46a6179Smrg
31511d8c7986Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
31521d8c7986Smrg# activate it with -Werror, so we add it here explicitly.
31531d8c7986SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
31545fac8b10Smrg
31551d8c7986Smrgif test "x$STRICT_COMPILE" = "xyes"; then
31561d8c7986Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
31571d8c7986Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
31581d8c7986Smrgfi
31591d8c7986SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
31601d8c7986SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
31611d8c7986SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
31621d8c7986Smrg]) # XORG_STRICT_OPTION
3163f46a6179Smrg
31641d8c7986Smrg# XORG_DEFAULT_OPTIONS
3165f46a6179Smrg# --------------------
31661d8c7986Smrg# Minimum version: 1.3.0
3167f46a6179Smrg#
31681d8c7986Smrg# Defines default options for X.Org modules.
3169f46a6179Smrg#
31701d8c7986SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
31711d8c7986SmrgAC_REQUIRE([AC_PROG_INSTALL])
31721d8c7986SmrgXORG_COMPILER_FLAGS
31731d8c7986SmrgXORG_CWARNFLAGS
31741d8c7986SmrgXORG_STRICT_OPTION
31751d8c7986SmrgXORG_RELEASE_VERSION
31761d8c7986SmrgXORG_CHANGELOG
31771d8c7986SmrgXORG_INSTALL
31781d8c7986SmrgXORG_MANPAGE_SECTIONS
31791d8c7986Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
31801d8c7986Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
31811d8c7986Smrg]) # XORG_DEFAULT_OPTIONS
318283e5f723Smrg
31831d8c7986Smrg# XORG_INSTALL()
31841d8c7986Smrg# ----------------
31851d8c7986Smrg# Minimum version: 1.4.0
31861d8c7986Smrg#
31871d8c7986Smrg# Defines the variable INSTALL_CMD as the command to copy
31881d8c7986Smrg# INSTALL from $prefix/share/util-macros.
31891d8c7986Smrg#
31901d8c7986SmrgAC_DEFUN([XORG_INSTALL], [
31911d8c7986SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
31921d8c7986Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
31931d8c7986SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
31941d8c7986Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
31951d8c7986Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
31961d8c7986Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
31971d8c7986SmrgAC_SUBST([INSTALL_CMD])
31981d8c7986Smrg]) # XORG_INSTALL
31991d8c7986Smrgdnl Copyright 2005 Red Hat, Inc
32001d8c7986Smrgdnl
32011d8c7986Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
32021d8c7986Smrgdnl documentation for any purpose is hereby granted without fee, provided that
32031d8c7986Smrgdnl the above copyright notice appear in all copies and that both that
32041d8c7986Smrgdnl copyright notice and this permission notice appear in supporting
32051d8c7986Smrgdnl documentation.
32061d8c7986Smrgdnl
32071d8c7986Smrgdnl The above copyright notice and this permission notice shall be included
32081d8c7986Smrgdnl in all copies or substantial portions of the Software.
32091d8c7986Smrgdnl
32101d8c7986Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
32111d8c7986Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32121d8c7986Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
32131d8c7986Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
32141d8c7986Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
32151d8c7986Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
32161d8c7986Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
32171d8c7986Smrgdnl
32181d8c7986Smrgdnl Except as contained in this notice, the name of the copyright holders shall
32191d8c7986Smrgdnl not be used in advertising or otherwise to promote the sale, use or
32201d8c7986Smrgdnl other dealings in this Software without prior written authorization
32211d8c7986Smrgdnl from the copyright holders.
32221d8c7986Smrgdnl
3223f46a6179Smrg
32241d8c7986Smrg# XORG_RELEASE_VERSION
32251d8c7986Smrg# --------------------
32261d8c7986Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3227c82dfdfbSmrg
32281d8c7986SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
32291d8c7986Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
32301d8c7986Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
32311d8c7986Smrg		[Major version of this package])
32321d8c7986Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
32331d8c7986Smrg	if test "x$PVM" = "x"; then
32341d8c7986Smrg		PVM="0"
32351d8c7986Smrg	fi
32361d8c7986Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
32371d8c7986Smrg		[$PVM],
32381d8c7986Smrg		[Minor version of this package])
32391d8c7986Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
32401d8c7986Smrg	if test "x$PVP" = "x"; then
32411d8c7986Smrg		PVP="0"
32421d8c7986Smrg	fi
32431d8c7986Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
32441d8c7986Smrg		[$PVP],
32451d8c7986Smrg		[Patch version of this package])
32461d8c7986Smrg])
3247f46a6179Smrg
32481d8c7986Smrg# XORG_CHANGELOG()
32491d8c7986Smrg# ----------------
32501d8c7986Smrg# Minimum version: 1.2.0
32511d8c7986Smrg#
32521d8c7986Smrg# Defines the variable CHANGELOG_CMD as the command to generate
32531d8c7986Smrg# ChangeLog from git.
32541d8c7986Smrg#
32551d8c7986Smrg#
32561d8c7986SmrgAC_DEFUN([XORG_CHANGELOG], [
32571d8c7986SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
32581d8c7986Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
32591d8c7986Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
32601d8c7986Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
32611d8c7986SmrgAC_SUBST([CHANGELOG_CMD])
32621d8c7986Smrg]) # XORG_CHANGELOG
3263f46a6179Smrg
3264