aclocal.m4 revision 44d8e951
144d8e951Smrg# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
2ded1caa4Smrg
350539131Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
450539131Smrg# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
5ded1caa4Smrg# This file is free software; the Free Software Foundation
6ded1caa4Smrg# gives unlimited permission to copy and/or distribute it,
7ded1caa4Smrg# with or without modifications, as long as this notice is preserved.
8ded1caa4Smrg
9ded1caa4Smrg# This program is distributed in the hope that it will be useful,
10ded1caa4Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11ded1caa4Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12ded1caa4Smrg# PARTICULAR PURPOSE.
13ded1caa4Smrg
1450539131Smrgm4_ifndef([AC_AUTOCONF_VERSION],
1550539131Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1644d8e951Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
1744d8e951Smrg[m4_warning([this file was generated for autoconf 2.68.
1850539131SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
1950539131SmrgIf you have problems, you may need to regenerate the build system entirely.
2050539131SmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
21ded1caa4Smrg
2244d8e951Smrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
2344d8e951Smrgdnl
2444d8e951Smrgdnl This file comes from X.Org's font-util 1.2.0
2544d8e951Smrgdnl
2644d8e951Smrgdnl Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
2744d8e951Smrgdnl
2844d8e951Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
2944d8e951Smrgdnl copy of this software and associated documentation files (the "Software"),
3044d8e951Smrgdnl to deal in the Software without restriction, including without limitation
3144d8e951Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3244d8e951Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
3344d8e951Smrgdnl Software is furnished to do so, subject to the following conditions:
3444d8e951Smrgdnl
3544d8e951Smrgdnl The above copyright notice and this permission notice (including the next
3644d8e951Smrgdnl paragraph) shall be included in all copies or substantial portions of the
3744d8e951Smrgdnl Software.
3844d8e951Smrgdnl
3944d8e951Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4044d8e951Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4144d8e951Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
4244d8e951Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4344d8e951Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
4444d8e951Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
4544d8e951Smrgdnl DEALINGS IN THE SOFTWARE.
4644d8e951Smrgdnl
4744d8e951Smrgdnl --------------------------------------------------------------------
4844d8e951Smrgdnl
4944d8e951Smrgdnl Copyright 2005 Red Hat, Inc
5044d8e951Smrgdnl
5144d8e951Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
5244d8e951Smrgdnl documentation for any purpose is hereby granted without fee, provided that
5344d8e951Smrgdnl the above copyright notice appear in all copies and that both that
5444d8e951Smrgdnl copyright notice and this permission notice appear in supporting
5544d8e951Smrgdnl documentation.
5644d8e951Smrgdnl
5744d8e951Smrgdnl The above copyright notice and this permission notice shall be included
5844d8e951Smrgdnl in all copies or substantial portions of the Software.
5944d8e951Smrgdnl
6044d8e951Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
6144d8e951Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
6244d8e951Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
6344d8e951Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
6444d8e951Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
6544d8e951Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
6644d8e951Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
6744d8e951Smrgdnl
6844d8e951Smrgdnl Except as contained in this notice, the name of the copyright holders shall
6944d8e951Smrgdnl not be used in advertising or otherwise to promote the sale, use or
7044d8e951Smrgdnl other dealings in this Software without prior written authorization
7144d8e951Smrgdnl from the copyright holders.
7244d8e951Smrg
7344d8e951Smrg# XORG_FONT_MACROS_VERSION(required-version)
7444d8e951Smrg# ------------------------------------------
7544d8e951Smrg# Minimum version: 1.1.0
7650539131Smrg#
7744d8e951Smrg# If you're using a macro added in Version 1.1 or newer, include this in
7844d8e951Smrg# your configure.ac with the minimum required version, such as:
7944d8e951Smrg# XORG_FONT_MACROS_VERSION(1.1)
8044d8e951Smrg#
8144d8e951Smrg# To ensure that this macro is defined, also add:
8244d8e951Smrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
8344d8e951Smrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
8444d8e951Smrg#
8544d8e951Smrg#
8644d8e951Smrg# See the "minimum version" comment for each macro you use to see what
8744d8e951Smrg# version you require.
8844d8e951Smrgm4_defun([XORG_FONT_MACROS_VERSION],[
8944d8e951Smrgm4_define([vers_have], [1.2.0])
9044d8e951Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
9144d8e951Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
9244d8e951Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
9344d8e951Smrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
9444d8e951Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
9544d8e951Smrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
9644d8e951Smrgm4_undefine([vers_have])
9744d8e951Smrgm4_undefine([maj_have])
9844d8e951Smrgm4_undefine([maj_needed])
9944d8e951Smrg]) # XORG_FONT_MACROS_VERSION
100ded1caa4Smrg
10144d8e951Smrg# XORG_FONT_CHECK_{maps}()
10244d8e951Smrg# ------------------------
10344d8e951Smrg# Minimum version: 1.0.0
10444d8e951Smrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
10544d8e951Smrg# JISX0201 or KOI8_R.  By default, they are all enabled.
10650539131Smrg
10744d8e951SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
10844d8e951SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
10944d8e951SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
11044d8e951SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
11144d8e951SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
11244d8e951SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
11344d8e951SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
11444d8e951SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
11544d8e951SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
11644d8e951SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
11744d8e951SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
11844d8e951SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
11944d8e951SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
12044d8e951SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
12144d8e951SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
12244d8e951SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
12344d8e951SmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
12444d8e951SmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
125ded1caa4Smrg
12644d8e951Smrg# XORG_FONT_CHECK_ENCODING(encoding)
12744d8e951Smrg# ----------------------------------
12844d8e951Smrg# Minimum version: 1.1.0
12944d8e951Smrg# This macro adds --enable/disable-<encoding>, enabled by default.
13044d8e951Smrg# It replaced individual copies of this code in the above macros in 1.1.
13144d8e951Smrg# Currently assumes encoding names will be all upper-case - add m4_toupper
13244d8e951Smrg# calls if this is not true in the future.
133ded1caa4Smrg
13444d8e951SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
13544d8e951Smrg	AC_ARG_ENABLE(m4_tolower($1),
13644d8e951Smrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
13744d8e951Smrg				[Build $1 fonts (default: yes)]),
13844d8e951Smrg		[AS_TR_SH($1)=$enableval])
13944d8e951Smrg	AC_MSG_CHECKING([whether to build $1 fonts])
14044d8e951Smrg	AC_MSG_RESULT($[AS_TR_SH($1)])
14144d8e951Smrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
14244d8e951Smrg]) # XORG_FONT_CHECK_ENCODING
143ded1caa4Smrg
14444d8e951Smrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
14544d8e951Smrg# -----------------------------------------------------
14644d8e951Smrg# Minimum version: 1.1.0
14744d8e951Smrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
14844d8e951Smrg# Add a shorthand --enable/disable-all-encodings option.
149ded1caa4Smrg
15044d8e951SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
15144d8e951Smrg	AC_ARG_ENABLE([all-encodings],
15244d8e951Smrg		AS_HELP_STRING([--disable-all-encodings],
15344d8e951Smrg				[Disable building of all font encodings]),
15444d8e951Smrg		[m4_foreach_w([enc], [$1], [
15544d8e951Smrg			AS_TR_SH(enc)=$enableval
15644d8e951Smrg		])],
15744d8e951Smrg		[m4_foreach_w([enc], [$1], [
15844d8e951Smrg			AS_TR_SH(enc)=yes
15944d8e951Smrg		])])
16044d8e951Smrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
16144d8e951Smrg]) # XORG_FONT_CHECK_ENCODING_LIST
16244d8e951Smrg
16344d8e951Smrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
16444d8e951Smrg# ------------------------------------------
16544d8e951Smrg# Minimum version: 1.1.0
166ded1caa4Smrg#
16744d8e951Smrg# Simple wrapper around AC_PATH_PROG that errors if not found
168ded1caa4Smrg#
169ded1caa4Smrg
17044d8e951SmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
17144d8e951Smrg	AC_PATH_PROG($1, $2)
17244d8e951Smrg	if test x"$$1" = x; then
17344d8e951Smrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
17444d8e951Smrg	fi
175ded1caa4Smrg])
176ded1caa4Smrg
177ded1caa4Smrg
17844d8e951Smrg# XORG_FONT_FCCACHE()
17944d8e951Smrg# -------------------
18044d8e951Smrg# Minimum version: 1.1.0
18150539131Smrg#
18244d8e951Smrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
18344d8e951Smrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
18444d8e951Smrg# to run fc-cache if found and not installing to $DESTDIR
18544d8e951Smrg#
18644d8e951Smrg# fc-cache is optional, not required, and should be skipped when making
18744d8e951Smrg# packages (installing to $DESTDIR).
18844d8e951Smrg#
18944d8e951SmrgAC_DEFUN([XORG_FONT_FCCACHE],[
19044d8e951Smrg	AC_PATH_PROG(FCCACHE, fc-cache)
19144d8e951Smrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
19244d8e951Smrg	if test x"$FCCACHE" = x ; then
19344d8e951Smrg		RUN_FCCACHE="${FCCACHE_WARN}"
19444d8e951Smrg	else
19544d8e951Smrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
19644d8e951Smrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
19744d8e951Smrg	fi
19844d8e951Smrg	AC_SUBST([RUN_FCCACHE])
19944d8e951Smrg])
200ded1caa4Smrg
201ded1caa4Smrg
20244d8e951Smrg# XORG_FONT_COMMON_UTILS()
20344d8e951Smrg# ------------------------
20444d8e951Smrg# Minimum version: 1.1.0
20550539131Smrg#
20644d8e951Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
207ded1caa4Smrg
20844d8e951SmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
20944d8e951Smrg	XORG_FONT_FCCACHE
21044d8e951Smrg	XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
21144d8e951Smrg])
212ded1caa4Smrg
21344d8e951Smrg# XORG_FONT_SCALED_UTILS()
21444d8e951Smrg# ------------------------
21544d8e951Smrg# Minimum version: 1.1.0
21644d8e951Smrg#
21744d8e951Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
21844d8e951Smrg# (TrueType, OpenType, Type1)
219ded1caa4Smrg
22044d8e951SmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
22144d8e951Smrg	XORG_FONT_COMMON_UTILS
22244d8e951Smrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
22344d8e951Smrg])
224ded1caa4Smrg
22544d8e951Smrg# XORG_FONT_BDF_UTILS()
22644d8e951Smrg# ---------------------
22744d8e951Smrg# Minimum version: 1.1.0
228ded1caa4Smrg#
22944d8e951Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
23044d8e951Smrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
23144d8e951Smrg# PCF output files created by bdftopcf
232ded1caa4Smrg
23344d8e951SmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
23444d8e951Smrg	XORG_FONT_COMMON_UTILS
23544d8e951Smrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
23644d8e951Smrg	XORG_FONT_CHECK_COMPRESSION
23744d8e951Smrg])
238ded1caa4Smrg
23944d8e951Smrg# XORG_FONT_CHECK_COMPRESSION()
24044d8e951Smrg# -----------------------------
24144d8e951Smrg# Minimum version: 1.1.0
24244d8e951Smrg#
24344d8e951Smrg# Offer a --with-compression flag to control what compression method is
24444d8e951Smrg# used for pcf font files.   Offers all the methods currently supported
24544d8e951Smrg# by libXfont, including no compression.
24650539131Smrg
24744d8e951SmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
24844d8e951Smrg	AC_MSG_CHECKING([font compression method])
24944d8e951Smrg	AC_ARG_WITH(compression,
25044d8e951Smrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
25144d8e951Smrg			 [compression method to use on pcf fonts])],
25244d8e951Smrg         [compression="$withval"], [compression="yes"])
25344d8e951Smrg	if test x"$compression" = "xyes" ; then
25444d8e951Smrg		compression="gzip"
25544d8e951Smrg	fi
25644d8e951Smrg	AC_MSG_RESULT([${compression}])
25744d8e951Smrg	case ${compression} in
25844d8e951Smrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
25944d8e951Smrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;;
26044d8e951Smrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
26144d8e951Smrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
26244d8e951Smrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
26344d8e951Smrg	esac
26444d8e951Smrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
26544d8e951Smrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
26644d8e951Smrg	fi
26744d8e951Smrg	AC_SUBST([COMPRESS_SUFFIX])
26844d8e951Smrg])
269ded1caa4Smrg
27044d8e951Smrg# XORG_FONT_UCS2ANY()
27144d8e951Smrg# -------------------
27244d8e951Smrg# Minimum version: 1.1.0
27344d8e951Smrg#
27444d8e951Smrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
27544d8e951Smrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
27644d8e951Smrg# Also call pkg-config to find the directory with the encoding files needed
27744d8e951Smrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
278ded1caa4Smrg
27944d8e951SmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
28044d8e951Smrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
28144d8e951Smrg	PKG_CHECK_MODULES(MAPS, [fontutil])
28244d8e951Smrg	AC_MSG_CHECKING([for ucs2any encoding data files])
28344d8e951Smrg	MAPFILES_PATH=`pkg-config --variable=mapdir fontutil`
28444d8e951Smrg	AC_SUBST(MAPFILES_PATH)
28544d8e951Smrg	AC_MSG_RESULT([${MAPFILES_PATH}])
28650539131Smrg])
28750539131Smrg
28850539131Smrg
28950539131Smrg
29044d8e951Smrg# XORG_FONT_FC_CONFDIR()
29144d8e951Smrg# --------------------
29244d8e951Smrg# Minimum version: 1.2.0
29344d8e951Smrg#
29444d8e951Smrg# Sets FC_CONFDIR to the fontconfig config directory
29544d8e951Smrg# (which should be --with-confdir=... when building fontconfig)
29644d8e951Smrg# found from:
29744d8e951Smrg#	--with-fc-confdir=...
29844d8e951Smrg#	pkg-config --variable=confdir fontconfig
29944d8e951Smrg#	${sysconfdir}/fonts
30050539131Smrg
30144d8e951SmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
30244d8e951Smrg	dnl Ensure $PKG_CONFIG is set first
30344d8e951Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
30444d8e951Smrg
30544d8e951Smrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
30644d8e951Smrg	AC_ARG_WITH(fc-confdir,
30744d8e951Smrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
30844d8e951Smrg			   [Path to fontconfig's configuration directory]),
30944d8e951Smrg		    [FC_CONFDIR="$withval"])
31044d8e951Smrg	# if --with-fc-confdir was not specified
31144d8e951Smrg	if test "x${FC_CONFDIR}" = "x"; then
31244d8e951Smrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
31344d8e951Smrg	fi
31444d8e951Smrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
31544d8e951Smrg	if test "x${FC_CONFDIR}" = "x"; then
31644d8e951Smrg		FC_CONFDIR="${sysconfdir}/fonts"
31744d8e951Smrg	fi
31844d8e951Smrg	AC_SUBST(FC_CONFDIR)
31944d8e951Smrg	AC_MSG_RESULT([${FC_CONFDIR}])
32050539131Smrg])
32150539131Smrg
32250539131Smrg
32344d8e951Smrg
32444d8e951Smrg# XORG_FONTROOTDIR()
32544d8e951Smrg# --------------------
32644d8e951Smrg# Minimum version: 1.1.0
32750539131Smrg#
32844d8e951Smrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
32944d8e951Smrg# found from:
33044d8e951Smrg#	--with-fontrootdir
33144d8e951Smrg#	pkg-config --variable=fontrootdir fontutil
33244d8e951Smrg#	${datadir}/fonts/X11
33350539131Smrg
33444d8e951SmrgAC_DEFUN([XORG_FONTROOTDIR],[
33544d8e951Smrg	dnl Ensure $PKG_CONFIG is set first
33644d8e951Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
33750539131Smrg
33844d8e951Smrg	AC_MSG_CHECKING([for root directory for font files])
33944d8e951Smrg	AC_ARG_WITH(fontrootdir,
34044d8e951Smrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
34144d8e951Smrg			   [Path to root directory for font files]),
34244d8e951Smrg		    [FONTROOTDIR="$withval"])
34344d8e951Smrg	# if --with-fontrootdir not specified...
34444d8e951Smrg	if test "x${FONTROOTDIR}" = "x"; then
34544d8e951Smrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
34644d8e951Smrg	fi
34744d8e951Smrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
34844d8e951Smrg	if test "x${FONTROOTDIR}" = "x"; then
34944d8e951Smrg		FONTROOTDIR="${datadir}/fonts/X11"
35044d8e951Smrg	fi
35144d8e951Smrg	AC_SUBST(FONTROOTDIR)
35244d8e951Smrg	AC_MSG_RESULT([${FONTROOTDIR}])
35344d8e951Smrg])
35450539131Smrg
35544d8e951Smrg# XORG_FONTSUBDIR(variable, flag, subdir)
35644d8e951Smrg# ---------------------------------------
35744d8e951Smrg# Minimum version: 1.1.0
35850539131Smrg#
35944d8e951Smrg# Offer a --with-<flag> flag to control directory for font installation
36044d8e951Smrg# Default is the specified <subdir> of the font root directory.
36144d8e951Smrg# Sets <variable> to the selected directory
36250539131Smrg
36344d8e951SmrgAC_DEFUN([XORG_FONTSUBDIR],[
36444d8e951Smrg	AC_REQUIRE([XORG_FONTROOTDIR])
36550539131Smrg
36644d8e951Smrg	AC_MSG_CHECKING([for directory for $3 files])
36744d8e951Smrg	AC_ARG_WITH($2,
36844d8e951Smrg		    [AS_HELP_STRING([--with-$2=DIR],
36944d8e951Smrg				    [Path to $3 files [FONTROOTDIR/$3]])],
37044d8e951Smrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
37144d8e951Smrg	AC_SUBST($1)
37244d8e951Smrg	AC_MSG_RESULT([${$1}])
37344d8e951Smrg]) # XORG_FONTSUBDIR
37444d8e951Smrg
37544d8e951Smrg# XORG_FONTDIR(subdir)
37644d8e951Smrg# --------------------
37744d8e951Smrg# Minimum version: 1.1.0
37850539131Smrg#
37944d8e951Smrg# Offer a --with-fontdir flag to control directory for font installation
38044d8e951Smrg# Default is the specified subdir of the font root directory.
38144d8e951Smrg# Sets FONTDIR to the selected directory
38250539131Smrg
38344d8e951SmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
38450539131Smrg
38544d8e951Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
38644d8e951Smrg# serial 1 (pkg-config-0.24)
38744d8e951Smrg# 
38844d8e951Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
38944d8e951Smrg#
39044d8e951Smrg# This program is free software; you can redistribute it and/or modify
39144d8e951Smrg# it under the terms of the GNU General Public License as published by
39244d8e951Smrg# the Free Software Foundation; either version 2 of the License, or
39344d8e951Smrg# (at your option) any later version.
39444d8e951Smrg#
39544d8e951Smrg# This program is distributed in the hope that it will be useful, but
39644d8e951Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
39744d8e951Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
39844d8e951Smrg# General Public License for more details.
39944d8e951Smrg#
40044d8e951Smrg# You should have received a copy of the GNU General Public License
40144d8e951Smrg# along with this program; if not, write to the Free Software
40244d8e951Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
40344d8e951Smrg#
40444d8e951Smrg# As a special exception to the GNU General Public License, if you
40544d8e951Smrg# distribute this file as part of a program that contains a
40644d8e951Smrg# configuration script generated by Autoconf, you may include it under
40744d8e951Smrg# the same distribution terms that you use for the rest of that program.
40850539131Smrg
40944d8e951Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
41044d8e951Smrg# ----------------------------------
41144d8e951SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
41244d8e951Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
41344d8e951Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
41444d8e951SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
41544d8e951SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
41644d8e951SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
41750539131Smrg
41844d8e951Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
41944d8e951Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
42050539131Smrgfi
42144d8e951Smrgif test -n "$PKG_CONFIG"; then
42244d8e951Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
42344d8e951Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
42444d8e951Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
42544d8e951Smrg		AC_MSG_RESULT([yes])
42644d8e951Smrg	else
42744d8e951Smrg		AC_MSG_RESULT([no])
42844d8e951Smrg		PKG_CONFIG=""
42944d8e951Smrg	fi
43044d8e951Smrgfi[]dnl
43144d8e951Smrg])# PKG_PROG_PKG_CONFIG
43250539131Smrg
43344d8e951Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
43444d8e951Smrg#
43544d8e951Smrg# Check to see whether a particular set of modules exists.  Similar
43644d8e951Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
43744d8e951Smrg#
43844d8e951Smrg# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
43944d8e951Smrg# only at the first occurence in configure.ac, so if the first place
44044d8e951Smrg# it's called might be skipped (such as if it is within an "if", you
44144d8e951Smrg# have to call PKG_CHECK_EXISTS manually
44244d8e951Smrg# --------------------------------------------------------------
44344d8e951SmrgAC_DEFUN([PKG_CHECK_EXISTS],
44444d8e951Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
44544d8e951Smrgif test -n "$PKG_CONFIG" && \
44644d8e951Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
44744d8e951Smrg  m4_default([$2], [:])
44844d8e951Smrgm4_ifvaln([$3], [else
44944d8e951Smrg  $3])dnl
45044d8e951Smrgfi])
45150539131Smrg
45244d8e951Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
45344d8e951Smrg# ---------------------------------------------
45444d8e951Smrgm4_define([_PKG_CONFIG],
45544d8e951Smrg[if test -n "$$1"; then
45644d8e951Smrg    pkg_cv_[]$1="$$1"
45744d8e951Smrg elif test -n "$PKG_CONFIG"; then
45844d8e951Smrg    PKG_CHECK_EXISTS([$3],
45944d8e951Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
46044d8e951Smrg		     [pkg_failed=yes])
46144d8e951Smrg else
46244d8e951Smrg    pkg_failed=untried
46344d8e951Smrgfi[]dnl
46444d8e951Smrg])# _PKG_CONFIG
46550539131Smrg
46644d8e951Smrg# _PKG_SHORT_ERRORS_SUPPORTED
46744d8e951Smrg# -----------------------------
46844d8e951SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
46944d8e951Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
47044d8e951Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
47144d8e951Smrg        _pkg_short_errors_supported=yes
47244d8e951Smrgelse
47344d8e951Smrg        _pkg_short_errors_supported=no
47444d8e951Smrgfi[]dnl
47544d8e951Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
47650539131Smrg
47750539131Smrg
47844d8e951Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
47944d8e951Smrg# [ACTION-IF-NOT-FOUND])
48044d8e951Smrg#
48144d8e951Smrg#
48244d8e951Smrg# Note that if there is a possibility the first call to
48344d8e951Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
48444d8e951Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
48544d8e951Smrg#
48644d8e951Smrg#
48744d8e951Smrg# --------------------------------------------------------------
48844d8e951SmrgAC_DEFUN([PKG_CHECK_MODULES],
48944d8e951Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
49044d8e951SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
49144d8e951SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
49250539131Smrg
49344d8e951Smrgpkg_failed=no
49444d8e951SmrgAC_MSG_CHECKING([for $1])
49544d8e951Smrg
49644d8e951Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
49744d8e951Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
49844d8e951Smrg
49944d8e951Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
50044d8e951Smrgand $1[]_LIBS to avoid the need to call pkg-config.
50144d8e951SmrgSee the pkg-config man page for more details.])
50244d8e951Smrg
50344d8e951Smrgif test $pkg_failed = yes; then
50444d8e951Smrg   	AC_MSG_RESULT([no])
50544d8e951Smrg        _PKG_SHORT_ERRORS_SUPPORTED
50644d8e951Smrg        if test $_pkg_short_errors_supported = yes; then
50744d8e951Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
50844d8e951Smrg        else 
50944d8e951Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
51044d8e951Smrg        fi
51144d8e951Smrg	# Put the nasty error message in config.log where it belongs
51244d8e951Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
51344d8e951Smrg
51444d8e951Smrg	m4_default([$4], [AC_MSG_ERROR(
51544d8e951Smrg[Package requirements ($2) were not met:
51644d8e951Smrg
51744d8e951Smrg$$1_PKG_ERRORS
51844d8e951Smrg
51944d8e951SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
52044d8e951Smrginstalled software in a non-standard prefix.
52144d8e951Smrg
52244d8e951Smrg_PKG_TEXT])[]dnl
52344d8e951Smrg        ])
52444d8e951Smrgelif test $pkg_failed = untried; then
52544d8e951Smrg     	AC_MSG_RESULT([no])
52644d8e951Smrg	m4_default([$4], [AC_MSG_FAILURE(
52744d8e951Smrg[The pkg-config script could not be found or is too old.  Make sure it
52844d8e951Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
52944d8e951Smrgpath to pkg-config.
53044d8e951Smrg
53144d8e951Smrg_PKG_TEXT
53244d8e951Smrg
53344d8e951SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])dnl
53444d8e951Smrg        ])
53544d8e951Smrgelse
53644d8e951Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
53744d8e951Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
53844d8e951Smrg        AC_MSG_RESULT([yes])
53944d8e951Smrg	$3
54044d8e951Smrgfi[]dnl
54144d8e951Smrg])# PKG_CHECK_MODULES
54250539131Smrg
54344d8e951Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
54444d8e951Smrgdnl
54544d8e951Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
54644d8e951Smrgdnl 
54744d8e951Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
54844d8e951Smrgdnl copy of this software and associated documentation files (the "Software"),
54944d8e951Smrgdnl to deal in the Software without restriction, including without limitation
55044d8e951Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
55144d8e951Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
55244d8e951Smrgdnl Software is furnished to do so, subject to the following conditions:
55344d8e951Smrgdnl
55444d8e951Smrgdnl The above copyright notice and this permission notice (including the next
55544d8e951Smrgdnl paragraph) shall be included in all copies or substantial portions of the
55644d8e951Smrgdnl Software.
55744d8e951Smrgdnl
55844d8e951Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
55944d8e951Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
56044d8e951Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
56144d8e951Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
56244d8e951Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
56344d8e951Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
56444d8e951Smrgdnl DEALINGS IN THE SOFTWARE.
56550539131Smrg
56644d8e951Smrg# XORG_MACROS_VERSION(required-version)
56744d8e951Smrg# -------------------------------------
56844d8e951Smrg# Minimum version: 1.1.0
56950539131Smrg#
57044d8e951Smrg# If you're using a macro added in Version 1.1 or newer, include this in
57144d8e951Smrg# your configure.ac with the minimum required version, such as:
57244d8e951Smrg# XORG_MACROS_VERSION(1.1)
57344d8e951Smrg#
57444d8e951Smrg# To ensure that this macro is defined, also add:
57544d8e951Smrg# m4_ifndef([XORG_MACROS_VERSION],
57644d8e951Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
57744d8e951Smrg#
57844d8e951Smrg#
57944d8e951Smrg# See the "minimum version" comment for each macro you use to see what 
58044d8e951Smrg# version you require.
58144d8e951Smrgm4_defun([XORG_MACROS_VERSION],[
58244d8e951Smrgm4_define([vers_have], [1.11.0])
58344d8e951Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
58444d8e951Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
58544d8e951Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
58644d8e951Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
58744d8e951Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
58844d8e951Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
58944d8e951Smrgm4_undefine([vers_have])
59044d8e951Smrgm4_undefine([maj_have])
59144d8e951Smrgm4_undefine([maj_needed])
59244d8e951Smrg]) # XORG_MACROS_VERSION
59350539131Smrg
59444d8e951Smrg# XORG_PROG_RAWCPP()
59550539131Smrg# ------------------
59644d8e951Smrg# Minimum version: 1.0.0
59750539131Smrg#
59844d8e951Smrg# Find cpp program and necessary flags for use in pre-processing text files
59944d8e951Smrg# such as man pages and config files
60044d8e951SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
60144d8e951SmrgAC_REQUIRE([AC_PROG_CPP])
60244d8e951SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
60344d8e951Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
60450539131Smrg
60544d8e951Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
60644d8e951Smrg# which is not the best choice for supporting other OS'es, but covers most
60744d8e951Smrg# of the ones we need for now.
60844d8e951SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
60944d8e951SmrgAC_LANG_CONFTEST([Does cpp redefine unix ?])
61044d8e951Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
61144d8e951Smrg	AC_MSG_RESULT([no])
61250539131Smrgelse
61344d8e951Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
61444d8e951Smrg		RAWCPPFLAGS=-undef
61544d8e951Smrg		AC_MSG_RESULT([yes])
61644d8e951Smrg	# under Cygwin unix is still defined even with -undef
61744d8e951Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
61844d8e951Smrg		RAWCPPFLAGS="-undef -ansi"
61944d8e951Smrg		AC_MSG_RESULT([yes, with -ansi])
62044d8e951Smrg	else
62144d8e951Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
62244d8e951Smrg	fi
62350539131Smrgfi
62444d8e951Smrgrm -f conftest.$ac_ext
62550539131Smrg
62644d8e951SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
62744d8e951SmrgAC_LANG_CONFTEST([Does cpp preserve   "whitespace"?])
62844d8e951Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
62944d8e951Smrg	AC_MSG_RESULT([no])
63044d8e951Smrgelse
63144d8e951Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
63244d8e951Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
63344d8e951Smrg		AC_MSG_RESULT([yes])
63444d8e951Smrg	else
63544d8e951Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
63644d8e951Smrg	fi
63744d8e951Smrgfi
63844d8e951Smrgrm -f conftest.$ac_ext
63944d8e951SmrgAC_SUBST(RAWCPPFLAGS)
64044d8e951Smrg]) # XORG_PROG_RAWCPP
64150539131Smrg
64244d8e951Smrg# XORG_MANPAGE_SECTIONS()
64344d8e951Smrg# -----------------------
64444d8e951Smrg# Minimum version: 1.0.0
64550539131Smrg#
64644d8e951Smrg# Determine which sections man pages go in for the different man page types
64744d8e951Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
64844d8e951Smrg# Not sure if there's any better way than just hardcoding by OS name.
64944d8e951Smrg# Override default settings by setting environment variables
65044d8e951Smrg# Added MAN_SUBSTS in version 1.8
65144d8e951Smrg# Added AC_PROG_SED in version 1.8
65250539131Smrg
65344d8e951SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
65444d8e951SmrgAC_REQUIRE([AC_CANONICAL_HOST])
65544d8e951SmrgAC_REQUIRE([AC_PROG_SED])
65650539131Smrg
65744d8e951Smrgif test x$APP_MAN_SUFFIX = x    ; then
65844d8e951Smrg    APP_MAN_SUFFIX=1
65944d8e951Smrgfi
66044d8e951Smrgif test x$APP_MAN_DIR = x    ; then
66144d8e951Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
66244d8e951Smrgfi
66350539131Smrg
66444d8e951Smrgif test x$LIB_MAN_SUFFIX = x    ; then
66544d8e951Smrg    LIB_MAN_SUFFIX=3
66644d8e951Smrgfi
66744d8e951Smrgif test x$LIB_MAN_DIR = x    ; then
66844d8e951Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
66944d8e951Smrgfi
67050539131Smrg
67144d8e951Smrgif test x$FILE_MAN_SUFFIX = x    ; then
67244d8e951Smrg    case $host_os in
67344d8e951Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
67444d8e951Smrg	*)		FILE_MAN_SUFFIX=5  ;;
67544d8e951Smrg    esac
67644d8e951Smrgfi
67744d8e951Smrgif test x$FILE_MAN_DIR = x    ; then
67844d8e951Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
67944d8e951Smrgfi
68050539131Smrg
68144d8e951Smrgif test x$MISC_MAN_SUFFIX = x    ; then
68244d8e951Smrg    case $host_os in
68344d8e951Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
68444d8e951Smrg	*)		MISC_MAN_SUFFIX=7  ;;
68544d8e951Smrg    esac
68644d8e951Smrgfi
68744d8e951Smrgif test x$MISC_MAN_DIR = x    ; then
68844d8e951Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
68944d8e951Smrgfi
69050539131Smrg
69144d8e951Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
69244d8e951Smrg    case $host_os in
69344d8e951Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
69444d8e951Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
69544d8e951Smrg    esac
69644d8e951Smrgfi
69744d8e951Smrgif test x$DRIVER_MAN_DIR = x    ; then
69844d8e951Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
69944d8e951Smrgfi
70050539131Smrg
70144d8e951Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
70244d8e951Smrg    case $host_os in
70344d8e951Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
70444d8e951Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
70544d8e951Smrg    esac
70644d8e951Smrgfi
70744d8e951Smrgif test x$ADMIN_MAN_DIR = x    ; then
70844d8e951Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
70950539131Smrgfi
71050539131Smrg
71150539131Smrg
71244d8e951SmrgAC_SUBST([APP_MAN_SUFFIX])
71344d8e951SmrgAC_SUBST([LIB_MAN_SUFFIX])
71444d8e951SmrgAC_SUBST([FILE_MAN_SUFFIX])
71544d8e951SmrgAC_SUBST([MISC_MAN_SUFFIX])
71644d8e951SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
71744d8e951SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
71844d8e951SmrgAC_SUBST([APP_MAN_DIR])
71944d8e951SmrgAC_SUBST([LIB_MAN_DIR])
72044d8e951SmrgAC_SUBST([FILE_MAN_DIR])
72144d8e951SmrgAC_SUBST([MISC_MAN_DIR])
72244d8e951SmrgAC_SUBST([DRIVER_MAN_DIR])
72344d8e951SmrgAC_SUBST([ADMIN_MAN_DIR])
72450539131Smrg
72544d8e951SmrgXORG_MAN_PAGE="X Version 11"
72644d8e951SmrgAC_SUBST([XORG_MAN_PAGE])
72744d8e951SmrgMAN_SUBSTS="\
72844d8e951Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
72944d8e951Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
73044d8e951Smrg	-e 's|__xservername__|Xorg|g' \
73144d8e951Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
73244d8e951Smrg	-e 's|__projectroot__|\$(prefix)|g' \
73344d8e951Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
73444d8e951Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
73544d8e951Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
73644d8e951Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
73744d8e951Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
73844d8e951Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
73944d8e951Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
74044d8e951SmrgAC_SUBST([MAN_SUBSTS])
74150539131Smrg
74244d8e951Smrg]) # XORG_MANPAGE_SECTIONS
74350539131Smrg
74444d8e951Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
74544d8e951Smrg# ------------------------
74644d8e951Smrg# Minimum version: 1.7.0
74744d8e951Smrg#
74844d8e951Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
74944d8e951Smrg# provided by xorg-sgml-doctools, if installed.
75044d8e951SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
75144d8e951SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
75244d8e951SmrgXORG_SGML_PATH=
75344d8e951SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
75444d8e951Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
75544d8e951Smrg    [m4_ifval([$1],[:],
75644d8e951Smrg        [if test x"$cross_compiling" != x"yes" ; then
75744d8e951Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
75844d8e951Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
75944d8e951Smrg         fi])
76044d8e951Smrg    ])
76144d8e951Smrg
76244d8e951Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
76344d8e951Smrg# the path and the name of the doc stylesheet
76444d8e951Smrgif test "x$XORG_SGML_PATH" != "x" ; then
76544d8e951Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
76644d8e951Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
76744d8e951Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
76850539131Smrgelse
76944d8e951Smrg   AC_MSG_RESULT([no])
77050539131Smrgfi
77150539131Smrg
77244d8e951SmrgAC_SUBST(XORG_SGML_PATH)
77344d8e951SmrgAC_SUBST(STYLESHEET_SRCDIR)
77444d8e951SmrgAC_SUBST(XSL_STYLESHEET)
77544d8e951SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
77644d8e951Smrg]) # XORG_CHECK_SGML_DOCTOOLS
77744d8e951Smrg
77844d8e951Smrg# XORG_CHECK_LINUXDOC
77944d8e951Smrg# -------------------
78044d8e951Smrg# Minimum version: 1.0.0
78150539131Smrg#
78244d8e951Smrg# Defines the variable MAKE_TEXT if the necessary tools and
78344d8e951Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
78444d8e951Smrg# Whether or not the necessary tools and files are found can be checked
78544d8e951Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
78644d8e951SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
78744d8e951SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
78844d8e951SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
78950539131Smrg
79044d8e951SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
79150539131Smrg
79244d8e951SmrgAC_MSG_CHECKING([whether to build documentation])
79350539131Smrg
79444d8e951Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
79544d8e951Smrg   BUILDDOC=yes
79644d8e951Smrgelse
79744d8e951Smrg   BUILDDOC=no
79844d8e951Smrgfi
79950539131Smrg
80044d8e951SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
80150539131Smrg
80244d8e951SmrgAC_MSG_RESULT([$BUILDDOC])
80350539131Smrg
80444d8e951SmrgAC_MSG_CHECKING([whether to build pdf documentation])
80550539131Smrg
80644d8e951Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
80744d8e951Smrg   BUILDPDFDOC=yes
80844d8e951Smrgelse
80944d8e951Smrg   BUILDPDFDOC=no
81044d8e951Smrgfi
81150539131Smrg
81244d8e951SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
81350539131Smrg
81444d8e951SmrgAC_MSG_RESULT([$BUILDPDFDOC])
81550539131Smrg
81644d8e951SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
81744d8e951SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
81844d8e951SmrgMAKE_PDF="$PS2PDF"
81944d8e951SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
82050539131Smrg
82144d8e951SmrgAC_SUBST(MAKE_TEXT)
82244d8e951SmrgAC_SUBST(MAKE_PS)
82344d8e951SmrgAC_SUBST(MAKE_PDF)
82444d8e951SmrgAC_SUBST(MAKE_HTML)
82544d8e951Smrg]) # XORG_CHECK_LINUXDOC
82650539131Smrg
82744d8e951Smrg# XORG_CHECK_DOCBOOK
82844d8e951Smrg# -------------------
82944d8e951Smrg# Minimum version: 1.0.0
83044d8e951Smrg#
83144d8e951Smrg# Checks for the ability to build output formats from SGML DocBook source.
83244d8e951Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
83344d8e951Smrg# indicates whether the necessary tools and files are found and, if set,
83444d8e951Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
83544d8e951SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
83644d8e951SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
83750539131Smrg
83844d8e951SmrgBUILDTXTDOC=no
83944d8e951SmrgBUILDPDFDOC=no
84044d8e951SmrgBUILDPSDOC=no
84144d8e951SmrgBUILDHTMLDOC=no
84250539131Smrg
84344d8e951SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
84444d8e951SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
84544d8e951SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
84644d8e951SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
84750539131Smrg
84844d8e951SmrgAC_MSG_CHECKING([whether to build text documentation])
84944d8e951Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
85044d8e951Smrg   test x$BUILD_TXTDOC != xno; then
85144d8e951Smrg	BUILDTXTDOC=yes
85250539131Smrgfi
85344d8e951SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
85444d8e951SmrgAC_MSG_RESULT([$BUILDTXTDOC])
85550539131Smrg
85644d8e951SmrgAC_MSG_CHECKING([whether to build PDF documentation])
85744d8e951Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
85844d8e951Smrg   test x$BUILD_PDFDOC != xno; then
85944d8e951Smrg	BUILDPDFDOC=yes
86044d8e951Smrgfi
86144d8e951SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
86244d8e951SmrgAC_MSG_RESULT([$BUILDPDFDOC])
86350539131Smrg
86444d8e951SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
86544d8e951Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
86644d8e951Smrg   test x$BUILD_PSDOC != xno; then
86744d8e951Smrg	BUILDPSDOC=yes
86844d8e951Smrgfi
86944d8e951SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
87044d8e951SmrgAC_MSG_RESULT([$BUILDPSDOC])
87150539131Smrg
87244d8e951SmrgAC_MSG_CHECKING([whether to build HTML documentation])
87344d8e951Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
87444d8e951Smrg   test x$BUILD_HTMLDOC != xno; then
87544d8e951Smrg	BUILDHTMLDOC=yes
87644d8e951Smrgfi
87744d8e951SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
87844d8e951SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
87944d8e951Smrg
88044d8e951SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
88144d8e951SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
88244d8e951SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
88344d8e951SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
88450539131Smrg
88544d8e951SmrgAC_SUBST(MAKE_TEXT)
88644d8e951SmrgAC_SUBST(MAKE_PS)
88744d8e951SmrgAC_SUBST(MAKE_PDF)
88844d8e951SmrgAC_SUBST(MAKE_HTML)
88944d8e951Smrg]) # XORG_CHECK_DOCBOOK
89050539131Smrg
89144d8e951Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
89244d8e951Smrg# ----------------
89344d8e951Smrg# Minimum version: 1.5.0
89444d8e951Smrg# Minimum version for optional DEFAULT argument: 1.11.0
89544d8e951Smrg#
89644d8e951Smrg# Documentation tools are not always available on all platforms and sometimes
89744d8e951Smrg# not at the appropriate level. This macro enables a module to test for the
89844d8e951Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
89944d8e951Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
90044d8e951Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
90144d8e951Smrg# --with-xmlto assumes 'auto'.
90244d8e951Smrg#
90344d8e951Smrg# Interface to module:
90444d8e951Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
90544d8e951Smrg# XMLTO:	returns the path of the xmlto program found
90644d8e951Smrg#		returns the path set by the user in the environment
90744d8e951Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
90844d8e951Smrg#		'no' user instructs the module not to use xmlto
90944d8e951Smrg#
91044d8e951Smrg# Added in version 1.10.0
91144d8e951Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
91244d8e951Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
91344d8e951Smrg#
91444d8e951Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
91544d8e951Smrg#
91644d8e951SmrgAC_DEFUN([XORG_WITH_XMLTO],[
91744d8e951SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
91844d8e951Smrgm4_define([_defopt], m4_default([$2], [auto]))
91944d8e951SmrgAC_ARG_WITH(xmlto,
92044d8e951Smrg	AS_HELP_STRING([--with-xmlto],
92144d8e951Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
92244d8e951Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
92344d8e951Smrgm4_undefine([_defopt])
92444d8e951Smrg
92544d8e951Smrgif test "x$use_xmlto" = x"auto"; then
92644d8e951Smrg   AC_PATH_PROG([XMLTO], [xmlto])
92744d8e951Smrg   if test "x$XMLTO" = "x"; then
92844d8e951Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
92944d8e951Smrg	have_xmlto=no
93044d8e951Smrg   else
93144d8e951Smrg        have_xmlto=yes
93244d8e951Smrg   fi
93344d8e951Smrgelif test "x$use_xmlto" = x"yes" ; then
93444d8e951Smrg   AC_PATH_PROG([XMLTO], [xmlto])
93544d8e951Smrg   if test "x$XMLTO" = "x"; then
93644d8e951Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
93744d8e951Smrg   fi
93844d8e951Smrg   have_xmlto=yes
93944d8e951Smrgelif test "x$use_xmlto" = x"no" ; then
94044d8e951Smrg   if test "x$XMLTO" != "x"; then
94144d8e951Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
94244d8e951Smrg   fi
94344d8e951Smrg   have_xmlto=no
94444d8e951Smrgelse
94544d8e951Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
94650539131Smrgfi
94750539131Smrg
94844d8e951Smrg# Test for a minimum version of xmlto, if provided.
94944d8e951Smrgm4_ifval([$1],
95044d8e951Smrg[if test "$have_xmlto" = yes; then
95144d8e951Smrg    # scrape the xmlto version
95244d8e951Smrg    AC_MSG_CHECKING([the xmlto version])
95344d8e951Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
95444d8e951Smrg    AC_MSG_RESULT([$xmlto_version])
95544d8e951Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
95644d8e951Smrg        [if test "x$use_xmlto" = xauto; then
95744d8e951Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
95844d8e951Smrg            have_xmlto=no
95944d8e951Smrg        else
96044d8e951Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
96144d8e951Smrg        fi])
96244d8e951Smrgfi])
96350539131Smrg
96444d8e951Smrg# Test for the ability of xmlto to generate a text target
96544d8e951Smrghave_xmlto_text=no
96644d8e951Smrgcat > conftest.xml << "EOF"
96744d8e951SmrgEOF
96844d8e951SmrgAS_IF([test "$have_xmlto" = yes],
96944d8e951Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
97044d8e951Smrg             [have_xmlto_text=yes],
97144d8e951Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
97244d8e951Smrgrm -f conftest.xml
97344d8e951SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
97444d8e951SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
97544d8e951Smrg]) # XORG_WITH_XMLTO
97644d8e951Smrg
97744d8e951Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
97844d8e951Smrg# ----------------
97944d8e951Smrg# Minimum version: 1.5.0
98044d8e951Smrg# Minimum version for optional DEFAULT argument: 1.11.0
98144d8e951Smrg#
98244d8e951Smrg# Documentation tools are not always available on all platforms and sometimes
98344d8e951Smrg# not at the appropriate level. This macro enables a module to test for the
98444d8e951Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
98544d8e951Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
98644d8e951Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
98744d8e951Smrg# --with-asciidoc assumes 'auto'.
98844d8e951Smrg#
98944d8e951Smrg# Interface to module:
99044d8e951Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
99144d8e951Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
99244d8e951Smrg#		 returns the path set by the user in the environment
99344d8e951Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
99444d8e951Smrg#		  'no' user instructs the module not to use asciidoc
99544d8e951Smrg#
99644d8e951Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
99744d8e951Smrg#
99844d8e951SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
99944d8e951SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
100044d8e951Smrgm4_define([_defopt], m4_default([$2], [auto]))
100144d8e951SmrgAC_ARG_WITH(asciidoc,
100244d8e951Smrg	AS_HELP_STRING([--with-asciidoc],
100344d8e951Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
100444d8e951Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
100544d8e951Smrgm4_undefine([_defopt])
100644d8e951Smrg
100744d8e951Smrgif test "x$use_asciidoc" = x"auto"; then
100844d8e951Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
100944d8e951Smrg   if test "x$ASCIIDOC" = "x"; then
101044d8e951Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
101144d8e951Smrg	have_asciidoc=no
101244d8e951Smrg   else
101344d8e951Smrg        have_asciidoc=yes
101444d8e951Smrg   fi
101544d8e951Smrgelif test "x$use_asciidoc" = x"yes" ; then
101644d8e951Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
101744d8e951Smrg   if test "x$ASCIIDOC" = "x"; then
101844d8e951Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
101944d8e951Smrg   fi
102044d8e951Smrg   have_asciidoc=yes
102144d8e951Smrgelif test "x$use_asciidoc" = x"no" ; then
102244d8e951Smrg   if test "x$ASCIIDOC" != "x"; then
102344d8e951Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
102444d8e951Smrg   fi
102544d8e951Smrg   have_asciidoc=no
102644d8e951Smrgelse
102744d8e951Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
102844d8e951Smrgfi
102944d8e951Smrgm4_ifval([$1],
103044d8e951Smrg[if test "$have_asciidoc" = yes; then
103144d8e951Smrg    # scrape the asciidoc version
103244d8e951Smrg    AC_MSG_CHECKING([the asciidoc version])
103344d8e951Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
103444d8e951Smrg    AC_MSG_RESULT([$asciidoc_version])
103544d8e951Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
103644d8e951Smrg        [if test "x$use_asciidoc" = xauto; then
103744d8e951Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
103844d8e951Smrg            have_asciidoc=no
103944d8e951Smrg        else
104044d8e951Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
104144d8e951Smrg        fi])
104244d8e951Smrgfi])
104344d8e951SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
104444d8e951Smrg]) # XORG_WITH_ASCIIDOC
104544d8e951Smrg
104644d8e951Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
104744d8e951Smrg# --------------------------------
104844d8e951Smrg# Minimum version: 1.5.0
104944d8e951Smrg# Minimum version for optional DEFAULT argument: 1.11.0
105044d8e951Smrg#
105144d8e951Smrg# Documentation tools are not always available on all platforms and sometimes
105244d8e951Smrg# not at the appropriate level. This macro enables a module to test for the
105344d8e951Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
105444d8e951Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
105544d8e951Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
105644d8e951Smrg# --with-doxygen assumes 'auto'.
105744d8e951Smrg#
105844d8e951Smrg# Interface to module:
105944d8e951Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
106044d8e951Smrg# DOXYGEN:	 returns the path of the doxygen program found
106144d8e951Smrg#		 returns the path set by the user in the environment
106244d8e951Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
106344d8e951Smrg#		  'no' user instructs the module not to use doxygen
106444d8e951Smrg#
106544d8e951Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
106644d8e951Smrg#
106744d8e951SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
106844d8e951SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
106944d8e951Smrgm4_define([_defopt], m4_default([$2], [auto]))
107044d8e951SmrgAC_ARG_WITH(doxygen,
107144d8e951Smrg	AS_HELP_STRING([--with-doxygen],
107244d8e951Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
107344d8e951Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
107444d8e951Smrgm4_undefine([_defopt])
107544d8e951Smrg
107644d8e951Smrgif test "x$use_doxygen" = x"auto"; then
107744d8e951Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
107844d8e951Smrg   if test "x$DOXYGEN" = "x"; then
107944d8e951Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
108044d8e951Smrg	have_doxygen=no
108144d8e951Smrg   else
108244d8e951Smrg        have_doxygen=yes
108344d8e951Smrg   fi
108444d8e951Smrgelif test "x$use_doxygen" = x"yes" ; then
108544d8e951Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
108644d8e951Smrg   if test "x$DOXYGEN" = "x"; then
108744d8e951Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
108844d8e951Smrg   fi
108944d8e951Smrg   have_doxygen=yes
109044d8e951Smrgelif test "x$use_doxygen" = x"no" ; then
109144d8e951Smrg   if test "x$DOXYGEN" != "x"; then
109244d8e951Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
109344d8e951Smrg   fi
109444d8e951Smrg   have_doxygen=no
109544d8e951Smrgelse
109644d8e951Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
109744d8e951Smrgfi
109844d8e951Smrgm4_ifval([$1],
109944d8e951Smrg[if test "$have_doxygen" = yes; then
110044d8e951Smrg    # scrape the doxygen version
110144d8e951Smrg    AC_MSG_CHECKING([the doxygen version])
110244d8e951Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
110344d8e951Smrg    AC_MSG_RESULT([$doxygen_version])
110444d8e951Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
110544d8e951Smrg        [if test "x$use_doxygen" = xauto; then
110644d8e951Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
110744d8e951Smrg            have_doxygen=no
110844d8e951Smrg        else
110944d8e951Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
111044d8e951Smrg        fi])
111144d8e951Smrgfi])
111244d8e951SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
111344d8e951Smrg]) # XORG_WITH_DOXYGEN
111450539131Smrg
111544d8e951Smrg# XORG_WITH_GROFF([DEFAULT])
111644d8e951Smrg# ----------------
111744d8e951Smrg# Minimum version: 1.6.0
111844d8e951Smrg# Minimum version for optional DEFAULT argument: 1.11.0
111944d8e951Smrg#
112044d8e951Smrg# Documentation tools are not always available on all platforms and sometimes
112144d8e951Smrg# not at the appropriate level. This macro enables a module to test for the
112244d8e951Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
112344d8e951Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
112444d8e951Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
112544d8e951Smrg# --with-groff assumes 'auto'.
112644d8e951Smrg#
112744d8e951Smrg# Interface to module:
112844d8e951Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
112944d8e951Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
113044d8e951Smrg# HAVE_GROFF_MS: the -ms macros package
113144d8e951Smrg# GROFF:	 returns the path of the groff program found
113244d8e951Smrg#		 returns the path set by the user in the environment
113344d8e951Smrg# --with-groff:	 'yes' user instructs the module to use groff
113444d8e951Smrg#		 'no' user instructs the module not to use groff
113544d8e951Smrg#
113644d8e951Smrg# Added in version 1.9.0:
113744d8e951Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
113844d8e951Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
113944d8e951Smrg#		   psselect from the psutils package.
114044d8e951Smrg#		   the ghostcript package. Refer to the grohtml man pages
114144d8e951Smrg#
114244d8e951Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
114344d8e951Smrg#
114444d8e951Smrg# OS and distros often splits groff in a basic and full package, the former
114544d8e951Smrg# having the groff program and the later having devices, fonts and macros
114644d8e951Smrg# Checking for the groff executable is not enough.
114744d8e951Smrg#
114844d8e951Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
114944d8e951Smrg# unset HAVE_GROFF or GROFF env variables.
115044d8e951Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
115144d8e951Smrg#
115244d8e951SmrgAC_DEFUN([XORG_WITH_GROFF],[
115344d8e951SmrgAC_ARG_VAR([GROFF], [Path to groff command])
115444d8e951Smrgm4_define([_defopt], m4_default([$1], [auto]))
115544d8e951SmrgAC_ARG_WITH(groff,
115644d8e951Smrg	AS_HELP_STRING([--with-groff],
115744d8e951Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
115844d8e951Smrg	   [use_groff=$withval], [use_groff=]_defopt)
115944d8e951Smrgm4_undefine([_defopt])
116044d8e951Smrg
116144d8e951Smrgif test "x$use_groff" = x"auto"; then
116244d8e951Smrg   AC_PATH_PROG([GROFF], [groff])
116344d8e951Smrg   if test "x$GROFF" = "x"; then
116444d8e951Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
116544d8e951Smrg	have_groff=no
116644d8e951Smrg   else
116744d8e951Smrg        have_groff=yes
116844d8e951Smrg   fi
116944d8e951Smrgelif test "x$use_groff" = x"yes" ; then
117044d8e951Smrg   AC_PATH_PROG([GROFF], [groff])
117144d8e951Smrg   if test "x$GROFF" = "x"; then
117244d8e951Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
117344d8e951Smrg   fi
117444d8e951Smrg   have_groff=yes
117544d8e951Smrgelif test "x$use_groff" = x"no" ; then
117644d8e951Smrg   if test "x$GROFF" != "x"; then
117744d8e951Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
117844d8e951Smrg   fi
117944d8e951Smrg   have_groff=no
118044d8e951Smrgelse
118144d8e951Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
118244d8e951Smrgfi
118350539131Smrg
118444d8e951Smrg# We have groff, test for the presence of the macro packages
118544d8e951Smrgif test "x$have_groff" = x"yes"; then
118644d8e951Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
118744d8e951Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
118844d8e951Smrg        groff_ms_works=yes
118944d8e951Smrg    else
119044d8e951Smrg        groff_ms_works=no
119144d8e951Smrg    fi
119244d8e951Smrg    AC_MSG_RESULT([$groff_ms_works])
119344d8e951Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
119444d8e951Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
119544d8e951Smrg        groff_mm_works=yes
119644d8e951Smrg    else
119744d8e951Smrg        groff_mm_works=no
119844d8e951Smrg    fi
119944d8e951Smrg    AC_MSG_RESULT([$groff_mm_works])
120044d8e951Smrgfi
120150539131Smrg
120244d8e951Smrg# We have groff, test for HTML dependencies, one command per package
120344d8e951Smrgif test "x$have_groff" = x"yes"; then
120444d8e951Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
120544d8e951Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
120644d8e951Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
120744d8e951Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
120844d8e951Smrg      have_groff_html=yes
120944d8e951Smrg   else
121044d8e951Smrg      have_groff_html=no
121144d8e951Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
121244d8e951Smrg   fi
121344d8e951Smrgfi
121450539131Smrg
121544d8e951Smrg# Set Automake conditionals for Makefiles
121644d8e951SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
121744d8e951SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
121844d8e951SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
121944d8e951SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
122044d8e951Smrg]) # XORG_WITH_GROFF
122150539131Smrg
122244d8e951Smrg# XORG_WITH_FOP([DEFAULT])
122344d8e951Smrg# ----------------
122444d8e951Smrg# Minimum version: 1.6.0
122544d8e951Smrg# Minimum version for optional DEFAULT argument: 1.11.0
122644d8e951Smrg#
122744d8e951Smrg# Documentation tools are not always available on all platforms and sometimes
122844d8e951Smrg# not at the appropriate level. This macro enables a module to test for the
122944d8e951Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
123044d8e951Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
123144d8e951Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
123244d8e951Smrg# --with-fop assumes 'auto'.
123344d8e951Smrg#
123444d8e951Smrg# Interface to module:
123544d8e951Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
123644d8e951Smrg# FOP:	 	returns the path of the fop program found
123744d8e951Smrg#		returns the path set by the user in the environment
123844d8e951Smrg# --with-fop: 	'yes' user instructs the module to use fop
123944d8e951Smrg#		'no' user instructs the module not to use fop
124044d8e951Smrg#
124144d8e951Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
124244d8e951Smrg#
124344d8e951SmrgAC_DEFUN([XORG_WITH_FOP],[
124444d8e951SmrgAC_ARG_VAR([FOP], [Path to fop command])
124544d8e951Smrgm4_define([_defopt], m4_default([$1], [auto]))
124644d8e951SmrgAC_ARG_WITH(fop,
124744d8e951Smrg	AS_HELP_STRING([--with-fop],
124844d8e951Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
124944d8e951Smrg	   [use_fop=$withval], [use_fop=]_defopt)
125044d8e951Smrgm4_undefine([_defopt])
125144d8e951Smrg
125244d8e951Smrgif test "x$use_fop" = x"auto"; then
125344d8e951Smrg   AC_PATH_PROG([FOP], [fop])
125444d8e951Smrg   if test "x$FOP" = "x"; then
125544d8e951Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
125644d8e951Smrg	have_fop=no
125744d8e951Smrg   else
125844d8e951Smrg        have_fop=yes
125944d8e951Smrg   fi
126044d8e951Smrgelif test "x$use_fop" = x"yes" ; then
126144d8e951Smrg   AC_PATH_PROG([FOP], [fop])
126244d8e951Smrg   if test "x$FOP" = "x"; then
126344d8e951Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
126444d8e951Smrg   fi
126544d8e951Smrg   have_fop=yes
126644d8e951Smrgelif test "x$use_fop" = x"no" ; then
126744d8e951Smrg   if test "x$FOP" != "x"; then
126844d8e951Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
126944d8e951Smrg   fi
127044d8e951Smrg   have_fop=no
127144d8e951Smrgelse
127244d8e951Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
127344d8e951Smrgfi
127444d8e951SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
127544d8e951Smrg]) # XORG_WITH_FOP
127650539131Smrg
127744d8e951Smrg# XORG_WITH_PS2PDF([DEFAULT])
127844d8e951Smrg# ----------------
127944d8e951Smrg# Minimum version: 1.6.0
128044d8e951Smrg# Minimum version for optional DEFAULT argument: 1.11.0
128144d8e951Smrg#
128244d8e951Smrg# Documentation tools are not always available on all platforms and sometimes
128344d8e951Smrg# not at the appropriate level. This macro enables a module to test for the
128444d8e951Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
128544d8e951Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
128644d8e951Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
128744d8e951Smrg# --with-ps2pdf assumes 'auto'.
128844d8e951Smrg#
128944d8e951Smrg# Interface to module:
129044d8e951Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
129144d8e951Smrg# PS2PDF:	returns the path of the ps2pdf program found
129244d8e951Smrg#		returns the path set by the user in the environment
129344d8e951Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
129444d8e951Smrg#		 'no' user instructs the module not to use ps2pdf
129544d8e951Smrg#
129644d8e951Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
129744d8e951Smrg#
129844d8e951SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
129944d8e951SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
130044d8e951Smrgm4_define([_defopt], m4_default([$1], [auto]))
130144d8e951SmrgAC_ARG_WITH(ps2pdf,
130244d8e951Smrg	AS_HELP_STRING([--with-ps2pdf],
130344d8e951Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
130444d8e951Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
130544d8e951Smrgm4_undefine([_defopt])
130644d8e951Smrg
130744d8e951Smrgif test "x$use_ps2pdf" = x"auto"; then
130844d8e951Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
130944d8e951Smrg   if test "x$PS2PDF" = "x"; then
131044d8e951Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
131144d8e951Smrg	have_ps2pdf=no
131244d8e951Smrg   else
131344d8e951Smrg        have_ps2pdf=yes
131444d8e951Smrg   fi
131544d8e951Smrgelif test "x$use_ps2pdf" = x"yes" ; then
131644d8e951Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
131744d8e951Smrg   if test "x$PS2PDF" = "x"; then
131844d8e951Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
131944d8e951Smrg   fi
132044d8e951Smrg   have_ps2pdf=yes
132144d8e951Smrgelif test "x$use_ps2pdf" = x"no" ; then
132244d8e951Smrg   if test "x$PS2PDF" != "x"; then
132344d8e951Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
132444d8e951Smrg   fi
132544d8e951Smrg   have_ps2pdf=no
132644d8e951Smrgelse
132744d8e951Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
132844d8e951Smrgfi
132944d8e951SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
133044d8e951Smrg]) # XORG_WITH_PS2PDF
133150539131Smrg
133244d8e951Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
133344d8e951Smrg# ----------------
133444d8e951Smrg# Minimum version: 1.6.0
133544d8e951Smrg#
133644d8e951Smrg# Documentation tools are not always available on all platforms and sometimes
133744d8e951Smrg# not at the appropriate level. This macro enables a builder to skip all
133844d8e951Smrg# documentation targets except traditional man pages.
133944d8e951Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
134044d8e951Smrg# maximum flexibilty in controlling documentation building.
134144d8e951Smrg# Refer to:
134244d8e951Smrg# XORG_WITH_XMLTO         --with-xmlto
134344d8e951Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
134444d8e951Smrg# XORG_WITH_DOXYGEN       --with-doxygen
134544d8e951Smrg# XORG_WITH_FOP           --with-fop
134644d8e951Smrg# XORG_WITH_GROFF         --with-groff
134744d8e951Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
134844d8e951Smrg#
134944d8e951Smrg# Interface to module:
135044d8e951Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
135144d8e951Smrg# --enable-docs: 'yes' user instructs the module to generate docs
135244d8e951Smrg#		 'no' user instructs the module not to generate docs
135344d8e951Smrg# parm1:	specify the default value, yes or no.
135444d8e951Smrg#
135544d8e951SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
135644d8e951Smrgm4_define([default], m4_default([$1], [yes]))
135744d8e951SmrgAC_ARG_ENABLE(docs,
135844d8e951Smrg	AS_HELP_STRING([--enable-docs],
135944d8e951Smrg	   [Enable building the documentation (default: ]default[)]),
136044d8e951Smrg	   [build_docs=$enableval], [build_docs=]default)
136144d8e951Smrgm4_undefine([default])
136244d8e951SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
136344d8e951SmrgAC_MSG_CHECKING([whether to build documentation])
136444d8e951SmrgAC_MSG_RESULT([$build_docs])
136544d8e951Smrg]) # XORG_ENABLE_DOCS
136644d8e951Smrg
136744d8e951Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
136844d8e951Smrg# ----------------
136944d8e951Smrg# Minimum version: 1.6.0
137044d8e951Smrg#
137144d8e951Smrg# This macro enables a builder to skip all developer documentation.
137244d8e951Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
137344d8e951Smrg# maximum flexibilty in controlling documentation building.
137444d8e951Smrg# Refer to:
137544d8e951Smrg# XORG_WITH_XMLTO         --with-xmlto
137644d8e951Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
137744d8e951Smrg# XORG_WITH_DOXYGEN       --with-doxygen
137844d8e951Smrg# XORG_WITH_FOP           --with-fop
137944d8e951Smrg# XORG_WITH_GROFF         --with-groff
138044d8e951Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
138144d8e951Smrg#
138244d8e951Smrg# Interface to module:
138344d8e951Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
138444d8e951Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
138544d8e951Smrg#			'no' user instructs the module not to generate developer docs
138644d8e951Smrg# parm1:		specify the default value, yes or no.
138744d8e951Smrg#
138844d8e951SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
138944d8e951Smrgm4_define([devel_default], m4_default([$1], [yes]))
139044d8e951SmrgAC_ARG_ENABLE(devel-docs,
139144d8e951Smrg	AS_HELP_STRING([--enable-devel-docs],
139244d8e951Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
139344d8e951Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
139444d8e951Smrgm4_undefine([devel_default])
139544d8e951SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
139644d8e951SmrgAC_MSG_CHECKING([whether to build developer documentation])
139744d8e951SmrgAC_MSG_RESULT([$build_devel_docs])
139844d8e951Smrg]) # XORG_ENABLE_DEVEL_DOCS
139944d8e951Smrg
140044d8e951Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
140144d8e951Smrg# ----------------
140244d8e951Smrg# Minimum version: 1.6.0
140344d8e951Smrg#
140444d8e951Smrg# This macro enables a builder to skip all functional specification targets.
140544d8e951Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
140644d8e951Smrg# maximum flexibilty in controlling documentation building.
140744d8e951Smrg# Refer to:
140844d8e951Smrg# XORG_WITH_XMLTO         --with-xmlto
140944d8e951Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
141044d8e951Smrg# XORG_WITH_DOXYGEN       --with-doxygen
141144d8e951Smrg# XORG_WITH_FOP           --with-fop
141244d8e951Smrg# XORG_WITH_GROFF         --with-groff
141344d8e951Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
141444d8e951Smrg#
141544d8e951Smrg# Interface to module:
141644d8e951Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
141744d8e951Smrg# --enable-specs:	'yes' user instructs the module to generate specs
141844d8e951Smrg#			'no' user instructs the module not to generate specs
141944d8e951Smrg# parm1:		specify the default value, yes or no.
142044d8e951Smrg#
142144d8e951SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
142244d8e951Smrgm4_define([spec_default], m4_default([$1], [yes]))
142344d8e951SmrgAC_ARG_ENABLE(specs,
142444d8e951Smrg	AS_HELP_STRING([--enable-specs],
142544d8e951Smrg	   [Enable building the specs (default: ]spec_default[)]),
142644d8e951Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
142744d8e951Smrgm4_undefine([spec_default])
142844d8e951SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
142944d8e951SmrgAC_MSG_CHECKING([whether to build functional specifications])
143044d8e951SmrgAC_MSG_RESULT([$build_specs])
143144d8e951Smrg]) # XORG_ENABLE_SPECS
143250539131Smrg
143344d8e951Smrg# XORG_CHECK_MALLOC_ZERO
143444d8e951Smrg# ----------------------
143544d8e951Smrg# Minimum version: 1.0.0
143644d8e951Smrg#
143744d8e951Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
143844d8e951Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
143944d8e951Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
144044d8e951SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
144144d8e951SmrgAC_ARG_ENABLE(malloc0returnsnull,
144244d8e951Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
144344d8e951Smrg		       [malloc(0) returns NULL (default: auto)]),
144444d8e951Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
144544d8e951Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
144650539131Smrg
144744d8e951SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
144844d8e951Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
144944d8e951Smrg	AC_RUN_IFELSE([
145044d8e951Smrgchar *malloc();
145144d8e951Smrgchar *realloc();
145244d8e951Smrgchar *calloc();
145344d8e951Smrgmain() {
145444d8e951Smrg    char *m0, *r0, *c0, *p;
145544d8e951Smrg    m0 = malloc(0);
145644d8e951Smrg    p = malloc(10);
145744d8e951Smrg    r0 = realloc(p,0);
145844d8e951Smrg    c0 = calloc(0);
145944d8e951Smrg    exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1);
146044d8e951Smrg}],
146144d8e951Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
146244d8e951Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
146344d8e951Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
146444d8e951Smrgfi
146544d8e951SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
146650539131Smrg
146744d8e951Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
146844d8e951Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
146944d8e951Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
147044d8e951Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
147144d8e951Smrgelse
147244d8e951Smrg	MALLOC_ZERO_CFLAGS=""
147344d8e951Smrg	XMALLOC_ZERO_CFLAGS=""
147444d8e951Smrg	XTMALLOC_ZERO_CFLAGS=""
147544d8e951Smrgfi
147644d8e951Smrg
147744d8e951SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
147844d8e951SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
147944d8e951SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
148044d8e951Smrg]) # XORG_CHECK_MALLOC_ZERO
148150539131Smrg
148244d8e951Smrg# XORG_WITH_LINT()
148344d8e951Smrg# ----------------
148450539131Smrg# Minimum version: 1.1.0
148550539131Smrg#
148644d8e951Smrg# This macro enables the use of a tool that flags some suspicious and
148744d8e951Smrg# non-portable constructs (likely to be bugs) in C language source code.
148844d8e951Smrg# It will attempt to locate the tool and use appropriate options.
148944d8e951Smrg# There are various lint type tools on different platforms.
149050539131Smrg#
149144d8e951Smrg# Interface to module:
149244d8e951Smrg# LINT:		returns the path to the tool found on the platform
149344d8e951Smrg#		or the value set to LINT on the configure cmd line
149444d8e951Smrg#		also an Automake conditional
149544d8e951Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
149650539131Smrg#
149744d8e951Smrg# --with-lint:	'yes' user instructs the module to use lint
149844d8e951Smrg#		'no' user instructs the module not to use lint (default)
149950539131Smrg#
150044d8e951Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
150144d8e951Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
150244d8e951Smrg#
150344d8e951SmrgAC_DEFUN([XORG_WITH_LINT],[
150450539131Smrg
150544d8e951SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
150644d8e951SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
150744d8e951SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
150844d8e951Smrg		[Use a lint-style source code checker (default: disabled)])],
150944d8e951Smrg		[use_lint=$withval], [use_lint=no])
151050539131Smrg
151144d8e951Smrg# Obtain platform specific info like program name and options
151244d8e951Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
151344d8e951Smrgcase $host_os in
151444d8e951Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
151544d8e951Smrg	lint_name=splint
151644d8e951Smrg	lint_options="-badflag"
151744d8e951Smrg	;;
151844d8e951Smrg  *freebsd* | *netbsd*)
151944d8e951Smrg	lint_name=lint
152044d8e951Smrg	lint_options="-u -b"
152144d8e951Smrg	;;
152244d8e951Smrg  *solaris*)
152344d8e951Smrg	lint_name=lint
152444d8e951Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
152544d8e951Smrg	;;
152644d8e951Smrgesac
152750539131Smrg
152844d8e951Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
152944d8e951Smrgif test "x$use_lint" = x"yes" ; then
153044d8e951Smrg   AC_PATH_PROG([LINT], [$lint_name])
153144d8e951Smrg   if test "x$LINT" = "x"; then
153244d8e951Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
153344d8e951Smrg   fi
153444d8e951Smrgelif test "x$use_lint" = x"no" ; then
153544d8e951Smrg   if test "x$LINT" != "x"; then
153644d8e951Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
153744d8e951Smrg   fi
153844d8e951Smrgelse
153944d8e951Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
154044d8e951Smrgfi
154150539131Smrg
154244d8e951Smrg# User supplied flags override default flags
154344d8e951Smrgif test "x$LINT_FLAGS" != "x"; then
154444d8e951Smrg   lint_options=$LINT_FLAGS
154544d8e951Smrgfi
154650539131Smrg
154744d8e951SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
154844d8e951SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
154950539131Smrg
155044d8e951Smrg]) # XORG_WITH_LINT
155150539131Smrg
155244d8e951Smrg# XORG_LINT_LIBRARY(LIBNAME)
155344d8e951Smrg# --------------------------
155450539131Smrg# Minimum version: 1.1.0
155550539131Smrg#
155644d8e951Smrg# Sets up flags for building lint libraries for checking programs that call
155744d8e951Smrg# functions in the library.
155850539131Smrg#
155944d8e951Smrg# Interface to module:
156044d8e951Smrg# LINTLIB		- Automake variable with the name of lint library file to make
156144d8e951Smrg# MAKE_LINT_LIB		- Automake conditional
156250539131Smrg#
156344d8e951Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
156444d8e951Smrg#			  - 'no' user instructs the module not to create a lint library (default)
1565ded1caa4Smrg
156644d8e951SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
156744d8e951SmrgAC_REQUIRE([XORG_WITH_LINT])
156844d8e951SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
156944d8e951Smrg	[Create lint library (default: disabled)])],
157044d8e951Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
1571ded1caa4Smrg
157244d8e951Smrgif test "x$make_lint_lib" = x"yes" ; then
157344d8e951Smrg   LINTLIB=llib-l$1.ln
157444d8e951Smrg   if test "x$LINT" = "x"; then
157544d8e951Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
157644d8e951Smrg   fi
157744d8e951Smrgelif test "x$make_lint_lib" != x"no" ; then
157844d8e951Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
157944d8e951Smrgfi
1580ded1caa4Smrg
158144d8e951SmrgAC_SUBST(LINTLIB)
158244d8e951SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
1583ded1caa4Smrg
158444d8e951Smrg]) # XORG_LINT_LIBRARY
1585ded1caa4Smrg
158644d8e951Smrg# XORG_CWARNFLAGS
158744d8e951Smrg# ---------------
158844d8e951Smrg# Minimum version: 1.2.0
158950539131Smrg#
159044d8e951Smrg# Defines CWARNFLAGS to enable C compiler warnings.
159150539131Smrg#
159244d8e951SmrgAC_DEFUN([XORG_CWARNFLAGS], [
159344d8e951SmrgAC_REQUIRE([AC_PROG_CC_C99])
159444d8e951Smrgif  test "x$GCC" = xyes ; then
159544d8e951Smrg    CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
159644d8e951Smrg-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
159744d8e951Smrg-Wbad-function-cast -Wformat=2"
159844d8e951Smrg    case `$CC -dumpversion` in
159944d8e951Smrg    3.4.* | 4.*)
160044d8e951Smrg	CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
160144d8e951Smrg	;;
160244d8e951Smrg    esac
160344d8e951Smrgelse
160444d8e951Smrg    AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
160544d8e951Smrg    if test "x$SUNCC" = "xyes"; then
160644d8e951Smrg	CWARNFLAGS="-v"
160744d8e951Smrg    fi
160844d8e951Smrgfi
160944d8e951SmrgAC_SUBST(CWARNFLAGS)
161044d8e951Smrg]) # XORG_CWARNFLAGS
1611ded1caa4Smrg
161244d8e951Smrg# XORG_STRICT_OPTION
161344d8e951Smrg# -----------------------
161444d8e951Smrg# Minimum version: 1.3.0
161550539131Smrg#
161644d8e951Smrg# Add configure option to enable strict compilation
161744d8e951SmrgAC_DEFUN([XORG_STRICT_OPTION], [
161844d8e951Smrg# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
161944d8e951SmrgAC_REQUIRE([AC_PROG_CC_C99])
162044d8e951SmrgAC_REQUIRE([XORG_CWARNFLAGS])
1621ded1caa4Smrg
162244d8e951SmrgAC_ARG_ENABLE(strict-compilation,
162344d8e951Smrg			  AS_HELP_STRING([--enable-strict-compilation],
162444d8e951Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
162544d8e951Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
162644d8e951Smrgif test "x$STRICT_COMPILE" = "xyes"; then
162744d8e951Smrg	AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
162844d8e951Smrg	AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
162944d8e951Smrg	if test "x$GCC" = xyes ; then
163044d8e951Smrg		STRICT_CFLAGS="-pedantic -Werror"
163144d8e951Smrg	elif test "x$SUNCC" = "xyes"; then
163244d8e951Smrg		STRICT_CFLAGS="-errwarn"
163344d8e951Smrg    elif test "x$INTELCC" = "xyes"; then
163444d8e951Smrg		STRICT_CFLAGS="-Werror"
163544d8e951Smrg	fi
163644d8e951Smrgfi
163744d8e951SmrgCWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
163844d8e951SmrgAC_SUBST([CWARNFLAGS])
163944d8e951Smrg]) # XORG_STRICT_OPTION
1640ded1caa4Smrg
164144d8e951Smrg# XORG_DEFAULT_OPTIONS
164250539131Smrg# --------------------
164344d8e951Smrg# Minimum version: 1.3.0
164450539131Smrg#
164544d8e951Smrg# Defines default options for X.Org modules.
164644d8e951Smrg#
164744d8e951SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
164844d8e951SmrgAC_REQUIRE([AC_PROG_INSTALL])
164944d8e951SmrgXORG_CWARNFLAGS
165044d8e951SmrgXORG_STRICT_OPTION
165144d8e951SmrgXORG_RELEASE_VERSION
165244d8e951SmrgXORG_CHANGELOG
165344d8e951SmrgXORG_INSTALL
165444d8e951SmrgXORG_MANPAGE_SECTIONS
165544d8e951Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
165644d8e951Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
165744d8e951Smrg]) # XORG_DEFAULT_OPTIONS
165850539131Smrg
165944d8e951Smrg# XORG_INSTALL()
166044d8e951Smrg# ----------------
166144d8e951Smrg# Minimum version: 1.4.0
166244d8e951Smrg#
166344d8e951Smrg# Defines the variable INSTALL_CMD as the command to copy
166444d8e951Smrg# INSTALL from $prefix/share/util-macros.
166544d8e951Smrg#
166644d8e951SmrgAC_DEFUN([XORG_INSTALL], [
166744d8e951SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
166844d8e951Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
166944d8e951SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
167044d8e951Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
167144d8e951Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
167244d8e951Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
167344d8e951SmrgAC_SUBST([INSTALL_CMD])
167444d8e951Smrg]) # XORG_INSTALL
167544d8e951Smrgdnl Copyright 2005 Red Hat, Inc
167644d8e951Smrgdnl
167744d8e951Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
167844d8e951Smrgdnl documentation for any purpose is hereby granted without fee, provided that
167944d8e951Smrgdnl the above copyright notice appear in all copies and that both that
168044d8e951Smrgdnl copyright notice and this permission notice appear in supporting
168144d8e951Smrgdnl documentation.
168244d8e951Smrgdnl
168344d8e951Smrgdnl The above copyright notice and this permission notice shall be included
168444d8e951Smrgdnl in all copies or substantial portions of the Software.
168544d8e951Smrgdnl
168644d8e951Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
168744d8e951Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
168844d8e951Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
168944d8e951Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
169044d8e951Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
169144d8e951Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
169244d8e951Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
169344d8e951Smrgdnl
169444d8e951Smrgdnl Except as contained in this notice, the name of the copyright holders shall
169544d8e951Smrgdnl not be used in advertising or otherwise to promote the sale, use or
169644d8e951Smrgdnl other dealings in this Software without prior written authorization
169744d8e951Smrgdnl from the copyright holders.
169844d8e951Smrgdnl
169950539131Smrg
170044d8e951Smrg# XORG_RELEASE_VERSION
170144d8e951Smrg# --------------------
170244d8e951Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
170344d8e951Smrg 
170444d8e951SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
170544d8e951Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
170644d8e951Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
170744d8e951Smrg		[Major version of this package])
170844d8e951Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
170944d8e951Smrg	if test "x$PVM" = "x"; then
171044d8e951Smrg		PVM="0"
171150539131Smrg	fi
171244d8e951Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
171344d8e951Smrg		[$PVM],
171444d8e951Smrg		[Minor version of this package])
171544d8e951Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
171644d8e951Smrg	if test "x$PVP" = "x"; then
171744d8e951Smrg		PVP="0"
171850539131Smrg	fi
171944d8e951Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
172044d8e951Smrg		[$PVP],
172144d8e951Smrg		[Patch version of this package])
172250539131Smrg])
1723ded1caa4Smrg
172444d8e951Smrg# XORG_CHANGELOG()
172544d8e951Smrg# ----------------
172644d8e951Smrg# Minimum version: 1.2.0
172750539131Smrg#
172844d8e951Smrg# Defines the variable CHANGELOG_CMD as the command to generate
172944d8e951Smrg# ChangeLog from git.
173044d8e951Smrg#
173144d8e951Smrg#
173244d8e951SmrgAC_DEFUN([XORG_CHANGELOG], [
173344d8e951SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
173444d8e951Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
173544d8e951Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
173644d8e951Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
173744d8e951SmrgAC_SUBST([CHANGELOG_CMD])
173844d8e951Smrg]) # XORG_CHANGELOG
173950539131Smrg
174044d8e951Smrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
174144d8e951Smrg#
174244d8e951Smrg# This file is free software; the Free Software Foundation
174344d8e951Smrg# gives unlimited permission to copy and/or distribute it,
174444d8e951Smrg# with or without modifications, as long as this notice is preserved.
174550539131Smrg
174644d8e951Smrg# AM_AUTOMAKE_VERSION(VERSION)
174744d8e951Smrg# ----------------------------
174844d8e951Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
174944d8e951Smrg# generated from the m4 files accompanying Automake X.Y.
175044d8e951Smrg# (This private macro should not be called outside this file.)
175144d8e951SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
175244d8e951Smrg[am__api_version='1.11'
175344d8e951Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
175444d8e951Smrgdnl require some minimum version.  Point them to the right macro.
175544d8e951Smrgm4_if([$1], [1.11.1], [],
175644d8e951Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
175744d8e951Smrg])
175850539131Smrg
175944d8e951Smrg# _AM_AUTOCONF_VERSION(VERSION)
176044d8e951Smrg# -----------------------------
176144d8e951Smrg# aclocal traces this macro to find the Autoconf version.
176244d8e951Smrg# This is a private macro too.  Using m4_define simplifies
176344d8e951Smrg# the logic in aclocal, which can simply ignore this definition.
176444d8e951Smrgm4_define([_AM_AUTOCONF_VERSION], [])
1765ded1caa4Smrg
176644d8e951Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
176744d8e951Smrg# -------------------------------
176844d8e951Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
176944d8e951Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
177044d8e951SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
177144d8e951Smrg[AM_AUTOMAKE_VERSION([1.11.1])dnl
177244d8e951Smrgm4_ifndef([AC_AUTOCONF_VERSION],
177344d8e951Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
177444d8e951Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
1775ded1caa4Smrg
177644d8e951Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
177750539131Smrg
177844d8e951Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
1779ded1caa4Smrg#
178044d8e951Smrg# This file is free software; the Free Software Foundation
178144d8e951Smrg# gives unlimited permission to copy and/or distribute it,
178244d8e951Smrg# with or without modifications, as long as this notice is preserved.
178344d8e951Smrg
178444d8e951Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
178544d8e951Smrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
178644d8e951Smrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
178750539131Smrg#
178844d8e951Smrg# Of course, Automake must honor this variable whenever it calls a
178944d8e951Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
179044d8e951Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
179144d8e951Smrg# depending on how configure is run.  This is pretty annoying, since
179244d8e951Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
179344d8e951Smrg# source directory, any form will work fine, but in subdirectories a
179444d8e951Smrg# relative path needs to be adjusted first.
179550539131Smrg#
179644d8e951Smrg# $ac_aux_dir/missing
179744d8e951Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
179844d8e951Smrg# $top_srcdir/$ac_aux_dir/missing
179944d8e951Smrg#    fails if $ac_aux_dir is absolute,
180044d8e951Smrg#    fails when called from a subdirectory in a VPATH build with
180144d8e951Smrg#          a relative $ac_aux_dir
180250539131Smrg#
180344d8e951Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
180444d8e951Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
180544d8e951Smrg# harmless because $srcdir is `.', but things will broke when you
180644d8e951Smrg# start a VPATH build or use an absolute $srcdir.
180750539131Smrg#
180844d8e951Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
180944d8e951Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
181044d8e951Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
181144d8e951Smrg# and then we would define $MISSING as
181244d8e951Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
181344d8e951Smrg# This will work as long as MISSING is not called from configure, because
181444d8e951Smrg# unfortunately $(top_srcdir) has no meaning in configure.
181544d8e951Smrg# However there are other variables, like CC, which are often used in
181644d8e951Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
181744d8e951Smrg#
181844d8e951Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
181944d8e951Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
182044d8e951Smrg# configured tree to be moved without reconfiguration.
182150539131Smrg
182244d8e951SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
182344d8e951Smrg[dnl Rely on autoconf to set up CDPATH properly.
182444d8e951SmrgAC_PREREQ([2.50])dnl
182544d8e951Smrg# expand $ac_aux_dir to an absolute path
182644d8e951Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
182744d8e951Smrg])
182844d8e951Smrg
182944d8e951Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
183044d8e951Smrg
183144d8e951Smrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
183244d8e951Smrg# Free Software Foundation, Inc.
183344d8e951Smrg#
183444d8e951Smrg# This file is free software; the Free Software Foundation
183544d8e951Smrg# gives unlimited permission to copy and/or distribute it,
183644d8e951Smrg# with or without modifications, as long as this notice is preserved.
1837ded1caa4Smrg
183844d8e951Smrg# serial 9
183944d8e951Smrg
184044d8e951Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
184144d8e951Smrg# -------------------------------------
184244d8e951Smrg# Define a conditional.
184344d8e951SmrgAC_DEFUN([AM_CONDITIONAL],
184444d8e951Smrg[AC_PREREQ(2.52)dnl
184544d8e951Smrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
184644d8e951Smrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
184744d8e951SmrgAC_SUBST([$1_TRUE])dnl
184844d8e951SmrgAC_SUBST([$1_FALSE])dnl
184944d8e951Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
185044d8e951Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
185144d8e951Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
185244d8e951Smrgif $2; then
185344d8e951Smrg  $1_TRUE=
185444d8e951Smrg  $1_FALSE='#'
185550539131Smrgelse
185644d8e951Smrg  $1_TRUE='#'
185744d8e951Smrg  $1_FALSE=
185850539131Smrgfi
185944d8e951SmrgAC_CONFIG_COMMANDS_PRE(
186044d8e951Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
186144d8e951Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
186244d8e951SmrgUsually this means the macro was only invoked conditionally.]])
186344d8e951Smrgfi])])
1864ded1caa4Smrg
186544d8e951Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
186644d8e951Smrg# Free Software Foundation, Inc.
186750539131Smrg#
186844d8e951Smrg# This file is free software; the Free Software Foundation
186944d8e951Smrg# gives unlimited permission to copy and/or distribute it,
187044d8e951Smrg# with or without modifications, as long as this notice is preserved.
1871ded1caa4Smrg
187244d8e951Smrg# serial 10
1873ded1caa4Smrg
187444d8e951Smrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
187544d8e951Smrg# written in clear, in which case automake, when reading aclocal.m4,
187644d8e951Smrg# will think it sees a *use*, and therefore will trigger all it's
187744d8e951Smrg# C support machinery.  Also note that it means that autoscan, seeing
187844d8e951Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1879ded1caa4Smrg
1880ded1caa4Smrg
188144d8e951Smrg# _AM_DEPENDENCIES(NAME)
188244d8e951Smrg# ----------------------
188344d8e951Smrg# See how the compiler implements dependency checking.
188444d8e951Smrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
188544d8e951Smrg# We try a few techniques and use that to set a single cache variable.
188644d8e951Smrg#
188744d8e951Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
188844d8e951Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
188944d8e951Smrg# dependency, and given that the user is not expected to run this macro,
189044d8e951Smrg# just rely on AC_PROG_CC.
189144d8e951SmrgAC_DEFUN([_AM_DEPENDENCIES],
189244d8e951Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
189344d8e951SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
189444d8e951SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
189544d8e951SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1896ded1caa4Smrg
189744d8e951Smrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
189844d8e951Smrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
189944d8e951Smrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
190044d8e951Smrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
190144d8e951Smrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
190244d8e951Smrg                   [depcc="$$1"   am_compiler_list=])
1903ded1caa4Smrg
190444d8e951SmrgAC_CACHE_CHECK([dependency style of $depcc],
190544d8e951Smrg               [am_cv_$1_dependencies_compiler_type],
190644d8e951Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
190744d8e951Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
190844d8e951Smrg  # making bogus files that we don't know about and never remove.  For
190944d8e951Smrg  # instance it was reported that on HP-UX the gcc test will end up
191044d8e951Smrg  # making a dummy file named `D' -- because `-MD' means `put the output
191144d8e951Smrg  # in D'.
191244d8e951Smrg  mkdir conftest.dir
191344d8e951Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
191444d8e951Smrg  # using a relative directory.
191544d8e951Smrg  cp "$am_depcomp" conftest.dir
191644d8e951Smrg  cd conftest.dir
191744d8e951Smrg  # We will build objects and dependencies in a subdirectory because
191844d8e951Smrg  # it helps to detect inapplicable dependency modes.  For instance
191944d8e951Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
192044d8e951Smrg  # side effect of compilation, but ICC will put the dependencies in
192144d8e951Smrg  # the current directory while Tru64 will put them in the object
192244d8e951Smrg  # directory.
192344d8e951Smrg  mkdir sub
1924ded1caa4Smrg
192544d8e951Smrg  am_cv_$1_dependencies_compiler_type=none
192644d8e951Smrg  if test "$am_compiler_list" = ""; then
192744d8e951Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
192844d8e951Smrg  fi
192944d8e951Smrg  am__universal=false
193044d8e951Smrg  m4_case([$1], [CC],
193144d8e951Smrg    [case " $depcc " in #(
193244d8e951Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
193344d8e951Smrg     esac],
193444d8e951Smrg    [CXX],
193544d8e951Smrg    [case " $depcc " in #(
193644d8e951Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
193744d8e951Smrg     esac])
193844d8e951Smrg
193944d8e951Smrg  for depmode in $am_compiler_list; do
194044d8e951Smrg    # Setup a source with many dependencies, because some compilers
194144d8e951Smrg    # like to wrap large dependency lists on column 80 (with \), and
194244d8e951Smrg    # we should not choose a depcomp mode which is confused by this.
194344d8e951Smrg    #
194444d8e951Smrg    # We need to recreate these files for each test, as the compiler may
194544d8e951Smrg    # overwrite some of them when testing with obscure command lines.
194644d8e951Smrg    # This happens at least with the AIX C compiler.
194744d8e951Smrg    : > sub/conftest.c
194844d8e951Smrg    for i in 1 2 3 4 5 6; do
194944d8e951Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
195044d8e951Smrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
195144d8e951Smrg      # Solaris 8's {/usr,}/bin/sh.
195244d8e951Smrg      touch sub/conftst$i.h
195344d8e951Smrg    done
195444d8e951Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
195544d8e951Smrg
195644d8e951Smrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
195744d8e951Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
195844d8e951Smrg    # handle `-M -o', and we need to detect this.  Also, some Intel
195944d8e951Smrg    # versions had trouble with output in subdirs
196044d8e951Smrg    am__obj=sub/conftest.${OBJEXT-o}
196144d8e951Smrg    am__minus_obj="-o $am__obj"
196244d8e951Smrg    case $depmode in
196344d8e951Smrg    gcc)
196444d8e951Smrg      # This depmode causes a compiler race in universal mode.
196544d8e951Smrg      test "$am__universal" = false || continue
196644d8e951Smrg      ;;
196744d8e951Smrg    nosideeffect)
196844d8e951Smrg      # after this tag, mechanisms are not by side-effect, so they'll
196944d8e951Smrg      # only be used when explicitly requested
197044d8e951Smrg      if test "x$enable_dependency_tracking" = xyes; then
197144d8e951Smrg	continue
197244d8e951Smrg      else
197344d8e951Smrg	break
197444d8e951Smrg      fi
197544d8e951Smrg      ;;
197644d8e951Smrg    msvisualcpp | msvcmsys)
197744d8e951Smrg      # This compiler won't grok `-c -o', but also, the minuso test has
197844d8e951Smrg      # not run yet.  These depmodes are late enough in the game, and
197944d8e951Smrg      # so weak that their functioning should not be impacted.
198044d8e951Smrg      am__obj=conftest.${OBJEXT-o}
198144d8e951Smrg      am__minus_obj=
198244d8e951Smrg      ;;
198344d8e951Smrg    none) break ;;
198450539131Smrg    esac
198544d8e951Smrg    if depmode=$depmode \
198644d8e951Smrg       source=sub/conftest.c object=$am__obj \
198744d8e951Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
198844d8e951Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
198944d8e951Smrg         >/dev/null 2>conftest.err &&
199044d8e951Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
199144d8e951Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
199244d8e951Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
199344d8e951Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
199444d8e951Smrg      # icc doesn't choke on unknown options, it will just issue warnings
199544d8e951Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
199644d8e951Smrg      # that says an option was ignored or not supported.
199744d8e951Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
199844d8e951Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
199944d8e951Smrg      # The diagnosis changed in icc 8.0:
200044d8e951Smrg      #   icc: Command line remark: option '-MP' not supported
200144d8e951Smrg      if (grep 'ignoring option' conftest.err ||
200244d8e951Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
200344d8e951Smrg        am_cv_$1_dependencies_compiler_type=$depmode
200444d8e951Smrg        break
200544d8e951Smrg      fi
200644d8e951Smrg    fi
200744d8e951Smrg  done
200844d8e951Smrg
200944d8e951Smrg  cd ..
201044d8e951Smrg  rm -rf conftest.dir
201144d8e951Smrgelse
201244d8e951Smrg  am_cv_$1_dependencies_compiler_type=none
201350539131Smrgfi
201444d8e951Smrg])
201544d8e951SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
201644d8e951SmrgAM_CONDITIONAL([am__fastdep$1], [
201744d8e951Smrg  test "x$enable_dependency_tracking" != xno \
201844d8e951Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
201944d8e951Smrg])
202044d8e951Smrg
202144d8e951Smrg
202244d8e951Smrg# AM_SET_DEPDIR
202344d8e951Smrg# -------------
202444d8e951Smrg# Choose a directory name for dependency files.
202544d8e951Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
202644d8e951SmrgAC_DEFUN([AM_SET_DEPDIR],
202744d8e951Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
202844d8e951SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
202944d8e951Smrg])
203044d8e951Smrg
203144d8e951Smrg
203244d8e951Smrg# AM_DEP_TRACK
203344d8e951Smrg# ------------
203444d8e951SmrgAC_DEFUN([AM_DEP_TRACK],
203544d8e951Smrg[AC_ARG_ENABLE(dependency-tracking,
203644d8e951Smrg[  --disable-dependency-tracking  speeds up one-time build
203744d8e951Smrg  --enable-dependency-tracking   do not reject slow dependency extractors])
203844d8e951Smrgif test "x$enable_dependency_tracking" != xno; then
203944d8e951Smrg  am_depcomp="$ac_aux_dir/depcomp"
204044d8e951Smrg  AMDEPBACKSLASH='\'
204150539131Smrgfi
204244d8e951SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
204344d8e951SmrgAC_SUBST([AMDEPBACKSLASH])dnl
204444d8e951Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
204544d8e951Smrg])
2046ded1caa4Smrg
204744d8e951Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
2048ded1caa4Smrg
204944d8e951Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
205044d8e951Smrg# Free Software Foundation, Inc.
205150539131Smrg#
205244d8e951Smrg# This file is free software; the Free Software Foundation
205344d8e951Smrg# gives unlimited permission to copy and/or distribute it,
205444d8e951Smrg# with or without modifications, as long as this notice is preserved.
2055ded1caa4Smrg
205644d8e951Smrg#serial 5
2057ded1caa4Smrg
205844d8e951Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
205944d8e951Smrg# ------------------------------
206044d8e951SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
206144d8e951Smrg[{
206244d8e951Smrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
206344d8e951Smrg  # are listed without --file.  Let's play safe and only enable the eval
206444d8e951Smrg  # if we detect the quoting.
206544d8e951Smrg  case $CONFIG_FILES in
206644d8e951Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
206744d8e951Smrg  *)   set x $CONFIG_FILES ;;
206844d8e951Smrg  esac
206944d8e951Smrg  shift
207044d8e951Smrg  for mf
207144d8e951Smrg  do
207244d8e951Smrg    # Strip MF so we end up with the name of the file.
207344d8e951Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
207444d8e951Smrg    # Check whether this is an Automake generated Makefile or not.
207544d8e951Smrg    # We used to match only the files named `Makefile.in', but
207644d8e951Smrg    # some people rename them; so instead we look at the file content.
207744d8e951Smrg    # Grep'ing the first line is not enough: some people post-process
207844d8e951Smrg    # each Makefile.in and add a new line on top of each file to say so.
207944d8e951Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
208044d8e951Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
208144d8e951Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
208244d8e951Smrg      dirpart=`AS_DIRNAME("$mf")`
208344d8e951Smrg    else
208444d8e951Smrg      continue
208544d8e951Smrg    fi
208644d8e951Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
208744d8e951Smrg    # from the Makefile without running `make'.
208844d8e951Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
208944d8e951Smrg    test -z "$DEPDIR" && continue
209044d8e951Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
209144d8e951Smrg    test -z "am__include" && continue
209244d8e951Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
209344d8e951Smrg    # When using ansi2knr, U may be empty or an underscore; expand it
209444d8e951Smrg    U=`sed -n 's/^U = //p' < "$mf"`
209544d8e951Smrg    # Find all dependency output files, they are included files with
209644d8e951Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
209744d8e951Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
209844d8e951Smrg    # expansion.
209944d8e951Smrg    for file in `sed -n "
210044d8e951Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
210144d8e951Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
210244d8e951Smrg      # Make sure the directory exists.
210344d8e951Smrg      test -f "$dirpart/$file" && continue
210444d8e951Smrg      fdir=`AS_DIRNAME(["$file"])`
210544d8e951Smrg      AS_MKDIR_P([$dirpart/$fdir])
210644d8e951Smrg      # echo "creating $dirpart/$file"
210744d8e951Smrg      echo '# dummy' > "$dirpart/$file"
210844d8e951Smrg    done
210944d8e951Smrg  done
211044d8e951Smrg}
211144d8e951Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
2112ded1caa4Smrg
2113ded1caa4Smrg
211444d8e951Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
211544d8e951Smrg# -----------------------------
211644d8e951Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
211744d8e951Smrg#
211844d8e951Smrg# This code is only required when automatic dependency tracking
211944d8e951Smrg# is enabled.  FIXME.  This creates each `.P' file that we will
212044d8e951Smrg# need in order to bootstrap the dependency handling code.
212144d8e951SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
212244d8e951Smrg[AC_CONFIG_COMMANDS([depfiles],
212344d8e951Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
212444d8e951Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
212544d8e951Smrg])
2126ded1caa4Smrg
212744d8e951Smrg# Do all the work for Automake.                             -*- Autoconf -*-
2128ded1caa4Smrg
212944d8e951Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
213044d8e951Smrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
213144d8e951Smrg#
213244d8e951Smrg# This file is free software; the Free Software Foundation
213344d8e951Smrg# gives unlimited permission to copy and/or distribute it,
213444d8e951Smrg# with or without modifications, as long as this notice is preserved.
213544d8e951Smrg
213644d8e951Smrg# serial 16
2137ded1caa4Smrg
213844d8e951Smrg# This macro actually does too much.  Some checks are only needed if
213944d8e951Smrg# your package does certain things.  But this isn't really a big deal.
2140ded1caa4Smrg
214144d8e951Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
214244d8e951Smrg# AM_INIT_AUTOMAKE([OPTIONS])
214344d8e951Smrg# -----------------------------------------------
214444d8e951Smrg# The call with PACKAGE and VERSION arguments is the old style
214544d8e951Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
214644d8e951Smrg# and VERSION should now be passed to AC_INIT and removed from
214744d8e951Smrg# the call to AM_INIT_AUTOMAKE.
214844d8e951Smrg# We support both call styles for the transition.  After
214944d8e951Smrg# the next Automake release, Autoconf can make the AC_INIT
215044d8e951Smrg# arguments mandatory, and then we can depend on a new Autoconf
215144d8e951Smrg# release and drop the old call support.
215244d8e951SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
215344d8e951Smrg[AC_PREREQ([2.62])dnl
215444d8e951Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
215544d8e951Smrgdnl the ones we care about.
215644d8e951Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
215744d8e951SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
215844d8e951SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
215944d8e951Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
216044d8e951Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
216144d8e951Smrg  # is not polluted with repeated "-I."
216244d8e951Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
216344d8e951Smrg  # test to see if srcdir already configured
216444d8e951Smrg  if test -f $srcdir/config.status; then
216544d8e951Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
216644d8e951Smrg  fi
216750539131Smrgfi
2168ded1caa4Smrg
216944d8e951Smrg# test whether we have cygpath
217044d8e951Smrgif test -z "$CYGPATH_W"; then
217144d8e951Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
217244d8e951Smrg    CYGPATH_W='cygpath -w'
217344d8e951Smrg  else
217444d8e951Smrg    CYGPATH_W=echo
217544d8e951Smrg  fi
217644d8e951Smrgfi
217744d8e951SmrgAC_SUBST([CYGPATH_W])
2178ded1caa4Smrg
217944d8e951Smrg# Define the identity of the package.
218044d8e951Smrgdnl Distinguish between old-style and new-style calls.
218144d8e951Smrgm4_ifval([$2],
218244d8e951Smrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
218344d8e951Smrg AC_SUBST([PACKAGE], [$1])dnl
218444d8e951Smrg AC_SUBST([VERSION], [$2])],
218544d8e951Smrg[_AM_SET_OPTIONS([$1])dnl
218644d8e951Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
218744d8e951Smrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
218844d8e951Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
218944d8e951Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
219044d8e951Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2191ded1caa4Smrg
219244d8e951Smrg_AM_IF_OPTION([no-define],,
219344d8e951Smrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
219444d8e951Smrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
2195ded1caa4Smrg
219644d8e951Smrg# Some tools Automake needs.
219744d8e951SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
219844d8e951SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
219944d8e951SmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
220044d8e951SmrgAM_MISSING_PROG(AUTOCONF, autoconf)
220144d8e951SmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
220244d8e951SmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
220344d8e951SmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
220444d8e951SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
220544d8e951SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
220644d8e951SmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
220744d8e951Smrg# We need awk for the "check" target.  The system "awk" is bad on
220844d8e951Smrg# some platforms.
220944d8e951SmrgAC_REQUIRE([AC_PROG_AWK])dnl
221044d8e951SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
221144d8e951SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
221244d8e951Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
221344d8e951Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
221444d8e951Smrg			     [_AM_PROG_TAR([v7])])])
221544d8e951Smrg_AM_IF_OPTION([no-dependencies],,
221644d8e951Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
221744d8e951Smrg		  [_AM_DEPENDENCIES(CC)],
221844d8e951Smrg		  [define([AC_PROG_CC],
221944d8e951Smrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
222044d8e951SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
222144d8e951Smrg		  [_AM_DEPENDENCIES(CXX)],
222244d8e951Smrg		  [define([AC_PROG_CXX],
222344d8e951Smrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
222444d8e951SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
222544d8e951Smrg		  [_AM_DEPENDENCIES(OBJC)],
222644d8e951Smrg		  [define([AC_PROG_OBJC],
222744d8e951Smrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
222844d8e951Smrg])
222944d8e951Smrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
223044d8e951Smrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
223144d8e951Smrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
223244d8e951Smrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
223344d8e951SmrgAC_CONFIG_COMMANDS_PRE(dnl
223444d8e951Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
223544d8e951Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
223644d8e951Smrg])
223750539131Smrg
223844d8e951Smrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
223944d8e951Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
224044d8e951Smrgdnl mangled by Autoconf and run in a shell conditional statement.
224144d8e951Smrgm4_define([_AC_COMPILER_EXEEXT],
224244d8e951Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
224344d8e951Smrg
224444d8e951Smrg
224544d8e951Smrg# When config.status generates a header, we must update the stamp-h file.
224644d8e951Smrg# This file resides in the same directory as the config header
224744d8e951Smrg# that is generated.  The stamp files are numbered to have different names.
224844d8e951Smrg
224944d8e951Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
225044d8e951Smrg# loop where config.status creates the headers, so we can generate
225144d8e951Smrg# our stamp files there.
225244d8e951SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
225344d8e951Smrg[# Compute $1's index in $config_headers.
225444d8e951Smrg_am_arg=$1
225544d8e951Smrg_am_stamp_count=1
225644d8e951Smrgfor _am_header in $config_headers :; do
225744d8e951Smrg  case $_am_header in
225844d8e951Smrg    $_am_arg | $_am_arg:* )
225944d8e951Smrg      break ;;
226044d8e951Smrg    * )
226144d8e951Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
226244d8e951Smrg  esac
226344d8e951Smrgdone
226444d8e951Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
226544d8e951Smrg
226644d8e951Smrg# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
226750539131Smrg#
226844d8e951Smrg# This file is free software; the Free Software Foundation
226944d8e951Smrg# gives unlimited permission to copy and/or distribute it,
227044d8e951Smrg# with or without modifications, as long as this notice is preserved.
227144d8e951Smrg
227244d8e951Smrg# AM_PROG_INSTALL_SH
227344d8e951Smrg# ------------------
227444d8e951Smrg# Define $install_sh.
227544d8e951SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
227644d8e951Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
227744d8e951Smrgif test x"${install_sh}" != xset; then
227844d8e951Smrg  case $am_aux_dir in
227944d8e951Smrg  *\ * | *\	*)
228044d8e951Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
228144d8e951Smrg  *)
228244d8e951Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
228344d8e951Smrg  esac
228450539131Smrgfi
228544d8e951SmrgAC_SUBST(install_sh)])
228650539131Smrg
228744d8e951Smrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
228844d8e951Smrg#
228944d8e951Smrg# This file is free software; the Free Software Foundation
229044d8e951Smrg# gives unlimited permission to copy and/or distribute it,
229144d8e951Smrg# with or without modifications, as long as this notice is preserved.
229250539131Smrg
229344d8e951Smrg# serial 2
229450539131Smrg
229544d8e951Smrg# Check whether the underlying file-system supports filenames
229644d8e951Smrg# with a leading dot.  For instance MS-DOS doesn't.
229744d8e951SmrgAC_DEFUN([AM_SET_LEADING_DOT],
229844d8e951Smrg[rm -rf .tst 2>/dev/null
229944d8e951Smrgmkdir .tst 2>/dev/null
230044d8e951Smrgif test -d .tst; then
230144d8e951Smrg  am__leading_dot=.
230244d8e951Smrgelse
230344d8e951Smrg  am__leading_dot=_
230450539131Smrgfi
230544d8e951Smrgrmdir .tst 2>/dev/null
230644d8e951SmrgAC_SUBST([am__leading_dot])])
230750539131Smrg
230844d8e951Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
230944d8e951Smrg# From Jim Meyering
231050539131Smrg
231144d8e951Smrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
231244d8e951Smrg# Free Software Foundation, Inc.
231344d8e951Smrg#
231444d8e951Smrg# This file is free software; the Free Software Foundation
231544d8e951Smrg# gives unlimited permission to copy and/or distribute it,
231644d8e951Smrg# with or without modifications, as long as this notice is preserved.
231750539131Smrg
231844d8e951Smrg# serial 5
231950539131Smrg
232044d8e951Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
232144d8e951Smrg# ----------------------------------
232244d8e951Smrg# Control maintainer-specific portions of Makefiles.
232344d8e951Smrg# Default is to disable them, unless `enable' is passed literally.
232444d8e951Smrg# For symmetry, `disable' may be passed as well.  Anyway, the user
232544d8e951Smrg# can override the default with the --enable/--disable switch.
232644d8e951SmrgAC_DEFUN([AM_MAINTAINER_MODE],
232744d8e951Smrg[m4_case(m4_default([$1], [disable]),
232844d8e951Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
232944d8e951Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
233044d8e951Smrg       [m4_define([am_maintainer_other], [enable])
233144d8e951Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
233244d8e951SmrgAC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
233344d8e951Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
233444d8e951Smrg  AC_ARG_ENABLE([maintainer-mode],
233544d8e951Smrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
233644d8e951Smrg			  (and sometimes confusing) to the casual installer],
233744d8e951Smrg      [USE_MAINTAINER_MODE=$enableval],
233844d8e951Smrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
233944d8e951Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
234044d8e951Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
234144d8e951Smrg  MAINT=$MAINTAINER_MODE_TRUE
234244d8e951Smrg  AC_SUBST([MAINT])dnl
234344d8e951Smrg]
234444d8e951Smrg)
234550539131Smrg
234644d8e951SmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
234750539131Smrg
234844d8e951Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
234944d8e951Smrg
235044d8e951Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
235150539131Smrg#
235244d8e951Smrg# This file is free software; the Free Software Foundation
235344d8e951Smrg# gives unlimited permission to copy and/or distribute it,
235444d8e951Smrg# with or without modifications, as long as this notice is preserved.
235550539131Smrg
235644d8e951Smrg# serial 4
235750539131Smrg
235844d8e951Smrg# AM_MAKE_INCLUDE()
235944d8e951Smrg# -----------------
236044d8e951Smrg# Check to see how make treats includes.
236144d8e951SmrgAC_DEFUN([AM_MAKE_INCLUDE],
236244d8e951Smrg[am_make=${MAKE-make}
236344d8e951Smrgcat > confinc << 'END'
236444d8e951Smrgam__doit:
236544d8e951Smrg	@echo this is the am__doit target
236644d8e951Smrg.PHONY: am__doit
236744d8e951SmrgEND
236844d8e951Smrg# If we don't find an include directive, just comment out the code.
236944d8e951SmrgAC_MSG_CHECKING([for style of include used by $am_make])
237044d8e951Smrgam__include="#"
237144d8e951Smrgam__quote=
237244d8e951Smrg_am_result=none
237344d8e951Smrg# First try GNU make style include.
237444d8e951Smrgecho "include confinc" > confmf
237544d8e951Smrg# Ignore all kinds of additional output from `make'.
237644d8e951Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
237744d8e951Smrg*the\ am__doit\ target*)
237844d8e951Smrg  am__include=include
237944d8e951Smrg  am__quote=
238044d8e951Smrg  _am_result=GNU
238144d8e951Smrg  ;;
238244d8e951Smrgesac
238344d8e951Smrg# Now try BSD make style include.
238444d8e951Smrgif test "$am__include" = "#"; then
238544d8e951Smrg   echo '.include "confinc"' > confmf
238644d8e951Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
238744d8e951Smrg   *the\ am__doit\ target*)
238844d8e951Smrg     am__include=.include
238944d8e951Smrg     am__quote="\""
239044d8e951Smrg     _am_result=BSD
239144d8e951Smrg     ;;
239244d8e951Smrg   esac
239350539131Smrgfi
239444d8e951SmrgAC_SUBST([am__include])
239544d8e951SmrgAC_SUBST([am__quote])
239644d8e951SmrgAC_MSG_RESULT([$_am_result])
239744d8e951Smrgrm -f confinc confmf
239844d8e951Smrg])
239950539131Smrg
240044d8e951Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
2401ded1caa4Smrg
240244d8e951Smrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
240344d8e951Smrg# Free Software Foundation, Inc.
240450539131Smrg#
240544d8e951Smrg# This file is free software; the Free Software Foundation
240644d8e951Smrg# gives unlimited permission to copy and/or distribute it,
240744d8e951Smrg# with or without modifications, as long as this notice is preserved.
240850539131Smrg
240944d8e951Smrg# serial 6
241050539131Smrg
241144d8e951Smrg# AM_MISSING_PROG(NAME, PROGRAM)
241244d8e951Smrg# ------------------------------
241344d8e951SmrgAC_DEFUN([AM_MISSING_PROG],
241444d8e951Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
241544d8e951Smrg$1=${$1-"${am_missing_run}$2"}
241644d8e951SmrgAC_SUBST($1)])
241750539131Smrg
241850539131Smrg
241944d8e951Smrg# AM_MISSING_HAS_RUN
242044d8e951Smrg# ------------------
242144d8e951Smrg# Define MISSING if not defined so far and test if it supports --run.
242244d8e951Smrg# If it does, set am_missing_run to use it, otherwise, to nothing.
242344d8e951SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
242444d8e951Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
242544d8e951SmrgAC_REQUIRE_AUX_FILE([missing])dnl
242644d8e951Smrgif test x"${MISSING+set}" != xset; then
242744d8e951Smrg  case $am_aux_dir in
242844d8e951Smrg  *\ * | *\	*)
242944d8e951Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
243044d8e951Smrg  *)
243144d8e951Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
243244d8e951Smrg  esac
243350539131Smrgfi
243444d8e951Smrg# Use eval to expand $SHELL
243544d8e951Smrgif eval "$MISSING --run true"; then
243644d8e951Smrg  am_missing_run="$MISSING --run "
243744d8e951Smrgelse
243844d8e951Smrg  am_missing_run=
243944d8e951Smrg  AC_MSG_WARN([`missing' script is too old or missing])
244044d8e951Smrgfi
244144d8e951Smrg])
244250539131Smrg
244344d8e951Smrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
244444d8e951Smrg#
244544d8e951Smrg# This file is free software; the Free Software Foundation
244644d8e951Smrg# gives unlimited permission to copy and/or distribute it,
244744d8e951Smrg# with or without modifications, as long as this notice is preserved.
244850539131Smrg
244944d8e951Smrg# AM_PROG_MKDIR_P
245050539131Smrg# ---------------
245144d8e951Smrg# Check for `mkdir -p'.
245244d8e951SmrgAC_DEFUN([AM_PROG_MKDIR_P],
245344d8e951Smrg[AC_PREREQ([2.60])dnl
245444d8e951SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
245544d8e951Smrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
245644d8e951Smrgdnl while keeping a definition of mkdir_p for backward compatibility.
245744d8e951Smrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
245844d8e951Smrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
245944d8e951Smrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
246044d8e951Smrgdnl adjustment using top_builddir (which is defined more often than
246144d8e951Smrgdnl MKDIR_P).
246244d8e951SmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
246344d8e951Smrgcase $mkdir_p in
246444d8e951Smrg  [[\\/$]]* | ?:[[\\/]]*) ;;
246544d8e951Smrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
246644d8e951Smrgesac
246744d8e951Smrg])
246844d8e951Smrg
246944d8e951Smrg# Helper functions for option handling.                     -*- Autoconf -*-
247044d8e951Smrg
247144d8e951Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
247250539131Smrg#
247344d8e951Smrg# This file is free software; the Free Software Foundation
247444d8e951Smrg# gives unlimited permission to copy and/or distribute it,
247544d8e951Smrg# with or without modifications, as long as this notice is preserved.
247650539131Smrg
247744d8e951Smrg# serial 4
247844d8e951Smrg
247944d8e951Smrg# _AM_MANGLE_OPTION(NAME)
248050539131Smrg# -----------------------
248144d8e951SmrgAC_DEFUN([_AM_MANGLE_OPTION],
248244d8e951Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
248350539131Smrg
248444d8e951Smrg# _AM_SET_OPTION(NAME)
248544d8e951Smrg# ------------------------------
248644d8e951Smrg# Set option NAME.  Presently that only means defining a flag for this option.
248744d8e951SmrgAC_DEFUN([_AM_SET_OPTION],
248844d8e951Smrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
248950539131Smrg
249044d8e951Smrg# _AM_SET_OPTIONS(OPTIONS)
249144d8e951Smrg# ----------------------------------
249244d8e951Smrg# OPTIONS is a space-separated list of Automake options.
249344d8e951SmrgAC_DEFUN([_AM_SET_OPTIONS],
249444d8e951Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
2495ded1caa4Smrg
249644d8e951Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
249744d8e951Smrg# -------------------------------------------
249844d8e951Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
249944d8e951SmrgAC_DEFUN([_AM_IF_OPTION],
250044d8e951Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
2501ded1caa4Smrg
250244d8e951Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
250350539131Smrg
250444d8e951Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
250544d8e951Smrg# Free Software Foundation, Inc.
250650539131Smrg#
250744d8e951Smrg# This file is free software; the Free Software Foundation
250844d8e951Smrg# gives unlimited permission to copy and/or distribute it,
250944d8e951Smrg# with or without modifications, as long as this notice is preserved.
251050539131Smrg
251144d8e951Smrg# serial 5
251244d8e951Smrg
251344d8e951Smrg# AM_SANITY_CHECK
251444d8e951Smrg# ---------------
251544d8e951SmrgAC_DEFUN([AM_SANITY_CHECK],
251644d8e951Smrg[AC_MSG_CHECKING([whether build environment is sane])
251744d8e951Smrg# Just in case
251844d8e951Smrgsleep 1
251944d8e951Smrgecho timestamp > conftest.file
252044d8e951Smrg# Reject unsafe characters in $srcdir or the absolute working directory
252144d8e951Smrg# name.  Accept space and tab only in the latter.
252244d8e951Smrgam_lf='
252344d8e951Smrg'
252444d8e951Smrgcase `pwd` in
252544d8e951Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
252644d8e951Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
252744d8e951Smrgesac
252844d8e951Smrgcase $srcdir in
252944d8e951Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
253044d8e951Smrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
253144d8e951Smrgesac
253244d8e951Smrg
253344d8e951Smrg# Do `set' in a subshell so we don't clobber the current shell's
253444d8e951Smrg# arguments.  Must try -L first in case configure is actually a
253544d8e951Smrg# symlink; some systems play weird games with the mod time of symlinks
253644d8e951Smrg# (eg FreeBSD returns the mod time of the symlink's containing
253744d8e951Smrg# directory).
253844d8e951Smrgif (
253944d8e951Smrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
254044d8e951Smrg   if test "$[*]" = "X"; then
254144d8e951Smrg      # -L didn't work.
254244d8e951Smrg      set X `ls -t "$srcdir/configure" conftest.file`
254344d8e951Smrg   fi
254444d8e951Smrg   rm -f conftest.file
254544d8e951Smrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
254644d8e951Smrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
254744d8e951Smrg
254844d8e951Smrg      # If neither matched, then we have a broken ls.  This can happen
254944d8e951Smrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
255044d8e951Smrg      # broken ls alias from the environment.  This has actually
255144d8e951Smrg      # happened.  Such a system could not be considered "sane".
255244d8e951Smrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
255344d8e951Smrgalias in your environment])
255444d8e951Smrg   fi
255544d8e951Smrg
255644d8e951Smrg   test "$[2]" = conftest.file
255744d8e951Smrg   )
255844d8e951Smrgthen
255944d8e951Smrg   # Ok.
256044d8e951Smrg   :
256144d8e951Smrgelse
256244d8e951Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
256344d8e951SmrgCheck your system clock])
256450539131Smrgfi
256544d8e951SmrgAC_MSG_RESULT(yes)])
256650539131Smrg
256744d8e951Smrg# Copyright (C) 2009  Free Software Foundation, Inc.
256850539131Smrg#
256944d8e951Smrg# This file is free software; the Free Software Foundation
257044d8e951Smrg# gives unlimited permission to copy and/or distribute it,
257144d8e951Smrg# with or without modifications, as long as this notice is preserved.
257250539131Smrg
257344d8e951Smrg# serial 1
257450539131Smrg
257544d8e951Smrg# AM_SILENT_RULES([DEFAULT])
257644d8e951Smrg# --------------------------
257744d8e951Smrg# Enable less verbose build rules; with the default set to DEFAULT
257844d8e951Smrg# (`yes' being less verbose, `no' or empty being verbose).
257944d8e951SmrgAC_DEFUN([AM_SILENT_RULES],
258044d8e951Smrg[AC_ARG_ENABLE([silent-rules],
258144d8e951Smrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
258244d8e951Smrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
258344d8e951Smrgcase $enable_silent_rules in
258444d8e951Smrgyes) AM_DEFAULT_VERBOSITY=0;;
258544d8e951Smrgno)  AM_DEFAULT_VERBOSITY=1;;
258644d8e951Smrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
258744d8e951Smrgesac
258844d8e951SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
258944d8e951SmrgAM_BACKSLASH='\'
259044d8e951SmrgAC_SUBST([AM_BACKSLASH])dnl
259144d8e951Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
259244d8e951Smrg])
259350539131Smrg
259444d8e951Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
259544d8e951Smrg#
259644d8e951Smrg# This file is free software; the Free Software Foundation
259744d8e951Smrg# gives unlimited permission to copy and/or distribute it,
259844d8e951Smrg# with or without modifications, as long as this notice is preserved.
259950539131Smrg
260044d8e951Smrg# AM_PROG_INSTALL_STRIP
260144d8e951Smrg# ---------------------
260244d8e951Smrg# One issue with vendor `install' (even GNU) is that you can't
260344d8e951Smrg# specify the program used to strip binaries.  This is especially
260444d8e951Smrg# annoying in cross-compiling environments, where the build's strip
260544d8e951Smrg# is unlikely to handle the host's binaries.
260644d8e951Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
260744d8e951Smrg# always use install-sh in `make install-strip', and initialize
260844d8e951Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
260944d8e951SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
261044d8e951Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
261144d8e951Smrg# Installed binaries are usually stripped using `strip' when the user
261244d8e951Smrg# run `make install-strip'.  However `strip' might not be the right
261344d8e951Smrg# tool to use in cross-compilation environments, therefore Automake
261444d8e951Smrg# will honor the `STRIP' environment variable to overrule this program.
261544d8e951Smrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
261644d8e951Smrgif test "$cross_compiling" != no; then
261744d8e951Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
261844d8e951Smrgfi
261944d8e951SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
262044d8e951SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
262150539131Smrg
262244d8e951Smrg# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
262350539131Smrg#
262444d8e951Smrg# This file is free software; the Free Software Foundation
262544d8e951Smrg# gives unlimited permission to copy and/or distribute it,
262644d8e951Smrg# with or without modifications, as long as this notice is preserved.
262750539131Smrg
262844d8e951Smrg# serial 2
262950539131Smrg
263044d8e951Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
263144d8e951Smrg# ---------------------------
263244d8e951Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
263344d8e951Smrg# This macro is traced by Automake.
263444d8e951SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
263550539131Smrg
263644d8e951Smrg# AM_SUBST_NOTMAKE(VARIABLE)
263744d8e951Smrg# ---------------------------
263844d8e951Smrg# Public sister of _AM_SUBST_NOTMAKE.
263944d8e951SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
264050539131Smrg
264144d8e951Smrg# Check how to create a tarball.                            -*- Autoconf -*-
264250539131Smrg
264344d8e951Smrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
264444d8e951Smrg#
264544d8e951Smrg# This file is free software; the Free Software Foundation
264644d8e951Smrg# gives unlimited permission to copy and/or distribute it,
264744d8e951Smrg# with or without modifications, as long as this notice is preserved.
264850539131Smrg
264944d8e951Smrg# serial 2
265050539131Smrg
265144d8e951Smrg# _AM_PROG_TAR(FORMAT)
265244d8e951Smrg# --------------------
265344d8e951Smrg# Check how to create a tarball in format FORMAT.
265444d8e951Smrg# FORMAT should be one of `v7', `ustar', or `pax'.
265544d8e951Smrg#
265644d8e951Smrg# Substitute a variable $(am__tar) that is a command
265744d8e951Smrg# writing to stdout a FORMAT-tarball containing the directory
265844d8e951Smrg# $tardir.
265944d8e951Smrg#     tardir=directory && $(am__tar) > result.tar
266044d8e951Smrg#
266144d8e951Smrg# Substitute a variable $(am__untar) that extract such
266244d8e951Smrg# a tarball read from stdin.
266344d8e951Smrg#     $(am__untar) < result.tar
266444d8e951SmrgAC_DEFUN([_AM_PROG_TAR],
266544d8e951Smrg[# Always define AMTAR for backward compatibility.
266644d8e951SmrgAM_MISSING_PROG([AMTAR], [tar])
266744d8e951Smrgm4_if([$1], [v7],
266844d8e951Smrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
266944d8e951Smrg     [m4_case([$1], [ustar],, [pax],,
267044d8e951Smrg              [m4_fatal([Unknown tar format])])
267144d8e951SmrgAC_MSG_CHECKING([how to create a $1 tar archive])
267244d8e951Smrg# Loop over all known methods to create a tar archive until one works.
267344d8e951Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
267444d8e951Smrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
267544d8e951Smrg# Do not fold the above two line into one, because Tru64 sh and
267644d8e951Smrg# Solaris sh will not grok spaces in the rhs of `-'.
267744d8e951Smrgfor _am_tool in $_am_tools
267844d8e951Smrgdo
267944d8e951Smrg  case $_am_tool in
268044d8e951Smrg  gnutar)
268144d8e951Smrg    for _am_tar in tar gnutar gtar;
268244d8e951Smrg    do
268344d8e951Smrg      AM_RUN_LOG([$_am_tar --version]) && break
268444d8e951Smrg    done
268544d8e951Smrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
268644d8e951Smrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
268744d8e951Smrg    am__untar="$_am_tar -xf -"
268844d8e951Smrg    ;;
268944d8e951Smrg  plaintar)
269044d8e951Smrg    # Must skip GNU tar: if it does not support --format= it doesn't create
269144d8e951Smrg    # ustar tarball either.
269244d8e951Smrg    (tar --version) >/dev/null 2>&1 && continue
269344d8e951Smrg    am__tar='tar chf - "$$tardir"'
269444d8e951Smrg    am__tar_='tar chf - "$tardir"'
269544d8e951Smrg    am__untar='tar xf -'
269644d8e951Smrg    ;;
269744d8e951Smrg  pax)
269844d8e951Smrg    am__tar='pax -L -x $1 -w "$$tardir"'
269944d8e951Smrg    am__tar_='pax -L -x $1 -w "$tardir"'
270044d8e951Smrg    am__untar='pax -r'
270144d8e951Smrg    ;;
270244d8e951Smrg  cpio)
270344d8e951Smrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
270444d8e951Smrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
270544d8e951Smrg    am__untar='cpio -i -H $1 -d'
270644d8e951Smrg    ;;
270744d8e951Smrg  none)
270844d8e951Smrg    am__tar=false
270944d8e951Smrg    am__tar_=false
271044d8e951Smrg    am__untar=false
271144d8e951Smrg    ;;
271244d8e951Smrg  esac
271350539131Smrg
271444d8e951Smrg  # If the value was cached, stop now.  We just wanted to have am__tar
271544d8e951Smrg  # and am__untar set.
271644d8e951Smrg  test -n "${am_cv_prog_tar_$1}" && break
271750539131Smrg
271844d8e951Smrg  # tar/untar a dummy directory, and stop if the command works
271944d8e951Smrg  rm -rf conftest.dir
272044d8e951Smrg  mkdir conftest.dir
272144d8e951Smrg  echo GrepMe > conftest.dir/file
272244d8e951Smrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
272344d8e951Smrg  rm -rf conftest.dir
272444d8e951Smrg  if test -s conftest.tar; then
272544d8e951Smrg    AM_RUN_LOG([$am__untar <conftest.tar])
272644d8e951Smrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
272744d8e951Smrg  fi
272844d8e951Smrgdone
272944d8e951Smrgrm -rf conftest.dir
273050539131Smrg
273144d8e951SmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
273244d8e951SmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
273344d8e951SmrgAC_SUBST([am__tar])
273444d8e951SmrgAC_SUBST([am__untar])
273544d8e951Smrg]) # _AM_PROG_TAR
273650539131Smrg
2737