aclocal.m4 revision 1b5d61b8
11b5d61b8Smrg# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
235c4bbdfSmrg
31b5d61b8Smrg# Copyright (C) 1996-2017 Free Software Foundation, Inc.
405b261ecSmrg
505b261ecSmrg# This file is free software; the Free Software Foundation
605b261ecSmrg# gives unlimited permission to copy and/or distribute it,
705b261ecSmrg# with or without modifications, as long as this notice is preserved.
805b261ecSmrg
905b261ecSmrg# This program is distributed in the hope that it will be useful,
1005b261ecSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1105b261ecSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1205b261ecSmrg# PARTICULAR PURPOSE.
1305b261ecSmrg
1435c4bbdfSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
1535c4bbdfSmrgm4_ifndef([AC_AUTOCONF_VERSION],
1635c4bbdfSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1735c4bbdfSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
1835c4bbdfSmrg[m4_warning([this file was generated for autoconf 2.69.
1935c4bbdfSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
2035c4bbdfSmrgIf you have problems, you may need to regenerate the build system entirely.
2135c4bbdfSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2235c4bbdfSmrg
2335c4bbdfSmrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
2435c4bbdfSmrgdnl
2535c4bbdfSmrgdnl This file comes from X.Org's font-util 1.3.1
2635c4bbdfSmrgdnl
2735c4bbdfSmrgdnl Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
2835c4bbdfSmrgdnl
2935c4bbdfSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
3035c4bbdfSmrgdnl copy of this software and associated documentation files (the "Software"),
3135c4bbdfSmrgdnl to deal in the Software without restriction, including without limitation
3235c4bbdfSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3335c4bbdfSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
3435c4bbdfSmrgdnl Software is furnished to do so, subject to the following conditions:
3535c4bbdfSmrgdnl
3635c4bbdfSmrgdnl The above copyright notice and this permission notice (including the next
3735c4bbdfSmrgdnl paragraph) shall be included in all copies or substantial portions of the
3835c4bbdfSmrgdnl Software.
3935c4bbdfSmrgdnl
4035c4bbdfSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4135c4bbdfSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4235c4bbdfSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
4335c4bbdfSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4435c4bbdfSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
4535c4bbdfSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
4635c4bbdfSmrgdnl DEALINGS IN THE SOFTWARE.
4735c4bbdfSmrgdnl
4835c4bbdfSmrgdnl --------------------------------------------------------------------
4935c4bbdfSmrgdnl
5035c4bbdfSmrgdnl Copyright 2005 Red Hat, Inc
5135c4bbdfSmrgdnl
5235c4bbdfSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
5335c4bbdfSmrgdnl documentation for any purpose is hereby granted without fee, provided that
5435c4bbdfSmrgdnl the above copyright notice appear in all copies and that both that
5535c4bbdfSmrgdnl copyright notice and this permission notice appear in supporting
5635c4bbdfSmrgdnl documentation.
5735c4bbdfSmrgdnl
5835c4bbdfSmrgdnl The above copyright notice and this permission notice shall be included
5935c4bbdfSmrgdnl in all copies or substantial portions of the Software.
6035c4bbdfSmrgdnl
6135c4bbdfSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
6235c4bbdfSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
6335c4bbdfSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
6435c4bbdfSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
6535c4bbdfSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
6635c4bbdfSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
6735c4bbdfSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
6835c4bbdfSmrgdnl
6935c4bbdfSmrgdnl Except as contained in this notice, the name of the copyright holders shall
7035c4bbdfSmrgdnl not be used in advertising or otherwise to promote the sale, use or
7135c4bbdfSmrgdnl other dealings in this Software without prior written authorization
7235c4bbdfSmrgdnl from the copyright holders.
7305b261ecSmrg
7435c4bbdfSmrg# XORG_FONT_MACROS_VERSION(required-version)
7535c4bbdfSmrg# ------------------------------------------
7635c4bbdfSmrg# Minimum version: 1.1.0
774642e01fSmrg#
7835c4bbdfSmrg# If you're using a macro added in Version 1.1 or newer, include this in
7935c4bbdfSmrg# your configure.ac with the minimum required version, such as:
8035c4bbdfSmrg# XORG_FONT_MACROS_VERSION(1.1)
8135c4bbdfSmrg#
8235c4bbdfSmrg# To ensure that this macro is defined, also add:
8335c4bbdfSmrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
8435c4bbdfSmrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
8535c4bbdfSmrg#
8635c4bbdfSmrg#
8735c4bbdfSmrg# See the "minimum version" comment for each macro you use to see what
8835c4bbdfSmrg# version you require.
8935c4bbdfSmrgm4_defun([XORG_FONT_MACROS_VERSION],[
9035c4bbdfSmrgm4_define([vers_have], [1.3.1])
9135c4bbdfSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
9235c4bbdfSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
9335c4bbdfSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
9435c4bbdfSmrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
9535c4bbdfSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
9635c4bbdfSmrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
9735c4bbdfSmrgm4_undefine([vers_have])
9835c4bbdfSmrgm4_undefine([maj_have])
9935c4bbdfSmrgm4_undefine([maj_needed])
10035c4bbdfSmrg]) # XORG_FONT_MACROS_VERSION
1014642e01fSmrg
10235c4bbdfSmrg# XORG_FONT_CHECK_{maps}()
10335c4bbdfSmrg# ------------------------
10435c4bbdfSmrg# Minimum version: 1.0.0
10535c4bbdfSmrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
10635c4bbdfSmrg# JISX0201 or KOI8_R.  By default, they are all enabled.
10705b261ecSmrg
10835c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
10935c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
11035c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
11135c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
11235c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
11335c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
11435c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
11535c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
11635c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
11735c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
11835c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
11935c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
12035c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
12135c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
12235c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
12335c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
12435c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
12535c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
12605b261ecSmrg
12735c4bbdfSmrg# XORG_FONT_CHECK_ENCODING(encoding)
12835c4bbdfSmrg# ----------------------------------
12935c4bbdfSmrg# Minimum version: 1.1.0
13035c4bbdfSmrg# This macro adds --enable/disable-<encoding>, enabled by default.
13135c4bbdfSmrg# It replaced individual copies of this code in the above macros in 1.1.
13235c4bbdfSmrg# Currently assumes encoding names will be all upper-case - add m4_toupper
13335c4bbdfSmrg# calls if this is not true in the future.
13405b261ecSmrg
13535c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
13635c4bbdfSmrg	AC_ARG_ENABLE(m4_tolower($1),
13735c4bbdfSmrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
13835c4bbdfSmrg				[Build $1 fonts (default: yes)]),
13935c4bbdfSmrg		[AS_TR_SH($1)=$enableval])
14035c4bbdfSmrg	AC_MSG_CHECKING([whether to build $1 fonts])
14135c4bbdfSmrg	AC_MSG_RESULT($[AS_TR_SH($1)])
14235c4bbdfSmrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
14335c4bbdfSmrg]) # XORG_FONT_CHECK_ENCODING
14405b261ecSmrg
14535c4bbdfSmrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
14635c4bbdfSmrg# -----------------------------------------------------
14735c4bbdfSmrg# Minimum version: 1.1.0
14835c4bbdfSmrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
14935c4bbdfSmrg# Add a shorthand --enable/disable-all-encodings option.
15035c4bbdfSmrg
15135c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
15235c4bbdfSmrg	AC_ARG_ENABLE([all-encodings],
15335c4bbdfSmrg		AS_HELP_STRING([--disable-all-encodings],
15435c4bbdfSmrg				[Disable building of all font encodings]),
15535c4bbdfSmrg		[m4_foreach_w([enc], [$1], [
15635c4bbdfSmrg			AS_TR_SH(enc)=$enableval
15735c4bbdfSmrg		])],
15835c4bbdfSmrg		[m4_foreach_w([enc], [$1], [
15935c4bbdfSmrg			AS_TR_SH(enc)=yes
16035c4bbdfSmrg		])])
16135c4bbdfSmrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
16235c4bbdfSmrg]) # XORG_FONT_CHECK_ENCODING_LIST
16305b261ecSmrg
16435c4bbdfSmrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
16535c4bbdfSmrg# ------------------------------------------
16635c4bbdfSmrg# Minimum version: 1.1.0
16735c4bbdfSmrg#
16835c4bbdfSmrg# Simple wrapper around AC_PATH_PROG that errors if not found
16935c4bbdfSmrg#
1706747b715Smrg
17135c4bbdfSmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
17235c4bbdfSmrg	AC_PATH_PROG($1, $2)
17335c4bbdfSmrg	if test x"$$1" = x; then
17435c4bbdfSmrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
17535c4bbdfSmrg	fi
1764642e01fSmrg])
1774642e01fSmrg
1784642e01fSmrg
17935c4bbdfSmrg# XORG_FONT_FCCACHE()
18035c4bbdfSmrg# -------------------
18135c4bbdfSmrg# Minimum version: 1.1.0
1826747b715Smrg#
18335c4bbdfSmrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
18435c4bbdfSmrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
18535c4bbdfSmrg# to run fc-cache if found and not installing to $DESTDIR and not
18635c4bbdfSmrg# cross-compiling
1876747b715Smrg#
18835c4bbdfSmrg# fc-cache is optional, not required, and should be skipped when making
18935c4bbdfSmrg# packages (installing to $DESTDIR) or cross-compiling
1906747b715Smrg#
19135c4bbdfSmrgAC_DEFUN([XORG_FONT_FCCACHE],[
19235c4bbdfSmrg	AC_PATH_PROG(FCCACHE, fc-cache)
19335c4bbdfSmrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
19435c4bbdfSmrg	if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then
19535c4bbdfSmrg		RUN_FCCACHE="${FCCACHE_WARN}"
19635c4bbdfSmrg	else
19735c4bbdfSmrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
19835c4bbdfSmrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
19935c4bbdfSmrg	fi
20035c4bbdfSmrg	AC_SUBST([RUN_FCCACHE])
20135c4bbdfSmrg])
20235c4bbdfSmrg
20335c4bbdfSmrg# XORG_FONT_MKFONTDIR()
20435c4bbdfSmrg# -------------------
20535c4bbdfSmrg# Minimum version: 1.3.0
2066747b715Smrg#
20735c4bbdfSmrg# Set MKFONTDIR to path to mkfontdir.
2086747b715Smrg#
20935c4bbdfSmrg# If cross-compiling, and if mkdir is not found, use a shell command
21035c4bbdfSmrg# which warns mkfontdir needs to be run on the target
2116747b715Smrg#
21235c4bbdfSmrg# If not cross-compiling, mkfontdir must be found
21335c4bbdfSmrg#
21435c4bbdfSmrgAC_DEFUN([XORG_FONT_MKFONTDIR],[
21535c4bbdfSmrg	if test x"$cross_compiling" != x"no" ; then
21635c4bbdfSmrg		AC_PATH_PROG(MKFONTDIR, mkfontdir, "")
21735c4bbdfSmrg		MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run mkfontdir manually on host system"'
2184642e01fSmrg
21935c4bbdfSmrg		if test x"$MKFONTDIR" = x; then
22035c4bbdfSmrg			MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'"
22135c4bbdfSmrg		fi
22235c4bbdfSmrg	else
22335c4bbdfSmrg		XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
22435c4bbdfSmrg	fi
22505b261ecSmrg
22635c4bbdfSmrg	AC_SUBST([MKFONTDIR])
22735c4bbdfSmrg])
22805b261ecSmrg
22935c4bbdfSmrg# XORG_FONT_COMMON_UTILS()
23035c4bbdfSmrg# ------------------------
23135c4bbdfSmrg# Minimum version: 1.1.0
2326747b715Smrg#
23335c4bbdfSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
23405b261ecSmrg
23535c4bbdfSmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
23635c4bbdfSmrg	XORG_FONT_FCCACHE
23735c4bbdfSmrg	XORG_FONT_MKFONTDIR
23835c4bbdfSmrg])
23905b261ecSmrg
24035c4bbdfSmrg# XORG_FONT_SCALED_UTILS()
24135c4bbdfSmrg# ------------------------
24235c4bbdfSmrg# Minimum version: 1.1.0
2436747b715Smrg#
24435c4bbdfSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
24535c4bbdfSmrg# (TrueType, OpenType, Type1)
2464642e01fSmrg
24735c4bbdfSmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
24835c4bbdfSmrg	XORG_FONT_COMMON_UTILS
24935c4bbdfSmrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
25035c4bbdfSmrg])
2514642e01fSmrg
25235c4bbdfSmrg# XORG_FONT_BDF_UTILS()
25335c4bbdfSmrg# ---------------------
25435c4bbdfSmrg# Minimum version: 1.1.0
2556747b715Smrg#
25635c4bbdfSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
25735c4bbdfSmrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
25835c4bbdfSmrg# PCF output files created by bdftopcf
25905b261ecSmrg
26035c4bbdfSmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
26135c4bbdfSmrg	XORG_FONT_COMMON_UTILS
26235c4bbdfSmrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
26335c4bbdfSmrg	XORG_FONT_CHECK_COMPRESSION
2646747b715Smrg])
26505b261ecSmrg
26635c4bbdfSmrg# XORG_FONT_CHECK_COMPRESSION()
26735c4bbdfSmrg# -----------------------------
26835c4bbdfSmrg# Minimum version: 1.1.0
26935c4bbdfSmrg#
27035c4bbdfSmrg# Offer a --with-compression flag to control what compression method is
27135c4bbdfSmrg# used for pcf font files.   Offers all the methods currently supported
27235c4bbdfSmrg# by libXfont, including no compression.
27305b261ecSmrg
27435c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
27535c4bbdfSmrg	AC_MSG_CHECKING([font compression method])
27635c4bbdfSmrg	AC_ARG_WITH(compression,
27735c4bbdfSmrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
27835c4bbdfSmrg			 [compression method to use on pcf fonts])],
27935c4bbdfSmrg         [compression="$withval"], [compression="yes"])
28035c4bbdfSmrg	if test x"$compression" = "xyes" ; then
28135c4bbdfSmrg		compression="gzip"
28235c4bbdfSmrg	fi
28335c4bbdfSmrg	AC_MSG_RESULT([${compression}])
28435c4bbdfSmrg	case ${compression} in
28535c4bbdfSmrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
28635c4bbdfSmrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;;
28735c4bbdfSmrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
28835c4bbdfSmrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
28935c4bbdfSmrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
29035c4bbdfSmrg	esac
29135c4bbdfSmrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
29235c4bbdfSmrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
29335c4bbdfSmrg	fi
29435c4bbdfSmrg	AC_SUBST([COMPRESS_SUFFIX])
2956747b715Smrg])
29605b261ecSmrg
29735c4bbdfSmrg# XORG_FONT_UCS2ANY()
29835c4bbdfSmrg# -------------------
29935c4bbdfSmrg# Minimum version: 1.1.0
30035c4bbdfSmrg#
30135c4bbdfSmrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
30235c4bbdfSmrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
30335c4bbdfSmrg# Also call pkg-config to find the directory with the encoding files needed
30435c4bbdfSmrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
30505b261ecSmrg
30635c4bbdfSmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
30735c4bbdfSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
30835c4bbdfSmrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
30935c4bbdfSmrg	PKG_CHECK_MODULES(MAPS, [fontutil])
31035c4bbdfSmrg	AC_MSG_CHECKING([for ucs2any encoding data files])
31135c4bbdfSmrg	MAPFILES_PATH=`$PKG_CONFIG --variable=mapdir fontutil`
31235c4bbdfSmrg	AC_SUBST(MAPFILES_PATH)
31335c4bbdfSmrg	AC_MSG_RESULT([${MAPFILES_PATH}])
3146747b715Smrg])
31505b261ecSmrg
31605b261ecSmrg
31705b261ecSmrg
31835c4bbdfSmrg# XORG_FONT_FC_CONFDIR()
31935c4bbdfSmrg# --------------------
32035c4bbdfSmrg# Minimum version: 1.2.0
32135c4bbdfSmrg#
32235c4bbdfSmrg# Sets FC_CONFDIR to the fontconfig config directory
32335c4bbdfSmrg# (which should be --with-confdir=... when building fontconfig)
32435c4bbdfSmrg# found from:
32535c4bbdfSmrg#	--with-fc-confdir=...
32635c4bbdfSmrg#	pkg-config --variable=confdir fontconfig
32735c4bbdfSmrg#	${sysconfdir}/fonts
32805b261ecSmrg
32935c4bbdfSmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
33035c4bbdfSmrg	dnl Ensure $PKG_CONFIG is set first
33135c4bbdfSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
33205b261ecSmrg
33335c4bbdfSmrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
33435c4bbdfSmrg	AC_ARG_WITH(fc-confdir,
33535c4bbdfSmrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
33635c4bbdfSmrg			   [Path to fontconfig's configuration directory]),
33735c4bbdfSmrg		    [FC_CONFDIR="$withval"])
33835c4bbdfSmrg	# if --with-fc-confdir was not specified
33935c4bbdfSmrg	if test "x${FC_CONFDIR}" = "x"; then
34035c4bbdfSmrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
34135c4bbdfSmrg	fi
34235c4bbdfSmrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
34335c4bbdfSmrg	if test "x${FC_CONFDIR}" = "x"; then
34435c4bbdfSmrg		FC_CONFDIR="${sysconfdir}/fonts"
34535c4bbdfSmrg	fi
34635c4bbdfSmrg	AC_SUBST(FC_CONFDIR)
34735c4bbdfSmrg	AC_MSG_RESULT([${FC_CONFDIR}])
3486747b715Smrg])
3494642e01fSmrg
3504642e01fSmrg
3514642e01fSmrg
35235c4bbdfSmrg# XORG_FONTROOTDIR()
35335c4bbdfSmrg# --------------------
35435c4bbdfSmrg# Minimum version: 1.1.0
35535c4bbdfSmrg#
35635c4bbdfSmrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
35735c4bbdfSmrg# found from:
35835c4bbdfSmrg#	--with-fontrootdir
35935c4bbdfSmrg#	pkg-config --variable=fontrootdir fontutil
36035c4bbdfSmrg#	${datadir}/fonts/X11
3614642e01fSmrg
36235c4bbdfSmrgAC_DEFUN([XORG_FONTROOTDIR],[
36335c4bbdfSmrg	dnl Ensure $PKG_CONFIG is set first
36435c4bbdfSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
3654642e01fSmrg
36635c4bbdfSmrg	AC_MSG_CHECKING([for root directory for font files])
36735c4bbdfSmrg	AC_ARG_WITH(fontrootdir,
36835c4bbdfSmrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
36935c4bbdfSmrg			   [Path to root directory for font files]),
37035c4bbdfSmrg		    [FONTROOTDIR="$withval"])
37135c4bbdfSmrg	# if --with-fontrootdir not specified...
37235c4bbdfSmrg	if test "x${FONTROOTDIR}" = "x"; then
37335c4bbdfSmrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
37435c4bbdfSmrg	fi
37535c4bbdfSmrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
37635c4bbdfSmrg	if test "x${FONTROOTDIR}" = "x"; then
37735c4bbdfSmrg		FONTROOTDIR="${datadir}/fonts/X11"
37835c4bbdfSmrg	fi
37935c4bbdfSmrg	AC_SUBST(FONTROOTDIR)
38035c4bbdfSmrg	AC_MSG_RESULT([${FONTROOTDIR}])
3814642e01fSmrg])
3824642e01fSmrg
38335c4bbdfSmrg# XORG_FONTSUBDIR(variable, flag, subdir)
38435c4bbdfSmrg# ---------------------------------------
38535c4bbdfSmrg# Minimum version: 1.1.0
38635c4bbdfSmrg#
38735c4bbdfSmrg# Offer a --with-<flag> flag to control directory for font installation
38835c4bbdfSmrg# Default is the specified <subdir> of the font root directory.
38935c4bbdfSmrg# Sets <variable> to the selected directory
3904642e01fSmrg
39135c4bbdfSmrgAC_DEFUN([XORG_FONTSUBDIR],[
39235c4bbdfSmrg	AC_REQUIRE([XORG_FONTROOTDIR])
3934642e01fSmrg
39435c4bbdfSmrg	AC_MSG_CHECKING([for directory for $3 files])
39535c4bbdfSmrg	AC_ARG_WITH($2,
39635c4bbdfSmrg		    [AS_HELP_STRING([--with-$2=DIR],
39735c4bbdfSmrg				    [Path to $3 files [FONTROOTDIR/$3]])],
39835c4bbdfSmrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
39935c4bbdfSmrg	AC_SUBST($1)
40035c4bbdfSmrg	AC_MSG_RESULT([${$1}])
40135c4bbdfSmrg]) # XORG_FONTSUBDIR
4024642e01fSmrg
40335c4bbdfSmrg# XORG_FONTDIR(subdir)
40435c4bbdfSmrg# --------------------
40535c4bbdfSmrg# Minimum version: 1.1.0
4066747b715Smrg#
40735c4bbdfSmrg# Offer a --with-fontdir flag to control directory for font installation
40835c4bbdfSmrg# Default is the specified subdir of the font root directory.
40935c4bbdfSmrg# Sets FONTDIR to the selected directory
4104642e01fSmrg
41135c4bbdfSmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
4124642e01fSmrg
4131b5d61b8Smrg# pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
4141b5d61b8Smrg# serial 11 (pkg-config-0.29.1)
4151b5d61b8Smrg
41635c4bbdfSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
41735c4bbdfSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
41835c4bbdfSmrgdnl
41935c4bbdfSmrgdnl This program is free software; you can redistribute it and/or modify
42035c4bbdfSmrgdnl it under the terms of the GNU General Public License as published by
42135c4bbdfSmrgdnl the Free Software Foundation; either version 2 of the License, or
42235c4bbdfSmrgdnl (at your option) any later version.
42335c4bbdfSmrgdnl
42435c4bbdfSmrgdnl This program is distributed in the hope that it will be useful, but
42535c4bbdfSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
42635c4bbdfSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
42735c4bbdfSmrgdnl General Public License for more details.
42835c4bbdfSmrgdnl
42935c4bbdfSmrgdnl You should have received a copy of the GNU General Public License
43035c4bbdfSmrgdnl along with this program; if not, write to the Free Software
43135c4bbdfSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
43235c4bbdfSmrgdnl 02111-1307, USA.
43335c4bbdfSmrgdnl
43435c4bbdfSmrgdnl As a special exception to the GNU General Public License, if you
43535c4bbdfSmrgdnl distribute this file as part of a program that contains a
43635c4bbdfSmrgdnl configuration script generated by Autoconf, you may include it under
43735c4bbdfSmrgdnl the same distribution terms that you use for the rest of that
43835c4bbdfSmrgdnl program.
43935c4bbdfSmrg
44035c4bbdfSmrgdnl PKG_PREREQ(MIN-VERSION)
44135c4bbdfSmrgdnl -----------------------
44235c4bbdfSmrgdnl Since: 0.29
44335c4bbdfSmrgdnl
44435c4bbdfSmrgdnl Verify that the version of the pkg-config macros are at least
44535c4bbdfSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
44635c4bbdfSmrgdnl installed version of pkg-config, this checks the developer's version
44735c4bbdfSmrgdnl of pkg.m4 when generating configure.
44835c4bbdfSmrgdnl
44935c4bbdfSmrgdnl To ensure that this macro is defined, also add:
45035c4bbdfSmrgdnl m4_ifndef([PKG_PREREQ],
45135c4bbdfSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
45235c4bbdfSmrgdnl
45335c4bbdfSmrgdnl See the "Since" comment for each macro you use to see what version
45435c4bbdfSmrgdnl of the macros you require.
45535c4bbdfSmrgm4_defun([PKG_PREREQ],
4561b5d61b8Smrg[m4_define([PKG_MACROS_VERSION], [0.29.1])
45735c4bbdfSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
45835c4bbdfSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
45935c4bbdfSmrg])dnl PKG_PREREQ
46035c4bbdfSmrg
46135c4bbdfSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
46235c4bbdfSmrgdnl ----------------------------------
46335c4bbdfSmrgdnl Since: 0.16
46435c4bbdfSmrgdnl
46535c4bbdfSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
46635c4bbdfSmrgdnl first found in the path. Checks that the version of pkg-config found
46735c4bbdfSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
46835c4bbdfSmrgdnl used since that's the first version where most current features of
46935c4bbdfSmrgdnl pkg-config existed.
47035c4bbdfSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
47135c4bbdfSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
47235c4bbdfSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
47335c4bbdfSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
47435c4bbdfSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
47535c4bbdfSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
47635c4bbdfSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
4774642e01fSmrg
47835c4bbdfSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
47935c4bbdfSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
4806747b715Smrgfi
48135c4bbdfSmrgif test -n "$PKG_CONFIG"; then
48235c4bbdfSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
48335c4bbdfSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
48435c4bbdfSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
48535c4bbdfSmrg		AC_MSG_RESULT([yes])
48635c4bbdfSmrg	else
48735c4bbdfSmrg		AC_MSG_RESULT([no])
48835c4bbdfSmrg		PKG_CONFIG=""
48935c4bbdfSmrg	fi
49035c4bbdfSmrgfi[]dnl
49135c4bbdfSmrg])dnl PKG_PROG_PKG_CONFIG
4924642e01fSmrg
49335c4bbdfSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
49435c4bbdfSmrgdnl -------------------------------------------------------------------
49535c4bbdfSmrgdnl Since: 0.18
49635c4bbdfSmrgdnl
49735c4bbdfSmrgdnl Check to see whether a particular set of modules exists. Similar to
49835c4bbdfSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
49935c4bbdfSmrgdnl
50035c4bbdfSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
50135c4bbdfSmrgdnl only at the first occurence in configure.ac, so if the first place
50235c4bbdfSmrgdnl it's called might be skipped (such as if it is within an "if", you
50335c4bbdfSmrgdnl have to call PKG_CHECK_EXISTS manually
50435c4bbdfSmrgAC_DEFUN([PKG_CHECK_EXISTS],
50535c4bbdfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
50635c4bbdfSmrgif test -n "$PKG_CONFIG" && \
50735c4bbdfSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
50835c4bbdfSmrg  m4_default([$2], [:])
50935c4bbdfSmrgm4_ifvaln([$3], [else
51035c4bbdfSmrg  $3])dnl
51135c4bbdfSmrgfi])
5124642e01fSmrg
51335c4bbdfSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
51435c4bbdfSmrgdnl ---------------------------------------------
51535c4bbdfSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
51635c4bbdfSmrgdnl pkg_failed based on the result.
51735c4bbdfSmrgm4_define([_PKG_CONFIG],
51835c4bbdfSmrg[if test -n "$$1"; then
51935c4bbdfSmrg    pkg_cv_[]$1="$$1"
52035c4bbdfSmrg elif test -n "$PKG_CONFIG"; then
52135c4bbdfSmrg    PKG_CHECK_EXISTS([$3],
52235c4bbdfSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
52335c4bbdfSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
52435c4bbdfSmrg		     [pkg_failed=yes])
52535c4bbdfSmrg else
52635c4bbdfSmrg    pkg_failed=untried
52735c4bbdfSmrgfi[]dnl
52835c4bbdfSmrg])dnl _PKG_CONFIG
5294642e01fSmrg
53035c4bbdfSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
53135c4bbdfSmrgdnl ---------------------------
53235c4bbdfSmrgdnl Internal check to see if pkg-config supports short errors.
53335c4bbdfSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
53435c4bbdfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
53535c4bbdfSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
53635c4bbdfSmrg        _pkg_short_errors_supported=yes
53735c4bbdfSmrgelse
53835c4bbdfSmrg        _pkg_short_errors_supported=no
53935c4bbdfSmrgfi[]dnl
54035c4bbdfSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
5414642e01fSmrg
5424642e01fSmrg
54335c4bbdfSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
54435c4bbdfSmrgdnl   [ACTION-IF-NOT-FOUND])
54535c4bbdfSmrgdnl --------------------------------------------------------------
54635c4bbdfSmrgdnl Since: 0.4.0
54735c4bbdfSmrgdnl
54835c4bbdfSmrgdnl Note that if there is a possibility the first call to
54935c4bbdfSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
55035c4bbdfSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
55135c4bbdfSmrgAC_DEFUN([PKG_CHECK_MODULES],
55235c4bbdfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
55335c4bbdfSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
55435c4bbdfSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
5554642e01fSmrg
55635c4bbdfSmrgpkg_failed=no
55735c4bbdfSmrgAC_MSG_CHECKING([for $1])
5584642e01fSmrg
55935c4bbdfSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
56035c4bbdfSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
5614642e01fSmrg
56235c4bbdfSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
56335c4bbdfSmrgand $1[]_LIBS to avoid the need to call pkg-config.
56435c4bbdfSmrgSee the pkg-config man page for more details.])
565475c125cSmrg
566475c125cSmrgif test $pkg_failed = yes; then
567475c125cSmrg   	AC_MSG_RESULT([no])
568475c125cSmrg        _PKG_SHORT_ERRORS_SUPPORTED
569475c125cSmrg        if test $_pkg_short_errors_supported = yes; then
57035c4bbdfSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
571475c125cSmrg        else 
57235c4bbdfSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
573475c125cSmrg        fi
574475c125cSmrg	# Put the nasty error message in config.log where it belongs
575475c125cSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
576475c125cSmrg
577475c125cSmrg	m4_default([$4], [AC_MSG_ERROR(
578475c125cSmrg[Package requirements ($2) were not met:
579475c125cSmrg
580475c125cSmrg$$1_PKG_ERRORS
581475c125cSmrg
582475c125cSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
583475c125cSmrginstalled software in a non-standard prefix.
584475c125cSmrg
585475c125cSmrg_PKG_TEXT])[]dnl
586475c125cSmrg        ])
587475c125cSmrgelif test $pkg_failed = untried; then
588475c125cSmrg     	AC_MSG_RESULT([no])
589475c125cSmrg	m4_default([$4], [AC_MSG_FAILURE(
590475c125cSmrg[The pkg-config script could not be found or is too old.  Make sure it
591475c125cSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
592475c125cSmrgpath to pkg-config.
593475c125cSmrg
594475c125cSmrg_PKG_TEXT
595475c125cSmrg
59635c4bbdfSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
597475c125cSmrg        ])
598475c125cSmrgelse
599475c125cSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
600475c125cSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
601475c125cSmrg        AC_MSG_RESULT([yes])
602475c125cSmrg	$3
603475c125cSmrgfi[]dnl
60435c4bbdfSmrg])dnl PKG_CHECK_MODULES
605475c125cSmrg
60635c4bbdfSmrg
60735c4bbdfSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
60835c4bbdfSmrgdnl   [ACTION-IF-NOT-FOUND])
60935c4bbdfSmrgdnl ---------------------------------------------------------------------
61035c4bbdfSmrgdnl Since: 0.29
6116747b715Smrgdnl
61235c4bbdfSmrgdnl Checks for existence of MODULES and gathers its build flags with
61335c4bbdfSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
61435c4bbdfSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
6156747b715Smrgdnl
61635c4bbdfSmrgdnl Note that if there is a possibility the first call to
61735c4bbdfSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
61835c4bbdfSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
61935c4bbdfSmrgdnl configure.ac.
62035c4bbdfSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
62135c4bbdfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
62235c4bbdfSmrg_save_PKG_CONFIG=$PKG_CONFIG
62335c4bbdfSmrgPKG_CONFIG="$PKG_CONFIG --static"
62435c4bbdfSmrgPKG_CHECK_MODULES($@)
62535c4bbdfSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
62635c4bbdfSmrg])dnl PKG_CHECK_MODULES_STATIC
62735c4bbdfSmrg
62835c4bbdfSmrg
62935c4bbdfSmrgdnl PKG_INSTALLDIR([DIRECTORY])
63035c4bbdfSmrgdnl -------------------------
63135c4bbdfSmrgdnl Since: 0.27
63235c4bbdfSmrgdnl
63335c4bbdfSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
63435c4bbdfSmrgdnl should install pkg-config .pc files. By default the directory is
63535c4bbdfSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
63635c4bbdfSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
63735c4bbdfSmrgdnl parameter.
63835c4bbdfSmrgAC_DEFUN([PKG_INSTALLDIR],
63935c4bbdfSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
64035c4bbdfSmrgm4_pushdef([pkg_description],
64135c4bbdfSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
64235c4bbdfSmrgAC_ARG_WITH([pkgconfigdir],
64335c4bbdfSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
64435c4bbdfSmrg    [with_pkgconfigdir=]pkg_default)
64535c4bbdfSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
64635c4bbdfSmrgm4_popdef([pkg_default])
64735c4bbdfSmrgm4_popdef([pkg_description])
64835c4bbdfSmrg])dnl PKG_INSTALLDIR
64935c4bbdfSmrg
65035c4bbdfSmrg
65135c4bbdfSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
65235c4bbdfSmrgdnl --------------------------------
65335c4bbdfSmrgdnl Since: 0.27
65435c4bbdfSmrgdnl
65535c4bbdfSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
65635c4bbdfSmrgdnl module should install arch-independent pkg-config .pc files. By
65735c4bbdfSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
65835c4bbdfSmrgdnl changed by passing DIRECTORY. The user can override through the
65935c4bbdfSmrgdnl --with-noarch-pkgconfigdir parameter.
66035c4bbdfSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
66135c4bbdfSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
66235c4bbdfSmrgm4_pushdef([pkg_description],
66335c4bbdfSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
66435c4bbdfSmrgAC_ARG_WITH([noarch-pkgconfigdir],
66535c4bbdfSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
66635c4bbdfSmrg    [with_noarch_pkgconfigdir=]pkg_default)
66735c4bbdfSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
66835c4bbdfSmrgm4_popdef([pkg_default])
66935c4bbdfSmrgm4_popdef([pkg_description])
67035c4bbdfSmrg])dnl PKG_NOARCH_INSTALLDIR
67135c4bbdfSmrg
67235c4bbdfSmrg
67335c4bbdfSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
67435c4bbdfSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
67535c4bbdfSmrgdnl -------------------------------------------
67635c4bbdfSmrgdnl Since: 0.28
67735c4bbdfSmrgdnl
67835c4bbdfSmrgdnl Retrieves the value of the pkg-config variable for the given module.
67935c4bbdfSmrgAC_DEFUN([PKG_CHECK_VAR],
68035c4bbdfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
68135c4bbdfSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
68235c4bbdfSmrg
68335c4bbdfSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
68435c4bbdfSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
68535c4bbdfSmrg
68635c4bbdfSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
68735c4bbdfSmrg])dnl PKG_CHECK_VAR
68835c4bbdfSmrg
6891b5d61b8Smrgdnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
6901b5d61b8Smrgdnl   [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
6911b5d61b8Smrgdnl   [DESCRIPTION], [DEFAULT])
6921b5d61b8Smrgdnl ------------------------------------------
6931b5d61b8Smrgdnl
6941b5d61b8Smrgdnl Prepare a "--with-" configure option using the lowercase
6951b5d61b8Smrgdnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
6961b5d61b8Smrgdnl PKG_CHECK_MODULES in a single macro.
6971b5d61b8SmrgAC_DEFUN([PKG_WITH_MODULES],
6981b5d61b8Smrg[
6991b5d61b8Smrgm4_pushdef([with_arg], m4_tolower([$1]))
7001b5d61b8Smrg
7011b5d61b8Smrgm4_pushdef([description],
7021b5d61b8Smrg           [m4_default([$5], [build with ]with_arg[ support])])
7031b5d61b8Smrg
7041b5d61b8Smrgm4_pushdef([def_arg], [m4_default([$6], [auto])])
7051b5d61b8Smrgm4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
7061b5d61b8Smrgm4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
7071b5d61b8Smrg
7081b5d61b8Smrgm4_case(def_arg,
7091b5d61b8Smrg            [yes],[m4_pushdef([with_without], [--without-]with_arg)],
7101b5d61b8Smrg            [m4_pushdef([with_without],[--with-]with_arg)])
7111b5d61b8Smrg
7121b5d61b8SmrgAC_ARG_WITH(with_arg,
7131b5d61b8Smrg     AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
7141b5d61b8Smrg    [AS_TR_SH([with_]with_arg)=def_arg])
7151b5d61b8Smrg
7161b5d61b8SmrgAS_CASE([$AS_TR_SH([with_]with_arg)],
7171b5d61b8Smrg            [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
7181b5d61b8Smrg            [auto],[PKG_CHECK_MODULES([$1],[$2],
7191b5d61b8Smrg                                        [m4_n([def_action_if_found]) $3],
7201b5d61b8Smrg                                        [m4_n([def_action_if_not_found]) $4])])
7211b5d61b8Smrg
7221b5d61b8Smrgm4_popdef([with_arg])
7231b5d61b8Smrgm4_popdef([description])
7241b5d61b8Smrgm4_popdef([def_arg])
7251b5d61b8Smrg
7261b5d61b8Smrg])dnl PKG_WITH_MODULES
7271b5d61b8Smrg
7281b5d61b8Smrgdnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
7291b5d61b8Smrgdnl   [DESCRIPTION], [DEFAULT])
7301b5d61b8Smrgdnl -----------------------------------------------
7311b5d61b8Smrgdnl
7321b5d61b8Smrgdnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
7331b5d61b8Smrgdnl check._[VARIABLE-PREFIX] is exported as make variable.
7341b5d61b8SmrgAC_DEFUN([PKG_HAVE_WITH_MODULES],
7351b5d61b8Smrg[
7361b5d61b8SmrgPKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
7371b5d61b8Smrg
7381b5d61b8SmrgAM_CONDITIONAL([HAVE_][$1],
7391b5d61b8Smrg               [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
7401b5d61b8Smrg])dnl PKG_HAVE_WITH_MODULES
7411b5d61b8Smrg
7421b5d61b8Smrgdnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
7431b5d61b8Smrgdnl   [DESCRIPTION], [DEFAULT])
7441b5d61b8Smrgdnl ------------------------------------------------------
7451b5d61b8Smrgdnl
7461b5d61b8Smrgdnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
7471b5d61b8Smrgdnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
7481b5d61b8Smrgdnl and preprocessor variable.
7491b5d61b8SmrgAC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
7501b5d61b8Smrg[
7511b5d61b8SmrgPKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
7521b5d61b8Smrg
7531b5d61b8SmrgAS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
7541b5d61b8Smrg        [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
7551b5d61b8Smrg])dnl PKG_HAVE_DEFINE_WITH_MODULES
7561b5d61b8Smrg
75735c4bbdfSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
75835c4bbdfSmrgdnl
75935c4bbdfSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
7606747b715Smrgdnl
7616747b715Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
7626747b715Smrgdnl copy of this software and associated documentation files (the "Software"),
7636747b715Smrgdnl to deal in the Software without restriction, including without limitation
7646747b715Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
7656747b715Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
7666747b715Smrgdnl Software is furnished to do so, subject to the following conditions:
7676747b715Smrgdnl
7686747b715Smrgdnl The above copyright notice and this permission notice (including the next
7696747b715Smrgdnl paragraph) shall be included in all copies or substantial portions of the
7706747b715Smrgdnl Software.
7716747b715Smrgdnl
7726747b715Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
7736747b715Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
7746747b715Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
7756747b715Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
7766747b715Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
7776747b715Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
7786747b715Smrgdnl DEALINGS IN THE SOFTWARE.
7794642e01fSmrg
78035c4bbdfSmrg# XORG_MACROS_VERSION(required-version)
78135c4bbdfSmrg# -------------------------------------
7826747b715Smrg# Minimum version: 1.1.0
7836747b715Smrg#
7846747b715Smrg# If you're using a macro added in Version 1.1 or newer, include this in
7856747b715Smrg# your configure.ac with the minimum required version, such as:
78635c4bbdfSmrg# XORG_MACROS_VERSION(1.1)
7876747b715Smrg#
7886747b715Smrg# To ensure that this macro is defined, also add:
78935c4bbdfSmrg# m4_ifndef([XORG_MACROS_VERSION],
79035c4bbdfSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
7916747b715Smrg#
7926747b715Smrg#
7936747b715Smrg# See the "minimum version" comment for each macro you use to see what
7946747b715Smrg# version you require.
79535c4bbdfSmrgm4_defun([XORG_MACROS_VERSION],[
79635c4bbdfSmrgm4_define([vers_have], [1.19.0])
7976747b715Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
7986747b715Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
7996747b715Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
80035c4bbdfSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
8016747b715Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
80235c4bbdfSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
8036747b715Smrgm4_undefine([vers_have])
8046747b715Smrgm4_undefine([maj_have])
8056747b715Smrgm4_undefine([maj_needed])
80635c4bbdfSmrg]) # XORG_MACROS_VERSION
8074642e01fSmrg
80835c4bbdfSmrg# XORG_PROG_RAWCPP()
80935c4bbdfSmrg# ------------------
8106747b715Smrg# Minimum version: 1.0.0
8116747b715Smrg#
81235c4bbdfSmrg# Find cpp program and necessary flags for use in pre-processing text files
81335c4bbdfSmrg# such as man pages and config files
81435c4bbdfSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
81535c4bbdfSmrgAC_REQUIRE([AC_PROG_CPP])
81635c4bbdfSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
81735c4bbdfSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
8184642e01fSmrg
81935c4bbdfSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
82035c4bbdfSmrg# which is not the best choice for supporting other OS'es, but covers most
82135c4bbdfSmrg# of the ones we need for now.
82235c4bbdfSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
82335c4bbdfSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
82435c4bbdfSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
82535c4bbdfSmrg	AC_MSG_RESULT([no])
82635c4bbdfSmrgelse
82735c4bbdfSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
82835c4bbdfSmrg		RAWCPPFLAGS=-undef
82935c4bbdfSmrg		AC_MSG_RESULT([yes])
83035c4bbdfSmrg	# under Cygwin unix is still defined even with -undef
83135c4bbdfSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
83235c4bbdfSmrg		RAWCPPFLAGS="-undef -ansi"
83335c4bbdfSmrg		AC_MSG_RESULT([yes, with -ansi])
83435c4bbdfSmrg	else
83535c4bbdfSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
8366747b715Smrg	fi
83735c4bbdfSmrgfi
83835c4bbdfSmrgrm -f conftest.$ac_ext
8394642e01fSmrg
84035c4bbdfSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
84135c4bbdfSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
84235c4bbdfSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
84335c4bbdfSmrg	AC_MSG_RESULT([no])
84435c4bbdfSmrgelse
84535c4bbdfSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
84635c4bbdfSmrg		TRADITIONALCPPFLAGS="-traditional"
84735c4bbdfSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
84835c4bbdfSmrg		AC_MSG_RESULT([yes])
8496747b715Smrg	else
85035c4bbdfSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
8516747b715Smrg	fi
85235c4bbdfSmrgfi
85335c4bbdfSmrgrm -f conftest.$ac_ext
85435c4bbdfSmrgAC_SUBST(RAWCPPFLAGS)
85535c4bbdfSmrgAC_SUBST(TRADITIONALCPPFLAGS)
85635c4bbdfSmrg]) # XORG_PROG_RAWCPP
8574642e01fSmrg
85835c4bbdfSmrg# XORG_MANPAGE_SECTIONS()
85935c4bbdfSmrg# -----------------------
86035c4bbdfSmrg# Minimum version: 1.0.0
8614642e01fSmrg#
86235c4bbdfSmrg# Determine which sections man pages go in for the different man page types
86335c4bbdfSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
86435c4bbdfSmrg# Not sure if there's any better way than just hardcoding by OS name.
86535c4bbdfSmrg# Override default settings by setting environment variables
86635c4bbdfSmrg# Added MAN_SUBSTS in version 1.8
86735c4bbdfSmrg# Added AC_PROG_SED in version 1.8
8684642e01fSmrg
86935c4bbdfSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
87035c4bbdfSmrgAC_REQUIRE([AC_CANONICAL_HOST])
87135c4bbdfSmrgAC_REQUIRE([AC_PROG_SED])
8724642e01fSmrg
87335c4bbdfSmrgif test x$APP_MAN_SUFFIX = x    ; then
87435c4bbdfSmrg    APP_MAN_SUFFIX=1
87535c4bbdfSmrgfi
87635c4bbdfSmrgif test x$APP_MAN_DIR = x    ; then
87735c4bbdfSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
87835c4bbdfSmrgfi
8794642e01fSmrg
88035c4bbdfSmrgif test x$LIB_MAN_SUFFIX = x    ; then
88135c4bbdfSmrg    LIB_MAN_SUFFIX=3
88235c4bbdfSmrgfi
88335c4bbdfSmrgif test x$LIB_MAN_DIR = x    ; then
88435c4bbdfSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
88535c4bbdfSmrgfi
8866747b715Smrg
88735c4bbdfSmrgif test x$FILE_MAN_SUFFIX = x    ; then
88835c4bbdfSmrg    case $host_os in
88935c4bbdfSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
89035c4bbdfSmrg	*)		FILE_MAN_SUFFIX=5  ;;
89135c4bbdfSmrg    esac
89235c4bbdfSmrgfi
89335c4bbdfSmrgif test x$FILE_MAN_DIR = x    ; then
89435c4bbdfSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
89535c4bbdfSmrgfi
8964642e01fSmrg
89735c4bbdfSmrgif test x$MISC_MAN_SUFFIX = x    ; then
89835c4bbdfSmrg    case $host_os in
89935c4bbdfSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
90035c4bbdfSmrg	*)		MISC_MAN_SUFFIX=7  ;;
90135c4bbdfSmrg    esac
90235c4bbdfSmrgfi
90335c4bbdfSmrgif test x$MISC_MAN_DIR = x    ; then
90435c4bbdfSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
90535c4bbdfSmrgfi
9066747b715Smrg
90735c4bbdfSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
90835c4bbdfSmrg    case $host_os in
90935c4bbdfSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
91035c4bbdfSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
91135c4bbdfSmrg    esac
91235c4bbdfSmrgfi
91335c4bbdfSmrgif test x$DRIVER_MAN_DIR = x    ; then
91435c4bbdfSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
91535c4bbdfSmrgfi
9164642e01fSmrg
91735c4bbdfSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
91835c4bbdfSmrg    case $host_os in
91935c4bbdfSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
92035c4bbdfSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
92135c4bbdfSmrg    esac
92235c4bbdfSmrgfi
92335c4bbdfSmrgif test x$ADMIN_MAN_DIR = x    ; then
92435c4bbdfSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
92535c4bbdfSmrgfi
92605b261ecSmrg
92705b261ecSmrg
92835c4bbdfSmrgAC_SUBST([APP_MAN_SUFFIX])
92935c4bbdfSmrgAC_SUBST([LIB_MAN_SUFFIX])
93035c4bbdfSmrgAC_SUBST([FILE_MAN_SUFFIX])
93135c4bbdfSmrgAC_SUBST([MISC_MAN_SUFFIX])
93235c4bbdfSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
93335c4bbdfSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
93435c4bbdfSmrgAC_SUBST([APP_MAN_DIR])
93535c4bbdfSmrgAC_SUBST([LIB_MAN_DIR])
93635c4bbdfSmrgAC_SUBST([FILE_MAN_DIR])
93735c4bbdfSmrgAC_SUBST([MISC_MAN_DIR])
93835c4bbdfSmrgAC_SUBST([DRIVER_MAN_DIR])
93935c4bbdfSmrgAC_SUBST([ADMIN_MAN_DIR])
94035c4bbdfSmrg
94135c4bbdfSmrgXORG_MAN_PAGE="X Version 11"
94235c4bbdfSmrgAC_SUBST([XORG_MAN_PAGE])
94335c4bbdfSmrgMAN_SUBSTS="\
94435c4bbdfSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
94535c4bbdfSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
94635c4bbdfSmrg	-e 's|__xservername__|Xorg|g' \
94735c4bbdfSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
94835c4bbdfSmrg	-e 's|__projectroot__|\$(prefix)|g' \
94935c4bbdfSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
95035c4bbdfSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
95135c4bbdfSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
95235c4bbdfSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
95335c4bbdfSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
95435c4bbdfSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
95535c4bbdfSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
95635c4bbdfSmrgAC_SUBST([MAN_SUBSTS])
95705b261ecSmrg
95835c4bbdfSmrg]) # XORG_MANPAGE_SECTIONS
95905b261ecSmrg
96035c4bbdfSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
96135c4bbdfSmrg# ------------------------
96235c4bbdfSmrg# Minimum version: 1.7.0
9636747b715Smrg#
96435c4bbdfSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
96535c4bbdfSmrg# provided by xorg-sgml-doctools, if installed.
96635c4bbdfSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
96735c4bbdfSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
96835c4bbdfSmrgXORG_SGML_PATH=
96935c4bbdfSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
97035c4bbdfSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
97135c4bbdfSmrg    [m4_ifval([$1],[:],
97235c4bbdfSmrg        [if test x"$cross_compiling" != x"yes" ; then
97335c4bbdfSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
97435c4bbdfSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
97535c4bbdfSmrg         fi])
97635c4bbdfSmrg    ])
97705b261ecSmrg
97835c4bbdfSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
97935c4bbdfSmrg# the path and the name of the doc stylesheet
98035c4bbdfSmrgif test "x$XORG_SGML_PATH" != "x" ; then
98135c4bbdfSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
98235c4bbdfSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
98335c4bbdfSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
98435c4bbdfSmrgelse
98535c4bbdfSmrg   AC_MSG_RESULT([no])
98635c4bbdfSmrgfi
987b1d344b3Smrg
98835c4bbdfSmrgAC_SUBST(XORG_SGML_PATH)
98935c4bbdfSmrgAC_SUBST(STYLESHEET_SRCDIR)
99035c4bbdfSmrgAC_SUBST(XSL_STYLESHEET)
99135c4bbdfSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
99235c4bbdfSmrg]) # XORG_CHECK_SGML_DOCTOOLS
99305b261ecSmrg
99435c4bbdfSmrg# XORG_CHECK_LINUXDOC
99535c4bbdfSmrg# -------------------
99635c4bbdfSmrg# Minimum version: 1.0.0
99735c4bbdfSmrg#
99835c4bbdfSmrg# Defines the variable MAKE_TEXT if the necessary tools and
99935c4bbdfSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
100035c4bbdfSmrg# Whether or not the necessary tools and files are found can be checked
100135c4bbdfSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
100235c4bbdfSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
100335c4bbdfSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
100435c4bbdfSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1005b1d344b3Smrg
100635c4bbdfSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
100705b261ecSmrg
100835c4bbdfSmrgAC_MSG_CHECKING([whether to build documentation])
100905b261ecSmrg
101035c4bbdfSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
101135c4bbdfSmrg   BUILDDOC=yes
101235c4bbdfSmrgelse
101335c4bbdfSmrg   BUILDDOC=no
101435c4bbdfSmrgfi
101505b261ecSmrg
101635c4bbdfSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
101705b261ecSmrg
101835c4bbdfSmrgAC_MSG_RESULT([$BUILDDOC])
101905b261ecSmrg
102035c4bbdfSmrgAC_MSG_CHECKING([whether to build pdf documentation])
102105b261ecSmrg
102235c4bbdfSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
102335c4bbdfSmrg   BUILDPDFDOC=yes
102435c4bbdfSmrgelse
102535c4bbdfSmrg   BUILDPDFDOC=no
102635c4bbdfSmrgfi
1027475c125cSmrg
102835c4bbdfSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1029475c125cSmrg
103035c4bbdfSmrgAC_MSG_RESULT([$BUILDPDFDOC])
103105b261ecSmrg
103235c4bbdfSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
103335c4bbdfSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
103435c4bbdfSmrgMAKE_PDF="$PS2PDF"
103535c4bbdfSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
10364642e01fSmrg
10374642e01fSmrgAC_SUBST(MAKE_TEXT)
10384642e01fSmrgAC_SUBST(MAKE_PS)
10394642e01fSmrgAC_SUBST(MAKE_PDF)
10404642e01fSmrgAC_SUBST(MAKE_HTML)
10414642e01fSmrg]) # XORG_CHECK_LINUXDOC
10424642e01fSmrg
10434642e01fSmrg# XORG_CHECK_DOCBOOK
10444642e01fSmrg# -------------------
10454642e01fSmrg# Minimum version: 1.0.0
10464642e01fSmrg#
10474642e01fSmrg# Checks for the ability to build output formats from SGML DocBook source.
10484642e01fSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
10494642e01fSmrg# indicates whether the necessary tools and files are found and, if set,
10504642e01fSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
10514642e01fSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
10526747b715SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
10536747b715Smrg
10544642e01fSmrgBUILDTXTDOC=no
10554642e01fSmrgBUILDPDFDOC=no
10564642e01fSmrgBUILDPSDOC=no
10574642e01fSmrgBUILDHTMLDOC=no
10584642e01fSmrg
10594642e01fSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
10604642e01fSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
10614642e01fSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
10624642e01fSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
10634642e01fSmrg
10646747b715SmrgAC_MSG_CHECKING([whether to build text documentation])
10656747b715Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
10664642e01fSmrg   test x$BUILD_TXTDOC != xno; then
10674642e01fSmrg	BUILDTXTDOC=yes
10684642e01fSmrgfi
10694642e01fSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
10704642e01fSmrgAC_MSG_RESULT([$BUILDTXTDOC])
10714642e01fSmrg
10726747b715SmrgAC_MSG_CHECKING([whether to build PDF documentation])
10736747b715Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
10744642e01fSmrg   test x$BUILD_PDFDOC != xno; then
10754642e01fSmrg	BUILDPDFDOC=yes
10764642e01fSmrgfi
10774642e01fSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
10784642e01fSmrgAC_MSG_RESULT([$BUILDPDFDOC])
10794642e01fSmrg
10806747b715SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
10816747b715Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
10824642e01fSmrg   test x$BUILD_PSDOC != xno; then
10834642e01fSmrg	BUILDPSDOC=yes
10844642e01fSmrgfi
10854642e01fSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
10864642e01fSmrgAC_MSG_RESULT([$BUILDPSDOC])
10874642e01fSmrg
10886747b715SmrgAC_MSG_CHECKING([whether to build HTML documentation])
10896747b715Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
10904642e01fSmrg   test x$BUILD_HTMLDOC != xno; then
10914642e01fSmrg	BUILDHTMLDOC=yes
10924642e01fSmrgfi
10934642e01fSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
10944642e01fSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
10954642e01fSmrg
10964642e01fSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
10974642e01fSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
10984642e01fSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
10994642e01fSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
11004642e01fSmrg
11014642e01fSmrgAC_SUBST(MAKE_TEXT)
11024642e01fSmrgAC_SUBST(MAKE_PS)
11034642e01fSmrgAC_SUBST(MAKE_PDF)
11044642e01fSmrgAC_SUBST(MAKE_HTML)
11054642e01fSmrg]) # XORG_CHECK_DOCBOOK
11064642e01fSmrg
11076747b715Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
11086747b715Smrg# ----------------
11096747b715Smrg# Minimum version: 1.5.0
11106747b715Smrg# Minimum version for optional DEFAULT argument: 1.11.0
11116747b715Smrg#
11126747b715Smrg# Documentation tools are not always available on all platforms and sometimes
11136747b715Smrg# not at the appropriate level. This macro enables a module to test for the
11146747b715Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
11156747b715Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
11166747b715Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
11176747b715Smrg# --with-xmlto assumes 'auto'.
11186747b715Smrg#
11196747b715Smrg# Interface to module:
11206747b715Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
11216747b715Smrg# XMLTO:	returns the path of the xmlto program found
11226747b715Smrg#		returns the path set by the user in the environment
11236747b715Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
11246747b715Smrg#		'no' user instructs the module not to use xmlto
11256747b715Smrg#
11266747b715Smrg# Added in version 1.10.0
11276747b715Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
11286747b715Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
11296747b715Smrg#
11306747b715Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
11316747b715Smrg#
11326747b715SmrgAC_DEFUN([XORG_WITH_XMLTO],[
11336747b715SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
11346747b715Smrgm4_define([_defopt], m4_default([$2], [auto]))
11356747b715SmrgAC_ARG_WITH(xmlto,
11366747b715Smrg	AS_HELP_STRING([--with-xmlto],
11376747b715Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
11386747b715Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
11396747b715Smrgm4_undefine([_defopt])
11406747b715Smrg
11416747b715Smrgif test "x$use_xmlto" = x"auto"; then
11426747b715Smrg   AC_PATH_PROG([XMLTO], [xmlto])
11436747b715Smrg   if test "x$XMLTO" = "x"; then
11446747b715Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
11456747b715Smrg	have_xmlto=no
11466747b715Smrg   else
11476747b715Smrg        have_xmlto=yes
11486747b715Smrg   fi
11496747b715Smrgelif test "x$use_xmlto" = x"yes" ; then
11506747b715Smrg   AC_PATH_PROG([XMLTO], [xmlto])
11516747b715Smrg   if test "x$XMLTO" = "x"; then
11526747b715Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
11536747b715Smrg   fi
11546747b715Smrg   have_xmlto=yes
11556747b715Smrgelif test "x$use_xmlto" = x"no" ; then
11566747b715Smrg   if test "x$XMLTO" != "x"; then
11576747b715Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
11586747b715Smrg   fi
11596747b715Smrg   have_xmlto=no
11606747b715Smrgelse
11616747b715Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
11626747b715Smrgfi
11636747b715Smrg
11646747b715Smrg# Test for a minimum version of xmlto, if provided.
11656747b715Smrgm4_ifval([$1],
11666747b715Smrg[if test "$have_xmlto" = yes; then
11676747b715Smrg    # scrape the xmlto version
11686747b715Smrg    AC_MSG_CHECKING([the xmlto version])
11696747b715Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
11706747b715Smrg    AC_MSG_RESULT([$xmlto_version])
11716747b715Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
11726747b715Smrg        [if test "x$use_xmlto" = xauto; then
11736747b715Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
11746747b715Smrg            have_xmlto=no
11756747b715Smrg        else
11766747b715Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
11776747b715Smrg        fi])
11786747b715Smrgfi])
11796747b715Smrg
11806747b715Smrg# Test for the ability of xmlto to generate a text target
11816747b715Smrghave_xmlto_text=no
11826747b715Smrgcat > conftest.xml << "EOF"
11836747b715SmrgEOF
11846747b715SmrgAS_IF([test "$have_xmlto" = yes],
11856747b715Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
11866747b715Smrg             [have_xmlto_text=yes],
11876747b715Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
11886747b715Smrgrm -f conftest.xml
11896747b715SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
11906747b715SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
11916747b715Smrg]) # XORG_WITH_XMLTO
11926747b715Smrg
11938223e2f2Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
11948223e2f2Smrg# --------------------------------------------
11958223e2f2Smrg# Minimum version: 1.12.0
11968223e2f2Smrg# Minimum version for optional DEFAULT argument: 1.12.0
11978223e2f2Smrg#
11988223e2f2Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
11998223e2f2Smrg# XML-based language used for the transformation of XML documents.
12008223e2f2Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
12018223e2f2Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
12028223e2f2Smrg# The XSLT processor is often used as a standalone tool for transformations.
12038223e2f2Smrg# It should not be assumed that this tool is used only to work with documnetation.
12048223e2f2Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
12058223e2f2Smrg#
12068223e2f2Smrg# Interface to module:
12078223e2f2Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
12088223e2f2Smrg# XSLTPROC:	 returns the path of the xsltproc program found
12098223e2f2Smrg#		 returns the path set by the user in the environment
12108223e2f2Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
12118223e2f2Smrg#		  'no' user instructs the module not to use xsltproc
12128223e2f2Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
12138223e2f2Smrg#
12148223e2f2Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
12158223e2f2Smrg#
12168223e2f2SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
12178223e2f2SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1218475c125cSmrg# Preserves the interface, should it be implemented later
1219475c125cSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
12208223e2f2Smrgm4_define([_defopt], m4_default([$2], [auto]))
12218223e2f2SmrgAC_ARG_WITH(xsltproc,
12228223e2f2Smrg	AS_HELP_STRING([--with-xsltproc],
12238223e2f2Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
12248223e2f2Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
12258223e2f2Smrgm4_undefine([_defopt])
12268223e2f2Smrg
12278223e2f2Smrgif test "x$use_xsltproc" = x"auto"; then
12288223e2f2Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
12298223e2f2Smrg   if test "x$XSLTPROC" = "x"; then
12308223e2f2Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
12318223e2f2Smrg	have_xsltproc=no
12328223e2f2Smrg   else
12338223e2f2Smrg        have_xsltproc=yes
12348223e2f2Smrg   fi
12358223e2f2Smrgelif test "x$use_xsltproc" = x"yes" ; then
12368223e2f2Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
12378223e2f2Smrg   if test "x$XSLTPROC" = "x"; then
12388223e2f2Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
12398223e2f2Smrg   fi
12408223e2f2Smrg   have_xsltproc=yes
12418223e2f2Smrgelif test "x$use_xsltproc" = x"no" ; then
12428223e2f2Smrg   if test "x$XSLTPROC" != "x"; then
12438223e2f2Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
12448223e2f2Smrg   fi
12458223e2f2Smrg   have_xsltproc=no
12468223e2f2Smrgelse
12478223e2f2Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
12488223e2f2Smrgfi
12498223e2f2Smrg
12508223e2f2SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
12518223e2f2Smrg]) # XORG_WITH_XSLTPROC
12528223e2f2Smrg
1253475c125cSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1254475c125cSmrg# ----------------------------------------
1255475c125cSmrg# Minimum version: 1.15.0
1256475c125cSmrg#
1257475c125cSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
1258475c125cSmrg# scanning arbitrary text files, extracting information from those text files,
1259475c125cSmrg# and printing reports based on that information.
1260475c125cSmrg#
1261475c125cSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1262475c125cSmrg#
1263475c125cSmrg# Interface to module:
1264475c125cSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
1265475c125cSmrg# PERL:	     returns the path of the perl program found
1266475c125cSmrg#	     returns the path set by the user in the environment
1267475c125cSmrg# --with-perl: 'yes' user instructs the module to use perl
1268475c125cSmrg#	       'no' user instructs the module not to use perl
1269475c125cSmrg# have_perl: returns yes if perl found in PATH or no
1270475c125cSmrg#
1271475c125cSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1272475c125cSmrg#
1273475c125cSmrgAC_DEFUN([XORG_WITH_PERL],[
1274475c125cSmrgAC_ARG_VAR([PERL], [Path to perl command])
1275475c125cSmrg# Preserves the interface, should it be implemented later
1276475c125cSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1277475c125cSmrgm4_define([_defopt], m4_default([$2], [auto]))
1278475c125cSmrgAC_ARG_WITH(perl,
1279475c125cSmrg	AS_HELP_STRING([--with-perl],
1280475c125cSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1281475c125cSmrg	   [use_perl=$withval], [use_perl=]_defopt)
1282475c125cSmrgm4_undefine([_defopt])
1283475c125cSmrg
1284475c125cSmrgif test "x$use_perl" = x"auto"; then
1285475c125cSmrg   AC_PATH_PROG([PERL], [perl])
1286475c125cSmrg   if test "x$PERL" = "x"; then
1287475c125cSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1288475c125cSmrg	have_perl=no
1289475c125cSmrg   else
1290475c125cSmrg        have_perl=yes
1291475c125cSmrg   fi
1292475c125cSmrgelif test "x$use_perl" = x"yes" ; then
1293475c125cSmrg   AC_PATH_PROG([PERL], [perl])
1294475c125cSmrg   if test "x$PERL" = "x"; then
1295475c125cSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1296475c125cSmrg   fi
1297475c125cSmrg   have_perl=yes
1298475c125cSmrgelif test "x$use_perl" = x"no" ; then
1299475c125cSmrg   if test "x$PERL" != "x"; then
1300475c125cSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1301475c125cSmrg   fi
1302475c125cSmrg   have_perl=no
1303475c125cSmrgelse
1304475c125cSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1305475c125cSmrgfi
1306475c125cSmrg
1307475c125cSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1308475c125cSmrg]) # XORG_WITH_PERL
13098223e2f2Smrg
13106747b715Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
13116747b715Smrg# ----------------
13126747b715Smrg# Minimum version: 1.5.0
13136747b715Smrg# Minimum version for optional DEFAULT argument: 1.11.0
13146747b715Smrg#
13156747b715Smrg# Documentation tools are not always available on all platforms and sometimes
13166747b715Smrg# not at the appropriate level. This macro enables a module to test for the
13176747b715Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
13186747b715Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
13196747b715Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
13206747b715Smrg# --with-asciidoc assumes 'auto'.
13216747b715Smrg#
13226747b715Smrg# Interface to module:
13236747b715Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
13246747b715Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
13256747b715Smrg#		 returns the path set by the user in the environment
13266747b715Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
13276747b715Smrg#		  'no' user instructs the module not to use asciidoc
13286747b715Smrg#
13296747b715Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
13306747b715Smrg#
13316747b715SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
13326747b715SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
13336747b715Smrgm4_define([_defopt], m4_default([$2], [auto]))
13346747b715SmrgAC_ARG_WITH(asciidoc,
13356747b715Smrg	AS_HELP_STRING([--with-asciidoc],
13366747b715Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
13376747b715Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
13386747b715Smrgm4_undefine([_defopt])
13396747b715Smrg
13406747b715Smrgif test "x$use_asciidoc" = x"auto"; then
13416747b715Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
13426747b715Smrg   if test "x$ASCIIDOC" = "x"; then
13436747b715Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
13446747b715Smrg	have_asciidoc=no
13456747b715Smrg   else
13466747b715Smrg        have_asciidoc=yes
13476747b715Smrg   fi
13486747b715Smrgelif test "x$use_asciidoc" = x"yes" ; then
13496747b715Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
13506747b715Smrg   if test "x$ASCIIDOC" = "x"; then
13516747b715Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
13526747b715Smrg   fi
13536747b715Smrg   have_asciidoc=yes
13546747b715Smrgelif test "x$use_asciidoc" = x"no" ; then
13556747b715Smrg   if test "x$ASCIIDOC" != "x"; then
13566747b715Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
13576747b715Smrg   fi
13586747b715Smrg   have_asciidoc=no
13596747b715Smrgelse
13606747b715Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
13616747b715Smrgfi
13626747b715Smrgm4_ifval([$1],
13636747b715Smrg[if test "$have_asciidoc" = yes; then
13646747b715Smrg    # scrape the asciidoc version
13656747b715Smrg    AC_MSG_CHECKING([the asciidoc version])
13666747b715Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
13676747b715Smrg    AC_MSG_RESULT([$asciidoc_version])
13686747b715Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
13696747b715Smrg        [if test "x$use_asciidoc" = xauto; then
13706747b715Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
13716747b715Smrg            have_asciidoc=no
13726747b715Smrg        else
13736747b715Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
13746747b715Smrg        fi])
13756747b715Smrgfi])
13766747b715SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
13776747b715Smrg]) # XORG_WITH_ASCIIDOC
13786747b715Smrg
13796747b715Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
138035c4bbdfSmrg# -------------------------------------------
13816747b715Smrg# Minimum version: 1.5.0
13826747b715Smrg# Minimum version for optional DEFAULT argument: 1.11.0
138335c4bbdfSmrg# Minimum version for optional DOT checking: 1.18.0
13846747b715Smrg#
13856747b715Smrg# Documentation tools are not always available on all platforms and sometimes
13866747b715Smrg# not at the appropriate level. This macro enables a module to test for the
13876747b715Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
13886747b715Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
13896747b715Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
13906747b715Smrg# --with-doxygen assumes 'auto'.
13916747b715Smrg#
13926747b715Smrg# Interface to module:
13936747b715Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
13946747b715Smrg# DOXYGEN:	 returns the path of the doxygen program found
13956747b715Smrg#		 returns the path set by the user in the environment
13966747b715Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
13976747b715Smrg#		  'no' user instructs the module not to use doxygen
13986747b715Smrg#
13996747b715Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
14006747b715Smrg#
14016747b715SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
14026747b715SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
140335c4bbdfSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
14046747b715Smrgm4_define([_defopt], m4_default([$2], [auto]))
14056747b715SmrgAC_ARG_WITH(doxygen,
14066747b715Smrg	AS_HELP_STRING([--with-doxygen],
14076747b715Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
14086747b715Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
14096747b715Smrgm4_undefine([_defopt])
14106747b715Smrg
14116747b715Smrgif test "x$use_doxygen" = x"auto"; then
14126747b715Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
14136747b715Smrg   if test "x$DOXYGEN" = "x"; then
14146747b715Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
14156747b715Smrg	have_doxygen=no
14166747b715Smrg   else
14176747b715Smrg        have_doxygen=yes
14186747b715Smrg   fi
14196747b715Smrgelif test "x$use_doxygen" = x"yes" ; then
14206747b715Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
14216747b715Smrg   if test "x$DOXYGEN" = "x"; then
14226747b715Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
14236747b715Smrg   fi
14246747b715Smrg   have_doxygen=yes
14256747b715Smrgelif test "x$use_doxygen" = x"no" ; then
14266747b715Smrg   if test "x$DOXYGEN" != "x"; then
14276747b715Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
14286747b715Smrg   fi
14296747b715Smrg   have_doxygen=no
14306747b715Smrgelse
14316747b715Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
14326747b715Smrgfi
14336747b715Smrgm4_ifval([$1],
14346747b715Smrg[if test "$have_doxygen" = yes; then
14356747b715Smrg    # scrape the doxygen version
14366747b715Smrg    AC_MSG_CHECKING([the doxygen version])
14376747b715Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
14386747b715Smrg    AC_MSG_RESULT([$doxygen_version])
14396747b715Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
14406747b715Smrg        [if test "x$use_doxygen" = xauto; then
14416747b715Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
14426747b715Smrg            have_doxygen=no
14436747b715Smrg        else
14446747b715Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
14456747b715Smrg        fi])
14466747b715Smrgfi])
144735c4bbdfSmrg
144835c4bbdfSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
144935c4bbdfSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
145035c4bbdfSmrgdnl 	HAVE_DOT = @HAVE_DOT@
145135c4bbdfSmrgHAVE_DOT=no
145235c4bbdfSmrgif test "x$have_doxygen" = "xyes"; then
145335c4bbdfSmrg  AC_PATH_PROG([DOT], [dot])
145435c4bbdfSmrg    if test "x$DOT" != "x"; then
145535c4bbdfSmrg      HAVE_DOT=yes
145635c4bbdfSmrg    fi
145735c4bbdfSmrgfi
145835c4bbdfSmrg
145935c4bbdfSmrgAC_SUBST([HAVE_DOT])
146035c4bbdfSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
14616747b715SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
14626747b715Smrg]) # XORG_WITH_DOXYGEN
14636747b715Smrg
14646747b715Smrg# XORG_WITH_GROFF([DEFAULT])
14656747b715Smrg# ----------------
14666747b715Smrg# Minimum version: 1.6.0
14676747b715Smrg# Minimum version for optional DEFAULT argument: 1.11.0
14686747b715Smrg#
14696747b715Smrg# Documentation tools are not always available on all platforms and sometimes
14706747b715Smrg# not at the appropriate level. This macro enables a module to test for the
14716747b715Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
14726747b715Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
14736747b715Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
14746747b715Smrg# --with-groff assumes 'auto'.
14756747b715Smrg#
14766747b715Smrg# Interface to module:
14776747b715Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
14786747b715Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
14796747b715Smrg# HAVE_GROFF_MS: the -ms macros package
14806747b715Smrg# GROFF:	 returns the path of the groff program found
14816747b715Smrg#		 returns the path set by the user in the environment
14826747b715Smrg# --with-groff:	 'yes' user instructs the module to use groff
14836747b715Smrg#		 'no' user instructs the module not to use groff
14846747b715Smrg#
14856747b715Smrg# Added in version 1.9.0:
14866747b715Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
14876747b715Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
14886747b715Smrg#		   psselect from the psutils package.
14896747b715Smrg#		   the ghostcript package. Refer to the grohtml man pages
14906747b715Smrg#
14916747b715Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
14926747b715Smrg#
14936747b715Smrg# OS and distros often splits groff in a basic and full package, the former
14946747b715Smrg# having the groff program and the later having devices, fonts and macros
14956747b715Smrg# Checking for the groff executable is not enough.
14966747b715Smrg#
14976747b715Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
14986747b715Smrg# unset HAVE_GROFF or GROFF env variables.
14996747b715Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
15006747b715Smrg#
15016747b715SmrgAC_DEFUN([XORG_WITH_GROFF],[
15026747b715SmrgAC_ARG_VAR([GROFF], [Path to groff command])
15036747b715Smrgm4_define([_defopt], m4_default([$1], [auto]))
15046747b715SmrgAC_ARG_WITH(groff,
15056747b715Smrg	AS_HELP_STRING([--with-groff],
15066747b715Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
15076747b715Smrg	   [use_groff=$withval], [use_groff=]_defopt)
15086747b715Smrgm4_undefine([_defopt])
15096747b715Smrg
15106747b715Smrgif test "x$use_groff" = x"auto"; then
15116747b715Smrg   AC_PATH_PROG([GROFF], [groff])
15126747b715Smrg   if test "x$GROFF" = "x"; then
15136747b715Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
15146747b715Smrg	have_groff=no
15156747b715Smrg   else
15166747b715Smrg        have_groff=yes
15176747b715Smrg   fi
15186747b715Smrgelif test "x$use_groff" = x"yes" ; then
15196747b715Smrg   AC_PATH_PROG([GROFF], [groff])
15206747b715Smrg   if test "x$GROFF" = "x"; then
15216747b715Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
15226747b715Smrg   fi
15236747b715Smrg   have_groff=yes
15246747b715Smrgelif test "x$use_groff" = x"no" ; then
15256747b715Smrg   if test "x$GROFF" != "x"; then
15266747b715Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
15276747b715Smrg   fi
15286747b715Smrg   have_groff=no
15296747b715Smrgelse
15306747b715Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
15316747b715Smrgfi
15326747b715Smrg
15336747b715Smrg# We have groff, test for the presence of the macro packages
15346747b715Smrgif test "x$have_groff" = x"yes"; then
15356747b715Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
15366747b715Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
15376747b715Smrg        groff_ms_works=yes
15386747b715Smrg    else
15396747b715Smrg        groff_ms_works=no
15406747b715Smrg    fi
15416747b715Smrg    AC_MSG_RESULT([$groff_ms_works])
15426747b715Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
15436747b715Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
15446747b715Smrg        groff_mm_works=yes
15456747b715Smrg    else
15466747b715Smrg        groff_mm_works=no
15476747b715Smrg    fi
15486747b715Smrg    AC_MSG_RESULT([$groff_mm_works])
15496747b715Smrgfi
15506747b715Smrg
15516747b715Smrg# We have groff, test for HTML dependencies, one command per package
15526747b715Smrgif test "x$have_groff" = x"yes"; then
15536747b715Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
15546747b715Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
15556747b715Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
15566747b715Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
15576747b715Smrg      have_groff_html=yes
15586747b715Smrg   else
15596747b715Smrg      have_groff_html=no
15606747b715Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
15616747b715Smrg   fi
15626747b715Smrgfi
15636747b715Smrg
15646747b715Smrg# Set Automake conditionals for Makefiles
15656747b715SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
15666747b715SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
15676747b715SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
15686747b715SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
15696747b715Smrg]) # XORG_WITH_GROFF
15706747b715Smrg
1571475c125cSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
1572475c125cSmrg# ---------------------------------------
15736747b715Smrg# Minimum version: 1.6.0
15746747b715Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1575475c125cSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
15766747b715Smrg#
15776747b715Smrg# Documentation tools are not always available on all platforms and sometimes
15786747b715Smrg# not at the appropriate level. This macro enables a module to test for the
15796747b715Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
15806747b715Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
15816747b715Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
15826747b715Smrg# --with-fop assumes 'auto'.
15836747b715Smrg#
15846747b715Smrg# Interface to module:
15856747b715Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
15866747b715Smrg# FOP:	 	returns the path of the fop program found
15876747b715Smrg#		returns the path set by the user in the environment
15886747b715Smrg# --with-fop: 	'yes' user instructs the module to use fop
15896747b715Smrg#		'no' user instructs the module not to use fop
15906747b715Smrg#
15916747b715Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
15926747b715Smrg#
15936747b715SmrgAC_DEFUN([XORG_WITH_FOP],[
15946747b715SmrgAC_ARG_VAR([FOP], [Path to fop command])
1595475c125cSmrgm4_define([_defopt], m4_default([$2], [auto]))
15966747b715SmrgAC_ARG_WITH(fop,
15976747b715Smrg	AS_HELP_STRING([--with-fop],
15986747b715Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
15996747b715Smrg	   [use_fop=$withval], [use_fop=]_defopt)
16006747b715Smrgm4_undefine([_defopt])
16016747b715Smrg
16026747b715Smrgif test "x$use_fop" = x"auto"; then
16036747b715Smrg   AC_PATH_PROG([FOP], [fop])
16046747b715Smrg   if test "x$FOP" = "x"; then
16056747b715Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
16066747b715Smrg	have_fop=no
16076747b715Smrg   else
16086747b715Smrg        have_fop=yes
16096747b715Smrg   fi
16106747b715Smrgelif test "x$use_fop" = x"yes" ; then
16116747b715Smrg   AC_PATH_PROG([FOP], [fop])
16126747b715Smrg   if test "x$FOP" = "x"; then
16136747b715Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
16146747b715Smrg   fi
16156747b715Smrg   have_fop=yes
16166747b715Smrgelif test "x$use_fop" = x"no" ; then
16176747b715Smrg   if test "x$FOP" != "x"; then
16186747b715Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
16196747b715Smrg   fi
16206747b715Smrg   have_fop=no
16216747b715Smrgelse
16226747b715Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
16236747b715Smrgfi
1624475c125cSmrg
1625475c125cSmrg# Test for a minimum version of fop, if provided.
1626475c125cSmrgm4_ifval([$1],
1627475c125cSmrg[if test "$have_fop" = yes; then
1628475c125cSmrg    # scrape the fop version
1629475c125cSmrg    AC_MSG_CHECKING([for fop minimum version])
1630475c125cSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
1631475c125cSmrg    AC_MSG_RESULT([$fop_version])
1632475c125cSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
1633475c125cSmrg        [if test "x$use_fop" = xauto; then
1634475c125cSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
1635475c125cSmrg            have_fop=no
1636475c125cSmrg        else
1637475c125cSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
1638475c125cSmrg        fi])
1639475c125cSmrgfi])
16406747b715SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
16416747b715Smrg]) # XORG_WITH_FOP
16426747b715Smrg
164335c4bbdfSmrg# XORG_WITH_M4([MIN-VERSION])
164435c4bbdfSmrg# ---------------------------
164535c4bbdfSmrg# Minimum version: 1.19.0
164635c4bbdfSmrg#
164735c4bbdfSmrg# This macro attempts to locate an m4 macro processor which supports
164835c4bbdfSmrg# -I option and is only useful for modules relying on M4 in order to
164935c4bbdfSmrg# expand macros in source code files.
165035c4bbdfSmrg#
165135c4bbdfSmrg# Interface to module:
165235c4bbdfSmrg# M4:	 	returns the path of the m4 program found
165335c4bbdfSmrg#		returns the path set by the user in the environment
165435c4bbdfSmrg#
165535c4bbdfSmrgAC_DEFUN([XORG_WITH_M4], [
165635c4bbdfSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
165735c4bbdfSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
165835c4bbdfSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
165935c4bbdfSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
166035c4bbdfSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
166135c4bbdfSmrg   [$PATH:/usr/gnu/bin])])
166235c4bbdfSmrg
166335c4bbdfSmrgAC_SUBST([M4], [$ac_cv_path_M4])
166435c4bbdfSmrg]) # XORG_WITH_M4
166535c4bbdfSmrg
16666747b715Smrg# XORG_WITH_PS2PDF([DEFAULT])
16676747b715Smrg# ----------------
16686747b715Smrg# Minimum version: 1.6.0
16696747b715Smrg# Minimum version for optional DEFAULT argument: 1.11.0
16706747b715Smrg#
16716747b715Smrg# Documentation tools are not always available on all platforms and sometimes
16726747b715Smrg# not at the appropriate level. This macro enables a module to test for the
16736747b715Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
16746747b715Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
16756747b715Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
16766747b715Smrg# --with-ps2pdf assumes 'auto'.
16776747b715Smrg#
16786747b715Smrg# Interface to module:
16796747b715Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
16806747b715Smrg# PS2PDF:	returns the path of the ps2pdf program found
16816747b715Smrg#		returns the path set by the user in the environment
16826747b715Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
16836747b715Smrg#		 'no' user instructs the module not to use ps2pdf
16846747b715Smrg#
16856747b715Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
16866747b715Smrg#
16876747b715SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
16886747b715SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
16896747b715Smrgm4_define([_defopt], m4_default([$1], [auto]))
16906747b715SmrgAC_ARG_WITH(ps2pdf,
16916747b715Smrg	AS_HELP_STRING([--with-ps2pdf],
16926747b715Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
16936747b715Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
16946747b715Smrgm4_undefine([_defopt])
16956747b715Smrg
16966747b715Smrgif test "x$use_ps2pdf" = x"auto"; then
16976747b715Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
16986747b715Smrg   if test "x$PS2PDF" = "x"; then
16996747b715Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
17006747b715Smrg	have_ps2pdf=no
17016747b715Smrg   else
17026747b715Smrg        have_ps2pdf=yes
17036747b715Smrg   fi
17046747b715Smrgelif test "x$use_ps2pdf" = x"yes" ; then
17056747b715Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
17066747b715Smrg   if test "x$PS2PDF" = "x"; then
17076747b715Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
17086747b715Smrg   fi
17096747b715Smrg   have_ps2pdf=yes
17106747b715Smrgelif test "x$use_ps2pdf" = x"no" ; then
17116747b715Smrg   if test "x$PS2PDF" != "x"; then
17126747b715Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
17136747b715Smrg   fi
17146747b715Smrg   have_ps2pdf=no
17156747b715Smrgelse
17166747b715Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
17176747b715Smrgfi
17186747b715SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
17196747b715Smrg]) # XORG_WITH_PS2PDF
17206747b715Smrg
17216747b715Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
17226747b715Smrg# ----------------
17236747b715Smrg# Minimum version: 1.6.0
17246747b715Smrg#
17256747b715Smrg# Documentation tools are not always available on all platforms and sometimes
17266747b715Smrg# not at the appropriate level. This macro enables a builder to skip all
17276747b715Smrg# documentation targets except traditional man pages.
17286747b715Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
17296747b715Smrg# maximum flexibilty in controlling documentation building.
17306747b715Smrg# Refer to:
17316747b715Smrg# XORG_WITH_XMLTO         --with-xmlto
17326747b715Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
17336747b715Smrg# XORG_WITH_DOXYGEN       --with-doxygen
17346747b715Smrg# XORG_WITH_FOP           --with-fop
17356747b715Smrg# XORG_WITH_GROFF         --with-groff
17366747b715Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
17376747b715Smrg#
17386747b715Smrg# Interface to module:
17396747b715Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
17406747b715Smrg# --enable-docs: 'yes' user instructs the module to generate docs
17416747b715Smrg#		 'no' user instructs the module not to generate docs
17426747b715Smrg# parm1:	specify the default value, yes or no.
17436747b715Smrg#
17446747b715SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
17458223e2f2Smrgm4_define([docs_default], m4_default([$1], [yes]))
17466747b715SmrgAC_ARG_ENABLE(docs,
17476747b715Smrg	AS_HELP_STRING([--enable-docs],
17488223e2f2Smrg	   [Enable building the documentation (default: ]docs_default[)]),
17498223e2f2Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
17508223e2f2Smrgm4_undefine([docs_default])
17516747b715SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
17526747b715SmrgAC_MSG_CHECKING([whether to build documentation])
17536747b715SmrgAC_MSG_RESULT([$build_docs])
17546747b715Smrg]) # XORG_ENABLE_DOCS
17556747b715Smrg
17566747b715Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
17576747b715Smrg# ----------------
17586747b715Smrg# Minimum version: 1.6.0
17596747b715Smrg#
17606747b715Smrg# This macro enables a builder to skip all developer documentation.
17616747b715Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
17626747b715Smrg# maximum flexibilty in controlling documentation building.
17636747b715Smrg# Refer to:
17646747b715Smrg# XORG_WITH_XMLTO         --with-xmlto
17656747b715Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
17666747b715Smrg# XORG_WITH_DOXYGEN       --with-doxygen
17676747b715Smrg# XORG_WITH_FOP           --with-fop
17686747b715Smrg# XORG_WITH_GROFF         --with-groff
17696747b715Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
17706747b715Smrg#
17716747b715Smrg# Interface to module:
17726747b715Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
17736747b715Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
17746747b715Smrg#			'no' user instructs the module not to generate developer docs
17756747b715Smrg# parm1:		specify the default value, yes or no.
17766747b715Smrg#
17776747b715SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
17786747b715Smrgm4_define([devel_default], m4_default([$1], [yes]))
17796747b715SmrgAC_ARG_ENABLE(devel-docs,
17806747b715Smrg	AS_HELP_STRING([--enable-devel-docs],
17816747b715Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
17826747b715Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
17836747b715Smrgm4_undefine([devel_default])
17846747b715SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
17856747b715SmrgAC_MSG_CHECKING([whether to build developer documentation])
17866747b715SmrgAC_MSG_RESULT([$build_devel_docs])
17876747b715Smrg]) # XORG_ENABLE_DEVEL_DOCS
17886747b715Smrg
17896747b715Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
17906747b715Smrg# ----------------
17916747b715Smrg# Minimum version: 1.6.0
17926747b715Smrg#
17936747b715Smrg# This macro enables a builder to skip all functional specification targets.
17946747b715Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
17956747b715Smrg# maximum flexibilty in controlling documentation building.
17966747b715Smrg# Refer to:
17976747b715Smrg# XORG_WITH_XMLTO         --with-xmlto
17986747b715Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
17996747b715Smrg# XORG_WITH_DOXYGEN       --with-doxygen
18006747b715Smrg# XORG_WITH_FOP           --with-fop
18016747b715Smrg# XORG_WITH_GROFF         --with-groff
18026747b715Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
18036747b715Smrg#
18046747b715Smrg# Interface to module:
18056747b715Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
18066747b715Smrg# --enable-specs:	'yes' user instructs the module to generate specs
18076747b715Smrg#			'no' user instructs the module not to generate specs
18086747b715Smrg# parm1:		specify the default value, yes or no.
18096747b715Smrg#
18106747b715SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
18116747b715Smrgm4_define([spec_default], m4_default([$1], [yes]))
18126747b715SmrgAC_ARG_ENABLE(specs,
18136747b715Smrg	AS_HELP_STRING([--enable-specs],
18146747b715Smrg	   [Enable building the specs (default: ]spec_default[)]),
18156747b715Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
18166747b715Smrgm4_undefine([spec_default])
18176747b715SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
18186747b715SmrgAC_MSG_CHECKING([whether to build functional specifications])
18196747b715SmrgAC_MSG_RESULT([$build_specs])
18206747b715Smrg]) # XORG_ENABLE_SPECS
18216747b715Smrg
18229ace9065Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
18239ace9065Smrg# ----------------------------------------------
18249ace9065Smrg# Minimum version: 1.13.0
18259ace9065Smrg#
18269ace9065Smrg# This macro enables a builder to enable/disable unit testing
18279ace9065Smrg# It makes no assumption about the test cases implementation
18289ace9065Smrg# Test cases may or may not use Automake "Support for test suites"
18299ace9065Smrg# They may or may not use the software utility library GLib
18309ace9065Smrg#
18319ace9065Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
18329ace9065Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
18339ace9065Smrg# The variable enable_unit_tests is used by other macros in this file.
18349ace9065Smrg#
18359ace9065Smrg# Interface to module:
18369ace9065Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
18379ace9065Smrg# enable_unit_tests:    used in configure.ac for additional configuration
18389ace9065Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
18399ace9065Smrg#			'no' user instructs the module not to build tests
18409ace9065Smrg# parm1:		specify the default value, yes or no.
18419ace9065Smrg#
18429ace9065SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
18439ace9065SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
18449ace9065SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
1845475c125cSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
18469ace9065Smrgm4_define([_defopt], m4_default([$1], [auto]))
18479ace9065SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
18489ace9065Smrg	[Enable building unit test cases (default: ]_defopt[)]),
18499ace9065Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
18509ace9065Smrgm4_undefine([_defopt])
18519ace9065SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
18529ace9065SmrgAC_MSG_CHECKING([whether to build unit test cases])
18539ace9065SmrgAC_MSG_RESULT([$enable_unit_tests])
18549ace9065Smrg]) # XORG_ENABLE_UNIT_TESTS
18559ace9065Smrg
185635c4bbdfSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
185735c4bbdfSmrg# ------------------------------------------------------
185835c4bbdfSmrg# Minimum version: 1.17.0
185935c4bbdfSmrg#
186035c4bbdfSmrg# This macro enables a builder to enable/disable integration testing
186135c4bbdfSmrg# It makes no assumption about the test cases' implementation
186235c4bbdfSmrg# Test cases may or may not use Automake "Support for test suites"
186335c4bbdfSmrg#
186435c4bbdfSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
186535c4bbdfSmrg# usually requires less dependencies and may be built and run under less
186635c4bbdfSmrg# stringent environments than integration tests.
186735c4bbdfSmrg#
186835c4bbdfSmrg# Interface to module:
186935c4bbdfSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
187035c4bbdfSmrg# enable_integration_tests:   used in configure.ac for additional configuration
187135c4bbdfSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
187235c4bbdfSmrg#                             'no' user instructs the module not to build tests
187335c4bbdfSmrg# parm1:                      specify the default value, yes or no.
187435c4bbdfSmrg#
187535c4bbdfSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
187635c4bbdfSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
187735c4bbdfSmrgm4_define([_defopt], m4_default([$1], [auto]))
187835c4bbdfSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
187935c4bbdfSmrg	[Enable building integration test cases (default: ]_defopt[)]),
188035c4bbdfSmrg	[enable_integration_tests=$enableval],
188135c4bbdfSmrg	[enable_integration_tests=]_defopt)
188235c4bbdfSmrgm4_undefine([_defopt])
188335c4bbdfSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
188435c4bbdfSmrg	[test "x$enable_integration_tests" != xno])
188535c4bbdfSmrgAC_MSG_CHECKING([whether to build unit test cases])
188635c4bbdfSmrgAC_MSG_RESULT([$enable_integration_tests])
188735c4bbdfSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
188835c4bbdfSmrg
188935c4bbdfSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
189035c4bbdfSmrg# ----------------------------------------
18919ace9065Smrg# Minimum version: 1.13.0
18929ace9065Smrg#
18939ace9065Smrg# GLib is a library which provides advanced data structures and functions.
18949ace9065Smrg# This macro enables a module to test for the presence of Glib.
18959ace9065Smrg#
18969ace9065Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
18979ace9065Smrg# Otherwise the value of $enable_unit_tests is blank.
18989ace9065Smrg#
189935c4bbdfSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
190035c4bbdfSmrg# test support usually requires less dependencies and may be built and run under
190135c4bbdfSmrg# less stringent environments than integration tests.
190235c4bbdfSmrg#
19039ace9065Smrg# Interface to module:
19049ace9065Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
19059ace9065Smrg# with_glib: used in configure.ac to know if GLib has been found
19069ace9065Smrg# --with-glib:	'yes' user instructs the module to use glib
19079ace9065Smrg#		'no' user instructs the module not to use glib
19089ace9065Smrg#
19099ace9065SmrgAC_DEFUN([XORG_WITH_GLIB],[
19109ace9065SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
19119ace9065Smrgm4_define([_defopt], m4_default([$2], [auto]))
19129ace9065SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
19139ace9065Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
19149ace9065Smrg	[with_glib=$withval], [with_glib=]_defopt)
19159ace9065Smrgm4_undefine([_defopt])
19169ace9065Smrg
19179ace9065Smrghave_glib=no
19189ace9065Smrg# Do not probe GLib if user explicitly disabled unit testing
19199ace9065Smrgif test "x$enable_unit_tests" != x"no"; then
19209ace9065Smrg  # Do not probe GLib if user explicitly disabled it
19219ace9065Smrg  if test "x$with_glib" != x"no"; then
19229ace9065Smrg    m4_ifval(
19239ace9065Smrg      [$1],
19249ace9065Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
19259ace9065Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
19269ace9065Smrg    )
19279ace9065Smrg  fi
19289ace9065Smrgfi
19299ace9065Smrg
19309ace9065Smrg# Not having GLib when unit testing has been explicitly requested is an error
19319ace9065Smrgif test "x$enable_unit_tests" = x"yes"; then
19329ace9065Smrg  if test "x$have_glib" = x"no"; then
19339ace9065Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
19349ace9065Smrg  fi
19359ace9065Smrgfi
19369ace9065Smrg
19379ace9065Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
19389ace9065Smrgif test "x$enable_unit_tests" = x"no"; then
19399ace9065Smrg  if test "x$with_glib" = x"yes"; then
19409ace9065Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
19419ace9065Smrg  fi
19429ace9065Smrgfi
19439ace9065Smrg
19449ace9065Smrg# Not having GLib when it has been explicitly requested is an error
19459ace9065Smrgif test "x$with_glib" = x"yes"; then
19469ace9065Smrg  if test "x$have_glib" = x"no"; then
19479ace9065Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
19489ace9065Smrg  fi
19499ace9065Smrgfi
19509ace9065Smrg
19519ace9065SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
19529ace9065Smrg]) # XORG_WITH_GLIB
19539ace9065Smrg
1954475c125cSmrg# XORG_LD_WRAP([required|optional])
1955475c125cSmrg# ---------------------------------
19569ace9065Smrg# Minimum version: 1.13.0
19579ace9065Smrg#
19589ace9065Smrg# Check if linker supports -wrap, passed via compiler flags
19599ace9065Smrg#
19609ace9065Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
19619ace9065Smrg# Otherwise the value of $enable_unit_tests is blank.
19629ace9065Smrg#
1963475c125cSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
1964475c125cSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
1965475c125cSmrg# available, an argument of "optional" allows use when some unit tests require
1966475c125cSmrg# ld -wrap and others do not.
1967475c125cSmrg#
19689ace9065SmrgAC_DEFUN([XORG_LD_WRAP],[
1969475c125cSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
1970475c125cSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
1971475c125cSmrg                      void __wrap_exit(int status) { return; }],
1972475c125cSmrg                     [exit(0);])])
19739ace9065Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
1974475c125cSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
19759ace9065Smrg  if test "x$have_ld_wrap" = x"no"; then
19769ace9065Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
19779ace9065Smrg  fi
19789ace9065Smrgfi
19799ace9065SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
19809ace9065Smrg#
19819ace9065Smrg]) # XORG_LD_WRAP
19829ace9065Smrg
19839ace9065Smrg# XORG_CHECK_LINKER_FLAGS
19849ace9065Smrg# -----------------------
19859ace9065Smrg# SYNOPSIS
19869ace9065Smrg#
1987475c125cSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
19889ace9065Smrg#
19899ace9065Smrg# DESCRIPTION
19909ace9065Smrg#
19919ace9065Smrg#   Check whether the given linker FLAGS work with the current language's
19929ace9065Smrg#   linker, or whether they give an error.
19939ace9065Smrg#
19949ace9065Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
19959ace9065Smrg#   success/failure.
19969ace9065Smrg#
1997475c125cSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
1998475c125cSmrg#
19999ace9065Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
20009ace9065Smrg#
20019ace9065Smrg# LICENSE
20029ace9065Smrg#
20039ace9065Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
20049ace9065Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
20059ace9065Smrg#   Copyright (c) 2009 Matteo Frigo
20069ace9065Smrg#
20079ace9065Smrg#   This program is free software: you can redistribute it and/or modify it
20089ace9065Smrg#   under the terms of the GNU General Public License as published by the
20099ace9065Smrg#   Free Software Foundation, either version 3 of the License, or (at your
20109ace9065Smrg#   option) any later version.
20119ace9065Smrg#
20129ace9065Smrg#   This program is distributed in the hope that it will be useful, but
20139ace9065Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
20149ace9065Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
20159ace9065Smrg#   Public License for more details.
20169ace9065Smrg#
20179ace9065Smrg#   You should have received a copy of the GNU General Public License along
20189ace9065Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
20199ace9065Smrg#
20209ace9065Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
20219ace9065Smrg#   gives unlimited permission to copy, distribute and modify the configure
20229ace9065Smrg#   scripts that are the output of Autoconf when processing the Macro. You
20239ace9065Smrg#   need not follow the terms of the GNU General Public License when using
20249ace9065Smrg#   or distributing such scripts, even though portions of the text of the
20259ace9065Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
20269ace9065Smrg#   all other use of the material that constitutes the Autoconf Macro.
20279ace9065Smrg#
20289ace9065Smrg#   This special exception to the GPL applies to versions of the Autoconf
20299ace9065Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
20309ace9065Smrg#   modified version of the Autoconf Macro, you may extend this special
20319ace9065Smrg#   exception to the GPL to apply to your modified version as well.#
20329ace9065SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
20339ace9065Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
20349ace9065Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
20359ace9065SmrgAS_LITERAL_IF([$1],
20369ace9065Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
20379ace9065Smrg      ax_save_FLAGS=$LDFLAGS
20389ace9065Smrg      LDFLAGS="$1"
2039475c125cSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
20409ace9065Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
20419ace9065Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
20429ace9065Smrg      LDFLAGS=$ax_save_FLAGS])],
20439ace9065Smrg  [ax_save_FLAGS=$LDFLAGS
20449ace9065Smrg   LDFLAGS="$1"
20459ace9065Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
20469ace9065Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
20479ace9065Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
20489ace9065Smrg   LDFLAGS=$ax_save_FLAGS])
20499ace9065Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
20509ace9065SmrgAC_MSG_RESULT($xorg_check_linker_flags)
20519ace9065Smrgif test "x$xorg_check_linker_flags" = xyes; then
20529ace9065Smrg	m4_default([$2], :)
20539ace9065Smrgelse
20549ace9065Smrg	m4_default([$3], :)
20559ace9065Smrgfi
20569ace9065Smrg]) # XORG_CHECK_LINKER_FLAGS
20579ace9065Smrg
2058475c125cSmrg# XORG_MEMORY_CHECK_FLAGS
2059475c125cSmrg# -----------------------
2060475c125cSmrg# Minimum version: 1.16.0
2061475c125cSmrg#
2062475c125cSmrg# This macro attempts to find appropriate memory checking functionality
2063475c125cSmrg# for various platforms which unit testing code may use to catch various
2064475c125cSmrg# forms of memory allocation and access errors in testing.
2065475c125cSmrg#
2066475c125cSmrg# Interface to module:
2067475c125cSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2068475c125cSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2069475c125cSmrg#
2070475c125cSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2071475c125cSmrg#
2072475c125cSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2073475c125cSmrg
2074475c125cSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2075475c125cSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2076475c125cSmrg           [Environment variables to enable memory checking in tests])
2077475c125cSmrg
2078475c125cSmrg# Check for different types of support on different platforms
2079475c125cSmrgcase $host_os in
2080475c125cSmrg    solaris*)
2081475c125cSmrg        AC_CHECK_LIB([umem], [umem_alloc],
2082475c125cSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2083475c125cSmrg        ;;
2084475c125cSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2085475c125cSmrg        # both directly and inverted, so should not be 0 or 255.
2086475c125cSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
2087475c125cSmrg        ;;
2088475c125cSmrg    darwin*)
2089475c125cSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2090475c125cSmrg        ;;
2091475c125cSmrg    *bsd*)
2092475c125cSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2093475c125cSmrg        ;;
2094475c125cSmrgesac
2095475c125cSmrg
2096475c125cSmrg# User supplied flags override default flags
2097475c125cSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2098475c125cSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2099475c125cSmrgfi
2100475c125cSmrg
2101475c125cSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2102475c125cSmrg]) # XORG_WITH_LINT
2103475c125cSmrg
21044642e01fSmrg# XORG_CHECK_MALLOC_ZERO
21054642e01fSmrg# ----------------------
21064642e01fSmrg# Minimum version: 1.0.0
21074642e01fSmrg#
21084642e01fSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
21094642e01fSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
21104642e01fSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
21114642e01fSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
21124642e01fSmrgAC_ARG_ENABLE(malloc0returnsnull,
2113b1d344b3Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
21144642e01fSmrg		       [malloc(0) returns NULL (default: auto)]),
21154642e01fSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
21164642e01fSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
21174642e01fSmrg
21184642e01fSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
21194642e01fSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
212035c4bbdfSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
212135c4bbdfSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
21228223e2f2Smrg#include <stdlib.h>
21238223e2f2Smrg],[
21244642e01fSmrg    char *m0, *r0, *c0, *p;
21254642e01fSmrg    m0 = malloc(0);
21264642e01fSmrg    p = malloc(10);
21274642e01fSmrg    r0 = realloc(p,0);
21288223e2f2Smrg    c0 = calloc(0,10);
21298223e2f2Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
21308223e2f2Smrg])],
213135c4bbdfSmrg		[xorg_cv_malloc0_returns_null=yes],
213235c4bbdfSmrg		[xorg_cv_malloc0_returns_null=no])])
213335c4bbdfSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
21344642e01fSmrgfi
21354642e01fSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
21364642e01fSmrg
21374642e01fSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
21384642e01fSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
21394642e01fSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
21404642e01fSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
21414642e01fSmrgelse
21424642e01fSmrg	MALLOC_ZERO_CFLAGS=""
21434642e01fSmrg	XMALLOC_ZERO_CFLAGS=""
21444642e01fSmrg	XTMALLOC_ZERO_CFLAGS=""
21454642e01fSmrgfi
21464642e01fSmrg
21474642e01fSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
21484642e01fSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
21494642e01fSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
21504642e01fSmrg]) # XORG_CHECK_MALLOC_ZERO
21514642e01fSmrg
21524642e01fSmrg# XORG_WITH_LINT()
21534642e01fSmrg# ----------------
21544642e01fSmrg# Minimum version: 1.1.0
21554642e01fSmrg#
21566747b715Smrg# This macro enables the use of a tool that flags some suspicious and
21576747b715Smrg# non-portable constructs (likely to be bugs) in C language source code.
21586747b715Smrg# It will attempt to locate the tool and use appropriate options.
21596747b715Smrg# There are various lint type tools on different platforms.
21606747b715Smrg#
21616747b715Smrg# Interface to module:
21626747b715Smrg# LINT:		returns the path to the tool found on the platform
21636747b715Smrg#		or the value set to LINT on the configure cmd line
21646747b715Smrg#		also an Automake conditional
21656747b715Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
21666747b715Smrg#
21676747b715Smrg# --with-lint:	'yes' user instructs the module to use lint
21686747b715Smrg#		'no' user instructs the module not to use lint (default)
21696747b715Smrg#
21706747b715Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
21716747b715Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
21724642e01fSmrg#
21734642e01fSmrgAC_DEFUN([XORG_WITH_LINT],[
21744642e01fSmrg
21756747b715SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
21766747b715SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2177b1d344b3SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
21784642e01fSmrg		[Use a lint-style source code checker (default: disabled)])],
21794642e01fSmrg		[use_lint=$withval], [use_lint=no])
21806747b715Smrg
21816747b715Smrg# Obtain platform specific info like program name and options
21826747b715Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
21836747b715Smrgcase $host_os in
21846747b715Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
21856747b715Smrg	lint_name=splint
21866747b715Smrg	lint_options="-badflag"
21876747b715Smrg	;;
21886747b715Smrg  *freebsd* | *netbsd*)
21896747b715Smrg	lint_name=lint
21906747b715Smrg	lint_options="-u -b"
21916747b715Smrg	;;
21926747b715Smrg  *solaris*)
21936747b715Smrg	lint_name=lint
21946747b715Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
21956747b715Smrg	;;
21966747b715Smrgesac
21976747b715Smrg
21986747b715Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
21996747b715Smrgif test "x$use_lint" = x"yes" ; then
22006747b715Smrg   AC_PATH_PROG([LINT], [$lint_name])
22016747b715Smrg   if test "x$LINT" = "x"; then
22026747b715Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
22036747b715Smrg   fi
22046747b715Smrgelif test "x$use_lint" = x"no" ; then
22056747b715Smrg   if test "x$LINT" != "x"; then
22066747b715Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
22076747b715Smrg   fi
22084642e01fSmrgelse
22096747b715Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
22104642e01fSmrgfi
22116747b715Smrg
22126747b715Smrg# User supplied flags override default flags
22136747b715Smrgif test "x$LINT_FLAGS" != "x"; then
22146747b715Smrg   lint_options=$LINT_FLAGS
22154642e01fSmrgfi
22164642e01fSmrg
22176747b715SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
22186747b715SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
22194642e01fSmrg
22204642e01fSmrg]) # XORG_WITH_LINT
22214642e01fSmrg
22224642e01fSmrg# XORG_LINT_LIBRARY(LIBNAME)
22234642e01fSmrg# --------------------------
22244642e01fSmrg# Minimum version: 1.1.0
22254642e01fSmrg#
22264642e01fSmrg# Sets up flags for building lint libraries for checking programs that call
22274642e01fSmrg# functions in the library.
22284642e01fSmrg#
22296747b715Smrg# Interface to module:
22306747b715Smrg# LINTLIB		- Automake variable with the name of lint library file to make
22316747b715Smrg# MAKE_LINT_LIB		- Automake conditional
22326747b715Smrg#
22336747b715Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
22346747b715Smrg#			  - 'no' user instructs the module not to create a lint library (default)
22354642e01fSmrg
22364642e01fSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
22374642e01fSmrgAC_REQUIRE([XORG_WITH_LINT])
2238b1d344b3SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
22394642e01fSmrg	[Create lint library (default: disabled)])],
22404642e01fSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
22416747b715Smrg
22426747b715Smrgif test "x$make_lint_lib" = x"yes" ; then
22436747b715Smrg   LINTLIB=llib-l$1.ln
22446747b715Smrg   if test "x$LINT" = "x"; then
22456747b715Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
22466747b715Smrg   fi
22476747b715Smrgelif test "x$make_lint_lib" != x"no" ; then
22486747b715Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
22494642e01fSmrgfi
22506747b715Smrg
22514642e01fSmrgAC_SUBST(LINTLIB)
22524642e01fSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
22534642e01fSmrg
22544642e01fSmrg]) # XORG_LINT_LIBRARY
22554642e01fSmrg
22569ace9065Smrg# XORG_COMPILER_BRAND
22579ace9065Smrg# -------------------
22589ace9065Smrg# Minimum version: 1.14.0
22599ace9065Smrg#
22609ace9065Smrg# Checks for various brands of compilers and sets flags as appropriate:
22619ace9065Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
226235c4bbdfSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
22639ace9065Smrg#   clang compiler - sets CLANGCC to "yes"
22649ace9065Smrg#   Intel compiler - sets INTELCC to "yes"
22659ace9065Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
22669ace9065Smrg#
22679ace9065SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
226835c4bbdfSmrgAC_LANG_CASE(
226935c4bbdfSmrg	[C], [
227035c4bbdfSmrg		AC_REQUIRE([AC_PROG_CC_C99])
227135c4bbdfSmrg	],
227235c4bbdfSmrg	[C++], [
227335c4bbdfSmrg		AC_REQUIRE([AC_PROG_CXX])
227435c4bbdfSmrg	]
227535c4bbdfSmrg)
22769ace9065SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
22779ace9065SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
22789ace9065SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
22799ace9065Smrg]) # XORG_COMPILER_BRAND
22809ace9065Smrg
2281475c125cSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2282475c125cSmrg# ---------------
2283475c125cSmrg# Minimum version: 1.16.0
2284475c125cSmrg#
2285475c125cSmrg# Test if the compiler works when passed the given flag as a command line argument.
2286475c125cSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2287475c125cSmrg# next flag in the list until there are no more options.
2288475c125cSmrg#
2289475c125cSmrg# Note that this does not guarantee that the compiler supports the flag as some
2290475c125cSmrg# compilers will simply ignore arguments that they do not understand, but we do
2291475c125cSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2292475c125cSmrg# -Werror=unused-command-line-argument
2293475c125cSmrg#
2294475c125cSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2295475c125cSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2296475c125cSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2297475c125cSmrg
229835c4bbdfSmrgAC_LANG_COMPILER_REQUIRE
229935c4bbdfSmrg
230035c4bbdfSmrgAC_LANG_CASE(
230135c4bbdfSmrg	[C], [
230235c4bbdfSmrg		AC_REQUIRE([AC_PROG_CC_C99])
230335c4bbdfSmrg		define([PREFIX], [C])
230435c4bbdfSmrg		define([CACHE_PREFIX], [cc])
230535c4bbdfSmrg		define([COMPILER], [$CC])
230635c4bbdfSmrg	],
230735c4bbdfSmrg	[C++], [
230835c4bbdfSmrg		define([PREFIX], [CXX])
230935c4bbdfSmrg		define([CACHE_PREFIX], [cxx])
231035c4bbdfSmrg		define([COMPILER], [$CXX])
231135c4bbdfSmrg	]
231235c4bbdfSmrg)
2313475c125cSmrg
231435c4bbdfSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
231535c4bbdfSmrg
231635c4bbdfSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
231735c4bbdfSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
231835c4bbdfSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
231935c4bbdfSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
232035c4bbdfSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
232135c4bbdfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
232235c4bbdfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
232335c4bbdfSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
232435c4bbdfSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2325475c125cSmrgfi
2326475c125cSmrg
232735c4bbdfSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
232835c4bbdfSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
232935c4bbdfSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2330475c125cSmrg	fi
233135c4bbdfSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
233235c4bbdfSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
233335c4bbdfSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
233435c4bbdfSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
233535c4bbdfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
233635c4bbdfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
233735c4bbdfSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
233835c4bbdfSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2339475c125cSmrgfi
2340475c125cSmrg
2341475c125cSmrgfound="no"
2342475c125cSmrgm4_foreach([flag], m4_cdr($@), [
2343475c125cSmrg	if test $found = "no" ; then
234435c4bbdfSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
234535c4bbdfSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2346475c125cSmrg		fi
2347475c125cSmrg
234835c4bbdfSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
234935c4bbdfSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2350475c125cSmrg		fi
2351475c125cSmrg
235235c4bbdfSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2353475c125cSmrg
235435c4bbdfSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
235535c4bbdfSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
235635c4bbdfSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
235735c4bbdfSmrg		AC_CACHE_VAL($cacheid,
235835c4bbdfSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
235935c4bbdfSmrg					     [eval $cacheid=yes],
236035c4bbdfSmrg					     [eval $cacheid=no])])
236135c4bbdfSmrg
236235c4bbdfSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2363475c125cSmrg
236435c4bbdfSmrg		eval supported=\$$cacheid
236535c4bbdfSmrg		AC_MSG_RESULT([$supported])
2366475c125cSmrg		if test "$supported" = "yes" ; then
2367475c125cSmrg			$1="$$1 ]flag["
2368475c125cSmrg			found="yes"
2369475c125cSmrg		fi
2370475c125cSmrg	fi
2371475c125cSmrg])
2372475c125cSmrg]) # XORG_TESTSET_CFLAG
2373475c125cSmrg
2374475c125cSmrg# XORG_COMPILER_FLAGS
2375475c125cSmrg# ---------------
2376475c125cSmrg# Minimum version: 1.16.0
2377475c125cSmrg#
237835c4bbdfSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
237935c4bbdfSmrg# arguments supported by the selected compiler which do NOT alter the generated
238035c4bbdfSmrg# code.  These arguments will cause the compiler to print various warnings
238135c4bbdfSmrg# during compilation AND turn a conservative set of warnings into errors.
2382475c125cSmrg#
238335c4bbdfSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
238435c4bbdfSmrg# future versions of util-macros as options are added to new compilers.
2385475c125cSmrg#
2386475c125cSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2387475c125cSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2388475c125cSmrg
2389475c125cSmrgAC_ARG_ENABLE(selective-werror,
2390475c125cSmrg              AS_HELP_STRING([--disable-selective-werror],
2391475c125cSmrg                             [Turn off selective compiler errors. (default: enabled)]),
2392475c125cSmrg              [SELECTIVE_WERROR=$enableval],
2393475c125cSmrg              [SELECTIVE_WERROR=yes])
2394475c125cSmrg
239535c4bbdfSmrgAC_LANG_CASE(
239635c4bbdfSmrg        [C], [
239735c4bbdfSmrg                define([PREFIX], [C])
239835c4bbdfSmrg        ],
239935c4bbdfSmrg        [C++], [
240035c4bbdfSmrg                define([PREFIX], [CXX])
240135c4bbdfSmrg        ]
240235c4bbdfSmrg)
2403475c125cSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2404475c125cSmrgif test "x$SUNCC" = "xyes"; then
240535c4bbdfSmrg    [BASE_]PREFIX[FLAGS]="-v"
2406475c125cSmrgelse
240735c4bbdfSmrg    [BASE_]PREFIX[FLAGS]=""
2408475c125cSmrgfi
2409475c125cSmrg
2410475c125cSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
241135c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
241235c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
241335c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
241435c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
241535c4bbdfSmrg
241635c4bbdfSmrgAC_LANG_CASE(
241735c4bbdfSmrg	[C], [
241835c4bbdfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
241935c4bbdfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
242035c4bbdfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
242135c4bbdfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
242235c4bbdfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
242335c4bbdfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
242435c4bbdfSmrg	]
242535c4bbdfSmrg)
2426475c125cSmrg
2427475c125cSmrg# This chunk adds additional warnings that could catch undesired effects.
242835c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
242935c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
243035c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
243135c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
243235c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
243335c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
243435c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2435475c125cSmrg
2436475c125cSmrg# These are currently disabled because they are noisy.  They will be enabled
2437475c125cSmrg# in the future once the codebase is sufficiently modernized to silence
2438475c125cSmrg# them.  For now, I don't want them to drown out the other warnings.
243935c4bbdfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
244035c4bbdfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
244135c4bbdfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2442475c125cSmrg
2443475c125cSmrg# Turn some warnings into errors, so we don't accidently get successful builds
2444475c125cSmrg# when there are problems that should be fixed.
2445475c125cSmrg
2446475c125cSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
244735c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
244835c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
244935c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
245035c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
245135c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
245235c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
245335c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
245435c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
245535c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
245635c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
245735c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
245835c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
245935c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
2460475c125cSmrgelse
2461475c125cSmrgAC_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])
246235c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
246335c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
246435c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
246535c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
246635c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
246735c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
246835c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
246935c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
247035c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
247135c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
247235c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
247335c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
247435c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
247535c4bbdfSmrgfi
247635c4bbdfSmrg
247735c4bbdfSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2478475c125cSmrg]) # XORG_COMPILER_FLAGS
2479475c125cSmrg
24804642e01fSmrg# XORG_CWARNFLAGS
24814642e01fSmrg# ---------------
24824642e01fSmrg# Minimum version: 1.2.0
2483475c125cSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
24844642e01fSmrg#
24854642e01fSmrg# Defines CWARNFLAGS to enable C compiler warnings.
24864642e01fSmrg#
2487475c125cSmrg# This function is deprecated because it defines -fno-strict-aliasing
2488475c125cSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
2489475c125cSmrg# is needed, then it should be added explicitly in the module when
2490475c125cSmrg# it is updated to use BASE_CFLAGS.
2491475c125cSmrg#
24924642e01fSmrgAC_DEFUN([XORG_CWARNFLAGS], [
2493475c125cSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
24949ace9065SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
249535c4bbdfSmrgAC_LANG_CASE(
249635c4bbdfSmrg	[C], [
249735c4bbdfSmrg		CWARNFLAGS="$BASE_CFLAGS"
249835c4bbdfSmrg		if  test "x$GCC" = xyes ; then
249935c4bbdfSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
250035c4bbdfSmrg		fi
250135c4bbdfSmrg		AC_SUBST(CWARNFLAGS)
250235c4bbdfSmrg	]
250335c4bbdfSmrg)
25044642e01fSmrg]) # XORG_CWARNFLAGS
2505b1d344b3Smrg
2506b1d344b3Smrg# XORG_STRICT_OPTION
2507b1d344b3Smrg# -----------------------
2508b1d344b3Smrg# Minimum version: 1.3.0
2509b1d344b3Smrg#
25109ace9065Smrg# Add configure option to enable strict compilation flags, such as treating
25119ace9065Smrg# warnings as fatal errors.
25129ace9065Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
251335c4bbdfSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
25149ace9065Smrg#
25159ace9065Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
25169ace9065Smrg# when strict compilation is unconditionally desired.
2517b1d344b3SmrgAC_DEFUN([XORG_STRICT_OPTION], [
2518b1d344b3SmrgAC_REQUIRE([XORG_CWARNFLAGS])
2519475c125cSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2520b1d344b3Smrg
2521b1d344b3SmrgAC_ARG_ENABLE(strict-compilation,
2522b1d344b3Smrg			  AS_HELP_STRING([--enable-strict-compilation],
2523b1d344b3Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2524b1d344b3Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2525475c125cSmrg
252635c4bbdfSmrgAC_LANG_CASE(
252735c4bbdfSmrg        [C], [
252835c4bbdfSmrg                define([PREFIX], [C])
252935c4bbdfSmrg        ],
253035c4bbdfSmrg        [C++], [
253135c4bbdfSmrg                define([PREFIX], [CXX])
253235c4bbdfSmrg        ]
253335c4bbdfSmrg)
253435c4bbdfSmrg
253535c4bbdfSmrg[STRICT_]PREFIX[FLAGS]=""
253635c4bbdfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
253735c4bbdfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
2538475c125cSmrg
2539475c125cSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
2540475c125cSmrg# activate it with -Werror, so we add it here explicitly.
254135c4bbdfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
2542475c125cSmrg
2543b1d344b3Smrgif test "x$STRICT_COMPILE" = "xyes"; then
254435c4bbdfSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
254535c4bbdfSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
2546b1d344b3Smrgfi
254735c4bbdfSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
254835c4bbdfSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
254935c4bbdfSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
2550b1d344b3Smrg]) # XORG_STRICT_OPTION
2551b1d344b3Smrg
2552b1d344b3Smrg# XORG_DEFAULT_OPTIONS
2553b1d344b3Smrg# --------------------
2554b1d344b3Smrg# Minimum version: 1.3.0
2555b1d344b3Smrg#
2556b1d344b3Smrg# Defines default options for X.Org modules.
2557b1d344b3Smrg#
2558b1d344b3SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
25596747b715SmrgAC_REQUIRE([AC_PROG_INSTALL])
2560475c125cSmrgXORG_COMPILER_FLAGS
2561b1d344b3SmrgXORG_CWARNFLAGS
2562b1d344b3SmrgXORG_STRICT_OPTION
2563b1d344b3SmrgXORG_RELEASE_VERSION
2564b1d344b3SmrgXORG_CHANGELOG
25656747b715SmrgXORG_INSTALL
2566b1d344b3SmrgXORG_MANPAGE_SECTIONS
25676747b715Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
25686747b715Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
2569b1d344b3Smrg]) # XORG_DEFAULT_OPTIONS
25706747b715Smrg
25716747b715Smrg# XORG_INSTALL()
25726747b715Smrg# ----------------
25736747b715Smrg# Minimum version: 1.4.0
25746747b715Smrg#
25756747b715Smrg# Defines the variable INSTALL_CMD as the command to copy
25766747b715Smrg# INSTALL from $prefix/share/util-macros.
25776747b715Smrg#
25786747b715SmrgAC_DEFUN([XORG_INSTALL], [
25796747b715SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
25806747b715Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
25816747b715SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
25826747b715Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
25836747b715Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
25846747b715Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
25856747b715SmrgAC_SUBST([INSTALL_CMD])
25866747b715Smrg]) # XORG_INSTALL
25874642e01fSmrgdnl Copyright 2005 Red Hat, Inc
25884642e01fSmrgdnl
25894642e01fSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
25904642e01fSmrgdnl documentation for any purpose is hereby granted without fee, provided that
25914642e01fSmrgdnl the above copyright notice appear in all copies and that both that
25924642e01fSmrgdnl copyright notice and this permission notice appear in supporting
25934642e01fSmrgdnl documentation.
25944642e01fSmrgdnl
25954642e01fSmrgdnl The above copyright notice and this permission notice shall be included
25964642e01fSmrgdnl in all copies or substantial portions of the Software.
25974642e01fSmrgdnl
25984642e01fSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25994642e01fSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26004642e01fSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
26014642e01fSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
26024642e01fSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26034642e01fSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26044642e01fSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
26054642e01fSmrgdnl
26064642e01fSmrgdnl Except as contained in this notice, the name of the copyright holders shall
26074642e01fSmrgdnl not be used in advertising or otherwise to promote the sale, use or
26084642e01fSmrgdnl other dealings in this Software without prior written authorization
26094642e01fSmrgdnl from the copyright holders.
26104642e01fSmrgdnl
26114642e01fSmrg
26124642e01fSmrg# XORG_RELEASE_VERSION
26134642e01fSmrg# --------------------
26146747b715Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
261535c4bbdfSmrg
26164642e01fSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
26174642e01fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
26184642e01fSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
26194642e01fSmrg		[Major version of this package])
26204642e01fSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
26214642e01fSmrg	if test "x$PVM" = "x"; then
26224642e01fSmrg		PVM="0"
26234642e01fSmrg	fi
26244642e01fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
26254642e01fSmrg		[$PVM],
26264642e01fSmrg		[Minor version of this package])
26274642e01fSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
26284642e01fSmrg	if test "x$PVP" = "x"; then
26294642e01fSmrg		PVP="0"
26304642e01fSmrg	fi
26314642e01fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
26324642e01fSmrg		[$PVP],
26334642e01fSmrg		[Patch version of this package])
26344642e01fSmrg])
26354642e01fSmrg
26364642e01fSmrg# XORG_CHANGELOG()
26374642e01fSmrg# ----------------
26384642e01fSmrg# Minimum version: 1.2.0
26394642e01fSmrg#
26404642e01fSmrg# Defines the variable CHANGELOG_CMD as the command to generate
26414642e01fSmrg# ChangeLog from git.
26424642e01fSmrg#
264352397711Smrg#
26444642e01fSmrgAC_DEFUN([XORG_CHANGELOG], [
26456747b715SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
26466747b715Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
26476747b715Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
26484642e01fSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
26494642e01fSmrgAC_SUBST([CHANGELOG_CMD])
26504642e01fSmrg]) # XORG_CHANGELOG
26514642e01fSmrg
26524642e01fSmrgdnl
26538223e2f2Smrgdnl Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
26548223e2f2Smrgdnl
26558223e2f2Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
26568223e2f2Smrgdnl copy of this software and associated documentation files (the "Software"),
26578223e2f2Smrgdnl to deal in the Software without restriction, including without limitation
26588223e2f2Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
26598223e2f2Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
26608223e2f2Smrgdnl Software is furnished to do so, subject to the following conditions:
26618223e2f2Smrgdnl
26628223e2f2Smrgdnl The above copyright notice and this permission notice (including the next
26638223e2f2Smrgdnl paragraph) shall be included in all copies or substantial portions of the
26648223e2f2Smrgdnl Software.
26658223e2f2Smrgdnl
26668223e2f2Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26678223e2f2Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26688223e2f2Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
26698223e2f2Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26708223e2f2Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26718223e2f2Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26728223e2f2Smrgdnl DEALINGS IN THE SOFTWARE.
26738223e2f2Smrgdnl
26744642e01fSmrg
26754642e01fSmrg# XTRANS_TCP_FLAGS()
26764642e01fSmrg# ------------------
26774642e01fSmrg# Find needed libraries for TCP sockets, and check for IPv6 support
26784642e01fSmrgAC_DEFUN([XTRANS_TCP_FLAGS],[
26794642e01fSmrg # SVR4 hides these in libraries other than libc
26804642e01fSmrg AC_SEARCH_LIBS(socket, [socket])
26814642e01fSmrg AC_SEARCH_LIBS(gethostbyname, [nsl])
26826747b715Smrg if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then
268335c4bbdfSmrg   AC_CHECK_LIB([ws2_32],[main])
26846747b715Smrg fi
26854642e01fSmrg
26864642e01fSmrg # Needs to come after above checks for libsocket & libnsl for SVR4 systems
268735c4bbdfSmrg AC_ARG_ENABLE(ipv6,
268835c4bbdfSmrg	AS_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),
268935c4bbdfSmrg	[IPV6CONN=$enableval],
26904642e01fSmrg	[AC_CHECK_FUNC(getaddrinfo,[IPV6CONN=yes],[IPV6CONN=no])])
26914642e01fSmrg AC_MSG_CHECKING([if IPv6 support should be built])
26924642e01fSmrg if test "$IPV6CONN" = "yes"; then
26934642e01fSmrg	AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections])
26944642e01fSmrg fi
26954642e01fSmrg AC_MSG_RESULT($IPV6CONN)
26964642e01fSmrg
26974642e01fSmrg # 4.3BSD-Reno added a new member to struct sockaddr_in
269835c4bbdfSmrg AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
26994642e01fSmrg	AC_DEFINE([BSD44SOCKETS],1,
27004642e01fSmrg 	    [Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [
27014642e01fSmrg#include <sys/types.h>
27024642e01fSmrg#include <sys/socket.h>
27034642e01fSmrg#include <netinet/in.h>
27044642e01fSmrg ])
27054642e01fSmrg
27064642e01fSmrg # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc.
27074642e01fSmrg AC_CHECK_TYPES([socklen_t], [], [], [
27084642e01fSmrgAC_INCLUDES_DEFAULT
27094642e01fSmrg#include <sys/socket.h>])
271035c4bbdfSmrg
271135c4bbdfSmrg # XPG4v2/UNIX95 added msg_control - check to see if we need to define
271235c4bbdfSmrg # _XOPEN_SOURCE to get it (such as on Solaris)
271335c4bbdfSmrg AC_CHECK_MEMBER([struct msghdr.msg_control], [], [],
271435c4bbdfSmrg                 [
271535c4bbdfSmrgAC_INCLUDES_DEFAULT
271635c4bbdfSmrg#include <sys/socket.h>
271735c4bbdfSmrg                 ])
271835c4bbdfSmrg # First try for Solaris in C99 compliant mode, which requires XPG6/UNIX03
271935c4bbdfSmrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
272035c4bbdfSmrg     unset ac_cv_member_struct_msghdr_msg_control
272135c4bbdfSmrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=600])
272235c4bbdfSmrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
272335c4bbdfSmrg                     [AC_DEFINE([_XOPEN_SOURCE], [600],
272435c4bbdfSmrg                       [Defined if needed to expose struct msghdr.msg_control])
272535c4bbdfSmrg                     ], [], [
272635c4bbdfSmrg#define _XOPEN_SOURCE 600
272735c4bbdfSmrgAC_INCLUDES_DEFAULT
272835c4bbdfSmrg#include <sys/socket.h>
272935c4bbdfSmrg                     ])
273035c4bbdfSmrg fi
273135c4bbdfSmrg # If that didn't work, fall back to XPG5/UNIX98 with C89
273235c4bbdfSmrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
273335c4bbdfSmrg     unset ac_cv_member_struct_msghdr_msg_control
273435c4bbdfSmrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=500])
273535c4bbdfSmrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
273635c4bbdfSmrg                     [AC_DEFINE([_XOPEN_SOURCE], [500],
273735c4bbdfSmrg                       [Defined if needed to expose struct msghdr.msg_control])
273835c4bbdfSmrg                     ], [], [
273935c4bbdfSmrg#define _XOPEN_SOURCE 500
274035c4bbdfSmrgAC_INCLUDES_DEFAULT
274135c4bbdfSmrg#include <sys/socket.h>
274235c4bbdfSmrg                     ])
274335c4bbdfSmrg fi
274435c4bbdfSmrg
274535c4bbdfSmrg
27464642e01fSmrg]) # XTRANS_TCP_FLAGS
27474642e01fSmrg
27484642e01fSmrg# XTRANS_CONNECTION_FLAGS()
27494642e01fSmrg# -------------------------
27504642e01fSmrg# Standard checks for which Xtrans transports to use by the Xorg packages
27514642e01fSmrg# that use Xtrans functions
27524642e01fSmrgAC_DEFUN([XTRANS_CONNECTION_FLAGS],[
27534642e01fSmrg AC_REQUIRE([AC_CANONICAL_HOST])
27544642e01fSmrg [case $host_os in
27554642e01fSmrg	mingw*)	unixdef="no"   ;;
27564642e01fSmrg	*)	unixdef="yes"  ;;
27574642e01fSmrg esac]
27584642e01fSmrg AC_ARG_ENABLE(unix-transport,
275935c4bbdfSmrg	AS_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]),
27604642e01fSmrg	[UNIXCONN=$enableval], [UNIXCONN=$unixdef])
27614642e01fSmrg AC_MSG_CHECKING([if Xtrans should support UNIX socket connections])
27624642e01fSmrg if test "$UNIXCONN" = "yes"; then
27634642e01fSmrg	AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
27644642e01fSmrg fi
27654642e01fSmrg AC_MSG_RESULT($UNIXCONN)
276635c4bbdfSmrg AC_ARG_ENABLE(tcp-transport,
276735c4bbdfSmrg	AS_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]),
27684642e01fSmrg	[TCPCONN=$enableval], [TCPCONN=yes])
27694642e01fSmrg AC_MSG_CHECKING([if Xtrans should support TCP socket connections])
27704642e01fSmrg AC_MSG_RESULT($TCPCONN)
27714642e01fSmrg if test "$TCPCONN" = "yes"; then
27724642e01fSmrg	AC_DEFINE(TCPCONN,1,[Support TCP socket connections])
27734642e01fSmrg	XTRANS_TCP_FLAGS
27744642e01fSmrg fi
27754642e01fSmrg [case $host_os in
27764642e01fSmrg	solaris*|sco*|sysv4*)	localdef="yes" ;;
27774642e01fSmrg	*)			localdef="no"  ;;
27784642e01fSmrg esac]
27794642e01fSmrg AC_ARG_ENABLE(local-transport,
278035c4bbdfSmrg	AS_HELP_STRING([--enable-local-transport],[Enable os-specific local transport]),
27814642e01fSmrg	[LOCALCONN=$enableval], [LOCALCONN=$localdef])
27824642e01fSmrg AC_MSG_CHECKING([if Xtrans should support os-specific local connections])
27834642e01fSmrg AC_MSG_RESULT($LOCALCONN)
27844642e01fSmrg if test "$LOCALCONN" = "yes"; then
27854642e01fSmrg	AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
27864642e01fSmrg fi
278735c4bbdfSmrg
27884642e01fSmrg]) # XTRANS_CONNECTION_FLAGS
27894642e01fSmrg
27904642e01fSmrg
27914642e01fSmrg# XTRANS_SECURE_RPC_FLAGS()
27924642e01fSmrg# -------------------------
27934642e01fSmrg# Check for Secure RPC functions - must come after XTRANS_TCP_FLAGS
27944642e01fSmrg# so that any necessary networking libraries are already found
27954642e01fSmrgAC_DEFUN([XTRANS_SECURE_RPC_FLAGS],
27964642e01fSmrg[AC_REQUIRE([XTRANS_TCP_FLAGS])
279735c4bbdfSmrg AC_ARG_ENABLE(secure-rpc,
279835c4bbdfSmrg	AS_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]),
27994642e01fSmrg        [SECURE_RPC=$enableval], [SECURE_RPC="try"])
28004642e01fSmrg
28014642e01fSmrg if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then
28024642e01fSmrg	FOUND_SECURE_RPC="no"
28034642e01fSmrg	AC_CHECK_FUNCS([authdes_seccreate authdes_create],
28044642e01fSmrg			[FOUND_SECURE_RPC="yes"])
28054642e01fSmrg	if test "x$FOUND_SECURE_RPC" = "xno" ; then
28064642e01fSmrg		if test "x$SECURE_RPC" = "xyes" ; then
28074642e01fSmrg	AC_MSG_ERROR([Secure RPC requested, but required functions not found])
280835c4bbdfSmrg		fi
28094642e01fSmrg		SECURE_RPC="no"
28104642e01fSmrg	else
28114642e01fSmrg		dnl FreeBSD keeps getsecretkey in librpcsvc
28124642e01fSmrg		AC_SEARCH_LIBS(getsecretkey, [rpcsvc])
28134642e01fSmrg		SECURE_RPC="yes"
28144642e01fSmrg	fi
28154642e01fSmrg fi
28164642e01fSmrg AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported])
28174642e01fSmrg if test "x$SECURE_RPC" = "xyes" ; then
28184642e01fSmrg	AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients])
28194642e01fSmrg fi
28204642e01fSmrg AC_MSG_RESULT($SECURE_RPC)
28214642e01fSmrg]) # XTRANS_SECURE_RPC_FLAGS
28224642e01fSmrg
28234642e01fSmrg
28241b5d61b8Smrg# Copyright (C) 2002-2017 Free Software Foundation, Inc.
282535c4bbdfSmrg#
282635c4bbdfSmrg# This file is free software; the Free Software Foundation
282735c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
282835c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
282935c4bbdfSmrg
283035c4bbdfSmrg# AM_AUTOMAKE_VERSION(VERSION)
283135c4bbdfSmrg# ----------------------------
283235c4bbdfSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
283335c4bbdfSmrg# generated from the m4 files accompanying Automake X.Y.
283435c4bbdfSmrg# (This private macro should not be called outside this file.)
283535c4bbdfSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
283635c4bbdfSmrg[am__api_version='1.15'
283735c4bbdfSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
283835c4bbdfSmrgdnl require some minimum version.  Point them to the right macro.
28391b5d61b8Smrgm4_if([$1], [1.15.1], [],
284035c4bbdfSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
284135c4bbdfSmrg])
284235c4bbdfSmrg
284335c4bbdfSmrg# _AM_AUTOCONF_VERSION(VERSION)
284435c4bbdfSmrg# -----------------------------
284535c4bbdfSmrg# aclocal traces this macro to find the Autoconf version.
284635c4bbdfSmrg# This is a private macro too.  Using m4_define simplifies
284735c4bbdfSmrg# the logic in aclocal, which can simply ignore this definition.
284835c4bbdfSmrgm4_define([_AM_AUTOCONF_VERSION], [])
284935c4bbdfSmrg
285035c4bbdfSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
285135c4bbdfSmrg# -------------------------------
285235c4bbdfSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
285335c4bbdfSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
285435c4bbdfSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
28551b5d61b8Smrg[AM_AUTOMAKE_VERSION([1.15.1])dnl
285635c4bbdfSmrgm4_ifndef([AC_AUTOCONF_VERSION],
285735c4bbdfSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
285835c4bbdfSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
285935c4bbdfSmrg
286035c4bbdfSmrg# Figure out how to run the assembler.                      -*- Autoconf -*-
286135c4bbdfSmrg
28621b5d61b8Smrg# Copyright (C) 2001-2017 Free Software Foundation, Inc.
286335c4bbdfSmrg#
286435c4bbdfSmrg# This file is free software; the Free Software Foundation
286535c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
286635c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
286735c4bbdfSmrg
286835c4bbdfSmrg# AM_PROG_AS
286935c4bbdfSmrg# ----------
287035c4bbdfSmrgAC_DEFUN([AM_PROG_AS],
287135c4bbdfSmrg[# By default we simply use the C compiler to build assembly code.
287235c4bbdfSmrgAC_REQUIRE([AC_PROG_CC])
287335c4bbdfSmrgtest "${CCAS+set}" = set || CCAS=$CC
287435c4bbdfSmrgtest "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS
287535c4bbdfSmrgAC_ARG_VAR([CCAS],      [assembler compiler command (defaults to CC)])
287635c4bbdfSmrgAC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)])
287735c4bbdfSmrg_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl
287835c4bbdfSmrg])
287935c4bbdfSmrg
288035c4bbdfSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
288135c4bbdfSmrg
28821b5d61b8Smrg# Copyright (C) 2001-2017 Free Software Foundation, Inc.
288335c4bbdfSmrg#
288435c4bbdfSmrg# This file is free software; the Free Software Foundation
288535c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
288635c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
288735c4bbdfSmrg
288835c4bbdfSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
288935c4bbdfSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
289035c4bbdfSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
289135c4bbdfSmrg#
289235c4bbdfSmrg# Of course, Automake must honor this variable whenever it calls a
289335c4bbdfSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
289435c4bbdfSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
289535c4bbdfSmrg# depending on how configure is run.  This is pretty annoying, since
289635c4bbdfSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
289735c4bbdfSmrg# source directory, any form will work fine, but in subdirectories a
289835c4bbdfSmrg# relative path needs to be adjusted first.
289935c4bbdfSmrg#
290035c4bbdfSmrg# $ac_aux_dir/missing
290135c4bbdfSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
290235c4bbdfSmrg# $top_srcdir/$ac_aux_dir/missing
290335c4bbdfSmrg#    fails if $ac_aux_dir is absolute,
290435c4bbdfSmrg#    fails when called from a subdirectory in a VPATH build with
290535c4bbdfSmrg#          a relative $ac_aux_dir
290635c4bbdfSmrg#
290735c4bbdfSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
290835c4bbdfSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
290935c4bbdfSmrg# harmless because $srcdir is '.', but things will broke when you
291035c4bbdfSmrg# start a VPATH build or use an absolute $srcdir.
291135c4bbdfSmrg#
291235c4bbdfSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
291335c4bbdfSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
291435c4bbdfSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
291535c4bbdfSmrg# and then we would define $MISSING as
291635c4bbdfSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
291735c4bbdfSmrg# This will work as long as MISSING is not called from configure, because
291835c4bbdfSmrg# unfortunately $(top_srcdir) has no meaning in configure.
291935c4bbdfSmrg# However there are other variables, like CC, which are often used in
292035c4bbdfSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
292135c4bbdfSmrg#
292235c4bbdfSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
292335c4bbdfSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
292435c4bbdfSmrg# configured tree to be moved without reconfiguration.
292535c4bbdfSmrg
292635c4bbdfSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
292735c4bbdfSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
292835c4bbdfSmrg# Expand $ac_aux_dir to an absolute path.
292935c4bbdfSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
293035c4bbdfSmrg])
293135c4bbdfSmrg
293235c4bbdfSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
293335c4bbdfSmrg
29341b5d61b8Smrg# Copyright (C) 1997-2017 Free Software Foundation, Inc.
293535c4bbdfSmrg#
293635c4bbdfSmrg# This file is free software; the Free Software Foundation
293735c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
293835c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
293935c4bbdfSmrg
294035c4bbdfSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
294135c4bbdfSmrg# -------------------------------------
294235c4bbdfSmrg# Define a conditional.
294335c4bbdfSmrgAC_DEFUN([AM_CONDITIONAL],
294435c4bbdfSmrg[AC_PREREQ([2.52])dnl
294535c4bbdfSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
294635c4bbdfSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
294735c4bbdfSmrgAC_SUBST([$1_TRUE])dnl
294835c4bbdfSmrgAC_SUBST([$1_FALSE])dnl
294935c4bbdfSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
295035c4bbdfSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
295135c4bbdfSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
295235c4bbdfSmrgif $2; then
295335c4bbdfSmrg  $1_TRUE=
295435c4bbdfSmrg  $1_FALSE='#'
295535c4bbdfSmrgelse
295635c4bbdfSmrg  $1_TRUE='#'
295735c4bbdfSmrg  $1_FALSE=
295835c4bbdfSmrgfi
295935c4bbdfSmrgAC_CONFIG_COMMANDS_PRE(
296035c4bbdfSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
296135c4bbdfSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
296235c4bbdfSmrgUsually this means the macro was only invoked conditionally.]])
296335c4bbdfSmrgfi])])
296435c4bbdfSmrg
29651b5d61b8Smrg# Copyright (C) 1999-2017 Free Software Foundation, Inc.
296635c4bbdfSmrg#
296735c4bbdfSmrg# This file is free software; the Free Software Foundation
296835c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
296935c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
297035c4bbdfSmrg
297135c4bbdfSmrg
297235c4bbdfSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
297335c4bbdfSmrg# written in clear, in which case automake, when reading aclocal.m4,
297435c4bbdfSmrg# will think it sees a *use*, and therefore will trigger all it's
297535c4bbdfSmrg# C support machinery.  Also note that it means that autoscan, seeing
297635c4bbdfSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
297735c4bbdfSmrg
297835c4bbdfSmrg
297935c4bbdfSmrg# _AM_DEPENDENCIES(NAME)
298035c4bbdfSmrg# ----------------------
298135c4bbdfSmrg# See how the compiler implements dependency checking.
298235c4bbdfSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
298335c4bbdfSmrg# We try a few techniques and use that to set a single cache variable.
298435c4bbdfSmrg#
298535c4bbdfSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
298635c4bbdfSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
298735c4bbdfSmrg# dependency, and given that the user is not expected to run this macro,
298835c4bbdfSmrg# just rely on AC_PROG_CC.
298935c4bbdfSmrgAC_DEFUN([_AM_DEPENDENCIES],
299035c4bbdfSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
299135c4bbdfSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
299235c4bbdfSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
299335c4bbdfSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
299435c4bbdfSmrg
299535c4bbdfSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
299635c4bbdfSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
299735c4bbdfSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
299835c4bbdfSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
299935c4bbdfSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
300035c4bbdfSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
300135c4bbdfSmrg                    [depcc="$$1"   am_compiler_list=])
300235c4bbdfSmrg
300335c4bbdfSmrgAC_CACHE_CHECK([dependency style of $depcc],
300435c4bbdfSmrg               [am_cv_$1_dependencies_compiler_type],
300535c4bbdfSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
300635c4bbdfSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
300735c4bbdfSmrg  # making bogus files that we don't know about and never remove.  For
300835c4bbdfSmrg  # instance it was reported that on HP-UX the gcc test will end up
300935c4bbdfSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
301035c4bbdfSmrg  # in D".
301135c4bbdfSmrg  rm -rf conftest.dir
301235c4bbdfSmrg  mkdir conftest.dir
301335c4bbdfSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
301435c4bbdfSmrg  # using a relative directory.
301535c4bbdfSmrg  cp "$am_depcomp" conftest.dir
301635c4bbdfSmrg  cd conftest.dir
301735c4bbdfSmrg  # We will build objects and dependencies in a subdirectory because
301835c4bbdfSmrg  # it helps to detect inapplicable dependency modes.  For instance
301935c4bbdfSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
302035c4bbdfSmrg  # side effect of compilation, but ICC will put the dependencies in
302135c4bbdfSmrg  # the current directory while Tru64 will put them in the object
302235c4bbdfSmrg  # directory.
302335c4bbdfSmrg  mkdir sub
302435c4bbdfSmrg
302535c4bbdfSmrg  am_cv_$1_dependencies_compiler_type=none
302635c4bbdfSmrg  if test "$am_compiler_list" = ""; then
302735c4bbdfSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
302835c4bbdfSmrg  fi
302935c4bbdfSmrg  am__universal=false
303035c4bbdfSmrg  m4_case([$1], [CC],
303135c4bbdfSmrg    [case " $depcc " in #(
303235c4bbdfSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
303335c4bbdfSmrg     esac],
303435c4bbdfSmrg    [CXX],
303535c4bbdfSmrg    [case " $depcc " in #(
303635c4bbdfSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
303735c4bbdfSmrg     esac])
303835c4bbdfSmrg
303935c4bbdfSmrg  for depmode in $am_compiler_list; do
304035c4bbdfSmrg    # Setup a source with many dependencies, because some compilers
304135c4bbdfSmrg    # like to wrap large dependency lists on column 80 (with \), and
304235c4bbdfSmrg    # we should not choose a depcomp mode which is confused by this.
304335c4bbdfSmrg    #
304435c4bbdfSmrg    # We need to recreate these files for each test, as the compiler may
304535c4bbdfSmrg    # overwrite some of them when testing with obscure command lines.
304635c4bbdfSmrg    # This happens at least with the AIX C compiler.
304735c4bbdfSmrg    : > sub/conftest.c
304835c4bbdfSmrg    for i in 1 2 3 4 5 6; do
304935c4bbdfSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
305035c4bbdfSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
305135c4bbdfSmrg      # Solaris 10 /bin/sh.
305235c4bbdfSmrg      echo '/* dummy */' > sub/conftst$i.h
305335c4bbdfSmrg    done
305435c4bbdfSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
305535c4bbdfSmrg
305635c4bbdfSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
305735c4bbdfSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
305835c4bbdfSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
305935c4bbdfSmrg    # versions had trouble with output in subdirs.
306035c4bbdfSmrg    am__obj=sub/conftest.${OBJEXT-o}
306135c4bbdfSmrg    am__minus_obj="-o $am__obj"
306235c4bbdfSmrg    case $depmode in
306335c4bbdfSmrg    gcc)
306435c4bbdfSmrg      # This depmode causes a compiler race in universal mode.
306535c4bbdfSmrg      test "$am__universal" = false || continue
306635c4bbdfSmrg      ;;
306735c4bbdfSmrg    nosideeffect)
306835c4bbdfSmrg      # After this tag, mechanisms are not by side-effect, so they'll
306935c4bbdfSmrg      # only be used when explicitly requested.
307035c4bbdfSmrg      if test "x$enable_dependency_tracking" = xyes; then
307135c4bbdfSmrg	continue
307235c4bbdfSmrg      else
307335c4bbdfSmrg	break
307435c4bbdfSmrg      fi
307535c4bbdfSmrg      ;;
307635c4bbdfSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
307735c4bbdfSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
307835c4bbdfSmrg      # not run yet.  These depmodes are late enough in the game, and
307935c4bbdfSmrg      # so weak that their functioning should not be impacted.
308035c4bbdfSmrg      am__obj=conftest.${OBJEXT-o}
308135c4bbdfSmrg      am__minus_obj=
308235c4bbdfSmrg      ;;
308335c4bbdfSmrg    none) break ;;
308435c4bbdfSmrg    esac
308535c4bbdfSmrg    if depmode=$depmode \
308635c4bbdfSmrg       source=sub/conftest.c object=$am__obj \
308735c4bbdfSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
308835c4bbdfSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
308935c4bbdfSmrg         >/dev/null 2>conftest.err &&
309035c4bbdfSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
309135c4bbdfSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
309235c4bbdfSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
309335c4bbdfSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
309435c4bbdfSmrg      # icc doesn't choke on unknown options, it will just issue warnings
309535c4bbdfSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
309635c4bbdfSmrg      # that says an option was ignored or not supported.
309735c4bbdfSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
309835c4bbdfSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
309935c4bbdfSmrg      # The diagnosis changed in icc 8.0:
310035c4bbdfSmrg      #   icc: Command line remark: option '-MP' not supported
310135c4bbdfSmrg      if (grep 'ignoring option' conftest.err ||
310235c4bbdfSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
310335c4bbdfSmrg        am_cv_$1_dependencies_compiler_type=$depmode
310435c4bbdfSmrg        break
310535c4bbdfSmrg      fi
310635c4bbdfSmrg    fi
310735c4bbdfSmrg  done
310835c4bbdfSmrg
310935c4bbdfSmrg  cd ..
311035c4bbdfSmrg  rm -rf conftest.dir
311135c4bbdfSmrgelse
311235c4bbdfSmrg  am_cv_$1_dependencies_compiler_type=none
311335c4bbdfSmrgfi
311435c4bbdfSmrg])
311535c4bbdfSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
311635c4bbdfSmrgAM_CONDITIONAL([am__fastdep$1], [
311735c4bbdfSmrg  test "x$enable_dependency_tracking" != xno \
311835c4bbdfSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
311935c4bbdfSmrg])
312035c4bbdfSmrg
312135c4bbdfSmrg
312235c4bbdfSmrg# AM_SET_DEPDIR
312335c4bbdfSmrg# -------------
312435c4bbdfSmrg# Choose a directory name for dependency files.
312535c4bbdfSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
312635c4bbdfSmrgAC_DEFUN([AM_SET_DEPDIR],
312735c4bbdfSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
312835c4bbdfSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
312935c4bbdfSmrg])
313035c4bbdfSmrg
313135c4bbdfSmrg
313235c4bbdfSmrg# AM_DEP_TRACK
313335c4bbdfSmrg# ------------
313435c4bbdfSmrgAC_DEFUN([AM_DEP_TRACK],
313535c4bbdfSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
313635c4bbdfSmrgAS_HELP_STRING(
313735c4bbdfSmrg  [--enable-dependency-tracking],
313835c4bbdfSmrg  [do not reject slow dependency extractors])
313935c4bbdfSmrgAS_HELP_STRING(
314035c4bbdfSmrg  [--disable-dependency-tracking],
314135c4bbdfSmrg  [speeds up one-time build])])
314235c4bbdfSmrgif test "x$enable_dependency_tracking" != xno; then
314335c4bbdfSmrg  am_depcomp="$ac_aux_dir/depcomp"
314435c4bbdfSmrg  AMDEPBACKSLASH='\'
314535c4bbdfSmrg  am__nodep='_no'
314635c4bbdfSmrgfi
314735c4bbdfSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
314835c4bbdfSmrgAC_SUBST([AMDEPBACKSLASH])dnl
314935c4bbdfSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
315035c4bbdfSmrgAC_SUBST([am__nodep])dnl
315135c4bbdfSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
315235c4bbdfSmrg])
315335c4bbdfSmrg
315435c4bbdfSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
315535c4bbdfSmrg
31561b5d61b8Smrg# Copyright (C) 1999-2017 Free Software Foundation, Inc.
315735c4bbdfSmrg#
315835c4bbdfSmrg# This file is free software; the Free Software Foundation
315935c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
316035c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
316135c4bbdfSmrg
316235c4bbdfSmrg
316335c4bbdfSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
316435c4bbdfSmrg# ------------------------------
316535c4bbdfSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
316635c4bbdfSmrg[{
316735c4bbdfSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
316835c4bbdfSmrg  # are listed without --file.  Let's play safe and only enable the eval
316935c4bbdfSmrg  # if we detect the quoting.
317035c4bbdfSmrg  case $CONFIG_FILES in
317135c4bbdfSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
317235c4bbdfSmrg  *)   set x $CONFIG_FILES ;;
317335c4bbdfSmrg  esac
317435c4bbdfSmrg  shift
317535c4bbdfSmrg  for mf
317635c4bbdfSmrg  do
317735c4bbdfSmrg    # Strip MF so we end up with the name of the file.
317835c4bbdfSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
317935c4bbdfSmrg    # Check whether this is an Automake generated Makefile or not.
318035c4bbdfSmrg    # We used to match only the files named 'Makefile.in', but
318135c4bbdfSmrg    # some people rename them; so instead we look at the file content.
318235c4bbdfSmrg    # Grep'ing the first line is not enough: some people post-process
318335c4bbdfSmrg    # each Makefile.in and add a new line on top of each file to say so.
318435c4bbdfSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
318535c4bbdfSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
318635c4bbdfSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
318735c4bbdfSmrg      dirpart=`AS_DIRNAME("$mf")`
318835c4bbdfSmrg    else
318935c4bbdfSmrg      continue
319035c4bbdfSmrg    fi
319135c4bbdfSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
319235c4bbdfSmrg    # from the Makefile without running 'make'.
319335c4bbdfSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
319435c4bbdfSmrg    test -z "$DEPDIR" && continue
319535c4bbdfSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
319635c4bbdfSmrg    test -z "$am__include" && continue
319735c4bbdfSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
319835c4bbdfSmrg    # Find all dependency output files, they are included files with
319935c4bbdfSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
320035c4bbdfSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
320135c4bbdfSmrg    # expansion.
320235c4bbdfSmrg    for file in `sed -n "
320335c4bbdfSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
320435c4bbdfSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
320535c4bbdfSmrg      # Make sure the directory exists.
320635c4bbdfSmrg      test -f "$dirpart/$file" && continue
320735c4bbdfSmrg      fdir=`AS_DIRNAME(["$file"])`
320835c4bbdfSmrg      AS_MKDIR_P([$dirpart/$fdir])
320935c4bbdfSmrg      # echo "creating $dirpart/$file"
321035c4bbdfSmrg      echo '# dummy' > "$dirpart/$file"
321135c4bbdfSmrg    done
321235c4bbdfSmrg  done
321335c4bbdfSmrg}
321435c4bbdfSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
321535c4bbdfSmrg
321635c4bbdfSmrg
321735c4bbdfSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
321835c4bbdfSmrg# -----------------------------
321935c4bbdfSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
322035c4bbdfSmrg#
322135c4bbdfSmrg# This code is only required when automatic dependency tracking
322235c4bbdfSmrg# is enabled.  FIXME.  This creates each '.P' file that we will
322335c4bbdfSmrg# need in order to bootstrap the dependency handling code.
322435c4bbdfSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
322535c4bbdfSmrg[AC_CONFIG_COMMANDS([depfiles],
322635c4bbdfSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
322735c4bbdfSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
322835c4bbdfSmrg])
322935c4bbdfSmrg
323035c4bbdfSmrg# Do all the work for Automake.                             -*- Autoconf -*-
323135c4bbdfSmrg
32321b5d61b8Smrg# Copyright (C) 1996-2017 Free Software Foundation, Inc.
323335c4bbdfSmrg#
323435c4bbdfSmrg# This file is free software; the Free Software Foundation
323535c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
323635c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
323735c4bbdfSmrg
323835c4bbdfSmrg# This macro actually does too much.  Some checks are only needed if
323935c4bbdfSmrg# your package does certain things.  But this isn't really a big deal.
324035c4bbdfSmrg
324135c4bbdfSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
324235c4bbdfSmrgm4_define([AC_PROG_CC],
324335c4bbdfSmrgm4_defn([AC_PROG_CC])
324435c4bbdfSmrg[_AM_PROG_CC_C_O
324535c4bbdfSmrg])
324635c4bbdfSmrg
324735c4bbdfSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
324835c4bbdfSmrg# AM_INIT_AUTOMAKE([OPTIONS])
324935c4bbdfSmrg# -----------------------------------------------
325035c4bbdfSmrg# The call with PACKAGE and VERSION arguments is the old style
325135c4bbdfSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
325235c4bbdfSmrg# and VERSION should now be passed to AC_INIT and removed from
325335c4bbdfSmrg# the call to AM_INIT_AUTOMAKE.
325435c4bbdfSmrg# We support both call styles for the transition.  After
325535c4bbdfSmrg# the next Automake release, Autoconf can make the AC_INIT
325635c4bbdfSmrg# arguments mandatory, and then we can depend on a new Autoconf
325735c4bbdfSmrg# release and drop the old call support.
325835c4bbdfSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
325935c4bbdfSmrg[AC_PREREQ([2.65])dnl
326035c4bbdfSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
326135c4bbdfSmrgdnl the ones we care about.
326235c4bbdfSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
326335c4bbdfSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
326435c4bbdfSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
326535c4bbdfSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
326635c4bbdfSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
326735c4bbdfSmrg  # is not polluted with repeated "-I."
326835c4bbdfSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
326935c4bbdfSmrg  # test to see if srcdir already configured
327035c4bbdfSmrg  if test -f $srcdir/config.status; then
327135c4bbdfSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
327235c4bbdfSmrg  fi
327335c4bbdfSmrgfi
327435c4bbdfSmrg
327535c4bbdfSmrg# test whether we have cygpath
327635c4bbdfSmrgif test -z "$CYGPATH_W"; then
327735c4bbdfSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
327835c4bbdfSmrg    CYGPATH_W='cygpath -w'
327935c4bbdfSmrg  else
328035c4bbdfSmrg    CYGPATH_W=echo
328135c4bbdfSmrg  fi
328235c4bbdfSmrgfi
328335c4bbdfSmrgAC_SUBST([CYGPATH_W])
328435c4bbdfSmrg
328535c4bbdfSmrg# Define the identity of the package.
328635c4bbdfSmrgdnl Distinguish between old-style and new-style calls.
328735c4bbdfSmrgm4_ifval([$2],
328835c4bbdfSmrg[AC_DIAGNOSE([obsolete],
328935c4bbdfSmrg             [$0: two- and three-arguments forms are deprecated.])
329035c4bbdfSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
329135c4bbdfSmrg AC_SUBST([PACKAGE], [$1])dnl
329235c4bbdfSmrg AC_SUBST([VERSION], [$2])],
329335c4bbdfSmrg[_AM_SET_OPTIONS([$1])dnl
329435c4bbdfSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
329535c4bbdfSmrgm4_if(
329635c4bbdfSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
329735c4bbdfSmrg  [ok:ok],,
329835c4bbdfSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
329935c4bbdfSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
330035c4bbdfSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
330135c4bbdfSmrg
330235c4bbdfSmrg_AM_IF_OPTION([no-define],,
330335c4bbdfSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
330435c4bbdfSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
330535c4bbdfSmrg
330635c4bbdfSmrg# Some tools Automake needs.
330735c4bbdfSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
330835c4bbdfSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
330935c4bbdfSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
331035c4bbdfSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
331135c4bbdfSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
331235c4bbdfSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
331335c4bbdfSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
331435c4bbdfSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
331535c4bbdfSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
331635c4bbdfSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
331735c4bbdfSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
331835c4bbdfSmrg# dies out for good.  For more background, see:
331935c4bbdfSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
332035c4bbdfSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
332135c4bbdfSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
332235c4bbdfSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
332335c4bbdfSmrg# system "awk" is bad on some platforms.
332435c4bbdfSmrgAC_REQUIRE([AC_PROG_AWK])dnl
332535c4bbdfSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
332635c4bbdfSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
332735c4bbdfSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
332835c4bbdfSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
332935c4bbdfSmrg			     [_AM_PROG_TAR([v7])])])
333035c4bbdfSmrg_AM_IF_OPTION([no-dependencies],,
333135c4bbdfSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
333235c4bbdfSmrg		  [_AM_DEPENDENCIES([CC])],
333335c4bbdfSmrg		  [m4_define([AC_PROG_CC],
333435c4bbdfSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
333535c4bbdfSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
333635c4bbdfSmrg		  [_AM_DEPENDENCIES([CXX])],
333735c4bbdfSmrg		  [m4_define([AC_PROG_CXX],
333835c4bbdfSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
333935c4bbdfSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
334035c4bbdfSmrg		  [_AM_DEPENDENCIES([OBJC])],
334135c4bbdfSmrg		  [m4_define([AC_PROG_OBJC],
334235c4bbdfSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
334335c4bbdfSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
334435c4bbdfSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
334535c4bbdfSmrg		  [m4_define([AC_PROG_OBJCXX],
334635c4bbdfSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
334735c4bbdfSmrg])
334835c4bbdfSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
334935c4bbdfSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
335035c4bbdfSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
335135c4bbdfSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
335235c4bbdfSmrgAC_CONFIG_COMMANDS_PRE(dnl
335335c4bbdfSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
335435c4bbdfSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
335535c4bbdfSmrg
335635c4bbdfSmrg# POSIX will say in a future version that running "rm -f" with no argument
335735c4bbdfSmrg# is OK; and we want to be able to make that assumption in our Makefile
335835c4bbdfSmrg# recipes.  So use an aggressive probe to check that the usage we want is
335935c4bbdfSmrg# actually supported "in the wild" to an acceptable degree.
336035c4bbdfSmrg# See automake bug#10828.
336135c4bbdfSmrg# To make any issue more visible, cause the running configure to be aborted
336235c4bbdfSmrg# by default if the 'rm' program in use doesn't match our expectations; the
336335c4bbdfSmrg# user can still override this though.
336435c4bbdfSmrgif rm -f && rm -fr && rm -rf; then : OK; else
336535c4bbdfSmrg  cat >&2 <<'END'
336635c4bbdfSmrgOops!
336735c4bbdfSmrg
336835c4bbdfSmrgYour 'rm' program seems unable to run without file operands specified
336935c4bbdfSmrgon the command line, even when the '-f' option is present.  This is contrary
337035c4bbdfSmrgto the behaviour of most rm programs out there, and not conforming with
337135c4bbdfSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
337235c4bbdfSmrg
337335c4bbdfSmrgPlease tell bug-automake@gnu.org about your system, including the value
337435c4bbdfSmrgof your $PATH and any error possibly output before this message.  This
337535c4bbdfSmrgcan help us improve future automake versions.
337635c4bbdfSmrg
337735c4bbdfSmrgEND
337835c4bbdfSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
337935c4bbdfSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
338035c4bbdfSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
338135c4bbdfSmrg    echo >&2
338235c4bbdfSmrg  else
338335c4bbdfSmrg    cat >&2 <<'END'
338435c4bbdfSmrgAborting the configuration process, to ensure you take notice of the issue.
338535c4bbdfSmrg
338635c4bbdfSmrgYou can download and install GNU coreutils to get an 'rm' implementation
338735c4bbdfSmrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
338835c4bbdfSmrg
338935c4bbdfSmrgIf you want to complete the configuration process using your problematic
339035c4bbdfSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
339135c4bbdfSmrgto "yes", and re-run configure.
339235c4bbdfSmrg
339335c4bbdfSmrgEND
339435c4bbdfSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
339535c4bbdfSmrg  fi
339635c4bbdfSmrgfi
339735c4bbdfSmrgdnl The trailing newline in this macro's definition is deliberate, for
339835c4bbdfSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
339935c4bbdfSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
340035c4bbdfSmrg])
340135c4bbdfSmrg
340235c4bbdfSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
340335c4bbdfSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
340435c4bbdfSmrgdnl mangled by Autoconf and run in a shell conditional statement.
340535c4bbdfSmrgm4_define([_AC_COMPILER_EXEEXT],
340635c4bbdfSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
340735c4bbdfSmrg
340835c4bbdfSmrg# When config.status generates a header, we must update the stamp-h file.
340935c4bbdfSmrg# This file resides in the same directory as the config header
341035c4bbdfSmrg# that is generated.  The stamp files are numbered to have different names.
341135c4bbdfSmrg
341235c4bbdfSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
341335c4bbdfSmrg# loop where config.status creates the headers, so we can generate
341435c4bbdfSmrg# our stamp files there.
341535c4bbdfSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
341635c4bbdfSmrg[# Compute $1's index in $config_headers.
341735c4bbdfSmrg_am_arg=$1
341835c4bbdfSmrg_am_stamp_count=1
341935c4bbdfSmrgfor _am_header in $config_headers :; do
342035c4bbdfSmrg  case $_am_header in
342135c4bbdfSmrg    $_am_arg | $_am_arg:* )
342235c4bbdfSmrg      break ;;
342335c4bbdfSmrg    * )
342435c4bbdfSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
342535c4bbdfSmrg  esac
342635c4bbdfSmrgdone
342735c4bbdfSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
342835c4bbdfSmrg
34291b5d61b8Smrg# Copyright (C) 2001-2017 Free Software Foundation, Inc.
343035c4bbdfSmrg#
343135c4bbdfSmrg# This file is free software; the Free Software Foundation
343235c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
343335c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
343435c4bbdfSmrg
343535c4bbdfSmrg# AM_PROG_INSTALL_SH
343635c4bbdfSmrg# ------------------
343735c4bbdfSmrg# Define $install_sh.
343835c4bbdfSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
343935c4bbdfSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
344035c4bbdfSmrgif test x"${install_sh+set}" != xset; then
344135c4bbdfSmrg  case $am_aux_dir in
344235c4bbdfSmrg  *\ * | *\	*)
344335c4bbdfSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
344435c4bbdfSmrg  *)
344535c4bbdfSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
344635c4bbdfSmrg  esac
344735c4bbdfSmrgfi
344835c4bbdfSmrgAC_SUBST([install_sh])])
344935c4bbdfSmrg
34501b5d61b8Smrg# Copyright (C) 2003-2017 Free Software Foundation, Inc.
345135c4bbdfSmrg#
345235c4bbdfSmrg# This file is free software; the Free Software Foundation
345335c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
345435c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
345535c4bbdfSmrg
345635c4bbdfSmrg# Check whether the underlying file-system supports filenames
345735c4bbdfSmrg# with a leading dot.  For instance MS-DOS doesn't.
345835c4bbdfSmrgAC_DEFUN([AM_SET_LEADING_DOT],
345935c4bbdfSmrg[rm -rf .tst 2>/dev/null
346035c4bbdfSmrgmkdir .tst 2>/dev/null
346135c4bbdfSmrgif test -d .tst; then
346235c4bbdfSmrg  am__leading_dot=.
346335c4bbdfSmrgelse
346435c4bbdfSmrg  am__leading_dot=_
346535c4bbdfSmrgfi
346635c4bbdfSmrgrmdir .tst 2>/dev/null
346735c4bbdfSmrgAC_SUBST([am__leading_dot])])
346835c4bbdfSmrg
346935c4bbdfSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
347035c4bbdfSmrg
34711b5d61b8Smrg# Copyright (C) 2001-2017 Free Software Foundation, Inc.
347235c4bbdfSmrg#
347335c4bbdfSmrg# This file is free software; the Free Software Foundation
347435c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
347535c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
347635c4bbdfSmrg
347735c4bbdfSmrg# AM_MAKE_INCLUDE()
347835c4bbdfSmrg# -----------------
347935c4bbdfSmrg# Check to see how make treats includes.
348035c4bbdfSmrgAC_DEFUN([AM_MAKE_INCLUDE],
348135c4bbdfSmrg[am_make=${MAKE-make}
348235c4bbdfSmrgcat > confinc << 'END'
348335c4bbdfSmrgam__doit:
348435c4bbdfSmrg	@echo this is the am__doit target
348535c4bbdfSmrg.PHONY: am__doit
348635c4bbdfSmrgEND
348735c4bbdfSmrg# If we don't find an include directive, just comment out the code.
348835c4bbdfSmrgAC_MSG_CHECKING([for style of include used by $am_make])
348935c4bbdfSmrgam__include="#"
349035c4bbdfSmrgam__quote=
349135c4bbdfSmrg_am_result=none
349235c4bbdfSmrg# First try GNU make style include.
349335c4bbdfSmrgecho "include confinc" > confmf
349435c4bbdfSmrg# Ignore all kinds of additional output from 'make'.
349535c4bbdfSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
349635c4bbdfSmrg*the\ am__doit\ target*)
349735c4bbdfSmrg  am__include=include
349835c4bbdfSmrg  am__quote=
349935c4bbdfSmrg  _am_result=GNU
350035c4bbdfSmrg  ;;
350135c4bbdfSmrgesac
350235c4bbdfSmrg# Now try BSD make style include.
350335c4bbdfSmrgif test "$am__include" = "#"; then
350435c4bbdfSmrg   echo '.include "confinc"' > confmf
350535c4bbdfSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
350635c4bbdfSmrg   *the\ am__doit\ target*)
350735c4bbdfSmrg     am__include=.include
350835c4bbdfSmrg     am__quote="\""
350935c4bbdfSmrg     _am_result=BSD
351035c4bbdfSmrg     ;;
351135c4bbdfSmrg   esac
351235c4bbdfSmrgfi
351335c4bbdfSmrgAC_SUBST([am__include])
351435c4bbdfSmrgAC_SUBST([am__quote])
351535c4bbdfSmrgAC_MSG_RESULT([$_am_result])
351635c4bbdfSmrgrm -f confinc confmf
351735c4bbdfSmrg])
351835c4bbdfSmrg
351935c4bbdfSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
352035c4bbdfSmrg
35211b5d61b8Smrg# Copyright (C) 1997-2017 Free Software Foundation, Inc.
352235c4bbdfSmrg#
352335c4bbdfSmrg# This file is free software; the Free Software Foundation
352435c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
352535c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
352635c4bbdfSmrg
352735c4bbdfSmrg# AM_MISSING_PROG(NAME, PROGRAM)
352835c4bbdfSmrg# ------------------------------
352935c4bbdfSmrgAC_DEFUN([AM_MISSING_PROG],
353035c4bbdfSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
353135c4bbdfSmrg$1=${$1-"${am_missing_run}$2"}
353235c4bbdfSmrgAC_SUBST($1)])
353335c4bbdfSmrg
353435c4bbdfSmrg# AM_MISSING_HAS_RUN
353535c4bbdfSmrg# ------------------
353635c4bbdfSmrg# Define MISSING if not defined so far and test if it is modern enough.
353735c4bbdfSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
353835c4bbdfSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
353935c4bbdfSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
354035c4bbdfSmrgAC_REQUIRE_AUX_FILE([missing])dnl
354135c4bbdfSmrgif test x"${MISSING+set}" != xset; then
354235c4bbdfSmrg  case $am_aux_dir in
354335c4bbdfSmrg  *\ * | *\	*)
354435c4bbdfSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
354535c4bbdfSmrg  *)
354635c4bbdfSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
354735c4bbdfSmrg  esac
354835c4bbdfSmrgfi
354935c4bbdfSmrg# Use eval to expand $SHELL
355035c4bbdfSmrgif eval "$MISSING --is-lightweight"; then
355135c4bbdfSmrg  am_missing_run="$MISSING "
355235c4bbdfSmrgelse
355335c4bbdfSmrg  am_missing_run=
355435c4bbdfSmrg  AC_MSG_WARN(['missing' script is too old or missing])
355535c4bbdfSmrgfi
355635c4bbdfSmrg])
355735c4bbdfSmrg
355835c4bbdfSmrg# Helper functions for option handling.                     -*- Autoconf -*-
355935c4bbdfSmrg
35601b5d61b8Smrg# Copyright (C) 2001-2017 Free Software Foundation, Inc.
356135c4bbdfSmrg#
356235c4bbdfSmrg# This file is free software; the Free Software Foundation
356335c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
356435c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
356535c4bbdfSmrg
356635c4bbdfSmrg# _AM_MANGLE_OPTION(NAME)
356735c4bbdfSmrg# -----------------------
356835c4bbdfSmrgAC_DEFUN([_AM_MANGLE_OPTION],
356935c4bbdfSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
357035c4bbdfSmrg
357135c4bbdfSmrg# _AM_SET_OPTION(NAME)
357235c4bbdfSmrg# --------------------
357335c4bbdfSmrg# Set option NAME.  Presently that only means defining a flag for this option.
357435c4bbdfSmrgAC_DEFUN([_AM_SET_OPTION],
357535c4bbdfSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
357635c4bbdfSmrg
357735c4bbdfSmrg# _AM_SET_OPTIONS(OPTIONS)
357835c4bbdfSmrg# ------------------------
357935c4bbdfSmrg# OPTIONS is a space-separated list of Automake options.
358035c4bbdfSmrgAC_DEFUN([_AM_SET_OPTIONS],
358135c4bbdfSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
358235c4bbdfSmrg
358335c4bbdfSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
358435c4bbdfSmrg# -------------------------------------------
358535c4bbdfSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
358635c4bbdfSmrgAC_DEFUN([_AM_IF_OPTION],
358735c4bbdfSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
358835c4bbdfSmrg
35891b5d61b8Smrg# Copyright (C) 1999-2017 Free Software Foundation, Inc.
359035c4bbdfSmrg#
359135c4bbdfSmrg# This file is free software; the Free Software Foundation
359235c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
359335c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
359435c4bbdfSmrg
359535c4bbdfSmrg# _AM_PROG_CC_C_O
359635c4bbdfSmrg# ---------------
359735c4bbdfSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
359835c4bbdfSmrg# to automatically call this.
359935c4bbdfSmrgAC_DEFUN([_AM_PROG_CC_C_O],
360035c4bbdfSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
360135c4bbdfSmrgAC_REQUIRE_AUX_FILE([compile])dnl
360235c4bbdfSmrgAC_LANG_PUSH([C])dnl
360335c4bbdfSmrgAC_CACHE_CHECK(
360435c4bbdfSmrg  [whether $CC understands -c and -o together],
360535c4bbdfSmrg  [am_cv_prog_cc_c_o],
360635c4bbdfSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
360735c4bbdfSmrg  # Make sure it works both with $CC and with simple cc.
360835c4bbdfSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
360935c4bbdfSmrg  # compilers refuse to overwrite an existing .o file with -o,
361035c4bbdfSmrg  # though they will create one.
361135c4bbdfSmrg  am_cv_prog_cc_c_o=yes
361235c4bbdfSmrg  for am_i in 1 2; do
361335c4bbdfSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
361435c4bbdfSmrg         && test -f conftest2.$ac_objext; then
361535c4bbdfSmrg      : OK
361635c4bbdfSmrg    else
361735c4bbdfSmrg      am_cv_prog_cc_c_o=no
361835c4bbdfSmrg      break
361935c4bbdfSmrg    fi
362035c4bbdfSmrg  done
362135c4bbdfSmrg  rm -f core conftest*
362235c4bbdfSmrg  unset am_i])
362335c4bbdfSmrgif test "$am_cv_prog_cc_c_o" != yes; then
362435c4bbdfSmrg   # Losing compiler, so override with the script.
362535c4bbdfSmrg   # FIXME: It is wrong to rewrite CC.
362635c4bbdfSmrg   # But if we don't then we get into trouble of one sort or another.
362735c4bbdfSmrg   # A longer-term fix would be to have automake use am__CC in this case,
362835c4bbdfSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
362935c4bbdfSmrg   CC="$am_aux_dir/compile $CC"
363035c4bbdfSmrgfi
363135c4bbdfSmrgAC_LANG_POP([C])])
363235c4bbdfSmrg
363335c4bbdfSmrg# For backward compatibility.
363435c4bbdfSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
363535c4bbdfSmrg
36361b5d61b8Smrg# Copyright (C) 2001-2017 Free Software Foundation, Inc.
363735c4bbdfSmrg#
363835c4bbdfSmrg# This file is free software; the Free Software Foundation
363935c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
364035c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
364135c4bbdfSmrg
364235c4bbdfSmrg# AM_RUN_LOG(COMMAND)
364335c4bbdfSmrg# -------------------
364435c4bbdfSmrg# Run COMMAND, save the exit status in ac_status, and log it.
364535c4bbdfSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
364635c4bbdfSmrgAC_DEFUN([AM_RUN_LOG],
364735c4bbdfSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
364835c4bbdfSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
364935c4bbdfSmrg   ac_status=$?
365035c4bbdfSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
365135c4bbdfSmrg   (exit $ac_status); }])
365235c4bbdfSmrg
365335c4bbdfSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
365435c4bbdfSmrg
36551b5d61b8Smrg# Copyright (C) 1996-2017 Free Software Foundation, Inc.
365635c4bbdfSmrg#
365735c4bbdfSmrg# This file is free software; the Free Software Foundation
365835c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
365935c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
366035c4bbdfSmrg
366135c4bbdfSmrg# AM_SANITY_CHECK
366235c4bbdfSmrg# ---------------
366335c4bbdfSmrgAC_DEFUN([AM_SANITY_CHECK],
366435c4bbdfSmrg[AC_MSG_CHECKING([whether build environment is sane])
366535c4bbdfSmrg# Reject unsafe characters in $srcdir or the absolute working directory
366635c4bbdfSmrg# name.  Accept space and tab only in the latter.
366735c4bbdfSmrgam_lf='
366835c4bbdfSmrg'
366935c4bbdfSmrgcase `pwd` in
367035c4bbdfSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
367135c4bbdfSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
367235c4bbdfSmrgesac
367335c4bbdfSmrgcase $srcdir in
367435c4bbdfSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
367535c4bbdfSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
367635c4bbdfSmrgesac
367735c4bbdfSmrg
367835c4bbdfSmrg# Do 'set' in a subshell so we don't clobber the current shell's
367935c4bbdfSmrg# arguments.  Must try -L first in case configure is actually a
368035c4bbdfSmrg# symlink; some systems play weird games with the mod time of symlinks
368135c4bbdfSmrg# (eg FreeBSD returns the mod time of the symlink's containing
368235c4bbdfSmrg# directory).
368335c4bbdfSmrgif (
368435c4bbdfSmrg   am_has_slept=no
368535c4bbdfSmrg   for am_try in 1 2; do
368635c4bbdfSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
368735c4bbdfSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
368835c4bbdfSmrg     if test "$[*]" = "X"; then
368935c4bbdfSmrg	# -L didn't work.
369035c4bbdfSmrg	set X `ls -t "$srcdir/configure" conftest.file`
369135c4bbdfSmrg     fi
369235c4bbdfSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
369335c4bbdfSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
369435c4bbdfSmrg
369535c4bbdfSmrg	# If neither matched, then we have a broken ls.  This can happen
369635c4bbdfSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
369735c4bbdfSmrg	# broken ls alias from the environment.  This has actually
369835c4bbdfSmrg	# happened.  Such a system could not be considered "sane".
369935c4bbdfSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
370035c4bbdfSmrg  alias in your environment])
370135c4bbdfSmrg     fi
370235c4bbdfSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
370335c4bbdfSmrg       break
370435c4bbdfSmrg     fi
370535c4bbdfSmrg     # Just in case.
370635c4bbdfSmrg     sleep 1
370735c4bbdfSmrg     am_has_slept=yes
370835c4bbdfSmrg   done
370935c4bbdfSmrg   test "$[2]" = conftest.file
371035c4bbdfSmrg   )
371135c4bbdfSmrgthen
371235c4bbdfSmrg   # Ok.
371335c4bbdfSmrg   :
371435c4bbdfSmrgelse
371535c4bbdfSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
371635c4bbdfSmrgCheck your system clock])
371735c4bbdfSmrgfi
371835c4bbdfSmrgAC_MSG_RESULT([yes])
371935c4bbdfSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
372035c4bbdfSmrg# generated files are strictly newer.
372135c4bbdfSmrgam_sleep_pid=
372235c4bbdfSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
372335c4bbdfSmrg  ( sleep 1 ) &
372435c4bbdfSmrg  am_sleep_pid=$!
372535c4bbdfSmrgfi
372635c4bbdfSmrgAC_CONFIG_COMMANDS_PRE(
372735c4bbdfSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
372835c4bbdfSmrg   if test -n "$am_sleep_pid"; then
372935c4bbdfSmrg     # Hide warnings about reused PIDs.
373035c4bbdfSmrg     wait $am_sleep_pid 2>/dev/null
373135c4bbdfSmrg   fi
373235c4bbdfSmrg   AC_MSG_RESULT([done])])
373335c4bbdfSmrgrm -f conftest.file
373435c4bbdfSmrg])
373535c4bbdfSmrg
37361b5d61b8Smrg# Copyright (C) 2009-2017 Free Software Foundation, Inc.
373735c4bbdfSmrg#
373835c4bbdfSmrg# This file is free software; the Free Software Foundation
373935c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
374035c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
374135c4bbdfSmrg
374235c4bbdfSmrg# AM_SILENT_RULES([DEFAULT])
374335c4bbdfSmrg# --------------------------
374435c4bbdfSmrg# Enable less verbose build rules; with the default set to DEFAULT
374535c4bbdfSmrg# ("yes" being less verbose, "no" or empty being verbose).
374635c4bbdfSmrgAC_DEFUN([AM_SILENT_RULES],
374735c4bbdfSmrg[AC_ARG_ENABLE([silent-rules], [dnl
374835c4bbdfSmrgAS_HELP_STRING(
374935c4bbdfSmrg  [--enable-silent-rules],
375035c4bbdfSmrg  [less verbose build output (undo: "make V=1")])
375135c4bbdfSmrgAS_HELP_STRING(
375235c4bbdfSmrg  [--disable-silent-rules],
375335c4bbdfSmrg  [verbose build output (undo: "make V=0")])dnl
375435c4bbdfSmrg])
375535c4bbdfSmrgcase $enable_silent_rules in @%:@ (((
375635c4bbdfSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
375735c4bbdfSmrg   no) AM_DEFAULT_VERBOSITY=1;;
375835c4bbdfSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
375935c4bbdfSmrgesac
376035c4bbdfSmrgdnl
376135c4bbdfSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
376235c4bbdfSmrgdnl do not support nested variable expansions.
376335c4bbdfSmrgdnl See automake bug#9928 and bug#10237.
376435c4bbdfSmrgam_make=${MAKE-make}
376535c4bbdfSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
376635c4bbdfSmrg   [am_cv_make_support_nested_variables],
376735c4bbdfSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
376835c4bbdfSmrgBAR0=false
376935c4bbdfSmrgBAR1=true
377035c4bbdfSmrgV=1
377135c4bbdfSmrgam__doit:
377235c4bbdfSmrg	@$(TRUE)
377335c4bbdfSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
377435c4bbdfSmrg  am_cv_make_support_nested_variables=yes
377535c4bbdfSmrgelse
377635c4bbdfSmrg  am_cv_make_support_nested_variables=no
377735c4bbdfSmrgfi])
377835c4bbdfSmrgif test $am_cv_make_support_nested_variables = yes; then
377935c4bbdfSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
378035c4bbdfSmrg  AM_V='$(V)'
378135c4bbdfSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
378235c4bbdfSmrgelse
378335c4bbdfSmrg  AM_V=$AM_DEFAULT_VERBOSITY
378435c4bbdfSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
378535c4bbdfSmrgfi
378635c4bbdfSmrgAC_SUBST([AM_V])dnl
378735c4bbdfSmrgAM_SUBST_NOTMAKE([AM_V])dnl
378835c4bbdfSmrgAC_SUBST([AM_DEFAULT_V])dnl
378935c4bbdfSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
379035c4bbdfSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
379135c4bbdfSmrgAM_BACKSLASH='\'
379235c4bbdfSmrgAC_SUBST([AM_BACKSLASH])dnl
379335c4bbdfSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
379435c4bbdfSmrg])
379535c4bbdfSmrg
37961b5d61b8Smrg# Copyright (C) 2001-2017 Free Software Foundation, Inc.
379735c4bbdfSmrg#
379835c4bbdfSmrg# This file is free software; the Free Software Foundation
379935c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
380035c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
380135c4bbdfSmrg
380235c4bbdfSmrg# AM_PROG_INSTALL_STRIP
380335c4bbdfSmrg# ---------------------
380435c4bbdfSmrg# One issue with vendor 'install' (even GNU) is that you can't
380535c4bbdfSmrg# specify the program used to strip binaries.  This is especially
380635c4bbdfSmrg# annoying in cross-compiling environments, where the build's strip
380735c4bbdfSmrg# is unlikely to handle the host's binaries.
380835c4bbdfSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
380935c4bbdfSmrg# always use install-sh in "make install-strip", and initialize
381035c4bbdfSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
381135c4bbdfSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
381235c4bbdfSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
381335c4bbdfSmrg# Installed binaries are usually stripped using 'strip' when the user
381435c4bbdfSmrg# run "make install-strip".  However 'strip' might not be the right
381535c4bbdfSmrg# tool to use in cross-compilation environments, therefore Automake
381635c4bbdfSmrg# will honor the 'STRIP' environment variable to overrule this program.
381735c4bbdfSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
381835c4bbdfSmrgif test "$cross_compiling" != no; then
381935c4bbdfSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
382035c4bbdfSmrgfi
382135c4bbdfSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
382235c4bbdfSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
382335c4bbdfSmrg
38241b5d61b8Smrg# Copyright (C) 2006-2017 Free Software Foundation, Inc.
382535c4bbdfSmrg#
382635c4bbdfSmrg# This file is free software; the Free Software Foundation
382735c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
382835c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
382935c4bbdfSmrg
383035c4bbdfSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
383135c4bbdfSmrg# ---------------------------
383235c4bbdfSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
383335c4bbdfSmrg# This macro is traced by Automake.
383435c4bbdfSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
383535c4bbdfSmrg
383635c4bbdfSmrg# AM_SUBST_NOTMAKE(VARIABLE)
383735c4bbdfSmrg# --------------------------
383835c4bbdfSmrg# Public sister of _AM_SUBST_NOTMAKE.
383935c4bbdfSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
384035c4bbdfSmrg
384135c4bbdfSmrg# Check how to create a tarball.                            -*- Autoconf -*-
384235c4bbdfSmrg
38431b5d61b8Smrg# Copyright (C) 2004-2017 Free Software Foundation, Inc.
384435c4bbdfSmrg#
384535c4bbdfSmrg# This file is free software; the Free Software Foundation
384635c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
384735c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
384835c4bbdfSmrg
384935c4bbdfSmrg# _AM_PROG_TAR(FORMAT)
385035c4bbdfSmrg# --------------------
385135c4bbdfSmrg# Check how to create a tarball in format FORMAT.
385235c4bbdfSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
385335c4bbdfSmrg#
385435c4bbdfSmrg# Substitute a variable $(am__tar) that is a command
385535c4bbdfSmrg# writing to stdout a FORMAT-tarball containing the directory
385635c4bbdfSmrg# $tardir.
385735c4bbdfSmrg#     tardir=directory && $(am__tar) > result.tar
385835c4bbdfSmrg#
385935c4bbdfSmrg# Substitute a variable $(am__untar) that extract such
386035c4bbdfSmrg# a tarball read from stdin.
386135c4bbdfSmrg#     $(am__untar) < result.tar
386235c4bbdfSmrg#
386335c4bbdfSmrgAC_DEFUN([_AM_PROG_TAR],
386435c4bbdfSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
386535c4bbdfSmrg# in the wild :-(  We should find a proper way to deprecate it ...
386635c4bbdfSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
386735c4bbdfSmrg
386835c4bbdfSmrg# We'll loop over all known methods to create a tar archive until one works.
386935c4bbdfSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
387035c4bbdfSmrg
387135c4bbdfSmrgm4_if([$1], [v7],
387235c4bbdfSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
387335c4bbdfSmrg
387435c4bbdfSmrg  [m4_case([$1],
387535c4bbdfSmrg    [ustar],
387635c4bbdfSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
387735c4bbdfSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
387835c4bbdfSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
387935c4bbdfSmrg      # and bug#13588).
388035c4bbdfSmrg      am_max_uid=2097151 # 2^21 - 1
388135c4bbdfSmrg      am_max_gid=$am_max_uid
388235c4bbdfSmrg      # The $UID and $GID variables are not portable, so we need to resort
388335c4bbdfSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
388435c4bbdfSmrg      # below are definitely unexpected, so allow the users to see them
388535c4bbdfSmrg      # (that is, avoid stderr redirection).
388635c4bbdfSmrg      am_uid=`id -u || echo unknown`
388735c4bbdfSmrg      am_gid=`id -g || echo unknown`
388835c4bbdfSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
388935c4bbdfSmrg      if test $am_uid -le $am_max_uid; then
389035c4bbdfSmrg         AC_MSG_RESULT([yes])
389135c4bbdfSmrg      else
389235c4bbdfSmrg         AC_MSG_RESULT([no])
389335c4bbdfSmrg         _am_tools=none
389435c4bbdfSmrg      fi
389535c4bbdfSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
389635c4bbdfSmrg      if test $am_gid -le $am_max_gid; then
389735c4bbdfSmrg         AC_MSG_RESULT([yes])
389835c4bbdfSmrg      else
389935c4bbdfSmrg        AC_MSG_RESULT([no])
390035c4bbdfSmrg        _am_tools=none
390135c4bbdfSmrg      fi],
390235c4bbdfSmrg
390335c4bbdfSmrg  [pax],
390435c4bbdfSmrg    [],
390535c4bbdfSmrg
390635c4bbdfSmrg  [m4_fatal([Unknown tar format])])
390735c4bbdfSmrg
390835c4bbdfSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
390935c4bbdfSmrg
391035c4bbdfSmrg  # Go ahead even if we have the value already cached.  We do so because we
391135c4bbdfSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
391235c4bbdfSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
391335c4bbdfSmrg
391435c4bbdfSmrg  for _am_tool in $_am_tools; do
391535c4bbdfSmrg    case $_am_tool in
391635c4bbdfSmrg    gnutar)
391735c4bbdfSmrg      for _am_tar in tar gnutar gtar; do
391835c4bbdfSmrg        AM_RUN_LOG([$_am_tar --version]) && break
391935c4bbdfSmrg      done
392035c4bbdfSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
392135c4bbdfSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
392235c4bbdfSmrg      am__untar="$_am_tar -xf -"
392335c4bbdfSmrg      ;;
392435c4bbdfSmrg    plaintar)
392535c4bbdfSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
392635c4bbdfSmrg      # ustar tarball either.
392735c4bbdfSmrg      (tar --version) >/dev/null 2>&1 && continue
392835c4bbdfSmrg      am__tar='tar chf - "$$tardir"'
392935c4bbdfSmrg      am__tar_='tar chf - "$tardir"'
393035c4bbdfSmrg      am__untar='tar xf -'
393135c4bbdfSmrg      ;;
393235c4bbdfSmrg    pax)
393335c4bbdfSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
393435c4bbdfSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
393535c4bbdfSmrg      am__untar='pax -r'
393635c4bbdfSmrg      ;;
393735c4bbdfSmrg    cpio)
393835c4bbdfSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
393935c4bbdfSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
394035c4bbdfSmrg      am__untar='cpio -i -H $1 -d'
394135c4bbdfSmrg      ;;
394235c4bbdfSmrg    none)
394335c4bbdfSmrg      am__tar=false
394435c4bbdfSmrg      am__tar_=false
394535c4bbdfSmrg      am__untar=false
394635c4bbdfSmrg      ;;
394735c4bbdfSmrg    esac
394835c4bbdfSmrg
394935c4bbdfSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
395035c4bbdfSmrg    # and am__untar set.
395135c4bbdfSmrg    test -n "${am_cv_prog_tar_$1}" && break
395235c4bbdfSmrg
395335c4bbdfSmrg    # tar/untar a dummy directory, and stop if the command works.
395435c4bbdfSmrg    rm -rf conftest.dir
395535c4bbdfSmrg    mkdir conftest.dir
395635c4bbdfSmrg    echo GrepMe > conftest.dir/file
395735c4bbdfSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
395835c4bbdfSmrg    rm -rf conftest.dir
395935c4bbdfSmrg    if test -s conftest.tar; then
396035c4bbdfSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
396135c4bbdfSmrg      AM_RUN_LOG([cat conftest.dir/file])
396235c4bbdfSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
396335c4bbdfSmrg    fi
396435c4bbdfSmrg  done
396535c4bbdfSmrg  rm -rf conftest.dir
396635c4bbdfSmrg
396735c4bbdfSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
396835c4bbdfSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
396935c4bbdfSmrg
397035c4bbdfSmrgAC_SUBST([am__tar])
397135c4bbdfSmrgAC_SUBST([am__untar])
397235c4bbdfSmrg]) # _AM_PROG_TAR
397335c4bbdfSmrg
397435c4bbdfSmrgm4_include([m4/ac_define_dir.m4])
39751b5d61b8Smrgm4_include([m4/ax_pthread.m4])
397635c4bbdfSmrgm4_include([m4/libtool.m4])
397735c4bbdfSmrgm4_include([m4/ltoptions.m4])
397835c4bbdfSmrgm4_include([m4/ltsugar.m4])
397935c4bbdfSmrgm4_include([m4/ltversion.m4])
398035c4bbdfSmrgm4_include([m4/lt~obsolete.m4])
3981