aclocal.m4 revision 0309d3b3
10309d3b3Smrg# generated automatically by aclocal 1.11.3 -*- Autoconf -*-
2b1297603Smrg
3b1297603Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
40309d3b3Smrg# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
50309d3b3Smrg# Inc.
6b1297603Smrg# This file is free software; the Free Software Foundation
7b1297603Smrg# gives unlimited permission to copy and/or distribute it,
8b1297603Smrg# with or without modifications, as long as this notice is preserved.
9b1297603Smrg
10b1297603Smrg# This program is distributed in the hope that it will be useful,
11b1297603Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
12b1297603Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13b1297603Smrg# PARTICULAR PURPOSE.
14b1297603Smrg
155b944e2aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
165b944e2aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
170309d3b3Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
180309d3b3Smrg[m4_warning([this file was generated for autoconf 2.68.
195b944e2aSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
205b944e2aSmrgIf you have problems, you may need to regenerate the build system entirely.
215b944e2aSmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
225b944e2aSmrg
23b1297603Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
2454e0bb33Smrg# serial 1 (pkg-config-0.24)
25b1297603Smrg# 
26b1297603Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
27b1297603Smrg#
28b1297603Smrg# This program is free software; you can redistribute it and/or modify
29b1297603Smrg# it under the terms of the GNU General Public License as published by
30b1297603Smrg# the Free Software Foundation; either version 2 of the License, or
31b1297603Smrg# (at your option) any later version.
32b1297603Smrg#
33b1297603Smrg# This program is distributed in the hope that it will be useful, but
34b1297603Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
35b1297603Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
36b1297603Smrg# General Public License for more details.
37b1297603Smrg#
38b1297603Smrg# You should have received a copy of the GNU General Public License
39b1297603Smrg# along with this program; if not, write to the Free Software
40b1297603Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
41b1297603Smrg#
42b1297603Smrg# As a special exception to the GNU General Public License, if you
43b1297603Smrg# distribute this file as part of a program that contains a
44b1297603Smrg# configuration script generated by Autoconf, you may include it under
45b1297603Smrg# the same distribution terms that you use for the rest of that program.
46b1297603Smrg
47b1297603Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
48b1297603Smrg# ----------------------------------
49b1297603SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
50b1297603Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
51b1297603Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
5254e0bb33SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
5354e0bb33SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
5454e0bb33SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
5554e0bb33Smrg
56b1297603Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
57b1297603Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
58b1297603Smrgfi
59b1297603Smrgif test -n "$PKG_CONFIG"; then
60b1297603Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
61b1297603Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
62b1297603Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
63b1297603Smrg		AC_MSG_RESULT([yes])
64b1297603Smrg	else
65b1297603Smrg		AC_MSG_RESULT([no])
66b1297603Smrg		PKG_CONFIG=""
67b1297603Smrg	fi
68b1297603Smrgfi[]dnl
69b1297603Smrg])# PKG_PROG_PKG_CONFIG
70b1297603Smrg
71b1297603Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
72b1297603Smrg#
73b1297603Smrg# Check to see whether a particular set of modules exists.  Similar
74b1297603Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
75b1297603Smrg#
7654e0bb33Smrg# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
7754e0bb33Smrg# only at the first occurence in configure.ac, so if the first place
7854e0bb33Smrg# it's called might be skipped (such as if it is within an "if", you
7954e0bb33Smrg# have to call PKG_CHECK_EXISTS manually
80b1297603Smrg# --------------------------------------------------------------
81b1297603SmrgAC_DEFUN([PKG_CHECK_EXISTS],
82b1297603Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
83b1297603Smrgif test -n "$PKG_CONFIG" && \
84b1297603Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
8554e0bb33Smrg  m4_default([$2], [:])
86b1297603Smrgm4_ifvaln([$3], [else
87b1297603Smrg  $3])dnl
88b1297603Smrgfi])
89b1297603Smrg
90b1297603Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
91b1297603Smrg# ---------------------------------------------
92b1297603Smrgm4_define([_PKG_CONFIG],
935b944e2aSmrg[if test -n "$$1"; then
945b944e2aSmrg    pkg_cv_[]$1="$$1"
955b944e2aSmrg elif test -n "$PKG_CONFIG"; then
965b944e2aSmrg    PKG_CHECK_EXISTS([$3],
975b944e2aSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
985b944e2aSmrg		     [pkg_failed=yes])
995b944e2aSmrg else
1005b944e2aSmrg    pkg_failed=untried
101b1297603Smrgfi[]dnl
102b1297603Smrg])# _PKG_CONFIG
103b1297603Smrg
104b1297603Smrg# _PKG_SHORT_ERRORS_SUPPORTED
105b1297603Smrg# -----------------------------
106b1297603SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
107b1297603Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
108b1297603Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
109b1297603Smrg        _pkg_short_errors_supported=yes
110b1297603Smrgelse
111b1297603Smrg        _pkg_short_errors_supported=no
112b1297603Smrgfi[]dnl
113b1297603Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
114b1297603Smrg
115b1297603Smrg
116b1297603Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
117b1297603Smrg# [ACTION-IF-NOT-FOUND])
118b1297603Smrg#
119b1297603Smrg#
120b1297603Smrg# Note that if there is a possibility the first call to
121b1297603Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
122b1297603Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
123b1297603Smrg#
124b1297603Smrg#
125b1297603Smrg# --------------------------------------------------------------
126b1297603SmrgAC_DEFUN([PKG_CHECK_MODULES],
127b1297603Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
128b1297603SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
129b1297603SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
130b1297603Smrg
131b1297603Smrgpkg_failed=no
132b1297603SmrgAC_MSG_CHECKING([for $1])
133b1297603Smrg
134b1297603Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
135b1297603Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
136b1297603Smrg
137b1297603Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
138b1297603Smrgand $1[]_LIBS to avoid the need to call pkg-config.
139b1297603SmrgSee the pkg-config man page for more details.])
140b1297603Smrg
141b1297603Smrgif test $pkg_failed = yes; then
14254e0bb33Smrg   	AC_MSG_RESULT([no])
143b1297603Smrg        _PKG_SHORT_ERRORS_SUPPORTED
144b1297603Smrg        if test $_pkg_short_errors_supported = yes; then
1455b944e2aSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
146b1297603Smrg        else 
1475b944e2aSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
148b1297603Smrg        fi
149b1297603Smrg	# Put the nasty error message in config.log where it belongs
150b1297603Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
151b1297603Smrg
15254e0bb33Smrg	m4_default([$4], [AC_MSG_ERROR(
153b1297603Smrg[Package requirements ($2) were not met:
154b1297603Smrg
155b1297603Smrg$$1_PKG_ERRORS
156b1297603Smrg
157b1297603SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
158b1297603Smrginstalled software in a non-standard prefix.
159b1297603Smrg
16054e0bb33Smrg_PKG_TEXT])
16154e0bb33Smrg        ])
162b1297603Smrgelif test $pkg_failed = untried; then
16354e0bb33Smrg     	AC_MSG_RESULT([no])
16454e0bb33Smrg	m4_default([$4], [AC_MSG_FAILURE(
165b1297603Smrg[The pkg-config script could not be found or is too old.  Make sure it
166b1297603Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
167b1297603Smrgpath to pkg-config.
168b1297603Smrg
169b1297603Smrg_PKG_TEXT
170b1297603Smrg
17154e0bb33SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])
17254e0bb33Smrg        ])
173b1297603Smrgelse
174b1297603Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
175b1297603Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
176b1297603Smrg        AC_MSG_RESULT([yes])
17754e0bb33Smrg	$3
178b1297603Smrgfi[]dnl
179b1297603Smrg])# PKG_CHECK_MODULES
180b1297603Smrg
18154e0bb33Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
18254e0bb33Smrgdnl
1830309d3b3Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
18454e0bb33Smrgdnl 
18554e0bb33Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
18654e0bb33Smrgdnl copy of this software and associated documentation files (the "Software"),
18754e0bb33Smrgdnl to deal in the Software without restriction, including without limitation
18854e0bb33Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
18954e0bb33Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
19054e0bb33Smrgdnl Software is furnished to do so, subject to the following conditions:
19154e0bb33Smrgdnl
19254e0bb33Smrgdnl The above copyright notice and this permission notice (including the next
19354e0bb33Smrgdnl paragraph) shall be included in all copies or substantial portions of the
19454e0bb33Smrgdnl Software.
19554e0bb33Smrgdnl
19654e0bb33Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19754e0bb33Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19854e0bb33Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19954e0bb33Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20054e0bb33Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20154e0bb33Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20254e0bb33Smrgdnl DEALINGS IN THE SOFTWARE.
203cea37944Smrg
20454e0bb33Smrg# XORG_MACROS_VERSION(required-version)
20554e0bb33Smrg# -------------------------------------
20654e0bb33Smrg# Minimum version: 1.1.0
2075b944e2aSmrg#
20854e0bb33Smrg# If you're using a macro added in Version 1.1 or newer, include this in
20954e0bb33Smrg# your configure.ac with the minimum required version, such as:
21054e0bb33Smrg# XORG_MACROS_VERSION(1.1)
2115b944e2aSmrg#
21254e0bb33Smrg# To ensure that this macro is defined, also add:
21354e0bb33Smrg# m4_ifndef([XORG_MACROS_VERSION],
21454e0bb33Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
215cea37944Smrg#
216cea37944Smrg#
21754e0bb33Smrg# See the "minimum version" comment for each macro you use to see what 
21854e0bb33Smrg# version you require.
21954e0bb33Smrgm4_defun([XORG_MACROS_VERSION],[
2200309d3b3Smrgm4_define([vers_have], [1.16.1])
22154e0bb33Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
22254e0bb33Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
22354e0bb33Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
22454e0bb33Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
22554e0bb33Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
22654e0bb33Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
22754e0bb33Smrgm4_undefine([vers_have])
22854e0bb33Smrgm4_undefine([maj_have])
22954e0bb33Smrgm4_undefine([maj_needed])
23054e0bb33Smrg]) # XORG_MACROS_VERSION
231cea37944Smrg
23254e0bb33Smrg# XORG_PROG_RAWCPP()
23354e0bb33Smrg# ------------------
23454e0bb33Smrg# Minimum version: 1.0.0
235b1297603Smrg#
23654e0bb33Smrg# Find cpp program and necessary flags for use in pre-processing text files
23754e0bb33Smrg# such as man pages and config files
23854e0bb33SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
23954e0bb33SmrgAC_REQUIRE([AC_PROG_CPP])
24054e0bb33SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
24154e0bb33Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
242b1297603Smrg
24354e0bb33Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
24454e0bb33Smrg# which is not the best choice for supporting other OS'es, but covers most
24554e0bb33Smrg# of the ones we need for now.
24654e0bb33SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
2470309d3b3SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
24854e0bb33Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
24954e0bb33Smrg	AC_MSG_RESULT([no])
25054e0bb33Smrgelse
25154e0bb33Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
25254e0bb33Smrg		RAWCPPFLAGS=-undef
25354e0bb33Smrg		AC_MSG_RESULT([yes])
25454e0bb33Smrg	# under Cygwin unix is still defined even with -undef
25554e0bb33Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
25654e0bb33Smrg		RAWCPPFLAGS="-undef -ansi"
25754e0bb33Smrg		AC_MSG_RESULT([yes, with -ansi])
25854e0bb33Smrg	else
25954e0bb33Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
26054e0bb33Smrg	fi
26154e0bb33Smrgfi
26254e0bb33Smrgrm -f conftest.$ac_ext
263b1297603Smrg
26454e0bb33SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
2650309d3b3SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
26654e0bb33Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
26754e0bb33Smrg	AC_MSG_RESULT([no])
268b1297603Smrgelse
26954e0bb33Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
27054e0bb33Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
27154e0bb33Smrg		AC_MSG_RESULT([yes])
27254e0bb33Smrg	else
27354e0bb33Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
27454e0bb33Smrg	fi
275b1297603Smrgfi
27654e0bb33Smrgrm -f conftest.$ac_ext
27754e0bb33SmrgAC_SUBST(RAWCPPFLAGS)
27854e0bb33Smrg]) # XORG_PROG_RAWCPP
279b1297603Smrg
28054e0bb33Smrg# XORG_MANPAGE_SECTIONS()
28154e0bb33Smrg# -----------------------
28254e0bb33Smrg# Minimum version: 1.0.0
283b1297603Smrg#
28454e0bb33Smrg# Determine which sections man pages go in for the different man page types
28554e0bb33Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
28654e0bb33Smrg# Not sure if there's any better way than just hardcoding by OS name.
28754e0bb33Smrg# Override default settings by setting environment variables
28854e0bb33Smrg# Added MAN_SUBSTS in version 1.8
28954e0bb33Smrg# Added AC_PROG_SED in version 1.8
290b1297603Smrg
29154e0bb33SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
29254e0bb33SmrgAC_REQUIRE([AC_CANONICAL_HOST])
29354e0bb33SmrgAC_REQUIRE([AC_PROG_SED])
294b1297603Smrg
29554e0bb33Smrgif test x$APP_MAN_SUFFIX = x    ; then
29654e0bb33Smrg    APP_MAN_SUFFIX=1
29754e0bb33Smrgfi
29854e0bb33Smrgif test x$APP_MAN_DIR = x    ; then
29954e0bb33Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
30054e0bb33Smrgfi
301b1297603Smrg
30254e0bb33Smrgif test x$LIB_MAN_SUFFIX = x    ; then
30354e0bb33Smrg    LIB_MAN_SUFFIX=3
30454e0bb33Smrgfi
30554e0bb33Smrgif test x$LIB_MAN_DIR = x    ; then
30654e0bb33Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
30754e0bb33Smrgfi
308b1297603Smrg
30954e0bb33Smrgif test x$FILE_MAN_SUFFIX = x    ; then
31054e0bb33Smrg    case $host_os in
31154e0bb33Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
31254e0bb33Smrg	*)		FILE_MAN_SUFFIX=5  ;;
31354e0bb33Smrg    esac
31454e0bb33Smrgfi
31554e0bb33Smrgif test x$FILE_MAN_DIR = x    ; then
31654e0bb33Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
31754e0bb33Smrgfi
318b1297603Smrg
31954e0bb33Smrgif test x$MISC_MAN_SUFFIX = x    ; then
32054e0bb33Smrg    case $host_os in
32154e0bb33Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
32254e0bb33Smrg	*)		MISC_MAN_SUFFIX=7  ;;
32354e0bb33Smrg    esac
32454e0bb33Smrgfi
32554e0bb33Smrgif test x$MISC_MAN_DIR = x    ; then
32654e0bb33Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
32754e0bb33Smrgfi
328b1297603Smrg
32954e0bb33Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
33054e0bb33Smrg    case $host_os in
33154e0bb33Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
33254e0bb33Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
33354e0bb33Smrg    esac
33454e0bb33Smrgfi
33554e0bb33Smrgif test x$DRIVER_MAN_DIR = x    ; then
33654e0bb33Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
33754e0bb33Smrgfi
338b1297603Smrg
33954e0bb33Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
34054e0bb33Smrg    case $host_os in
34154e0bb33Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
34254e0bb33Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
343cea37944Smrg    esac
34454e0bb33Smrgfi
34554e0bb33Smrgif test x$ADMIN_MAN_DIR = x    ; then
34654e0bb33Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
34754e0bb33Smrgfi
348b1297603Smrg
34954e0bb33Smrg
35054e0bb33SmrgAC_SUBST([APP_MAN_SUFFIX])
35154e0bb33SmrgAC_SUBST([LIB_MAN_SUFFIX])
35254e0bb33SmrgAC_SUBST([FILE_MAN_SUFFIX])
35354e0bb33SmrgAC_SUBST([MISC_MAN_SUFFIX])
35454e0bb33SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
35554e0bb33SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
35654e0bb33SmrgAC_SUBST([APP_MAN_DIR])
35754e0bb33SmrgAC_SUBST([LIB_MAN_DIR])
35854e0bb33SmrgAC_SUBST([FILE_MAN_DIR])
35954e0bb33SmrgAC_SUBST([MISC_MAN_DIR])
36054e0bb33SmrgAC_SUBST([DRIVER_MAN_DIR])
36154e0bb33SmrgAC_SUBST([ADMIN_MAN_DIR])
36254e0bb33Smrg
36354e0bb33SmrgXORG_MAN_PAGE="X Version 11"
36454e0bb33SmrgAC_SUBST([XORG_MAN_PAGE])
36554e0bb33SmrgMAN_SUBSTS="\
36654e0bb33Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
36754e0bb33Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
36854e0bb33Smrg	-e 's|__xservername__|Xorg|g' \
36954e0bb33Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
37054e0bb33Smrg	-e 's|__projectroot__|\$(prefix)|g' \
3710309d3b3Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
37254e0bb33Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
37354e0bb33Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
37454e0bb33Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
37554e0bb33Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
37654e0bb33Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
37754e0bb33Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
37854e0bb33SmrgAC_SUBST([MAN_SUBSTS])
37954e0bb33Smrg
38054e0bb33Smrg]) # XORG_MANPAGE_SECTIONS
38154e0bb33Smrg
38254e0bb33Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
38354e0bb33Smrg# ------------------------
38454e0bb33Smrg# Minimum version: 1.7.0
38554e0bb33Smrg#
38654e0bb33Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
38754e0bb33Smrg# provided by xorg-sgml-doctools, if installed.
38854e0bb33SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
38954e0bb33SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
39054e0bb33SmrgXORG_SGML_PATH=
39154e0bb33SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
39254e0bb33Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
39354e0bb33Smrg    [m4_ifval([$1],[:],
39454e0bb33Smrg        [if test x"$cross_compiling" != x"yes" ; then
39554e0bb33Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
39654e0bb33Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
39754e0bb33Smrg         fi])
39854e0bb33Smrg    ])
39954e0bb33Smrg
40054e0bb33Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
40154e0bb33Smrg# the path and the name of the doc stylesheet
40254e0bb33Smrgif test "x$XORG_SGML_PATH" != "x" ; then
40354e0bb33Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
40454e0bb33Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
40554e0bb33Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
40653719b08Smrgelse
40754e0bb33Smrg   AC_MSG_RESULT([no])
40853719b08Smrgfi
409b1297603Smrg
41054e0bb33SmrgAC_SUBST(XORG_SGML_PATH)
41154e0bb33SmrgAC_SUBST(STYLESHEET_SRCDIR)
41254e0bb33SmrgAC_SUBST(XSL_STYLESHEET)
41354e0bb33SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
41454e0bb33Smrg]) # XORG_CHECK_SGML_DOCTOOLS
415b1297603Smrg
41654e0bb33Smrg# XORG_CHECK_LINUXDOC
41754e0bb33Smrg# -------------------
41854e0bb33Smrg# Minimum version: 1.0.0
41954e0bb33Smrg#
42054e0bb33Smrg# Defines the variable MAKE_TEXT if the necessary tools and
42154e0bb33Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
42254e0bb33Smrg# Whether or not the necessary tools and files are found can be checked
42354e0bb33Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
42454e0bb33SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
42554e0bb33SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
42654e0bb33SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
42754e0bb33Smrg
42854e0bb33SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
4295b944e2aSmrg
43054e0bb33SmrgAC_MSG_CHECKING([whether to build documentation])
431b1297603Smrg
43254e0bb33Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
43354e0bb33Smrg   BUILDDOC=yes
43454e0bb33Smrgelse
43554e0bb33Smrg   BUILDDOC=no
43653719b08Smrgfi
437b1297603Smrg
43854e0bb33SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
43953719b08Smrg
44054e0bb33SmrgAC_MSG_RESULT([$BUILDDOC])
441b1297603Smrg
44254e0bb33SmrgAC_MSG_CHECKING([whether to build pdf documentation])
443b1297603Smrg
44454e0bb33Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
44554e0bb33Smrg   BUILDPDFDOC=yes
44654e0bb33Smrgelse
44754e0bb33Smrg   BUILDPDFDOC=no
44854e0bb33Smrgfi
449cea37944Smrg
45054e0bb33SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
451cea37944Smrg
45254e0bb33SmrgAC_MSG_RESULT([$BUILDPDFDOC])
453cea37944Smrg
45454e0bb33SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
45554e0bb33SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
45654e0bb33SmrgMAKE_PDF="$PS2PDF"
45754e0bb33SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
458cea37944Smrg
45954e0bb33SmrgAC_SUBST(MAKE_TEXT)
46054e0bb33SmrgAC_SUBST(MAKE_PS)
46154e0bb33SmrgAC_SUBST(MAKE_PDF)
46254e0bb33SmrgAC_SUBST(MAKE_HTML)
46354e0bb33Smrg]) # XORG_CHECK_LINUXDOC
464cea37944Smrg
46554e0bb33Smrg# XORG_CHECK_DOCBOOK
46654e0bb33Smrg# -------------------
46754e0bb33Smrg# Minimum version: 1.0.0
46853719b08Smrg#
46954e0bb33Smrg# Checks for the ability to build output formats from SGML DocBook source.
47054e0bb33Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
47154e0bb33Smrg# indicates whether the necessary tools and files are found and, if set,
47254e0bb33Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
47354e0bb33SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
47454e0bb33SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
47553719b08Smrg
47654e0bb33SmrgBUILDTXTDOC=no
47754e0bb33SmrgBUILDPDFDOC=no
47854e0bb33SmrgBUILDPSDOC=no
47954e0bb33SmrgBUILDHTMLDOC=no
480cea37944Smrg
48154e0bb33SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
48254e0bb33SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
48354e0bb33SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
48454e0bb33SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
485cea37944Smrg
48654e0bb33SmrgAC_MSG_CHECKING([whether to build text documentation])
48754e0bb33Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
48854e0bb33Smrg   test x$BUILD_TXTDOC != xno; then
48954e0bb33Smrg	BUILDTXTDOC=yes
49053719b08Smrgfi
49154e0bb33SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
49254e0bb33SmrgAC_MSG_RESULT([$BUILDTXTDOC])
493b1297603Smrg
49454e0bb33SmrgAC_MSG_CHECKING([whether to build PDF documentation])
49554e0bb33Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
49654e0bb33Smrg   test x$BUILD_PDFDOC != xno; then
49754e0bb33Smrg	BUILDPDFDOC=yes
498cea37944Smrgfi
49954e0bb33SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
50054e0bb33SmrgAC_MSG_RESULT([$BUILDPDFDOC])
501cea37944Smrg
50254e0bb33SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
50354e0bb33Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
50454e0bb33Smrg   test x$BUILD_PSDOC != xno; then
50554e0bb33Smrg	BUILDPSDOC=yes
50654e0bb33Smrgfi
50754e0bb33SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
50854e0bb33SmrgAC_MSG_RESULT([$BUILDPSDOC])
509cea37944Smrg
51054e0bb33SmrgAC_MSG_CHECKING([whether to build HTML documentation])
51154e0bb33Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
51254e0bb33Smrg   test x$BUILD_HTMLDOC != xno; then
51354e0bb33Smrg	BUILDHTMLDOC=yes
51454e0bb33Smrgfi
51554e0bb33SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
51654e0bb33SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
517cea37944Smrg
51854e0bb33SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
51954e0bb33SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
52054e0bb33SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
52154e0bb33SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
522cea37944Smrg
52354e0bb33SmrgAC_SUBST(MAKE_TEXT)
52454e0bb33SmrgAC_SUBST(MAKE_PS)
52554e0bb33SmrgAC_SUBST(MAKE_PDF)
52654e0bb33SmrgAC_SUBST(MAKE_HTML)
52754e0bb33Smrg]) # XORG_CHECK_DOCBOOK
528cea37944Smrg
5290309d3b3Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
53054e0bb33Smrg# ----------------
53154e0bb33Smrg# Minimum version: 1.5.0
5320309d3b3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
53353719b08Smrg#
53454e0bb33Smrg# Documentation tools are not always available on all platforms and sometimes
53554e0bb33Smrg# not at the appropriate level. This macro enables a module to test for the
53654e0bb33Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
53754e0bb33Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
5380309d3b3Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
5390309d3b3Smrg# --with-xmlto assumes 'auto'.
54053719b08Smrg#
54154e0bb33Smrg# Interface to module:
54254e0bb33Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
54354e0bb33Smrg# XMLTO:	returns the path of the xmlto program found
54454e0bb33Smrg#		returns the path set by the user in the environment
54554e0bb33Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
54654e0bb33Smrg#		'no' user instructs the module not to use xmlto
54754e0bb33Smrg#
54854e0bb33Smrg# Added in version 1.10.0
54954e0bb33Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
55054e0bb33Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
55154e0bb33Smrg#
55254e0bb33Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
55354e0bb33Smrg#
55454e0bb33SmrgAC_DEFUN([XORG_WITH_XMLTO],[
55554e0bb33SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
5560309d3b3Smrgm4_define([_defopt], m4_default([$2], [auto]))
55754e0bb33SmrgAC_ARG_WITH(xmlto,
55854e0bb33Smrg	AS_HELP_STRING([--with-xmlto],
5590309d3b3Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
5600309d3b3Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
5610309d3b3Smrgm4_undefine([_defopt])
562cea37944Smrg
56354e0bb33Smrgif test "x$use_xmlto" = x"auto"; then
56454e0bb33Smrg   AC_PATH_PROG([XMLTO], [xmlto])
56554e0bb33Smrg   if test "x$XMLTO" = "x"; then
56654e0bb33Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
56754e0bb33Smrg	have_xmlto=no
56854e0bb33Smrg   else
56954e0bb33Smrg        have_xmlto=yes
57054e0bb33Smrg   fi
57154e0bb33Smrgelif test "x$use_xmlto" = x"yes" ; then
57254e0bb33Smrg   AC_PATH_PROG([XMLTO], [xmlto])
57354e0bb33Smrg   if test "x$XMLTO" = "x"; then
57454e0bb33Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
57554e0bb33Smrg   fi
57654e0bb33Smrg   have_xmlto=yes
57754e0bb33Smrgelif test "x$use_xmlto" = x"no" ; then
57854e0bb33Smrg   if test "x$XMLTO" != "x"; then
57954e0bb33Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
58054e0bb33Smrg   fi
58154e0bb33Smrg   have_xmlto=no
58253719b08Smrgelse
58354e0bb33Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
58453719b08Smrgfi
585cea37944Smrg
58654e0bb33Smrg# Test for a minimum version of xmlto, if provided.
58754e0bb33Smrgm4_ifval([$1],
58854e0bb33Smrg[if test "$have_xmlto" = yes; then
58954e0bb33Smrg    # scrape the xmlto version
59054e0bb33Smrg    AC_MSG_CHECKING([the xmlto version])
59154e0bb33Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
59254e0bb33Smrg    AC_MSG_RESULT([$xmlto_version])
59354e0bb33Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
59454e0bb33Smrg        [if test "x$use_xmlto" = xauto; then
59554e0bb33Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
59654e0bb33Smrg            have_xmlto=no
59754e0bb33Smrg        else
59854e0bb33Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
59954e0bb33Smrg        fi])
60054e0bb33Smrgfi])
601cea37944Smrg
60254e0bb33Smrg# Test for the ability of xmlto to generate a text target
60354e0bb33Smrghave_xmlto_text=no
60454e0bb33Smrgcat > conftest.xml << "EOF"
60554e0bb33SmrgEOF
60654e0bb33SmrgAS_IF([test "$have_xmlto" = yes],
60754e0bb33Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
60854e0bb33Smrg             [have_xmlto_text=yes],
60954e0bb33Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
61054e0bb33Smrgrm -f conftest.xml
61154e0bb33SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
61254e0bb33SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
61354e0bb33Smrg]) # XORG_WITH_XMLTO
614cea37944Smrg
6150309d3b3Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
6160309d3b3Smrg# --------------------------------------------
6170309d3b3Smrg# Minimum version: 1.12.0
6180309d3b3Smrg# Minimum version for optional DEFAULT argument: 1.12.0
6190309d3b3Smrg#
6200309d3b3Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
6210309d3b3Smrg# XML-based language used for the transformation of XML documents.
6220309d3b3Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
6230309d3b3Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
6240309d3b3Smrg# The XSLT processor is often used as a standalone tool for transformations.
6250309d3b3Smrg# It should not be assumed that this tool is used only to work with documnetation.
6260309d3b3Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
6270309d3b3Smrg#
6280309d3b3Smrg# Interface to module:
6290309d3b3Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
6300309d3b3Smrg# XSLTPROC:	 returns the path of the xsltproc program found
6310309d3b3Smrg#		 returns the path set by the user in the environment
6320309d3b3Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
6330309d3b3Smrg#		  'no' user instructs the module not to use xsltproc
6340309d3b3Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
6350309d3b3Smrg#
6360309d3b3Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
6370309d3b3Smrg#
6380309d3b3SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
6390309d3b3SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
6400309d3b3Smrg# Preserves the interface, should it be implemented later
6410309d3b3Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
6420309d3b3Smrgm4_define([_defopt], m4_default([$2], [auto]))
6430309d3b3SmrgAC_ARG_WITH(xsltproc,
6440309d3b3Smrg	AS_HELP_STRING([--with-xsltproc],
6450309d3b3Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
6460309d3b3Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
6470309d3b3Smrgm4_undefine([_defopt])
6480309d3b3Smrg
6490309d3b3Smrgif test "x$use_xsltproc" = x"auto"; then
6500309d3b3Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
6510309d3b3Smrg   if test "x$XSLTPROC" = "x"; then
6520309d3b3Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
6530309d3b3Smrg	have_xsltproc=no
6540309d3b3Smrg   else
6550309d3b3Smrg        have_xsltproc=yes
6560309d3b3Smrg   fi
6570309d3b3Smrgelif test "x$use_xsltproc" = x"yes" ; then
6580309d3b3Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
6590309d3b3Smrg   if test "x$XSLTPROC" = "x"; then
6600309d3b3Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
6610309d3b3Smrg   fi
6620309d3b3Smrg   have_xsltproc=yes
6630309d3b3Smrgelif test "x$use_xsltproc" = x"no" ; then
6640309d3b3Smrg   if test "x$XSLTPROC" != "x"; then
6650309d3b3Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
6660309d3b3Smrg   fi
6670309d3b3Smrg   have_xsltproc=no
6680309d3b3Smrgelse
6690309d3b3Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
6700309d3b3Smrgfi
6710309d3b3Smrg
6720309d3b3SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
6730309d3b3Smrg]) # XORG_WITH_XSLTPROC
6740309d3b3Smrg
6750309d3b3Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
6760309d3b3Smrg# ----------------------------------------
6770309d3b3Smrg# Minimum version: 1.15.0
6780309d3b3Smrg#
6790309d3b3Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
6800309d3b3Smrg# scanning arbitrary text files, extracting information from those text files,
6810309d3b3Smrg# and printing reports based on that information.
6820309d3b3Smrg#
6830309d3b3Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
6840309d3b3Smrg#
6850309d3b3Smrg# Interface to module:
6860309d3b3Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
6870309d3b3Smrg# PERL:	     returns the path of the perl program found
6880309d3b3Smrg#	     returns the path set by the user in the environment
6890309d3b3Smrg# --with-perl: 'yes' user instructs the module to use perl
6900309d3b3Smrg#	       'no' user instructs the module not to use perl
6910309d3b3Smrg# have_perl: returns yes if perl found in PATH or no
6920309d3b3Smrg#
6930309d3b3Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
6940309d3b3Smrg#
6950309d3b3SmrgAC_DEFUN([XORG_WITH_PERL],[
6960309d3b3SmrgAC_ARG_VAR([PERL], [Path to perl command])
6970309d3b3Smrg# Preserves the interface, should it be implemented later
6980309d3b3Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
6990309d3b3Smrgm4_define([_defopt], m4_default([$2], [auto]))
7000309d3b3SmrgAC_ARG_WITH(perl,
7010309d3b3Smrg	AS_HELP_STRING([--with-perl],
7020309d3b3Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
7030309d3b3Smrg	   [use_perl=$withval], [use_perl=]_defopt)
7040309d3b3Smrgm4_undefine([_defopt])
7050309d3b3Smrg
7060309d3b3Smrgif test "x$use_perl" = x"auto"; then
7070309d3b3Smrg   AC_PATH_PROG([PERL], [perl])
7080309d3b3Smrg   if test "x$PERL" = "x"; then
7090309d3b3Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
7100309d3b3Smrg	have_perl=no
7110309d3b3Smrg   else
7120309d3b3Smrg        have_perl=yes
7130309d3b3Smrg   fi
7140309d3b3Smrgelif test "x$use_perl" = x"yes" ; then
7150309d3b3Smrg   AC_PATH_PROG([PERL], [perl])
7160309d3b3Smrg   if test "x$PERL" = "x"; then
7170309d3b3Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
7180309d3b3Smrg   fi
7190309d3b3Smrg   have_perl=yes
7200309d3b3Smrgelif test "x$use_perl" = x"no" ; then
7210309d3b3Smrg   if test "x$PERL" != "x"; then
7220309d3b3Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
7230309d3b3Smrg   fi
7240309d3b3Smrg   have_perl=no
7250309d3b3Smrgelse
7260309d3b3Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
7270309d3b3Smrgfi
7280309d3b3Smrg
7290309d3b3SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
7300309d3b3Smrg]) # XORG_WITH_PERL
7310309d3b3Smrg
7320309d3b3Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
73354e0bb33Smrg# ----------------
73454e0bb33Smrg# Minimum version: 1.5.0
7350309d3b3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
73653719b08Smrg#
73754e0bb33Smrg# Documentation tools are not always available on all platforms and sometimes
73854e0bb33Smrg# not at the appropriate level. This macro enables a module to test for the
73954e0bb33Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
74054e0bb33Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
7410309d3b3Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
7420309d3b3Smrg# --with-asciidoc assumes 'auto'.
74354e0bb33Smrg#
74454e0bb33Smrg# Interface to module:
74554e0bb33Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
74654e0bb33Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
74754e0bb33Smrg#		 returns the path set by the user in the environment
74854e0bb33Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
74954e0bb33Smrg#		  'no' user instructs the module not to use asciidoc
75054e0bb33Smrg#
75154e0bb33Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
75254e0bb33Smrg#
75354e0bb33SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
75454e0bb33SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
7550309d3b3Smrgm4_define([_defopt], m4_default([$2], [auto]))
75654e0bb33SmrgAC_ARG_WITH(asciidoc,
75754e0bb33Smrg	AS_HELP_STRING([--with-asciidoc],
7580309d3b3Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
7590309d3b3Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
7600309d3b3Smrgm4_undefine([_defopt])
761cea37944Smrg
76254e0bb33Smrgif test "x$use_asciidoc" = x"auto"; then
76354e0bb33Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
76454e0bb33Smrg   if test "x$ASCIIDOC" = "x"; then
76554e0bb33Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
76654e0bb33Smrg	have_asciidoc=no
76754e0bb33Smrg   else
76854e0bb33Smrg        have_asciidoc=yes
76954e0bb33Smrg   fi
77054e0bb33Smrgelif test "x$use_asciidoc" = x"yes" ; then
77154e0bb33Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
77254e0bb33Smrg   if test "x$ASCIIDOC" = "x"; then
77354e0bb33Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
77454e0bb33Smrg   fi
77554e0bb33Smrg   have_asciidoc=yes
77654e0bb33Smrgelif test "x$use_asciidoc" = x"no" ; then
77754e0bb33Smrg   if test "x$ASCIIDOC" != "x"; then
77854e0bb33Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
77954e0bb33Smrg   fi
78054e0bb33Smrg   have_asciidoc=no
78154e0bb33Smrgelse
78254e0bb33Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
78353719b08Smrgfi
78454e0bb33Smrgm4_ifval([$1],
78554e0bb33Smrg[if test "$have_asciidoc" = yes; then
78654e0bb33Smrg    # scrape the asciidoc version
78754e0bb33Smrg    AC_MSG_CHECKING([the asciidoc version])
78854e0bb33Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
78954e0bb33Smrg    AC_MSG_RESULT([$asciidoc_version])
79054e0bb33Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
79154e0bb33Smrg        [if test "x$use_asciidoc" = xauto; then
79254e0bb33Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
79354e0bb33Smrg            have_asciidoc=no
79454e0bb33Smrg        else
79554e0bb33Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
79654e0bb33Smrg        fi])
79754e0bb33Smrgfi])
79854e0bb33SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
79954e0bb33Smrg]) # XORG_WITH_ASCIIDOC
8005b944e2aSmrg
8010309d3b3Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
80254e0bb33Smrg# --------------------------------
80354e0bb33Smrg# Minimum version: 1.5.0
8040309d3b3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
805b1297603Smrg#
80654e0bb33Smrg# Documentation tools are not always available on all platforms and sometimes
80754e0bb33Smrg# not at the appropriate level. This macro enables a module to test for the
80854e0bb33Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
80954e0bb33Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
8100309d3b3Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
8110309d3b3Smrg# --with-doxygen assumes 'auto'.
81254e0bb33Smrg#
81354e0bb33Smrg# Interface to module:
81454e0bb33Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
81554e0bb33Smrg# DOXYGEN:	 returns the path of the doxygen program found
81654e0bb33Smrg#		 returns the path set by the user in the environment
81754e0bb33Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
81854e0bb33Smrg#		  'no' user instructs the module not to use doxygen
81954e0bb33Smrg#
82054e0bb33Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
82154e0bb33Smrg#
82254e0bb33SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
82354e0bb33SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
8240309d3b3Smrgm4_define([_defopt], m4_default([$2], [auto]))
82554e0bb33SmrgAC_ARG_WITH(doxygen,
82654e0bb33Smrg	AS_HELP_STRING([--with-doxygen],
8270309d3b3Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
8280309d3b3Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
8290309d3b3Smrgm4_undefine([_defopt])
830cea37944Smrg
83154e0bb33Smrgif test "x$use_doxygen" = x"auto"; then
83254e0bb33Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
83354e0bb33Smrg   if test "x$DOXYGEN" = "x"; then
83454e0bb33Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
83554e0bb33Smrg	have_doxygen=no
83654e0bb33Smrg   else
83754e0bb33Smrg        have_doxygen=yes
83854e0bb33Smrg   fi
83954e0bb33Smrgelif test "x$use_doxygen" = x"yes" ; then
84054e0bb33Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
84154e0bb33Smrg   if test "x$DOXYGEN" = "x"; then
84254e0bb33Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
84354e0bb33Smrg   fi
84454e0bb33Smrg   have_doxygen=yes
84554e0bb33Smrgelif test "x$use_doxygen" = x"no" ; then
84654e0bb33Smrg   if test "x$DOXYGEN" != "x"; then
84754e0bb33Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
84854e0bb33Smrg   fi
84954e0bb33Smrg   have_doxygen=no
850b1297603Smrgelse
85154e0bb33Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
852b1297603Smrgfi
85354e0bb33Smrgm4_ifval([$1],
85454e0bb33Smrg[if test "$have_doxygen" = yes; then
85554e0bb33Smrg    # scrape the doxygen version
85654e0bb33Smrg    AC_MSG_CHECKING([the doxygen version])
85754e0bb33Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
85854e0bb33Smrg    AC_MSG_RESULT([$doxygen_version])
85954e0bb33Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
86054e0bb33Smrg        [if test "x$use_doxygen" = xauto; then
86154e0bb33Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
86254e0bb33Smrg            have_doxygen=no
86354e0bb33Smrg        else
86454e0bb33Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
86554e0bb33Smrg        fi])
86654e0bb33Smrgfi])
86754e0bb33SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
86854e0bb33Smrg]) # XORG_WITH_DOXYGEN
869b1297603Smrg
8700309d3b3Smrg# XORG_WITH_GROFF([DEFAULT])
87154e0bb33Smrg# ----------------
87254e0bb33Smrg# Minimum version: 1.6.0
8730309d3b3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
874b1297603Smrg#
87554e0bb33Smrg# Documentation tools are not always available on all platforms and sometimes
87654e0bb33Smrg# not at the appropriate level. This macro enables a module to test for the
87754e0bb33Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
87854e0bb33Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
8790309d3b3Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
8800309d3b3Smrg# --with-groff assumes 'auto'.
88153719b08Smrg#
88254e0bb33Smrg# Interface to module:
88354e0bb33Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
88454e0bb33Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
88554e0bb33Smrg# HAVE_GROFF_MS: the -ms macros package
88654e0bb33Smrg# GROFF:	 returns the path of the groff program found
88754e0bb33Smrg#		 returns the path set by the user in the environment
88854e0bb33Smrg# --with-groff:	 'yes' user instructs the module to use groff
88954e0bb33Smrg#		 'no' user instructs the module not to use groff
89054e0bb33Smrg#
89154e0bb33Smrg# Added in version 1.9.0:
89254e0bb33Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
89354e0bb33Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
89454e0bb33Smrg#		   psselect from the psutils package.
89554e0bb33Smrg#		   the ghostcript package. Refer to the grohtml man pages
89654e0bb33Smrg#
89754e0bb33Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
89854e0bb33Smrg#
89954e0bb33Smrg# OS and distros often splits groff in a basic and full package, the former
90054e0bb33Smrg# having the groff program and the later having devices, fonts and macros
90154e0bb33Smrg# Checking for the groff executable is not enough.
90254e0bb33Smrg#
90354e0bb33Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
90454e0bb33Smrg# unset HAVE_GROFF or GROFF env variables.
90554e0bb33Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
90654e0bb33Smrg#
90754e0bb33SmrgAC_DEFUN([XORG_WITH_GROFF],[
90854e0bb33SmrgAC_ARG_VAR([GROFF], [Path to groff command])
9090309d3b3Smrgm4_define([_defopt], m4_default([$1], [auto]))
91054e0bb33SmrgAC_ARG_WITH(groff,
91154e0bb33Smrg	AS_HELP_STRING([--with-groff],
9120309d3b3Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
9130309d3b3Smrg	   [use_groff=$withval], [use_groff=]_defopt)
9140309d3b3Smrgm4_undefine([_defopt])
915b1297603Smrg
91654e0bb33Smrgif test "x$use_groff" = x"auto"; then
91754e0bb33Smrg   AC_PATH_PROG([GROFF], [groff])
91854e0bb33Smrg   if test "x$GROFF" = "x"; then
91954e0bb33Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
92054e0bb33Smrg	have_groff=no
92154e0bb33Smrg   else
92254e0bb33Smrg        have_groff=yes
92354e0bb33Smrg   fi
92454e0bb33Smrgelif test "x$use_groff" = x"yes" ; then
92554e0bb33Smrg   AC_PATH_PROG([GROFF], [groff])
92654e0bb33Smrg   if test "x$GROFF" = "x"; then
92754e0bb33Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
92854e0bb33Smrg   fi
92954e0bb33Smrg   have_groff=yes
93054e0bb33Smrgelif test "x$use_groff" = x"no" ; then
93154e0bb33Smrg   if test "x$GROFF" != "x"; then
93254e0bb33Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
93354e0bb33Smrg   fi
93454e0bb33Smrg   have_groff=no
93554e0bb33Smrgelse
93654e0bb33Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
93754e0bb33Smrgfi
938b1297603Smrg
93954e0bb33Smrg# We have groff, test for the presence of the macro packages
94054e0bb33Smrgif test "x$have_groff" = x"yes"; then
94154e0bb33Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
94254e0bb33Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
94354e0bb33Smrg        groff_ms_works=yes
94454e0bb33Smrg    else
94554e0bb33Smrg        groff_ms_works=no
94654e0bb33Smrg    fi
94754e0bb33Smrg    AC_MSG_RESULT([$groff_ms_works])
94854e0bb33Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
94954e0bb33Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
95054e0bb33Smrg        groff_mm_works=yes
95154e0bb33Smrg    else
95254e0bb33Smrg        groff_mm_works=no
95354e0bb33Smrg    fi
95454e0bb33Smrg    AC_MSG_RESULT([$groff_mm_works])
95554e0bb33Smrgfi
956b1297603Smrg
95754e0bb33Smrg# We have groff, test for HTML dependencies, one command per package
95854e0bb33Smrgif test "x$have_groff" = x"yes"; then
95954e0bb33Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
96054e0bb33Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
96154e0bb33Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
96254e0bb33Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
96354e0bb33Smrg      have_groff_html=yes
96454e0bb33Smrg   else
96554e0bb33Smrg      have_groff_html=no
96654e0bb33Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
96754e0bb33Smrg   fi
96854e0bb33Smrgfi
969b1297603Smrg
97054e0bb33Smrg# Set Automake conditionals for Makefiles
97154e0bb33SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
97254e0bb33SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
97354e0bb33SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
97454e0bb33SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
97554e0bb33Smrg]) # XORG_WITH_GROFF
976b1297603Smrg
9770309d3b3Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
9780309d3b3Smrg# ---------------------------------------
97954e0bb33Smrg# Minimum version: 1.6.0
9800309d3b3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
9810309d3b3Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
98253719b08Smrg#
98354e0bb33Smrg# Documentation tools are not always available on all platforms and sometimes
98454e0bb33Smrg# not at the appropriate level. This macro enables a module to test for the
98554e0bb33Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
98654e0bb33Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
9870309d3b3Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
9880309d3b3Smrg# --with-fop assumes 'auto'.
98954e0bb33Smrg#
99054e0bb33Smrg# Interface to module:
99154e0bb33Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
99254e0bb33Smrg# FOP:	 	returns the path of the fop program found
99354e0bb33Smrg#		returns the path set by the user in the environment
99454e0bb33Smrg# --with-fop: 	'yes' user instructs the module to use fop
99554e0bb33Smrg#		'no' user instructs the module not to use fop
99654e0bb33Smrg#
99754e0bb33Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
99854e0bb33Smrg#
99954e0bb33SmrgAC_DEFUN([XORG_WITH_FOP],[
100054e0bb33SmrgAC_ARG_VAR([FOP], [Path to fop command])
10010309d3b3Smrgm4_define([_defopt], m4_default([$2], [auto]))
100254e0bb33SmrgAC_ARG_WITH(fop,
100354e0bb33Smrg	AS_HELP_STRING([--with-fop],
10040309d3b3Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
10050309d3b3Smrg	   [use_fop=$withval], [use_fop=]_defopt)
10060309d3b3Smrgm4_undefine([_defopt])
1007cea37944Smrg
100854e0bb33Smrgif test "x$use_fop" = x"auto"; then
100954e0bb33Smrg   AC_PATH_PROG([FOP], [fop])
101054e0bb33Smrg   if test "x$FOP" = "x"; then
101154e0bb33Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
101254e0bb33Smrg	have_fop=no
101354e0bb33Smrg   else
101454e0bb33Smrg        have_fop=yes
1015cea37944Smrg   fi
101654e0bb33Smrgelif test "x$use_fop" = x"yes" ; then
101754e0bb33Smrg   AC_PATH_PROG([FOP], [fop])
101854e0bb33Smrg   if test "x$FOP" = "x"; then
101954e0bb33Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
1020cea37944Smrg   fi
102154e0bb33Smrg   have_fop=yes
102254e0bb33Smrgelif test "x$use_fop" = x"no" ; then
102354e0bb33Smrg   if test "x$FOP" != "x"; then
102454e0bb33Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
102554e0bb33Smrg   fi
102654e0bb33Smrg   have_fop=no
1027cea37944Smrgelse
102854e0bb33Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
102953719b08Smrgfi
10300309d3b3Smrg
10310309d3b3Smrg# Test for a minimum version of fop, if provided.
10320309d3b3Smrgm4_ifval([$1],
10330309d3b3Smrg[if test "$have_fop" = yes; then
10340309d3b3Smrg    # scrape the fop version
10350309d3b3Smrg    AC_MSG_CHECKING([for fop minimum version])
10360309d3b3Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
10370309d3b3Smrg    AC_MSG_RESULT([$fop_version])
10380309d3b3Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
10390309d3b3Smrg        [if test "x$use_fop" = xauto; then
10400309d3b3Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
10410309d3b3Smrg            have_fop=no
10420309d3b3Smrg        else
10430309d3b3Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
10440309d3b3Smrg        fi])
10450309d3b3Smrgfi])
104654e0bb33SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
104754e0bb33Smrg]) # XORG_WITH_FOP
1048b1297603Smrg
10490309d3b3Smrg# XORG_WITH_PS2PDF([DEFAULT])
105054e0bb33Smrg# ----------------
105154e0bb33Smrg# Minimum version: 1.6.0
10520309d3b3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
105353719b08Smrg#
105454e0bb33Smrg# Documentation tools are not always available on all platforms and sometimes
105554e0bb33Smrg# not at the appropriate level. This macro enables a module to test for the
105654e0bb33Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
105754e0bb33Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
10580309d3b3Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
10590309d3b3Smrg# --with-ps2pdf assumes 'auto'.
106053719b08Smrg#
106154e0bb33Smrg# Interface to module:
106254e0bb33Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
106354e0bb33Smrg# PS2PDF:	returns the path of the ps2pdf program found
106454e0bb33Smrg#		returns the path set by the user in the environment
106554e0bb33Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
106654e0bb33Smrg#		 'no' user instructs the module not to use ps2pdf
106754e0bb33Smrg#
106854e0bb33Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
106954e0bb33Smrg#
107054e0bb33SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
107154e0bb33SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
10720309d3b3Smrgm4_define([_defopt], m4_default([$1], [auto]))
107354e0bb33SmrgAC_ARG_WITH(ps2pdf,
107454e0bb33Smrg	AS_HELP_STRING([--with-ps2pdf],
10750309d3b3Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
10760309d3b3Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
10770309d3b3Smrgm4_undefine([_defopt])
1078cea37944Smrg
107954e0bb33Smrgif test "x$use_ps2pdf" = x"auto"; then
108054e0bb33Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
108154e0bb33Smrg   if test "x$PS2PDF" = "x"; then
108254e0bb33Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
108354e0bb33Smrg	have_ps2pdf=no
108454e0bb33Smrg   else
108554e0bb33Smrg        have_ps2pdf=yes
108654e0bb33Smrg   fi
108754e0bb33Smrgelif test "x$use_ps2pdf" = x"yes" ; then
108854e0bb33Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
108954e0bb33Smrg   if test "x$PS2PDF" = "x"; then
109054e0bb33Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
109154e0bb33Smrg   fi
109254e0bb33Smrg   have_ps2pdf=yes
109354e0bb33Smrgelif test "x$use_ps2pdf" = x"no" ; then
109454e0bb33Smrg   if test "x$PS2PDF" != "x"; then
109554e0bb33Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
109654e0bb33Smrg   fi
109754e0bb33Smrg   have_ps2pdf=no
109854e0bb33Smrgelse
109954e0bb33Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
1100cea37944Smrgfi
110154e0bb33SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
110254e0bb33Smrg]) # XORG_WITH_PS2PDF
1103cea37944Smrg
110454e0bb33Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
110554e0bb33Smrg# ----------------
110654e0bb33Smrg# Minimum version: 1.6.0
110753719b08Smrg#
110854e0bb33Smrg# Documentation tools are not always available on all platforms and sometimes
110954e0bb33Smrg# not at the appropriate level. This macro enables a builder to skip all
111054e0bb33Smrg# documentation targets except traditional man pages.
111154e0bb33Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
111254e0bb33Smrg# maximum flexibilty in controlling documentation building.
111354e0bb33Smrg# Refer to:
111454e0bb33Smrg# XORG_WITH_XMLTO         --with-xmlto
111554e0bb33Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
111654e0bb33Smrg# XORG_WITH_DOXYGEN       --with-doxygen
111754e0bb33Smrg# XORG_WITH_FOP           --with-fop
111854e0bb33Smrg# XORG_WITH_GROFF         --with-groff
111954e0bb33Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
1120b1297603Smrg#
112154e0bb33Smrg# Interface to module:
112254e0bb33Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
112354e0bb33Smrg# --enable-docs: 'yes' user instructs the module to generate docs
112454e0bb33Smrg#		 'no' user instructs the module not to generate docs
112554e0bb33Smrg# parm1:	specify the default value, yes or no.
112654e0bb33Smrg#
112754e0bb33SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
11280309d3b3Smrgm4_define([docs_default], m4_default([$1], [yes]))
112954e0bb33SmrgAC_ARG_ENABLE(docs,
113054e0bb33Smrg	AS_HELP_STRING([--enable-docs],
11310309d3b3Smrg	   [Enable building the documentation (default: ]docs_default[)]),
11320309d3b3Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
11330309d3b3Smrgm4_undefine([docs_default])
113454e0bb33SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
113554e0bb33SmrgAC_MSG_CHECKING([whether to build documentation])
113654e0bb33SmrgAC_MSG_RESULT([$build_docs])
113754e0bb33Smrg]) # XORG_ENABLE_DOCS
1138b1297603Smrg
113954e0bb33Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
114054e0bb33Smrg# ----------------
114154e0bb33Smrg# Minimum version: 1.6.0
1142cea37944Smrg#
114354e0bb33Smrg# This macro enables a builder to skip all developer documentation.
114454e0bb33Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
114554e0bb33Smrg# maximum flexibilty in controlling documentation building.
114654e0bb33Smrg# Refer to:
114754e0bb33Smrg# XORG_WITH_XMLTO         --with-xmlto
114854e0bb33Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
114954e0bb33Smrg# XORG_WITH_DOXYGEN       --with-doxygen
115054e0bb33Smrg# XORG_WITH_FOP           --with-fop
115154e0bb33Smrg# XORG_WITH_GROFF         --with-groff
115254e0bb33Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
1153cea37944Smrg#
115454e0bb33Smrg# Interface to module:
115554e0bb33Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
115654e0bb33Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
115754e0bb33Smrg#			'no' user instructs the module not to generate developer docs
115854e0bb33Smrg# parm1:		specify the default value, yes or no.
115953719b08Smrg#
116054e0bb33SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
11610309d3b3Smrgm4_define([devel_default], m4_default([$1], [yes]))
116254e0bb33SmrgAC_ARG_ENABLE(devel-docs,
116354e0bb33Smrg	AS_HELP_STRING([--enable-devel-docs],
11640309d3b3Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
11650309d3b3Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
11660309d3b3Smrgm4_undefine([devel_default])
116754e0bb33SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
116854e0bb33SmrgAC_MSG_CHECKING([whether to build developer documentation])
116954e0bb33SmrgAC_MSG_RESULT([$build_devel_docs])
117054e0bb33Smrg]) # XORG_ENABLE_DEVEL_DOCS
117154e0bb33Smrg
117254e0bb33Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
117354e0bb33Smrg# ----------------
117454e0bb33Smrg# Minimum version: 1.6.0
117553719b08Smrg#
117654e0bb33Smrg# This macro enables a builder to skip all functional specification targets.
117754e0bb33Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
117854e0bb33Smrg# maximum flexibilty in controlling documentation building.
117954e0bb33Smrg# Refer to:
118054e0bb33Smrg# XORG_WITH_XMLTO         --with-xmlto
118154e0bb33Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
118254e0bb33Smrg# XORG_WITH_DOXYGEN       --with-doxygen
118354e0bb33Smrg# XORG_WITH_FOP           --with-fop
118454e0bb33Smrg# XORG_WITH_GROFF         --with-groff
118554e0bb33Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
118653719b08Smrg#
118754e0bb33Smrg# Interface to module:
118854e0bb33Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
118954e0bb33Smrg# --enable-specs:	'yes' user instructs the module to generate specs
119054e0bb33Smrg#			'no' user instructs the module not to generate specs
119154e0bb33Smrg# parm1:		specify the default value, yes or no.
119253719b08Smrg#
119354e0bb33SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
11940309d3b3Smrgm4_define([spec_default], m4_default([$1], [yes]))
119554e0bb33SmrgAC_ARG_ENABLE(specs,
119654e0bb33Smrg	AS_HELP_STRING([--enable-specs],
11970309d3b3Smrg	   [Enable building the specs (default: ]spec_default[)]),
11980309d3b3Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
11990309d3b3Smrgm4_undefine([spec_default])
120054e0bb33SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
120154e0bb33SmrgAC_MSG_CHECKING([whether to build functional specifications])
120254e0bb33SmrgAC_MSG_RESULT([$build_specs])
120354e0bb33Smrg]) # XORG_ENABLE_SPECS
1204b1297603Smrg
12050309d3b3Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
12060309d3b3Smrg# ----------------------------------------------
12070309d3b3Smrg# Minimum version: 1.13.0
12080309d3b3Smrg#
12090309d3b3Smrg# This macro enables a builder to enable/disable unit testing
12100309d3b3Smrg# It makes no assumption about the test cases implementation
12110309d3b3Smrg# Test cases may or may not use Automake "Support for test suites"
12120309d3b3Smrg# They may or may not use the software utility library GLib
12130309d3b3Smrg#
12140309d3b3Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
12150309d3b3Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
12160309d3b3Smrg# The variable enable_unit_tests is used by other macros in this file.
12170309d3b3Smrg#
12180309d3b3Smrg# Interface to module:
12190309d3b3Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
12200309d3b3Smrg# enable_unit_tests:    used in configure.ac for additional configuration
12210309d3b3Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
12220309d3b3Smrg#			'no' user instructs the module not to build tests
12230309d3b3Smrg# parm1:		specify the default value, yes or no.
12240309d3b3Smrg#
12250309d3b3SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
12260309d3b3SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
12270309d3b3SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
12280309d3b3SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
12290309d3b3Smrgm4_define([_defopt], m4_default([$1], [auto]))
12300309d3b3SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
12310309d3b3Smrg	[Enable building unit test cases (default: ]_defopt[)]),
12320309d3b3Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
12330309d3b3Smrgm4_undefine([_defopt])
12340309d3b3SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
12350309d3b3SmrgAC_MSG_CHECKING([whether to build unit test cases])
12360309d3b3SmrgAC_MSG_RESULT([$enable_unit_tests])
12370309d3b3Smrg]) # XORG_ENABLE_UNIT_TESTS
12380309d3b3Smrg
12390309d3b3Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
12400309d3b3Smrg# ----------------------------------------
12410309d3b3Smrg# Minimum version: 1.13.0
12420309d3b3Smrg#
12430309d3b3Smrg# GLib is a library which provides advanced data structures and functions.
12440309d3b3Smrg# This macro enables a module to test for the presence of Glib.
12450309d3b3Smrg#
12460309d3b3Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
12470309d3b3Smrg# Otherwise the value of $enable_unit_tests is blank.
12480309d3b3Smrg#
12490309d3b3Smrg# Interface to module:
12500309d3b3Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
12510309d3b3Smrg# with_glib: used in configure.ac to know if GLib has been found
12520309d3b3Smrg# --with-glib:	'yes' user instructs the module to use glib
12530309d3b3Smrg#		'no' user instructs the module not to use glib
12540309d3b3Smrg#
12550309d3b3SmrgAC_DEFUN([XORG_WITH_GLIB],[
12560309d3b3SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
12570309d3b3Smrgm4_define([_defopt], m4_default([$2], [auto]))
12580309d3b3SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
12590309d3b3Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
12600309d3b3Smrg	[with_glib=$withval], [with_glib=]_defopt)
12610309d3b3Smrgm4_undefine([_defopt])
12620309d3b3Smrg
12630309d3b3Smrghave_glib=no
12640309d3b3Smrg# Do not probe GLib if user explicitly disabled unit testing
12650309d3b3Smrgif test "x$enable_unit_tests" != x"no"; then
12660309d3b3Smrg  # Do not probe GLib if user explicitly disabled it
12670309d3b3Smrg  if test "x$with_glib" != x"no"; then
12680309d3b3Smrg    m4_ifval(
12690309d3b3Smrg      [$1],
12700309d3b3Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
12710309d3b3Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
12720309d3b3Smrg    )
12730309d3b3Smrg  fi
12740309d3b3Smrgfi
12750309d3b3Smrg
12760309d3b3Smrg# Not having GLib when unit testing has been explicitly requested is an error
12770309d3b3Smrgif test "x$enable_unit_tests" = x"yes"; then
12780309d3b3Smrg  if test "x$have_glib" = x"no"; then
12790309d3b3Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
12800309d3b3Smrg  fi
12810309d3b3Smrgfi
12820309d3b3Smrg
12830309d3b3Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
12840309d3b3Smrgif test "x$enable_unit_tests" = x"no"; then
12850309d3b3Smrg  if test "x$with_glib" = x"yes"; then
12860309d3b3Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
12870309d3b3Smrg  fi
12880309d3b3Smrgfi
12890309d3b3Smrg
12900309d3b3Smrg# Not having GLib when it has been explicitly requested is an error
12910309d3b3Smrgif test "x$with_glib" = x"yes"; then
12920309d3b3Smrg  if test "x$have_glib" = x"no"; then
12930309d3b3Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
12940309d3b3Smrg  fi
12950309d3b3Smrgfi
12960309d3b3Smrg
12970309d3b3SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
12980309d3b3Smrg]) # XORG_WITH_GLIB
12990309d3b3Smrg
13000309d3b3Smrg# XORG_LD_WRAP([required|optional])
13010309d3b3Smrg# ---------------------------------
13020309d3b3Smrg# Minimum version: 1.13.0
13030309d3b3Smrg#
13040309d3b3Smrg# Check if linker supports -wrap, passed via compiler flags
13050309d3b3Smrg#
13060309d3b3Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
13070309d3b3Smrg# Otherwise the value of $enable_unit_tests is blank.
13080309d3b3Smrg#
13090309d3b3Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
13100309d3b3Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
13110309d3b3Smrg# available, an argument of "optional" allows use when some unit tests require
13120309d3b3Smrg# ld -wrap and others do not.
13130309d3b3Smrg#
13140309d3b3SmrgAC_DEFUN([XORG_LD_WRAP],[
13150309d3b3SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
13160309d3b3Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
13170309d3b3Smrg                      void __wrap_exit(int status) { return; }],
13180309d3b3Smrg                     [exit(0);])])
13190309d3b3Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
13200309d3b3Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
13210309d3b3Smrg  if test "x$have_ld_wrap" = x"no"; then
13220309d3b3Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
13230309d3b3Smrg  fi
13240309d3b3Smrgfi
13250309d3b3SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
13260309d3b3Smrg#
13270309d3b3Smrg]) # XORG_LD_WRAP
13280309d3b3Smrg
13290309d3b3Smrg# XORG_CHECK_LINKER_FLAGS
13300309d3b3Smrg# -----------------------
13310309d3b3Smrg# SYNOPSIS
13320309d3b3Smrg#
13330309d3b3Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
13340309d3b3Smrg#
13350309d3b3Smrg# DESCRIPTION
13360309d3b3Smrg#
13370309d3b3Smrg#   Check whether the given linker FLAGS work with the current language's
13380309d3b3Smrg#   linker, or whether they give an error.
13390309d3b3Smrg#
13400309d3b3Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
13410309d3b3Smrg#   success/failure.
13420309d3b3Smrg#
13430309d3b3Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
13440309d3b3Smrg#
13450309d3b3Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
13460309d3b3Smrg#
13470309d3b3Smrg# LICENSE
13480309d3b3Smrg#
13490309d3b3Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
13500309d3b3Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
13510309d3b3Smrg#   Copyright (c) 2009 Matteo Frigo
13520309d3b3Smrg#
13530309d3b3Smrg#   This program is free software: you can redistribute it and/or modify it
13540309d3b3Smrg#   under the terms of the GNU General Public License as published by the
13550309d3b3Smrg#   Free Software Foundation, either version 3 of the License, or (at your
13560309d3b3Smrg#   option) any later version.
13570309d3b3Smrg#
13580309d3b3Smrg#   This program is distributed in the hope that it will be useful, but
13590309d3b3Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
13600309d3b3Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
13610309d3b3Smrg#   Public License for more details.
13620309d3b3Smrg#
13630309d3b3Smrg#   You should have received a copy of the GNU General Public License along
13640309d3b3Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
13650309d3b3Smrg#
13660309d3b3Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
13670309d3b3Smrg#   gives unlimited permission to copy, distribute and modify the configure
13680309d3b3Smrg#   scripts that are the output of Autoconf when processing the Macro. You
13690309d3b3Smrg#   need not follow the terms of the GNU General Public License when using
13700309d3b3Smrg#   or distributing such scripts, even though portions of the text of the
13710309d3b3Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
13720309d3b3Smrg#   all other use of the material that constitutes the Autoconf Macro.
13730309d3b3Smrg#
13740309d3b3Smrg#   This special exception to the GPL applies to versions of the Autoconf
13750309d3b3Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
13760309d3b3Smrg#   modified version of the Autoconf Macro, you may extend this special
13770309d3b3Smrg#   exception to the GPL to apply to your modified version as well.#
13780309d3b3SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
13790309d3b3Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
13800309d3b3Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
13810309d3b3SmrgAS_LITERAL_IF([$1],
13820309d3b3Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
13830309d3b3Smrg      ax_save_FLAGS=$LDFLAGS
13840309d3b3Smrg      LDFLAGS="$1"
13850309d3b3Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
13860309d3b3Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
13870309d3b3Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
13880309d3b3Smrg      LDFLAGS=$ax_save_FLAGS])],
13890309d3b3Smrg  [ax_save_FLAGS=$LDFLAGS
13900309d3b3Smrg   LDFLAGS="$1"
13910309d3b3Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
13920309d3b3Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
13930309d3b3Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
13940309d3b3Smrg   LDFLAGS=$ax_save_FLAGS])
13950309d3b3Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
13960309d3b3SmrgAC_MSG_RESULT($xorg_check_linker_flags)
13970309d3b3Smrgif test "x$xorg_check_linker_flags" = xyes; then
13980309d3b3Smrg	m4_default([$2], :)
13990309d3b3Smrgelse
14000309d3b3Smrg	m4_default([$3], :)
14010309d3b3Smrgfi
14020309d3b3Smrg]) # XORG_CHECK_LINKER_FLAGS
14030309d3b3Smrg
14040309d3b3Smrg# XORG_MEMORY_CHECK_FLAGS
14050309d3b3Smrg# -----------------------
14060309d3b3Smrg# Minimum version: 1.16.0
14070309d3b3Smrg#
14080309d3b3Smrg# This macro attempts to find appropriate memory checking functionality
14090309d3b3Smrg# for various platforms which unit testing code may use to catch various
14100309d3b3Smrg# forms of memory allocation and access errors in testing.
14110309d3b3Smrg#
14120309d3b3Smrg# Interface to module:
14130309d3b3Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
14140309d3b3Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
14150309d3b3Smrg#
14160309d3b3Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
14170309d3b3Smrg#
14180309d3b3SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
14190309d3b3Smrg
14200309d3b3SmrgAC_REQUIRE([AC_CANONICAL_HOST])
14210309d3b3SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
14220309d3b3Smrg           [Environment variables to enable memory checking in tests])
14230309d3b3Smrg
14240309d3b3Smrg# Check for different types of support on different platforms
14250309d3b3Smrgcase $host_os in
14260309d3b3Smrg    solaris*)
14270309d3b3Smrg        AC_CHECK_LIB([umem], [umem_alloc],
14280309d3b3Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
14290309d3b3Smrg        ;;
14300309d3b3Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
14310309d3b3Smrg        # both directly and inverted, so should not be 0 or 255.
14320309d3b3Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
14330309d3b3Smrg        ;;
14340309d3b3Smrg    darwin*)
14350309d3b3Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
14360309d3b3Smrg        ;;
14370309d3b3Smrg    *bsd*)
14380309d3b3Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
14390309d3b3Smrg        ;;
14400309d3b3Smrgesac
14410309d3b3Smrg
14420309d3b3Smrg# User supplied flags override default flags
14430309d3b3Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
14440309d3b3Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
14450309d3b3Smrgfi
14460309d3b3Smrg
14470309d3b3SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
14480309d3b3Smrg]) # XORG_WITH_LINT
14490309d3b3Smrg
145054e0bb33Smrg# XORG_CHECK_MALLOC_ZERO
145154e0bb33Smrg# ----------------------
1452cea37944Smrg# Minimum version: 1.0.0
14535b944e2aSmrg#
145454e0bb33Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
145554e0bb33Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
145654e0bb33Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
145754e0bb33SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
145854e0bb33SmrgAC_ARG_ENABLE(malloc0returnsnull,
145954e0bb33Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
146054e0bb33Smrg		       [malloc(0) returns NULL (default: auto)]),
146154e0bb33Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
146254e0bb33Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
146353719b08Smrg
146454e0bb33SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
146554e0bb33Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
14660309d3b3Smrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
14670309d3b3Smrg#include <stdlib.h>
14680309d3b3Smrg],[
146954e0bb33Smrg    char *m0, *r0, *c0, *p;
147054e0bb33Smrg    m0 = malloc(0);
147154e0bb33Smrg    p = malloc(10);
147254e0bb33Smrg    r0 = realloc(p,0);
14730309d3b3Smrg    c0 = calloc(0,10);
14740309d3b3Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
14750309d3b3Smrg])],
147654e0bb33Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
147754e0bb33Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
147854e0bb33Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
14795b944e2aSmrgfi
148054e0bb33SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
14815b944e2aSmrg
148254e0bb33Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
148354e0bb33Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
148454e0bb33Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
148554e0bb33Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
1486cea37944Smrgelse
148754e0bb33Smrg	MALLOC_ZERO_CFLAGS=""
148854e0bb33Smrg	XMALLOC_ZERO_CFLAGS=""
148954e0bb33Smrg	XTMALLOC_ZERO_CFLAGS=""
1490cea37944Smrgfi
1491b1297603Smrg
149254e0bb33SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
149354e0bb33SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
149454e0bb33SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
149554e0bb33Smrg]) # XORG_CHECK_MALLOC_ZERO
149654e0bb33Smrg
149754e0bb33Smrg# XORG_WITH_LINT()
149854e0bb33Smrg# ----------------
149954e0bb33Smrg# Minimum version: 1.1.0
1500cea37944Smrg#
150154e0bb33Smrg# This macro enables the use of a tool that flags some suspicious and
150254e0bb33Smrg# non-portable constructs (likely to be bugs) in C language source code.
150354e0bb33Smrg# It will attempt to locate the tool and use appropriate options.
150454e0bb33Smrg# There are various lint type tools on different platforms.
150554e0bb33Smrg#
150654e0bb33Smrg# Interface to module:
150754e0bb33Smrg# LINT:		returns the path to the tool found on the platform
150854e0bb33Smrg#		or the value set to LINT on the configure cmd line
150954e0bb33Smrg#		also an Automake conditional
151054e0bb33Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
151154e0bb33Smrg#
151254e0bb33Smrg# --with-lint:	'yes' user instructs the module to use lint
151354e0bb33Smrg#		'no' user instructs the module not to use lint (default)
151454e0bb33Smrg#
151554e0bb33Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
151654e0bb33Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
151754e0bb33Smrg#
151854e0bb33SmrgAC_DEFUN([XORG_WITH_LINT],[
1519b1297603Smrg
152054e0bb33SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
152154e0bb33SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
152254e0bb33SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
152354e0bb33Smrg		[Use a lint-style source code checker (default: disabled)])],
152454e0bb33Smrg		[use_lint=$withval], [use_lint=no])
1525b1297603Smrg
152654e0bb33Smrg# Obtain platform specific info like program name and options
152754e0bb33Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
152854e0bb33Smrgcase $host_os in
152954e0bb33Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
153054e0bb33Smrg	lint_name=splint
153154e0bb33Smrg	lint_options="-badflag"
153254e0bb33Smrg	;;
153354e0bb33Smrg  *freebsd* | *netbsd*)
153454e0bb33Smrg	lint_name=lint
153554e0bb33Smrg	lint_options="-u -b"
153654e0bb33Smrg	;;
153754e0bb33Smrg  *solaris*)
153854e0bb33Smrg	lint_name=lint
153954e0bb33Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
154054e0bb33Smrg	;;
154154e0bb33Smrgesac
1542b1297603Smrg
154354e0bb33Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
154454e0bb33Smrgif test "x$use_lint" = x"yes" ; then
154554e0bb33Smrg   AC_PATH_PROG([LINT], [$lint_name])
154654e0bb33Smrg   if test "x$LINT" = "x"; then
154754e0bb33Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
154854e0bb33Smrg   fi
154954e0bb33Smrgelif test "x$use_lint" = x"no" ; then
155054e0bb33Smrg   if test "x$LINT" != "x"; then
155154e0bb33Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
155254e0bb33Smrg   fi
155354e0bb33Smrgelse
155454e0bb33Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
1555cea37944Smrgfi
1556b1297603Smrg
155754e0bb33Smrg# User supplied flags override default flags
155854e0bb33Smrgif test "x$LINT_FLAGS" != "x"; then
155954e0bb33Smrg   lint_options=$LINT_FLAGS
15605b944e2aSmrgfi
1561b1297603Smrg
156254e0bb33SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
156354e0bb33SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
1564b1297603Smrg
156554e0bb33Smrg]) # XORG_WITH_LINT
1566b1297603Smrg
156754e0bb33Smrg# XORG_LINT_LIBRARY(LIBNAME)
156854e0bb33Smrg# --------------------------
156954e0bb33Smrg# Minimum version: 1.1.0
1570cea37944Smrg#
157154e0bb33Smrg# Sets up flags for building lint libraries for checking programs that call
157254e0bb33Smrg# functions in the library.
157353719b08Smrg#
157454e0bb33Smrg# Interface to module:
157554e0bb33Smrg# LINTLIB		- Automake variable with the name of lint library file to make
157654e0bb33Smrg# MAKE_LINT_LIB		- Automake conditional
157754e0bb33Smrg#
157854e0bb33Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
157954e0bb33Smrg#			  - 'no' user instructs the module not to create a lint library (default)
1580b1297603Smrg
158154e0bb33SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
158254e0bb33SmrgAC_REQUIRE([XORG_WITH_LINT])
158354e0bb33SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
158454e0bb33Smrg	[Create lint library (default: disabled)])],
158554e0bb33Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
1586b1297603Smrg
158754e0bb33Smrgif test "x$make_lint_lib" = x"yes" ; then
158854e0bb33Smrg   LINTLIB=llib-l$1.ln
158954e0bb33Smrg   if test "x$LINT" = "x"; then
159054e0bb33Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
159154e0bb33Smrg   fi
159254e0bb33Smrgelif test "x$make_lint_lib" != x"no" ; then
159354e0bb33Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
1594cea37944Smrgfi
1595b1297603Smrg
159654e0bb33SmrgAC_SUBST(LINTLIB)
159754e0bb33SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
1598b1297603Smrg
159954e0bb33Smrg]) # XORG_LINT_LIBRARY
1600b1297603Smrg
16010309d3b3Smrg# XORG_COMPILER_BRAND
16020309d3b3Smrg# -------------------
16030309d3b3Smrg# Minimum version: 1.14.0
16040309d3b3Smrg#
16050309d3b3Smrg# Checks for various brands of compilers and sets flags as appropriate:
16060309d3b3Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
16070309d3b3Smrg#   clang compiler - sets CLANGCC to "yes"
16080309d3b3Smrg#   Intel compiler - sets INTELCC to "yes"
16090309d3b3Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
16100309d3b3Smrg#
16110309d3b3SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
16120309d3b3SmrgAC_REQUIRE([AC_PROG_CC_C99])
16130309d3b3SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
16140309d3b3SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
16150309d3b3SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
16160309d3b3Smrg]) # XORG_COMPILER_BRAND
16170309d3b3Smrg
16180309d3b3Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
16190309d3b3Smrg# ---------------
16200309d3b3Smrg# Minimum version: 1.16.0
16210309d3b3Smrg#
16220309d3b3Smrg# Test if the compiler works when passed the given flag as a command line argument.
16230309d3b3Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
16240309d3b3Smrg# next flag in the list until there are no more options.
16250309d3b3Smrg#
16260309d3b3Smrg# Note that this does not guarantee that the compiler supports the flag as some
16270309d3b3Smrg# compilers will simply ignore arguments that they do not understand, but we do
16280309d3b3Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
16290309d3b3Smrg# -Werror=unused-command-line-argument
16300309d3b3Smrg#
16310309d3b3SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
16320309d3b3SmrgAC_REQUIRE([AC_PROG_CC_C99])
16330309d3b3Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
16340309d3b3Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
16350309d3b3Smrg
16360309d3b3Smrgxorg_testset_save_CFLAGS="$CFLAGS"
16370309d3b3Smrg
16380309d3b3Smrgif test "x$xorg_testset_unknown_warning_option" = "x" ; then
16390309d3b3Smrg	CFLAGS="$CFLAGS -Werror=unknown-warning-option"
16400309d3b3Smrg	AC_MSG_CHECKING([if $CC supports -Werror=unknown-warning-option])
16410309d3b3Smrg	AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
16420309d3b3Smrg	                  [xorg_testset_unknown_warning_option=yes],
16430309d3b3Smrg	                  [xorg_testset_unknown_warning_option=no])
16440309d3b3Smrg	AC_MSG_RESULT([$xorg_testset_unknown_warning_option])
16450309d3b3Smrg	CFLAGS="$xorg_testset_save_CFLAGS"
16460309d3b3Smrgfi
16470309d3b3Smrg
16480309d3b3Smrgif test "x$xorg_testset_unused_command_line_argument" = "x" ; then
16490309d3b3Smrg	if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
16500309d3b3Smrg		CFLAGS="$CFLAGS -Werror=unknown-warning-option"
16510309d3b3Smrg	fi
16520309d3b3Smrg	CFLAGS="$CFLAGS -Werror=unused-command-line-argument"
16530309d3b3Smrg	AC_MSG_CHECKING([if $CC supports -Werror=unused-command-line-argument])
16540309d3b3Smrg	AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
16550309d3b3Smrg	                  [xorg_testset_unused_command_line_argument=yes],
16560309d3b3Smrg	                  [xorg_testset_unused_command_line_argument=no])
16570309d3b3Smrg	AC_MSG_RESULT([$xorg_testset_unused_command_line_argument])
16580309d3b3Smrg	CFLAGS="$xorg_testset_save_CFLAGS"
16590309d3b3Smrgfi
16600309d3b3Smrg
16610309d3b3Smrgfound="no"
16620309d3b3Smrgm4_foreach([flag], m4_cdr($@), [
16630309d3b3Smrg	if test $found = "no" ; then
16640309d3b3Smrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
16650309d3b3Smrg			CFLAGS="$CFLAGS -Werror=unknown-warning-option"
16660309d3b3Smrg		fi
16670309d3b3Smrg
16680309d3b3Smrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
16690309d3b3Smrg			CFLAGS="$CFLAGS -Werror=unused-command-line-argument"
16700309d3b3Smrg		fi
16710309d3b3Smrg
16720309d3b3Smrg		CFLAGS="$CFLAGS ]flag["
16730309d3b3Smrg
16740309d3b3Smrg		AC_MSG_CHECKING([if $CC supports ]flag[])
16750309d3b3Smrg		AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
16760309d3b3Smrg		                  [supported=yes], [supported=no])
16770309d3b3Smrg		AC_MSG_RESULT([$supported])
16780309d3b3Smrg		CFLAGS="$xorg_testset_save_CFLAGS"
16790309d3b3Smrg
16800309d3b3Smrg		if test "$supported" = "yes" ; then
16810309d3b3Smrg			$1="$$1 ]flag["
16820309d3b3Smrg			found="yes"
16830309d3b3Smrg		fi
16840309d3b3Smrg	fi
16850309d3b3Smrg])
16860309d3b3Smrg]) # XORG_TESTSET_CFLAG
16870309d3b3Smrg
16880309d3b3Smrg# XORG_COMPILER_FLAGS
16890309d3b3Smrg# ---------------
16900309d3b3Smrg# Minimum version: 1.16.0
16910309d3b3Smrg#
16920309d3b3Smrg# Defines BASE_CFLAGS to contain a set of command line arguments supported
16930309d3b3Smrg# by the selected compiler which do NOT alter the generated code.  These
16940309d3b3Smrg# arguments will cause the compiler to print various warnings during
16950309d3b3Smrg# compilation AND turn a conservative set of warnings into errors.
16960309d3b3Smrg#
16970309d3b3Smrg# The set of flags supported by BASE_CFLAGS will grow in future
16980309d3b3Smrg# versions of util-macros as options are added to new compilers.
16990309d3b3Smrg#
17000309d3b3SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
17010309d3b3SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
17020309d3b3Smrg
17030309d3b3SmrgAC_ARG_ENABLE(selective-werror,
17040309d3b3Smrg              AS_HELP_STRING([--disable-selective-werror],
17050309d3b3Smrg                             [Turn off selective compiler errors. (default: enabled)]),
17060309d3b3Smrg              [SELECTIVE_WERROR=$enableval],
17070309d3b3Smrg              [SELECTIVE_WERROR=yes])
17080309d3b3Smrg
17090309d3b3Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
17100309d3b3Smrgif test "x$SUNCC" = "xyes"; then
17110309d3b3Smrg    BASE_CFLAGS="-v"
17120309d3b3Smrgelse
17130309d3b3Smrg    BASE_CFLAGS=""
17140309d3b3Smrgfi
17150309d3b3Smrg
17160309d3b3Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
17170309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wall])
17180309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wpointer-arith])
17190309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wstrict-prototypes])
17200309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-prototypes])
17210309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-declarations])
17220309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wnested-externs])
17230309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wbad-function-cast])
17240309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wformat=2], [-Wformat])
17250309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wold-style-definition])
17260309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wdeclaration-after-statement])
17270309d3b3Smrg
17280309d3b3Smrg# This chunk adds additional warnings that could catch undesired effects.
17290309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wunused])
17300309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wuninitialized])
17310309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wshadow])
17320309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wcast-qual])
17330309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-noreturn])
17340309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-format-attribute])
17350309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wredundant-decls])
17360309d3b3Smrg
17370309d3b3Smrg# These are currently disabled because they are noisy.  They will be enabled
17380309d3b3Smrg# in the future once the codebase is sufficiently modernized to silence
17390309d3b3Smrg# them.  For now, I don't want them to drown out the other warnings.
17400309d3b3Smrg# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wlogical-op])
17410309d3b3Smrg# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wparentheses])
17420309d3b3Smrg# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wcast-align])
17430309d3b3Smrg
17440309d3b3Smrg# Turn some warnings into errors, so we don't accidently get successful builds
17450309d3b3Smrg# when there are problems that should be fixed.
17460309d3b3Smrg
17470309d3b3Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
17480309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
17490309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=nonnull])
17500309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=init-self])
17510309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=main])
17520309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=missing-braces])
17530309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=sequence-point])
17540309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
17550309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=trigraphs])
17560309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=array-bounds])
17570309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=write-strings])
17580309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=address])
17590309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
17600309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
17610309d3b3Smrgelse
17620309d3b3SmrgAC_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])
17630309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wimplicit])
17640309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wnonnull])
17650309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Winit-self])
17660309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmain])
17670309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-braces])
17680309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wsequence-point])
17690309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wreturn-type])
17700309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wtrigraphs])
17710309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Warray-bounds])
17720309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wwrite-strings])
17730309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Waddress])
17740309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wint-to-pointer-cast])
17750309d3b3SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wpointer-to-int-cast])
17760309d3b3Smrgfi
17770309d3b3Smrg
17780309d3b3SmrgAC_SUBST([BASE_CFLAGS])
17790309d3b3Smrg]) # XORG_COMPILER_FLAGS
17800309d3b3Smrg
178154e0bb33Smrg# XORG_CWARNFLAGS
178254e0bb33Smrg# ---------------
178354e0bb33Smrg# Minimum version: 1.2.0
17840309d3b3Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
178554e0bb33Smrg#
178654e0bb33Smrg# Defines CWARNFLAGS to enable C compiler warnings.
178754e0bb33Smrg#
17880309d3b3Smrg# This function is deprecated because it defines -fno-strict-aliasing
17890309d3b3Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
17900309d3b3Smrg# is needed, then it should be added explicitly in the module when
17910309d3b3Smrg# it is updated to use BASE_CFLAGS.
17920309d3b3Smrg#
179354e0bb33SmrgAC_DEFUN([XORG_CWARNFLAGS], [
17940309d3b3SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
17950309d3b3SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
17960309d3b3SmrgCWARNFLAGS="$BASE_CFLAGS"
179754e0bb33Smrgif  test "x$GCC" = xyes ; then
17980309d3b3Smrg    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
17995b944e2aSmrgfi
180054e0bb33SmrgAC_SUBST(CWARNFLAGS)
180154e0bb33Smrg]) # XORG_CWARNFLAGS
1802b1297603Smrg
180354e0bb33Smrg# XORG_STRICT_OPTION
180454e0bb33Smrg# -----------------------
180554e0bb33Smrg# Minimum version: 1.3.0
180654e0bb33Smrg#
18070309d3b3Smrg# Add configure option to enable strict compilation flags, such as treating
18080309d3b3Smrg# warnings as fatal errors.
18090309d3b3Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
18100309d3b3Smrg# $BASE_CFLAGS and the deprecated $CWARNFLAGS.
18110309d3b3Smrg#
18120309d3b3Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
18130309d3b3Smrg# when strict compilation is unconditionally desired.
181454e0bb33SmrgAC_DEFUN([XORG_STRICT_OPTION], [
181554e0bb33SmrgAC_REQUIRE([XORG_CWARNFLAGS])
18160309d3b3SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
1817b1297603Smrg
181854e0bb33SmrgAC_ARG_ENABLE(strict-compilation,
181954e0bb33Smrg			  AS_HELP_STRING([--enable-strict-compilation],
182054e0bb33Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
182154e0bb33Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
18220309d3b3Smrg
18230309d3b3SmrgSTRICT_CFLAGS=""
18240309d3b3SmrgXORG_TESTSET_CFLAG([STRICT_CFLAGS], [-pedantic])
18250309d3b3SmrgXORG_TESTSET_CFLAG([STRICT_CFLAGS], [-Werror], [-errwarn])
18260309d3b3Smrg
18270309d3b3Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
18280309d3b3Smrg# activate it with -Werror, so we add it here explicitly.
18290309d3b3SmrgXORG_TESTSET_CFLAG([STRICT_CFLAGS], [-Werror=attributes])
18300309d3b3Smrg
183154e0bb33Smrgif test "x$STRICT_COMPILE" = "xyes"; then
18320309d3b3Smrg    BASE_CFLAGS="$BASE_CFLAGS $STRICT_CFLAGS"
18330309d3b3Smrg    CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
183454e0bb33Smrgfi
18350309d3b3SmrgAC_SUBST([STRICT_CFLAGS])
18360309d3b3SmrgAC_SUBST([BASE_CFLAGS])
183754e0bb33SmrgAC_SUBST([CWARNFLAGS])
183854e0bb33Smrg]) # XORG_STRICT_OPTION
1839b1297603Smrg
184054e0bb33Smrg# XORG_DEFAULT_OPTIONS
184154e0bb33Smrg# --------------------
184254e0bb33Smrg# Minimum version: 1.3.0
184354e0bb33Smrg#
184454e0bb33Smrg# Defines default options for X.Org modules.
184554e0bb33Smrg#
184654e0bb33SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
184754e0bb33SmrgAC_REQUIRE([AC_PROG_INSTALL])
18480309d3b3SmrgXORG_COMPILER_FLAGS
184954e0bb33SmrgXORG_CWARNFLAGS
185054e0bb33SmrgXORG_STRICT_OPTION
185154e0bb33SmrgXORG_RELEASE_VERSION
185254e0bb33SmrgXORG_CHANGELOG
185354e0bb33SmrgXORG_INSTALL
185454e0bb33SmrgXORG_MANPAGE_SECTIONS
185554e0bb33Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
185654e0bb33Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
185754e0bb33Smrg]) # XORG_DEFAULT_OPTIONS
1858b1297603Smrg
185954e0bb33Smrg# XORG_INSTALL()
186054e0bb33Smrg# ----------------
186154e0bb33Smrg# Minimum version: 1.4.0
1862cea37944Smrg#
186354e0bb33Smrg# Defines the variable INSTALL_CMD as the command to copy
186454e0bb33Smrg# INSTALL from $prefix/share/util-macros.
186554e0bb33Smrg#
186654e0bb33SmrgAC_DEFUN([XORG_INSTALL], [
186754e0bb33SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
186854e0bb33Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
186954e0bb33SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
187054e0bb33Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
187154e0bb33Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
187254e0bb33Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
187354e0bb33SmrgAC_SUBST([INSTALL_CMD])
187454e0bb33Smrg]) # XORG_INSTALL
187554e0bb33Smrgdnl Copyright 2005 Red Hat, Inc
187654e0bb33Smrgdnl
187754e0bb33Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
187854e0bb33Smrgdnl documentation for any purpose is hereby granted without fee, provided that
187954e0bb33Smrgdnl the above copyright notice appear in all copies and that both that
188054e0bb33Smrgdnl copyright notice and this permission notice appear in supporting
188154e0bb33Smrgdnl documentation.
188254e0bb33Smrgdnl
188354e0bb33Smrgdnl The above copyright notice and this permission notice shall be included
188454e0bb33Smrgdnl in all copies or substantial portions of the Software.
188554e0bb33Smrgdnl
188654e0bb33Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
188754e0bb33Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
188854e0bb33Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
188954e0bb33Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
189054e0bb33Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
189154e0bb33Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
189254e0bb33Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
189354e0bb33Smrgdnl
189454e0bb33Smrgdnl Except as contained in this notice, the name of the copyright holders shall
189554e0bb33Smrgdnl not be used in advertising or otherwise to promote the sale, use or
189654e0bb33Smrgdnl other dealings in this Software without prior written authorization
189754e0bb33Smrgdnl from the copyright holders.
189854e0bb33Smrgdnl
189953719b08Smrg
190054e0bb33Smrg# XORG_RELEASE_VERSION
190154e0bb33Smrg# --------------------
190254e0bb33Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
190354e0bb33Smrg 
190454e0bb33SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
190554e0bb33Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
190654e0bb33Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
190754e0bb33Smrg		[Major version of this package])
190854e0bb33Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
190954e0bb33Smrg	if test "x$PVM" = "x"; then
191054e0bb33Smrg		PVM="0"
191154e0bb33Smrg	fi
191254e0bb33Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
191354e0bb33Smrg		[$PVM],
191454e0bb33Smrg		[Minor version of this package])
191554e0bb33Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
191654e0bb33Smrg	if test "x$PVP" = "x"; then
191754e0bb33Smrg		PVP="0"
191854e0bb33Smrg	fi
191954e0bb33Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
192054e0bb33Smrg		[$PVP],
192154e0bb33Smrg		[Patch version of this package])
192254e0bb33Smrg])
192353719b08Smrg
192454e0bb33Smrg# XORG_CHANGELOG()
192554e0bb33Smrg# ----------------
192654e0bb33Smrg# Minimum version: 1.2.0
192754e0bb33Smrg#
192854e0bb33Smrg# Defines the variable CHANGELOG_CMD as the command to generate
192954e0bb33Smrg# ChangeLog from git.
193054e0bb33Smrg#
193154e0bb33Smrg#
193254e0bb33SmrgAC_DEFUN([XORG_CHANGELOG], [
193354e0bb33SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
193454e0bb33Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
193554e0bb33Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
193654e0bb33Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
193754e0bb33SmrgAC_SUBST([CHANGELOG_CMD])
193854e0bb33Smrg]) # XORG_CHANGELOG
193953719b08Smrg
19400309d3b3Smrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
19410309d3b3Smrg# Foundation, Inc.
194254e0bb33Smrg#
194354e0bb33Smrg# This file is free software; the Free Software Foundation
194454e0bb33Smrg# gives unlimited permission to copy and/or distribute it,
194554e0bb33Smrg# with or without modifications, as long as this notice is preserved.
194653719b08Smrg
19470309d3b3Smrg# serial 1
19480309d3b3Smrg
194954e0bb33Smrg# AM_AUTOMAKE_VERSION(VERSION)
195054e0bb33Smrg# ----------------------------
195154e0bb33Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
195254e0bb33Smrg# generated from the m4 files accompanying Automake X.Y.
195354e0bb33Smrg# (This private macro should not be called outside this file.)
195454e0bb33SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
195554e0bb33Smrg[am__api_version='1.11'
195654e0bb33Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
195754e0bb33Smrgdnl require some minimum version.  Point them to the right macro.
19580309d3b3Smrgm4_if([$1], [1.11.3], [],
195954e0bb33Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
196054e0bb33Smrg])
1961cea37944Smrg
196254e0bb33Smrg# _AM_AUTOCONF_VERSION(VERSION)
196354e0bb33Smrg# -----------------------------
196454e0bb33Smrg# aclocal traces this macro to find the Autoconf version.
196554e0bb33Smrg# This is a private macro too.  Using m4_define simplifies
196654e0bb33Smrg# the logic in aclocal, which can simply ignore this definition.
196754e0bb33Smrgm4_define([_AM_AUTOCONF_VERSION], [])
1968cea37944Smrg
196954e0bb33Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
197054e0bb33Smrg# -------------------------------
197154e0bb33Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
197254e0bb33Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
197354e0bb33SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
19740309d3b3Smrg[AM_AUTOMAKE_VERSION([1.11.3])dnl
197554e0bb33Smrgm4_ifndef([AC_AUTOCONF_VERSION],
197654e0bb33Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
197754e0bb33Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
1978cea37944Smrg
197954e0bb33Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
1980cea37944Smrg
19810309d3b3Smrg# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
198254e0bb33Smrg#
198354e0bb33Smrg# This file is free software; the Free Software Foundation
198454e0bb33Smrg# gives unlimited permission to copy and/or distribute it,
198554e0bb33Smrg# with or without modifications, as long as this notice is preserved.
1986cea37944Smrg
19870309d3b3Smrg# serial 1
19880309d3b3Smrg
198954e0bb33Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
199054e0bb33Smrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
199154e0bb33Smrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
19925b944e2aSmrg#
199354e0bb33Smrg# Of course, Automake must honor this variable whenever it calls a
199454e0bb33Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
199554e0bb33Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
199654e0bb33Smrg# depending on how configure is run.  This is pretty annoying, since
199754e0bb33Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
199854e0bb33Smrg# source directory, any form will work fine, but in subdirectories a
199954e0bb33Smrg# relative path needs to be adjusted first.
2000cea37944Smrg#
200154e0bb33Smrg# $ac_aux_dir/missing
200254e0bb33Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
200354e0bb33Smrg# $top_srcdir/$ac_aux_dir/missing
200454e0bb33Smrg#    fails if $ac_aux_dir is absolute,
200554e0bb33Smrg#    fails when called from a subdirectory in a VPATH build with
200654e0bb33Smrg#          a relative $ac_aux_dir
2007cea37944Smrg#
200854e0bb33Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
200954e0bb33Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
201054e0bb33Smrg# harmless because $srcdir is `.', but things will broke when you
201154e0bb33Smrg# start a VPATH build or use an absolute $srcdir.
2012cea37944Smrg#
201354e0bb33Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
201454e0bb33Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
201554e0bb33Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
201654e0bb33Smrg# and then we would define $MISSING as
201754e0bb33Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
201854e0bb33Smrg# This will work as long as MISSING is not called from configure, because
201954e0bb33Smrg# unfortunately $(top_srcdir) has no meaning in configure.
202054e0bb33Smrg# However there are other variables, like CC, which are often used in
202154e0bb33Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
2022cea37944Smrg#
202354e0bb33Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
202454e0bb33Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
202554e0bb33Smrg# configured tree to be moved without reconfiguration.
2026b1297603Smrg
202754e0bb33SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
202854e0bb33Smrg[dnl Rely on autoconf to set up CDPATH properly.
202954e0bb33SmrgAC_PREREQ([2.50])dnl
203054e0bb33Smrg# expand $ac_aux_dir to an absolute path
203154e0bb33Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
203254e0bb33Smrg])
2033b1297603Smrg
203454e0bb33Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
203554e0bb33Smrg
203654e0bb33Smrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
203754e0bb33Smrg# Free Software Foundation, Inc.
2038cea37944Smrg#
203954e0bb33Smrg# This file is free software; the Free Software Foundation
204054e0bb33Smrg# gives unlimited permission to copy and/or distribute it,
204154e0bb33Smrg# with or without modifications, as long as this notice is preserved.
204253719b08Smrg
204354e0bb33Smrg# serial 9
204454e0bb33Smrg
204554e0bb33Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
204654e0bb33Smrg# -------------------------------------
204754e0bb33Smrg# Define a conditional.
204854e0bb33SmrgAC_DEFUN([AM_CONDITIONAL],
204954e0bb33Smrg[AC_PREREQ(2.52)dnl
205054e0bb33Smrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
205154e0bb33Smrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
205254e0bb33SmrgAC_SUBST([$1_TRUE])dnl
205354e0bb33SmrgAC_SUBST([$1_FALSE])dnl
205454e0bb33Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
205554e0bb33Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
205654e0bb33Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
205754e0bb33Smrgif $2; then
205854e0bb33Smrg  $1_TRUE=
205954e0bb33Smrg  $1_FALSE='#'
2060cea37944Smrgelse
206154e0bb33Smrg  $1_TRUE='#'
206254e0bb33Smrg  $1_FALSE=
20635b944e2aSmrgfi
206454e0bb33SmrgAC_CONFIG_COMMANDS_PRE(
206554e0bb33Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
206654e0bb33Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
206754e0bb33SmrgUsually this means the macro was only invoked conditionally.]])
206854e0bb33Smrgfi])])
206953719b08Smrg
20700309d3b3Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
20710309d3b3Smrg# 2010, 2011 Free Software Foundation, Inc.
2072cea37944Smrg#
207354e0bb33Smrg# This file is free software; the Free Software Foundation
207454e0bb33Smrg# gives unlimited permission to copy and/or distribute it,
207554e0bb33Smrg# with or without modifications, as long as this notice is preserved.
2076cea37944Smrg
20770309d3b3Smrg# serial 12
207854e0bb33Smrg
207954e0bb33Smrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
208054e0bb33Smrg# written in clear, in which case automake, when reading aclocal.m4,
208154e0bb33Smrg# will think it sees a *use*, and therefore will trigger all it's
208254e0bb33Smrg# C support machinery.  Also note that it means that autoscan, seeing
208354e0bb33Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
208454e0bb33Smrg
208554e0bb33Smrg
208654e0bb33Smrg# _AM_DEPENDENCIES(NAME)
208754e0bb33Smrg# ----------------------
208854e0bb33Smrg# See how the compiler implements dependency checking.
208954e0bb33Smrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
209054e0bb33Smrg# We try a few techniques and use that to set a single cache variable.
209154e0bb33Smrg#
209254e0bb33Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
209354e0bb33Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
209454e0bb33Smrg# dependency, and given that the user is not expected to run this macro,
209554e0bb33Smrg# just rely on AC_PROG_CC.
209654e0bb33SmrgAC_DEFUN([_AM_DEPENDENCIES],
209754e0bb33Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
209854e0bb33SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
209954e0bb33SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
210054e0bb33SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
210154e0bb33Smrg
210254e0bb33Smrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
210354e0bb33Smrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
210454e0bb33Smrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
210554e0bb33Smrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
210654e0bb33Smrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
210754e0bb33Smrg                   [depcc="$$1"   am_compiler_list=])
210854e0bb33Smrg
210954e0bb33SmrgAC_CACHE_CHECK([dependency style of $depcc],
211054e0bb33Smrg               [am_cv_$1_dependencies_compiler_type],
211154e0bb33Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
211254e0bb33Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
211354e0bb33Smrg  # making bogus files that we don't know about and never remove.  For
211454e0bb33Smrg  # instance it was reported that on HP-UX the gcc test will end up
211554e0bb33Smrg  # making a dummy file named `D' -- because `-MD' means `put the output
211654e0bb33Smrg  # in D'.
21170309d3b3Smrg  rm -rf conftest.dir
211854e0bb33Smrg  mkdir conftest.dir
211954e0bb33Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
212054e0bb33Smrg  # using a relative directory.
212154e0bb33Smrg  cp "$am_depcomp" conftest.dir
212254e0bb33Smrg  cd conftest.dir
212354e0bb33Smrg  # We will build objects and dependencies in a subdirectory because
212454e0bb33Smrg  # it helps to detect inapplicable dependency modes.  For instance
212554e0bb33Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
212654e0bb33Smrg  # side effect of compilation, but ICC will put the dependencies in
212754e0bb33Smrg  # the current directory while Tru64 will put them in the object
212854e0bb33Smrg  # directory.
212954e0bb33Smrg  mkdir sub
213054e0bb33Smrg
213154e0bb33Smrg  am_cv_$1_dependencies_compiler_type=none
213254e0bb33Smrg  if test "$am_compiler_list" = ""; then
213354e0bb33Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
213454e0bb33Smrg  fi
213554e0bb33Smrg  am__universal=false
213654e0bb33Smrg  m4_case([$1], [CC],
213754e0bb33Smrg    [case " $depcc " in #(
213854e0bb33Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
213954e0bb33Smrg     esac],
214054e0bb33Smrg    [CXX],
214154e0bb33Smrg    [case " $depcc " in #(
214254e0bb33Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
214354e0bb33Smrg     esac])
214454e0bb33Smrg
214554e0bb33Smrg  for depmode in $am_compiler_list; do
214654e0bb33Smrg    # Setup a source with many dependencies, because some compilers
214754e0bb33Smrg    # like to wrap large dependency lists on column 80 (with \), and
214854e0bb33Smrg    # we should not choose a depcomp mode which is confused by this.
214954e0bb33Smrg    #
215054e0bb33Smrg    # We need to recreate these files for each test, as the compiler may
215154e0bb33Smrg    # overwrite some of them when testing with obscure command lines.
215254e0bb33Smrg    # This happens at least with the AIX C compiler.
215354e0bb33Smrg    : > sub/conftest.c
215454e0bb33Smrg    for i in 1 2 3 4 5 6; do
215554e0bb33Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
215654e0bb33Smrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
215754e0bb33Smrg      # Solaris 8's {/usr,}/bin/sh.
215854e0bb33Smrg      touch sub/conftst$i.h
215954e0bb33Smrg    done
216054e0bb33Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
216154e0bb33Smrg
216254e0bb33Smrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
216354e0bb33Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
216454e0bb33Smrg    # handle `-M -o', and we need to detect this.  Also, some Intel
216554e0bb33Smrg    # versions had trouble with output in subdirs
216654e0bb33Smrg    am__obj=sub/conftest.${OBJEXT-o}
216754e0bb33Smrg    am__minus_obj="-o $am__obj"
216854e0bb33Smrg    case $depmode in
216954e0bb33Smrg    gcc)
217054e0bb33Smrg      # This depmode causes a compiler race in universal mode.
217154e0bb33Smrg      test "$am__universal" = false || continue
217254e0bb33Smrg      ;;
217354e0bb33Smrg    nosideeffect)
217454e0bb33Smrg      # after this tag, mechanisms are not by side-effect, so they'll
217554e0bb33Smrg      # only be used when explicitly requested
217654e0bb33Smrg      if test "x$enable_dependency_tracking" = xyes; then
217754e0bb33Smrg	continue
217854e0bb33Smrg      else
217954e0bb33Smrg	break
218054e0bb33Smrg      fi
218154e0bb33Smrg      ;;
21820309d3b3Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
218354e0bb33Smrg      # This compiler won't grok `-c -o', but also, the minuso test has
218454e0bb33Smrg      # not run yet.  These depmodes are late enough in the game, and
218554e0bb33Smrg      # so weak that their functioning should not be impacted.
218654e0bb33Smrg      am__obj=conftest.${OBJEXT-o}
218754e0bb33Smrg      am__minus_obj=
218854e0bb33Smrg      ;;
218954e0bb33Smrg    none) break ;;
219054e0bb33Smrg    esac
219154e0bb33Smrg    if depmode=$depmode \
219254e0bb33Smrg       source=sub/conftest.c object=$am__obj \
219354e0bb33Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
219454e0bb33Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
219554e0bb33Smrg         >/dev/null 2>conftest.err &&
219654e0bb33Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
219754e0bb33Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
219854e0bb33Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
219954e0bb33Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
220054e0bb33Smrg      # icc doesn't choke on unknown options, it will just issue warnings
220154e0bb33Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
220254e0bb33Smrg      # that says an option was ignored or not supported.
220354e0bb33Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
220454e0bb33Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
220554e0bb33Smrg      # The diagnosis changed in icc 8.0:
220654e0bb33Smrg      #   icc: Command line remark: option '-MP' not supported
220754e0bb33Smrg      if (grep 'ignoring option' conftest.err ||
220854e0bb33Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
220954e0bb33Smrg        am_cv_$1_dependencies_compiler_type=$depmode
221054e0bb33Smrg        break
221154e0bb33Smrg      fi
221254e0bb33Smrg    fi
221354e0bb33Smrg  done
221454e0bb33Smrg
221554e0bb33Smrg  cd ..
221654e0bb33Smrg  rm -rf conftest.dir
2217cea37944Smrgelse
221854e0bb33Smrg  am_cv_$1_dependencies_compiler_type=none
221953719b08Smrgfi
222054e0bb33Smrg])
222154e0bb33SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
222254e0bb33SmrgAM_CONDITIONAL([am__fastdep$1], [
222354e0bb33Smrg  test "x$enable_dependency_tracking" != xno \
222454e0bb33Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
222554e0bb33Smrg])
222654e0bb33Smrg
222754e0bb33Smrg
222854e0bb33Smrg# AM_SET_DEPDIR
222954e0bb33Smrg# -------------
223054e0bb33Smrg# Choose a directory name for dependency files.
223154e0bb33Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
223254e0bb33SmrgAC_DEFUN([AM_SET_DEPDIR],
223354e0bb33Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
223454e0bb33SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
223554e0bb33Smrg])
223654e0bb33Smrg
223754e0bb33Smrg
223854e0bb33Smrg# AM_DEP_TRACK
223954e0bb33Smrg# ------------
224054e0bb33SmrgAC_DEFUN([AM_DEP_TRACK],
224154e0bb33Smrg[AC_ARG_ENABLE(dependency-tracking,
224254e0bb33Smrg[  --disable-dependency-tracking  speeds up one-time build
224354e0bb33Smrg  --enable-dependency-tracking   do not reject slow dependency extractors])
224454e0bb33Smrgif test "x$enable_dependency_tracking" != xno; then
224554e0bb33Smrg  am_depcomp="$ac_aux_dir/depcomp"
224654e0bb33Smrg  AMDEPBACKSLASH='\'
22470309d3b3Smrg  am__nodep='_no'
2248cea37944Smrgfi
224954e0bb33SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
225054e0bb33SmrgAC_SUBST([AMDEPBACKSLASH])dnl
225154e0bb33Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
22520309d3b3SmrgAC_SUBST([am__nodep])dnl
22530309d3b3Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
225454e0bb33Smrg])
2255cea37944Smrg
225654e0bb33Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
225754e0bb33Smrg
225854e0bb33Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
225954e0bb33Smrg# Free Software Foundation, Inc.
2260cea37944Smrg#
226154e0bb33Smrg# This file is free software; the Free Software Foundation
226254e0bb33Smrg# gives unlimited permission to copy and/or distribute it,
226354e0bb33Smrg# with or without modifications, as long as this notice is preserved.
226454e0bb33Smrg
226554e0bb33Smrg#serial 5
226654e0bb33Smrg
226754e0bb33Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
226854e0bb33Smrg# ------------------------------
226954e0bb33SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
227054e0bb33Smrg[{
227154e0bb33Smrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
227254e0bb33Smrg  # are listed without --file.  Let's play safe and only enable the eval
227354e0bb33Smrg  # if we detect the quoting.
227454e0bb33Smrg  case $CONFIG_FILES in
227554e0bb33Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
227654e0bb33Smrg  *)   set x $CONFIG_FILES ;;
227754e0bb33Smrg  esac
227854e0bb33Smrg  shift
227954e0bb33Smrg  for mf
228054e0bb33Smrg  do
228154e0bb33Smrg    # Strip MF so we end up with the name of the file.
228254e0bb33Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
228354e0bb33Smrg    # Check whether this is an Automake generated Makefile or not.
228454e0bb33Smrg    # We used to match only the files named `Makefile.in', but
228554e0bb33Smrg    # some people rename them; so instead we look at the file content.
228654e0bb33Smrg    # Grep'ing the first line is not enough: some people post-process
228754e0bb33Smrg    # each Makefile.in and add a new line on top of each file to say so.
228854e0bb33Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
228954e0bb33Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
229054e0bb33Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
229154e0bb33Smrg      dirpart=`AS_DIRNAME("$mf")`
229254e0bb33Smrg    else
229354e0bb33Smrg      continue
229454e0bb33Smrg    fi
229554e0bb33Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
229654e0bb33Smrg    # from the Makefile without running `make'.
229754e0bb33Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
229854e0bb33Smrg    test -z "$DEPDIR" && continue
229954e0bb33Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
230054e0bb33Smrg    test -z "am__include" && continue
230154e0bb33Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
230254e0bb33Smrg    # When using ansi2knr, U may be empty or an underscore; expand it
230354e0bb33Smrg    U=`sed -n 's/^U = //p' < "$mf"`
230454e0bb33Smrg    # Find all dependency output files, they are included files with
230554e0bb33Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
230654e0bb33Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
230754e0bb33Smrg    # expansion.
230854e0bb33Smrg    for file in `sed -n "
230954e0bb33Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
231054e0bb33Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
231154e0bb33Smrg      # Make sure the directory exists.
231254e0bb33Smrg      test -f "$dirpart/$file" && continue
231354e0bb33Smrg      fdir=`AS_DIRNAME(["$file"])`
231454e0bb33Smrg      AS_MKDIR_P([$dirpart/$fdir])
231554e0bb33Smrg      # echo "creating $dirpart/$file"
231654e0bb33Smrg      echo '# dummy' > "$dirpart/$file"
231754e0bb33Smrg    done
231854e0bb33Smrg  done
231954e0bb33Smrg}
232054e0bb33Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
2321cea37944Smrg
2322b1297603Smrg
232354e0bb33Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
232454e0bb33Smrg# -----------------------------
232554e0bb33Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
2326b1297603Smrg#
232754e0bb33Smrg# This code is only required when automatic dependency tracking
232854e0bb33Smrg# is enabled.  FIXME.  This creates each `.P' file that we will
232954e0bb33Smrg# need in order to bootstrap the dependency handling code.
233054e0bb33SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
233154e0bb33Smrg[AC_CONFIG_COMMANDS([depfiles],
233254e0bb33Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
233354e0bb33Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
233454e0bb33Smrg])
233554e0bb33Smrg
233654e0bb33Smrg# Do all the work for Automake.                             -*- Autoconf -*-
233754e0bb33Smrg
233854e0bb33Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
233954e0bb33Smrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
2340cea37944Smrg#
234154e0bb33Smrg# This file is free software; the Free Software Foundation
234254e0bb33Smrg# gives unlimited permission to copy and/or distribute it,
234354e0bb33Smrg# with or without modifications, as long as this notice is preserved.
2344cea37944Smrg
234554e0bb33Smrg# serial 16
234654e0bb33Smrg
234754e0bb33Smrg# This macro actually does too much.  Some checks are only needed if
234854e0bb33Smrg# your package does certain things.  But this isn't really a big deal.
234954e0bb33Smrg
235054e0bb33Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
235154e0bb33Smrg# AM_INIT_AUTOMAKE([OPTIONS])
235254e0bb33Smrg# -----------------------------------------------
235354e0bb33Smrg# The call with PACKAGE and VERSION arguments is the old style
235454e0bb33Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
235554e0bb33Smrg# and VERSION should now be passed to AC_INIT and removed from
235654e0bb33Smrg# the call to AM_INIT_AUTOMAKE.
235754e0bb33Smrg# We support both call styles for the transition.  After
235854e0bb33Smrg# the next Automake release, Autoconf can make the AC_INIT
235954e0bb33Smrg# arguments mandatory, and then we can depend on a new Autoconf
236054e0bb33Smrg# release and drop the old call support.
236154e0bb33SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
236254e0bb33Smrg[AC_PREREQ([2.62])dnl
236354e0bb33Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
236454e0bb33Smrgdnl the ones we care about.
236554e0bb33Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
236654e0bb33SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
236754e0bb33SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
236854e0bb33Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
236954e0bb33Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
237054e0bb33Smrg  # is not polluted with repeated "-I."
237154e0bb33Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
237254e0bb33Smrg  # test to see if srcdir already configured
237354e0bb33Smrg  if test -f $srcdir/config.status; then
237454e0bb33Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
237554e0bb33Smrg  fi
2376cea37944Smrgfi
237753719b08Smrg
237854e0bb33Smrg# test whether we have cygpath
237954e0bb33Smrgif test -z "$CYGPATH_W"; then
238054e0bb33Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
238154e0bb33Smrg    CYGPATH_W='cygpath -w'
238254e0bb33Smrg  else
238354e0bb33Smrg    CYGPATH_W=echo
238454e0bb33Smrg  fi
238554e0bb33Smrgfi
238654e0bb33SmrgAC_SUBST([CYGPATH_W])
238754e0bb33Smrg
238854e0bb33Smrg# Define the identity of the package.
238954e0bb33Smrgdnl Distinguish between old-style and new-style calls.
239054e0bb33Smrgm4_ifval([$2],
239154e0bb33Smrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
239254e0bb33Smrg AC_SUBST([PACKAGE], [$1])dnl
239354e0bb33Smrg AC_SUBST([VERSION], [$2])],
239454e0bb33Smrg[_AM_SET_OPTIONS([$1])dnl
239554e0bb33Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
239654e0bb33Smrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
239754e0bb33Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
239854e0bb33Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
239954e0bb33Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
240054e0bb33Smrg
240154e0bb33Smrg_AM_IF_OPTION([no-define],,
240254e0bb33Smrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
240354e0bb33Smrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
240454e0bb33Smrg
240554e0bb33Smrg# Some tools Automake needs.
240654e0bb33SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
240754e0bb33SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
240854e0bb33SmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
240954e0bb33SmrgAM_MISSING_PROG(AUTOCONF, autoconf)
241054e0bb33SmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
241154e0bb33SmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
241254e0bb33SmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
241354e0bb33SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
241454e0bb33SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
241554e0bb33SmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
241654e0bb33Smrg# We need awk for the "check" target.  The system "awk" is bad on
241754e0bb33Smrg# some platforms.
241854e0bb33SmrgAC_REQUIRE([AC_PROG_AWK])dnl
241954e0bb33SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
242054e0bb33SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
242154e0bb33Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
242254e0bb33Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
242354e0bb33Smrg			     [_AM_PROG_TAR([v7])])])
242454e0bb33Smrg_AM_IF_OPTION([no-dependencies],,
242554e0bb33Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
242654e0bb33Smrg		  [_AM_DEPENDENCIES(CC)],
242754e0bb33Smrg		  [define([AC_PROG_CC],
242854e0bb33Smrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
242954e0bb33SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
243054e0bb33Smrg		  [_AM_DEPENDENCIES(CXX)],
243154e0bb33Smrg		  [define([AC_PROG_CXX],
243254e0bb33Smrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
243354e0bb33SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
243454e0bb33Smrg		  [_AM_DEPENDENCIES(OBJC)],
243554e0bb33Smrg		  [define([AC_PROG_OBJC],
243654e0bb33Smrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
243754e0bb33Smrg])
243854e0bb33Smrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
243954e0bb33Smrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
244054e0bb33Smrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
244154e0bb33Smrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
244254e0bb33SmrgAC_CONFIG_COMMANDS_PRE(dnl
244354e0bb33Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
244454e0bb33Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
244554e0bb33Smrg])
244654e0bb33Smrg
244754e0bb33Smrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
244854e0bb33Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
244954e0bb33Smrgdnl mangled by Autoconf and run in a shell conditional statement.
245054e0bb33Smrgm4_define([_AC_COMPILER_EXEEXT],
245154e0bb33Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
245254e0bb33Smrg
245354e0bb33Smrg
245454e0bb33Smrg# When config.status generates a header, we must update the stamp-h file.
245554e0bb33Smrg# This file resides in the same directory as the config header
245654e0bb33Smrg# that is generated.  The stamp files are numbered to have different names.
245754e0bb33Smrg
245854e0bb33Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
245954e0bb33Smrg# loop where config.status creates the headers, so we can generate
246054e0bb33Smrg# our stamp files there.
246154e0bb33SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
246254e0bb33Smrg[# Compute $1's index in $config_headers.
246354e0bb33Smrg_am_arg=$1
246454e0bb33Smrg_am_stamp_count=1
246554e0bb33Smrgfor _am_header in $config_headers :; do
246654e0bb33Smrg  case $_am_header in
246754e0bb33Smrg    $_am_arg | $_am_arg:* )
246854e0bb33Smrg      break ;;
246954e0bb33Smrg    * )
247054e0bb33Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
247154e0bb33Smrg  esac
247254e0bb33Smrgdone
247354e0bb33Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
247454e0bb33Smrg
24750309d3b3Smrg# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
24760309d3b3Smrg# Inc.
2477cea37944Smrg#
247854e0bb33Smrg# This file is free software; the Free Software Foundation
247954e0bb33Smrg# gives unlimited permission to copy and/or distribute it,
248054e0bb33Smrg# with or without modifications, as long as this notice is preserved.
248154e0bb33Smrg
24820309d3b3Smrg# serial 1
24830309d3b3Smrg
248454e0bb33Smrg# AM_PROG_INSTALL_SH
248554e0bb33Smrg# ------------------
248654e0bb33Smrg# Define $install_sh.
248754e0bb33SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
248854e0bb33Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
248954e0bb33Smrgif test x"${install_sh}" != xset; then
249054e0bb33Smrg  case $am_aux_dir in
249154e0bb33Smrg  *\ * | *\	*)
249254e0bb33Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
249354e0bb33Smrg  *)
249454e0bb33Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
249554e0bb33Smrg  esac
2496cea37944Smrgfi
249754e0bb33SmrgAC_SUBST(install_sh)])
2498cea37944Smrg
249954e0bb33Smrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
2500cea37944Smrg#
250154e0bb33Smrg# This file is free software; the Free Software Foundation
250254e0bb33Smrg# gives unlimited permission to copy and/or distribute it,
250354e0bb33Smrg# with or without modifications, as long as this notice is preserved.
250454e0bb33Smrg
250554e0bb33Smrg# serial 2
250654e0bb33Smrg
250754e0bb33Smrg# Check whether the underlying file-system supports filenames
250854e0bb33Smrg# with a leading dot.  For instance MS-DOS doesn't.
250954e0bb33SmrgAC_DEFUN([AM_SET_LEADING_DOT],
251054e0bb33Smrg[rm -rf .tst 2>/dev/null
251154e0bb33Smrgmkdir .tst 2>/dev/null
251254e0bb33Smrgif test -d .tst; then
251354e0bb33Smrg  am__leading_dot=.
251454e0bb33Smrgelse
251554e0bb33Smrg  am__leading_dot=_
2516cea37944Smrgfi
251754e0bb33Smrgrmdir .tst 2>/dev/null
251854e0bb33SmrgAC_SUBST([am__leading_dot])])
2519cea37944Smrg
252054e0bb33Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
252154e0bb33Smrg# From Jim Meyering
252254e0bb33Smrg
25230309d3b3Smrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
25240309d3b3Smrg# 2011 Free Software Foundation, Inc.
2525cea37944Smrg#
252654e0bb33Smrg# This file is free software; the Free Software Foundation
252754e0bb33Smrg# gives unlimited permission to copy and/or distribute it,
252854e0bb33Smrg# with or without modifications, as long as this notice is preserved.
252954e0bb33Smrg
253054e0bb33Smrg# serial 5
253154e0bb33Smrg
253254e0bb33Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
253354e0bb33Smrg# ----------------------------------
253454e0bb33Smrg# Control maintainer-specific portions of Makefiles.
253554e0bb33Smrg# Default is to disable them, unless `enable' is passed literally.
253654e0bb33Smrg# For symmetry, `disable' may be passed as well.  Anyway, the user
253754e0bb33Smrg# can override the default with the --enable/--disable switch.
253854e0bb33SmrgAC_DEFUN([AM_MAINTAINER_MODE],
253954e0bb33Smrg[m4_case(m4_default([$1], [disable]),
254054e0bb33Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
254154e0bb33Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
254254e0bb33Smrg       [m4_define([am_maintainer_other], [enable])
254354e0bb33Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
25440309d3b3SmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
254554e0bb33Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
254654e0bb33Smrg  AC_ARG_ENABLE([maintainer-mode],
254754e0bb33Smrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
254854e0bb33Smrg			  (and sometimes confusing) to the casual installer],
254954e0bb33Smrg      [USE_MAINTAINER_MODE=$enableval],
255054e0bb33Smrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
255154e0bb33Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
255254e0bb33Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
255354e0bb33Smrg  MAINT=$MAINTAINER_MODE_TRUE
255454e0bb33Smrg  AC_SUBST([MAINT])dnl
255554e0bb33Smrg]
255654e0bb33Smrg)
255754e0bb33Smrg
255854e0bb33SmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
255954e0bb33Smrg
256054e0bb33Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
256154e0bb33Smrg
256254e0bb33Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
2563cea37944Smrg#
256454e0bb33Smrg# This file is free software; the Free Software Foundation
256554e0bb33Smrg# gives unlimited permission to copy and/or distribute it,
256654e0bb33Smrg# with or without modifications, as long as this notice is preserved.
256754e0bb33Smrg
256854e0bb33Smrg# serial 4
256954e0bb33Smrg
257054e0bb33Smrg# AM_MAKE_INCLUDE()
257154e0bb33Smrg# -----------------
257254e0bb33Smrg# Check to see how make treats includes.
257354e0bb33SmrgAC_DEFUN([AM_MAKE_INCLUDE],
257454e0bb33Smrg[am_make=${MAKE-make}
257554e0bb33Smrgcat > confinc << 'END'
257654e0bb33Smrgam__doit:
257754e0bb33Smrg	@echo this is the am__doit target
257854e0bb33Smrg.PHONY: am__doit
257954e0bb33SmrgEND
258054e0bb33Smrg# If we don't find an include directive, just comment out the code.
258154e0bb33SmrgAC_MSG_CHECKING([for style of include used by $am_make])
258254e0bb33Smrgam__include="#"
258354e0bb33Smrgam__quote=
258454e0bb33Smrg_am_result=none
258554e0bb33Smrg# First try GNU make style include.
258654e0bb33Smrgecho "include confinc" > confmf
258754e0bb33Smrg# Ignore all kinds of additional output from `make'.
258854e0bb33Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
258954e0bb33Smrg*the\ am__doit\ target*)
259054e0bb33Smrg  am__include=include
259154e0bb33Smrg  am__quote=
259254e0bb33Smrg  _am_result=GNU
259354e0bb33Smrg  ;;
259454e0bb33Smrgesac
259554e0bb33Smrg# Now try BSD make style include.
259654e0bb33Smrgif test "$am__include" = "#"; then
259754e0bb33Smrg   echo '.include "confinc"' > confmf
259854e0bb33Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
259954e0bb33Smrg   *the\ am__doit\ target*)
260054e0bb33Smrg     am__include=.include
260154e0bb33Smrg     am__quote="\""
260254e0bb33Smrg     _am_result=BSD
260354e0bb33Smrg     ;;
260454e0bb33Smrg   esac
2605cea37944Smrgfi
260654e0bb33SmrgAC_SUBST([am__include])
260754e0bb33SmrgAC_SUBST([am__quote])
260854e0bb33SmrgAC_MSG_RESULT([$_am_result])
260954e0bb33Smrgrm -f confinc confmf
261054e0bb33Smrg])
261153719b08Smrg
261254e0bb33Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
261354e0bb33Smrg
261454e0bb33Smrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
261554e0bb33Smrg# Free Software Foundation, Inc.
2616cea37944Smrg#
261754e0bb33Smrg# This file is free software; the Free Software Foundation
261854e0bb33Smrg# gives unlimited permission to copy and/or distribute it,
261954e0bb33Smrg# with or without modifications, as long as this notice is preserved.
262053719b08Smrg
262154e0bb33Smrg# serial 6
262254e0bb33Smrg
262354e0bb33Smrg# AM_MISSING_PROG(NAME, PROGRAM)
262454e0bb33Smrg# ------------------------------
262554e0bb33SmrgAC_DEFUN([AM_MISSING_PROG],
262654e0bb33Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
262754e0bb33Smrg$1=${$1-"${am_missing_run}$2"}
262854e0bb33SmrgAC_SUBST($1)])
262954e0bb33Smrg
263054e0bb33Smrg
263154e0bb33Smrg# AM_MISSING_HAS_RUN
263254e0bb33Smrg# ------------------
263354e0bb33Smrg# Define MISSING if not defined so far and test if it supports --run.
263454e0bb33Smrg# If it does, set am_missing_run to use it, otherwise, to nothing.
263554e0bb33SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
263654e0bb33Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
263754e0bb33SmrgAC_REQUIRE_AUX_FILE([missing])dnl
263854e0bb33Smrgif test x"${MISSING+set}" != xset; then
263954e0bb33Smrg  case $am_aux_dir in
264054e0bb33Smrg  *\ * | *\	*)
264154e0bb33Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
264254e0bb33Smrg  *)
264354e0bb33Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
264454e0bb33Smrg  esac
2645cea37944Smrgfi
264654e0bb33Smrg# Use eval to expand $SHELL
264754e0bb33Smrgif eval "$MISSING --run true"; then
264854e0bb33Smrg  am_missing_run="$MISSING --run "
2649cea37944Smrgelse
265054e0bb33Smrg  am_missing_run=
265154e0bb33Smrg  AC_MSG_WARN([`missing' script is too old or missing])
2652cea37944Smrgfi
265354e0bb33Smrg])
265453719b08Smrg
26550309d3b3Smrg# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
26560309d3b3Smrg# Inc.
2657cea37944Smrg#
265854e0bb33Smrg# This file is free software; the Free Software Foundation
265954e0bb33Smrg# gives unlimited permission to copy and/or distribute it,
266054e0bb33Smrg# with or without modifications, as long as this notice is preserved.
266154e0bb33Smrg
26620309d3b3Smrg# serial 1
26630309d3b3Smrg
266454e0bb33Smrg# AM_PROG_MKDIR_P
266554e0bb33Smrg# ---------------
266654e0bb33Smrg# Check for `mkdir -p'.
266754e0bb33SmrgAC_DEFUN([AM_PROG_MKDIR_P],
266854e0bb33Smrg[AC_PREREQ([2.60])dnl
266954e0bb33SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
267054e0bb33Smrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
267154e0bb33Smrgdnl while keeping a definition of mkdir_p for backward compatibility.
267254e0bb33Smrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
267354e0bb33Smrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
267454e0bb33Smrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
267554e0bb33Smrgdnl adjustment using top_builddir (which is defined more often than
267654e0bb33Smrgdnl MKDIR_P).
267754e0bb33SmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
267854e0bb33Smrgcase $mkdir_p in
267954e0bb33Smrg  [[\\/$]]* | ?:[[\\/]]*) ;;
268054e0bb33Smrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
268154e0bb33Smrgesac
268254e0bb33Smrg])
268354e0bb33Smrg
268454e0bb33Smrg# Helper functions for option handling.                     -*- Autoconf -*-
268554e0bb33Smrg
26860309d3b3Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
26870309d3b3Smrg# Foundation, Inc.
2688cea37944Smrg#
268954e0bb33Smrg# This file is free software; the Free Software Foundation
269054e0bb33Smrg# gives unlimited permission to copy and/or distribute it,
269154e0bb33Smrg# with or without modifications, as long as this notice is preserved.
269254e0bb33Smrg
26930309d3b3Smrg# serial 5
269454e0bb33Smrg
269554e0bb33Smrg# _AM_MANGLE_OPTION(NAME)
269654e0bb33Smrg# -----------------------
269754e0bb33SmrgAC_DEFUN([_AM_MANGLE_OPTION],
269854e0bb33Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
269954e0bb33Smrg
270054e0bb33Smrg# _AM_SET_OPTION(NAME)
27010309d3b3Smrg# --------------------
270254e0bb33Smrg# Set option NAME.  Presently that only means defining a flag for this option.
270354e0bb33SmrgAC_DEFUN([_AM_SET_OPTION],
270454e0bb33Smrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
270554e0bb33Smrg
270654e0bb33Smrg# _AM_SET_OPTIONS(OPTIONS)
27070309d3b3Smrg# ------------------------
270854e0bb33Smrg# OPTIONS is a space-separated list of Automake options.
270954e0bb33SmrgAC_DEFUN([_AM_SET_OPTIONS],
271054e0bb33Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
271154e0bb33Smrg
271254e0bb33Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
271354e0bb33Smrg# -------------------------------------------
271454e0bb33Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
271554e0bb33SmrgAC_DEFUN([_AM_IF_OPTION],
271654e0bb33Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
271754e0bb33Smrg
271854e0bb33Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
271954e0bb33Smrg
272054e0bb33Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
272154e0bb33Smrg# Free Software Foundation, Inc.
2722cea37944Smrg#
272354e0bb33Smrg# This file is free software; the Free Software Foundation
272454e0bb33Smrg# gives unlimited permission to copy and/or distribute it,
272554e0bb33Smrg# with or without modifications, as long as this notice is preserved.
2726b1297603Smrg
272754e0bb33Smrg# serial 5
272853719b08Smrg
272954e0bb33Smrg# AM_SANITY_CHECK
273054e0bb33Smrg# ---------------
273154e0bb33SmrgAC_DEFUN([AM_SANITY_CHECK],
273254e0bb33Smrg[AC_MSG_CHECKING([whether build environment is sane])
273354e0bb33Smrg# Just in case
273454e0bb33Smrgsleep 1
273554e0bb33Smrgecho timestamp > conftest.file
273654e0bb33Smrg# Reject unsafe characters in $srcdir or the absolute working directory
273754e0bb33Smrg# name.  Accept space and tab only in the latter.
273854e0bb33Smrgam_lf='
273954e0bb33Smrg'
274054e0bb33Smrgcase `pwd` in
274154e0bb33Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
274254e0bb33Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
274354e0bb33Smrgesac
274454e0bb33Smrgcase $srcdir in
274554e0bb33Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
274654e0bb33Smrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
274753719b08Smrgesac
274853719b08Smrg
274954e0bb33Smrg# Do `set' in a subshell so we don't clobber the current shell's
275054e0bb33Smrg# arguments.  Must try -L first in case configure is actually a
275154e0bb33Smrg# symlink; some systems play weird games with the mod time of symlinks
275254e0bb33Smrg# (eg FreeBSD returns the mod time of the symlink's containing
275354e0bb33Smrg# directory).
275454e0bb33Smrgif (
275554e0bb33Smrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
275654e0bb33Smrg   if test "$[*]" = "X"; then
275754e0bb33Smrg      # -L didn't work.
275854e0bb33Smrg      set X `ls -t "$srcdir/configure" conftest.file`
275953719b08Smrg   fi
276054e0bb33Smrg   rm -f conftest.file
276154e0bb33Smrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
276254e0bb33Smrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
276354e0bb33Smrg
276454e0bb33Smrg      # If neither matched, then we have a broken ls.  This can happen
276554e0bb33Smrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
276654e0bb33Smrg      # broken ls alias from the environment.  This has actually
276754e0bb33Smrg      # happened.  Such a system could not be considered "sane".
276854e0bb33Smrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
276954e0bb33Smrgalias in your environment])
277053719b08Smrg   fi
27715b944e2aSmrg
277254e0bb33Smrg   test "$[2]" = conftest.file
277354e0bb33Smrg   )
277454e0bb33Smrgthen
277554e0bb33Smrg   # Ok.
277654e0bb33Smrg   :
277754e0bb33Smrgelse
277854e0bb33Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
277954e0bb33SmrgCheck your system clock])
2780cea37944Smrgfi
278154e0bb33SmrgAC_MSG_RESULT(yes)])
278253719b08Smrg
27830309d3b3Smrg# Copyright (C) 2009, 2011  Free Software Foundation, Inc.
278454e0bb33Smrg#
278554e0bb33Smrg# This file is free software; the Free Software Foundation
278654e0bb33Smrg# gives unlimited permission to copy and/or distribute it,
278754e0bb33Smrg# with or without modifications, as long as this notice is preserved.
2788b1297603Smrg
27890309d3b3Smrg# serial 2
2790b1297603Smrg
279154e0bb33Smrg# AM_SILENT_RULES([DEFAULT])
2792cea37944Smrg# --------------------------
279354e0bb33Smrg# Enable less verbose build rules; with the default set to DEFAULT
279454e0bb33Smrg# (`yes' being less verbose, `no' or empty being verbose).
279554e0bb33SmrgAC_DEFUN([AM_SILENT_RULES],
279654e0bb33Smrg[AC_ARG_ENABLE([silent-rules],
279754e0bb33Smrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
279854e0bb33Smrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
279954e0bb33Smrgcase $enable_silent_rules in
280054e0bb33Smrgyes) AM_DEFAULT_VERBOSITY=0;;
280154e0bb33Smrgno)  AM_DEFAULT_VERBOSITY=1;;
280254e0bb33Smrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
280354e0bb33Smrgesac
28040309d3b3Smrgdnl
28050309d3b3Smrgdnl A few `make' implementations (e.g., NonStop OS and NextStep)
28060309d3b3Smrgdnl do not support nested variable expansions.
28070309d3b3Smrgdnl See automake bug#9928 and bug#10237.
28080309d3b3Smrgam_make=${MAKE-make}
28090309d3b3SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
28100309d3b3Smrg   [am_cv_make_support_nested_variables],
28110309d3b3Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
28120309d3b3SmrgBAR0=false
28130309d3b3SmrgBAR1=true
28140309d3b3SmrgV=1
28150309d3b3Smrgam__doit:
28160309d3b3Smrg	@$(TRUE)
28170309d3b3Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
28180309d3b3Smrg  am_cv_make_support_nested_variables=yes
28190309d3b3Smrgelse
28200309d3b3Smrg  am_cv_make_support_nested_variables=no
28210309d3b3Smrgfi])
28220309d3b3Smrgif test $am_cv_make_support_nested_variables = yes; then
28230309d3b3Smrg  dnl Using `$V' instead of `$(V)' breaks IRIX make.
28240309d3b3Smrg  AM_V='$(V)'
28250309d3b3Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
28260309d3b3Smrgelse
28270309d3b3Smrg  AM_V=$AM_DEFAULT_VERBOSITY
28280309d3b3Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
28290309d3b3Smrgfi
28300309d3b3SmrgAC_SUBST([AM_V])dnl
28310309d3b3SmrgAM_SUBST_NOTMAKE([AM_V])dnl
28320309d3b3SmrgAC_SUBST([AM_DEFAULT_V])dnl
28330309d3b3SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
283454e0bb33SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
283554e0bb33SmrgAM_BACKSLASH='\'
283654e0bb33SmrgAC_SUBST([AM_BACKSLASH])dnl
283754e0bb33Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
283854e0bb33Smrg])
2839b1297603Smrg
28400309d3b3Smrg# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
284154e0bb33Smrg#
284254e0bb33Smrg# This file is free software; the Free Software Foundation
284354e0bb33Smrg# gives unlimited permission to copy and/or distribute it,
284454e0bb33Smrg# with or without modifications, as long as this notice is preserved.
28455b944e2aSmrg
28460309d3b3Smrg# serial 1
28470309d3b3Smrg
284854e0bb33Smrg# AM_PROG_INSTALL_STRIP
284954e0bb33Smrg# ---------------------
285054e0bb33Smrg# One issue with vendor `install' (even GNU) is that you can't
285154e0bb33Smrg# specify the program used to strip binaries.  This is especially
285254e0bb33Smrg# annoying in cross-compiling environments, where the build's strip
285354e0bb33Smrg# is unlikely to handle the host's binaries.
285454e0bb33Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
285554e0bb33Smrg# always use install-sh in `make install-strip', and initialize
285654e0bb33Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
285754e0bb33SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
285854e0bb33Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
285954e0bb33Smrg# Installed binaries are usually stripped using `strip' when the user
286054e0bb33Smrg# run `make install-strip'.  However `strip' might not be the right
286154e0bb33Smrg# tool to use in cross-compilation environments, therefore Automake
286254e0bb33Smrg# will honor the `STRIP' environment variable to overrule this program.
286354e0bb33Smrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
286454e0bb33Smrgif test "$cross_compiling" != no; then
286554e0bb33Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
2866cea37944Smrgfi
286754e0bb33SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
286854e0bb33SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
286953719b08Smrg
28700309d3b3Smrg# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
287154e0bb33Smrg#
287254e0bb33Smrg# This file is free software; the Free Software Foundation
287354e0bb33Smrg# gives unlimited permission to copy and/or distribute it,
287454e0bb33Smrg# with or without modifications, as long as this notice is preserved.
287553719b08Smrg
28760309d3b3Smrg# serial 3
287753719b08Smrg
287854e0bb33Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
287954e0bb33Smrg# ---------------------------
288054e0bb33Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
288154e0bb33Smrg# This macro is traced by Automake.
288254e0bb33SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
288353719b08Smrg
288454e0bb33Smrg# AM_SUBST_NOTMAKE(VARIABLE)
28850309d3b3Smrg# --------------------------
288654e0bb33Smrg# Public sister of _AM_SUBST_NOTMAKE.
288754e0bb33SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
288854e0bb33Smrg
288954e0bb33Smrg# Check how to create a tarball.                            -*- Autoconf -*-
289054e0bb33Smrg
28910309d3b3Smrg# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.
2892cea37944Smrg#
289354e0bb33Smrg# This file is free software; the Free Software Foundation
289454e0bb33Smrg# gives unlimited permission to copy and/or distribute it,
289554e0bb33Smrg# with or without modifications, as long as this notice is preserved.
289653719b08Smrg
289754e0bb33Smrg# serial 2
2898cea37944Smrg
289954e0bb33Smrg# _AM_PROG_TAR(FORMAT)
290053719b08Smrg# --------------------
290154e0bb33Smrg# Check how to create a tarball in format FORMAT.
290254e0bb33Smrg# FORMAT should be one of `v7', `ustar', or `pax'.
2903b1297603Smrg#
290454e0bb33Smrg# Substitute a variable $(am__tar) that is a command
290554e0bb33Smrg# writing to stdout a FORMAT-tarball containing the directory
290654e0bb33Smrg# $tardir.
290754e0bb33Smrg#     tardir=directory && $(am__tar) > result.tar
2908d3263506Smrg#
290954e0bb33Smrg# Substitute a variable $(am__untar) that extract such
291054e0bb33Smrg# a tarball read from stdin.
291154e0bb33Smrg#     $(am__untar) < result.tar
291254e0bb33SmrgAC_DEFUN([_AM_PROG_TAR],
29130309d3b3Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
29140309d3b3Smrg# in the wild :-(  We should find a proper way to deprecate it ...
29150309d3b3SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
291654e0bb33Smrgm4_if([$1], [v7],
29170309d3b3Smrg     [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
291854e0bb33Smrg     [m4_case([$1], [ustar],, [pax],,
291954e0bb33Smrg              [m4_fatal([Unknown tar format])])
292054e0bb33SmrgAC_MSG_CHECKING([how to create a $1 tar archive])
292154e0bb33Smrg# Loop over all known methods to create a tar archive until one works.
292254e0bb33Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
292354e0bb33Smrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
292454e0bb33Smrg# Do not fold the above two line into one, because Tru64 sh and
292554e0bb33Smrg# Solaris sh will not grok spaces in the rhs of `-'.
292654e0bb33Smrgfor _am_tool in $_am_tools
292754e0bb33Smrgdo
292854e0bb33Smrg  case $_am_tool in
292954e0bb33Smrg  gnutar)
293054e0bb33Smrg    for _am_tar in tar gnutar gtar;
293154e0bb33Smrg    do
293254e0bb33Smrg      AM_RUN_LOG([$_am_tar --version]) && break
293354e0bb33Smrg    done
293454e0bb33Smrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
293554e0bb33Smrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
293654e0bb33Smrg    am__untar="$_am_tar -xf -"
293754e0bb33Smrg    ;;
293854e0bb33Smrg  plaintar)
293954e0bb33Smrg    # Must skip GNU tar: if it does not support --format= it doesn't create
294054e0bb33Smrg    # ustar tarball either.
294154e0bb33Smrg    (tar --version) >/dev/null 2>&1 && continue
294254e0bb33Smrg    am__tar='tar chf - "$$tardir"'
294354e0bb33Smrg    am__tar_='tar chf - "$tardir"'
294454e0bb33Smrg    am__untar='tar xf -'
294554e0bb33Smrg    ;;
294654e0bb33Smrg  pax)
294754e0bb33Smrg    am__tar='pax -L -x $1 -w "$$tardir"'
294854e0bb33Smrg    am__tar_='pax -L -x $1 -w "$tardir"'
294954e0bb33Smrg    am__untar='pax -r'
295054e0bb33Smrg    ;;
295154e0bb33Smrg  cpio)
295254e0bb33Smrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
295354e0bb33Smrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
295454e0bb33Smrg    am__untar='cpio -i -H $1 -d'
295554e0bb33Smrg    ;;
295654e0bb33Smrg  none)
295754e0bb33Smrg    am__tar=false
295854e0bb33Smrg    am__tar_=false
295954e0bb33Smrg    am__untar=false
296054e0bb33Smrg    ;;
296154e0bb33Smrg  esac
296253719b08Smrg
296354e0bb33Smrg  # If the value was cached, stop now.  We just wanted to have am__tar
296454e0bb33Smrg  # and am__untar set.
296554e0bb33Smrg  test -n "${am_cv_prog_tar_$1}" && break
296653719b08Smrg
296754e0bb33Smrg  # tar/untar a dummy directory, and stop if the command works
296854e0bb33Smrg  rm -rf conftest.dir
296954e0bb33Smrg  mkdir conftest.dir
297054e0bb33Smrg  echo GrepMe > conftest.dir/file
297154e0bb33Smrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
297254e0bb33Smrg  rm -rf conftest.dir
297354e0bb33Smrg  if test -s conftest.tar; then
297454e0bb33Smrg    AM_RUN_LOG([$am__untar <conftest.tar])
297554e0bb33Smrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
297654e0bb33Smrg  fi
297754e0bb33Smrgdone
297854e0bb33Smrgrm -rf conftest.dir
297953719b08Smrg
298054e0bb33SmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
298154e0bb33SmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
298254e0bb33SmrgAC_SUBST([am__tar])
298354e0bb33SmrgAC_SUBST([am__untar])
298454e0bb33Smrg]) # _AM_PROG_TAR
2985b1297603Smrg
2986