aclocal.m4 revision c82dfdfb
1c82dfdfbSmrg# generated automatically by aclocal 1.14.1 -*- Autoconf -*-
2c82dfdfbSmrg
3c82dfdfbSmrg# Copyright (C) 1996-2013 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
238c82dfdfbSmrg# Copyright (C) 2002-2013 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],
250c82dfdfbSmrg[am__api_version='1.14'
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.
253c82dfdfbSmrgm4_if([$1], [1.14.1], [],
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],
269c82dfdfbSmrg[AM_AUTOMAKE_VERSION([1.14.1])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
276c82dfdfbSmrg# Copyright (C) 2001-2013 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],
3211d8c7986Smrg[dnl Rely on autoconf to set up CDPATH properly.
3221d8c7986SmrgAC_PREREQ([2.50])dnl
3231d8c7986Smrg# expand $ac_aux_dir to an absolute path
3241d8c7986Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
3251d8c7986Smrg])
32607d2e718Smrg
3271d8c7986Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
32807d2e718Smrg
329c82dfdfbSmrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
3301d8c7986Smrg#
3311d8c7986Smrg# This file is free software; the Free Software Foundation
3321d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
3331d8c7986Smrg# with or without modifications, as long as this notice is preserved.
33407d2e718Smrg
3351d8c7986Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
3361d8c7986Smrg# -------------------------------------
3371d8c7986Smrg# Define a conditional.
3381d8c7986SmrgAC_DEFUN([AM_CONDITIONAL],
339c82dfdfbSmrg[AC_PREREQ([2.52])dnl
340c82dfdfbSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
341c82dfdfbSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
3421d8c7986SmrgAC_SUBST([$1_TRUE])dnl
3431d8c7986SmrgAC_SUBST([$1_FALSE])dnl
3441d8c7986Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
3451d8c7986Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
3461d8c7986Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
3471d8c7986Smrgif $2; then
3481d8c7986Smrg  $1_TRUE=
3491d8c7986Smrg  $1_FALSE='#'
3501d8c7986Smrgelse
3511d8c7986Smrg  $1_TRUE='#'
3521d8c7986Smrg  $1_FALSE=
3531d8c7986Smrgfi
3541d8c7986SmrgAC_CONFIG_COMMANDS_PRE(
3551d8c7986Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
3561d8c7986Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
3571d8c7986SmrgUsually this means the macro was only invoked conditionally.]])
3581d8c7986Smrgfi])])
35907d2e718Smrg
360c82dfdfbSmrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
3611d8c7986Smrg#
3621d8c7986Smrg# This file is free software; the Free Software Foundation
3631d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
3641d8c7986Smrg# with or without modifications, as long as this notice is preserved.
36507d2e718Smrg
36607d2e718Smrg
367c82dfdfbSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
3681d8c7986Smrg# written in clear, in which case automake, when reading aclocal.m4,
3691d8c7986Smrg# will think it sees a *use*, and therefore will trigger all it's
3701d8c7986Smrg# C support machinery.  Also note that it means that autoscan, seeing
3711d8c7986Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
37207d2e718Smrg
37307d2e718Smrg
3741d8c7986Smrg# _AM_DEPENDENCIES(NAME)
3751d8c7986Smrg# ----------------------
3761d8c7986Smrg# See how the compiler implements dependency checking.
377c82dfdfbSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
3781d8c7986Smrg# We try a few techniques and use that to set a single cache variable.
3791d8c7986Smrg#
3801d8c7986Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
3811d8c7986Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
3821d8c7986Smrg# dependency, and given that the user is not expected to run this macro,
3831d8c7986Smrg# just rely on AC_PROG_CC.
3841d8c7986SmrgAC_DEFUN([_AM_DEPENDENCIES],
3851d8c7986Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
3861d8c7986SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
3871d8c7986SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
3881d8c7986SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
38907d2e718Smrg
390c82dfdfbSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
391c82dfdfbSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
392c82dfdfbSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
393c82dfdfbSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
394c82dfdfbSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
395c82dfdfbSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
396c82dfdfbSmrg                    [depcc="$$1"   am_compiler_list=])
3975fac8b10Smrg
3981d8c7986SmrgAC_CACHE_CHECK([dependency style of $depcc],
3991d8c7986Smrg               [am_cv_$1_dependencies_compiler_type],
4001d8c7986Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
4011d8c7986Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
4021d8c7986Smrg  # making bogus files that we don't know about and never remove.  For
4031d8c7986Smrg  # instance it was reported that on HP-UX the gcc test will end up
404c82dfdfbSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
405c82dfdfbSmrg  # in D".
406c82dfdfbSmrg  rm -rf conftest.dir
4071d8c7986Smrg  mkdir conftest.dir
4081d8c7986Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
4091d8c7986Smrg  # using a relative directory.
4101d8c7986Smrg  cp "$am_depcomp" conftest.dir
4111d8c7986Smrg  cd conftest.dir
4121d8c7986Smrg  # We will build objects and dependencies in a subdirectory because
4131d8c7986Smrg  # it helps to detect inapplicable dependency modes.  For instance
4141d8c7986Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
4151d8c7986Smrg  # side effect of compilation, but ICC will put the dependencies in
4161d8c7986Smrg  # the current directory while Tru64 will put them in the object
4171d8c7986Smrg  # directory.
4181d8c7986Smrg  mkdir sub
419f46a6179Smrg
4201d8c7986Smrg  am_cv_$1_dependencies_compiler_type=none
4211d8c7986Smrg  if test "$am_compiler_list" = ""; then
4221d8c7986Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
4231d8c7986Smrg  fi
4241d8c7986Smrg  am__universal=false
4251d8c7986Smrg  m4_case([$1], [CC],
4261d8c7986Smrg    [case " $depcc " in #(
4271d8c7986Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
4281d8c7986Smrg     esac],
4291d8c7986Smrg    [CXX],
4301d8c7986Smrg    [case " $depcc " in #(
4311d8c7986Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
4321d8c7986Smrg     esac])
433f46a6179Smrg
4341d8c7986Smrg  for depmode in $am_compiler_list; do
4351d8c7986Smrg    # Setup a source with many dependencies, because some compilers
4361d8c7986Smrg    # like to wrap large dependency lists on column 80 (with \), and
4371d8c7986Smrg    # we should not choose a depcomp mode which is confused by this.
4381d8c7986Smrg    #
4391d8c7986Smrg    # We need to recreate these files for each test, as the compiler may
4401d8c7986Smrg    # overwrite some of them when testing with obscure command lines.
4411d8c7986Smrg    # This happens at least with the AIX C compiler.
4421d8c7986Smrg    : > sub/conftest.c
4431d8c7986Smrg    for i in 1 2 3 4 5 6; do
4441d8c7986Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
445c82dfdfbSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
446c82dfdfbSmrg      # Solaris 10 /bin/sh.
447c82dfdfbSmrg      echo '/* dummy */' > sub/conftst$i.h
4481d8c7986Smrg    done
4491d8c7986Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
450f46a6179Smrg
451c82dfdfbSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
4521d8c7986Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
453c82dfdfbSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
454c82dfdfbSmrg    # versions had trouble with output in subdirs.
4551d8c7986Smrg    am__obj=sub/conftest.${OBJEXT-o}
4561d8c7986Smrg    am__minus_obj="-o $am__obj"
4571d8c7986Smrg    case $depmode in
4581d8c7986Smrg    gcc)
4591d8c7986Smrg      # This depmode causes a compiler race in universal mode.
4601d8c7986Smrg      test "$am__universal" = false || continue
4611d8c7986Smrg      ;;
4621d8c7986Smrg    nosideeffect)
463c82dfdfbSmrg      # After this tag, mechanisms are not by side-effect, so they'll
464c82dfdfbSmrg      # only be used when explicitly requested.
4651d8c7986Smrg      if test "x$enable_dependency_tracking" = xyes; then
4661d8c7986Smrg	continue
4671d8c7986Smrg      else
4681d8c7986Smrg	break
4691d8c7986Smrg      fi
4701d8c7986Smrg      ;;
471c82dfdfbSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
472c82dfdfbSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
4731d8c7986Smrg      # not run yet.  These depmodes are late enough in the game, and
4741d8c7986Smrg      # so weak that their functioning should not be impacted.
4751d8c7986Smrg      am__obj=conftest.${OBJEXT-o}
4761d8c7986Smrg      am__minus_obj=
4771d8c7986Smrg      ;;
4781d8c7986Smrg    none) break ;;
4791d8c7986Smrg    esac
4801d8c7986Smrg    if depmode=$depmode \
4811d8c7986Smrg       source=sub/conftest.c object=$am__obj \
4821d8c7986Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
4831d8c7986Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
4841d8c7986Smrg         >/dev/null 2>conftest.err &&
4851d8c7986Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
4861d8c7986Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
4871d8c7986Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
4881d8c7986Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
4891d8c7986Smrg      # icc doesn't choke on unknown options, it will just issue warnings
4901d8c7986Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
4911d8c7986Smrg      # that says an option was ignored or not supported.
4921d8c7986Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
4931d8c7986Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
4941d8c7986Smrg      # The diagnosis changed in icc 8.0:
4951d8c7986Smrg      #   icc: Command line remark: option '-MP' not supported
4961d8c7986Smrg      if (grep 'ignoring option' conftest.err ||
4971d8c7986Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
4981d8c7986Smrg        am_cv_$1_dependencies_compiler_type=$depmode
4991d8c7986Smrg        break
5001d8c7986Smrg      fi
5011d8c7986Smrg    fi
5021d8c7986Smrg  done
5031d8c7986Smrg
5041d8c7986Smrg  cd ..
5051d8c7986Smrg  rm -rf conftest.dir
5065fac8b10Smrgelse
5071d8c7986Smrg  am_cv_$1_dependencies_compiler_type=none
508f46a6179Smrgfi
5091d8c7986Smrg])
5101d8c7986SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
5111d8c7986SmrgAM_CONDITIONAL([am__fastdep$1], [
5121d8c7986Smrg  test "x$enable_dependency_tracking" != xno \
5131d8c7986Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
5141d8c7986Smrg])
515f46a6179Smrg
516f46a6179Smrg
5171d8c7986Smrg# AM_SET_DEPDIR
5181d8c7986Smrg# -------------
5191d8c7986Smrg# Choose a directory name for dependency files.
520c82dfdfbSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
5211d8c7986SmrgAC_DEFUN([AM_SET_DEPDIR],
5221d8c7986Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
5231d8c7986SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
5241d8c7986Smrg])
525f46a6179Smrg
526f46a6179Smrg
5271d8c7986Smrg# AM_DEP_TRACK
5281d8c7986Smrg# ------------
5291d8c7986SmrgAC_DEFUN([AM_DEP_TRACK],
530c82dfdfbSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
531c82dfdfbSmrgAS_HELP_STRING(
532c82dfdfbSmrg  [--enable-dependency-tracking],
533c82dfdfbSmrg  [do not reject slow dependency extractors])
534c82dfdfbSmrgAS_HELP_STRING(
535c82dfdfbSmrg  [--disable-dependency-tracking],
536c82dfdfbSmrg  [speeds up one-time build])])
5371d8c7986Smrgif test "x$enable_dependency_tracking" != xno; then
5381d8c7986Smrg  am_depcomp="$ac_aux_dir/depcomp"
5391d8c7986Smrg  AMDEPBACKSLASH='\'
540c82dfdfbSmrg  am__nodep='_no'
541690143ccSmrgfi
5421d8c7986SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
5431d8c7986SmrgAC_SUBST([AMDEPBACKSLASH])dnl
5441d8c7986Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
545c82dfdfbSmrgAC_SUBST([am__nodep])dnl
546c82dfdfbSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
5471d8c7986Smrg])
548f46a6179Smrg
5491d8c7986Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
550f46a6179Smrg
551c82dfdfbSmrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
5521d8c7986Smrg#
5531d8c7986Smrg# This file is free software; the Free Software Foundation
5541d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
5551d8c7986Smrg# with or without modifications, as long as this notice is preserved.
556f46a6179Smrg
557f46a6179Smrg
5581d8c7986Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
5591d8c7986Smrg# ------------------------------
5601d8c7986SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
5611d8c7986Smrg[{
562c82dfdfbSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
5631d8c7986Smrg  # are listed without --file.  Let's play safe and only enable the eval
5641d8c7986Smrg  # if we detect the quoting.
5651d8c7986Smrg  case $CONFIG_FILES in
5661d8c7986Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
5671d8c7986Smrg  *)   set x $CONFIG_FILES ;;
5681d8c7986Smrg  esac
5691d8c7986Smrg  shift
5701d8c7986Smrg  for mf
5711d8c7986Smrg  do
5721d8c7986Smrg    # Strip MF so we end up with the name of the file.
5731d8c7986Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
5741d8c7986Smrg    # Check whether this is an Automake generated Makefile or not.
575c82dfdfbSmrg    # We used to match only the files named 'Makefile.in', but
5761d8c7986Smrg    # some people rename them; so instead we look at the file content.
5771d8c7986Smrg    # Grep'ing the first line is not enough: some people post-process
5781d8c7986Smrg    # each Makefile.in and add a new line on top of each file to say so.
5791d8c7986Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
5801d8c7986Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
5811d8c7986Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
5821d8c7986Smrg      dirpart=`AS_DIRNAME("$mf")`
5831d8c7986Smrg    else
5841d8c7986Smrg      continue
5851d8c7986Smrg    fi
5861d8c7986Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
587c82dfdfbSmrg    # from the Makefile without running 'make'.
5881d8c7986Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
5891d8c7986Smrg    test -z "$DEPDIR" && continue
5901d8c7986Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
591c82dfdfbSmrg    test -z "$am__include" && continue
5921d8c7986Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
5931d8c7986Smrg    # Find all dependency output files, they are included files with
5941d8c7986Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
5951d8c7986Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
5961d8c7986Smrg    # expansion.
5971d8c7986Smrg    for file in `sed -n "
5981d8c7986Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
599c82dfdfbSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
6001d8c7986Smrg      # Make sure the directory exists.
6011d8c7986Smrg      test -f "$dirpart/$file" && continue
6021d8c7986Smrg      fdir=`AS_DIRNAME(["$file"])`
6031d8c7986Smrg      AS_MKDIR_P([$dirpart/$fdir])
6041d8c7986Smrg      # echo "creating $dirpart/$file"
6051d8c7986Smrg      echo '# dummy' > "$dirpart/$file"
6061d8c7986Smrg    done
6071d8c7986Smrg  done
6081d8c7986Smrg}
6091d8c7986Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
610690143ccSmrg
611690143ccSmrg
6121d8c7986Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
6131d8c7986Smrg# -----------------------------
6141d8c7986Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
615690143ccSmrg#
6161d8c7986Smrg# This code is only required when automatic dependency tracking
617c82dfdfbSmrg# is enabled.  FIXME.  This creates each '.P' file that we will
6181d8c7986Smrg# need in order to bootstrap the dependency handling code.
6191d8c7986SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
6201d8c7986Smrg[AC_CONFIG_COMMANDS([depfiles],
6211d8c7986Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
6221d8c7986Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
6231d8c7986Smrg])
624f46a6179Smrg
6251d8c7986Smrg# Do all the work for Automake.                             -*- Autoconf -*-
626f46a6179Smrg
627c82dfdfbSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
628690143ccSmrg#
6291d8c7986Smrg# This file is free software; the Free Software Foundation
6301d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
6311d8c7986Smrg# with or without modifications, as long as this notice is preserved.
632690143ccSmrg
6331d8c7986Smrg# This macro actually does too much.  Some checks are only needed if
6341d8c7986Smrg# your package does certain things.  But this isn't really a big deal.
635f46a6179Smrg
636c82dfdfbSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
637c82dfdfbSmrgm4_define([AC_PROG_CC],
638c82dfdfbSmrgm4_defn([AC_PROG_CC])
639c82dfdfbSmrg[_AM_PROG_CC_C_O
640c82dfdfbSmrg])
641c82dfdfbSmrg
6421d8c7986Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
6431d8c7986Smrg# AM_INIT_AUTOMAKE([OPTIONS])
6441d8c7986Smrg# -----------------------------------------------
6451d8c7986Smrg# The call with PACKAGE and VERSION arguments is the old style
6461d8c7986Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
6471d8c7986Smrg# and VERSION should now be passed to AC_INIT and removed from
6481d8c7986Smrg# the call to AM_INIT_AUTOMAKE.
6491d8c7986Smrg# We support both call styles for the transition.  After
6501d8c7986Smrg# the next Automake release, Autoconf can make the AC_INIT
6511d8c7986Smrg# arguments mandatory, and then we can depend on a new Autoconf
6521d8c7986Smrg# release and drop the old call support.
6531d8c7986SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
654c82dfdfbSmrg[AC_PREREQ([2.65])dnl
6551d8c7986Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
6561d8c7986Smrgdnl the ones we care about.
6571d8c7986Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
6581d8c7986SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
6591d8c7986SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
6601d8c7986Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
6611d8c7986Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
6621d8c7986Smrg  # is not polluted with repeated "-I."
6631d8c7986Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
6641d8c7986Smrg  # test to see if srcdir already configured
6651d8c7986Smrg  if test -f $srcdir/config.status; then
6661d8c7986Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
6671d8c7986Smrg  fi
66834345a63Smrgfi
669f46a6179Smrg
6701d8c7986Smrg# test whether we have cygpath
6711d8c7986Smrgif test -z "$CYGPATH_W"; then
6721d8c7986Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
6731d8c7986Smrg    CYGPATH_W='cygpath -w'
6741d8c7986Smrg  else
6751d8c7986Smrg    CYGPATH_W=echo
6761d8c7986Smrg  fi
677690143ccSmrgfi
6781d8c7986SmrgAC_SUBST([CYGPATH_W])
679f46a6179Smrg
6801d8c7986Smrg# Define the identity of the package.
6811d8c7986Smrgdnl Distinguish between old-style and new-style calls.
6821d8c7986Smrgm4_ifval([$2],
683c82dfdfbSmrg[AC_DIAGNOSE([obsolete],
684c82dfdfbSmrg             [$0: two- and three-arguments forms are deprecated.])
685c82dfdfbSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
6861d8c7986Smrg AC_SUBST([PACKAGE], [$1])dnl
6871d8c7986Smrg AC_SUBST([VERSION], [$2])],
6881d8c7986Smrg[_AM_SET_OPTIONS([$1])dnl
6891d8c7986Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
690c82dfdfbSmrgm4_if(
691c82dfdfbSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
692c82dfdfbSmrg  [ok:ok],,
6931d8c7986Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
6941d8c7986Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
6951d8c7986Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
696f46a6179Smrg
6971d8c7986Smrg_AM_IF_OPTION([no-define],,
698c82dfdfbSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
699c82dfdfbSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
700f46a6179Smrg
7011d8c7986Smrg# Some tools Automake needs.
7021d8c7986SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
7031d8c7986SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
704c82dfdfbSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
705c82dfdfbSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
706c82dfdfbSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
707c82dfdfbSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
708c82dfdfbSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
7091d8c7986SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
7101d8c7986SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
711c82dfdfbSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
712c82dfdfbSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
713c82dfdfbSmrg# dies out for good.  For more background, see:
714c82dfdfbSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
715c82dfdfbSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
716c82dfdfbSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
7171d8c7986Smrg# We need awk for the "check" target.  The system "awk" is bad on
7181d8c7986Smrg# some platforms.
7191d8c7986SmrgAC_REQUIRE([AC_PROG_AWK])dnl
7201d8c7986SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
7211d8c7986SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
7221d8c7986Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
7231d8c7986Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
7241d8c7986Smrg			     [_AM_PROG_TAR([v7])])])
7251d8c7986Smrg_AM_IF_OPTION([no-dependencies],,
7261d8c7986Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
727c82dfdfbSmrg		  [_AM_DEPENDENCIES([CC])],
728c82dfdfbSmrg		  [m4_define([AC_PROG_CC],
729c82dfdfbSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
7301d8c7986SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
731c82dfdfbSmrg		  [_AM_DEPENDENCIES([CXX])],
732c82dfdfbSmrg		  [m4_define([AC_PROG_CXX],
733c82dfdfbSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
7341d8c7986SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
735c82dfdfbSmrg		  [_AM_DEPENDENCIES([OBJC])],
736c82dfdfbSmrg		  [m4_define([AC_PROG_OBJC],
737c82dfdfbSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
738c82dfdfbSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
739c82dfdfbSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
740c82dfdfbSmrg		  [m4_define([AC_PROG_OBJCXX],
741c82dfdfbSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
7421d8c7986Smrg])
743c82dfdfbSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
744c82dfdfbSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
745c82dfdfbSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
746c82dfdfbSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
7471d8c7986SmrgAC_CONFIG_COMMANDS_PRE(dnl
7481d8c7986Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
7491d8c7986Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
750f46a6179Smrg
751c82dfdfbSmrg# POSIX will say in a future version that running "rm -f" with no argument
752c82dfdfbSmrg# is OK; and we want to be able to make that assumption in our Makefile
753c82dfdfbSmrg# recipes.  So use an aggressive probe to check that the usage we want is
754c82dfdfbSmrg# actually supported "in the wild" to an acceptable degree.
755c82dfdfbSmrg# See automake bug#10828.
756c82dfdfbSmrg# To make any issue more visible, cause the running configure to be aborted
757c82dfdfbSmrg# by default if the 'rm' program in use doesn't match our expectations; the
758c82dfdfbSmrg# user can still override this though.
759c82dfdfbSmrgif rm -f && rm -fr && rm -rf; then : OK; else
760c82dfdfbSmrg  cat >&2 <<'END'
761c82dfdfbSmrgOops!
762c82dfdfbSmrg
763c82dfdfbSmrgYour 'rm' program seems unable to run without file operands specified
764c82dfdfbSmrgon the command line, even when the '-f' option is present.  This is contrary
765c82dfdfbSmrgto the behaviour of most rm programs out there, and not conforming with
766c82dfdfbSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
767c82dfdfbSmrg
768c82dfdfbSmrgPlease tell bug-automake@gnu.org about your system, including the value
769c82dfdfbSmrgof your $PATH and any error possibly output before this message.  This
770c82dfdfbSmrgcan help us improve future automake versions.
771c82dfdfbSmrg
772c82dfdfbSmrgEND
773c82dfdfbSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
774c82dfdfbSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
775c82dfdfbSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
776c82dfdfbSmrg    echo >&2
777c82dfdfbSmrg  else
778c82dfdfbSmrg    cat >&2 <<'END'
779c82dfdfbSmrgAborting the configuration process, to ensure you take notice of the issue.
780c82dfdfbSmrg
781c82dfdfbSmrgYou can download and install GNU coreutils to get an 'rm' implementation
782c82dfdfbSmrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
783c82dfdfbSmrg
784c82dfdfbSmrgIf you want to complete the configuration process using your problematic
785c82dfdfbSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
786c82dfdfbSmrgto "yes", and re-run configure.
787c82dfdfbSmrg
788c82dfdfbSmrgEND
789c82dfdfbSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
790c82dfdfbSmrg  fi
791c82dfdfbSmrgfi])
792c82dfdfbSmrg
793c82dfdfbSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
7941d8c7986Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
7951d8c7986Smrgdnl mangled by Autoconf and run in a shell conditional statement.
7961d8c7986Smrgm4_define([_AC_COMPILER_EXEEXT],
7971d8c7986Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
798f46a6179Smrg
7991d8c7986Smrg# When config.status generates a header, we must update the stamp-h file.
8001d8c7986Smrg# This file resides in the same directory as the config header
8011d8c7986Smrg# that is generated.  The stamp files are numbered to have different names.
802f46a6179Smrg
8031d8c7986Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
8041d8c7986Smrg# loop where config.status creates the headers, so we can generate
8051d8c7986Smrg# our stamp files there.
8061d8c7986SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
8071d8c7986Smrg[# Compute $1's index in $config_headers.
8081d8c7986Smrg_am_arg=$1
8091d8c7986Smrg_am_stamp_count=1
8101d8c7986Smrgfor _am_header in $config_headers :; do
8111d8c7986Smrg  case $_am_header in
8121d8c7986Smrg    $_am_arg | $_am_arg:* )
8131d8c7986Smrg      break ;;
8141d8c7986Smrg    * )
8151d8c7986Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
8161d8c7986Smrg  esac
8171d8c7986Smrgdone
8181d8c7986Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
8195fac8b10Smrg
820c82dfdfbSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
8211d8c7986Smrg#
8221d8c7986Smrg# This file is free software; the Free Software Foundation
8231d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
8241d8c7986Smrg# with or without modifications, as long as this notice is preserved.
825f46a6179Smrg
8261d8c7986Smrg# AM_PROG_INSTALL_SH
8271d8c7986Smrg# ------------------
8281d8c7986Smrg# Define $install_sh.
8291d8c7986SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
8301d8c7986Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
8311d8c7986Smrgif test x"${install_sh}" != xset; then
8321d8c7986Smrg  case $am_aux_dir in
8331d8c7986Smrg  *\ * | *\	*)
8341d8c7986Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
8351d8c7986Smrg  *)
8361d8c7986Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
8371d8c7986Smrg  esac
838690143ccSmrgfi
839c82dfdfbSmrgAC_SUBST([install_sh])])
8405fac8b10Smrg
841c82dfdfbSmrg# Copyright (C) 2003-2013 Free Software Foundation, Inc.
842690143ccSmrg#
8431d8c7986Smrg# This file is free software; the Free Software Foundation
8441d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
8451d8c7986Smrg# with or without modifications, as long as this notice is preserved.
846f46a6179Smrg
8471d8c7986Smrg# Check whether the underlying file-system supports filenames
8481d8c7986Smrg# with a leading dot.  For instance MS-DOS doesn't.
8491d8c7986SmrgAC_DEFUN([AM_SET_LEADING_DOT],
8501d8c7986Smrg[rm -rf .tst 2>/dev/null
8511d8c7986Smrgmkdir .tst 2>/dev/null
8521d8c7986Smrgif test -d .tst; then
8531d8c7986Smrg  am__leading_dot=.
854690143ccSmrgelse
8551d8c7986Smrg  am__leading_dot=_
8565fac8b10Smrgfi
8571d8c7986Smrgrmdir .tst 2>/dev/null
8581d8c7986SmrgAC_SUBST([am__leading_dot])])
859f46a6179Smrg
8601d8c7986Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
8615fac8b10Smrg
862c82dfdfbSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
863690143ccSmrg#
8641d8c7986Smrg# This file is free software; the Free Software Foundation
8651d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
8661d8c7986Smrg# with or without modifications, as long as this notice is preserved.
8671d8c7986Smrg
8681d8c7986Smrg# AM_MAKE_INCLUDE()
8691d8c7986Smrg# -----------------
8701d8c7986Smrg# Check to see how make treats includes.
8711d8c7986SmrgAC_DEFUN([AM_MAKE_INCLUDE],
8721d8c7986Smrg[am_make=${MAKE-make}
8731d8c7986Smrgcat > confinc << 'END'
8741d8c7986Smrgam__doit:
8751d8c7986Smrg	@echo this is the am__doit target
8761d8c7986Smrg.PHONY: am__doit
8771d8c7986SmrgEND
8781d8c7986Smrg# If we don't find an include directive, just comment out the code.
8791d8c7986SmrgAC_MSG_CHECKING([for style of include used by $am_make])
8801d8c7986Smrgam__include="#"
8811d8c7986Smrgam__quote=
8821d8c7986Smrg_am_result=none
8831d8c7986Smrg# First try GNU make style include.
8841d8c7986Smrgecho "include confinc" > confmf
885c82dfdfbSmrg# Ignore all kinds of additional output from 'make'.
8861d8c7986Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
8871d8c7986Smrg*the\ am__doit\ target*)
8881d8c7986Smrg  am__include=include
8891d8c7986Smrg  am__quote=
8901d8c7986Smrg  _am_result=GNU
8911d8c7986Smrg  ;;
8921d8c7986Smrgesac
8931d8c7986Smrg# Now try BSD make style include.
8941d8c7986Smrgif test "$am__include" = "#"; then
8951d8c7986Smrg   echo '.include "confinc"' > confmf
8961d8c7986Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
8971d8c7986Smrg   *the\ am__doit\ target*)
8981d8c7986Smrg     am__include=.include
8991d8c7986Smrg     am__quote="\""
9001d8c7986Smrg     _am_result=BSD
9011d8c7986Smrg     ;;
9021d8c7986Smrg   esac
9031d8c7986Smrgfi
9041d8c7986SmrgAC_SUBST([am__include])
9051d8c7986SmrgAC_SUBST([am__quote])
9061d8c7986SmrgAC_MSG_RESULT([$_am_result])
9071d8c7986Smrgrm -f confinc confmf
9081d8c7986Smrg])
9091d8c7986Smrg
9101d8c7986Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
9111d8c7986Smrg
912c82dfdfbSmrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
913690143ccSmrg#
9141d8c7986Smrg# This file is free software; the Free Software Foundation
9151d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
9161d8c7986Smrg# with or without modifications, as long as this notice is preserved.
9175fac8b10Smrg
9181d8c7986Smrg# AM_MISSING_PROG(NAME, PROGRAM)
9191d8c7986Smrg# ------------------------------
9201d8c7986SmrgAC_DEFUN([AM_MISSING_PROG],
9211d8c7986Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
9221d8c7986Smrg$1=${$1-"${am_missing_run}$2"}
9231d8c7986SmrgAC_SUBST($1)])
9241d8c7986Smrg
9251d8c7986Smrg# AM_MISSING_HAS_RUN
9261d8c7986Smrg# ------------------
927c82dfdfbSmrg# Define MISSING if not defined so far and test if it is modern enough.
928c82dfdfbSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
9291d8c7986SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
9301d8c7986Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
9311d8c7986SmrgAC_REQUIRE_AUX_FILE([missing])dnl
9321d8c7986Smrgif test x"${MISSING+set}" != xset; then
9331d8c7986Smrg  case $am_aux_dir in
9341d8c7986Smrg  *\ * | *\	*)
9351d8c7986Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
9361d8c7986Smrg  *)
9371d8c7986Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
9381d8c7986Smrg  esac
9391d8c7986Smrgfi
9401d8c7986Smrg# Use eval to expand $SHELL
941c82dfdfbSmrgif eval "$MISSING --is-lightweight"; then
942c82dfdfbSmrg  am_missing_run="$MISSING "
943690143ccSmrgelse
9441d8c7986Smrg  am_missing_run=
945c82dfdfbSmrg  AC_MSG_WARN(['missing' script is too old or missing])
946690143ccSmrgfi
9471d8c7986Smrg])
9485fac8b10Smrg
9491d8c7986Smrg# Helper functions for option handling.                     -*- Autoconf -*-
9501d8c7986Smrg
951c82dfdfbSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
952690143ccSmrg#
9531d8c7986Smrg# This file is free software; the Free Software Foundation
9541d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
9551d8c7986Smrg# with or without modifications, as long as this notice is preserved.
9561d8c7986Smrg
9571d8c7986Smrg# _AM_MANGLE_OPTION(NAME)
9581d8c7986Smrg# -----------------------
9591d8c7986SmrgAC_DEFUN([_AM_MANGLE_OPTION],
9601d8c7986Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
9611d8c7986Smrg
9621d8c7986Smrg# _AM_SET_OPTION(NAME)
963c82dfdfbSmrg# --------------------
9641d8c7986Smrg# Set option NAME.  Presently that only means defining a flag for this option.
9651d8c7986SmrgAC_DEFUN([_AM_SET_OPTION],
966c82dfdfbSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
9671d8c7986Smrg
9681d8c7986Smrg# _AM_SET_OPTIONS(OPTIONS)
969c82dfdfbSmrg# ------------------------
9701d8c7986Smrg# OPTIONS is a space-separated list of Automake options.
9711d8c7986SmrgAC_DEFUN([_AM_SET_OPTIONS],
9721d8c7986Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
9731d8c7986Smrg
9741d8c7986Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
9751d8c7986Smrg# -------------------------------------------
9761d8c7986Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
9771d8c7986SmrgAC_DEFUN([_AM_IF_OPTION],
9781d8c7986Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
9791d8c7986Smrg
980c82dfdfbSmrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
981c82dfdfbSmrg#
982c82dfdfbSmrg# This file is free software; the Free Software Foundation
983c82dfdfbSmrg# gives unlimited permission to copy and/or distribute it,
984c82dfdfbSmrg# with or without modifications, as long as this notice is preserved.
985c82dfdfbSmrg
986c82dfdfbSmrg# _AM_PROG_CC_C_O
987c82dfdfbSmrg# ---------------
988c82dfdfbSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
989c82dfdfbSmrg# to automatically call this.
990c82dfdfbSmrgAC_DEFUN([_AM_PROG_CC_C_O],
991c82dfdfbSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
992c82dfdfbSmrgAC_REQUIRE_AUX_FILE([compile])dnl
993c82dfdfbSmrgAC_LANG_PUSH([C])dnl
994c82dfdfbSmrgAC_CACHE_CHECK(
995c82dfdfbSmrg  [whether $CC understands -c and -o together],
996c82dfdfbSmrg  [am_cv_prog_cc_c_o],
997c82dfdfbSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
998c82dfdfbSmrg  # Make sure it works both with $CC and with simple cc.
999c82dfdfbSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
1000c82dfdfbSmrg  # compilers refuse to overwrite an existing .o file with -o,
1001c82dfdfbSmrg  # though they will create one.
1002c82dfdfbSmrg  am_cv_prog_cc_c_o=yes
1003c82dfdfbSmrg  for am_i in 1 2; do
1004c82dfdfbSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
1005c82dfdfbSmrg         && test -f conftest2.$ac_objext; then
1006c82dfdfbSmrg      : OK
1007c82dfdfbSmrg    else
1008c82dfdfbSmrg      am_cv_prog_cc_c_o=no
1009c82dfdfbSmrg      break
1010c82dfdfbSmrg    fi
1011c82dfdfbSmrg  done
1012c82dfdfbSmrg  rm -f core conftest*
1013c82dfdfbSmrg  unset am_i])
1014c82dfdfbSmrgif test "$am_cv_prog_cc_c_o" != yes; then
1015c82dfdfbSmrg   # Losing compiler, so override with the script.
1016c82dfdfbSmrg   # FIXME: It is wrong to rewrite CC.
1017c82dfdfbSmrg   # But if we don't then we get into trouble of one sort or another.
1018c82dfdfbSmrg   # A longer-term fix would be to have automake use am__CC in this case,
1019c82dfdfbSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
1020c82dfdfbSmrg   CC="$am_aux_dir/compile $CC"
1021c82dfdfbSmrgfi
1022c82dfdfbSmrgAC_LANG_POP([C])])
1023c82dfdfbSmrg
1024c82dfdfbSmrg# For backward compatibility.
1025c82dfdfbSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
10261d8c7986Smrg
1027c82dfdfbSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
1028690143ccSmrg#
10291d8c7986Smrg# This file is free software; the Free Software Foundation
10301d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
10311d8c7986Smrg# with or without modifications, as long as this notice is preserved.
10325fac8b10Smrg
1033c82dfdfbSmrg# AM_RUN_LOG(COMMAND)
1034c82dfdfbSmrg# -------------------
1035c82dfdfbSmrg# Run COMMAND, save the exit status in ac_status, and log it.
1036c82dfdfbSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
1037c82dfdfbSmrgAC_DEFUN([AM_RUN_LOG],
1038c82dfdfbSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
1039c82dfdfbSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
1040c82dfdfbSmrg   ac_status=$?
1041c82dfdfbSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
1042c82dfdfbSmrg   (exit $ac_status); }])
1043c82dfdfbSmrg
1044c82dfdfbSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
1045c82dfdfbSmrg
1046c82dfdfbSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
1047c82dfdfbSmrg#
1048c82dfdfbSmrg# This file is free software; the Free Software Foundation
1049c82dfdfbSmrg# gives unlimited permission to copy and/or distribute it,
1050c82dfdfbSmrg# with or without modifications, as long as this notice is preserved.
10511d8c7986Smrg
10521d8c7986Smrg# AM_SANITY_CHECK
10531d8c7986Smrg# ---------------
10541d8c7986SmrgAC_DEFUN([AM_SANITY_CHECK],
10551d8c7986Smrg[AC_MSG_CHECKING([whether build environment is sane])
10561d8c7986Smrg# Reject unsafe characters in $srcdir or the absolute working directory
10571d8c7986Smrg# name.  Accept space and tab only in the latter.
10581d8c7986Smrgam_lf='
10591d8c7986Smrg'
10601d8c7986Smrgcase `pwd` in
10611d8c7986Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
10621d8c7986Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
10631d8c7986Smrgesac
10641d8c7986Smrgcase $srcdir in
10651d8c7986Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
1066c82dfdfbSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
10671d8c7986Smrgesac
10681d8c7986Smrg
1069c82dfdfbSmrg# Do 'set' in a subshell so we don't clobber the current shell's
10701d8c7986Smrg# arguments.  Must try -L first in case configure is actually a
10711d8c7986Smrg# symlink; some systems play weird games with the mod time of symlinks
10721d8c7986Smrg# (eg FreeBSD returns the mod time of the symlink's containing
10731d8c7986Smrg# directory).
10741d8c7986Smrgif (
1075c82dfdfbSmrg   am_has_slept=no
1076c82dfdfbSmrg   for am_try in 1 2; do
1077c82dfdfbSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
1078c82dfdfbSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
1079c82dfdfbSmrg     if test "$[*]" = "X"; then
1080c82dfdfbSmrg	# -L didn't work.
1081c82dfdfbSmrg	set X `ls -t "$srcdir/configure" conftest.file`
1082c82dfdfbSmrg     fi
1083c82dfdfbSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
1084c82dfdfbSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
1085c82dfdfbSmrg
1086c82dfdfbSmrg	# If neither matched, then we have a broken ls.  This can happen
1087c82dfdfbSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
1088c82dfdfbSmrg	# broken ls alias from the environment.  This has actually
1089c82dfdfbSmrg	# happened.  Such a system could not be considered "sane".
1090c82dfdfbSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
1091c82dfdfbSmrg  alias in your environment])
1092c82dfdfbSmrg     fi
1093c82dfdfbSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
1094c82dfdfbSmrg       break
1095c82dfdfbSmrg     fi
1096c82dfdfbSmrg     # Just in case.
1097c82dfdfbSmrg     sleep 1
1098c82dfdfbSmrg     am_has_slept=yes
1099c82dfdfbSmrg   done
11001d8c7986Smrg   test "$[2]" = conftest.file
11011d8c7986Smrg   )
11021d8c7986Smrgthen
11031d8c7986Smrg   # Ok.
11041d8c7986Smrg   :
11051d8c7986Smrgelse
11061d8c7986Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
11071d8c7986SmrgCheck your system clock])
1108690143ccSmrgfi
1109c82dfdfbSmrgAC_MSG_RESULT([yes])
1110c82dfdfbSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
1111c82dfdfbSmrg# generated files are strictly newer.
1112c82dfdfbSmrgam_sleep_pid=
1113c82dfdfbSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
1114c82dfdfbSmrg  ( sleep 1 ) &
1115c82dfdfbSmrg  am_sleep_pid=$!
1116c82dfdfbSmrgfi
1117c82dfdfbSmrgAC_CONFIG_COMMANDS_PRE(
1118c82dfdfbSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
1119c82dfdfbSmrg   if test -n "$am_sleep_pid"; then
1120c82dfdfbSmrg     # Hide warnings about reused PIDs.
1121c82dfdfbSmrg     wait $am_sleep_pid 2>/dev/null
1122c82dfdfbSmrg   fi
1123c82dfdfbSmrg   AC_MSG_RESULT([done])])
1124c82dfdfbSmrgrm -f conftest.file
1125c82dfdfbSmrg])
1126f46a6179Smrg
1127c82dfdfbSmrg# Copyright (C) 2009-2013 Free Software Foundation, Inc.
11281d8c7986Smrg#
11291d8c7986Smrg# This file is free software; the Free Software Foundation
11301d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
11311d8c7986Smrg# with or without modifications, as long as this notice is preserved.
1132f46a6179Smrg
11331d8c7986Smrg# AM_SILENT_RULES([DEFAULT])
11341d8c7986Smrg# --------------------------
11351d8c7986Smrg# Enable less verbose build rules; with the default set to DEFAULT
1136c82dfdfbSmrg# ("yes" being less verbose, "no" or empty being verbose).
11371d8c7986SmrgAC_DEFUN([AM_SILENT_RULES],
1138c82dfdfbSmrg[AC_ARG_ENABLE([silent-rules], [dnl
1139c82dfdfbSmrgAS_HELP_STRING(
1140c82dfdfbSmrg  [--enable-silent-rules],
1141c82dfdfbSmrg  [less verbose build output (undo: "make V=1")])
1142c82dfdfbSmrgAS_HELP_STRING(
1143c82dfdfbSmrg  [--disable-silent-rules],
1144c82dfdfbSmrg  [verbose build output (undo: "make V=0")])dnl
1145c82dfdfbSmrg])
1146c82dfdfbSmrgcase $enable_silent_rules in @%:@ (((
1147c82dfdfbSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
1148c82dfdfbSmrg   no) AM_DEFAULT_VERBOSITY=1;;
1149c82dfdfbSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
11501d8c7986Smrgesac
1151c82dfdfbSmrgdnl
1152c82dfdfbSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
1153c82dfdfbSmrgdnl do not support nested variable expansions.
1154c82dfdfbSmrgdnl See automake bug#9928 and bug#10237.
1155c82dfdfbSmrgam_make=${MAKE-make}
1156c82dfdfbSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
1157c82dfdfbSmrg   [am_cv_make_support_nested_variables],
1158c82dfdfbSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
1159c82dfdfbSmrgBAR0=false
1160c82dfdfbSmrgBAR1=true
1161c82dfdfbSmrgV=1
1162c82dfdfbSmrgam__doit:
1163c82dfdfbSmrg	@$(TRUE)
1164c82dfdfbSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
1165c82dfdfbSmrg  am_cv_make_support_nested_variables=yes
1166c82dfdfbSmrgelse
1167c82dfdfbSmrg  am_cv_make_support_nested_variables=no
1168c82dfdfbSmrgfi])
1169c82dfdfbSmrgif test $am_cv_make_support_nested_variables = yes; then
1170c82dfdfbSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
1171c82dfdfbSmrg  AM_V='$(V)'
1172c82dfdfbSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
1173c82dfdfbSmrgelse
1174c82dfdfbSmrg  AM_V=$AM_DEFAULT_VERBOSITY
1175c82dfdfbSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
1176c82dfdfbSmrgfi
1177c82dfdfbSmrgAC_SUBST([AM_V])dnl
1178c82dfdfbSmrgAM_SUBST_NOTMAKE([AM_V])dnl
1179c82dfdfbSmrgAC_SUBST([AM_DEFAULT_V])dnl
1180c82dfdfbSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
11811d8c7986SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
11821d8c7986SmrgAM_BACKSLASH='\'
11831d8c7986SmrgAC_SUBST([AM_BACKSLASH])dnl
11841d8c7986Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
11851d8c7986Smrg])
11861d8c7986Smrg
1187c82dfdfbSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
1188690143ccSmrg#
11891d8c7986Smrg# This file is free software; the Free Software Foundation
11901d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
11911d8c7986Smrg# with or without modifications, as long as this notice is preserved.
1192f46a6179Smrg
11931d8c7986Smrg# AM_PROG_INSTALL_STRIP
11941d8c7986Smrg# ---------------------
1195c82dfdfbSmrg# One issue with vendor 'install' (even GNU) is that you can't
11961d8c7986Smrg# specify the program used to strip binaries.  This is especially
11971d8c7986Smrg# annoying in cross-compiling environments, where the build's strip
11981d8c7986Smrg# is unlikely to handle the host's binaries.
11991d8c7986Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
1200c82dfdfbSmrg# always use install-sh in "make install-strip", and initialize
12011d8c7986Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
12021d8c7986SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
12031d8c7986Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
1204c82dfdfbSmrg# Installed binaries are usually stripped using 'strip' when the user
1205c82dfdfbSmrg# run "make install-strip".  However 'strip' might not be the right
12061d8c7986Smrg# tool to use in cross-compilation environments, therefore Automake
1207c82dfdfbSmrg# will honor the 'STRIP' environment variable to overrule this program.
1208c82dfdfbSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
12091d8c7986Smrgif test "$cross_compiling" != no; then
12101d8c7986Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
12115fac8b10Smrgfi
12121d8c7986SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
12131d8c7986SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1214f46a6179Smrg
1215c82dfdfbSmrg# Copyright (C) 2006-2013 Free Software Foundation, Inc.
1216690143ccSmrg#
12171d8c7986Smrg# This file is free software; the Free Software Foundation
12181d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
12191d8c7986Smrg# with or without modifications, as long as this notice is preserved.
1220f46a6179Smrg
12211d8c7986Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
12221d8c7986Smrg# ---------------------------
12231d8c7986Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
12241d8c7986Smrg# This macro is traced by Automake.
12251d8c7986SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1226f46a6179Smrg
12271d8c7986Smrg# AM_SUBST_NOTMAKE(VARIABLE)
1228c82dfdfbSmrg# --------------------------
12291d8c7986Smrg# Public sister of _AM_SUBST_NOTMAKE.
12301d8c7986SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1231f46a6179Smrg
12321d8c7986Smrg# Check how to create a tarball.                            -*- Autoconf -*-
12331d8c7986Smrg
1234c82dfdfbSmrg# Copyright (C) 2004-2013 Free Software Foundation, Inc.
1235690143ccSmrg#
12361d8c7986Smrg# This file is free software; the Free Software Foundation
12371d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
12381d8c7986Smrg# with or without modifications, as long as this notice is preserved.
12391d8c7986Smrg
12401d8c7986Smrg# _AM_PROG_TAR(FORMAT)
12411d8c7986Smrg# --------------------
12421d8c7986Smrg# Check how to create a tarball in format FORMAT.
1243c82dfdfbSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1244690143ccSmrg#
12451d8c7986Smrg# Substitute a variable $(am__tar) that is a command
12461d8c7986Smrg# writing to stdout a FORMAT-tarball containing the directory
12471d8c7986Smrg# $tardir.
12481d8c7986Smrg#     tardir=directory && $(am__tar) > result.tar
1249690143ccSmrg#
12501d8c7986Smrg# Substitute a variable $(am__untar) that extract such
12511d8c7986Smrg# a tarball read from stdin.
12521d8c7986Smrg#     $(am__untar) < result.tar
1253c82dfdfbSmrg#
12541d8c7986SmrgAC_DEFUN([_AM_PROG_TAR],
1255c82dfdfbSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1256c82dfdfbSmrg# in the wild :-(  We should find a proper way to deprecate it ...
1257c82dfdfbSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1258c82dfdfbSmrg
1259c82dfdfbSmrg# We'll loop over all known methods to create a tar archive until one works.
12601d8c7986Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
126134345a63Smrg
1262c82dfdfbSmrgm4_if([$1], [v7],
1263c82dfdfbSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1264c82dfdfbSmrg
1265c82dfdfbSmrg  [m4_case([$1],
1266c82dfdfbSmrg    [ustar],
1267c82dfdfbSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1268c82dfdfbSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1269c82dfdfbSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1270c82dfdfbSmrg      # and bug#13588).
1271c82dfdfbSmrg      am_max_uid=2097151 # 2^21 - 1
1272c82dfdfbSmrg      am_max_gid=$am_max_uid
1273c82dfdfbSmrg      # The $UID and $GID variables are not portable, so we need to resort
1274c82dfdfbSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1275c82dfdfbSmrg      # below are definitely unexpected, so allow the users to see them
1276c82dfdfbSmrg      # (that is, avoid stderr redirection).
1277c82dfdfbSmrg      am_uid=`id -u || echo unknown`
1278c82dfdfbSmrg      am_gid=`id -g || echo unknown`
1279c82dfdfbSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1280c82dfdfbSmrg      if test $am_uid -le $am_max_uid; then
1281c82dfdfbSmrg         AC_MSG_RESULT([yes])
1282c82dfdfbSmrg      else
1283c82dfdfbSmrg         AC_MSG_RESULT([no])
1284c82dfdfbSmrg         _am_tools=none
1285c82dfdfbSmrg      fi
1286c82dfdfbSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1287c82dfdfbSmrg      if test $am_gid -le $am_max_gid; then
1288c82dfdfbSmrg         AC_MSG_RESULT([yes])
1289c82dfdfbSmrg      else
1290c82dfdfbSmrg        AC_MSG_RESULT([no])
1291c82dfdfbSmrg        _am_tools=none
1292c82dfdfbSmrg      fi],
1293c82dfdfbSmrg
1294c82dfdfbSmrg  [pax],
1295c82dfdfbSmrg    [],
1296c82dfdfbSmrg
1297c82dfdfbSmrg  [m4_fatal([Unknown tar format])])
1298c82dfdfbSmrg
1299c82dfdfbSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1300c82dfdfbSmrg
1301c82dfdfbSmrg  # Go ahead even if we have the value already cached.  We do so because we
1302c82dfdfbSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1303c82dfdfbSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1304c82dfdfbSmrg
1305c82dfdfbSmrg  for _am_tool in $_am_tools; do
1306c82dfdfbSmrg    case $_am_tool in
1307c82dfdfbSmrg    gnutar)
1308c82dfdfbSmrg      for _am_tar in tar gnutar gtar; do
1309c82dfdfbSmrg        AM_RUN_LOG([$_am_tar --version]) && break
1310c82dfdfbSmrg      done
1311c82dfdfbSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1312c82dfdfbSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1313c82dfdfbSmrg      am__untar="$_am_tar -xf -"
1314c82dfdfbSmrg      ;;
1315c82dfdfbSmrg    plaintar)
1316c82dfdfbSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1317c82dfdfbSmrg      # ustar tarball either.
1318c82dfdfbSmrg      (tar --version) >/dev/null 2>&1 && continue
1319c82dfdfbSmrg      am__tar='tar chf - "$$tardir"'
1320c82dfdfbSmrg      am__tar_='tar chf - "$tardir"'
1321c82dfdfbSmrg      am__untar='tar xf -'
1322c82dfdfbSmrg      ;;
1323c82dfdfbSmrg    pax)
1324c82dfdfbSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
1325c82dfdfbSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
1326c82dfdfbSmrg      am__untar='pax -r'
1327c82dfdfbSmrg      ;;
1328c82dfdfbSmrg    cpio)
1329c82dfdfbSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1330c82dfdfbSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1331c82dfdfbSmrg      am__untar='cpio -i -H $1 -d'
1332c82dfdfbSmrg      ;;
1333c82dfdfbSmrg    none)
1334c82dfdfbSmrg      am__tar=false
1335c82dfdfbSmrg      am__tar_=false
1336c82dfdfbSmrg      am__untar=false
1337c82dfdfbSmrg      ;;
1338c82dfdfbSmrg    esac
13391d8c7986Smrg
1340c82dfdfbSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
1341c82dfdfbSmrg    # and am__untar set.
1342c82dfdfbSmrg    test -n "${am_cv_prog_tar_$1}" && break
1343c82dfdfbSmrg
1344c82dfdfbSmrg    # tar/untar a dummy directory, and stop if the command works.
1345c82dfdfbSmrg    rm -rf conftest.dir
1346c82dfdfbSmrg    mkdir conftest.dir
1347c82dfdfbSmrg    echo GrepMe > conftest.dir/file
1348c82dfdfbSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1349c82dfdfbSmrg    rm -rf conftest.dir
1350c82dfdfbSmrg    if test -s conftest.tar; then
1351c82dfdfbSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
1352c82dfdfbSmrg      AM_RUN_LOG([cat conftest.dir/file])
1353c82dfdfbSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1354c82dfdfbSmrg    fi
1355c82dfdfbSmrg  done
13561d8c7986Smrg  rm -rf conftest.dir
13571d8c7986Smrg
1358c82dfdfbSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1359c82dfdfbSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1360c82dfdfbSmrg
13611d8c7986SmrgAC_SUBST([am__tar])
13621d8c7986SmrgAC_SUBST([am__untar])
13631d8c7986Smrg]) # _AM_PROG_TAR
13641d8c7986Smrg
13651d8c7986Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
13661d8c7986Smrgdnl
13671d8c7986Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1368c82dfdfbSmrgdnl
13691d8c7986Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
13701d8c7986Smrgdnl copy of this software and associated documentation files (the "Software"),
13711d8c7986Smrgdnl to deal in the Software without restriction, including without limitation
13721d8c7986Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
13731d8c7986Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
13741d8c7986Smrgdnl Software is furnished to do so, subject to the following conditions:
13751d8c7986Smrgdnl
13761d8c7986Smrgdnl The above copyright notice and this permission notice (including the next
13771d8c7986Smrgdnl paragraph) shall be included in all copies or substantial portions of the
13781d8c7986Smrgdnl Software.
13791d8c7986Smrgdnl
13801d8c7986Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13811d8c7986Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13821d8c7986Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
13831d8c7986Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
13841d8c7986Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
13851d8c7986Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
13861d8c7986Smrgdnl DEALINGS IN THE SOFTWARE.
1387f46a6179Smrg
13881d8c7986Smrg# XORG_MACROS_VERSION(required-version)
13891d8c7986Smrg# -------------------------------------
1390690143ccSmrg# Minimum version: 1.1.0
1391690143ccSmrg#
13921d8c7986Smrg# If you're using a macro added in Version 1.1 or newer, include this in
13931d8c7986Smrg# your configure.ac with the minimum required version, such as:
13941d8c7986Smrg# XORG_MACROS_VERSION(1.1)
1395690143ccSmrg#
13961d8c7986Smrg# To ensure that this macro is defined, also add:
13971d8c7986Smrg# m4_ifndef([XORG_MACROS_VERSION],
13981d8c7986Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1399690143ccSmrg#
1400690143ccSmrg#
1401c82dfdfbSmrg# See the "minimum version" comment for each macro you use to see what
14021d8c7986Smrg# version you require.
14031d8c7986Smrgm4_defun([XORG_MACROS_VERSION],[
1404c82dfdfbSmrgm4_define([vers_have], [1.19.0])
14051d8c7986Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
14061d8c7986Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
14071d8c7986Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
14081d8c7986Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
14091d8c7986Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
14101d8c7986Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
14111d8c7986Smrgm4_undefine([vers_have])
14121d8c7986Smrgm4_undefine([maj_have])
14131d8c7986Smrgm4_undefine([maj_needed])
14141d8c7986Smrg]) # XORG_MACROS_VERSION
141583e5f723Smrg
14161d8c7986Smrg# XORG_PROG_RAWCPP()
14171d8c7986Smrg# ------------------
14181d8c7986Smrg# Minimum version: 1.0.0
1419690143ccSmrg#
14201d8c7986Smrg# Find cpp program and necessary flags for use in pre-processing text files
14211d8c7986Smrg# such as man pages and config files
14221d8c7986SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
14231d8c7986SmrgAC_REQUIRE([AC_PROG_CPP])
1424c82dfdfbSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
14251d8c7986Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
14261d8c7986Smrg
14271d8c7986Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
14281d8c7986Smrg# which is not the best choice for supporting other OS'es, but covers most
14291d8c7986Smrg# of the ones we need for now.
14301d8c7986SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
14311d8c7986SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
14321d8c7986Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14331d8c7986Smrg	AC_MSG_RESULT([no])
143483e5f723Smrgelse
14351d8c7986Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14361d8c7986Smrg		RAWCPPFLAGS=-undef
14371d8c7986Smrg		AC_MSG_RESULT([yes])
14381d8c7986Smrg	# under Cygwin unix is still defined even with -undef
14391d8c7986Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14401d8c7986Smrg		RAWCPPFLAGS="-undef -ansi"
14411d8c7986Smrg		AC_MSG_RESULT([yes, with -ansi])
14421d8c7986Smrg	else
14431d8c7986Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
14441d8c7986Smrg	fi
144583e5f723Smrgfi
14461d8c7986Smrgrm -f conftest.$ac_ext
144783e5f723Smrg
14481d8c7986SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
14491d8c7986SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
14501d8c7986Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
14511d8c7986Smrg	AC_MSG_RESULT([no])
14521d8c7986Smrgelse
14531d8c7986Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1454c82dfdfbSmrg		TRADITIONALCPPFLAGS="-traditional"
14551d8c7986Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
14561d8c7986Smrg		AC_MSG_RESULT([yes])
14571d8c7986Smrg	else
14581d8c7986Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
14591d8c7986Smrg	fi
14601d8c7986Smrgfi
14611d8c7986Smrgrm -f conftest.$ac_ext
14621d8c7986SmrgAC_SUBST(RAWCPPFLAGS)
1463c82dfdfbSmrgAC_SUBST(TRADITIONALCPPFLAGS)
14641d8c7986Smrg]) # XORG_PROG_RAWCPP
14651d8c7986Smrg
14661d8c7986Smrg# XORG_MANPAGE_SECTIONS()
1467690143ccSmrg# -----------------------
14681d8c7986Smrg# Minimum version: 1.0.0
1469690143ccSmrg#
14701d8c7986Smrg# Determine which sections man pages go in for the different man page types
14711d8c7986Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
14721d8c7986Smrg# Not sure if there's any better way than just hardcoding by OS name.
14731d8c7986Smrg# Override default settings by setting environment variables
14741d8c7986Smrg# Added MAN_SUBSTS in version 1.8
14751d8c7986Smrg# Added AC_PROG_SED in version 1.8
1476f46a6179Smrg
14771d8c7986SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
14781d8c7986SmrgAC_REQUIRE([AC_CANONICAL_HOST])
14791d8c7986SmrgAC_REQUIRE([AC_PROG_SED])
14801d8c7986Smrg
14811d8c7986Smrgif test x$APP_MAN_SUFFIX = x    ; then
14821d8c7986Smrg    APP_MAN_SUFFIX=1
14835fac8b10Smrgfi
14841d8c7986Smrgif test x$APP_MAN_DIR = x    ; then
14851d8c7986Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1486690143ccSmrgfi
1487f46a6179Smrg
14881d8c7986Smrgif test x$LIB_MAN_SUFFIX = x    ; then
14891d8c7986Smrg    LIB_MAN_SUFFIX=3
14901d8c7986Smrgfi
14911d8c7986Smrgif test x$LIB_MAN_DIR = x    ; then
14921d8c7986Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
14931d8c7986Smrgfi
149483e5f723Smrg
14951d8c7986Smrgif test x$FILE_MAN_SUFFIX = x    ; then
14961d8c7986Smrg    case $host_os in
14971d8c7986Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
14981d8c7986Smrg	*)		FILE_MAN_SUFFIX=5  ;;
14991d8c7986Smrg    esac
15001d8c7986Smrgfi
15011d8c7986Smrgif test x$FILE_MAN_DIR = x    ; then
15021d8c7986Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
15031d8c7986Smrgfi
1504f46a6179Smrg
15051d8c7986Smrgif test x$MISC_MAN_SUFFIX = x    ; then
15061d8c7986Smrg    case $host_os in
15071d8c7986Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
15081d8c7986Smrg	*)		MISC_MAN_SUFFIX=7  ;;
15091d8c7986Smrg    esac
15101d8c7986Smrgfi
15111d8c7986Smrgif test x$MISC_MAN_DIR = x    ; then
15121d8c7986Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
15131d8c7986Smrgfi
1514f46a6179Smrg
15151d8c7986Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
15161d8c7986Smrg    case $host_os in
15171d8c7986Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
15181d8c7986Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
15191d8c7986Smrg    esac
15201d8c7986Smrgfi
15211d8c7986Smrgif test x$DRIVER_MAN_DIR = x    ; then
15221d8c7986Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
15231d8c7986Smrgfi
1524f46a6179Smrg
15251d8c7986Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
15261d8c7986Smrg    case $host_os in
15271d8c7986Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
15281d8c7986Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
15291d8c7986Smrg    esac
15301d8c7986Smrgfi
15311d8c7986Smrgif test x$ADMIN_MAN_DIR = x    ; then
15321d8c7986Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
15331d8c7986Smrgfi
1534f46a6179Smrg
1535f46a6179Smrg
15361d8c7986SmrgAC_SUBST([APP_MAN_SUFFIX])
15371d8c7986SmrgAC_SUBST([LIB_MAN_SUFFIX])
15381d8c7986SmrgAC_SUBST([FILE_MAN_SUFFIX])
15391d8c7986SmrgAC_SUBST([MISC_MAN_SUFFIX])
15401d8c7986SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
15411d8c7986SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
15421d8c7986SmrgAC_SUBST([APP_MAN_DIR])
15431d8c7986SmrgAC_SUBST([LIB_MAN_DIR])
15441d8c7986SmrgAC_SUBST([FILE_MAN_DIR])
15451d8c7986SmrgAC_SUBST([MISC_MAN_DIR])
15461d8c7986SmrgAC_SUBST([DRIVER_MAN_DIR])
15471d8c7986SmrgAC_SUBST([ADMIN_MAN_DIR])
1548f46a6179Smrg
15491d8c7986SmrgXORG_MAN_PAGE="X Version 11"
15501d8c7986SmrgAC_SUBST([XORG_MAN_PAGE])
15511d8c7986SmrgMAN_SUBSTS="\
15521d8c7986Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
15531d8c7986Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
15541d8c7986Smrg	-e 's|__xservername__|Xorg|g' \
15551d8c7986Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1556c82dfdfbSmrg	-e 's|__xorgconfdir__|xorg.conf.d|g' \
15571d8c7986Smrg	-e 's|__projectroot__|\$(prefix)|g' \
15581d8c7986Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
15591d8c7986Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
15601d8c7986Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
15611d8c7986Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
15621d8c7986Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
15631d8c7986Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
15641d8c7986Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
15651d8c7986SmrgAC_SUBST([MAN_SUBSTS])
1566f46a6179Smrg
15671d8c7986Smrg]) # XORG_MANPAGE_SECTIONS
156834345a63Smrg
15691d8c7986Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
15701d8c7986Smrg# ------------------------
15711d8c7986Smrg# Minimum version: 1.7.0
157283e5f723Smrg#
15731d8c7986Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
15741d8c7986Smrg# provided by xorg-sgml-doctools, if installed.
15751d8c7986SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
15761d8c7986SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
15771d8c7986SmrgXORG_SGML_PATH=
15781d8c7986SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
15791d8c7986Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
15801d8c7986Smrg    [m4_ifval([$1],[:],
15811d8c7986Smrg        [if test x"$cross_compiling" != x"yes" ; then
15821d8c7986Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
15831d8c7986Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
15841d8c7986Smrg         fi])
15851d8c7986Smrg    ])
1586690143ccSmrg
15871d8c7986Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
15881d8c7986Smrg# the path and the name of the doc stylesheet
15891d8c7986Smrgif test "x$XORG_SGML_PATH" != "x" ; then
15901d8c7986Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
15911d8c7986Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
15921d8c7986Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
15931d8c7986Smrgelse
15941d8c7986Smrg   AC_MSG_RESULT([no])
15951d8c7986Smrgfi
15961d8c7986Smrg
15971d8c7986SmrgAC_SUBST(XORG_SGML_PATH)
15981d8c7986SmrgAC_SUBST(STYLESHEET_SRCDIR)
15991d8c7986SmrgAC_SUBST(XSL_STYLESHEET)
16001d8c7986SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
16011d8c7986Smrg]) # XORG_CHECK_SGML_DOCTOOLS
16021d8c7986Smrg
16031d8c7986Smrg# XORG_CHECK_LINUXDOC
16041d8c7986Smrg# -------------------
16051d8c7986Smrg# Minimum version: 1.0.0
1606690143ccSmrg#
16071d8c7986Smrg# Defines the variable MAKE_TEXT if the necessary tools and
16081d8c7986Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
16091d8c7986Smrg# Whether or not the necessary tools and files are found can be checked
16101d8c7986Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
16111d8c7986SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
16121d8c7986SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
16131d8c7986SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1614690143ccSmrg
16151d8c7986SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1616690143ccSmrg
16171d8c7986SmrgAC_MSG_CHECKING([whether to build documentation])
1618690143ccSmrg
16191d8c7986Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
16201d8c7986Smrg   BUILDDOC=yes
16211d8c7986Smrgelse
16221d8c7986Smrg   BUILDDOC=no
16231d8c7986Smrgfi
1624690143ccSmrg
16251d8c7986SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1626690143ccSmrg
16271d8c7986SmrgAC_MSG_RESULT([$BUILDDOC])
16281d8c7986Smrg
16291d8c7986SmrgAC_MSG_CHECKING([whether to build pdf documentation])
16301d8c7986Smrg
16311d8c7986Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
16321d8c7986Smrg   BUILDPDFDOC=yes
163383e5f723Smrgelse
16341d8c7986Smrg   BUILDPDFDOC=no
163583e5f723Smrgfi
163683e5f723Smrg
16371d8c7986SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
163883e5f723Smrg
16391d8c7986SmrgAC_MSG_RESULT([$BUILDPDFDOC])
164083e5f723Smrg
16411d8c7986SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
16421d8c7986SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
16431d8c7986SmrgMAKE_PDF="$PS2PDF"
16441d8c7986SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1645690143ccSmrg
16461d8c7986SmrgAC_SUBST(MAKE_TEXT)
16471d8c7986SmrgAC_SUBST(MAKE_PS)
16481d8c7986SmrgAC_SUBST(MAKE_PDF)
16491d8c7986SmrgAC_SUBST(MAKE_HTML)
16501d8c7986Smrg]) # XORG_CHECK_LINUXDOC
1651690143ccSmrg
16521d8c7986Smrg# XORG_CHECK_DOCBOOK
16531d8c7986Smrg# -------------------
16541d8c7986Smrg# Minimum version: 1.0.0
165583e5f723Smrg#
16561d8c7986Smrg# Checks for the ability to build output formats from SGML DocBook source.
16571d8c7986Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
16581d8c7986Smrg# indicates whether the necessary tools and files are found and, if set,
16591d8c7986Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
16601d8c7986SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
16611d8c7986SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1662690143ccSmrg
16631d8c7986SmrgBUILDTXTDOC=no
16641d8c7986SmrgBUILDPDFDOC=no
16651d8c7986SmrgBUILDPSDOC=no
16661d8c7986SmrgBUILDHTMLDOC=no
1667690143ccSmrg
16681d8c7986SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
16691d8c7986SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
16701d8c7986SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
16711d8c7986SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1672690143ccSmrg
16731d8c7986SmrgAC_MSG_CHECKING([whether to build text documentation])
16741d8c7986Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
16751d8c7986Smrg   test x$BUILD_TXTDOC != xno; then
16761d8c7986Smrg	BUILDTXTDOC=yes
1677690143ccSmrgfi
16781d8c7986SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
16791d8c7986SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1680690143ccSmrg
16811d8c7986SmrgAC_MSG_CHECKING([whether to build PDF documentation])
16821d8c7986Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
16831d8c7986Smrg   test x$BUILD_PDFDOC != xno; then
16841d8c7986Smrg	BUILDPDFDOC=yes
16851d8c7986Smrgfi
16861d8c7986SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
16871d8c7986SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1688690143ccSmrg
16891d8c7986SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
16901d8c7986Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
16911d8c7986Smrg   test x$BUILD_PSDOC != xno; then
16921d8c7986Smrg	BUILDPSDOC=yes
16931d8c7986Smrgfi
16941d8c7986SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
16951d8c7986SmrgAC_MSG_RESULT([$BUILDPSDOC])
1696690143ccSmrg
16971d8c7986SmrgAC_MSG_CHECKING([whether to build HTML documentation])
16981d8c7986Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
16991d8c7986Smrg   test x$BUILD_HTMLDOC != xno; then
17001d8c7986Smrg	BUILDHTMLDOC=yes
1701690143ccSmrgfi
17021d8c7986SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
17031d8c7986SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1704690143ccSmrg
17051d8c7986SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
17061d8c7986SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
17071d8c7986SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
17081d8c7986SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1709690143ccSmrg
17101d8c7986SmrgAC_SUBST(MAKE_TEXT)
17111d8c7986SmrgAC_SUBST(MAKE_PS)
17121d8c7986SmrgAC_SUBST(MAKE_PDF)
17131d8c7986SmrgAC_SUBST(MAKE_HTML)
17141d8c7986Smrg]) # XORG_CHECK_DOCBOOK
17151d8c7986Smrg
17161d8c7986Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
17171d8c7986Smrg# ----------------
17181d8c7986Smrg# Minimum version: 1.5.0
17191d8c7986Smrg# Minimum version for optional DEFAULT argument: 1.11.0
172083e5f723Smrg#
17211d8c7986Smrg# Documentation tools are not always available on all platforms and sometimes
17221d8c7986Smrg# not at the appropriate level. This macro enables a module to test for the
17231d8c7986Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
17241d8c7986Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
17251d8c7986Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
17261d8c7986Smrg# --with-xmlto assumes 'auto'.
17271d8c7986Smrg#
17281d8c7986Smrg# Interface to module:
17291d8c7986Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
17301d8c7986Smrg# XMLTO:	returns the path of the xmlto program found
17311d8c7986Smrg#		returns the path set by the user in the environment
17321d8c7986Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
17331d8c7986Smrg#		'no' user instructs the module not to use xmlto
17341d8c7986Smrg#
17351d8c7986Smrg# Added in version 1.10.0
17361d8c7986Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
17371d8c7986Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
17381d8c7986Smrg#
17391d8c7986Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
17401d8c7986Smrg#
17411d8c7986SmrgAC_DEFUN([XORG_WITH_XMLTO],[
17421d8c7986SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
17431d8c7986Smrgm4_define([_defopt], m4_default([$2], [auto]))
17441d8c7986SmrgAC_ARG_WITH(xmlto,
17451d8c7986Smrg	AS_HELP_STRING([--with-xmlto],
17461d8c7986Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
17471d8c7986Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
17481d8c7986Smrgm4_undefine([_defopt])
1749690143ccSmrg
17501d8c7986Smrgif test "x$use_xmlto" = x"auto"; then
17511d8c7986Smrg   AC_PATH_PROG([XMLTO], [xmlto])
17521d8c7986Smrg   if test "x$XMLTO" = "x"; then
17531d8c7986Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
17541d8c7986Smrg	have_xmlto=no
17551d8c7986Smrg   else
17561d8c7986Smrg        have_xmlto=yes
17571d8c7986Smrg   fi
17581d8c7986Smrgelif test "x$use_xmlto" = x"yes" ; then
17591d8c7986Smrg   AC_PATH_PROG([XMLTO], [xmlto])
17601d8c7986Smrg   if test "x$XMLTO" = "x"; then
17611d8c7986Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
17621d8c7986Smrg   fi
17631d8c7986Smrg   have_xmlto=yes
17641d8c7986Smrgelif test "x$use_xmlto" = x"no" ; then
17651d8c7986Smrg   if test "x$XMLTO" != "x"; then
17661d8c7986Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
17671d8c7986Smrg   fi
17681d8c7986Smrg   have_xmlto=no
17691d8c7986Smrgelse
17701d8c7986Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
17711d8c7986Smrgfi
1772690143ccSmrg
17731d8c7986Smrg# Test for a minimum version of xmlto, if provided.
17741d8c7986Smrgm4_ifval([$1],
17751d8c7986Smrg[if test "$have_xmlto" = yes; then
17761d8c7986Smrg    # scrape the xmlto version
17771d8c7986Smrg    AC_MSG_CHECKING([the xmlto version])
17781d8c7986Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
17791d8c7986Smrg    AC_MSG_RESULT([$xmlto_version])
17801d8c7986Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
17811d8c7986Smrg        [if test "x$use_xmlto" = xauto; then
17821d8c7986Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
17831d8c7986Smrg            have_xmlto=no
17841d8c7986Smrg        else
17851d8c7986Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
17861d8c7986Smrg        fi])
17871d8c7986Smrgfi])
17881d8c7986Smrg
17891d8c7986Smrg# Test for the ability of xmlto to generate a text target
17901d8c7986Smrghave_xmlto_text=no
17911d8c7986Smrgcat > conftest.xml << "EOF"
17921d8c7986SmrgEOF
17931d8c7986SmrgAS_IF([test "$have_xmlto" = yes],
17941d8c7986Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
17951d8c7986Smrg             [have_xmlto_text=yes],
17961d8c7986Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
17971d8c7986Smrgrm -f conftest.xml
17981d8c7986SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
17991d8c7986SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
18001d8c7986Smrg]) # XORG_WITH_XMLTO
18011d8c7986Smrg
18021d8c7986Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
18031d8c7986Smrg# --------------------------------------------
18041d8c7986Smrg# Minimum version: 1.12.0
18051d8c7986Smrg# Minimum version for optional DEFAULT argument: 1.12.0
18061d8c7986Smrg#
18071d8c7986Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
18081d8c7986Smrg# XML-based language used for the transformation of XML documents.
18091d8c7986Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
18101d8c7986Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
18111d8c7986Smrg# The XSLT processor is often used as a standalone tool for transformations.
18121d8c7986Smrg# It should not be assumed that this tool is used only to work with documnetation.
18131d8c7986Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
18141d8c7986Smrg#
18151d8c7986Smrg# Interface to module:
18161d8c7986Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
18171d8c7986Smrg# XSLTPROC:	 returns the path of the xsltproc program found
18181d8c7986Smrg#		 returns the path set by the user in the environment
18191d8c7986Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
18201d8c7986Smrg#		  'no' user instructs the module not to use xsltproc
18211d8c7986Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
18221d8c7986Smrg#
18231d8c7986Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
18241d8c7986Smrg#
18251d8c7986SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
18261d8c7986SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
18271d8c7986Smrg# Preserves the interface, should it be implemented later
18281d8c7986Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
18291d8c7986Smrgm4_define([_defopt], m4_default([$2], [auto]))
18301d8c7986SmrgAC_ARG_WITH(xsltproc,
18311d8c7986Smrg	AS_HELP_STRING([--with-xsltproc],
18321d8c7986Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
18331d8c7986Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
18341d8c7986Smrgm4_undefine([_defopt])
18351d8c7986Smrg
18361d8c7986Smrgif test "x$use_xsltproc" = x"auto"; then
18371d8c7986Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
18381d8c7986Smrg   if test "x$XSLTPROC" = "x"; then
18391d8c7986Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
18401d8c7986Smrg	have_xsltproc=no
18411d8c7986Smrg   else
18421d8c7986Smrg        have_xsltproc=yes
18431d8c7986Smrg   fi
18441d8c7986Smrgelif test "x$use_xsltproc" = x"yes" ; then
18451d8c7986Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
18461d8c7986Smrg   if test "x$XSLTPROC" = "x"; then
18471d8c7986Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
18481d8c7986Smrg   fi
18491d8c7986Smrg   have_xsltproc=yes
18501d8c7986Smrgelif test "x$use_xsltproc" = x"no" ; then
18511d8c7986Smrg   if test "x$XSLTPROC" != "x"; then
18521d8c7986Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
18531d8c7986Smrg   fi
18541d8c7986Smrg   have_xsltproc=no
18551d8c7986Smrgelse
18561d8c7986Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
18571d8c7986Smrgfi
18581d8c7986Smrg
18591d8c7986SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
18601d8c7986Smrg]) # XORG_WITH_XSLTPROC
18611d8c7986Smrg
18621d8c7986Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
18631d8c7986Smrg# ----------------------------------------
18641d8c7986Smrg# Minimum version: 1.15.0
18651d8c7986Smrg#
18661d8c7986Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
18671d8c7986Smrg# scanning arbitrary text files, extracting information from those text files,
18681d8c7986Smrg# and printing reports based on that information.
18691d8c7986Smrg#
18701d8c7986Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
18711d8c7986Smrg#
18721d8c7986Smrg# Interface to module:
18731d8c7986Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
18741d8c7986Smrg# PERL:	     returns the path of the perl program found
18751d8c7986Smrg#	     returns the path set by the user in the environment
18761d8c7986Smrg# --with-perl: 'yes' user instructs the module to use perl
18771d8c7986Smrg#	       'no' user instructs the module not to use perl
18781d8c7986Smrg# have_perl: returns yes if perl found in PATH or no
18791d8c7986Smrg#
18801d8c7986Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
18811d8c7986Smrg#
18821d8c7986SmrgAC_DEFUN([XORG_WITH_PERL],[
18831d8c7986SmrgAC_ARG_VAR([PERL], [Path to perl command])
18841d8c7986Smrg# Preserves the interface, should it be implemented later
18851d8c7986Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
18861d8c7986Smrgm4_define([_defopt], m4_default([$2], [auto]))
18871d8c7986SmrgAC_ARG_WITH(perl,
18881d8c7986Smrg	AS_HELP_STRING([--with-perl],
18891d8c7986Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
18901d8c7986Smrg	   [use_perl=$withval], [use_perl=]_defopt)
18911d8c7986Smrgm4_undefine([_defopt])
18921d8c7986Smrg
18931d8c7986Smrgif test "x$use_perl" = x"auto"; then
18941d8c7986Smrg   AC_PATH_PROG([PERL], [perl])
18951d8c7986Smrg   if test "x$PERL" = "x"; then
18961d8c7986Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
18971d8c7986Smrg	have_perl=no
18981d8c7986Smrg   else
18991d8c7986Smrg        have_perl=yes
19001d8c7986Smrg   fi
19011d8c7986Smrgelif test "x$use_perl" = x"yes" ; then
19021d8c7986Smrg   AC_PATH_PROG([PERL], [perl])
19031d8c7986Smrg   if test "x$PERL" = "x"; then
19041d8c7986Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
19051d8c7986Smrg   fi
19061d8c7986Smrg   have_perl=yes
19071d8c7986Smrgelif test "x$use_perl" = x"no" ; then
19081d8c7986Smrg   if test "x$PERL" != "x"; then
19091d8c7986Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
19101d8c7986Smrg   fi
19111d8c7986Smrg   have_perl=no
19121d8c7986Smrgelse
19131d8c7986Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
19141d8c7986Smrgfi
19151d8c7986Smrg
19161d8c7986SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
19171d8c7986Smrg]) # XORG_WITH_PERL
19181d8c7986Smrg
19191d8c7986Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
19201d8c7986Smrg# ----------------
19211d8c7986Smrg# Minimum version: 1.5.0
19221d8c7986Smrg# Minimum version for optional DEFAULT argument: 1.11.0
19231d8c7986Smrg#
19241d8c7986Smrg# Documentation tools are not always available on all platforms and sometimes
19251d8c7986Smrg# not at the appropriate level. This macro enables a module to test for the
19261d8c7986Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
19271d8c7986Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
19281d8c7986Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
19291d8c7986Smrg# --with-asciidoc assumes 'auto'.
19301d8c7986Smrg#
19311d8c7986Smrg# Interface to module:
19321d8c7986Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
19331d8c7986Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
19341d8c7986Smrg#		 returns the path set by the user in the environment
19351d8c7986Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
19361d8c7986Smrg#		  'no' user instructs the module not to use asciidoc
19371d8c7986Smrg#
19381d8c7986Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
19391d8c7986Smrg#
19401d8c7986SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
19411d8c7986SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
19421d8c7986Smrgm4_define([_defopt], m4_default([$2], [auto]))
19431d8c7986SmrgAC_ARG_WITH(asciidoc,
19441d8c7986Smrg	AS_HELP_STRING([--with-asciidoc],
19451d8c7986Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
19461d8c7986Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
19471d8c7986Smrgm4_undefine([_defopt])
19481d8c7986Smrg
19491d8c7986Smrgif test "x$use_asciidoc" = x"auto"; then
19501d8c7986Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
19511d8c7986Smrg   if test "x$ASCIIDOC" = "x"; then
19521d8c7986Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
19531d8c7986Smrg	have_asciidoc=no
19541d8c7986Smrg   else
19551d8c7986Smrg        have_asciidoc=yes
19561d8c7986Smrg   fi
19571d8c7986Smrgelif test "x$use_asciidoc" = x"yes" ; then
19581d8c7986Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
19591d8c7986Smrg   if test "x$ASCIIDOC" = "x"; then
19601d8c7986Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
19611d8c7986Smrg   fi
19621d8c7986Smrg   have_asciidoc=yes
19631d8c7986Smrgelif test "x$use_asciidoc" = x"no" ; then
19641d8c7986Smrg   if test "x$ASCIIDOC" != "x"; then
19651d8c7986Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
19661d8c7986Smrg   fi
19671d8c7986Smrg   have_asciidoc=no
19681d8c7986Smrgelse
19691d8c7986Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
19701d8c7986Smrgfi
19711d8c7986Smrgm4_ifval([$1],
19721d8c7986Smrg[if test "$have_asciidoc" = yes; then
19731d8c7986Smrg    # scrape the asciidoc version
19741d8c7986Smrg    AC_MSG_CHECKING([the asciidoc version])
19751d8c7986Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
19761d8c7986Smrg    AC_MSG_RESULT([$asciidoc_version])
19771d8c7986Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
19781d8c7986Smrg        [if test "x$use_asciidoc" = xauto; then
19791d8c7986Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
19801d8c7986Smrg            have_asciidoc=no
19811d8c7986Smrg        else
19821d8c7986Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
19831d8c7986Smrg        fi])
19841d8c7986Smrgfi])
19851d8c7986SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
19861d8c7986Smrg]) # XORG_WITH_ASCIIDOC
19871d8c7986Smrg
19881d8c7986Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1989c82dfdfbSmrg# -------------------------------------------
19901d8c7986Smrg# Minimum version: 1.5.0
19911d8c7986Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1992c82dfdfbSmrg# Minimum version for optional DOT checking: 1.18.0
19931d8c7986Smrg#
19941d8c7986Smrg# Documentation tools are not always available on all platforms and sometimes
19951d8c7986Smrg# not at the appropriate level. This macro enables a module to test for the
19961d8c7986Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
19971d8c7986Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
19981d8c7986Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
19991d8c7986Smrg# --with-doxygen assumes 'auto'.
20001d8c7986Smrg#
20011d8c7986Smrg# Interface to module:
20021d8c7986Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
20031d8c7986Smrg# DOXYGEN:	 returns the path of the doxygen program found
20041d8c7986Smrg#		 returns the path set by the user in the environment
20051d8c7986Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
20061d8c7986Smrg#		  'no' user instructs the module not to use doxygen
20071d8c7986Smrg#
20081d8c7986Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
20091d8c7986Smrg#
20101d8c7986SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
20111d8c7986SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2012c82dfdfbSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
20131d8c7986Smrgm4_define([_defopt], m4_default([$2], [auto]))
20141d8c7986SmrgAC_ARG_WITH(doxygen,
20151d8c7986Smrg	AS_HELP_STRING([--with-doxygen],
20161d8c7986Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
20171d8c7986Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
20181d8c7986Smrgm4_undefine([_defopt])
20191d8c7986Smrg
20201d8c7986Smrgif test "x$use_doxygen" = x"auto"; then
20211d8c7986Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
20221d8c7986Smrg   if test "x$DOXYGEN" = "x"; then
20231d8c7986Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
20241d8c7986Smrg	have_doxygen=no
20251d8c7986Smrg   else
20261d8c7986Smrg        have_doxygen=yes
20271d8c7986Smrg   fi
20281d8c7986Smrgelif test "x$use_doxygen" = x"yes" ; then
20291d8c7986Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
20301d8c7986Smrg   if test "x$DOXYGEN" = "x"; then
20311d8c7986Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
20321d8c7986Smrg   fi
20331d8c7986Smrg   have_doxygen=yes
20341d8c7986Smrgelif test "x$use_doxygen" = x"no" ; then
20351d8c7986Smrg   if test "x$DOXYGEN" != "x"; then
20361d8c7986Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
20371d8c7986Smrg   fi
20381d8c7986Smrg   have_doxygen=no
20391d8c7986Smrgelse
20401d8c7986Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
20411d8c7986Smrgfi
20421d8c7986Smrgm4_ifval([$1],
20431d8c7986Smrg[if test "$have_doxygen" = yes; then
20441d8c7986Smrg    # scrape the doxygen version
20451d8c7986Smrg    AC_MSG_CHECKING([the doxygen version])
20461d8c7986Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
20471d8c7986Smrg    AC_MSG_RESULT([$doxygen_version])
20481d8c7986Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
20491d8c7986Smrg        [if test "x$use_doxygen" = xauto; then
20501d8c7986Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
20511d8c7986Smrg            have_doxygen=no
20521d8c7986Smrg        else
20531d8c7986Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
20541d8c7986Smrg        fi])
20551d8c7986Smrgfi])
2056c82dfdfbSmrg
2057c82dfdfbSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2058c82dfdfbSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2059c82dfdfbSmrgdnl 	HAVE_DOT = @HAVE_DOT@
2060c82dfdfbSmrgHAVE_DOT=no
2061c82dfdfbSmrgif test "x$have_doxygen" = "xyes"; then
2062c82dfdfbSmrg  AC_PATH_PROG([DOT], [dot])
2063c82dfdfbSmrg    if test "x$DOT" != "x"; then
2064c82dfdfbSmrg      HAVE_DOT=yes
2065c82dfdfbSmrg    fi
2066c82dfdfbSmrgfi
2067c82dfdfbSmrg
2068c82dfdfbSmrgAC_SUBST([HAVE_DOT])
2069c82dfdfbSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
20701d8c7986SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
20711d8c7986Smrg]) # XORG_WITH_DOXYGEN
20721d8c7986Smrg
20731d8c7986Smrg# XORG_WITH_GROFF([DEFAULT])
20741d8c7986Smrg# ----------------
20751d8c7986Smrg# Minimum version: 1.6.0
20761d8c7986Smrg# Minimum version for optional DEFAULT argument: 1.11.0
20771d8c7986Smrg#
20781d8c7986Smrg# Documentation tools are not always available on all platforms and sometimes
20791d8c7986Smrg# not at the appropriate level. This macro enables a module to test for the
20801d8c7986Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
20811d8c7986Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
20821d8c7986Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
20831d8c7986Smrg# --with-groff assumes 'auto'.
20841d8c7986Smrg#
20851d8c7986Smrg# Interface to module:
20861d8c7986Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
20871d8c7986Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
20881d8c7986Smrg# HAVE_GROFF_MS: the -ms macros package
20891d8c7986Smrg# GROFF:	 returns the path of the groff program found
20901d8c7986Smrg#		 returns the path set by the user in the environment
20911d8c7986Smrg# --with-groff:	 'yes' user instructs the module to use groff
20921d8c7986Smrg#		 'no' user instructs the module not to use groff
20931d8c7986Smrg#
20941d8c7986Smrg# Added in version 1.9.0:
20951d8c7986Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
20961d8c7986Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
20971d8c7986Smrg#		   psselect from the psutils package.
20981d8c7986Smrg#		   the ghostcript package. Refer to the grohtml man pages
20991d8c7986Smrg#
21001d8c7986Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
21011d8c7986Smrg#
21021d8c7986Smrg# OS and distros often splits groff in a basic and full package, the former
21031d8c7986Smrg# having the groff program and the later having devices, fonts and macros
21041d8c7986Smrg# Checking for the groff executable is not enough.
21051d8c7986Smrg#
21061d8c7986Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
21071d8c7986Smrg# unset HAVE_GROFF or GROFF env variables.
21081d8c7986Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
21091d8c7986Smrg#
21101d8c7986SmrgAC_DEFUN([XORG_WITH_GROFF],[
21111d8c7986SmrgAC_ARG_VAR([GROFF], [Path to groff command])
21121d8c7986Smrgm4_define([_defopt], m4_default([$1], [auto]))
21131d8c7986SmrgAC_ARG_WITH(groff,
21141d8c7986Smrg	AS_HELP_STRING([--with-groff],
21151d8c7986Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
21161d8c7986Smrg	   [use_groff=$withval], [use_groff=]_defopt)
21171d8c7986Smrgm4_undefine([_defopt])
21181d8c7986Smrg
21191d8c7986Smrgif test "x$use_groff" = x"auto"; then
21201d8c7986Smrg   AC_PATH_PROG([GROFF], [groff])
21211d8c7986Smrg   if test "x$GROFF" = "x"; then
21221d8c7986Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
21231d8c7986Smrg	have_groff=no
21241d8c7986Smrg   else
21251d8c7986Smrg        have_groff=yes
21261d8c7986Smrg   fi
21271d8c7986Smrgelif test "x$use_groff" = x"yes" ; then
21281d8c7986Smrg   AC_PATH_PROG([GROFF], [groff])
21291d8c7986Smrg   if test "x$GROFF" = "x"; then
21301d8c7986Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
21311d8c7986Smrg   fi
21321d8c7986Smrg   have_groff=yes
21331d8c7986Smrgelif test "x$use_groff" = x"no" ; then
21341d8c7986Smrg   if test "x$GROFF" != "x"; then
21351d8c7986Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
21361d8c7986Smrg   fi
21371d8c7986Smrg   have_groff=no
21381d8c7986Smrgelse
21391d8c7986Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
21401d8c7986Smrgfi
21411d8c7986Smrg
21421d8c7986Smrg# We have groff, test for the presence of the macro packages
21431d8c7986Smrgif test "x$have_groff" = x"yes"; then
21441d8c7986Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
21451d8c7986Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
21461d8c7986Smrg        groff_ms_works=yes
21471d8c7986Smrg    else
21481d8c7986Smrg        groff_ms_works=no
21491d8c7986Smrg    fi
21501d8c7986Smrg    AC_MSG_RESULT([$groff_ms_works])
21511d8c7986Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
21521d8c7986Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
21531d8c7986Smrg        groff_mm_works=yes
2154690143ccSmrg    else
21551d8c7986Smrg        groff_mm_works=no
2156690143ccSmrg    fi
21571d8c7986Smrg    AC_MSG_RESULT([$groff_mm_works])
21581d8c7986Smrgfi
2159690143ccSmrg
21601d8c7986Smrg# We have groff, test for HTML dependencies, one command per package
21611d8c7986Smrgif test "x$have_groff" = x"yes"; then
21621d8c7986Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
21631d8c7986Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
21641d8c7986Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
21651d8c7986Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
21661d8c7986Smrg      have_groff_html=yes
21671d8c7986Smrg   else
21681d8c7986Smrg      have_groff_html=no
21691d8c7986Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
21701d8c7986Smrg   fi
21711d8c7986Smrgfi
2172690143ccSmrg
21731d8c7986Smrg# Set Automake conditionals for Makefiles
21741d8c7986SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
21751d8c7986SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
21761d8c7986SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
21771d8c7986SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
21781d8c7986Smrg]) # XORG_WITH_GROFF
21791d8c7986Smrg
21801d8c7986Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
21811d8c7986Smrg# ---------------------------------------
21821d8c7986Smrg# Minimum version: 1.6.0
21831d8c7986Smrg# Minimum version for optional DEFAULT argument: 1.11.0
21841d8c7986Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
21851d8c7986Smrg#
21861d8c7986Smrg# Documentation tools are not always available on all platforms and sometimes
21871d8c7986Smrg# not at the appropriate level. This macro enables a module to test for the
21881d8c7986Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
21891d8c7986Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
21901d8c7986Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
21911d8c7986Smrg# --with-fop assumes 'auto'.
21921d8c7986Smrg#
21931d8c7986Smrg# Interface to module:
21941d8c7986Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
21951d8c7986Smrg# FOP:	 	returns the path of the fop program found
21961d8c7986Smrg#		returns the path set by the user in the environment
21971d8c7986Smrg# --with-fop: 	'yes' user instructs the module to use fop
21981d8c7986Smrg#		'no' user instructs the module not to use fop
21991d8c7986Smrg#
22001d8c7986Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
22011d8c7986Smrg#
22021d8c7986SmrgAC_DEFUN([XORG_WITH_FOP],[
22031d8c7986SmrgAC_ARG_VAR([FOP], [Path to fop command])
22041d8c7986Smrgm4_define([_defopt], m4_default([$2], [auto]))
22051d8c7986SmrgAC_ARG_WITH(fop,
22061d8c7986Smrg	AS_HELP_STRING([--with-fop],
22071d8c7986Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
22081d8c7986Smrg	   [use_fop=$withval], [use_fop=]_defopt)
22091d8c7986Smrgm4_undefine([_defopt])
22101d8c7986Smrg
22111d8c7986Smrgif test "x$use_fop" = x"auto"; then
22121d8c7986Smrg   AC_PATH_PROG([FOP], [fop])
22131d8c7986Smrg   if test "x$FOP" = "x"; then
22141d8c7986Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
22151d8c7986Smrg	have_fop=no
22161d8c7986Smrg   else
22171d8c7986Smrg        have_fop=yes
22181d8c7986Smrg   fi
22191d8c7986Smrgelif test "x$use_fop" = x"yes" ; then
22201d8c7986Smrg   AC_PATH_PROG([FOP], [fop])
22211d8c7986Smrg   if test "x$FOP" = "x"; then
22221d8c7986Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
22231d8c7986Smrg   fi
22241d8c7986Smrg   have_fop=yes
22251d8c7986Smrgelif test "x$use_fop" = x"no" ; then
22261d8c7986Smrg   if test "x$FOP" != "x"; then
22271d8c7986Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
22281d8c7986Smrg   fi
22291d8c7986Smrg   have_fop=no
22301d8c7986Smrgelse
22311d8c7986Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
22321d8c7986Smrgfi
22331d8c7986Smrg
22341d8c7986Smrg# Test for a minimum version of fop, if provided.
22351d8c7986Smrgm4_ifval([$1],
22361d8c7986Smrg[if test "$have_fop" = yes; then
22371d8c7986Smrg    # scrape the fop version
22381d8c7986Smrg    AC_MSG_CHECKING([for fop minimum version])
22391d8c7986Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
22401d8c7986Smrg    AC_MSG_RESULT([$fop_version])
22411d8c7986Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
22421d8c7986Smrg        [if test "x$use_fop" = xauto; then
22431d8c7986Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
22441d8c7986Smrg            have_fop=no
22451d8c7986Smrg        else
22461d8c7986Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
22471d8c7986Smrg        fi])
22481d8c7986Smrgfi])
22491d8c7986SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
22501d8c7986Smrg]) # XORG_WITH_FOP
22511d8c7986Smrg
2252c82dfdfbSmrg# XORG_WITH_M4([MIN-VERSION])
2253c82dfdfbSmrg# ---------------------------
2254c82dfdfbSmrg# Minimum version: 1.19.0
2255c82dfdfbSmrg#
2256c82dfdfbSmrg# This macro attempts to locate an m4 macro processor which supports
2257c82dfdfbSmrg# -I option and is only useful for modules relying on M4 in order to
2258c82dfdfbSmrg# expand macros in source code files.
2259c82dfdfbSmrg#
2260c82dfdfbSmrg# Interface to module:
2261c82dfdfbSmrg# M4:	 	returns the path of the m4 program found
2262c82dfdfbSmrg#		returns the path set by the user in the environment
2263c82dfdfbSmrg#
2264c82dfdfbSmrgAC_DEFUN([XORG_WITH_M4], [
2265c82dfdfbSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2266c82dfdfbSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2267c82dfdfbSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2268c82dfdfbSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2269c82dfdfbSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2270c82dfdfbSmrg   [$PATH:/usr/gnu/bin])])
2271c82dfdfbSmrg
2272c82dfdfbSmrgAC_SUBST([M4], [$ac_cv_path_M4])
2273c82dfdfbSmrg]) # XORG_WITH_M4
2274c82dfdfbSmrg
22751d8c7986Smrg# XORG_WITH_PS2PDF([DEFAULT])
22761d8c7986Smrg# ----------------
22771d8c7986Smrg# Minimum version: 1.6.0
22781d8c7986Smrg# Minimum version for optional DEFAULT argument: 1.11.0
22791d8c7986Smrg#
22801d8c7986Smrg# Documentation tools are not always available on all platforms and sometimes
22811d8c7986Smrg# not at the appropriate level. This macro enables a module to test for the
22821d8c7986Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
22831d8c7986Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
22841d8c7986Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
22851d8c7986Smrg# --with-ps2pdf assumes 'auto'.
22861d8c7986Smrg#
22871d8c7986Smrg# Interface to module:
22881d8c7986Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
22891d8c7986Smrg# PS2PDF:	returns the path of the ps2pdf program found
22901d8c7986Smrg#		returns the path set by the user in the environment
22911d8c7986Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
22921d8c7986Smrg#		 'no' user instructs the module not to use ps2pdf
22931d8c7986Smrg#
22941d8c7986Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
22951d8c7986Smrg#
22961d8c7986SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
22971d8c7986SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
22981d8c7986Smrgm4_define([_defopt], m4_default([$1], [auto]))
22991d8c7986SmrgAC_ARG_WITH(ps2pdf,
23001d8c7986Smrg	AS_HELP_STRING([--with-ps2pdf],
23011d8c7986Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
23021d8c7986Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
23031d8c7986Smrgm4_undefine([_defopt])
23041d8c7986Smrg
23051d8c7986Smrgif test "x$use_ps2pdf" = x"auto"; then
23061d8c7986Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23071d8c7986Smrg   if test "x$PS2PDF" = "x"; then
23081d8c7986Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
23091d8c7986Smrg	have_ps2pdf=no
23101d8c7986Smrg   else
23111d8c7986Smrg        have_ps2pdf=yes
23121d8c7986Smrg   fi
23131d8c7986Smrgelif test "x$use_ps2pdf" = x"yes" ; then
23141d8c7986Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23151d8c7986Smrg   if test "x$PS2PDF" = "x"; then
23161d8c7986Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
23171d8c7986Smrg   fi
23181d8c7986Smrg   have_ps2pdf=yes
23191d8c7986Smrgelif test "x$use_ps2pdf" = x"no" ; then
23201d8c7986Smrg   if test "x$PS2PDF" != "x"; then
23211d8c7986Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
23221d8c7986Smrg   fi
23231d8c7986Smrg   have_ps2pdf=no
23241d8c7986Smrgelse
23251d8c7986Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
23261d8c7986Smrgfi
23271d8c7986SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
23281d8c7986Smrg]) # XORG_WITH_PS2PDF
23291d8c7986Smrg
23301d8c7986Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
23311d8c7986Smrg# ----------------
23321d8c7986Smrg# Minimum version: 1.6.0
23331d8c7986Smrg#
23341d8c7986Smrg# Documentation tools are not always available on all platforms and sometimes
23351d8c7986Smrg# not at the appropriate level. This macro enables a builder to skip all
23361d8c7986Smrg# documentation targets except traditional man pages.
23371d8c7986Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
23381d8c7986Smrg# maximum flexibilty in controlling documentation building.
23391d8c7986Smrg# Refer to:
23401d8c7986Smrg# XORG_WITH_XMLTO         --with-xmlto
23411d8c7986Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
23421d8c7986Smrg# XORG_WITH_DOXYGEN       --with-doxygen
23431d8c7986Smrg# XORG_WITH_FOP           --with-fop
23441d8c7986Smrg# XORG_WITH_GROFF         --with-groff
23451d8c7986Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
23461d8c7986Smrg#
23471d8c7986Smrg# Interface to module:
23481d8c7986Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
23491d8c7986Smrg# --enable-docs: 'yes' user instructs the module to generate docs
23501d8c7986Smrg#		 'no' user instructs the module not to generate docs
23511d8c7986Smrg# parm1:	specify the default value, yes or no.
23521d8c7986Smrg#
23531d8c7986SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
23541d8c7986Smrgm4_define([docs_default], m4_default([$1], [yes]))
23551d8c7986SmrgAC_ARG_ENABLE(docs,
23561d8c7986Smrg	AS_HELP_STRING([--enable-docs],
23571d8c7986Smrg	   [Enable building the documentation (default: ]docs_default[)]),
23581d8c7986Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
23591d8c7986Smrgm4_undefine([docs_default])
23601d8c7986SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
23611d8c7986SmrgAC_MSG_CHECKING([whether to build documentation])
23621d8c7986SmrgAC_MSG_RESULT([$build_docs])
23631d8c7986Smrg]) # XORG_ENABLE_DOCS
23641d8c7986Smrg
23651d8c7986Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
23661d8c7986Smrg# ----------------
23671d8c7986Smrg# Minimum version: 1.6.0
23681d8c7986Smrg#
23691d8c7986Smrg# This macro enables a builder to skip all developer documentation.
23701d8c7986Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
23711d8c7986Smrg# maximum flexibilty in controlling documentation building.
23721d8c7986Smrg# Refer to:
23731d8c7986Smrg# XORG_WITH_XMLTO         --with-xmlto
23741d8c7986Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
23751d8c7986Smrg# XORG_WITH_DOXYGEN       --with-doxygen
23761d8c7986Smrg# XORG_WITH_FOP           --with-fop
23771d8c7986Smrg# XORG_WITH_GROFF         --with-groff
23781d8c7986Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
23791d8c7986Smrg#
23801d8c7986Smrg# Interface to module:
23811d8c7986Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
23821d8c7986Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
23831d8c7986Smrg#			'no' user instructs the module not to generate developer docs
23841d8c7986Smrg# parm1:		specify the default value, yes or no.
23851d8c7986Smrg#
23861d8c7986SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
23871d8c7986Smrgm4_define([devel_default], m4_default([$1], [yes]))
23881d8c7986SmrgAC_ARG_ENABLE(devel-docs,
23891d8c7986Smrg	AS_HELP_STRING([--enable-devel-docs],
23901d8c7986Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
23911d8c7986Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
23921d8c7986Smrgm4_undefine([devel_default])
23931d8c7986SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
23941d8c7986SmrgAC_MSG_CHECKING([whether to build developer documentation])
23951d8c7986SmrgAC_MSG_RESULT([$build_devel_docs])
23961d8c7986Smrg]) # XORG_ENABLE_DEVEL_DOCS
23971d8c7986Smrg
23981d8c7986Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
23991d8c7986Smrg# ----------------
24001d8c7986Smrg# Minimum version: 1.6.0
24011d8c7986Smrg#
24021d8c7986Smrg# This macro enables a builder to skip all functional specification targets.
24031d8c7986Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24041d8c7986Smrg# maximum flexibilty in controlling documentation building.
24051d8c7986Smrg# Refer to:
24061d8c7986Smrg# XORG_WITH_XMLTO         --with-xmlto
24071d8c7986Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24081d8c7986Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24091d8c7986Smrg# XORG_WITH_FOP           --with-fop
24101d8c7986Smrg# XORG_WITH_GROFF         --with-groff
24111d8c7986Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24121d8c7986Smrg#
24131d8c7986Smrg# Interface to module:
24141d8c7986Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
24151d8c7986Smrg# --enable-specs:	'yes' user instructs the module to generate specs
24161d8c7986Smrg#			'no' user instructs the module not to generate specs
24171d8c7986Smrg# parm1:		specify the default value, yes or no.
241883e5f723Smrg#
24191d8c7986SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
24201d8c7986Smrgm4_define([spec_default], m4_default([$1], [yes]))
24211d8c7986SmrgAC_ARG_ENABLE(specs,
24221d8c7986Smrg	AS_HELP_STRING([--enable-specs],
24231d8c7986Smrg	   [Enable building the specs (default: ]spec_default[)]),
24241d8c7986Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
24251d8c7986Smrgm4_undefine([spec_default])
24261d8c7986SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
24271d8c7986SmrgAC_MSG_CHECKING([whether to build functional specifications])
24281d8c7986SmrgAC_MSG_RESULT([$build_specs])
24291d8c7986Smrg]) # XORG_ENABLE_SPECS
2430690143ccSmrg
24311d8c7986Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
24321d8c7986Smrg# ----------------------------------------------
24331d8c7986Smrg# Minimum version: 1.13.0
243483e5f723Smrg#
24351d8c7986Smrg# This macro enables a builder to enable/disable unit testing
24361d8c7986Smrg# It makes no assumption about the test cases implementation
24371d8c7986Smrg# Test cases may or may not use Automake "Support for test suites"
24381d8c7986Smrg# They may or may not use the software utility library GLib
24391d8c7986Smrg#
24401d8c7986Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
24411d8c7986Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
24421d8c7986Smrg# The variable enable_unit_tests is used by other macros in this file.
24431d8c7986Smrg#
24441d8c7986Smrg# Interface to module:
24451d8c7986Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
24461d8c7986Smrg# enable_unit_tests:    used in configure.ac for additional configuration
24471d8c7986Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
24481d8c7986Smrg#			'no' user instructs the module not to build tests
24491d8c7986Smrg# parm1:		specify the default value, yes or no.
24501d8c7986Smrg#
24511d8c7986SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
24521d8c7986SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
24531d8c7986SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
24541d8c7986SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
24551d8c7986Smrgm4_define([_defopt], m4_default([$1], [auto]))
24561d8c7986SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
24571d8c7986Smrg	[Enable building unit test cases (default: ]_defopt[)]),
24581d8c7986Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
24591d8c7986Smrgm4_undefine([_defopt])
24601d8c7986SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
24611d8c7986SmrgAC_MSG_CHECKING([whether to build unit test cases])
24621d8c7986SmrgAC_MSG_RESULT([$enable_unit_tests])
24631d8c7986Smrg]) # XORG_ENABLE_UNIT_TESTS
246483e5f723Smrg
24651d8c7986Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
24661d8c7986Smrg# ------------------------------------------------------
24671d8c7986Smrg# Minimum version: 1.17.0
24681d8c7986Smrg#
24691d8c7986Smrg# This macro enables a builder to enable/disable integration testing
24701d8c7986Smrg# It makes no assumption about the test cases' implementation
24711d8c7986Smrg# Test cases may or may not use Automake "Support for test suites"
24721d8c7986Smrg#
24731d8c7986Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
24741d8c7986Smrg# usually requires less dependencies and may be built and run under less
24751d8c7986Smrg# stringent environments than integration tests.
24761d8c7986Smrg#
24771d8c7986Smrg# Interface to module:
24781d8c7986Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
24791d8c7986Smrg# enable_integration_tests:   used in configure.ac for additional configuration
24801d8c7986Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
24811d8c7986Smrg#                             'no' user instructs the module not to build tests
24821d8c7986Smrg# parm1:                      specify the default value, yes or no.
24831d8c7986Smrg#
24841d8c7986SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
24851d8c7986SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
24861d8c7986Smrgm4_define([_defopt], m4_default([$1], [auto]))
24871d8c7986SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
24881d8c7986Smrg	[Enable building integration test cases (default: ]_defopt[)]),
24891d8c7986Smrg	[enable_integration_tests=$enableval],
24901d8c7986Smrg	[enable_integration_tests=]_defopt)
24911d8c7986Smrgm4_undefine([_defopt])
24921d8c7986SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
24931d8c7986Smrg	[test "x$enable_integration_tests" != xno])
24941d8c7986SmrgAC_MSG_CHECKING([whether to build unit test cases])
24951d8c7986SmrgAC_MSG_RESULT([$enable_integration_tests])
24961d8c7986Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2497690143ccSmrg
24981d8c7986Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
24991d8c7986Smrg# ----------------------------------------
25001d8c7986Smrg# Minimum version: 1.13.0
25011d8c7986Smrg#
25021d8c7986Smrg# GLib is a library which provides advanced data structures and functions.
25031d8c7986Smrg# This macro enables a module to test for the presence of Glib.
25041d8c7986Smrg#
25051d8c7986Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
25061d8c7986Smrg# Otherwise the value of $enable_unit_tests is blank.
25071d8c7986Smrg#
25081d8c7986Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
25091d8c7986Smrg# test support usually requires less dependencies and may be built and run under
25101d8c7986Smrg# less stringent environments than integration tests.
25111d8c7986Smrg#
25121d8c7986Smrg# Interface to module:
25131d8c7986Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
25141d8c7986Smrg# with_glib: used in configure.ac to know if GLib has been found
25151d8c7986Smrg# --with-glib:	'yes' user instructs the module to use glib
25161d8c7986Smrg#		'no' user instructs the module not to use glib
25171d8c7986Smrg#
25181d8c7986SmrgAC_DEFUN([XORG_WITH_GLIB],[
25191d8c7986SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
25201d8c7986Smrgm4_define([_defopt], m4_default([$2], [auto]))
25211d8c7986SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
25221d8c7986Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
25231d8c7986Smrg	[with_glib=$withval], [with_glib=]_defopt)
25241d8c7986Smrgm4_undefine([_defopt])
2525690143ccSmrg
25261d8c7986Smrghave_glib=no
25271d8c7986Smrg# Do not probe GLib if user explicitly disabled unit testing
25281d8c7986Smrgif test "x$enable_unit_tests" != x"no"; then
25291d8c7986Smrg  # Do not probe GLib if user explicitly disabled it
25301d8c7986Smrg  if test "x$with_glib" != x"no"; then
25311d8c7986Smrg    m4_ifval(
25321d8c7986Smrg      [$1],
25331d8c7986Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
25341d8c7986Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
25351d8c7986Smrg    )
2536690143ccSmrg  fi
253783e5f723Smrgfi
253883e5f723Smrg
25391d8c7986Smrg# Not having GLib when unit testing has been explicitly requested is an error
25401d8c7986Smrgif test "x$enable_unit_tests" = x"yes"; then
25411d8c7986Smrg  if test "x$have_glib" = x"no"; then
25421d8c7986Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2543690143ccSmrg  fi
2544690143ccSmrgfi
2545690143ccSmrg
25461d8c7986Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
25471d8c7986Smrgif test "x$enable_unit_tests" = x"no"; then
25481d8c7986Smrg  if test "x$with_glib" = x"yes"; then
25491d8c7986Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
25501d8c7986Smrg  fi
25511d8c7986Smrgfi
255283e5f723Smrg
25531d8c7986Smrg# Not having GLib when it has been explicitly requested is an error
25541d8c7986Smrgif test "x$with_glib" = x"yes"; then
25551d8c7986Smrg  if test "x$have_glib" = x"no"; then
25561d8c7986Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
25571d8c7986Smrg  fi
255883e5f723Smrgfi
255983e5f723Smrg
25601d8c7986SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
25611d8c7986Smrg]) # XORG_WITH_GLIB
25621d8c7986Smrg
25631d8c7986Smrg# XORG_LD_WRAP([required|optional])
25641d8c7986Smrg# ---------------------------------
25651d8c7986Smrg# Minimum version: 1.13.0
256683e5f723Smrg#
25671d8c7986Smrg# Check if linker supports -wrap, passed via compiler flags
25681d8c7986Smrg#
25691d8c7986Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
25701d8c7986Smrg# Otherwise the value of $enable_unit_tests is blank.
25711d8c7986Smrg#
25721d8c7986Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
25731d8c7986Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
25741d8c7986Smrg# available, an argument of "optional" allows use when some unit tests require
25751d8c7986Smrg# ld -wrap and others do not.
25761d8c7986Smrg#
25771d8c7986SmrgAC_DEFUN([XORG_LD_WRAP],[
25781d8c7986SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
25791d8c7986Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
25801d8c7986Smrg                      void __wrap_exit(int status) { return; }],
25811d8c7986Smrg                     [exit(0);])])
25821d8c7986Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
25831d8c7986Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
25841d8c7986Smrg  if test "x$have_ld_wrap" = x"no"; then
25851d8c7986Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
25861d8c7986Smrg  fi
25871d8c7986Smrgfi
25881d8c7986SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
25891d8c7986Smrg#
25901d8c7986Smrg]) # XORG_LD_WRAP
2591690143ccSmrg
25921d8c7986Smrg# XORG_CHECK_LINKER_FLAGS
25931d8c7986Smrg# -----------------------
25941d8c7986Smrg# SYNOPSIS
25951d8c7986Smrg#
25961d8c7986Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
25971d8c7986Smrg#
25981d8c7986Smrg# DESCRIPTION
25991d8c7986Smrg#
26001d8c7986Smrg#   Check whether the given linker FLAGS work with the current language's
26011d8c7986Smrg#   linker, or whether they give an error.
26021d8c7986Smrg#
26031d8c7986Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
26041d8c7986Smrg#   success/failure.
26051d8c7986Smrg#
26061d8c7986Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
26071d8c7986Smrg#
26081d8c7986Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
26091d8c7986Smrg#
26101d8c7986Smrg# LICENSE
26111d8c7986Smrg#
26121d8c7986Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
26131d8c7986Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
26141d8c7986Smrg#   Copyright (c) 2009 Matteo Frigo
26151d8c7986Smrg#
26161d8c7986Smrg#   This program is free software: you can redistribute it and/or modify it
26171d8c7986Smrg#   under the terms of the GNU General Public License as published by the
26181d8c7986Smrg#   Free Software Foundation, either version 3 of the License, or (at your
26191d8c7986Smrg#   option) any later version.
26201d8c7986Smrg#
26211d8c7986Smrg#   This program is distributed in the hope that it will be useful, but
26221d8c7986Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
26231d8c7986Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
26241d8c7986Smrg#   Public License for more details.
26251d8c7986Smrg#
26261d8c7986Smrg#   You should have received a copy of the GNU General Public License along
26271d8c7986Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
26281d8c7986Smrg#
26291d8c7986Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
26301d8c7986Smrg#   gives unlimited permission to copy, distribute and modify the configure
26311d8c7986Smrg#   scripts that are the output of Autoconf when processing the Macro. You
26321d8c7986Smrg#   need not follow the terms of the GNU General Public License when using
26331d8c7986Smrg#   or distributing such scripts, even though portions of the text of the
26341d8c7986Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
26351d8c7986Smrg#   all other use of the material that constitutes the Autoconf Macro.
26361d8c7986Smrg#
26371d8c7986Smrg#   This special exception to the GPL applies to versions of the Autoconf
26381d8c7986Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
26391d8c7986Smrg#   modified version of the Autoconf Macro, you may extend this special
26401d8c7986Smrg#   exception to the GPL to apply to your modified version as well.#
26411d8c7986SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
26421d8c7986Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
26431d8c7986Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
26441d8c7986SmrgAS_LITERAL_IF([$1],
26451d8c7986Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
26461d8c7986Smrg      ax_save_FLAGS=$LDFLAGS
26471d8c7986Smrg      LDFLAGS="$1"
26481d8c7986Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
26491d8c7986Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
26501d8c7986Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
26511d8c7986Smrg      LDFLAGS=$ax_save_FLAGS])],
26521d8c7986Smrg  [ax_save_FLAGS=$LDFLAGS
26531d8c7986Smrg   LDFLAGS="$1"
26541d8c7986Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
26551d8c7986Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
26561d8c7986Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
26571d8c7986Smrg   LDFLAGS=$ax_save_FLAGS])
26581d8c7986Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
26591d8c7986SmrgAC_MSG_RESULT($xorg_check_linker_flags)
26601d8c7986Smrgif test "x$xorg_check_linker_flags" = xyes; then
26611d8c7986Smrg	m4_default([$2], :)
266283e5f723Smrgelse
26631d8c7986Smrg	m4_default([$3], :)
266483e5f723Smrgfi
26651d8c7986Smrg]) # XORG_CHECK_LINKER_FLAGS
266683e5f723Smrg
26671d8c7986Smrg# XORG_MEMORY_CHECK_FLAGS
26681d8c7986Smrg# -----------------------
26691d8c7986Smrg# Minimum version: 1.16.0
2670690143ccSmrg#
26711d8c7986Smrg# This macro attempts to find appropriate memory checking functionality
26721d8c7986Smrg# for various platforms which unit testing code may use to catch various
26731d8c7986Smrg# forms of memory allocation and access errors in testing.
26741d8c7986Smrg#
26751d8c7986Smrg# Interface to module:
26761d8c7986Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
26771d8c7986Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
26781d8c7986Smrg#
26791d8c7986Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
26801d8c7986Smrg#
26811d8c7986SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
268283e5f723Smrg
26831d8c7986SmrgAC_REQUIRE([AC_CANONICAL_HOST])
26841d8c7986SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
26851d8c7986Smrg           [Environment variables to enable memory checking in tests])
2686690143ccSmrg
26871d8c7986Smrg# Check for different types of support on different platforms
26881d8c7986Smrgcase $host_os in
26891d8c7986Smrg    solaris*)
26901d8c7986Smrg        AC_CHECK_LIB([umem], [umem_alloc],
26911d8c7986Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
26921d8c7986Smrg        ;;
26931d8c7986Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
26941d8c7986Smrg        # both directly and inverted, so should not be 0 or 255.
26951d8c7986Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
26961d8c7986Smrg        ;;
26971d8c7986Smrg    darwin*)
26981d8c7986Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
26991d8c7986Smrg        ;;
27001d8c7986Smrg    *bsd*)
27011d8c7986Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
27021d8c7986Smrg        ;;
27031d8c7986Smrgesac
2704690143ccSmrg
27051d8c7986Smrg# User supplied flags override default flags
27061d8c7986Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
27071d8c7986Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
27081d8c7986Smrgfi
270983e5f723Smrg
27101d8c7986SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
27111d8c7986Smrg]) # XORG_WITH_LINT
2712690143ccSmrg
27131d8c7986Smrg# XORG_CHECK_MALLOC_ZERO
27141d8c7986Smrg# ----------------------
27151d8c7986Smrg# Minimum version: 1.0.0
271683e5f723Smrg#
27171d8c7986Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
27181d8c7986Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
27191d8c7986Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
27201d8c7986SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
27211d8c7986SmrgAC_ARG_ENABLE(malloc0returnsnull,
27221d8c7986Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
27231d8c7986Smrg		       [malloc(0) returns NULL (default: auto)]),
27241d8c7986Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
27251d8c7986Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
272683e5f723Smrg
27271d8c7986SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
27281d8c7986Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2729c82dfdfbSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
2730c82dfdfbSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
27311d8c7986Smrg#include <stdlib.h>
27321d8c7986Smrg],[
27331d8c7986Smrg    char *m0, *r0, *c0, *p;
27341d8c7986Smrg    m0 = malloc(0);
27351d8c7986Smrg    p = malloc(10);
27361d8c7986Smrg    r0 = realloc(p,0);
27371d8c7986Smrg    c0 = calloc(0,10);
27381d8c7986Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
27391d8c7986Smrg])],
2740c82dfdfbSmrg		[xorg_cv_malloc0_returns_null=yes],
2741c82dfdfbSmrg		[xorg_cv_malloc0_returns_null=no])])
2742c82dfdfbSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
27431d8c7986Smrgfi
27441d8c7986SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2745690143ccSmrg
27461d8c7986Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
27471d8c7986Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
27481d8c7986Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
27491d8c7986Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
27501d8c7986Smrgelse
27511d8c7986Smrg	MALLOC_ZERO_CFLAGS=""
27521d8c7986Smrg	XMALLOC_ZERO_CFLAGS=""
27531d8c7986Smrg	XTMALLOC_ZERO_CFLAGS=""
275483e5f723Smrgfi
275583e5f723Smrg
27561d8c7986SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
27571d8c7986SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
27581d8c7986SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
27591d8c7986Smrg]) # XORG_CHECK_MALLOC_ZERO
2760690143ccSmrg
27611d8c7986Smrg# XORG_WITH_LINT()
27621d8c7986Smrg# ----------------
27631d8c7986Smrg# Minimum version: 1.1.0
27641d8c7986Smrg#
27651d8c7986Smrg# This macro enables the use of a tool that flags some suspicious and
27661d8c7986Smrg# non-portable constructs (likely to be bugs) in C language source code.
27671d8c7986Smrg# It will attempt to locate the tool and use appropriate options.
27681d8c7986Smrg# There are various lint type tools on different platforms.
27691d8c7986Smrg#
27701d8c7986Smrg# Interface to module:
27711d8c7986Smrg# LINT:		returns the path to the tool found on the platform
27721d8c7986Smrg#		or the value set to LINT on the configure cmd line
27731d8c7986Smrg#		also an Automake conditional
27741d8c7986Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
27751d8c7986Smrg#
27761d8c7986Smrg# --with-lint:	'yes' user instructs the module to use lint
27771d8c7986Smrg#		'no' user instructs the module not to use lint (default)
27781d8c7986Smrg#
27791d8c7986Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
27801d8c7986Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
278183e5f723Smrg#
27821d8c7986SmrgAC_DEFUN([XORG_WITH_LINT],[
2783690143ccSmrg
27841d8c7986SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
27851d8c7986SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
27861d8c7986SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
27871d8c7986Smrg		[Use a lint-style source code checker (default: disabled)])],
27881d8c7986Smrg		[use_lint=$withval], [use_lint=no])
2789690143ccSmrg
27901d8c7986Smrg# Obtain platform specific info like program name and options
27911d8c7986Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
27921d8c7986Smrgcase $host_os in
27931d8c7986Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
27941d8c7986Smrg	lint_name=splint
27951d8c7986Smrg	lint_options="-badflag"
27961d8c7986Smrg	;;
27971d8c7986Smrg  *freebsd* | *netbsd*)
27981d8c7986Smrg	lint_name=lint
27991d8c7986Smrg	lint_options="-u -b"
28001d8c7986Smrg	;;
28011d8c7986Smrg  *solaris*)
28021d8c7986Smrg	lint_name=lint
28031d8c7986Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
28041d8c7986Smrg	;;
28051d8c7986Smrgesac
2806690143ccSmrg
28071d8c7986Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
28081d8c7986Smrgif test "x$use_lint" = x"yes" ; then
28091d8c7986Smrg   AC_PATH_PROG([LINT], [$lint_name])
28101d8c7986Smrg   if test "x$LINT" = "x"; then
28111d8c7986Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
28121d8c7986Smrg   fi
28131d8c7986Smrgelif test "x$use_lint" = x"no" ; then
28141d8c7986Smrg   if test "x$LINT" != "x"; then
28151d8c7986Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
28161d8c7986Smrg   fi
281783e5f723Smrgelse
28181d8c7986Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
281983e5f723Smrgfi
282083e5f723Smrg
28211d8c7986Smrg# User supplied flags override default flags
28221d8c7986Smrgif test "x$LINT_FLAGS" != "x"; then
28231d8c7986Smrg   lint_options=$LINT_FLAGS
28241d8c7986Smrgfi
282583e5f723Smrg
28261d8c7986SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
28271d8c7986SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2828690143ccSmrg
28291d8c7986Smrg]) # XORG_WITH_LINT
283083e5f723Smrg
28311d8c7986Smrg# XORG_LINT_LIBRARY(LIBNAME)
28321d8c7986Smrg# --------------------------
28331d8c7986Smrg# Minimum version: 1.1.0
283483e5f723Smrg#
28351d8c7986Smrg# Sets up flags for building lint libraries for checking programs that call
28361d8c7986Smrg# functions in the library.
28371d8c7986Smrg#
28381d8c7986Smrg# Interface to module:
28391d8c7986Smrg# LINTLIB		- Automake variable with the name of lint library file to make
28401d8c7986Smrg# MAKE_LINT_LIB		- Automake conditional
28411d8c7986Smrg#
28421d8c7986Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
28431d8c7986Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2844f46a6179Smrg
28451d8c7986SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
28461d8c7986SmrgAC_REQUIRE([XORG_WITH_LINT])
28471d8c7986SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
28481d8c7986Smrg	[Create lint library (default: disabled)])],
28491d8c7986Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2850f46a6179Smrg
28511d8c7986Smrgif test "x$make_lint_lib" = x"yes" ; then
28521d8c7986Smrg   LINTLIB=llib-l$1.ln
28531d8c7986Smrg   if test "x$LINT" = "x"; then
28541d8c7986Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
28551d8c7986Smrg   fi
28561d8c7986Smrgelif test "x$make_lint_lib" != x"no" ; then
28571d8c7986Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
28581d8c7986Smrgfi
28595fac8b10Smrg
28601d8c7986SmrgAC_SUBST(LINTLIB)
28611d8c7986SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2862690143ccSmrg
28631d8c7986Smrg]) # XORG_LINT_LIBRARY
2864690143ccSmrg
28651d8c7986Smrg# XORG_COMPILER_BRAND
28661d8c7986Smrg# -------------------
28671d8c7986Smrg# Minimum version: 1.14.0
28685fac8b10Smrg#
28691d8c7986Smrg# Checks for various brands of compilers and sets flags as appropriate:
28701d8c7986Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
28711d8c7986Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
28721d8c7986Smrg#   clang compiler - sets CLANGCC to "yes"
28731d8c7986Smrg#   Intel compiler - sets INTELCC to "yes"
28741d8c7986Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
28751d8c7986Smrg#
28761d8c7986SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
28771d8c7986SmrgAC_LANG_CASE(
28781d8c7986Smrg	[C], [
28791d8c7986Smrg		AC_REQUIRE([AC_PROG_CC_C99])
28801d8c7986Smrg	],
28811d8c7986Smrg	[C++], [
28821d8c7986Smrg		AC_REQUIRE([AC_PROG_CXX])
28831d8c7986Smrg	]
28841d8c7986Smrg)
28851d8c7986SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
28861d8c7986SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
28871d8c7986SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
28881d8c7986Smrg]) # XORG_COMPILER_BRAND
288983e5f723Smrg
28901d8c7986Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2891690143ccSmrg# ---------------
28921d8c7986Smrg# Minimum version: 1.16.0
28931d8c7986Smrg#
28941d8c7986Smrg# Test if the compiler works when passed the given flag as a command line argument.
28951d8c7986Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
28961d8c7986Smrg# next flag in the list until there are no more options.
28971d8c7986Smrg#
28981d8c7986Smrg# Note that this does not guarantee that the compiler supports the flag as some
28991d8c7986Smrg# compilers will simply ignore arguments that they do not understand, but we do
29001d8c7986Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
29011d8c7986Smrg# -Werror=unused-command-line-argument
29021d8c7986Smrg#
29031d8c7986SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
29041d8c7986Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29051d8c7986Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29061d8c7986Smrg
29071d8c7986SmrgAC_LANG_COMPILER_REQUIRE
29081d8c7986Smrg
29091d8c7986SmrgAC_LANG_CASE(
29101d8c7986Smrg	[C], [
29111d8c7986Smrg		AC_REQUIRE([AC_PROG_CC_C99])
29121d8c7986Smrg		define([PREFIX], [C])
29131d8c7986Smrg		define([CACHE_PREFIX], [cc])
29141d8c7986Smrg		define([COMPILER], [$CC])
29151d8c7986Smrg	],
29161d8c7986Smrg	[C++], [
29171d8c7986Smrg		define([PREFIX], [CXX])
29181d8c7986Smrg		define([CACHE_PREFIX], [cxx])
29191d8c7986Smrg		define([COMPILER], [$CXX])
29201d8c7986Smrg	]
29211d8c7986Smrg)
292283e5f723Smrg
29231d8c7986Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
29241d8c7986Smrg
29251d8c7986Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
29261d8c7986Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
29271d8c7986Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
29281d8c7986Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
29291d8c7986Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
29301d8c7986Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
29311d8c7986Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
29321d8c7986Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
29331d8c7986Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2934f46a6179Smrgfi
2935f46a6179Smrg
29361d8c7986Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
29371d8c7986Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
29381d8c7986Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
29391d8c7986Smrg	fi
29401d8c7986Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
29411d8c7986Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
29421d8c7986Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
29431d8c7986Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
29441d8c7986Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
29451d8c7986Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
29461d8c7986Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
29471d8c7986Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
29481d8c7986Smrgfi
294934345a63Smrg
29501d8c7986Smrgfound="no"
29511d8c7986Smrgm4_foreach([flag], m4_cdr($@), [
29521d8c7986Smrg	if test $found = "no" ; then
2953c82dfdfbSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
29541d8c7986Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
29551d8c7986Smrg		fi
29561d8c7986Smrg
2957c82dfdfbSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
29581d8c7986Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
29591d8c7986Smrg		fi
29601d8c7986Smrg
29611d8c7986Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
29621d8c7986Smrg
29631d8c7986Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2964c82dfdfbSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
29651d8c7986Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
29661d8c7986Smrg		AC_CACHE_VAL($cacheid,
29671d8c7986Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
29681d8c7986Smrg					     [eval $cacheid=yes],
29691d8c7986Smrg					     [eval $cacheid=no])])
29701d8c7986Smrg
29711d8c7986Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
29721d8c7986Smrg
29731d8c7986Smrg		eval supported=\$$cacheid
29741d8c7986Smrg		AC_MSG_RESULT([$supported])
29751d8c7986Smrg		if test "$supported" = "yes" ; then
29761d8c7986Smrg			$1="$$1 ]flag["
29771d8c7986Smrg			found="yes"
29781d8c7986Smrg		fi
29791d8c7986Smrg	fi
2980690143ccSmrg])
29811d8c7986Smrg]) # XORG_TESTSET_CFLAG
2982690143ccSmrg
29831d8c7986Smrg# XORG_COMPILER_FLAGS
29841d8c7986Smrg# ---------------
29851d8c7986Smrg# Minimum version: 1.16.0
298683e5f723Smrg#
29871d8c7986Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
29881d8c7986Smrg# arguments supported by the selected compiler which do NOT alter the generated
29891d8c7986Smrg# code.  These arguments will cause the compiler to print various warnings
29901d8c7986Smrg# during compilation AND turn a conservative set of warnings into errors.
29911d8c7986Smrg#
29921d8c7986Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
29931d8c7986Smrg# future versions of util-macros as options are added to new compilers.
29941d8c7986Smrg#
29951d8c7986SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
29961d8c7986SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2997690143ccSmrg
29981d8c7986SmrgAC_ARG_ENABLE(selective-werror,
29991d8c7986Smrg              AS_HELP_STRING([--disable-selective-werror],
30001d8c7986Smrg                             [Turn off selective compiler errors. (default: enabled)]),
30011d8c7986Smrg              [SELECTIVE_WERROR=$enableval],
30021d8c7986Smrg              [SELECTIVE_WERROR=yes])
30031d8c7986Smrg
30041d8c7986SmrgAC_LANG_CASE(
30051d8c7986Smrg        [C], [
30061d8c7986Smrg                define([PREFIX], [C])
30071d8c7986Smrg        ],
30081d8c7986Smrg        [C++], [
30091d8c7986Smrg                define([PREFIX], [CXX])
30101d8c7986Smrg        ]
30111d8c7986Smrg)
30121d8c7986Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
30131d8c7986Smrgif test "x$SUNCC" = "xyes"; then
30141d8c7986Smrg    [BASE_]PREFIX[FLAGS]="-v"
30151d8c7986Smrgelse
30161d8c7986Smrg    [BASE_]PREFIX[FLAGS]=""
3017690143ccSmrgfi
3018f46a6179Smrg
30191d8c7986Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
30201d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
30211d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
30221d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
30231d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
30241d8c7986Smrg
30251d8c7986SmrgAC_LANG_CASE(
30261d8c7986Smrg	[C], [
30271d8c7986Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
30281d8c7986Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
30291d8c7986Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
30301d8c7986Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
3031c82dfdfbSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
30321d8c7986Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
30331d8c7986Smrg	]
30341d8c7986Smrg)
30351d8c7986Smrg
30361d8c7986Smrg# This chunk adds additional warnings that could catch undesired effects.
30371d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
30381d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
30391d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
30401d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
30411d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
30421d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
3043c82dfdfbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
30441d8c7986Smrg
30451d8c7986Smrg# These are currently disabled because they are noisy.  They will be enabled
30461d8c7986Smrg# in the future once the codebase is sufficiently modernized to silence
30471d8c7986Smrg# them.  For now, I don't want them to drown out the other warnings.
30481d8c7986Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
30491d8c7986Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3050c82dfdfbSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
30511d8c7986Smrg
30521d8c7986Smrg# Turn some warnings into errors, so we don't accidently get successful builds
30531d8c7986Smrg# when there are problems that should be fixed.
30541d8c7986Smrg
30551d8c7986Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
30561d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
30571d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
30581d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
30591d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
30601d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
30611d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
30621d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
30631d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
30641d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
30651d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
30661d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
30671d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
30681d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
30691d8c7986Smrgelse
30701d8c7986SmrgAC_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])
30711d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
30721d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
30731d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
30741d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
30751d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
30761d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
30771d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
30781d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
30791d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
30801d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
30811d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
30821d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
30831d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
30841d8c7986Smrgfi
30851d8c7986Smrg
30861d8c7986SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
30871d8c7986Smrg]) # XORG_COMPILER_FLAGS
30881d8c7986Smrg
30891d8c7986Smrg# XORG_CWARNFLAGS
30901d8c7986Smrg# ---------------
30911d8c7986Smrg# Minimum version: 1.2.0
30921d8c7986Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3093690143ccSmrg#
30941d8c7986Smrg# Defines CWARNFLAGS to enable C compiler warnings.
30951d8c7986Smrg#
30961d8c7986Smrg# This function is deprecated because it defines -fno-strict-aliasing
30971d8c7986Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
30981d8c7986Smrg# is needed, then it should be added explicitly in the module when
30991d8c7986Smrg# it is updated to use BASE_CFLAGS.
31001d8c7986Smrg#
31011d8c7986SmrgAC_DEFUN([XORG_CWARNFLAGS], [
31021d8c7986SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
31031d8c7986SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
31041d8c7986SmrgAC_LANG_CASE(
31051d8c7986Smrg	[C], [
31061d8c7986Smrg		CWARNFLAGS="$BASE_CFLAGS"
31071d8c7986Smrg		if  test "x$GCC" = xyes ; then
31081d8c7986Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
31091d8c7986Smrg		fi
31101d8c7986Smrg		AC_SUBST(CWARNFLAGS)
31111d8c7986Smrg	]
31121d8c7986Smrg)
31131d8c7986Smrg]) # XORG_CWARNFLAGS
311483e5f723Smrg
31151d8c7986Smrg# XORG_STRICT_OPTION
31161d8c7986Smrg# -----------------------
31171d8c7986Smrg# Minimum version: 1.3.0
31181d8c7986Smrg#
31191d8c7986Smrg# Add configure option to enable strict compilation flags, such as treating
31201d8c7986Smrg# warnings as fatal errors.
31211d8c7986Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
31221d8c7986Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
31231d8c7986Smrg#
31241d8c7986Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
31251d8c7986Smrg# when strict compilation is unconditionally desired.
31261d8c7986SmrgAC_DEFUN([XORG_STRICT_OPTION], [
31271d8c7986SmrgAC_REQUIRE([XORG_CWARNFLAGS])
31281d8c7986SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
312983e5f723Smrg
31301d8c7986SmrgAC_ARG_ENABLE(strict-compilation,
31311d8c7986Smrg			  AS_HELP_STRING([--enable-strict-compilation],
31321d8c7986Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
31331d8c7986Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
313434345a63Smrg
31351d8c7986SmrgAC_LANG_CASE(
31361d8c7986Smrg        [C], [
31371d8c7986Smrg                define([PREFIX], [C])
31381d8c7986Smrg        ],
31391d8c7986Smrg        [C++], [
31401d8c7986Smrg                define([PREFIX], [CXX])
31411d8c7986Smrg        ]
31421d8c7986Smrg)
3143f46a6179Smrg
31441d8c7986Smrg[STRICT_]PREFIX[FLAGS]=""
31451d8c7986SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
31461d8c7986SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3147f46a6179Smrg
31481d8c7986Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
31491d8c7986Smrg# activate it with -Werror, so we add it here explicitly.
31501d8c7986SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
31515fac8b10Smrg
31521d8c7986Smrgif test "x$STRICT_COMPILE" = "xyes"; then
31531d8c7986Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
31541d8c7986Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
31551d8c7986Smrgfi
31561d8c7986SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
31571d8c7986SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
31581d8c7986SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
31591d8c7986Smrg]) # XORG_STRICT_OPTION
3160f46a6179Smrg
31611d8c7986Smrg# XORG_DEFAULT_OPTIONS
3162f46a6179Smrg# --------------------
31631d8c7986Smrg# Minimum version: 1.3.0
3164f46a6179Smrg#
31651d8c7986Smrg# Defines default options for X.Org modules.
3166f46a6179Smrg#
31671d8c7986SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
31681d8c7986SmrgAC_REQUIRE([AC_PROG_INSTALL])
31691d8c7986SmrgXORG_COMPILER_FLAGS
31701d8c7986SmrgXORG_CWARNFLAGS
31711d8c7986SmrgXORG_STRICT_OPTION
31721d8c7986SmrgXORG_RELEASE_VERSION
31731d8c7986SmrgXORG_CHANGELOG
31741d8c7986SmrgXORG_INSTALL
31751d8c7986SmrgXORG_MANPAGE_SECTIONS
31761d8c7986Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
31771d8c7986Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
31781d8c7986Smrg]) # XORG_DEFAULT_OPTIONS
317983e5f723Smrg
31801d8c7986Smrg# XORG_INSTALL()
31811d8c7986Smrg# ----------------
31821d8c7986Smrg# Minimum version: 1.4.0
31831d8c7986Smrg#
31841d8c7986Smrg# Defines the variable INSTALL_CMD as the command to copy
31851d8c7986Smrg# INSTALL from $prefix/share/util-macros.
31861d8c7986Smrg#
31871d8c7986SmrgAC_DEFUN([XORG_INSTALL], [
31881d8c7986SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
31891d8c7986Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
31901d8c7986SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
31911d8c7986Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
31921d8c7986Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
31931d8c7986Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
31941d8c7986SmrgAC_SUBST([INSTALL_CMD])
31951d8c7986Smrg]) # XORG_INSTALL
31961d8c7986Smrgdnl Copyright 2005 Red Hat, Inc
31971d8c7986Smrgdnl
31981d8c7986Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
31991d8c7986Smrgdnl documentation for any purpose is hereby granted without fee, provided that
32001d8c7986Smrgdnl the above copyright notice appear in all copies and that both that
32011d8c7986Smrgdnl copyright notice and this permission notice appear in supporting
32021d8c7986Smrgdnl documentation.
32031d8c7986Smrgdnl
32041d8c7986Smrgdnl The above copyright notice and this permission notice shall be included
32051d8c7986Smrgdnl in all copies or substantial portions of the Software.
32061d8c7986Smrgdnl
32071d8c7986Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
32081d8c7986Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32091d8c7986Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
32101d8c7986Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
32111d8c7986Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
32121d8c7986Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
32131d8c7986Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
32141d8c7986Smrgdnl
32151d8c7986Smrgdnl Except as contained in this notice, the name of the copyright holders shall
32161d8c7986Smrgdnl not be used in advertising or otherwise to promote the sale, use or
32171d8c7986Smrgdnl other dealings in this Software without prior written authorization
32181d8c7986Smrgdnl from the copyright holders.
32191d8c7986Smrgdnl
3220f46a6179Smrg
32211d8c7986Smrg# XORG_RELEASE_VERSION
32221d8c7986Smrg# --------------------
32231d8c7986Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3224c82dfdfbSmrg
32251d8c7986SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
32261d8c7986Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
32271d8c7986Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
32281d8c7986Smrg		[Major version of this package])
32291d8c7986Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
32301d8c7986Smrg	if test "x$PVM" = "x"; then
32311d8c7986Smrg		PVM="0"
32321d8c7986Smrg	fi
32331d8c7986Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
32341d8c7986Smrg		[$PVM],
32351d8c7986Smrg		[Minor version of this package])
32361d8c7986Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
32371d8c7986Smrg	if test "x$PVP" = "x"; then
32381d8c7986Smrg		PVP="0"
32391d8c7986Smrg	fi
32401d8c7986Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
32411d8c7986Smrg		[$PVP],
32421d8c7986Smrg		[Patch version of this package])
32431d8c7986Smrg])
3244f46a6179Smrg
32451d8c7986Smrg# XORG_CHANGELOG()
32461d8c7986Smrg# ----------------
32471d8c7986Smrg# Minimum version: 1.2.0
32481d8c7986Smrg#
32491d8c7986Smrg# Defines the variable CHANGELOG_CMD as the command to generate
32501d8c7986Smrg# ChangeLog from git.
32511d8c7986Smrg#
32521d8c7986Smrg#
32531d8c7986SmrgAC_DEFUN([XORG_CHANGELOG], [
32541d8c7986SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
32551d8c7986Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
32561d8c7986Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
32571d8c7986Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
32581d8c7986SmrgAC_SUBST([CHANGELOG_CMD])
32591d8c7986Smrg]) # XORG_CHANGELOG
3260f46a6179Smrg
3261