aclocal.m4 revision 40c5823b
140c5823bSmrg# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
28f34cbf9Ssnj
340c5823bSmrg# Copyright (C) 1996-2017 Free Software Foundation, Inc.
4bbe1b32bSmrg
5bbe1b32bSmrg# This file is free software; the Free Software Foundation
6bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
7bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
8bbe1b32bSmrg
9bbe1b32bSmrg# This program is distributed in the hope that it will be useful,
10bbe1b32bSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11bbe1b32bSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12bbe1b32bSmrg# PARTICULAR PURPOSE.
13bbe1b32bSmrg
148f34cbf9Ssnjm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
1530f8ce46Smrgm4_ifndef([AC_AUTOCONF_VERSION],
1630f8ce46Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1740c5823bSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
1840c5823bSmrg[m4_warning([this file was generated for autoconf 2.69.
1930f8ce46SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
2030f8ce46SmrgIf you have problems, you may need to regenerate the build system entirely.
218f34cbf9SsnjTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22bbe1b32bSmrg
2340c5823bSmrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
2440c5823bSmrgdnl
2540c5823bSmrgdnl This file comes from X.Org's font-util 1.3.1
2640c5823bSmrgdnl
2740c5823bSmrgdnl Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
2840c5823bSmrgdnl
2940c5823bSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
3040c5823bSmrgdnl copy of this software and associated documentation files (the "Software"),
3140c5823bSmrgdnl to deal in the Software without restriction, including without limitation
3240c5823bSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3340c5823bSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
3440c5823bSmrgdnl Software is furnished to do so, subject to the following conditions:
3540c5823bSmrgdnl
3640c5823bSmrgdnl The above copyright notice and this permission notice (including the next
3740c5823bSmrgdnl paragraph) shall be included in all copies or substantial portions of the
3840c5823bSmrgdnl Software.
3940c5823bSmrgdnl
4040c5823bSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4140c5823bSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4240c5823bSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
4340c5823bSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4440c5823bSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
4540c5823bSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
4640c5823bSmrgdnl DEALINGS IN THE SOFTWARE.
4740c5823bSmrgdnl
4840c5823bSmrgdnl --------------------------------------------------------------------
4940c5823bSmrgdnl
5040c5823bSmrgdnl Copyright 2005 Red Hat, Inc
5140c5823bSmrgdnl
5240c5823bSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
5340c5823bSmrgdnl documentation for any purpose is hereby granted without fee, provided that
5440c5823bSmrgdnl the above copyright notice appear in all copies and that both that
5540c5823bSmrgdnl copyright notice and this permission notice appear in supporting
5640c5823bSmrgdnl documentation.
5740c5823bSmrgdnl
5840c5823bSmrgdnl The above copyright notice and this permission notice shall be included
5940c5823bSmrgdnl in all copies or substantial portions of the Software.
6040c5823bSmrgdnl
6140c5823bSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
6240c5823bSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
6340c5823bSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
6440c5823bSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
6540c5823bSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
6640c5823bSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
6740c5823bSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
6840c5823bSmrgdnl
6940c5823bSmrgdnl Except as contained in this notice, the name of the copyright holders shall
7040c5823bSmrgdnl not be used in advertising or otherwise to promote the sale, use or
7140c5823bSmrgdnl other dealings in this Software without prior written authorization
7240c5823bSmrgdnl from the copyright holders.
7340c5823bSmrg
7440c5823bSmrg# XORG_FONT_MACROS_VERSION(required-version)
7540c5823bSmrg# ------------------------------------------
7640c5823bSmrg# Minimum version: 1.1.0
77ce6676dbSmrg#
7840c5823bSmrg# If you're using a macro added in Version 1.1 or newer, include this in
7940c5823bSmrg# your configure.ac with the minimum required version, such as:
8040c5823bSmrg# XORG_FONT_MACROS_VERSION(1.1)
8140c5823bSmrg#
8240c5823bSmrg# To ensure that this macro is defined, also add:
8340c5823bSmrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
8440c5823bSmrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
8540c5823bSmrg#
8640c5823bSmrg#
8740c5823bSmrg# See the "minimum version" comment for each macro you use to see what
8840c5823bSmrg# version you require.
8940c5823bSmrgm4_defun([XORG_FONT_MACROS_VERSION],[
9040c5823bSmrgm4_define([vers_have], [1.3.1])
9140c5823bSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
9240c5823bSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
9340c5823bSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
9440c5823bSmrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
9540c5823bSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
9640c5823bSmrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
9740c5823bSmrgm4_undefine([vers_have])
9840c5823bSmrgm4_undefine([maj_have])
9940c5823bSmrgm4_undefine([maj_needed])
10040c5823bSmrg]) # XORG_FONT_MACROS_VERSION
101bbe1b32bSmrg
10240c5823bSmrg# XORG_FONT_CHECK_{maps}()
10340c5823bSmrg# ------------------------
10440c5823bSmrg# Minimum version: 1.0.0
10540c5823bSmrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
10640c5823bSmrg# JISX0201 or KOI8_R.  By default, they are all enabled.
107bbe1b32bSmrg
10840c5823bSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
10940c5823bSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
11040c5823bSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
11140c5823bSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
11240c5823bSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
11340c5823bSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
11440c5823bSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
11540c5823bSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
11640c5823bSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
11740c5823bSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
11840c5823bSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
11940c5823bSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
12040c5823bSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
12140c5823bSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
12240c5823bSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
12340c5823bSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
12440c5823bSmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
12540c5823bSmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
126bbe1b32bSmrg
12740c5823bSmrg# XORG_FONT_CHECK_ENCODING(encoding)
12840c5823bSmrg# ----------------------------------
12940c5823bSmrg# Minimum version: 1.1.0
13040c5823bSmrg# This macro adds --enable/disable-<encoding>, enabled by default.
13140c5823bSmrg# It replaced individual copies of this code in the above macros in 1.1.
13240c5823bSmrg# Currently assumes encoding names will be all upper-case - add m4_toupper
13340c5823bSmrg# calls if this is not true in the future.
134bbe1b32bSmrg
13540c5823bSmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
13640c5823bSmrg	AC_ARG_ENABLE(m4_tolower($1),
13740c5823bSmrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
13840c5823bSmrg				[Build $1 fonts (default: yes)]),
13940c5823bSmrg		[AS_TR_SH($1)=$enableval])
14040c5823bSmrg	AC_MSG_CHECKING([whether to build $1 fonts])
14140c5823bSmrg	AC_MSG_RESULT($[AS_TR_SH($1)])
14240c5823bSmrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
14340c5823bSmrg]) # XORG_FONT_CHECK_ENCODING
144bbe1b32bSmrg
14540c5823bSmrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
14640c5823bSmrg# -----------------------------------------------------
14740c5823bSmrg# Minimum version: 1.1.0
14840c5823bSmrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
14940c5823bSmrg# Add a shorthand --enable/disable-all-encodings option.
150bbe1b32bSmrg
15140c5823bSmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
15240c5823bSmrg	AC_ARG_ENABLE([all-encodings],
15340c5823bSmrg		AS_HELP_STRING([--disable-all-encodings],
15440c5823bSmrg				[Disable building of all font encodings]),
15540c5823bSmrg		[m4_foreach_w([enc], [$1], [
15640c5823bSmrg			AS_TR_SH(enc)=$enableval
15740c5823bSmrg		])],
15840c5823bSmrg		[m4_foreach_w([enc], [$1], [
15940c5823bSmrg			AS_TR_SH(enc)=yes
16040c5823bSmrg		])])
16140c5823bSmrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
16240c5823bSmrg]) # XORG_FONT_CHECK_ENCODING_LIST
16340c5823bSmrg
16440c5823bSmrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
16540c5823bSmrg# ------------------------------------------
16640c5823bSmrg# Minimum version: 1.1.0
167bbe1b32bSmrg#
16840c5823bSmrg# Simple wrapper around AC_PATH_PROG that errors if not found
169bbe1b32bSmrg#
17040c5823bSmrg
17140c5823bSmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
17240c5823bSmrg	AC_PATH_PROG($1, $2)
17340c5823bSmrg	if test x"$$1" = x; then
17440c5823bSmrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
17540c5823bSmrg	fi
17640c5823bSmrg])
17740c5823bSmrg
17840c5823bSmrg
17940c5823bSmrg# XORG_FONT_FCCACHE()
18040c5823bSmrg# -------------------
18140c5823bSmrg# Minimum version: 1.1.0
182bbe1b32bSmrg#
18340c5823bSmrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
18440c5823bSmrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
18540c5823bSmrg# to run fc-cache if found and not installing to $DESTDIR and not
18640c5823bSmrg# cross-compiling
187bbe1b32bSmrg#
18840c5823bSmrg# fc-cache is optional, not required, and should be skipped when making
18940c5823bSmrg# packages (installing to $DESTDIR) or cross-compiling
190bbe1b32bSmrg#
19140c5823bSmrgAC_DEFUN([XORG_FONT_FCCACHE],[
19240c5823bSmrg	AC_PATH_PROG(FCCACHE, fc-cache)
19340c5823bSmrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
19440c5823bSmrg	if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then
19540c5823bSmrg		RUN_FCCACHE="${FCCACHE_WARN}"
19640c5823bSmrg	else
19740c5823bSmrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
19840c5823bSmrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
19940c5823bSmrg	fi
20040c5823bSmrg	AC_SUBST([RUN_FCCACHE])
201bbe1b32bSmrg])
202bbe1b32bSmrg
20340c5823bSmrg# XORG_FONT_MKFONTDIR()
20440c5823bSmrg# -------------------
20540c5823bSmrg# Minimum version: 1.3.0
206bbe1b32bSmrg#
20740c5823bSmrg# Set MKFONTDIR to path to mkfontdir.
20840c5823bSmrg#
20940c5823bSmrg# If cross-compiling, and if mkdir is not found, use a shell command
21040c5823bSmrg# which warns mkfontdir needs to be run on the target
21140c5823bSmrg#
21240c5823bSmrg# If not cross-compiling, mkfontdir must be found
21340c5823bSmrg#
21440c5823bSmrgAC_DEFUN([XORG_FONT_MKFONTDIR],[
21540c5823bSmrg	if test x"$cross_compiling" != x"no" ; then
21640c5823bSmrg		AC_PATH_PROG(MKFONTDIR, mkfontdir, "")
21740c5823bSmrg		MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run mkfontdir manually on host system"'
218bbe1b32bSmrg
21940c5823bSmrg		if test x"$MKFONTDIR" = x; then
22040c5823bSmrg			MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'"
22140c5823bSmrg		fi
22240c5823bSmrg	else
22340c5823bSmrg		XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
22440c5823bSmrg	fi
225bbe1b32bSmrg
22640c5823bSmrg	AC_SUBST([MKFONTDIR])
22740c5823bSmrg])
228bbe1b32bSmrg
22940c5823bSmrg# XORG_FONT_COMMON_UTILS()
23040c5823bSmrg# ------------------------
23140c5823bSmrg# Minimum version: 1.1.0
23240c5823bSmrg#
23340c5823bSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
234bbe1b32bSmrg
23540c5823bSmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
23640c5823bSmrg	XORG_FONT_FCCACHE
23740c5823bSmrg	XORG_FONT_MKFONTDIR
23840c5823bSmrg])
239bbe1b32bSmrg
24040c5823bSmrg# XORG_FONT_SCALED_UTILS()
24140c5823bSmrg# ------------------------
24240c5823bSmrg# Minimum version: 1.1.0
243bbe1b32bSmrg#
24440c5823bSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
24540c5823bSmrg# (TrueType, OpenType, Type1)
246bbe1b32bSmrg
24740c5823bSmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
24840c5823bSmrg	XORG_FONT_COMMON_UTILS
24940c5823bSmrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
25040c5823bSmrg])
251bbe1b32bSmrg
25240c5823bSmrg# XORG_FONT_BDF_UTILS()
25340c5823bSmrg# ---------------------
25440c5823bSmrg# Minimum version: 1.1.0
25540c5823bSmrg#
25640c5823bSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
25740c5823bSmrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
25840c5823bSmrg# PCF output files created by bdftopcf
25930f8ce46Smrg
26040c5823bSmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
26140c5823bSmrg	XORG_FONT_COMMON_UTILS
26240c5823bSmrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
26340c5823bSmrg	XORG_FONT_CHECK_COMPRESSION
26440c5823bSmrg])
265bbe1b32bSmrg
26640c5823bSmrg# XORG_FONT_CHECK_COMPRESSION()
26740c5823bSmrg# -----------------------------
26840c5823bSmrg# Minimum version: 1.1.0
26940c5823bSmrg#
27040c5823bSmrg# Offer a --with-compression flag to control what compression method is
27140c5823bSmrg# used for pcf font files.   Offers all the methods currently supported
27240c5823bSmrg# by libXfont, including no compression.
273bbe1b32bSmrg
27440c5823bSmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
27540c5823bSmrg	AC_MSG_CHECKING([font compression method])
27640c5823bSmrg	AC_ARG_WITH(compression,
27740c5823bSmrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
27840c5823bSmrg			 [compression method to use on pcf fonts])],
27940c5823bSmrg         [compression="$withval"], [compression="yes"])
28040c5823bSmrg	if test x"$compression" = "xyes" ; then
28140c5823bSmrg		compression="gzip"
28240c5823bSmrg	fi
28340c5823bSmrg	AC_MSG_RESULT([${compression}])
28440c5823bSmrg	case ${compression} in
28540c5823bSmrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
28640c5823bSmrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;;
28740c5823bSmrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
28840c5823bSmrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
28940c5823bSmrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
29040c5823bSmrg	esac
29140c5823bSmrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
29240c5823bSmrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
29340c5823bSmrg	fi
29440c5823bSmrg	AC_SUBST([COMPRESS_SUFFIX])
295bbe1b32bSmrg])
296bbe1b32bSmrg
29740c5823bSmrg# XORG_FONT_UCS2ANY()
29840c5823bSmrg# -------------------
29940c5823bSmrg# Minimum version: 1.1.0
30040c5823bSmrg#
30140c5823bSmrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
30240c5823bSmrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
30340c5823bSmrg# Also call pkg-config to find the directory with the encoding files needed
30440c5823bSmrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
305bbe1b32bSmrg
30640c5823bSmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
30740c5823bSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
30840c5823bSmrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
30940c5823bSmrg	PKG_CHECK_MODULES(MAPS, [fontutil])
31040c5823bSmrg	AC_MSG_CHECKING([for ucs2any encoding data files])
31140c5823bSmrg	MAPFILES_PATH=`$PKG_CONFIG --variable=mapdir fontutil`
31240c5823bSmrg	AC_SUBST(MAPFILES_PATH)
31340c5823bSmrg	AC_MSG_RESULT([${MAPFILES_PATH}])
314bbe1b32bSmrg])
315bbe1b32bSmrg
316bbe1b32bSmrg
317bbe1b32bSmrg
31840c5823bSmrg# XORG_FONT_FC_CONFDIR()
31940c5823bSmrg# --------------------
32040c5823bSmrg# Minimum version: 1.2.0
321bbe1b32bSmrg#
32240c5823bSmrg# Sets FC_CONFDIR to the fontconfig config directory
32340c5823bSmrg# (which should be --with-confdir=... when building fontconfig)
32440c5823bSmrg# found from:
32540c5823bSmrg#	--with-fc-confdir=...
32640c5823bSmrg#	pkg-config --variable=confdir fontconfig
32740c5823bSmrg#	${sysconfdir}/fonts
328bbe1b32bSmrg
32940c5823bSmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
33040c5823bSmrg	dnl Ensure $PKG_CONFIG is set first
33140c5823bSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
332bbe1b32bSmrg
33340c5823bSmrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
33440c5823bSmrg	AC_ARG_WITH(fc-confdir,
33540c5823bSmrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
33640c5823bSmrg			   [Path to fontconfig's configuration directory]),
33740c5823bSmrg		    [FC_CONFDIR="$withval"])
33840c5823bSmrg	# if --with-fc-confdir was not specified
33940c5823bSmrg	if test "x${FC_CONFDIR}" = "x"; then
34040c5823bSmrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
34140c5823bSmrg	fi
34240c5823bSmrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
34340c5823bSmrg	if test "x${FC_CONFDIR}" = "x"; then
34440c5823bSmrg		FC_CONFDIR="${sysconfdir}/fonts"
34540c5823bSmrg	fi
34640c5823bSmrg	AC_SUBST(FC_CONFDIR)
34740c5823bSmrg	AC_MSG_RESULT([${FC_CONFDIR}])
34840c5823bSmrg])
349bbe1b32bSmrg
350bbe1b32bSmrg
35140c5823bSmrg
35240c5823bSmrg# XORG_FONTROOTDIR()
35340c5823bSmrg# --------------------
35440c5823bSmrg# Minimum version: 1.1.0
355bbe1b32bSmrg#
35640c5823bSmrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
35740c5823bSmrg# found from:
35840c5823bSmrg#	--with-fontrootdir
35940c5823bSmrg#	pkg-config --variable=fontrootdir fontutil
36040c5823bSmrg#	${datadir}/fonts/X11
361bbe1b32bSmrg
36240c5823bSmrgAC_DEFUN([XORG_FONTROOTDIR],[
36340c5823bSmrg	dnl Ensure $PKG_CONFIG is set first
36440c5823bSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
36540c5823bSmrg
36640c5823bSmrg	AC_MSG_CHECKING([for root directory for font files])
36740c5823bSmrg	AC_ARG_WITH(fontrootdir,
36840c5823bSmrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
36940c5823bSmrg			   [Path to root directory for font files]),
37040c5823bSmrg		    [FONTROOTDIR="$withval"])
37140c5823bSmrg	# if --with-fontrootdir not specified...
37240c5823bSmrg	if test "x${FONTROOTDIR}" = "x"; then
37340c5823bSmrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
37440c5823bSmrg	fi
37540c5823bSmrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
37640c5823bSmrg	if test "x${FONTROOTDIR}" = "x"; then
37740c5823bSmrg		FONTROOTDIR="${datadir}/fonts/X11"
37840c5823bSmrg	fi
37940c5823bSmrg	AC_SUBST(FONTROOTDIR)
38040c5823bSmrg	AC_MSG_RESULT([${FONTROOTDIR}])
38140c5823bSmrg])
382bbe1b32bSmrg
38340c5823bSmrg# XORG_FONTSUBDIR(variable, flag, subdir)
38440c5823bSmrg# ---------------------------------------
38540c5823bSmrg# Minimum version: 1.1.0
386bbe1b32bSmrg#
38740c5823bSmrg# Offer a --with-<flag> flag to control directory for font installation
38840c5823bSmrg# Default is the specified <subdir> of the font root directory.
38940c5823bSmrg# Sets <variable> to the selected directory
390bbe1b32bSmrg
39140c5823bSmrgAC_DEFUN([XORG_FONTSUBDIR],[
39240c5823bSmrg	AC_REQUIRE([XORG_FONTROOTDIR])
393bbe1b32bSmrg
39440c5823bSmrg	AC_MSG_CHECKING([for directory for $3 files])
39540c5823bSmrg	AC_ARG_WITH($2,
39640c5823bSmrg		    [AS_HELP_STRING([--with-$2=DIR],
39740c5823bSmrg				    [Path to $3 files [FONTROOTDIR/$3]])],
39840c5823bSmrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
39940c5823bSmrg	AC_SUBST($1)
40040c5823bSmrg	AC_MSG_RESULT([${$1}])
40140c5823bSmrg]) # XORG_FONTSUBDIR
4028f34cbf9Ssnj
40340c5823bSmrg# XORG_FONTDIR(subdir)
40440c5823bSmrg# --------------------
40540c5823bSmrg# Minimum version: 1.1.0
40640c5823bSmrg#
40740c5823bSmrg# Offer a --with-fontdir flag to control directory for font installation
40840c5823bSmrg# Default is the specified subdir of the font root directory.
40940c5823bSmrg# Sets FONTDIR to the selected directory
410bbe1b32bSmrg
41140c5823bSmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
412bbe1b32bSmrg
41340c5823bSmrg# pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
41440c5823bSmrg# serial 11 (pkg-config-0.29.1)
415bbe1b32bSmrg
41640c5823bSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
41740c5823bSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
41840c5823bSmrgdnl
41940c5823bSmrgdnl This program is free software; you can redistribute it and/or modify
42040c5823bSmrgdnl it under the terms of the GNU General Public License as published by
42140c5823bSmrgdnl the Free Software Foundation; either version 2 of the License, or
42240c5823bSmrgdnl (at your option) any later version.
42340c5823bSmrgdnl
42440c5823bSmrgdnl This program is distributed in the hope that it will be useful, but
42540c5823bSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
42640c5823bSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
42740c5823bSmrgdnl General Public License for more details.
42840c5823bSmrgdnl
42940c5823bSmrgdnl You should have received a copy of the GNU General Public License
43040c5823bSmrgdnl along with this program; if not, write to the Free Software
43140c5823bSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
43240c5823bSmrgdnl 02111-1307, USA.
43340c5823bSmrgdnl
43440c5823bSmrgdnl As a special exception to the GNU General Public License, if you
43540c5823bSmrgdnl distribute this file as part of a program that contains a
43640c5823bSmrgdnl configuration script generated by Autoconf, you may include it under
43740c5823bSmrgdnl the same distribution terms that you use for the rest of that
43840c5823bSmrgdnl program.
43940c5823bSmrg
44040c5823bSmrgdnl PKG_PREREQ(MIN-VERSION)
44140c5823bSmrgdnl -----------------------
44240c5823bSmrgdnl Since: 0.29
44340c5823bSmrgdnl
44440c5823bSmrgdnl Verify that the version of the pkg-config macros are at least
44540c5823bSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
44640c5823bSmrgdnl installed version of pkg-config, this checks the developer's version
44740c5823bSmrgdnl of pkg.m4 when generating configure.
44840c5823bSmrgdnl
44940c5823bSmrgdnl To ensure that this macro is defined, also add:
45040c5823bSmrgdnl m4_ifndef([PKG_PREREQ],
45140c5823bSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
45240c5823bSmrgdnl
45340c5823bSmrgdnl See the "Since" comment for each macro you use to see what version
45440c5823bSmrgdnl of the macros you require.
45540c5823bSmrgm4_defun([PKG_PREREQ],
45640c5823bSmrg[m4_define([PKG_MACROS_VERSION], [0.29.1])
45740c5823bSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
45840c5823bSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
45940c5823bSmrg])dnl PKG_PREREQ
46040c5823bSmrg
46140c5823bSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
46240c5823bSmrgdnl ----------------------------------
46340c5823bSmrgdnl Since: 0.16
46440c5823bSmrgdnl
46540c5823bSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
46640c5823bSmrgdnl first found in the path. Checks that the version of pkg-config found
46740c5823bSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
46840c5823bSmrgdnl used since that's the first version where most current features of
46940c5823bSmrgdnl pkg-config existed.
47040c5823bSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
47140c5823bSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
47240c5823bSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
47340c5823bSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
47440c5823bSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
47540c5823bSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
47640c5823bSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
477bbe1b32bSmrg
47840c5823bSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
47940c5823bSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
48040c5823bSmrgfi
48140c5823bSmrgif test -n "$PKG_CONFIG"; then
48240c5823bSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
48340c5823bSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
48440c5823bSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
48540c5823bSmrg		AC_MSG_RESULT([yes])
48640c5823bSmrg	else
48740c5823bSmrg		AC_MSG_RESULT([no])
48840c5823bSmrg		PKG_CONFIG=""
48940c5823bSmrg	fi
49040c5823bSmrgfi[]dnl
49140c5823bSmrg])dnl PKG_PROG_PKG_CONFIG
492bbe1b32bSmrg
49340c5823bSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
49440c5823bSmrgdnl -------------------------------------------------------------------
49540c5823bSmrgdnl Since: 0.18
49640c5823bSmrgdnl
49740c5823bSmrgdnl Check to see whether a particular set of modules exists. Similar to
49840c5823bSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
49940c5823bSmrgdnl
50040c5823bSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
50140c5823bSmrgdnl only at the first occurence in configure.ac, so if the first place
50240c5823bSmrgdnl it's called might be skipped (such as if it is within an "if", you
50340c5823bSmrgdnl have to call PKG_CHECK_EXISTS manually
50440c5823bSmrgAC_DEFUN([PKG_CHECK_EXISTS],
50540c5823bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
50640c5823bSmrgif test -n "$PKG_CONFIG" && \
50740c5823bSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
50840c5823bSmrg  m4_default([$2], [:])
50940c5823bSmrgm4_ifvaln([$3], [else
51040c5823bSmrg  $3])dnl
51140c5823bSmrgfi])
5128f34cbf9Ssnj
51340c5823bSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
51440c5823bSmrgdnl ---------------------------------------------
51540c5823bSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
51640c5823bSmrgdnl pkg_failed based on the result.
51740c5823bSmrgm4_define([_PKG_CONFIG],
51840c5823bSmrg[if test -n "$$1"; then
51940c5823bSmrg    pkg_cv_[]$1="$$1"
52040c5823bSmrg elif test -n "$PKG_CONFIG"; then
52140c5823bSmrg    PKG_CHECK_EXISTS([$3],
52240c5823bSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
52340c5823bSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
52440c5823bSmrg		     [pkg_failed=yes])
52540c5823bSmrg else
52640c5823bSmrg    pkg_failed=untried
52740c5823bSmrgfi[]dnl
52840c5823bSmrg])dnl _PKG_CONFIG
5298f34cbf9Ssnj
53040c5823bSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
53140c5823bSmrgdnl ---------------------------
53240c5823bSmrgdnl Internal check to see if pkg-config supports short errors.
53340c5823bSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
53440c5823bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
53540c5823bSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
53640c5823bSmrg        _pkg_short_errors_supported=yes
53740c5823bSmrgelse
53840c5823bSmrg        _pkg_short_errors_supported=no
53940c5823bSmrgfi[]dnl
54040c5823bSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
5418f34cbf9Ssnj
5428f34cbf9Ssnj
54340c5823bSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
54440c5823bSmrgdnl   [ACTION-IF-NOT-FOUND])
54540c5823bSmrgdnl --------------------------------------------------------------
54640c5823bSmrgdnl Since: 0.4.0
54740c5823bSmrgdnl
54840c5823bSmrgdnl Note that if there is a possibility the first call to
54940c5823bSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
55040c5823bSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
55140c5823bSmrgAC_DEFUN([PKG_CHECK_MODULES],
55240c5823bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
55340c5823bSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
55440c5823bSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
5558f34cbf9Ssnj
55640c5823bSmrgpkg_failed=no
55740c5823bSmrgAC_MSG_CHECKING([for $1])
5588f34cbf9Ssnj
55940c5823bSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
56040c5823bSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
5618f34cbf9Ssnj
56240c5823bSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
56340c5823bSmrgand $1[]_LIBS to avoid the need to call pkg-config.
56440c5823bSmrgSee the pkg-config man page for more details.])
56530f8ce46Smrg
56640c5823bSmrgif test $pkg_failed = yes; then
56740c5823bSmrg   	AC_MSG_RESULT([no])
56840c5823bSmrg        _PKG_SHORT_ERRORS_SUPPORTED
56940c5823bSmrg        if test $_pkg_short_errors_supported = yes; then
57040c5823bSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
57140c5823bSmrg        else 
57240c5823bSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
57340c5823bSmrg        fi
57440c5823bSmrg	# Put the nasty error message in config.log where it belongs
57540c5823bSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
576bbe1b32bSmrg
57740c5823bSmrg	m4_default([$4], [AC_MSG_ERROR(
57840c5823bSmrg[Package requirements ($2) were not met:
579bbe1b32bSmrg
58040c5823bSmrg$$1_PKG_ERRORS
581bbe1b32bSmrg
58240c5823bSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
58340c5823bSmrginstalled software in a non-standard prefix.
584bbe1b32bSmrg
58540c5823bSmrg_PKG_TEXT])[]dnl
58640c5823bSmrg        ])
58740c5823bSmrgelif test $pkg_failed = untried; then
58840c5823bSmrg     	AC_MSG_RESULT([no])
58940c5823bSmrg	m4_default([$4], [AC_MSG_FAILURE(
59040c5823bSmrg[The pkg-config script could not be found or is too old.  Make sure it
59140c5823bSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
59240c5823bSmrgpath to pkg-config.
593bbe1b32bSmrg
59440c5823bSmrg_PKG_TEXT
59540c5823bSmrg
59640c5823bSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
59740c5823bSmrg        ])
598bbe1b32bSmrgelse
59940c5823bSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
60040c5823bSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
60140c5823bSmrg        AC_MSG_RESULT([yes])
60240c5823bSmrg	$3
60340c5823bSmrgfi[]dnl
60440c5823bSmrg])dnl PKG_CHECK_MODULES
605bbe1b32bSmrg
606bbe1b32bSmrg
60740c5823bSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
60840c5823bSmrgdnl   [ACTION-IF-NOT-FOUND])
60940c5823bSmrgdnl ---------------------------------------------------------------------
61040c5823bSmrgdnl Since: 0.29
61140c5823bSmrgdnl
61240c5823bSmrgdnl Checks for existence of MODULES and gathers its build flags with
61340c5823bSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
61440c5823bSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
61540c5823bSmrgdnl
61640c5823bSmrgdnl Note that if there is a possibility the first call to
61740c5823bSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
61840c5823bSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
61940c5823bSmrgdnl configure.ac.
62040c5823bSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
62140c5823bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
62240c5823bSmrg_save_PKG_CONFIG=$PKG_CONFIG
62340c5823bSmrgPKG_CONFIG="$PKG_CONFIG --static"
62440c5823bSmrgPKG_CHECK_MODULES($@)
62540c5823bSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
62640c5823bSmrg])dnl PKG_CHECK_MODULES_STATIC
627bbe1b32bSmrg
628bbe1b32bSmrg
62940c5823bSmrgdnl PKG_INSTALLDIR([DIRECTORY])
63040c5823bSmrgdnl -------------------------
63140c5823bSmrgdnl Since: 0.27
63240c5823bSmrgdnl
63340c5823bSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
63440c5823bSmrgdnl should install pkg-config .pc files. By default the directory is
63540c5823bSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
63640c5823bSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
63740c5823bSmrgdnl parameter.
63840c5823bSmrgAC_DEFUN([PKG_INSTALLDIR],
63940c5823bSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
64040c5823bSmrgm4_pushdef([pkg_description],
64140c5823bSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
64240c5823bSmrgAC_ARG_WITH([pkgconfigdir],
64340c5823bSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
64440c5823bSmrg    [with_pkgconfigdir=]pkg_default)
64540c5823bSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
64640c5823bSmrgm4_popdef([pkg_default])
64740c5823bSmrgm4_popdef([pkg_description])
64840c5823bSmrg])dnl PKG_INSTALLDIR
64940c5823bSmrg
65040c5823bSmrg
65140c5823bSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
65240c5823bSmrgdnl --------------------------------
65340c5823bSmrgdnl Since: 0.27
65440c5823bSmrgdnl
65540c5823bSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
65640c5823bSmrgdnl module should install arch-independent pkg-config .pc files. By
65740c5823bSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
65840c5823bSmrgdnl changed by passing DIRECTORY. The user can override through the
65940c5823bSmrgdnl --with-noarch-pkgconfigdir parameter.
66040c5823bSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
66140c5823bSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
66240c5823bSmrgm4_pushdef([pkg_description],
66340c5823bSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
66440c5823bSmrgAC_ARG_WITH([noarch-pkgconfigdir],
66540c5823bSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
66640c5823bSmrg    [with_noarch_pkgconfigdir=]pkg_default)
66740c5823bSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
66840c5823bSmrgm4_popdef([pkg_default])
66940c5823bSmrgm4_popdef([pkg_description])
67040c5823bSmrg])dnl PKG_NOARCH_INSTALLDIR
67140c5823bSmrg
67240c5823bSmrg
67340c5823bSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
67440c5823bSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
67540c5823bSmrgdnl -------------------------------------------
67640c5823bSmrgdnl Since: 0.28
67740c5823bSmrgdnl
67840c5823bSmrgdnl Retrieves the value of the pkg-config variable for the given module.
67940c5823bSmrgAC_DEFUN([PKG_CHECK_VAR],
68040c5823bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
68140c5823bSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
682bbe1b32bSmrg
68340c5823bSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
68440c5823bSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
685bbe1b32bSmrg
68640c5823bSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
68740c5823bSmrg])dnl PKG_CHECK_VAR
688bbe1b32bSmrg
68940c5823bSmrgdnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
69040c5823bSmrgdnl   [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
69140c5823bSmrgdnl   [DESCRIPTION], [DEFAULT])
69240c5823bSmrgdnl ------------------------------------------
69340c5823bSmrgdnl
69440c5823bSmrgdnl Prepare a "--with-" configure option using the lowercase
69540c5823bSmrgdnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
69640c5823bSmrgdnl PKG_CHECK_MODULES in a single macro.
69740c5823bSmrgAC_DEFUN([PKG_WITH_MODULES],
69840c5823bSmrg[
69940c5823bSmrgm4_pushdef([with_arg], m4_tolower([$1]))
70040c5823bSmrg
70140c5823bSmrgm4_pushdef([description],
70240c5823bSmrg           [m4_default([$5], [build with ]with_arg[ support])])
70340c5823bSmrg
70440c5823bSmrgm4_pushdef([def_arg], [m4_default([$6], [auto])])
70540c5823bSmrgm4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
70640c5823bSmrgm4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
70740c5823bSmrg
70840c5823bSmrgm4_case(def_arg,
70940c5823bSmrg            [yes],[m4_pushdef([with_without], [--without-]with_arg)],
71040c5823bSmrg            [m4_pushdef([with_without],[--with-]with_arg)])
71140c5823bSmrg
71240c5823bSmrgAC_ARG_WITH(with_arg,
71340c5823bSmrg     AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
71440c5823bSmrg    [AS_TR_SH([with_]with_arg)=def_arg])
71540c5823bSmrg
71640c5823bSmrgAS_CASE([$AS_TR_SH([with_]with_arg)],
71740c5823bSmrg            [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
71840c5823bSmrg            [auto],[PKG_CHECK_MODULES([$1],[$2],
71940c5823bSmrg                                        [m4_n([def_action_if_found]) $3],
72040c5823bSmrg                                        [m4_n([def_action_if_not_found]) $4])])
72140c5823bSmrg
72240c5823bSmrgm4_popdef([with_arg])
72340c5823bSmrgm4_popdef([description])
72440c5823bSmrgm4_popdef([def_arg])
72540c5823bSmrg
72640c5823bSmrg])dnl PKG_WITH_MODULES
72740c5823bSmrg
72840c5823bSmrgdnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
72940c5823bSmrgdnl   [DESCRIPTION], [DEFAULT])
73040c5823bSmrgdnl -----------------------------------------------
73140c5823bSmrgdnl
73240c5823bSmrgdnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
73340c5823bSmrgdnl check._[VARIABLE-PREFIX] is exported as make variable.
73440c5823bSmrgAC_DEFUN([PKG_HAVE_WITH_MODULES],
73540c5823bSmrg[
73640c5823bSmrgPKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
73740c5823bSmrg
73840c5823bSmrgAM_CONDITIONAL([HAVE_][$1],
73940c5823bSmrg               [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
74040c5823bSmrg])dnl PKG_HAVE_WITH_MODULES
74140c5823bSmrg
74240c5823bSmrgdnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
74340c5823bSmrgdnl   [DESCRIPTION], [DEFAULT])
74440c5823bSmrgdnl ------------------------------------------------------
74540c5823bSmrgdnl
74640c5823bSmrgdnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
74740c5823bSmrgdnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
74840c5823bSmrgdnl and preprocessor variable.
74940c5823bSmrgAC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
75040c5823bSmrg[
75140c5823bSmrgPKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
75240c5823bSmrg
75340c5823bSmrgAS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
75440c5823bSmrg        [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
75540c5823bSmrg])dnl PKG_HAVE_DEFINE_WITH_MODULES
75640c5823bSmrg
75740c5823bSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
75840c5823bSmrgdnl
75940c5823bSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
76040c5823bSmrgdnl
76140c5823bSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
76240c5823bSmrgdnl copy of this software and associated documentation files (the "Software"),
76340c5823bSmrgdnl to deal in the Software without restriction, including without limitation
76440c5823bSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
76540c5823bSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
76640c5823bSmrgdnl Software is furnished to do so, subject to the following conditions:
76740c5823bSmrgdnl
76840c5823bSmrgdnl The above copyright notice and this permission notice (including the next
76940c5823bSmrgdnl paragraph) shall be included in all copies or substantial portions of the
77040c5823bSmrgdnl Software.
77140c5823bSmrgdnl
77240c5823bSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
77340c5823bSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
77440c5823bSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
77540c5823bSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
77640c5823bSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
77740c5823bSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
77840c5823bSmrgdnl DEALINGS IN THE SOFTWARE.
77940c5823bSmrg
78040c5823bSmrg# XORG_MACROS_VERSION(required-version)
78140c5823bSmrg# -------------------------------------
78240c5823bSmrg# Minimum version: 1.1.0
78340c5823bSmrg#
78440c5823bSmrg# If you're using a macro added in Version 1.1 or newer, include this in
78540c5823bSmrg# your configure.ac with the minimum required version, such as:
78640c5823bSmrg# XORG_MACROS_VERSION(1.1)
78740c5823bSmrg#
78840c5823bSmrg# To ensure that this macro is defined, also add:
78940c5823bSmrg# m4_ifndef([XORG_MACROS_VERSION],
79040c5823bSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
79140c5823bSmrg#
79240c5823bSmrg#
79340c5823bSmrg# See the "minimum version" comment for each macro you use to see what
79440c5823bSmrg# version you require.
79540c5823bSmrgm4_defun([XORG_MACROS_VERSION],[
79640c5823bSmrgm4_define([vers_have], [1.19.0])
79740c5823bSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
79840c5823bSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
79940c5823bSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
80040c5823bSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
80140c5823bSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
80240c5823bSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
80340c5823bSmrgm4_undefine([vers_have])
80440c5823bSmrgm4_undefine([maj_have])
80540c5823bSmrgm4_undefine([maj_needed])
80640c5823bSmrg]) # XORG_MACROS_VERSION
80740c5823bSmrg
80840c5823bSmrg# XORG_PROG_RAWCPP()
809bbe1b32bSmrg# ------------------
81040c5823bSmrg# Minimum version: 1.0.0
81140c5823bSmrg#
81240c5823bSmrg# Find cpp program and necessary flags for use in pre-processing text files
81340c5823bSmrg# such as man pages and config files
81440c5823bSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
81540c5823bSmrgAC_REQUIRE([AC_PROG_CPP])
81640c5823bSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
81740c5823bSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
81840c5823bSmrg
81940c5823bSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
82040c5823bSmrg# which is not the best choice for supporting other OS'es, but covers most
82140c5823bSmrg# of the ones we need for now.
82240c5823bSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
82340c5823bSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
82440c5823bSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
82540c5823bSmrg	AC_MSG_RESULT([no])
826bbe1b32bSmrgelse
82740c5823bSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
82840c5823bSmrg		RAWCPPFLAGS=-undef
82940c5823bSmrg		AC_MSG_RESULT([yes])
83040c5823bSmrg	# under Cygwin unix is still defined even with -undef
83140c5823bSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
83240c5823bSmrg		RAWCPPFLAGS="-undef -ansi"
83340c5823bSmrg		AC_MSG_RESULT([yes, with -ansi])
83440c5823bSmrg	else
83540c5823bSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
83640c5823bSmrg	fi
837bbe1b32bSmrgfi
83840c5823bSmrgrm -f conftest.$ac_ext
839bbe1b32bSmrg
84040c5823bSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
84140c5823bSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
84240c5823bSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
84340c5823bSmrg	AC_MSG_RESULT([no])
84440c5823bSmrgelse
84540c5823bSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
84640c5823bSmrg		TRADITIONALCPPFLAGS="-traditional"
84740c5823bSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
84840c5823bSmrg		AC_MSG_RESULT([yes])
84940c5823bSmrg	else
85040c5823bSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
85140c5823bSmrg	fi
85240c5823bSmrgfi
85340c5823bSmrgrm -f conftest.$ac_ext
85440c5823bSmrgAC_SUBST(RAWCPPFLAGS)
85540c5823bSmrgAC_SUBST(TRADITIONALCPPFLAGS)
85640c5823bSmrg]) # XORG_PROG_RAWCPP
857bbe1b32bSmrg
85840c5823bSmrg# XORG_MANPAGE_SECTIONS()
85940c5823bSmrg# -----------------------
86040c5823bSmrg# Minimum version: 1.0.0
861bbe1b32bSmrg#
86240c5823bSmrg# Determine which sections man pages go in for the different man page types
86340c5823bSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
86440c5823bSmrg# Not sure if there's any better way than just hardcoding by OS name.
86540c5823bSmrg# Override default settings by setting environment variables
86640c5823bSmrg# Added MAN_SUBSTS in version 1.8
86740c5823bSmrg# Added AC_PROG_SED in version 1.8
868bbe1b32bSmrg
86940c5823bSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
87040c5823bSmrgAC_REQUIRE([AC_CANONICAL_HOST])
87140c5823bSmrgAC_REQUIRE([AC_PROG_SED])
872bbe1b32bSmrg
87340c5823bSmrgif test x$APP_MAN_SUFFIX = x    ; then
87440c5823bSmrg    APP_MAN_SUFFIX=1
87540c5823bSmrgfi
87640c5823bSmrgif test x$APP_MAN_DIR = x    ; then
87740c5823bSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
87840c5823bSmrgfi
879bbe1b32bSmrg
88040c5823bSmrgif test x$LIB_MAN_SUFFIX = x    ; then
88140c5823bSmrg    LIB_MAN_SUFFIX=3
88240c5823bSmrgfi
88340c5823bSmrgif test x$LIB_MAN_DIR = x    ; then
88440c5823bSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
88540c5823bSmrgfi
886bbe1b32bSmrg
88740c5823bSmrgif test x$FILE_MAN_SUFFIX = x    ; then
88840c5823bSmrg    case $host_os in
88940c5823bSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
89040c5823bSmrg	*)		FILE_MAN_SUFFIX=5  ;;
89140c5823bSmrg    esac
89240c5823bSmrgfi
89340c5823bSmrgif test x$FILE_MAN_DIR = x    ; then
89440c5823bSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
89540c5823bSmrgfi
896bbe1b32bSmrg
89740c5823bSmrgif test x$MISC_MAN_SUFFIX = x    ; then
89840c5823bSmrg    case $host_os in
89940c5823bSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
90040c5823bSmrg	*)		MISC_MAN_SUFFIX=7  ;;
90140c5823bSmrg    esac
90240c5823bSmrgfi
90340c5823bSmrgif test x$MISC_MAN_DIR = x    ; then
90440c5823bSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
90540c5823bSmrgfi
9068f34cbf9Ssnj
90740c5823bSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
90840c5823bSmrg    case $host_os in
90940c5823bSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
91040c5823bSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
91140c5823bSmrg    esac
91240c5823bSmrgfi
91340c5823bSmrgif test x$DRIVER_MAN_DIR = x    ; then
91440c5823bSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
9158f34cbf9Ssnjfi
916bbe1b32bSmrg
91740c5823bSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
91840c5823bSmrg    case $host_os in
91940c5823bSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
92040c5823bSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
92140c5823bSmrg    esac
92240c5823bSmrgfi
92340c5823bSmrgif test x$ADMIN_MAN_DIR = x    ; then
92440c5823bSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
92540c5823bSmrgfi
9268f34cbf9Ssnj
927bbe1b32bSmrg
92840c5823bSmrgAC_SUBST([APP_MAN_SUFFIX])
92940c5823bSmrgAC_SUBST([LIB_MAN_SUFFIX])
93040c5823bSmrgAC_SUBST([FILE_MAN_SUFFIX])
93140c5823bSmrgAC_SUBST([MISC_MAN_SUFFIX])
93240c5823bSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
93340c5823bSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
93440c5823bSmrgAC_SUBST([APP_MAN_DIR])
93540c5823bSmrgAC_SUBST([LIB_MAN_DIR])
93640c5823bSmrgAC_SUBST([FILE_MAN_DIR])
93740c5823bSmrgAC_SUBST([MISC_MAN_DIR])
93840c5823bSmrgAC_SUBST([DRIVER_MAN_DIR])
93940c5823bSmrgAC_SUBST([ADMIN_MAN_DIR])
9408f34cbf9Ssnj
94140c5823bSmrgXORG_MAN_PAGE="X Version 11"
94240c5823bSmrgAC_SUBST([XORG_MAN_PAGE])
94340c5823bSmrgMAN_SUBSTS="\
94440c5823bSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
94540c5823bSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
94640c5823bSmrg	-e 's|__xservername__|Xorg|g' \
94740c5823bSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
94840c5823bSmrg	-e 's|__projectroot__|\$(prefix)|g' \
94940c5823bSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
95040c5823bSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
95140c5823bSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
95240c5823bSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
95340c5823bSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
95440c5823bSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
95540c5823bSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
95640c5823bSmrgAC_SUBST([MAN_SUBSTS])
957bbe1b32bSmrg
95840c5823bSmrg]) # XORG_MANPAGE_SECTIONS
95930f8ce46Smrg
96040c5823bSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
96140c5823bSmrg# ------------------------
96240c5823bSmrg# Minimum version: 1.7.0
96340c5823bSmrg#
96440c5823bSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
96540c5823bSmrg# provided by xorg-sgml-doctools, if installed.
96640c5823bSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
96740c5823bSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
96840c5823bSmrgXORG_SGML_PATH=
96940c5823bSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
97040c5823bSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
97140c5823bSmrg    [m4_ifval([$1],[:],
97240c5823bSmrg        [if test x"$cross_compiling" != x"yes" ; then
97340c5823bSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
97440c5823bSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
97540c5823bSmrg         fi])
97640c5823bSmrg    ])
9778f34cbf9Ssnj
97840c5823bSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
97940c5823bSmrg# the path and the name of the doc stylesheet
98040c5823bSmrgif test "x$XORG_SGML_PATH" != "x" ; then
98140c5823bSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
98240c5823bSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
98340c5823bSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
984bbe1b32bSmrgelse
98540c5823bSmrg   AC_MSG_RESULT([no])
9868f34cbf9Ssnjfi
987bbe1b32bSmrg
98840c5823bSmrgAC_SUBST(XORG_SGML_PATH)
98940c5823bSmrgAC_SUBST(STYLESHEET_SRCDIR)
99040c5823bSmrgAC_SUBST(XSL_STYLESHEET)
99140c5823bSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
99240c5823bSmrg]) # XORG_CHECK_SGML_DOCTOOLS
99340c5823bSmrg
99440c5823bSmrg# XORG_CHECK_LINUXDOC
99540c5823bSmrg# -------------------
99640c5823bSmrg# Minimum version: 1.0.0
99730f8ce46Smrg#
99840c5823bSmrg# Defines the variable MAKE_TEXT if the necessary tools and
99940c5823bSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
100040c5823bSmrg# Whether or not the necessary tools and files are found can be checked
100140c5823bSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
100240c5823bSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
100340c5823bSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
100440c5823bSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
100530f8ce46Smrg
100640c5823bSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
100740c5823bSmrg
100840c5823bSmrgAC_MSG_CHECKING([whether to build documentation])
100940c5823bSmrg
101040c5823bSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
101140c5823bSmrg   BUILDDOC=yes
10128f34cbf9Ssnjelse
101340c5823bSmrg   BUILDDOC=no
10148f34cbf9Ssnjfi
101530f8ce46Smrg
101640c5823bSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1017bbe1b32bSmrg
101840c5823bSmrgAC_MSG_RESULT([$BUILDDOC])
101940c5823bSmrg
102040c5823bSmrgAC_MSG_CHECKING([whether to build pdf documentation])
102140c5823bSmrg
102240c5823bSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
102340c5823bSmrg   BUILDPDFDOC=yes
102440c5823bSmrgelse
102540c5823bSmrg   BUILDPDFDOC=no
1026bbe1b32bSmrgfi
1027bbe1b32bSmrg
102840c5823bSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
102930f8ce46Smrg
103040c5823bSmrgAC_MSG_RESULT([$BUILDPDFDOC])
103130f8ce46Smrg
103240c5823bSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
103340c5823bSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
103440c5823bSmrgMAKE_PDF="$PS2PDF"
103540c5823bSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
103630f8ce46Smrg
103740c5823bSmrgAC_SUBST(MAKE_TEXT)
103840c5823bSmrgAC_SUBST(MAKE_PS)
103940c5823bSmrgAC_SUBST(MAKE_PDF)
104040c5823bSmrgAC_SUBST(MAKE_HTML)
104140c5823bSmrg]) # XORG_CHECK_LINUXDOC
104230f8ce46Smrg
104340c5823bSmrg# XORG_CHECK_DOCBOOK
104440c5823bSmrg# -------------------
104540c5823bSmrg# Minimum version: 1.0.0
10468f34cbf9Ssnj#
104740c5823bSmrg# Checks for the ability to build output formats from SGML DocBook source.
104840c5823bSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
104940c5823bSmrg# indicates whether the necessary tools and files are found and, if set,
105040c5823bSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
105140c5823bSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
105240c5823bSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
105330f8ce46Smrg
105440c5823bSmrgBUILDTXTDOC=no
105540c5823bSmrgBUILDPDFDOC=no
105640c5823bSmrgBUILDPSDOC=no
105740c5823bSmrgBUILDHTMLDOC=no
10588f34cbf9Ssnj
105940c5823bSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
106040c5823bSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
106140c5823bSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
106240c5823bSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
106330f8ce46Smrg
106440c5823bSmrgAC_MSG_CHECKING([whether to build text documentation])
106540c5823bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
106640c5823bSmrg   test x$BUILD_TXTDOC != xno; then
106740c5823bSmrg	BUILDTXTDOC=yes
106834f90d55Smrgfi
106940c5823bSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
107040c5823bSmrgAC_MSG_RESULT([$BUILDTXTDOC])
107134f90d55Smrg
107240c5823bSmrgAC_MSG_CHECKING([whether to build PDF documentation])
107340c5823bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
107440c5823bSmrg   test x$BUILD_PDFDOC != xno; then
107540c5823bSmrg	BUILDPDFDOC=yes
107640c5823bSmrgfi
107740c5823bSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
107840c5823bSmrgAC_MSG_RESULT([$BUILDPDFDOC])
107934f90d55Smrg
108040c5823bSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
108140c5823bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
108240c5823bSmrg   test x$BUILD_PSDOC != xno; then
108340c5823bSmrg	BUILDPSDOC=yes
108440c5823bSmrgfi
108540c5823bSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
108640c5823bSmrgAC_MSG_RESULT([$BUILDPSDOC])
108734f90d55Smrg
108840c5823bSmrgAC_MSG_CHECKING([whether to build HTML documentation])
108940c5823bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
109040c5823bSmrg   test x$BUILD_HTMLDOC != xno; then
109140c5823bSmrg	BUILDHTMLDOC=yes
109240c5823bSmrgfi
109340c5823bSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
109440c5823bSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
109534f90d55Smrg
109640c5823bSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
109740c5823bSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
109840c5823bSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
109940c5823bSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
110034f90d55Smrg
110140c5823bSmrgAC_SUBST(MAKE_TEXT)
110240c5823bSmrgAC_SUBST(MAKE_PS)
110340c5823bSmrgAC_SUBST(MAKE_PDF)
110440c5823bSmrgAC_SUBST(MAKE_HTML)
110540c5823bSmrg]) # XORG_CHECK_DOCBOOK
110634f90d55Smrg
110740c5823bSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
110840c5823bSmrg# ----------------
110940c5823bSmrg# Minimum version: 1.5.0
111040c5823bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
111134f90d55Smrg#
111240c5823bSmrg# Documentation tools are not always available on all platforms and sometimes
111340c5823bSmrg# not at the appropriate level. This macro enables a module to test for the
111440c5823bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
111540c5823bSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
111640c5823bSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
111740c5823bSmrg# --with-xmlto assumes 'auto'.
111834f90d55Smrg#
111940c5823bSmrg# Interface to module:
112040c5823bSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
112140c5823bSmrg# XMLTO:	returns the path of the xmlto program found
112240c5823bSmrg#		returns the path set by the user in the environment
112340c5823bSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
112440c5823bSmrg#		'no' user instructs the module not to use xmlto
112534f90d55Smrg#
112640c5823bSmrg# Added in version 1.10.0
112740c5823bSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
112840c5823bSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
112934f90d55Smrg#
113040c5823bSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
113140c5823bSmrg#
113240c5823bSmrgAC_DEFUN([XORG_WITH_XMLTO],[
113340c5823bSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
113440c5823bSmrgm4_define([_defopt], m4_default([$2], [auto]))
113540c5823bSmrgAC_ARG_WITH(xmlto,
113640c5823bSmrg	AS_HELP_STRING([--with-xmlto],
113740c5823bSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
113840c5823bSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
113940c5823bSmrgm4_undefine([_defopt])
114034f90d55Smrg
114140c5823bSmrgif test "x$use_xmlto" = x"auto"; then
114240c5823bSmrg   AC_PATH_PROG([XMLTO], [xmlto])
114340c5823bSmrg   if test "x$XMLTO" = "x"; then
114440c5823bSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
114540c5823bSmrg	have_xmlto=no
114640c5823bSmrg   else
114740c5823bSmrg        have_xmlto=yes
114840c5823bSmrg   fi
114940c5823bSmrgelif test "x$use_xmlto" = x"yes" ; then
115040c5823bSmrg   AC_PATH_PROG([XMLTO], [xmlto])
115140c5823bSmrg   if test "x$XMLTO" = "x"; then
115240c5823bSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
115340c5823bSmrg   fi
115440c5823bSmrg   have_xmlto=yes
115540c5823bSmrgelif test "x$use_xmlto" = x"no" ; then
115640c5823bSmrg   if test "x$XMLTO" != "x"; then
115740c5823bSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
115840c5823bSmrg   fi
115940c5823bSmrg   have_xmlto=no
116040c5823bSmrgelse
116140c5823bSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
116240c5823bSmrgfi
116334f90d55Smrg
116440c5823bSmrg# Test for a minimum version of xmlto, if provided.
116540c5823bSmrgm4_ifval([$1],
116640c5823bSmrg[if test "$have_xmlto" = yes; then
116740c5823bSmrg    # scrape the xmlto version
116840c5823bSmrg    AC_MSG_CHECKING([the xmlto version])
116940c5823bSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
117040c5823bSmrg    AC_MSG_RESULT([$xmlto_version])
117140c5823bSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
117240c5823bSmrg        [if test "x$use_xmlto" = xauto; then
117340c5823bSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
117440c5823bSmrg            have_xmlto=no
117540c5823bSmrg        else
117640c5823bSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
117740c5823bSmrg        fi])
117840c5823bSmrgfi])
117934f90d55Smrg
118040c5823bSmrg# Test for the ability of xmlto to generate a text target
118140c5823bSmrghave_xmlto_text=no
118240c5823bSmrgcat > conftest.xml << "EOF"
118340c5823bSmrgEOF
118440c5823bSmrgAS_IF([test "$have_xmlto" = yes],
118540c5823bSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
118640c5823bSmrg             [have_xmlto_text=yes],
118740c5823bSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
118840c5823bSmrgrm -f conftest.xml
118940c5823bSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
119040c5823bSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
119140c5823bSmrg]) # XORG_WITH_XMLTO
119234f90d55Smrg
119340c5823bSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
119440c5823bSmrg# --------------------------------------------
119540c5823bSmrg# Minimum version: 1.12.0
119640c5823bSmrg# Minimum version for optional DEFAULT argument: 1.12.0
119740c5823bSmrg#
119840c5823bSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
119940c5823bSmrg# XML-based language used for the transformation of XML documents.
120040c5823bSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
120140c5823bSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
120240c5823bSmrg# The XSLT processor is often used as a standalone tool for transformations.
120340c5823bSmrg# It should not be assumed that this tool is used only to work with documnetation.
120440c5823bSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
120540c5823bSmrg#
120640c5823bSmrg# Interface to module:
120740c5823bSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
120840c5823bSmrg# XSLTPROC:	 returns the path of the xsltproc program found
120940c5823bSmrg#		 returns the path set by the user in the environment
121040c5823bSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
121140c5823bSmrg#		  'no' user instructs the module not to use xsltproc
121240c5823bSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
121340c5823bSmrg#
121440c5823bSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
121540c5823bSmrg#
121640c5823bSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
121740c5823bSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
121840c5823bSmrg# Preserves the interface, should it be implemented later
121940c5823bSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
122040c5823bSmrgm4_define([_defopt], m4_default([$2], [auto]))
122140c5823bSmrgAC_ARG_WITH(xsltproc,
122240c5823bSmrg	AS_HELP_STRING([--with-xsltproc],
122340c5823bSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
122440c5823bSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
122540c5823bSmrgm4_undefine([_defopt])
122634f90d55Smrg
122740c5823bSmrgif test "x$use_xsltproc" = x"auto"; then
122840c5823bSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
122940c5823bSmrg   if test "x$XSLTPROC" = "x"; then
123040c5823bSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
123140c5823bSmrg	have_xsltproc=no
123240c5823bSmrg   else
123340c5823bSmrg        have_xsltproc=yes
123440c5823bSmrg   fi
123540c5823bSmrgelif test "x$use_xsltproc" = x"yes" ; then
123640c5823bSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
123740c5823bSmrg   if test "x$XSLTPROC" = "x"; then
123840c5823bSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
123940c5823bSmrg   fi
124040c5823bSmrg   have_xsltproc=yes
124140c5823bSmrgelif test "x$use_xsltproc" = x"no" ; then
124240c5823bSmrg   if test "x$XSLTPROC" != "x"; then
124340c5823bSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
124440c5823bSmrg   fi
124540c5823bSmrg   have_xsltproc=no
124634f90d55Smrgelse
124740c5823bSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
124840c5823bSmrgfi
124934f90d55Smrg
125040c5823bSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
125140c5823bSmrg]) # XORG_WITH_XSLTPROC
125230f8ce46Smrg
125340c5823bSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
125440c5823bSmrg# ----------------------------------------
125540c5823bSmrg# Minimum version: 1.15.0
125630f8ce46Smrg#
125740c5823bSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
125840c5823bSmrg# scanning arbitrary text files, extracting information from those text files,
125940c5823bSmrg# and printing reports based on that information.
126030f8ce46Smrg#
126140c5823bSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
126230f8ce46Smrg#
126340c5823bSmrg# Interface to module:
126440c5823bSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
126540c5823bSmrg# PERL:	     returns the path of the perl program found
126640c5823bSmrg#	     returns the path set by the user in the environment
126740c5823bSmrg# --with-perl: 'yes' user instructs the module to use perl
126840c5823bSmrg#	       'no' user instructs the module not to use perl
126940c5823bSmrg# have_perl: returns yes if perl found in PATH or no
127030f8ce46Smrg#
127140c5823bSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
127240c5823bSmrg#
127340c5823bSmrgAC_DEFUN([XORG_WITH_PERL],[
127440c5823bSmrgAC_ARG_VAR([PERL], [Path to perl command])
127540c5823bSmrg# Preserves the interface, should it be implemented later
127640c5823bSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
127740c5823bSmrgm4_define([_defopt], m4_default([$2], [auto]))
127840c5823bSmrgAC_ARG_WITH(perl,
127940c5823bSmrg	AS_HELP_STRING([--with-perl],
128040c5823bSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
128140c5823bSmrg	   [use_perl=$withval], [use_perl=]_defopt)
128240c5823bSmrgm4_undefine([_defopt])
128330f8ce46Smrg
128440c5823bSmrgif test "x$use_perl" = x"auto"; then
128540c5823bSmrg   AC_PATH_PROG([PERL], [perl])
128640c5823bSmrg   if test "x$PERL" = "x"; then
128740c5823bSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
128840c5823bSmrg	have_perl=no
128940c5823bSmrg   else
129040c5823bSmrg        have_perl=yes
129140c5823bSmrg   fi
129240c5823bSmrgelif test "x$use_perl" = x"yes" ; then
129340c5823bSmrg   AC_PATH_PROG([PERL], [perl])
129440c5823bSmrg   if test "x$PERL" = "x"; then
129540c5823bSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
129640c5823bSmrg   fi
129740c5823bSmrg   have_perl=yes
129840c5823bSmrgelif test "x$use_perl" = x"no" ; then
129940c5823bSmrg   if test "x$PERL" != "x"; then
130040c5823bSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
130140c5823bSmrg   fi
130240c5823bSmrg   have_perl=no
130340c5823bSmrgelse
130440c5823bSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
130540c5823bSmrgfi
130630f8ce46Smrg
130740c5823bSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
130840c5823bSmrg]) # XORG_WITH_PERL
130930f8ce46Smrg
131040c5823bSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
131140c5823bSmrg# ----------------
131240c5823bSmrg# Minimum version: 1.5.0
131340c5823bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
131430f8ce46Smrg#
131540c5823bSmrg# Documentation tools are not always available on all platforms and sometimes
131640c5823bSmrg# not at the appropriate level. This macro enables a module to test for the
131740c5823bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
131840c5823bSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
131940c5823bSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
132040c5823bSmrg# --with-asciidoc assumes 'auto'.
132130f8ce46Smrg#
132240c5823bSmrg# Interface to module:
132340c5823bSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
132440c5823bSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
132540c5823bSmrg#		 returns the path set by the user in the environment
132640c5823bSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
132740c5823bSmrg#		  'no' user instructs the module not to use asciidoc
132830f8ce46Smrg#
132940c5823bSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
133030f8ce46Smrg#
133140c5823bSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
133240c5823bSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
133340c5823bSmrgm4_define([_defopt], m4_default([$2], [auto]))
133440c5823bSmrgAC_ARG_WITH(asciidoc,
133540c5823bSmrg	AS_HELP_STRING([--with-asciidoc],
133640c5823bSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
133740c5823bSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
133840c5823bSmrgm4_undefine([_defopt])
133930f8ce46Smrg
134040c5823bSmrgif test "x$use_asciidoc" = x"auto"; then
134140c5823bSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
134240c5823bSmrg   if test "x$ASCIIDOC" = "x"; then
134340c5823bSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
134440c5823bSmrg	have_asciidoc=no
134540c5823bSmrg   else
134640c5823bSmrg        have_asciidoc=yes
134740c5823bSmrg   fi
134840c5823bSmrgelif test "x$use_asciidoc" = x"yes" ; then
134940c5823bSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
135040c5823bSmrg   if test "x$ASCIIDOC" = "x"; then
135140c5823bSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
135240c5823bSmrg   fi
135340c5823bSmrg   have_asciidoc=yes
135440c5823bSmrgelif test "x$use_asciidoc" = x"no" ; then
135540c5823bSmrg   if test "x$ASCIIDOC" != "x"; then
135640c5823bSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
135740c5823bSmrg   fi
135840c5823bSmrg   have_asciidoc=no
135940c5823bSmrgelse
136040c5823bSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
136140c5823bSmrgfi
136240c5823bSmrgm4_ifval([$1],
136340c5823bSmrg[if test "$have_asciidoc" = yes; then
136440c5823bSmrg    # scrape the asciidoc version
136540c5823bSmrg    AC_MSG_CHECKING([the asciidoc version])
136640c5823bSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
136740c5823bSmrg    AC_MSG_RESULT([$asciidoc_version])
136840c5823bSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
136940c5823bSmrg        [if test "x$use_asciidoc" = xauto; then
137040c5823bSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
137140c5823bSmrg            have_asciidoc=no
137240c5823bSmrg        else
137340c5823bSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
137440c5823bSmrg        fi])
137540c5823bSmrgfi])
137640c5823bSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
137740c5823bSmrg]) # XORG_WITH_ASCIIDOC
137840c5823bSmrg
137940c5823bSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
138040c5823bSmrg# -------------------------------------------
138140c5823bSmrg# Minimum version: 1.5.0
138240c5823bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
138340c5823bSmrg# Minimum version for optional DOT checking: 1.18.0
138434f90d55Smrg#
138540c5823bSmrg# Documentation tools are not always available on all platforms and sometimes
138640c5823bSmrg# not at the appropriate level. This macro enables a module to test for the
138740c5823bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
138840c5823bSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
138940c5823bSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
139040c5823bSmrg# --with-doxygen assumes 'auto'.
139134f90d55Smrg#
139240c5823bSmrg# Interface to module:
139340c5823bSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
139440c5823bSmrg# DOXYGEN:	 returns the path of the doxygen program found
139540c5823bSmrg#		 returns the path set by the user in the environment
139640c5823bSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
139740c5823bSmrg#		  'no' user instructs the module not to use doxygen
139834f90d55Smrg#
139940c5823bSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
140034f90d55Smrg#
140140c5823bSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
140240c5823bSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
140340c5823bSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
140440c5823bSmrgm4_define([_defopt], m4_default([$2], [auto]))
140540c5823bSmrgAC_ARG_WITH(doxygen,
140640c5823bSmrg	AS_HELP_STRING([--with-doxygen],
140740c5823bSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
140840c5823bSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
140940c5823bSmrgm4_undefine([_defopt])
141034f90d55Smrg
141140c5823bSmrgif test "x$use_doxygen" = x"auto"; then
141240c5823bSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
141340c5823bSmrg   if test "x$DOXYGEN" = "x"; then
141440c5823bSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
141540c5823bSmrg	have_doxygen=no
141640c5823bSmrg   else
141740c5823bSmrg        have_doxygen=yes
141840c5823bSmrg   fi
141940c5823bSmrgelif test "x$use_doxygen" = x"yes" ; then
142040c5823bSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
142140c5823bSmrg   if test "x$DOXYGEN" = "x"; then
142240c5823bSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
142340c5823bSmrg   fi
142440c5823bSmrg   have_doxygen=yes
142540c5823bSmrgelif test "x$use_doxygen" = x"no" ; then
142640c5823bSmrg   if test "x$DOXYGEN" != "x"; then
142740c5823bSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
142840c5823bSmrg   fi
142940c5823bSmrg   have_doxygen=no
143040c5823bSmrgelse
143140c5823bSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
143240c5823bSmrgfi
143340c5823bSmrgm4_ifval([$1],
143440c5823bSmrg[if test "$have_doxygen" = yes; then
143540c5823bSmrg    # scrape the doxygen version
143640c5823bSmrg    AC_MSG_CHECKING([the doxygen version])
143740c5823bSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
143840c5823bSmrg    AC_MSG_RESULT([$doxygen_version])
143940c5823bSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
144040c5823bSmrg        [if test "x$use_doxygen" = xauto; then
144140c5823bSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
144240c5823bSmrg            have_doxygen=no
144340c5823bSmrg        else
144440c5823bSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
144540c5823bSmrg        fi])
144640c5823bSmrgfi])
144730f8ce46Smrg
144840c5823bSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
144940c5823bSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
145040c5823bSmrgdnl 	HAVE_DOT = @HAVE_DOT@
145140c5823bSmrgHAVE_DOT=no
145240c5823bSmrgif test "x$have_doxygen" = "xyes"; then
145340c5823bSmrg  AC_PATH_PROG([DOT], [dot])
145440c5823bSmrg    if test "x$DOT" != "x"; then
145540c5823bSmrg      HAVE_DOT=yes
145640c5823bSmrg    fi
145740c5823bSmrgfi
145830f8ce46Smrg
145940c5823bSmrgAC_SUBST([HAVE_DOT])
146040c5823bSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
146140c5823bSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
146240c5823bSmrg]) # XORG_WITH_DOXYGEN
146330f8ce46Smrg
146440c5823bSmrg# XORG_WITH_GROFF([DEFAULT])
146540c5823bSmrg# ----------------
146640c5823bSmrg# Minimum version: 1.6.0
146740c5823bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
146830f8ce46Smrg#
146940c5823bSmrg# Documentation tools are not always available on all platforms and sometimes
147040c5823bSmrg# not at the appropriate level. This macro enables a module to test for the
147140c5823bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
147240c5823bSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
147340c5823bSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
147440c5823bSmrg# --with-groff assumes 'auto'.
1475bbe1b32bSmrg#
147640c5823bSmrg# Interface to module:
147740c5823bSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
147840c5823bSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
147940c5823bSmrg# HAVE_GROFF_MS: the -ms macros package
148040c5823bSmrg# GROFF:	 returns the path of the groff program found
148140c5823bSmrg#		 returns the path set by the user in the environment
148240c5823bSmrg# --with-groff:	 'yes' user instructs the module to use groff
148340c5823bSmrg#		 'no' user instructs the module not to use groff
148430f8ce46Smrg#
148540c5823bSmrg# Added in version 1.9.0:
148640c5823bSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
148740c5823bSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
148840c5823bSmrg#		   psselect from the psutils package.
148940c5823bSmrg#		   the ghostcript package. Refer to the grohtml man pages
1490bbe1b32bSmrg#
149140c5823bSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
1492bbe1b32bSmrg#
149340c5823bSmrg# OS and distros often splits groff in a basic and full package, the former
149440c5823bSmrg# having the groff program and the later having devices, fonts and macros
149540c5823bSmrg# Checking for the groff executable is not enough.
149640c5823bSmrg#
149740c5823bSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
149840c5823bSmrg# unset HAVE_GROFF or GROFF env variables.
149940c5823bSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
150040c5823bSmrg#
150140c5823bSmrgAC_DEFUN([XORG_WITH_GROFF],[
150240c5823bSmrgAC_ARG_VAR([GROFF], [Path to groff command])
150340c5823bSmrgm4_define([_defopt], m4_default([$1], [auto]))
150440c5823bSmrgAC_ARG_WITH(groff,
150540c5823bSmrg	AS_HELP_STRING([--with-groff],
150640c5823bSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
150740c5823bSmrg	   [use_groff=$withval], [use_groff=]_defopt)
150840c5823bSmrgm4_undefine([_defopt])
150930f8ce46Smrg
151040c5823bSmrgif test "x$use_groff" = x"auto"; then
151140c5823bSmrg   AC_PATH_PROG([GROFF], [groff])
151240c5823bSmrg   if test "x$GROFF" = "x"; then
151340c5823bSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
151440c5823bSmrg	have_groff=no
151540c5823bSmrg   else
151640c5823bSmrg        have_groff=yes
151740c5823bSmrg   fi
151840c5823bSmrgelif test "x$use_groff" = x"yes" ; then
151940c5823bSmrg   AC_PATH_PROG([GROFF], [groff])
152040c5823bSmrg   if test "x$GROFF" = "x"; then
152140c5823bSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
152240c5823bSmrg   fi
152340c5823bSmrg   have_groff=yes
152440c5823bSmrgelif test "x$use_groff" = x"no" ; then
152540c5823bSmrg   if test "x$GROFF" != "x"; then
152640c5823bSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
152740c5823bSmrg   fi
152840c5823bSmrg   have_groff=no
152940c5823bSmrgelse
153040c5823bSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
153140c5823bSmrgfi
153230f8ce46Smrg
153340c5823bSmrg# We have groff, test for the presence of the macro packages
153440c5823bSmrgif test "x$have_groff" = x"yes"; then
153540c5823bSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
153640c5823bSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
153740c5823bSmrg        groff_ms_works=yes
153840c5823bSmrg    else
153940c5823bSmrg        groff_ms_works=no
154040c5823bSmrg    fi
154140c5823bSmrg    AC_MSG_RESULT([$groff_ms_works])
154240c5823bSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
154340c5823bSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
154440c5823bSmrg        groff_mm_works=yes
154540c5823bSmrg    else
154640c5823bSmrg        groff_mm_works=no
154740c5823bSmrg    fi
154840c5823bSmrg    AC_MSG_RESULT([$groff_mm_works])
154940c5823bSmrgfi
155030f8ce46Smrg
155140c5823bSmrg# We have groff, test for HTML dependencies, one command per package
155240c5823bSmrgif test "x$have_groff" = x"yes"; then
155340c5823bSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
155440c5823bSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
155540c5823bSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
155640c5823bSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
155740c5823bSmrg      have_groff_html=yes
155840c5823bSmrg   else
155940c5823bSmrg      have_groff_html=no
156040c5823bSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
156140c5823bSmrg   fi
156240c5823bSmrgfi
156330f8ce46Smrg
156440c5823bSmrg# Set Automake conditionals for Makefiles
156540c5823bSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
156640c5823bSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
156740c5823bSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
156840c5823bSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
156940c5823bSmrg]) # XORG_WITH_GROFF
1570bbe1b32bSmrg
157140c5823bSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
157230f8ce46Smrg# ---------------------------------------
157340c5823bSmrg# Minimum version: 1.6.0
157440c5823bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
157540c5823bSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
157630f8ce46Smrg#
157740c5823bSmrg# Documentation tools are not always available on all platforms and sometimes
157840c5823bSmrg# not at the appropriate level. This macro enables a module to test for the
157940c5823bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
158040c5823bSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
158140c5823bSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
158240c5823bSmrg# --with-fop assumes 'auto'.
158340c5823bSmrg#
158440c5823bSmrg# Interface to module:
158540c5823bSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
158640c5823bSmrg# FOP:	 	returns the path of the fop program found
158740c5823bSmrg#		returns the path set by the user in the environment
158840c5823bSmrg# --with-fop: 	'yes' user instructs the module to use fop
158940c5823bSmrg#		'no' user instructs the module not to use fop
159040c5823bSmrg#
159140c5823bSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
159240c5823bSmrg#
159340c5823bSmrgAC_DEFUN([XORG_WITH_FOP],[
159440c5823bSmrgAC_ARG_VAR([FOP], [Path to fop command])
159540c5823bSmrgm4_define([_defopt], m4_default([$2], [auto]))
159640c5823bSmrgAC_ARG_WITH(fop,
159740c5823bSmrg	AS_HELP_STRING([--with-fop],
159840c5823bSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
159940c5823bSmrg	   [use_fop=$withval], [use_fop=]_defopt)
160040c5823bSmrgm4_undefine([_defopt])
1601bbe1b32bSmrg
160240c5823bSmrgif test "x$use_fop" = x"auto"; then
160340c5823bSmrg   AC_PATH_PROG([FOP], [fop])
160440c5823bSmrg   if test "x$FOP" = "x"; then
160540c5823bSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
160640c5823bSmrg	have_fop=no
160740c5823bSmrg   else
160840c5823bSmrg        have_fop=yes
160940c5823bSmrg   fi
161040c5823bSmrgelif test "x$use_fop" = x"yes" ; then
161140c5823bSmrg   AC_PATH_PROG([FOP], [fop])
161240c5823bSmrg   if test "x$FOP" = "x"; then
161340c5823bSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
161440c5823bSmrg   fi
161540c5823bSmrg   have_fop=yes
161640c5823bSmrgelif test "x$use_fop" = x"no" ; then
161740c5823bSmrg   if test "x$FOP" != "x"; then
161840c5823bSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
161940c5823bSmrg   fi
162040c5823bSmrg   have_fop=no
162140c5823bSmrgelse
162240c5823bSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
162340c5823bSmrgfi
1624bbe1b32bSmrg
162540c5823bSmrg# Test for a minimum version of fop, if provided.
162640c5823bSmrgm4_ifval([$1],
162740c5823bSmrg[if test "$have_fop" = yes; then
162840c5823bSmrg    # scrape the fop version
162940c5823bSmrg    AC_MSG_CHECKING([for fop minimum version])
163040c5823bSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
163140c5823bSmrg    AC_MSG_RESULT([$fop_version])
163240c5823bSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
163340c5823bSmrg        [if test "x$use_fop" = xauto; then
163440c5823bSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
163540c5823bSmrg            have_fop=no
163640c5823bSmrg        else
163740c5823bSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
163840c5823bSmrg        fi])
163940c5823bSmrgfi])
164040c5823bSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
164140c5823bSmrg]) # XORG_WITH_FOP
164230f8ce46Smrg
164340c5823bSmrg# XORG_WITH_M4([MIN-VERSION])
164440c5823bSmrg# ---------------------------
164540c5823bSmrg# Minimum version: 1.19.0
164630f8ce46Smrg#
164740c5823bSmrg# This macro attempts to locate an m4 macro processor which supports
164840c5823bSmrg# -I option and is only useful for modules relying on M4 in order to
164940c5823bSmrg# expand macros in source code files.
165040c5823bSmrg#
165140c5823bSmrg# Interface to module:
165240c5823bSmrg# M4:	 	returns the path of the m4 program found
165340c5823bSmrg#		returns the path set by the user in the environment
165440c5823bSmrg#
165540c5823bSmrgAC_DEFUN([XORG_WITH_M4], [
165640c5823bSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
165740c5823bSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
165840c5823bSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
165940c5823bSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
166040c5823bSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
166140c5823bSmrg   [$PATH:/usr/gnu/bin])])
1662bbe1b32bSmrg
166340c5823bSmrgAC_SUBST([M4], [$ac_cv_path_M4])
166440c5823bSmrg]) # XORG_WITH_M4
1665ce6676dbSmrg
166640c5823bSmrg# XORG_WITH_PS2PDF([DEFAULT])
166740c5823bSmrg# ----------------
166840c5823bSmrg# Minimum version: 1.6.0
166940c5823bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1670ce6676dbSmrg#
167140c5823bSmrg# Documentation tools are not always available on all platforms and sometimes
167240c5823bSmrg# not at the appropriate level. This macro enables a module to test for the
167340c5823bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
167440c5823bSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
167540c5823bSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
167640c5823bSmrg# --with-ps2pdf assumes 'auto'.
1677ce6676dbSmrg#
167840c5823bSmrg# Interface to module:
167940c5823bSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
168040c5823bSmrg# PS2PDF:	returns the path of the ps2pdf program found
168140c5823bSmrg#		returns the path set by the user in the environment
168240c5823bSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
168340c5823bSmrg#		 'no' user instructs the module not to use ps2pdf
1684ce6676dbSmrg#
168540c5823bSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
1686ce6676dbSmrg#
168740c5823bSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
168840c5823bSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
168940c5823bSmrgm4_define([_defopt], m4_default([$1], [auto]))
169040c5823bSmrgAC_ARG_WITH(ps2pdf,
169140c5823bSmrg	AS_HELP_STRING([--with-ps2pdf],
169240c5823bSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
169340c5823bSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
169440c5823bSmrgm4_undefine([_defopt])
1695ce6676dbSmrg
169640c5823bSmrgif test "x$use_ps2pdf" = x"auto"; then
169740c5823bSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
169840c5823bSmrg   if test "x$PS2PDF" = "x"; then
169940c5823bSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
170040c5823bSmrg	have_ps2pdf=no
170140c5823bSmrg   else
170240c5823bSmrg        have_ps2pdf=yes
170340c5823bSmrg   fi
170440c5823bSmrgelif test "x$use_ps2pdf" = x"yes" ; then
170540c5823bSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
170640c5823bSmrg   if test "x$PS2PDF" = "x"; then
170740c5823bSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
170840c5823bSmrg   fi
170940c5823bSmrg   have_ps2pdf=yes
171040c5823bSmrgelif test "x$use_ps2pdf" = x"no" ; then
171140c5823bSmrg   if test "x$PS2PDF" != "x"; then
171240c5823bSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
171340c5823bSmrg   fi
171440c5823bSmrg   have_ps2pdf=no
1715ce6676dbSmrgelse
171640c5823bSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
1717ce6676dbSmrgfi
171840c5823bSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
171940c5823bSmrg]) # XORG_WITH_PS2PDF
1720ce6676dbSmrg
172140c5823bSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
172240c5823bSmrg# ----------------
172340c5823bSmrg# Minimum version: 1.6.0
1724ce6676dbSmrg#
172540c5823bSmrg# Documentation tools are not always available on all platforms and sometimes
172640c5823bSmrg# not at the appropriate level. This macro enables a builder to skip all
172740c5823bSmrg# documentation targets except traditional man pages.
172840c5823bSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
172940c5823bSmrg# maximum flexibilty in controlling documentation building.
173040c5823bSmrg# Refer to:
173140c5823bSmrg# XORG_WITH_XMLTO         --with-xmlto
173240c5823bSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
173340c5823bSmrg# XORG_WITH_DOXYGEN       --with-doxygen
173440c5823bSmrg# XORG_WITH_FOP           --with-fop
173540c5823bSmrg# XORG_WITH_GROFF         --with-groff
173640c5823bSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
173740c5823bSmrg#
173840c5823bSmrg# Interface to module:
173940c5823bSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
174040c5823bSmrg# --enable-docs: 'yes' user instructs the module to generate docs
174140c5823bSmrg#		 'no' user instructs the module not to generate docs
174240c5823bSmrg# parm1:	specify the default value, yes or no.
174340c5823bSmrg#
174440c5823bSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
174540c5823bSmrgm4_define([docs_default], m4_default([$1], [yes]))
174640c5823bSmrgAC_ARG_ENABLE(docs,
174740c5823bSmrg	AS_HELP_STRING([--enable-docs],
174840c5823bSmrg	   [Enable building the documentation (default: ]docs_default[)]),
174940c5823bSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
175040c5823bSmrgm4_undefine([docs_default])
175140c5823bSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
175240c5823bSmrgAC_MSG_CHECKING([whether to build documentation])
175340c5823bSmrgAC_MSG_RESULT([$build_docs])
175440c5823bSmrg]) # XORG_ENABLE_DOCS
1755ce6676dbSmrg
175640c5823bSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
175740c5823bSmrg# ----------------
175840c5823bSmrg# Minimum version: 1.6.0
175940c5823bSmrg#
176040c5823bSmrg# This macro enables a builder to skip all developer documentation.
176140c5823bSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
176240c5823bSmrg# maximum flexibilty in controlling documentation building.
176340c5823bSmrg# Refer to:
176440c5823bSmrg# XORG_WITH_XMLTO         --with-xmlto
176540c5823bSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
176640c5823bSmrg# XORG_WITH_DOXYGEN       --with-doxygen
176740c5823bSmrg# XORG_WITH_FOP           --with-fop
176840c5823bSmrg# XORG_WITH_GROFF         --with-groff
176940c5823bSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
177040c5823bSmrg#
177140c5823bSmrg# Interface to module:
177240c5823bSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
177340c5823bSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
177440c5823bSmrg#			'no' user instructs the module not to generate developer docs
177540c5823bSmrg# parm1:		specify the default value, yes or no.
177640c5823bSmrg#
177740c5823bSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
177840c5823bSmrgm4_define([devel_default], m4_default([$1], [yes]))
177940c5823bSmrgAC_ARG_ENABLE(devel-docs,
178040c5823bSmrg	AS_HELP_STRING([--enable-devel-docs],
178140c5823bSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
178240c5823bSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
178340c5823bSmrgm4_undefine([devel_default])
178440c5823bSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
178540c5823bSmrgAC_MSG_CHECKING([whether to build developer documentation])
178640c5823bSmrgAC_MSG_RESULT([$build_devel_docs])
178740c5823bSmrg]) # XORG_ENABLE_DEVEL_DOCS
1788ce6676dbSmrg
178940c5823bSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
179040c5823bSmrg# ----------------
179140c5823bSmrg# Minimum version: 1.6.0
179240c5823bSmrg#
179340c5823bSmrg# This macro enables a builder to skip all functional specification targets.
179440c5823bSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
179540c5823bSmrg# maximum flexibilty in controlling documentation building.
179640c5823bSmrg# Refer to:
179740c5823bSmrg# XORG_WITH_XMLTO         --with-xmlto
179840c5823bSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
179940c5823bSmrg# XORG_WITH_DOXYGEN       --with-doxygen
180040c5823bSmrg# XORG_WITH_FOP           --with-fop
180140c5823bSmrg# XORG_WITH_GROFF         --with-groff
180240c5823bSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
180340c5823bSmrg#
180440c5823bSmrg# Interface to module:
180540c5823bSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
180640c5823bSmrg# --enable-specs:	'yes' user instructs the module to generate specs
180740c5823bSmrg#			'no' user instructs the module not to generate specs
180840c5823bSmrg# parm1:		specify the default value, yes or no.
180940c5823bSmrg#
181040c5823bSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
181140c5823bSmrgm4_define([spec_default], m4_default([$1], [yes]))
181240c5823bSmrgAC_ARG_ENABLE(specs,
181340c5823bSmrg	AS_HELP_STRING([--enable-specs],
181440c5823bSmrg	   [Enable building the specs (default: ]spec_default[)]),
181540c5823bSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
181640c5823bSmrgm4_undefine([spec_default])
181740c5823bSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
181840c5823bSmrgAC_MSG_CHECKING([whether to build functional specifications])
181940c5823bSmrgAC_MSG_RESULT([$build_specs])
182040c5823bSmrg]) # XORG_ENABLE_SPECS
1821ce6676dbSmrg
182240c5823bSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
182340c5823bSmrg# ----------------------------------------------
182440c5823bSmrg# Minimum version: 1.13.0
182540c5823bSmrg#
182640c5823bSmrg# This macro enables a builder to enable/disable unit testing
182740c5823bSmrg# It makes no assumption about the test cases implementation
182840c5823bSmrg# Test cases may or may not use Automake "Support for test suites"
182940c5823bSmrg# They may or may not use the software utility library GLib
183040c5823bSmrg#
183140c5823bSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
183240c5823bSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
183340c5823bSmrg# The variable enable_unit_tests is used by other macros in this file.
183440c5823bSmrg#
183540c5823bSmrg# Interface to module:
183640c5823bSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
183740c5823bSmrg# enable_unit_tests:    used in configure.ac for additional configuration
183840c5823bSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
183940c5823bSmrg#			'no' user instructs the module not to build tests
184040c5823bSmrg# parm1:		specify the default value, yes or no.
184140c5823bSmrg#
184240c5823bSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
184340c5823bSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
184440c5823bSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
184540c5823bSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
184640c5823bSmrgm4_define([_defopt], m4_default([$1], [auto]))
184740c5823bSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
184840c5823bSmrg	[Enable building unit test cases (default: ]_defopt[)]),
184940c5823bSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
185040c5823bSmrgm4_undefine([_defopt])
185140c5823bSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
185240c5823bSmrgAC_MSG_CHECKING([whether to build unit test cases])
185340c5823bSmrgAC_MSG_RESULT([$enable_unit_tests])
185440c5823bSmrg]) # XORG_ENABLE_UNIT_TESTS
1855ce6676dbSmrg
185640c5823bSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
185740c5823bSmrg# ------------------------------------------------------
185840c5823bSmrg# Minimum version: 1.17.0
185940c5823bSmrg#
186040c5823bSmrg# This macro enables a builder to enable/disable integration testing
186140c5823bSmrg# It makes no assumption about the test cases' implementation
186240c5823bSmrg# Test cases may or may not use Automake "Support for test suites"
186340c5823bSmrg#
186440c5823bSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
186540c5823bSmrg# usually requires less dependencies and may be built and run under less
186640c5823bSmrg# stringent environments than integration tests.
186740c5823bSmrg#
186840c5823bSmrg# Interface to module:
186940c5823bSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
187040c5823bSmrg# enable_integration_tests:   used in configure.ac for additional configuration
187140c5823bSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
187240c5823bSmrg#                             'no' user instructs the module not to build tests
187340c5823bSmrg# parm1:                      specify the default value, yes or no.
187440c5823bSmrg#
187540c5823bSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
187640c5823bSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
187740c5823bSmrgm4_define([_defopt], m4_default([$1], [auto]))
187840c5823bSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
187940c5823bSmrg	[Enable building integration test cases (default: ]_defopt[)]),
188040c5823bSmrg	[enable_integration_tests=$enableval],
188140c5823bSmrg	[enable_integration_tests=]_defopt)
188240c5823bSmrgm4_undefine([_defopt])
188340c5823bSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
188440c5823bSmrg	[test "x$enable_integration_tests" != xno])
188540c5823bSmrgAC_MSG_CHECKING([whether to build unit test cases])
188640c5823bSmrgAC_MSG_RESULT([$enable_integration_tests])
188740c5823bSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
1888ce6676dbSmrg
188940c5823bSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
189040c5823bSmrg# ----------------------------------------
189140c5823bSmrg# Minimum version: 1.13.0
189240c5823bSmrg#
189340c5823bSmrg# GLib is a library which provides advanced data structures and functions.
189440c5823bSmrg# This macro enables a module to test for the presence of Glib.
189540c5823bSmrg#
189640c5823bSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
189740c5823bSmrg# Otherwise the value of $enable_unit_tests is blank.
189840c5823bSmrg#
189940c5823bSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
190040c5823bSmrg# test support usually requires less dependencies and may be built and run under
190140c5823bSmrg# less stringent environments than integration tests.
190240c5823bSmrg#
190340c5823bSmrg# Interface to module:
190440c5823bSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
190540c5823bSmrg# with_glib: used in configure.ac to know if GLib has been found
190640c5823bSmrg# --with-glib:	'yes' user instructs the module to use glib
190740c5823bSmrg#		'no' user instructs the module not to use glib
190840c5823bSmrg#
190940c5823bSmrgAC_DEFUN([XORG_WITH_GLIB],[
191040c5823bSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
191140c5823bSmrgm4_define([_defopt], m4_default([$2], [auto]))
191240c5823bSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
191340c5823bSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
191440c5823bSmrg	[with_glib=$withval], [with_glib=]_defopt)
191540c5823bSmrgm4_undefine([_defopt])
191640c5823bSmrg
191740c5823bSmrghave_glib=no
191840c5823bSmrg# Do not probe GLib if user explicitly disabled unit testing
191940c5823bSmrgif test "x$enable_unit_tests" != x"no"; then
192040c5823bSmrg  # Do not probe GLib if user explicitly disabled it
192140c5823bSmrg  if test "x$with_glib" != x"no"; then
192240c5823bSmrg    m4_ifval(
192340c5823bSmrg      [$1],
192440c5823bSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
192540c5823bSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
192640c5823bSmrg    )
192740c5823bSmrg  fi
1928ce6676dbSmrgfi
192940c5823bSmrg
193040c5823bSmrg# Not having GLib when unit testing has been explicitly requested is an error
193140c5823bSmrgif test "x$enable_unit_tests" = x"yes"; then
193240c5823bSmrg  if test "x$have_glib" = x"no"; then
193340c5823bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
193440c5823bSmrg  fi
1935ce6676dbSmrgfi
1936ce6676dbSmrg
193740c5823bSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
193840c5823bSmrgif test "x$enable_unit_tests" = x"no"; then
193940c5823bSmrg  if test "x$with_glib" = x"yes"; then
194040c5823bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
194140c5823bSmrg  fi
1942ce6676dbSmrgfi
194340c5823bSmrg
194440c5823bSmrg# Not having GLib when it has been explicitly requested is an error
194540c5823bSmrgif test "x$with_glib" = x"yes"; then
194640c5823bSmrg  if test "x$have_glib" = x"no"; then
194740c5823bSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
194840c5823bSmrg  fi
1949ce6676dbSmrgfi
1950ce6676dbSmrg
195140c5823bSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
195240c5823bSmrg]) # XORG_WITH_GLIB
1953ce6676dbSmrg
195440c5823bSmrg# XORG_LD_WRAP([required|optional])
195540c5823bSmrg# ---------------------------------
195640c5823bSmrg# Minimum version: 1.13.0
195730f8ce46Smrg#
195840c5823bSmrg# Check if linker supports -wrap, passed via compiler flags
195940c5823bSmrg#
196040c5823bSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
196140c5823bSmrg# Otherwise the value of $enable_unit_tests is blank.
196240c5823bSmrg#
196340c5823bSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
196440c5823bSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
196540c5823bSmrg# available, an argument of "optional" allows use when some unit tests require
196640c5823bSmrg# ld -wrap and others do not.
196740c5823bSmrg#
196840c5823bSmrgAC_DEFUN([XORG_LD_WRAP],[
196940c5823bSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
197040c5823bSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
197140c5823bSmrg                      void __wrap_exit(int status) { return; }],
197240c5823bSmrg                     [exit(0);])])
197340c5823bSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
197440c5823bSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
197540c5823bSmrg  if test "x$have_ld_wrap" = x"no"; then
197640c5823bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
197740c5823bSmrg  fi
197830f8ce46Smrgfi
197940c5823bSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
1980ce6676dbSmrg#
198140c5823bSmrg]) # XORG_LD_WRAP
1982ce6676dbSmrg
198340c5823bSmrg# XORG_CHECK_LINKER_FLAGS
198440c5823bSmrg# -----------------------
198540c5823bSmrg# SYNOPSIS
198640c5823bSmrg#
198740c5823bSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
198840c5823bSmrg#
198940c5823bSmrg# DESCRIPTION
199040c5823bSmrg#
199140c5823bSmrg#   Check whether the given linker FLAGS work with the current language's
199240c5823bSmrg#   linker, or whether they give an error.
199340c5823bSmrg#
199440c5823bSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
199540c5823bSmrg#   success/failure.
199640c5823bSmrg#
199740c5823bSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
199840c5823bSmrg#
199940c5823bSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
200040c5823bSmrg#
200140c5823bSmrg# LICENSE
200240c5823bSmrg#
200340c5823bSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
200440c5823bSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
200540c5823bSmrg#   Copyright (c) 2009 Matteo Frigo
200640c5823bSmrg#
200740c5823bSmrg#   This program is free software: you can redistribute it and/or modify it
200840c5823bSmrg#   under the terms of the GNU General Public License as published by the
200940c5823bSmrg#   Free Software Foundation, either version 3 of the License, or (at your
201040c5823bSmrg#   option) any later version.
201140c5823bSmrg#
201240c5823bSmrg#   This program is distributed in the hope that it will be useful, but
201340c5823bSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
201440c5823bSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
201540c5823bSmrg#   Public License for more details.
201640c5823bSmrg#
201740c5823bSmrg#   You should have received a copy of the GNU General Public License along
201840c5823bSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
201940c5823bSmrg#
202040c5823bSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
202140c5823bSmrg#   gives unlimited permission to copy, distribute and modify the configure
202240c5823bSmrg#   scripts that are the output of Autoconf when processing the Macro. You
202340c5823bSmrg#   need not follow the terms of the GNU General Public License when using
202440c5823bSmrg#   or distributing such scripts, even though portions of the text of the
202540c5823bSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
202640c5823bSmrg#   all other use of the material that constitutes the Autoconf Macro.
202740c5823bSmrg#
202840c5823bSmrg#   This special exception to the GPL applies to versions of the Autoconf
202940c5823bSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
203040c5823bSmrg#   modified version of the Autoconf Macro, you may extend this special
203140c5823bSmrg#   exception to the GPL to apply to your modified version as well.#
203240c5823bSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
203340c5823bSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
203440c5823bSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
203540c5823bSmrgAS_LITERAL_IF([$1],
203640c5823bSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
203740c5823bSmrg      ax_save_FLAGS=$LDFLAGS
203840c5823bSmrg      LDFLAGS="$1"
203940c5823bSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
204040c5823bSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
204140c5823bSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
204240c5823bSmrg      LDFLAGS=$ax_save_FLAGS])],
204340c5823bSmrg  [ax_save_FLAGS=$LDFLAGS
204440c5823bSmrg   LDFLAGS="$1"
204540c5823bSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
204640c5823bSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
204740c5823bSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
204840c5823bSmrg   LDFLAGS=$ax_save_FLAGS])
204940c5823bSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
205040c5823bSmrgAC_MSG_RESULT($xorg_check_linker_flags)
205140c5823bSmrgif test "x$xorg_check_linker_flags" = xyes; then
205240c5823bSmrg	m4_default([$2], :)
2053ce6676dbSmrgelse
205440c5823bSmrg	m4_default([$3], :)
2055ce6676dbSmrgfi
205640c5823bSmrg]) # XORG_CHECK_LINKER_FLAGS
2057ce6676dbSmrg
205840c5823bSmrg# XORG_MEMORY_CHECK_FLAGS
205940c5823bSmrg# -----------------------
206040c5823bSmrg# Minimum version: 1.16.0
206140c5823bSmrg#
206240c5823bSmrg# This macro attempts to find appropriate memory checking functionality
206340c5823bSmrg# for various platforms which unit testing code may use to catch various
206440c5823bSmrg# forms of memory allocation and access errors in testing.
206540c5823bSmrg#
206640c5823bSmrg# Interface to module:
206740c5823bSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
206840c5823bSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
206940c5823bSmrg#
207040c5823bSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
207140c5823bSmrg#
207240c5823bSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2073ce6676dbSmrg
207440c5823bSmrgAC_REQUIRE([AC_CANONICAL_HOST])
207540c5823bSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
207640c5823bSmrg           [Environment variables to enable memory checking in tests])
2077ce6676dbSmrg
207840c5823bSmrg# Check for different types of support on different platforms
207940c5823bSmrgcase $host_os in
208040c5823bSmrg    solaris*)
208140c5823bSmrg        AC_CHECK_LIB([umem], [umem_alloc],
208240c5823bSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
208340c5823bSmrg        ;;
208440c5823bSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
208540c5823bSmrg        # both directly and inverted, so should not be 0 or 255.
208640c5823bSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
208740c5823bSmrg        ;;
208840c5823bSmrg    darwin*)
208940c5823bSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
209040c5823bSmrg        ;;
209140c5823bSmrg    *bsd*)
209240c5823bSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
209340c5823bSmrg        ;;
209440c5823bSmrgesac
2095ce6676dbSmrg
209640c5823bSmrg# User supplied flags override default flags
209740c5823bSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
209840c5823bSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2099ce6676dbSmrgfi
2100ce6676dbSmrg
210140c5823bSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
210240c5823bSmrg]) # XORG_WITH_LINT
2103ce6676dbSmrg
210440c5823bSmrg# XORG_CHECK_MALLOC_ZERO
210540c5823bSmrg# ----------------------
2106ce6676dbSmrg# Minimum version: 1.0.0
2107ce6676dbSmrg#
210840c5823bSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
210940c5823bSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
211040c5823bSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
211140c5823bSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
211240c5823bSmrgAC_ARG_ENABLE(malloc0returnsnull,
211340c5823bSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
211440c5823bSmrg		       [malloc(0) returns NULL (default: auto)]),
211540c5823bSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
211640c5823bSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2117ce6676dbSmrg
211840c5823bSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
211940c5823bSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
212040c5823bSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
212140c5823bSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
212240c5823bSmrg#include <stdlib.h>
212340c5823bSmrg],[
212440c5823bSmrg    char *m0, *r0, *c0, *p;
212540c5823bSmrg    m0 = malloc(0);
212640c5823bSmrg    p = malloc(10);
212740c5823bSmrg    r0 = realloc(p,0);
212840c5823bSmrg    c0 = calloc(0,10);
212940c5823bSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
213040c5823bSmrg])],
213140c5823bSmrg		[xorg_cv_malloc0_returns_null=yes],
213240c5823bSmrg		[xorg_cv_malloc0_returns_null=no])])
213340c5823bSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2134ce6676dbSmrgfi
213540c5823bSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2136ce6676dbSmrg
213740c5823bSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
213840c5823bSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
213940c5823bSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
214040c5823bSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
214140c5823bSmrgelse
214240c5823bSmrg	MALLOC_ZERO_CFLAGS=""
214340c5823bSmrg	XMALLOC_ZERO_CFLAGS=""
214440c5823bSmrg	XTMALLOC_ZERO_CFLAGS=""
2145ce6676dbSmrgfi
2146ce6676dbSmrg
214740c5823bSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
214840c5823bSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
214940c5823bSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
215040c5823bSmrg]) # XORG_CHECK_MALLOC_ZERO
2151ce6676dbSmrg
215240c5823bSmrg# XORG_WITH_LINT()
215330f8ce46Smrg# ----------------
215440c5823bSmrg# Minimum version: 1.1.0
215530f8ce46Smrg#
215640c5823bSmrg# This macro enables the use of a tool that flags some suspicious and
215740c5823bSmrg# non-portable constructs (likely to be bugs) in C language source code.
215840c5823bSmrg# It will attempt to locate the tool and use appropriate options.
215940c5823bSmrg# There are various lint type tools on different platforms.
216030f8ce46Smrg#
216130f8ce46Smrg# Interface to module:
216240c5823bSmrg# LINT:		returns the path to the tool found on the platform
216340c5823bSmrg#		or the value set to LINT on the configure cmd line
216440c5823bSmrg#		also an Automake conditional
216540c5823bSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
216630f8ce46Smrg#
216740c5823bSmrg# --with-lint:	'yes' user instructs the module to use lint
216840c5823bSmrg#		'no' user instructs the module not to use lint (default)
216930f8ce46Smrg#
217040c5823bSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
217140c5823bSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
217230f8ce46Smrg#
217340c5823bSmrgAC_DEFUN([XORG_WITH_LINT],[
217430f8ce46Smrg
217540c5823bSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
217640c5823bSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
217740c5823bSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
217840c5823bSmrg		[Use a lint-style source code checker (default: disabled)])],
217940c5823bSmrg		[use_lint=$withval], [use_lint=no])
218040c5823bSmrg
218140c5823bSmrg# Obtain platform specific info like program name and options
218240c5823bSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
218340c5823bSmrgcase $host_os in
218440c5823bSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
218540c5823bSmrg	lint_name=splint
218640c5823bSmrg	lint_options="-badflag"
218740c5823bSmrg	;;
218840c5823bSmrg  *freebsd* | *netbsd*)
218940c5823bSmrg	lint_name=lint
219040c5823bSmrg	lint_options="-u -b"
219140c5823bSmrg	;;
219240c5823bSmrg  *solaris*)
219340c5823bSmrg	lint_name=lint
219440c5823bSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
219540c5823bSmrg	;;
219640c5823bSmrgesac
219740c5823bSmrg
219840c5823bSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
219940c5823bSmrgif test "x$use_lint" = x"yes" ; then
220040c5823bSmrg   AC_PATH_PROG([LINT], [$lint_name])
220140c5823bSmrg   if test "x$LINT" = "x"; then
220240c5823bSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
220330f8ce46Smrg   fi
220440c5823bSmrgelif test "x$use_lint" = x"no" ; then
220540c5823bSmrg   if test "x$LINT" != "x"; then
220640c5823bSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
220730f8ce46Smrg   fi
220830f8ce46Smrgelse
220940c5823bSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
221030f8ce46Smrgfi
221130f8ce46Smrg
221240c5823bSmrg# User supplied flags override default flags
221340c5823bSmrgif test "x$LINT_FLAGS" != "x"; then
221440c5823bSmrg   lint_options=$LINT_FLAGS
221540c5823bSmrgfi
221630f8ce46Smrg
221740c5823bSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
221840c5823bSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
221930f8ce46Smrg
222040c5823bSmrg]) # XORG_WITH_LINT
222140c5823bSmrg
222240c5823bSmrg# XORG_LINT_LIBRARY(LIBNAME)
222340c5823bSmrg# --------------------------
222440c5823bSmrg# Minimum version: 1.1.0
222534f90d55Smrg#
222640c5823bSmrg# Sets up flags for building lint libraries for checking programs that call
222740c5823bSmrg# functions in the library.
222834f90d55Smrg#
222934f90d55Smrg# Interface to module:
223040c5823bSmrg# LINTLIB		- Automake variable with the name of lint library file to make
223140c5823bSmrg# MAKE_LINT_LIB		- Automake conditional
223234f90d55Smrg#
223340c5823bSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
223440c5823bSmrg#			  - 'no' user instructs the module not to create a lint library (default)
223534f90d55Smrg
223640c5823bSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
223740c5823bSmrgAC_REQUIRE([XORG_WITH_LINT])
223840c5823bSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
223940c5823bSmrg	[Create lint library (default: disabled)])],
224040c5823bSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
224140c5823bSmrg
224240c5823bSmrgif test "x$make_lint_lib" = x"yes" ; then
224340c5823bSmrg   LINTLIB=llib-l$1.ln
224440c5823bSmrg   if test "x$LINT" = "x"; then
224540c5823bSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
224634f90d55Smrg   fi
224740c5823bSmrgelif test "x$make_lint_lib" != x"no" ; then
224840c5823bSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
224934f90d55Smrgfi
225034f90d55Smrg
225140c5823bSmrgAC_SUBST(LINTLIB)
225240c5823bSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
225334f90d55Smrg
225440c5823bSmrg]) # XORG_LINT_LIBRARY
225540c5823bSmrg
225640c5823bSmrg# XORG_COMPILER_BRAND
225740c5823bSmrg# -------------------
225840c5823bSmrg# Minimum version: 1.14.0
225934f90d55Smrg#
226040c5823bSmrg# Checks for various brands of compilers and sets flags as appropriate:
226140c5823bSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
226240c5823bSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
226340c5823bSmrg#   clang compiler - sets CLANGCC to "yes"
226440c5823bSmrg#   Intel compiler - sets INTELCC to "yes"
226540c5823bSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
226634f90d55Smrg#
226740c5823bSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
226840c5823bSmrgAC_LANG_CASE(
226940c5823bSmrg	[C], [
227040c5823bSmrg		AC_REQUIRE([AC_PROG_CC_C99])
227140c5823bSmrg	],
227240c5823bSmrg	[C++], [
227340c5823bSmrg		AC_REQUIRE([AC_PROG_CXX])
227440c5823bSmrg	]
227540c5823bSmrg)
227640c5823bSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
227740c5823bSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
227840c5823bSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
227940c5823bSmrg]) # XORG_COMPILER_BRAND
228040c5823bSmrg
228140c5823bSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
228240c5823bSmrg# ---------------
228340c5823bSmrg# Minimum version: 1.16.0
228434f90d55Smrg#
228540c5823bSmrg# Test if the compiler works when passed the given flag as a command line argument.
228640c5823bSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
228740c5823bSmrg# next flag in the list until there are no more options.
228834f90d55Smrg#
228940c5823bSmrg# Note that this does not guarantee that the compiler supports the flag as some
229040c5823bSmrg# compilers will simply ignore arguments that they do not understand, but we do
229140c5823bSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
229240c5823bSmrg# -Werror=unused-command-line-argument
229334f90d55Smrg#
229440c5823bSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
229540c5823bSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
229640c5823bSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
229734f90d55Smrg
229840c5823bSmrgAC_LANG_COMPILER_REQUIRE
229940c5823bSmrg
230040c5823bSmrgAC_LANG_CASE(
230140c5823bSmrg	[C], [
230240c5823bSmrg		AC_REQUIRE([AC_PROG_CC_C99])
230340c5823bSmrg		define([PREFIX], [C])
230440c5823bSmrg		define([CACHE_PREFIX], [cc])
230540c5823bSmrg		define([COMPILER], [$CC])
230640c5823bSmrg	],
230740c5823bSmrg	[C++], [
230840c5823bSmrg		define([PREFIX], [CXX])
230940c5823bSmrg		define([CACHE_PREFIX], [cxx])
231040c5823bSmrg		define([COMPILER], [$CXX])
231140c5823bSmrg	]
231240c5823bSmrg)
231340c5823bSmrg
231440c5823bSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
231540c5823bSmrg
231640c5823bSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
231740c5823bSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
231840c5823bSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
231940c5823bSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
232040c5823bSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
232140c5823bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
232240c5823bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
232340c5823bSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
232440c5823bSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
232534f90d55Smrgfi
232634f90d55Smrg
232740c5823bSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
232840c5823bSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
232940c5823bSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
233040c5823bSmrg	fi
233140c5823bSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
233240c5823bSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
233340c5823bSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
233440c5823bSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
233540c5823bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
233640c5823bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
233740c5823bSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
233840c5823bSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
233940c5823bSmrgfi
234034f90d55Smrg
234140c5823bSmrgfound="no"
234240c5823bSmrgm4_foreach([flag], m4_cdr($@), [
234340c5823bSmrg	if test $found = "no" ; then
234440c5823bSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
234540c5823bSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
234640c5823bSmrg		fi
234740c5823bSmrg
234840c5823bSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
234940c5823bSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
235040c5823bSmrg		fi
235140c5823bSmrg
235240c5823bSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
235340c5823bSmrg
235440c5823bSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
235540c5823bSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
235640c5823bSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
235740c5823bSmrg		AC_CACHE_VAL($cacheid,
235840c5823bSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
235940c5823bSmrg					     [eval $cacheid=yes],
236040c5823bSmrg					     [eval $cacheid=no])])
236140c5823bSmrg
236240c5823bSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
236340c5823bSmrg
236440c5823bSmrg		eval supported=\$$cacheid
236540c5823bSmrg		AC_MSG_RESULT([$supported])
236640c5823bSmrg		if test "$supported" = "yes" ; then
236740c5823bSmrg			$1="$$1 ]flag["
236840c5823bSmrg			found="yes"
236940c5823bSmrg		fi
237040c5823bSmrg	fi
237140c5823bSmrg])
237240c5823bSmrg]) # XORG_TESTSET_CFLAG
237340c5823bSmrg
237440c5823bSmrg# XORG_COMPILER_FLAGS
237540c5823bSmrg# ---------------
237640c5823bSmrg# Minimum version: 1.16.0
237730f8ce46Smrg#
237840c5823bSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
237940c5823bSmrg# arguments supported by the selected compiler which do NOT alter the generated
238040c5823bSmrg# code.  These arguments will cause the compiler to print various warnings
238140c5823bSmrg# during compilation AND turn a conservative set of warnings into errors.
238230f8ce46Smrg#
238340c5823bSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
238440c5823bSmrg# future versions of util-macros as options are added to new compilers.
238530f8ce46Smrg#
238640c5823bSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
238740c5823bSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
238830f8ce46Smrg
238940c5823bSmrgAC_ARG_ENABLE(selective-werror,
239040c5823bSmrg              AS_HELP_STRING([--disable-selective-werror],
239140c5823bSmrg                             [Turn off selective compiler errors. (default: enabled)]),
239240c5823bSmrg              [SELECTIVE_WERROR=$enableval],
239340c5823bSmrg              [SELECTIVE_WERROR=yes])
239430f8ce46Smrg
239540c5823bSmrgAC_LANG_CASE(
239640c5823bSmrg        [C], [
239740c5823bSmrg                define([PREFIX], [C])
239840c5823bSmrg        ],
239940c5823bSmrg        [C++], [
240040c5823bSmrg                define([PREFIX], [CXX])
240140c5823bSmrg        ]
240240c5823bSmrg)
240340c5823bSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
240440c5823bSmrgif test "x$SUNCC" = "xyes"; then
240540c5823bSmrg    [BASE_]PREFIX[FLAGS]="-v"
240630f8ce46Smrgelse
240740c5823bSmrg    [BASE_]PREFIX[FLAGS]=""
240830f8ce46Smrgfi
24098f34cbf9Ssnj
241040c5823bSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
241140c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
241240c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
241340c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
241440c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
241540c5823bSmrg
241640c5823bSmrgAC_LANG_CASE(
241740c5823bSmrg	[C], [
241840c5823bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
241940c5823bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
242040c5823bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
242140c5823bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
242240c5823bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
242340c5823bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
242440c5823bSmrg	]
242540c5823bSmrg)
242640c5823bSmrg
242740c5823bSmrg# This chunk adds additional warnings that could catch undesired effects.
242840c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
242940c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
243040c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
243140c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
243240c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
243340c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
243440c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
243540c5823bSmrg
243640c5823bSmrg# These are currently disabled because they are noisy.  They will be enabled
243740c5823bSmrg# in the future once the codebase is sufficiently modernized to silence
243840c5823bSmrg# them.  For now, I don't want them to drown out the other warnings.
243940c5823bSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
244040c5823bSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
244140c5823bSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
244240c5823bSmrg
244340c5823bSmrg# Turn some warnings into errors, so we don't accidently get successful builds
244440c5823bSmrg# when there are problems that should be fixed.
244540c5823bSmrg
244640c5823bSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
244740c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
244840c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
244940c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
245040c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
245140c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
245240c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
245340c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
245440c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
245540c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
245640c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
245740c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
245840c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
245940c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
246040c5823bSmrgelse
246140c5823bSmrgAC_MSG_WARN([You have chosen not to turn some select compiler warnings into errors.  This should not be necessary.  Please report why you needed to do so in a bug report at $PACKAGE_BUGREPORT])
246240c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
246340c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
246440c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
246540c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
246640c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
246740c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
246840c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
246940c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
247040c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
247140c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
247240c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
247340c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
247440c5823bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
24758f34cbf9Ssnjfi
24768f34cbf9Ssnj
247740c5823bSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
247840c5823bSmrg]) # XORG_COMPILER_FLAGS
247930f8ce46Smrg
248040c5823bSmrg# XORG_CWARNFLAGS
248140c5823bSmrg# ---------------
248240c5823bSmrg# Minimum version: 1.2.0
248340c5823bSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
248430f8ce46Smrg#
248540c5823bSmrg# Defines CWARNFLAGS to enable C compiler warnings.
248630f8ce46Smrg#
248740c5823bSmrg# This function is deprecated because it defines -fno-strict-aliasing
248840c5823bSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
248940c5823bSmrg# is needed, then it should be added explicitly in the module when
249040c5823bSmrg# it is updated to use BASE_CFLAGS.
249130f8ce46Smrg#
249240c5823bSmrgAC_DEFUN([XORG_CWARNFLAGS], [
249340c5823bSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
249440c5823bSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
249540c5823bSmrgAC_LANG_CASE(
249640c5823bSmrg	[C], [
249740c5823bSmrg		CWARNFLAGS="$BASE_CFLAGS"
249840c5823bSmrg		if  test "x$GCC" = xyes ; then
249940c5823bSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
250040c5823bSmrg		fi
250140c5823bSmrg		AC_SUBST(CWARNFLAGS)
250240c5823bSmrg	]
250340c5823bSmrg)
250440c5823bSmrg]) # XORG_CWARNFLAGS
250540c5823bSmrg
250640c5823bSmrg# XORG_STRICT_OPTION
250740c5823bSmrg# -----------------------
250840c5823bSmrg# Minimum version: 1.3.0
250930f8ce46Smrg#
251040c5823bSmrg# Add configure option to enable strict compilation flags, such as treating
251140c5823bSmrg# warnings as fatal errors.
251240c5823bSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
251340c5823bSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
251430f8ce46Smrg#
251540c5823bSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
251640c5823bSmrg# when strict compilation is unconditionally desired.
251740c5823bSmrgAC_DEFUN([XORG_STRICT_OPTION], [
251840c5823bSmrgAC_REQUIRE([XORG_CWARNFLAGS])
251940c5823bSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
252030f8ce46Smrg
252140c5823bSmrgAC_ARG_ENABLE(strict-compilation,
252240c5823bSmrg			  AS_HELP_STRING([--enable-strict-compilation],
252340c5823bSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
252440c5823bSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
252530f8ce46Smrg
252640c5823bSmrgAC_LANG_CASE(
252740c5823bSmrg        [C], [
252840c5823bSmrg                define([PREFIX], [C])
252940c5823bSmrg        ],
253040c5823bSmrg        [C++], [
253140c5823bSmrg                define([PREFIX], [CXX])
253240c5823bSmrg        ]
253340c5823bSmrg)
253430f8ce46Smrg
253540c5823bSmrg[STRICT_]PREFIX[FLAGS]=""
253640c5823bSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
253740c5823bSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
253830f8ce46Smrg
253940c5823bSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
254040c5823bSmrg# activate it with -Werror, so we add it here explicitly.
254140c5823bSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
254230f8ce46Smrg
254340c5823bSmrgif test "x$STRICT_COMPILE" = "xyes"; then
254440c5823bSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
254540c5823bSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
254640c5823bSmrgfi
254740c5823bSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
254840c5823bSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
254940c5823bSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
255040c5823bSmrg]) # XORG_STRICT_OPTION
255140c5823bSmrg
255240c5823bSmrg# XORG_DEFAULT_OPTIONS
255340c5823bSmrg# --------------------
255440c5823bSmrg# Minimum version: 1.3.0
255530f8ce46Smrg#
255640c5823bSmrg# Defines default options for X.Org modules.
255730f8ce46Smrg#
255840c5823bSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
255940c5823bSmrgAC_REQUIRE([AC_PROG_INSTALL])
256040c5823bSmrgXORG_COMPILER_FLAGS
256140c5823bSmrgXORG_CWARNFLAGS
256240c5823bSmrgXORG_STRICT_OPTION
256340c5823bSmrgXORG_RELEASE_VERSION
256440c5823bSmrgXORG_CHANGELOG
256540c5823bSmrgXORG_INSTALL
256640c5823bSmrgXORG_MANPAGE_SECTIONS
256740c5823bSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
256840c5823bSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
256940c5823bSmrg]) # XORG_DEFAULT_OPTIONS
257040c5823bSmrg
257140c5823bSmrg# XORG_INSTALL()
257240c5823bSmrg# ----------------
257340c5823bSmrg# Minimum version: 1.4.0
257430f8ce46Smrg#
257540c5823bSmrg# Defines the variable INSTALL_CMD as the command to copy
257640c5823bSmrg# INSTALL from $prefix/share/util-macros.
257730f8ce46Smrg#
257840c5823bSmrgAC_DEFUN([XORG_INSTALL], [
257940c5823bSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
258040c5823bSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
258140c5823bSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
258240c5823bSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
258340c5823bSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
258440c5823bSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
258540c5823bSmrgAC_SUBST([INSTALL_CMD])
258640c5823bSmrg]) # XORG_INSTALL
258740c5823bSmrgdnl Copyright 2005 Red Hat, Inc
258840c5823bSmrgdnl
258940c5823bSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
259040c5823bSmrgdnl documentation for any purpose is hereby granted without fee, provided that
259140c5823bSmrgdnl the above copyright notice appear in all copies and that both that
259240c5823bSmrgdnl copyright notice and this permission notice appear in supporting
259340c5823bSmrgdnl documentation.
259440c5823bSmrgdnl
259540c5823bSmrgdnl The above copyright notice and this permission notice shall be included
259640c5823bSmrgdnl in all copies or substantial portions of the Software.
259740c5823bSmrgdnl
259840c5823bSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
259940c5823bSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
260040c5823bSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
260140c5823bSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
260240c5823bSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
260340c5823bSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
260440c5823bSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
260540c5823bSmrgdnl
260640c5823bSmrgdnl Except as contained in this notice, the name of the copyright holders shall
260740c5823bSmrgdnl not be used in advertising or otherwise to promote the sale, use or
260840c5823bSmrgdnl other dealings in this Software without prior written authorization
260940c5823bSmrgdnl from the copyright holders.
261040c5823bSmrgdnl
261130f8ce46Smrg
261240c5823bSmrg# XORG_RELEASE_VERSION
261340c5823bSmrg# --------------------
261440c5823bSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
261534f90d55Smrg
261640c5823bSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
261740c5823bSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
261840c5823bSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
261940c5823bSmrg		[Major version of this package])
262040c5823bSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
262140c5823bSmrg	if test "x$PVM" = "x"; then
262240c5823bSmrg		PVM="0"
262340c5823bSmrg	fi
262440c5823bSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
262540c5823bSmrg		[$PVM],
262640c5823bSmrg		[Minor version of this package])
262740c5823bSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
262840c5823bSmrg	if test "x$PVP" = "x"; then
262940c5823bSmrg		PVP="0"
263040c5823bSmrg	fi
263140c5823bSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
263240c5823bSmrg		[$PVP],
263340c5823bSmrg		[Patch version of this package])
263440c5823bSmrg])
263530f8ce46Smrg
263640c5823bSmrg# XORG_CHANGELOG()
263740c5823bSmrg# ----------------
263840c5823bSmrg# Minimum version: 1.2.0
26398f34cbf9Ssnj#
264040c5823bSmrg# Defines the variable CHANGELOG_CMD as the command to generate
264140c5823bSmrg# ChangeLog from git.
26428f34cbf9Ssnj#
26438f34cbf9Ssnj#
264440c5823bSmrgAC_DEFUN([XORG_CHANGELOG], [
264540c5823bSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
264640c5823bSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
264740c5823bSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
264840c5823bSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
264940c5823bSmrgAC_SUBST([CHANGELOG_CMD])
265040c5823bSmrg]) # XORG_CHANGELOG
26518f34cbf9Ssnj
265240c5823bSmrgdnl
265340c5823bSmrgdnl Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
265440c5823bSmrgdnl
265540c5823bSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
265640c5823bSmrgdnl copy of this software and associated documentation files (the "Software"),
265740c5823bSmrgdnl to deal in the Software without restriction, including without limitation
265840c5823bSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
265940c5823bSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
266040c5823bSmrgdnl Software is furnished to do so, subject to the following conditions:
266140c5823bSmrgdnl
266240c5823bSmrgdnl The above copyright notice and this permission notice (including the next
266340c5823bSmrgdnl paragraph) shall be included in all copies or substantial portions of the
266440c5823bSmrgdnl Software.
266540c5823bSmrgdnl
266640c5823bSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
266740c5823bSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
266840c5823bSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
266940c5823bSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
267040c5823bSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
267140c5823bSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
267240c5823bSmrgdnl DEALINGS IN THE SOFTWARE.
267340c5823bSmrgdnl
267430f8ce46Smrg
267540c5823bSmrg# XTRANS_TCP_FLAGS()
267640c5823bSmrg# ------------------
267740c5823bSmrg# Find needed libraries for TCP sockets, and check for IPv6 support
267840c5823bSmrgAC_DEFUN([XTRANS_TCP_FLAGS],[
267940c5823bSmrg # SVR4 hides these in libraries other than libc
268040c5823bSmrg AC_SEARCH_LIBS(socket, [socket])
268140c5823bSmrg AC_SEARCH_LIBS(gethostbyname, [nsl])
268240c5823bSmrg if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then
268340c5823bSmrg   AC_CHECK_LIB([ws2_32],[main])
268440c5823bSmrg fi
268530f8ce46Smrg
268640c5823bSmrg # Needs to come after above checks for libsocket & libnsl for SVR4 systems
268740c5823bSmrg AC_ARG_ENABLE(ipv6,
268840c5823bSmrg	AS_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),
268940c5823bSmrg	[IPV6CONN=$enableval],
269040c5823bSmrg	[AC_CHECK_FUNC(getaddrinfo,[IPV6CONN=yes],[IPV6CONN=no])])
269140c5823bSmrg AC_MSG_CHECKING([if IPv6 support should be built])
269240c5823bSmrg if test "$IPV6CONN" = "yes"; then
269340c5823bSmrg	AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections])
269440c5823bSmrg fi
269540c5823bSmrg AC_MSG_RESULT($IPV6CONN)
269630f8ce46Smrg
269740c5823bSmrg # 4.3BSD-Reno added a new member to struct sockaddr_in
269840c5823bSmrg AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
269940c5823bSmrg	AC_DEFINE([BSD44SOCKETS],1,
270040c5823bSmrg 	    [Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [
270140c5823bSmrg#include <sys/types.h>
270240c5823bSmrg#include <sys/socket.h>
270340c5823bSmrg#include <netinet/in.h>
270440c5823bSmrg ])
270530f8ce46Smrg
270640c5823bSmrg # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc.
270740c5823bSmrg AC_CHECK_TYPES([socklen_t], [], [], [
270840c5823bSmrgAC_INCLUDES_DEFAULT
270940c5823bSmrg#include <sys/socket.h>])
271030f8ce46Smrg
271140c5823bSmrg # XPG4v2/UNIX95 added msg_control - check to see if we need to define
271240c5823bSmrg # _XOPEN_SOURCE to get it (such as on Solaris)
271340c5823bSmrg AC_CHECK_MEMBER([struct msghdr.msg_control], [], [],
271440c5823bSmrg                 [
271540c5823bSmrgAC_INCLUDES_DEFAULT
271640c5823bSmrg#include <sys/socket.h>
271740c5823bSmrg                 ])
271840c5823bSmrg # First try for Solaris in C99 compliant mode, which requires XPG6/UNIX03
271940c5823bSmrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
272040c5823bSmrg     unset ac_cv_member_struct_msghdr_msg_control
272140c5823bSmrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=600])
272240c5823bSmrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
272340c5823bSmrg                     [AC_DEFINE([_XOPEN_SOURCE], [600],
272440c5823bSmrg                       [Defined if needed to expose struct msghdr.msg_control])
272540c5823bSmrg                     ], [], [
272640c5823bSmrg#define _XOPEN_SOURCE 600
272740c5823bSmrgAC_INCLUDES_DEFAULT
272840c5823bSmrg#include <sys/socket.h>
272940c5823bSmrg                     ])
273040c5823bSmrg fi
273140c5823bSmrg # If that didn't work, fall back to XPG5/UNIX98 with C89
273240c5823bSmrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
273340c5823bSmrg     unset ac_cv_member_struct_msghdr_msg_control
273440c5823bSmrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=500])
273540c5823bSmrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
273640c5823bSmrg                     [AC_DEFINE([_XOPEN_SOURCE], [500],
273740c5823bSmrg                       [Defined if needed to expose struct msghdr.msg_control])
273840c5823bSmrg                     ], [], [
273940c5823bSmrg#define _XOPEN_SOURCE 500
274040c5823bSmrgAC_INCLUDES_DEFAULT
274140c5823bSmrg#include <sys/socket.h>
274240c5823bSmrg                     ])
274340c5823bSmrg fi
274434f90d55Smrg
274540c5823bSmrg
274640c5823bSmrg]) # XTRANS_TCP_FLAGS
274740c5823bSmrg
274840c5823bSmrg# XTRANS_CONNECTION_FLAGS()
274940c5823bSmrg# -------------------------
275040c5823bSmrg# Standard checks for which Xtrans transports to use by the Xorg packages
275140c5823bSmrg# that use Xtrans functions
275240c5823bSmrgAC_DEFUN([XTRANS_CONNECTION_FLAGS],[
275340c5823bSmrg AC_REQUIRE([AC_CANONICAL_HOST])
275440c5823bSmrg [case $host_os in
275540c5823bSmrg	mingw*)	unixdef="no"   ;;
275640c5823bSmrg	*)	unixdef="yes"  ;;
275740c5823bSmrg esac]
275840c5823bSmrg AC_ARG_ENABLE(unix-transport,
275940c5823bSmrg	AS_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]),
276040c5823bSmrg	[UNIXCONN=$enableval], [UNIXCONN=$unixdef])
276140c5823bSmrg AC_MSG_CHECKING([if Xtrans should support UNIX socket connections])
276240c5823bSmrg if test "$UNIXCONN" = "yes"; then
276340c5823bSmrg	AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
276440c5823bSmrg fi
276540c5823bSmrg AC_MSG_RESULT($UNIXCONN)
276640c5823bSmrg AC_ARG_ENABLE(tcp-transport,
276740c5823bSmrg	AS_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]),
276840c5823bSmrg	[TCPCONN=$enableval], [TCPCONN=yes])
276940c5823bSmrg AC_MSG_CHECKING([if Xtrans should support TCP socket connections])
277040c5823bSmrg AC_MSG_RESULT($TCPCONN)
277140c5823bSmrg if test "$TCPCONN" = "yes"; then
277240c5823bSmrg	AC_DEFINE(TCPCONN,1,[Support TCP socket connections])
277340c5823bSmrg	XTRANS_TCP_FLAGS
277440c5823bSmrg fi
277540c5823bSmrg [case $host_os in
277640c5823bSmrg	solaris*|sco*|sysv4*)	localdef="yes" ;;
277740c5823bSmrg	*)			localdef="no"  ;;
277840c5823bSmrg esac]
277940c5823bSmrg AC_ARG_ENABLE(local-transport,
278040c5823bSmrg	AS_HELP_STRING([--enable-local-transport],[Enable os-specific local transport]),
278140c5823bSmrg	[LOCALCONN=$enableval], [LOCALCONN=$localdef])
278240c5823bSmrg AC_MSG_CHECKING([if Xtrans should support os-specific local connections])
278340c5823bSmrg AC_MSG_RESULT($LOCALCONN)
278440c5823bSmrg if test "$LOCALCONN" = "yes"; then
278540c5823bSmrg	AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
278640c5823bSmrg fi
278740c5823bSmrg
278840c5823bSmrg]) # XTRANS_CONNECTION_FLAGS
278940c5823bSmrg
279040c5823bSmrg
279140c5823bSmrg# XTRANS_SECURE_RPC_FLAGS()
279240c5823bSmrg# -------------------------
279340c5823bSmrg# Check for Secure RPC functions - must come after XTRANS_TCP_FLAGS
279440c5823bSmrg# so that any necessary networking libraries are already found
279540c5823bSmrgAC_DEFUN([XTRANS_SECURE_RPC_FLAGS],
279640c5823bSmrg[AC_REQUIRE([XTRANS_TCP_FLAGS])
279740c5823bSmrg AC_ARG_ENABLE(secure-rpc,
279840c5823bSmrg	AS_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]),
279940c5823bSmrg        [SECURE_RPC=$enableval], [SECURE_RPC="try"])
280040c5823bSmrg
280140c5823bSmrg if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then
280240c5823bSmrg	FOUND_SECURE_RPC="no"
280340c5823bSmrg	AC_CHECK_FUNCS([authdes_seccreate authdes_create],
280440c5823bSmrg			[FOUND_SECURE_RPC="yes"])
280540c5823bSmrg	if test "x$FOUND_SECURE_RPC" = "xno" ; then
280640c5823bSmrg		if test "x$SECURE_RPC" = "xyes" ; then
280740c5823bSmrg	AC_MSG_ERROR([Secure RPC requested, but required functions not found])
280840c5823bSmrg		fi
280940c5823bSmrg		SECURE_RPC="no"
281040c5823bSmrg	else
281140c5823bSmrg		dnl FreeBSD keeps getsecretkey in librpcsvc
281240c5823bSmrg		AC_SEARCH_LIBS(getsecretkey, [rpcsvc])
281340c5823bSmrg		SECURE_RPC="yes"
281440c5823bSmrg	fi
281540c5823bSmrg fi
281640c5823bSmrg AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported])
281740c5823bSmrg if test "x$SECURE_RPC" = "xyes" ; then
281840c5823bSmrg	AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients])
281940c5823bSmrg fi
282040c5823bSmrg AC_MSG_RESULT($SECURE_RPC)
282140c5823bSmrg]) # XTRANS_SECURE_RPC_FLAGS
282240c5823bSmrg
282340c5823bSmrg
282440c5823bSmrg# Copyright (C) 2002-2017 Free Software Foundation, Inc.
282534f90d55Smrg#
282640c5823bSmrg# This file is free software; the Free Software Foundation
282740c5823bSmrg# gives unlimited permission to copy and/or distribute it,
282840c5823bSmrg# with or without modifications, as long as this notice is preserved.
282934f90d55Smrg
283040c5823bSmrg# AM_AUTOMAKE_VERSION(VERSION)
283140c5823bSmrg# ----------------------------
283240c5823bSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
283340c5823bSmrg# generated from the m4 files accompanying Automake X.Y.
283440c5823bSmrg# (This private macro should not be called outside this file.)
283540c5823bSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
283640c5823bSmrg[am__api_version='1.15'
283740c5823bSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
283840c5823bSmrgdnl require some minimum version.  Point them to the right macro.
283940c5823bSmrgm4_if([$1], [1.15.1], [],
284040c5823bSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
284140c5823bSmrg])
284240c5823bSmrg
284340c5823bSmrg# _AM_AUTOCONF_VERSION(VERSION)
284440c5823bSmrg# -----------------------------
284540c5823bSmrg# aclocal traces this macro to find the Autoconf version.
284640c5823bSmrg# This is a private macro too.  Using m4_define simplifies
284740c5823bSmrg# the logic in aclocal, which can simply ignore this definition.
284840c5823bSmrgm4_define([_AM_AUTOCONF_VERSION], [])
284940c5823bSmrg
285040c5823bSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
285140c5823bSmrg# -------------------------------
285240c5823bSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
285340c5823bSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
285440c5823bSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
285540c5823bSmrg[AM_AUTOMAKE_VERSION([1.15.1])dnl
285640c5823bSmrgm4_ifndef([AC_AUTOCONF_VERSION],
285740c5823bSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
285840c5823bSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
285940c5823bSmrg
286040c5823bSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
286140c5823bSmrg
286240c5823bSmrg# Copyright (C) 2001-2017 Free Software Foundation, Inc.
286340c5823bSmrg#
286440c5823bSmrg# This file is free software; the Free Software Foundation
286540c5823bSmrg# gives unlimited permission to copy and/or distribute it,
286640c5823bSmrg# with or without modifications, as long as this notice is preserved.
286740c5823bSmrg
286840c5823bSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
286940c5823bSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
287040c5823bSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
287134f90d55Smrg#
287240c5823bSmrg# Of course, Automake must honor this variable whenever it calls a
287340c5823bSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
287440c5823bSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
287540c5823bSmrg# depending on how configure is run.  This is pretty annoying, since
287640c5823bSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
287740c5823bSmrg# source directory, any form will work fine, but in subdirectories a
287840c5823bSmrg# relative path needs to be adjusted first.
287934f90d55Smrg#
288040c5823bSmrg# $ac_aux_dir/missing
288140c5823bSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
288240c5823bSmrg# $top_srcdir/$ac_aux_dir/missing
288340c5823bSmrg#    fails if $ac_aux_dir is absolute,
288440c5823bSmrg#    fails when called from a subdirectory in a VPATH build with
288540c5823bSmrg#          a relative $ac_aux_dir
288634f90d55Smrg#
288740c5823bSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
288840c5823bSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
288940c5823bSmrg# harmless because $srcdir is '.', but things will broke when you
289040c5823bSmrg# start a VPATH build or use an absolute $srcdir.
289134f90d55Smrg#
289240c5823bSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
289340c5823bSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
289440c5823bSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
289540c5823bSmrg# and then we would define $MISSING as
289640c5823bSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
289740c5823bSmrg# This will work as long as MISSING is not called from configure, because
289840c5823bSmrg# unfortunately $(top_srcdir) has no meaning in configure.
289940c5823bSmrg# However there are other variables, like CC, which are often used in
290040c5823bSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
290134f90d55Smrg#
290240c5823bSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
290340c5823bSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
290440c5823bSmrg# configured tree to be moved without reconfiguration.
290534f90d55Smrg
290640c5823bSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
290740c5823bSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
290840c5823bSmrg# Expand $ac_aux_dir to an absolute path.
290940c5823bSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
291040c5823bSmrg])
291134f90d55Smrg
291240c5823bSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
291334f90d55Smrg
291440c5823bSmrg# Copyright (C) 1997-2017 Free Software Foundation, Inc.
291540c5823bSmrg#
291640c5823bSmrg# This file is free software; the Free Software Foundation
291740c5823bSmrg# gives unlimited permission to copy and/or distribute it,
291840c5823bSmrg# with or without modifications, as long as this notice is preserved.
291934f90d55Smrg
292040c5823bSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
292140c5823bSmrg# -------------------------------------
292240c5823bSmrg# Define a conditional.
292340c5823bSmrgAC_DEFUN([AM_CONDITIONAL],
292440c5823bSmrg[AC_PREREQ([2.52])dnl
292540c5823bSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
292640c5823bSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
292740c5823bSmrgAC_SUBST([$1_TRUE])dnl
292840c5823bSmrgAC_SUBST([$1_FALSE])dnl
292940c5823bSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
293040c5823bSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
293140c5823bSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
293240c5823bSmrgif $2; then
293340c5823bSmrg  $1_TRUE=
293440c5823bSmrg  $1_FALSE='#'
293540c5823bSmrgelse
293640c5823bSmrg  $1_TRUE='#'
293740c5823bSmrg  $1_FALSE=
293834f90d55Smrgfi
293940c5823bSmrgAC_CONFIG_COMMANDS_PRE(
294040c5823bSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
294140c5823bSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
294240c5823bSmrgUsually this means the macro was only invoked conditionally.]])
294340c5823bSmrgfi])])
294434f90d55Smrg
294540c5823bSmrg# Copyright (C) 1999-2017 Free Software Foundation, Inc.
294634f90d55Smrg#
294740c5823bSmrg# This file is free software; the Free Software Foundation
294840c5823bSmrg# gives unlimited permission to copy and/or distribute it,
294940c5823bSmrg# with or without modifications, as long as this notice is preserved.
295040c5823bSmrg
295140c5823bSmrg
295240c5823bSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
295340c5823bSmrg# written in clear, in which case automake, when reading aclocal.m4,
295440c5823bSmrg# will think it sees a *use*, and therefore will trigger all it's
295540c5823bSmrg# C support machinery.  Also note that it means that autoscan, seeing
295640c5823bSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
295740c5823bSmrg
295840c5823bSmrg
295940c5823bSmrg# _AM_DEPENDENCIES(NAME)
296040c5823bSmrg# ----------------------
296140c5823bSmrg# See how the compiler implements dependency checking.
296240c5823bSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
296340c5823bSmrg# We try a few techniques and use that to set a single cache variable.
296434f90d55Smrg#
296540c5823bSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
296640c5823bSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
296740c5823bSmrg# dependency, and given that the user is not expected to run this macro,
296840c5823bSmrg# just rely on AC_PROG_CC.
296940c5823bSmrgAC_DEFUN([_AM_DEPENDENCIES],
297040c5823bSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
297140c5823bSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
297240c5823bSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
297340c5823bSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
297440c5823bSmrg
297540c5823bSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
297640c5823bSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
297740c5823bSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
297840c5823bSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
297940c5823bSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
298040c5823bSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
298140c5823bSmrg                    [depcc="$$1"   am_compiler_list=])
298240c5823bSmrg
298340c5823bSmrgAC_CACHE_CHECK([dependency style of $depcc],
298440c5823bSmrg               [am_cv_$1_dependencies_compiler_type],
298540c5823bSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
298640c5823bSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
298740c5823bSmrg  # making bogus files that we don't know about and never remove.  For
298840c5823bSmrg  # instance it was reported that on HP-UX the gcc test will end up
298940c5823bSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
299040c5823bSmrg  # in D".
299140c5823bSmrg  rm -rf conftest.dir
299240c5823bSmrg  mkdir conftest.dir
299340c5823bSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
299440c5823bSmrg  # using a relative directory.
299540c5823bSmrg  cp "$am_depcomp" conftest.dir
299640c5823bSmrg  cd conftest.dir
299740c5823bSmrg  # We will build objects and dependencies in a subdirectory because
299840c5823bSmrg  # it helps to detect inapplicable dependency modes.  For instance
299940c5823bSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
300040c5823bSmrg  # side effect of compilation, but ICC will put the dependencies in
300140c5823bSmrg  # the current directory while Tru64 will put them in the object
300240c5823bSmrg  # directory.
300340c5823bSmrg  mkdir sub
300440c5823bSmrg
300540c5823bSmrg  am_cv_$1_dependencies_compiler_type=none
300640c5823bSmrg  if test "$am_compiler_list" = ""; then
300740c5823bSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
300834f90d55Smrg  fi
300940c5823bSmrg  am__universal=false
301040c5823bSmrg  m4_case([$1], [CC],
301140c5823bSmrg    [case " $depcc " in #(
301240c5823bSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
301340c5823bSmrg     esac],
301440c5823bSmrg    [CXX],
301540c5823bSmrg    [case " $depcc " in #(
301640c5823bSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
301740c5823bSmrg     esac])
301840c5823bSmrg
301940c5823bSmrg  for depmode in $am_compiler_list; do
302040c5823bSmrg    # Setup a source with many dependencies, because some compilers
302140c5823bSmrg    # like to wrap large dependency lists on column 80 (with \), and
302240c5823bSmrg    # we should not choose a depcomp mode which is confused by this.
302340c5823bSmrg    #
302440c5823bSmrg    # We need to recreate these files for each test, as the compiler may
302540c5823bSmrg    # overwrite some of them when testing with obscure command lines.
302640c5823bSmrg    # This happens at least with the AIX C compiler.
302740c5823bSmrg    : > sub/conftest.c
302840c5823bSmrg    for i in 1 2 3 4 5 6; do
302940c5823bSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
303040c5823bSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
303140c5823bSmrg      # Solaris 10 /bin/sh.
303240c5823bSmrg      echo '/* dummy */' > sub/conftst$i.h
303340c5823bSmrg    done
303440c5823bSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
303540c5823bSmrg
303640c5823bSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
303740c5823bSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
303840c5823bSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
303940c5823bSmrg    # versions had trouble with output in subdirs.
304040c5823bSmrg    am__obj=sub/conftest.${OBJEXT-o}
304140c5823bSmrg    am__minus_obj="-o $am__obj"
304240c5823bSmrg    case $depmode in
304340c5823bSmrg    gcc)
304440c5823bSmrg      # This depmode causes a compiler race in universal mode.
304540c5823bSmrg      test "$am__universal" = false || continue
304640c5823bSmrg      ;;
304740c5823bSmrg    nosideeffect)
304840c5823bSmrg      # After this tag, mechanisms are not by side-effect, so they'll
304940c5823bSmrg      # only be used when explicitly requested.
305040c5823bSmrg      if test "x$enable_dependency_tracking" = xyes; then
305140c5823bSmrg	continue
305240c5823bSmrg      else
305340c5823bSmrg	break
305440c5823bSmrg      fi
305540c5823bSmrg      ;;
305640c5823bSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
305740c5823bSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
305840c5823bSmrg      # not run yet.  These depmodes are late enough in the game, and
305940c5823bSmrg      # so weak that their functioning should not be impacted.
306040c5823bSmrg      am__obj=conftest.${OBJEXT-o}
306140c5823bSmrg      am__minus_obj=
306240c5823bSmrg      ;;
306340c5823bSmrg    none) break ;;
306440c5823bSmrg    esac
306540c5823bSmrg    if depmode=$depmode \
306640c5823bSmrg       source=sub/conftest.c object=$am__obj \
306740c5823bSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
306840c5823bSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
306940c5823bSmrg         >/dev/null 2>conftest.err &&
307040c5823bSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
307140c5823bSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
307240c5823bSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
307340c5823bSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
307440c5823bSmrg      # icc doesn't choke on unknown options, it will just issue warnings
307540c5823bSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
307640c5823bSmrg      # that says an option was ignored or not supported.
307740c5823bSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
307840c5823bSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
307940c5823bSmrg      # The diagnosis changed in icc 8.0:
308040c5823bSmrg      #   icc: Command line remark: option '-MP' not supported
308140c5823bSmrg      if (grep 'ignoring option' conftest.err ||
308240c5823bSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
308340c5823bSmrg        am_cv_$1_dependencies_compiler_type=$depmode
308440c5823bSmrg        break
308540c5823bSmrg      fi
308640c5823bSmrg    fi
308740c5823bSmrg  done
308834f90d55Smrg
308940c5823bSmrg  cd ..
309040c5823bSmrg  rm -rf conftest.dir
309134f90d55Smrgelse
309240c5823bSmrg  am_cv_$1_dependencies_compiler_type=none
309334f90d55Smrgfi
309440c5823bSmrg])
309540c5823bSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
309640c5823bSmrgAM_CONDITIONAL([am__fastdep$1], [
309740c5823bSmrg  test "x$enable_dependency_tracking" != xno \
309840c5823bSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
309940c5823bSmrg])
310034f90d55Smrg
310134f90d55Smrg
310240c5823bSmrg# AM_SET_DEPDIR
310340c5823bSmrg# -------------
310440c5823bSmrg# Choose a directory name for dependency files.
310540c5823bSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
310640c5823bSmrgAC_DEFUN([AM_SET_DEPDIR],
310740c5823bSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
310840c5823bSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
310940c5823bSmrg])
311034f90d55Smrg
311134f90d55Smrg
311240c5823bSmrg# AM_DEP_TRACK
311340c5823bSmrg# ------------
311440c5823bSmrgAC_DEFUN([AM_DEP_TRACK],
311540c5823bSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
311640c5823bSmrgAS_HELP_STRING(
311740c5823bSmrg  [--enable-dependency-tracking],
311840c5823bSmrg  [do not reject slow dependency extractors])
311940c5823bSmrgAS_HELP_STRING(
312040c5823bSmrg  [--disable-dependency-tracking],
312140c5823bSmrg  [speeds up one-time build])])
312240c5823bSmrgif test "x$enable_dependency_tracking" != xno; then
312340c5823bSmrg  am_depcomp="$ac_aux_dir/depcomp"
312440c5823bSmrg  AMDEPBACKSLASH='\'
312540c5823bSmrg  am__nodep='_no'
312634f90d55Smrgfi
312740c5823bSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
312840c5823bSmrgAC_SUBST([AMDEPBACKSLASH])dnl
312940c5823bSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
313040c5823bSmrgAC_SUBST([am__nodep])dnl
313140c5823bSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
313240c5823bSmrg])
313334f90d55Smrg
313440c5823bSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
313534f90d55Smrg
313640c5823bSmrg# Copyright (C) 1999-2017 Free Software Foundation, Inc.
3137ce6676dbSmrg#
313840c5823bSmrg# This file is free software; the Free Software Foundation
313940c5823bSmrg# gives unlimited permission to copy and/or distribute it,
314040c5823bSmrg# with or without modifications, as long as this notice is preserved.
3141ce6676dbSmrg
3142ce6676dbSmrg
314340c5823bSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
314440c5823bSmrg# ------------------------------
314540c5823bSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
314640c5823bSmrg[{
314740c5823bSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
314840c5823bSmrg  # are listed without --file.  Let's play safe and only enable the eval
314940c5823bSmrg  # if we detect the quoting.
315040c5823bSmrg  case $CONFIG_FILES in
315140c5823bSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
315240c5823bSmrg  *)   set x $CONFIG_FILES ;;
315340c5823bSmrg  esac
315440c5823bSmrg  shift
315540c5823bSmrg  for mf
315640c5823bSmrg  do
315740c5823bSmrg    # Strip MF so we end up with the name of the file.
315840c5823bSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
315940c5823bSmrg    # Check whether this is an Automake generated Makefile or not.
316040c5823bSmrg    # We used to match only the files named 'Makefile.in', but
316140c5823bSmrg    # some people rename them; so instead we look at the file content.
316240c5823bSmrg    # Grep'ing the first line is not enough: some people post-process
316340c5823bSmrg    # each Makefile.in and add a new line on top of each file to say so.
316440c5823bSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
316540c5823bSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
316640c5823bSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
316740c5823bSmrg      dirpart=`AS_DIRNAME("$mf")`
316840c5823bSmrg    else
316940c5823bSmrg      continue
317040c5823bSmrg    fi
317140c5823bSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
317240c5823bSmrg    # from the Makefile without running 'make'.
317340c5823bSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
317440c5823bSmrg    test -z "$DEPDIR" && continue
317540c5823bSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
317640c5823bSmrg    test -z "$am__include" && continue
317740c5823bSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
317840c5823bSmrg    # Find all dependency output files, they are included files with
317940c5823bSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
318040c5823bSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
318140c5823bSmrg    # expansion.
318240c5823bSmrg    for file in `sed -n "
318340c5823bSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
318440c5823bSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
318540c5823bSmrg      # Make sure the directory exists.
318640c5823bSmrg      test -f "$dirpart/$file" && continue
318740c5823bSmrg      fdir=`AS_DIRNAME(["$file"])`
318840c5823bSmrg      AS_MKDIR_P([$dirpart/$fdir])
318940c5823bSmrg      # echo "creating $dirpart/$file"
319040c5823bSmrg      echo '# dummy' > "$dirpart/$file"
319140c5823bSmrg    done
319240c5823bSmrg  done
319340c5823bSmrg}
319440c5823bSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3195ce6676dbSmrg
3196ce6676dbSmrg
319740c5823bSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
319840c5823bSmrg# -----------------------------
319940c5823bSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
320030f8ce46Smrg#
320140c5823bSmrg# This code is only required when automatic dependency tracking
320240c5823bSmrg# is enabled.  FIXME.  This creates each '.P' file that we will
320340c5823bSmrg# need in order to bootstrap the dependency handling code.
320440c5823bSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
320540c5823bSmrg[AC_CONFIG_COMMANDS([depfiles],
320640c5823bSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
320740c5823bSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
320840c5823bSmrg])
320940c5823bSmrg
321040c5823bSmrg# Do all the work for Automake.                             -*- Autoconf -*-
321140c5823bSmrg
321240c5823bSmrg# Copyright (C) 1996-2017 Free Software Foundation, Inc.
3213ce6676dbSmrg#
321440c5823bSmrg# This file is free software; the Free Software Foundation
321540c5823bSmrg# gives unlimited permission to copy and/or distribute it,
321640c5823bSmrg# with or without modifications, as long as this notice is preserved.
3217ce6676dbSmrg
321840c5823bSmrg# This macro actually does too much.  Some checks are only needed if
321940c5823bSmrg# your package does certain things.  But this isn't really a big deal.
322030f8ce46Smrg
322140c5823bSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
322240c5823bSmrgm4_define([AC_PROG_CC],
322340c5823bSmrgm4_defn([AC_PROG_CC])
322440c5823bSmrg[_AM_PROG_CC_C_O
322540c5823bSmrg])
322630f8ce46Smrg
322740c5823bSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
322840c5823bSmrg# AM_INIT_AUTOMAKE([OPTIONS])
322940c5823bSmrg# -----------------------------------------------
323040c5823bSmrg# The call with PACKAGE and VERSION arguments is the old style
323140c5823bSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
323240c5823bSmrg# and VERSION should now be passed to AC_INIT and removed from
323340c5823bSmrg# the call to AM_INIT_AUTOMAKE.
323440c5823bSmrg# We support both call styles for the transition.  After
323540c5823bSmrg# the next Automake release, Autoconf can make the AC_INIT
323640c5823bSmrg# arguments mandatory, and then we can depend on a new Autoconf
323740c5823bSmrg# release and drop the old call support.
323840c5823bSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
323940c5823bSmrg[AC_PREREQ([2.65])dnl
324040c5823bSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
324140c5823bSmrgdnl the ones we care about.
324240c5823bSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
324340c5823bSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
324440c5823bSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
324540c5823bSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
324640c5823bSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
324740c5823bSmrg  # is not polluted with repeated "-I."
324840c5823bSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
324940c5823bSmrg  # test to see if srcdir already configured
325040c5823bSmrg  if test -f $srcdir/config.status; then
325140c5823bSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
325240c5823bSmrg  fi
3253ce6676dbSmrgfi
325430f8ce46Smrg
325540c5823bSmrg# test whether we have cygpath
325640c5823bSmrgif test -z "$CYGPATH_W"; then
325740c5823bSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
325840c5823bSmrg    CYGPATH_W='cygpath -w'
325940c5823bSmrg  else
326040c5823bSmrg    CYGPATH_W=echo
326140c5823bSmrg  fi
3262ce6676dbSmrgfi
326340c5823bSmrgAC_SUBST([CYGPATH_W])
3264ce6676dbSmrg
326540c5823bSmrg# Define the identity of the package.
326640c5823bSmrgdnl Distinguish between old-style and new-style calls.
326740c5823bSmrgm4_ifval([$2],
326840c5823bSmrg[AC_DIAGNOSE([obsolete],
326940c5823bSmrg             [$0: two- and three-arguments forms are deprecated.])
327040c5823bSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
327140c5823bSmrg AC_SUBST([PACKAGE], [$1])dnl
327240c5823bSmrg AC_SUBST([VERSION], [$2])],
327340c5823bSmrg[_AM_SET_OPTIONS([$1])dnl
327440c5823bSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
327540c5823bSmrgm4_if(
327640c5823bSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
327740c5823bSmrg  [ok:ok],,
327840c5823bSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
327940c5823bSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
328040c5823bSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
328130f8ce46Smrg
328240c5823bSmrg_AM_IF_OPTION([no-define],,
328340c5823bSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
328440c5823bSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
3285ce6676dbSmrg
328640c5823bSmrg# Some tools Automake needs.
328740c5823bSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
328840c5823bSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
328940c5823bSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
329040c5823bSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
329140c5823bSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
329240c5823bSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
329340c5823bSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
329440c5823bSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
329540c5823bSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
329640c5823bSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
329740c5823bSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
329840c5823bSmrg# dies out for good.  For more background, see:
329940c5823bSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
330040c5823bSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
330140c5823bSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
330240c5823bSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
330340c5823bSmrg# system "awk" is bad on some platforms.
330440c5823bSmrgAC_REQUIRE([AC_PROG_AWK])dnl
330540c5823bSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
330640c5823bSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
330740c5823bSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
330840c5823bSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
330940c5823bSmrg			     [_AM_PROG_TAR([v7])])])
331040c5823bSmrg_AM_IF_OPTION([no-dependencies],,
331140c5823bSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
331240c5823bSmrg		  [_AM_DEPENDENCIES([CC])],
331340c5823bSmrg		  [m4_define([AC_PROG_CC],
331440c5823bSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
331540c5823bSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
331640c5823bSmrg		  [_AM_DEPENDENCIES([CXX])],
331740c5823bSmrg		  [m4_define([AC_PROG_CXX],
331840c5823bSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
331940c5823bSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
332040c5823bSmrg		  [_AM_DEPENDENCIES([OBJC])],
332140c5823bSmrg		  [m4_define([AC_PROG_OBJC],
332240c5823bSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
332340c5823bSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
332440c5823bSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
332540c5823bSmrg		  [m4_define([AC_PROG_OBJCXX],
332640c5823bSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
332740c5823bSmrg])
332840c5823bSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
332940c5823bSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
333040c5823bSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
333140c5823bSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
333240c5823bSmrgAC_CONFIG_COMMANDS_PRE(dnl
333340c5823bSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
333440c5823bSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
3335ce6676dbSmrg
333640c5823bSmrg# POSIX will say in a future version that running "rm -f" with no argument
333740c5823bSmrg# is OK; and we want to be able to make that assumption in our Makefile
333840c5823bSmrg# recipes.  So use an aggressive probe to check that the usage we want is
333940c5823bSmrg# actually supported "in the wild" to an acceptable degree.
334040c5823bSmrg# See automake bug#10828.
334140c5823bSmrg# To make any issue more visible, cause the running configure to be aborted
334240c5823bSmrg# by default if the 'rm' program in use doesn't match our expectations; the
334340c5823bSmrg# user can still override this though.
334440c5823bSmrgif rm -f && rm -fr && rm -rf; then : OK; else
334540c5823bSmrg  cat >&2 <<'END'
334640c5823bSmrgOops!
334734f90d55Smrg
334840c5823bSmrgYour 'rm' program seems unable to run without file operands specified
334940c5823bSmrgon the command line, even when the '-f' option is present.  This is contrary
335040c5823bSmrgto the behaviour of most rm programs out there, and not conforming with
335140c5823bSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
335234f90d55Smrg
335340c5823bSmrgPlease tell bug-automake@gnu.org about your system, including the value
335440c5823bSmrgof your $PATH and any error possibly output before this message.  This
335540c5823bSmrgcan help us improve future automake versions.
335634f90d55Smrg
335740c5823bSmrgEND
335840c5823bSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
335940c5823bSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
336040c5823bSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
336140c5823bSmrg    echo >&2
336240c5823bSmrg  else
336340c5823bSmrg    cat >&2 <<'END'
336440c5823bSmrgAborting the configuration process, to ensure you take notice of the issue.
336534f90d55Smrg
336640c5823bSmrgYou can download and install GNU coreutils to get an 'rm' implementation
336740c5823bSmrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
336834f90d55Smrg
336940c5823bSmrgIf you want to complete the configuration process using your problematic
337040c5823bSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
337140c5823bSmrgto "yes", and re-run configure.
337234f90d55Smrg
337340c5823bSmrgEND
337440c5823bSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
337540c5823bSmrg  fi
337634f90d55Smrgfi
337740c5823bSmrgdnl The trailing newline in this macro's definition is deliberate, for
337840c5823bSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
337940c5823bSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
338040c5823bSmrg])
338134f90d55Smrg
338240c5823bSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
338340c5823bSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
338440c5823bSmrgdnl mangled by Autoconf and run in a shell conditional statement.
338540c5823bSmrgm4_define([_AC_COMPILER_EXEEXT],
338640c5823bSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
338734f90d55Smrg
338840c5823bSmrg# When config.status generates a header, we must update the stamp-h file.
338940c5823bSmrg# This file resides in the same directory as the config header
339040c5823bSmrg# that is generated.  The stamp files are numbered to have different names.
339134f90d55Smrg
339240c5823bSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
339340c5823bSmrg# loop where config.status creates the headers, so we can generate
339440c5823bSmrg# our stamp files there.
339540c5823bSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
339640c5823bSmrg[# Compute $1's index in $config_headers.
339740c5823bSmrg_am_arg=$1
339840c5823bSmrg_am_stamp_count=1
339940c5823bSmrgfor _am_header in $config_headers :; do
340040c5823bSmrg  case $_am_header in
340140c5823bSmrg    $_am_arg | $_am_arg:* )
340240c5823bSmrg      break ;;
340340c5823bSmrg    * )
340440c5823bSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
340540c5823bSmrg  esac
340640c5823bSmrgdone
340740c5823bSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
340834f90d55Smrg
340940c5823bSmrg# Copyright (C) 2001-2017 Free Software Foundation, Inc.
341040c5823bSmrg#
341140c5823bSmrg# This file is free software; the Free Software Foundation
341240c5823bSmrg# gives unlimited permission to copy and/or distribute it,
341340c5823bSmrg# with or without modifications, as long as this notice is preserved.
341434f90d55Smrg
341540c5823bSmrg# AM_PROG_INSTALL_SH
341640c5823bSmrg# ------------------
341740c5823bSmrg# Define $install_sh.
341840c5823bSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
341940c5823bSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
342040c5823bSmrgif test x"${install_sh+set}" != xset; then
342140c5823bSmrg  case $am_aux_dir in
342240c5823bSmrg  *\ * | *\	*)
342340c5823bSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
342440c5823bSmrg  *)
342540c5823bSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
342640c5823bSmrg  esac
342740c5823bSmrgfi
342840c5823bSmrgAC_SUBST([install_sh])])
342934f90d55Smrg
343040c5823bSmrg# Copyright (C) 2003-2017 Free Software Foundation, Inc.
343134f90d55Smrg#
343240c5823bSmrg# This file is free software; the Free Software Foundation
343340c5823bSmrg# gives unlimited permission to copy and/or distribute it,
343440c5823bSmrg# with or without modifications, as long as this notice is preserved.
343534f90d55Smrg
343640c5823bSmrg# Check whether the underlying file-system supports filenames
343740c5823bSmrg# with a leading dot.  For instance MS-DOS doesn't.
343840c5823bSmrgAC_DEFUN([AM_SET_LEADING_DOT],
343940c5823bSmrg[rm -rf .tst 2>/dev/null
344040c5823bSmrgmkdir .tst 2>/dev/null
344140c5823bSmrgif test -d .tst; then
344240c5823bSmrg  am__leading_dot=.
344334f90d55Smrgelse
344440c5823bSmrg  am__leading_dot=_
344534f90d55Smrgfi
344640c5823bSmrgrmdir .tst 2>/dev/null
344740c5823bSmrgAC_SUBST([am__leading_dot])])
344834f90d55Smrg
344940c5823bSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
345034f90d55Smrg
345140c5823bSmrg# Copyright (C) 2001-2017 Free Software Foundation, Inc.
345240c5823bSmrg#
345340c5823bSmrg# This file is free software; the Free Software Foundation
345440c5823bSmrg# gives unlimited permission to copy and/or distribute it,
345540c5823bSmrg# with or without modifications, as long as this notice is preserved.
345640c5823bSmrg
345740c5823bSmrg# AM_MAKE_INCLUDE()
345840c5823bSmrg# -----------------
345940c5823bSmrg# Check to see how make treats includes.
346040c5823bSmrgAC_DEFUN([AM_MAKE_INCLUDE],
346140c5823bSmrg[am_make=${MAKE-make}
346240c5823bSmrgcat > confinc << 'END'
346340c5823bSmrgam__doit:
346440c5823bSmrg	@echo this is the am__doit target
346540c5823bSmrg.PHONY: am__doit
346640c5823bSmrgEND
346740c5823bSmrg# If we don't find an include directive, just comment out the code.
346840c5823bSmrgAC_MSG_CHECKING([for style of include used by $am_make])
346940c5823bSmrgam__include="#"
347040c5823bSmrgam__quote=
347140c5823bSmrg_am_result=none
347240c5823bSmrg# First try GNU make style include.
347340c5823bSmrgecho "include confinc" > confmf
347440c5823bSmrg# Ignore all kinds of additional output from 'make'.
347540c5823bSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
347640c5823bSmrg*the\ am__doit\ target*)
347740c5823bSmrg  am__include=include
347840c5823bSmrg  am__quote=
347940c5823bSmrg  _am_result=GNU
348040c5823bSmrg  ;;
348140c5823bSmrgesac
348240c5823bSmrg# Now try BSD make style include.
348340c5823bSmrgif test "$am__include" = "#"; then
348440c5823bSmrg   echo '.include "confinc"' > confmf
348540c5823bSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
348640c5823bSmrg   *the\ am__doit\ target*)
348740c5823bSmrg     am__include=.include
348840c5823bSmrg     am__quote="\""
348940c5823bSmrg     _am_result=BSD
349040c5823bSmrg     ;;
349140c5823bSmrg   esac
349240c5823bSmrgfi
349340c5823bSmrgAC_SUBST([am__include])
349440c5823bSmrgAC_SUBST([am__quote])
349540c5823bSmrgAC_MSG_RESULT([$_am_result])
349640c5823bSmrgrm -f confinc confmf
349740c5823bSmrg])
349834f90d55Smrg
349940c5823bSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
350034f90d55Smrg
350140c5823bSmrg# Copyright (C) 1997-2017 Free Software Foundation, Inc.
350240c5823bSmrg#
350340c5823bSmrg# This file is free software; the Free Software Foundation
350440c5823bSmrg# gives unlimited permission to copy and/or distribute it,
350540c5823bSmrg# with or without modifications, as long as this notice is preserved.
350634f90d55Smrg
350740c5823bSmrg# AM_MISSING_PROG(NAME, PROGRAM)
350840c5823bSmrg# ------------------------------
350940c5823bSmrgAC_DEFUN([AM_MISSING_PROG],
351040c5823bSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
351140c5823bSmrg$1=${$1-"${am_missing_run}$2"}
351240c5823bSmrgAC_SUBST($1)])
351334f90d55Smrg
351440c5823bSmrg# AM_MISSING_HAS_RUN
351540c5823bSmrg# ------------------
351640c5823bSmrg# Define MISSING if not defined so far and test if it is modern enough.
351740c5823bSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
351840c5823bSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
351940c5823bSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
352040c5823bSmrgAC_REQUIRE_AUX_FILE([missing])dnl
352140c5823bSmrgif test x"${MISSING+set}" != xset; then
352240c5823bSmrg  case $am_aux_dir in
352340c5823bSmrg  *\ * | *\	*)
352440c5823bSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
352540c5823bSmrg  *)
352640c5823bSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
352740c5823bSmrg  esac
352840c5823bSmrgfi
352940c5823bSmrg# Use eval to expand $SHELL
353040c5823bSmrgif eval "$MISSING --is-lightweight"; then
353140c5823bSmrg  am_missing_run="$MISSING "
353234f90d55Smrgelse
353340c5823bSmrg  am_missing_run=
353440c5823bSmrg  AC_MSG_WARN(['missing' script is too old or missing])
353534f90d55Smrgfi
353640c5823bSmrg])
353734f90d55Smrg
353840c5823bSmrg# Helper functions for option handling.                     -*- Autoconf -*-
353934f90d55Smrg
354040c5823bSmrg# Copyright (C) 2001-2017 Free Software Foundation, Inc.
354134f90d55Smrg#
354240c5823bSmrg# This file is free software; the Free Software Foundation
354340c5823bSmrg# gives unlimited permission to copy and/or distribute it,
354440c5823bSmrg# with or without modifications, as long as this notice is preserved.
354530f8ce46Smrg
354640c5823bSmrg# _AM_MANGLE_OPTION(NAME)
354730f8ce46Smrg# -----------------------
354840c5823bSmrgAC_DEFUN([_AM_MANGLE_OPTION],
354940c5823bSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
355040c5823bSmrg
355140c5823bSmrg# _AM_SET_OPTION(NAME)
355240c5823bSmrg# --------------------
355340c5823bSmrg# Set option NAME.  Presently that only means defining a flag for this option.
355440c5823bSmrgAC_DEFUN([_AM_SET_OPTION],
355540c5823bSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
355640c5823bSmrg
355740c5823bSmrg# _AM_SET_OPTIONS(OPTIONS)
355840c5823bSmrg# ------------------------
355940c5823bSmrg# OPTIONS is a space-separated list of Automake options.
356040c5823bSmrgAC_DEFUN([_AM_SET_OPTIONS],
356140c5823bSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
356240c5823bSmrg
356340c5823bSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
356440c5823bSmrg# -------------------------------------------
356540c5823bSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
356640c5823bSmrgAC_DEFUN([_AM_IF_OPTION],
356740c5823bSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
356840c5823bSmrg
356940c5823bSmrg# Copyright (C) 1999-2017 Free Software Foundation, Inc.
357030f8ce46Smrg#
357140c5823bSmrg# This file is free software; the Free Software Foundation
357240c5823bSmrg# gives unlimited permission to copy and/or distribute it,
357340c5823bSmrg# with or without modifications, as long as this notice is preserved.
357440c5823bSmrg
357540c5823bSmrg# _AM_PROG_CC_C_O
357640c5823bSmrg# ---------------
357740c5823bSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
357840c5823bSmrg# to automatically call this.
357940c5823bSmrgAC_DEFUN([_AM_PROG_CC_C_O],
358040c5823bSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
358140c5823bSmrgAC_REQUIRE_AUX_FILE([compile])dnl
358240c5823bSmrgAC_LANG_PUSH([C])dnl
358340c5823bSmrgAC_CACHE_CHECK(
358440c5823bSmrg  [whether $CC understands -c and -o together],
358540c5823bSmrg  [am_cv_prog_cc_c_o],
358640c5823bSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
358740c5823bSmrg  # Make sure it works both with $CC and with simple cc.
358840c5823bSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
358940c5823bSmrg  # compilers refuse to overwrite an existing .o file with -o,
359040c5823bSmrg  # though they will create one.
359140c5823bSmrg  am_cv_prog_cc_c_o=yes
359240c5823bSmrg  for am_i in 1 2; do
359340c5823bSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
359440c5823bSmrg         && test -f conftest2.$ac_objext; then
359540c5823bSmrg      : OK
359640c5823bSmrg    else
359740c5823bSmrg      am_cv_prog_cc_c_o=no
359840c5823bSmrg      break
359940c5823bSmrg    fi
360040c5823bSmrg  done
360140c5823bSmrg  rm -f core conftest*
360240c5823bSmrg  unset am_i])
360340c5823bSmrgif test "$am_cv_prog_cc_c_o" != yes; then
360440c5823bSmrg   # Losing compiler, so override with the script.
360540c5823bSmrg   # FIXME: It is wrong to rewrite CC.
360640c5823bSmrg   # But if we don't then we get into trouble of one sort or another.
360740c5823bSmrg   # A longer-term fix would be to have automake use am__CC in this case,
360840c5823bSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
360940c5823bSmrg   CC="$am_aux_dir/compile $CC"
361040c5823bSmrgfi
361140c5823bSmrgAC_LANG_POP([C])])
361240c5823bSmrg
361340c5823bSmrg# For backward compatibility.
361440c5823bSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
361540c5823bSmrg
361640c5823bSmrg# Copyright (C) 2001-2017 Free Software Foundation, Inc.
361734f90d55Smrg#
361840c5823bSmrg# This file is free software; the Free Software Foundation
361940c5823bSmrg# gives unlimited permission to copy and/or distribute it,
362040c5823bSmrg# with or without modifications, as long as this notice is preserved.
362130f8ce46Smrg
362240c5823bSmrg# AM_RUN_LOG(COMMAND)
362340c5823bSmrg# -------------------
362440c5823bSmrg# Run COMMAND, save the exit status in ac_status, and log it.
362540c5823bSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
362640c5823bSmrgAC_DEFUN([AM_RUN_LOG],
362740c5823bSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
362840c5823bSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
362940c5823bSmrg   ac_status=$?
363040c5823bSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
363140c5823bSmrg   (exit $ac_status); }])
363234f90d55Smrg
363340c5823bSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
363434f90d55Smrg
363540c5823bSmrg# Copyright (C) 1996-2017 Free Software Foundation, Inc.
363640c5823bSmrg#
363740c5823bSmrg# This file is free software; the Free Software Foundation
363840c5823bSmrg# gives unlimited permission to copy and/or distribute it,
363940c5823bSmrg# with or without modifications, as long as this notice is preserved.
364034f90d55Smrg
364140c5823bSmrg# AM_SANITY_CHECK
364240c5823bSmrg# ---------------
364340c5823bSmrgAC_DEFUN([AM_SANITY_CHECK],
364440c5823bSmrg[AC_MSG_CHECKING([whether build environment is sane])
364540c5823bSmrg# Reject unsafe characters in $srcdir or the absolute working directory
364640c5823bSmrg# name.  Accept space and tab only in the latter.
364740c5823bSmrgam_lf='
364840c5823bSmrg'
364940c5823bSmrgcase `pwd` in
365040c5823bSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
365140c5823bSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
365240c5823bSmrgesac
365340c5823bSmrgcase $srcdir in
365440c5823bSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
365540c5823bSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
365640c5823bSmrgesac
365740c5823bSmrg
365840c5823bSmrg# Do 'set' in a subshell so we don't clobber the current shell's
365940c5823bSmrg# arguments.  Must try -L first in case configure is actually a
366040c5823bSmrg# symlink; some systems play weird games with the mod time of symlinks
366140c5823bSmrg# (eg FreeBSD returns the mod time of the symlink's containing
366240c5823bSmrg# directory).
366340c5823bSmrgif (
366440c5823bSmrg   am_has_slept=no
366540c5823bSmrg   for am_try in 1 2; do
366640c5823bSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
366740c5823bSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
366840c5823bSmrg     if test "$[*]" = "X"; then
366940c5823bSmrg	# -L didn't work.
367040c5823bSmrg	set X `ls -t "$srcdir/configure" conftest.file`
367140c5823bSmrg     fi
367240c5823bSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
367340c5823bSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
367434f90d55Smrg
367540c5823bSmrg	# If neither matched, then we have a broken ls.  This can happen
367640c5823bSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
367740c5823bSmrg	# broken ls alias from the environment.  This has actually
367840c5823bSmrg	# happened.  Such a system could not be considered "sane".
367940c5823bSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
368040c5823bSmrg  alias in your environment])
368140c5823bSmrg     fi
368240c5823bSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
368340c5823bSmrg       break
368440c5823bSmrg     fi
368540c5823bSmrg     # Just in case.
368640c5823bSmrg     sleep 1
368740c5823bSmrg     am_has_slept=yes
368840c5823bSmrg   done
368940c5823bSmrg   test "$[2]" = conftest.file
369040c5823bSmrg   )
369140c5823bSmrgthen
369240c5823bSmrg   # Ok.
369340c5823bSmrg   :
369440c5823bSmrgelse
369540c5823bSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
369640c5823bSmrgCheck your system clock])
369730f8ce46Smrgfi
369840c5823bSmrgAC_MSG_RESULT([yes])
369940c5823bSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
370040c5823bSmrg# generated files are strictly newer.
370140c5823bSmrgam_sleep_pid=
370240c5823bSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
370340c5823bSmrg  ( sleep 1 ) &
370440c5823bSmrg  am_sleep_pid=$!
370540c5823bSmrgfi
370640c5823bSmrgAC_CONFIG_COMMANDS_PRE(
370740c5823bSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
370840c5823bSmrg   if test -n "$am_sleep_pid"; then
370940c5823bSmrg     # Hide warnings about reused PIDs.
371040c5823bSmrg     wait $am_sleep_pid 2>/dev/null
371140c5823bSmrg   fi
371240c5823bSmrg   AC_MSG_RESULT([done])])
371340c5823bSmrgrm -f conftest.file
371440c5823bSmrg])
371530f8ce46Smrg
371640c5823bSmrg# Copyright (C) 2009-2017 Free Software Foundation, Inc.
371730f8ce46Smrg#
371840c5823bSmrg# This file is free software; the Free Software Foundation
371940c5823bSmrg# gives unlimited permission to copy and/or distribute it,
372040c5823bSmrg# with or without modifications, as long as this notice is preserved.
372130f8ce46Smrg
372240c5823bSmrg# AM_SILENT_RULES([DEFAULT])
372340c5823bSmrg# --------------------------
372440c5823bSmrg# Enable less verbose build rules; with the default set to DEFAULT
372540c5823bSmrg# ("yes" being less verbose, "no" or empty being verbose).
372640c5823bSmrgAC_DEFUN([AM_SILENT_RULES],
372740c5823bSmrg[AC_ARG_ENABLE([silent-rules], [dnl
372840c5823bSmrgAS_HELP_STRING(
372940c5823bSmrg  [--enable-silent-rules],
373040c5823bSmrg  [less verbose build output (undo: "make V=1")])
373140c5823bSmrgAS_HELP_STRING(
373240c5823bSmrg  [--disable-silent-rules],
373340c5823bSmrg  [verbose build output (undo: "make V=0")])dnl
373440c5823bSmrg])
373540c5823bSmrgcase $enable_silent_rules in @%:@ (((
373640c5823bSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
373740c5823bSmrg   no) AM_DEFAULT_VERBOSITY=1;;
373840c5823bSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
373940c5823bSmrgesac
3740ce6676dbSmrgdnl
374140c5823bSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
374240c5823bSmrgdnl do not support nested variable expansions.
374340c5823bSmrgdnl See automake bug#9928 and bug#10237.
374440c5823bSmrgam_make=${MAKE-make}
374540c5823bSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
374640c5823bSmrg   [am_cv_make_support_nested_variables],
374740c5823bSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
374840c5823bSmrgBAR0=false
374940c5823bSmrgBAR1=true
375040c5823bSmrgV=1
375140c5823bSmrgam__doit:
375240c5823bSmrg	@$(TRUE)
375340c5823bSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
375440c5823bSmrg  am_cv_make_support_nested_variables=yes
375540c5823bSmrgelse
375640c5823bSmrg  am_cv_make_support_nested_variables=no
375740c5823bSmrgfi])
375840c5823bSmrgif test $am_cv_make_support_nested_variables = yes; then
375940c5823bSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
376040c5823bSmrg  AM_V='$(V)'
376140c5823bSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
376240c5823bSmrgelse
376340c5823bSmrg  AM_V=$AM_DEFAULT_VERBOSITY
376440c5823bSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
376540c5823bSmrgfi
376640c5823bSmrgAC_SUBST([AM_V])dnl
376740c5823bSmrgAM_SUBST_NOTMAKE([AM_V])dnl
376840c5823bSmrgAC_SUBST([AM_DEFAULT_V])dnl
376940c5823bSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
377040c5823bSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
377140c5823bSmrgAM_BACKSLASH='\'
377240c5823bSmrgAC_SUBST([AM_BACKSLASH])dnl
377340c5823bSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
3774ce6676dbSmrg])
3775ce6676dbSmrg
377640c5823bSmrg# Copyright (C) 2001-2017 Free Software Foundation, Inc.
3777ce6676dbSmrg#
377840c5823bSmrg# This file is free software; the Free Software Foundation
377940c5823bSmrg# gives unlimited permission to copy and/or distribute it,
378040c5823bSmrg# with or without modifications, as long as this notice is preserved.
378140c5823bSmrg
378240c5823bSmrg# AM_PROG_INSTALL_STRIP
378340c5823bSmrg# ---------------------
378440c5823bSmrg# One issue with vendor 'install' (even GNU) is that you can't
378540c5823bSmrg# specify the program used to strip binaries.  This is especially
378640c5823bSmrg# annoying in cross-compiling environments, where the build's strip
378740c5823bSmrg# is unlikely to handle the host's binaries.
378840c5823bSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
378940c5823bSmrg# always use install-sh in "make install-strip", and initialize
379040c5823bSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
379140c5823bSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
379240c5823bSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
379340c5823bSmrg# Installed binaries are usually stripped using 'strip' when the user
379440c5823bSmrg# run "make install-strip".  However 'strip' might not be the right
379540c5823bSmrg# tool to use in cross-compilation environments, therefore Automake
379640c5823bSmrg# will honor the 'STRIP' environment variable to overrule this program.
379740c5823bSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
379840c5823bSmrgif test "$cross_compiling" != no; then
379940c5823bSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
380040c5823bSmrgfi
380140c5823bSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
380240c5823bSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
380340c5823bSmrg
380440c5823bSmrg# Copyright (C) 2006-2017 Free Software Foundation, Inc.
3805ce6676dbSmrg#
380640c5823bSmrg# This file is free software; the Free Software Foundation
380740c5823bSmrg# gives unlimited permission to copy and/or distribute it,
380840c5823bSmrg# with or without modifications, as long as this notice is preserved.
3809ce6676dbSmrg
381040c5823bSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
381140c5823bSmrg# ---------------------------
381240c5823bSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
381340c5823bSmrg# This macro is traced by Automake.
381440c5823bSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
381540c5823bSmrg
381640c5823bSmrg# AM_SUBST_NOTMAKE(VARIABLE)
381740c5823bSmrg# --------------------------
381840c5823bSmrg# Public sister of _AM_SUBST_NOTMAKE.
381940c5823bSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
3820ce6676dbSmrg
382140c5823bSmrg# Check how to create a tarball.                            -*- Autoconf -*-
3822ce6676dbSmrg
382340c5823bSmrg# Copyright (C) 2004-2017 Free Software Foundation, Inc.
382440c5823bSmrg#
382540c5823bSmrg# This file is free software; the Free Software Foundation
382640c5823bSmrg# gives unlimited permission to copy and/or distribute it,
382740c5823bSmrg# with or without modifications, as long as this notice is preserved.
3828ce6676dbSmrg
382940c5823bSmrg# _AM_PROG_TAR(FORMAT)
383040c5823bSmrg# --------------------
383140c5823bSmrg# Check how to create a tarball in format FORMAT.
383240c5823bSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
383340c5823bSmrg#
383440c5823bSmrg# Substitute a variable $(am__tar) that is a command
383540c5823bSmrg# writing to stdout a FORMAT-tarball containing the directory
383640c5823bSmrg# $tardir.
383740c5823bSmrg#     tardir=directory && $(am__tar) > result.tar
383840c5823bSmrg#
383940c5823bSmrg# Substitute a variable $(am__untar) that extract such
384040c5823bSmrg# a tarball read from stdin.
384140c5823bSmrg#     $(am__untar) < result.tar
384240c5823bSmrg#
384340c5823bSmrgAC_DEFUN([_AM_PROG_TAR],
384440c5823bSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
384540c5823bSmrg# in the wild :-(  We should find a proper way to deprecate it ...
384640c5823bSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
3847ce6676dbSmrg
384840c5823bSmrg# We'll loop over all known methods to create a tar archive until one works.
384940c5823bSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
385034f90d55Smrg
385140c5823bSmrgm4_if([$1], [v7],
385240c5823bSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
38538f34cbf9Ssnj
385440c5823bSmrg  [m4_case([$1],
385540c5823bSmrg    [ustar],
385640c5823bSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
385740c5823bSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
385840c5823bSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
385940c5823bSmrg      # and bug#13588).
386040c5823bSmrg      am_max_uid=2097151 # 2^21 - 1
386140c5823bSmrg      am_max_gid=$am_max_uid
386240c5823bSmrg      # The $UID and $GID variables are not portable, so we need to resort
386340c5823bSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
386440c5823bSmrg      # below are definitely unexpected, so allow the users to see them
386540c5823bSmrg      # (that is, avoid stderr redirection).
386640c5823bSmrg      am_uid=`id -u || echo unknown`
386740c5823bSmrg      am_gid=`id -g || echo unknown`
386840c5823bSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
386940c5823bSmrg      if test $am_uid -le $am_max_uid; then
387040c5823bSmrg         AC_MSG_RESULT([yes])
387140c5823bSmrg      else
387240c5823bSmrg         AC_MSG_RESULT([no])
387340c5823bSmrg         _am_tools=none
387440c5823bSmrg      fi
387540c5823bSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
387640c5823bSmrg      if test $am_gid -le $am_max_gid; then
387740c5823bSmrg         AC_MSG_RESULT([yes])
387840c5823bSmrg      else
387940c5823bSmrg        AC_MSG_RESULT([no])
388040c5823bSmrg        _am_tools=none
388140c5823bSmrg      fi],
38828f34cbf9Ssnj
388340c5823bSmrg  [pax],
388440c5823bSmrg    [],
3885ce6676dbSmrg
388640c5823bSmrg  [m4_fatal([Unknown tar format])])
388734f90d55Smrg
388840c5823bSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
3889ce6676dbSmrg
389040c5823bSmrg  # Go ahead even if we have the value already cached.  We do so because we
389140c5823bSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
389240c5823bSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
3893ce6676dbSmrg
389440c5823bSmrg  for _am_tool in $_am_tools; do
389540c5823bSmrg    case $_am_tool in
389640c5823bSmrg    gnutar)
389740c5823bSmrg      for _am_tar in tar gnutar gtar; do
389840c5823bSmrg        AM_RUN_LOG([$_am_tar --version]) && break
389940c5823bSmrg      done
390040c5823bSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
390140c5823bSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
390240c5823bSmrg      am__untar="$_am_tar -xf -"
390340c5823bSmrg      ;;
390440c5823bSmrg    plaintar)
390540c5823bSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
390640c5823bSmrg      # ustar tarball either.
390740c5823bSmrg      (tar --version) >/dev/null 2>&1 && continue
390840c5823bSmrg      am__tar='tar chf - "$$tardir"'
390940c5823bSmrg      am__tar_='tar chf - "$tardir"'
391040c5823bSmrg      am__untar='tar xf -'
391140c5823bSmrg      ;;
391240c5823bSmrg    pax)
391340c5823bSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
391440c5823bSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
391540c5823bSmrg      am__untar='pax -r'
391640c5823bSmrg      ;;
391740c5823bSmrg    cpio)
391840c5823bSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
391940c5823bSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
392040c5823bSmrg      am__untar='cpio -i -H $1 -d'
392140c5823bSmrg      ;;
392240c5823bSmrg    none)
392340c5823bSmrg      am__tar=false
392440c5823bSmrg      am__tar_=false
392540c5823bSmrg      am__untar=false
392640c5823bSmrg      ;;
392740c5823bSmrg    esac
3928ce6676dbSmrg
392940c5823bSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
393040c5823bSmrg    # and am__untar set.
393140c5823bSmrg    test -n "${am_cv_prog_tar_$1}" && break
393240c5823bSmrg
393340c5823bSmrg    # tar/untar a dummy directory, and stop if the command works.
393440c5823bSmrg    rm -rf conftest.dir
393540c5823bSmrg    mkdir conftest.dir
393640c5823bSmrg    echo GrepMe > conftest.dir/file
393740c5823bSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
393840c5823bSmrg    rm -rf conftest.dir
393940c5823bSmrg    if test -s conftest.tar; then
394040c5823bSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
394140c5823bSmrg      AM_RUN_LOG([cat conftest.dir/file])
394240c5823bSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
394340c5823bSmrg    fi
394440c5823bSmrg  done
394540c5823bSmrg  rm -rf conftest.dir
394640c5823bSmrg
394740c5823bSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
394840c5823bSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
3949ce6676dbSmrg
395040c5823bSmrgAC_SUBST([am__tar])
395140c5823bSmrgAC_SUBST([am__untar])
395240c5823bSmrg]) # _AM_PROG_TAR
3953ce6676dbSmrg
395440c5823bSmrgm4_include([m4/ax_define_dir.m4])
3955