aclocal.m4 revision 01395c31
101395c31Smrg# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
201395c31Smrg
301395c31Smrg# Copyright (C) 1996-2018 Free Software Foundation, Inc.
492bb16f8Smrg
592bb16f8Smrg# This file is free software; the Free Software Foundation
692bb16f8Smrg# gives unlimited permission to copy and/or distribute it,
792bb16f8Smrg# with or without modifications, as long as this notice is preserved.
892bb16f8Smrg
992bb16f8Smrg# This program is distributed in the hope that it will be useful,
1092bb16f8Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1192bb16f8Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1292bb16f8Smrg# PARTICULAR PURPOSE.
1392bb16f8Smrg
1401395c31Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
158255a313Smrgm4_ifndef([AC_AUTOCONF_VERSION],
168255a313Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1701395c31Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
1801395c31Smrg[m4_warning([this file was generated for autoconf 2.69.
198255a313SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
208255a313SmrgIf you have problems, you may need to regenerate the build system entirely.
2101395c31SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2201395c31Smrg
2301395c31Smrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
2401395c31Smrgdnl
2501395c31Smrgdnl This file comes from X.Org's font-util 1.3.1
2601395c31Smrgdnl
2701395c31Smrgdnl Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
2801395c31Smrgdnl
2901395c31Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
3001395c31Smrgdnl copy of this software and associated documentation files (the "Software"),
3101395c31Smrgdnl to deal in the Software without restriction, including without limitation
3201395c31Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3301395c31Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
3401395c31Smrgdnl Software is furnished to do so, subject to the following conditions:
3501395c31Smrgdnl
3601395c31Smrgdnl The above copyright notice and this permission notice (including the next
3701395c31Smrgdnl paragraph) shall be included in all copies or substantial portions of the
3801395c31Smrgdnl Software.
3901395c31Smrgdnl
4001395c31Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4101395c31Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4201395c31Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
4301395c31Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4401395c31Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
4501395c31Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
4601395c31Smrgdnl DEALINGS IN THE SOFTWARE.
4701395c31Smrgdnl
4801395c31Smrgdnl --------------------------------------------------------------------
4901395c31Smrgdnl
5001395c31Smrgdnl Copyright 2005 Red Hat, Inc
5101395c31Smrgdnl
5201395c31Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
5301395c31Smrgdnl documentation for any purpose is hereby granted without fee, provided that
5401395c31Smrgdnl the above copyright notice appear in all copies and that both that
5501395c31Smrgdnl copyright notice and this permission notice appear in supporting
5601395c31Smrgdnl documentation.
5701395c31Smrgdnl
5801395c31Smrgdnl The above copyright notice and this permission notice shall be included
5901395c31Smrgdnl in all copies or substantial portions of the Software.
6001395c31Smrgdnl
6101395c31Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
6201395c31Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
6301395c31Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
6401395c31Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
6501395c31Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
6601395c31Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
6701395c31Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
6801395c31Smrgdnl
6901395c31Smrgdnl Except as contained in this notice, the name of the copyright holders shall
7001395c31Smrgdnl not be used in advertising or otherwise to promote the sale, use or
7101395c31Smrgdnl other dealings in this Software without prior written authorization
7201395c31Smrgdnl from the copyright holders.
7392bb16f8Smrg
7401395c31Smrg# XORG_FONT_MACROS_VERSION(required-version)
7501395c31Smrg# ------------------------------------------
7601395c31Smrg# Minimum version: 1.1.0
7792bb16f8Smrg#
7801395c31Smrg# If you're using a macro added in Version 1.1 or newer, include this in
7901395c31Smrg# your configure.ac with the minimum required version, such as:
8001395c31Smrg# XORG_FONT_MACROS_VERSION(1.1)
8101395c31Smrg#
8201395c31Smrg# To ensure that this macro is defined, also add:
8301395c31Smrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
8401395c31Smrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
8501395c31Smrg#
8601395c31Smrg#
8701395c31Smrg# See the "minimum version" comment for each macro you use to see what
8801395c31Smrg# version you require.
8901395c31Smrgm4_defun([XORG_FONT_MACROS_VERSION],[
9001395c31Smrgm4_define([vers_have], [1.3.1])
9101395c31Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
9201395c31Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
9301395c31Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
9401395c31Smrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
9501395c31Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
9601395c31Smrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
9701395c31Smrgm4_undefine([vers_have])
9801395c31Smrgm4_undefine([maj_have])
9901395c31Smrgm4_undefine([maj_needed])
10001395c31Smrg]) # XORG_FONT_MACROS_VERSION
10192bb16f8Smrg
10201395c31Smrg# XORG_FONT_CHECK_{maps}()
10301395c31Smrg# ------------------------
10401395c31Smrg# Minimum version: 1.0.0
10501395c31Smrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
10601395c31Smrg# JISX0201 or KOI8_R.  By default, they are all enabled.
1078255a313Smrg
10801395c31SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
10901395c31SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
11001395c31SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
11101395c31SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
11201395c31SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
11301395c31SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
11401395c31SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
11501395c31SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
11601395c31SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
11701395c31SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
11801395c31SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
11901395c31SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
12001395c31SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
12101395c31SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
12201395c31SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
12301395c31SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
12401395c31SmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
12501395c31SmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
12692bb16f8Smrg
12701395c31Smrg# XORG_FONT_CHECK_ENCODING(encoding)
12801395c31Smrg# ----------------------------------
12901395c31Smrg# Minimum version: 1.1.0
13001395c31Smrg# This macro adds --enable/disable-<encoding>, enabled by default.
13101395c31Smrg# It replaced individual copies of this code in the above macros in 1.1.
13201395c31Smrg# Currently assumes encoding names will be all upper-case - add m4_toupper
13301395c31Smrg# calls if this is not true in the future.
13492bb16f8Smrg
13501395c31SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
13601395c31Smrg	AC_ARG_ENABLE(m4_tolower($1),
13701395c31Smrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
13801395c31Smrg				[Build $1 fonts (default: yes)]),
13901395c31Smrg		[AS_TR_SH($1)=$enableval])
14001395c31Smrg	AC_MSG_CHECKING([whether to build $1 fonts])
14101395c31Smrg	AC_MSG_RESULT($[AS_TR_SH($1)])
14201395c31Smrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
14301395c31Smrg]) # XORG_FONT_CHECK_ENCODING
14401395c31Smrg
14501395c31Smrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
14601395c31Smrg# -----------------------------------------------------
14701395c31Smrg# Minimum version: 1.1.0
14801395c31Smrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
14901395c31Smrg# Add a shorthand --enable/disable-all-encodings option.
15001395c31Smrg
15101395c31SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
15201395c31Smrg	AC_ARG_ENABLE([all-encodings],
15301395c31Smrg		AS_HELP_STRING([--disable-all-encodings],
15401395c31Smrg				[Disable building of all font encodings]),
15501395c31Smrg		[m4_foreach_w([enc], [$1], [
15601395c31Smrg			AS_TR_SH(enc)=$enableval
15701395c31Smrg		])],
15801395c31Smrg		[m4_foreach_w([enc], [$1], [
15901395c31Smrg			AS_TR_SH(enc)=yes
16001395c31Smrg		])])
16101395c31Smrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
16201395c31Smrg]) # XORG_FONT_CHECK_ENCODING_LIST
16392bb16f8Smrg
16401395c31Smrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
16501395c31Smrg# ------------------------------------------
16601395c31Smrg# Minimum version: 1.1.0
16701395c31Smrg#
16801395c31Smrg# Simple wrapper around AC_PATH_PROG that errors if not found
16992bb16f8Smrg#
17092bb16f8Smrg
17101395c31SmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
17201395c31Smrg	AC_PATH_PROG($1, $2)
17301395c31Smrg	if test x"$$1" = x; then
17401395c31Smrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
17501395c31Smrg	fi
17601395c31Smrg])
17701395c31Smrg
17801395c31Smrg
17901395c31Smrg# XORG_FONT_FCCACHE()
18001395c31Smrg# -------------------
18101395c31Smrg# Minimum version: 1.1.0
18292bb16f8Smrg#
18301395c31Smrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
18401395c31Smrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
18501395c31Smrg# to run fc-cache if found and not installing to $DESTDIR and not
18601395c31Smrg# cross-compiling
18792bb16f8Smrg#
18801395c31Smrg# fc-cache is optional, not required, and should be skipped when making
18901395c31Smrg# packages (installing to $DESTDIR) or cross-compiling
19092bb16f8Smrg#
19101395c31SmrgAC_DEFUN([XORG_FONT_FCCACHE],[
19201395c31Smrg	AC_PATH_PROG(FCCACHE, fc-cache)
19301395c31Smrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
19401395c31Smrg	if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then
19501395c31Smrg		RUN_FCCACHE="${FCCACHE_WARN}"
19601395c31Smrg	else
19701395c31Smrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
19801395c31Smrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
19901395c31Smrg	fi
20001395c31Smrg	AC_SUBST([RUN_FCCACHE])
20101395c31Smrg])
20201395c31Smrg
20301395c31Smrg# XORG_FONT_MKFONTDIR()
20401395c31Smrg# -------------------
20501395c31Smrg# Minimum version: 1.3.0
20692bb16f8Smrg#
20701395c31Smrg# Set MKFONTDIR to path to mkfontdir.
20892bb16f8Smrg#
20901395c31Smrg# If cross-compiling, and if mkdir is not found, use a shell command
21001395c31Smrg# which warns mkfontdir needs to be run on the target
21101395c31Smrg#
21201395c31Smrg# If not cross-compiling, mkfontdir must be found
21301395c31Smrg#
21401395c31SmrgAC_DEFUN([XORG_FONT_MKFONTDIR],[
21501395c31Smrg	if test x"$cross_compiling" != x"no" ; then
21601395c31Smrg		AC_PATH_PROG(MKFONTDIR, mkfontdir, "")
21701395c31Smrg		MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run mkfontdir manually on host system"'
21892bb16f8Smrg
21901395c31Smrg		if test x"$MKFONTDIR" = x; then
22001395c31Smrg			MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'"
22101395c31Smrg		fi
22201395c31Smrg	else
22301395c31Smrg		XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
22401395c31Smrg	fi
22501395c31Smrg
22601395c31Smrg	AC_SUBST([MKFONTDIR])
22792bb16f8Smrg])
22892bb16f8Smrg
22901395c31Smrg# XORG_FONT_COMMON_UTILS()
23001395c31Smrg# ------------------------
23101395c31Smrg# Minimum version: 1.1.0
23201395c31Smrg#
23301395c31Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
23401395c31Smrg
23501395c31SmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
23601395c31Smrg	XORG_FONT_FCCACHE
23701395c31Smrg	XORG_FONT_MKFONTDIR
23801395c31Smrg])
23992bb16f8Smrg
24001395c31Smrg# XORG_FONT_SCALED_UTILS()
24101395c31Smrg# ------------------------
24201395c31Smrg# Minimum version: 1.1.0
24392bb16f8Smrg#
24401395c31Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
24501395c31Smrg# (TrueType, OpenType, Type1)
24692bb16f8Smrg
24701395c31SmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
24801395c31Smrg	XORG_FONT_COMMON_UTILS
24901395c31Smrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
25001395c31Smrg])
25192bb16f8Smrg
25201395c31Smrg# XORG_FONT_BDF_UTILS()
25301395c31Smrg# ---------------------
25401395c31Smrg# Minimum version: 1.1.0
2558255a313Smrg#
25601395c31Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
25701395c31Smrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
25801395c31Smrg# PCF output files created by bdftopcf
2598255a313Smrg
26001395c31SmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
26101395c31Smrg	XORG_FONT_COMMON_UTILS
26201395c31Smrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
26301395c31Smrg	XORG_FONT_CHECK_COMPRESSION
26401395c31Smrg])
26592bb16f8Smrg
26601395c31Smrg# XORG_FONT_CHECK_COMPRESSION()
26701395c31Smrg# -----------------------------
26801395c31Smrg# Minimum version: 1.1.0
2698255a313Smrg#
27001395c31Smrg# Offer a --with-compression flag to control what compression method is
27101395c31Smrg# used for pcf font files.   Offers all the methods currently supported
27201395c31Smrg# by libXfont, including no compression.
2738255a313Smrg
27401395c31SmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
27501395c31Smrg	AC_MSG_CHECKING([font compression method])
27601395c31Smrg	AC_ARG_WITH(compression,
27701395c31Smrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
27801395c31Smrg			 [compression method to use on pcf fonts])],
27901395c31Smrg         [compression="$withval"], [compression="yes"])
28001395c31Smrg	if test x"$compression" = "xyes" ; then
28101395c31Smrg		compression="gzip"
28201395c31Smrg	fi
28301395c31Smrg	AC_MSG_RESULT([${compression}])
28401395c31Smrg	case ${compression} in
28501395c31Smrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
28601395c31Smrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;;
28701395c31Smrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
28801395c31Smrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
28901395c31Smrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
29001395c31Smrg	esac
29101395c31Smrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
29201395c31Smrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
29301395c31Smrg	fi
29401395c31Smrg	AC_SUBST([COMPRESS_SUFFIX])
29501395c31Smrg])
2968255a313Smrg
29701395c31Smrg# XORG_FONT_UCS2ANY()
29801395c31Smrg# -------------------
29901395c31Smrg# Minimum version: 1.1.0
30001395c31Smrg#
30101395c31Smrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
30201395c31Smrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
30301395c31Smrg# Also call pkg-config to find the directory with the encoding files needed
30401395c31Smrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
3058255a313Smrg
30601395c31SmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
30701395c31Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
30801395c31Smrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
30901395c31Smrg	PKG_CHECK_MODULES(MAPS, [fontutil])
31001395c31Smrg	AC_MSG_CHECKING([for ucs2any encoding data files])
31101395c31Smrg	MAPFILES_PATH=`$PKG_CONFIG --variable=mapdir fontutil`
31201395c31Smrg	AC_SUBST(MAPFILES_PATH)
31301395c31Smrg	AC_MSG_RESULT([${MAPFILES_PATH}])
31401395c31Smrg])
3158255a313Smrg
3168255a313Smrg
3178255a313Smrg
31801395c31Smrg# XORG_FONT_FC_CONFDIR()
31901395c31Smrg# --------------------
32001395c31Smrg# Minimum version: 1.2.0
32101395c31Smrg#
32201395c31Smrg# Sets FC_CONFDIR to the fontconfig config directory
32301395c31Smrg# (which should be --with-confdir=... when building fontconfig)
32401395c31Smrg# found from:
32501395c31Smrg#	--with-fc-confdir=...
32601395c31Smrg#	pkg-config --variable=confdir fontconfig
32701395c31Smrg#	${sysconfdir}/fonts
3288255a313Smrg
32901395c31SmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
33001395c31Smrg	dnl Ensure $PKG_CONFIG is set first
33101395c31Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
3328255a313Smrg
33301395c31Smrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
33401395c31Smrg	AC_ARG_WITH(fc-confdir,
33501395c31Smrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
33601395c31Smrg			   [Path to fontconfig's configuration directory]),
33701395c31Smrg		    [FC_CONFDIR="$withval"])
33801395c31Smrg	# if --with-fc-confdir was not specified
33901395c31Smrg	if test "x${FC_CONFDIR}" = "x"; then
34001395c31Smrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
34101395c31Smrg	fi
34201395c31Smrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
34301395c31Smrg	if test "x${FC_CONFDIR}" = "x"; then
34401395c31Smrg		FC_CONFDIR="${sysconfdir}/fonts"
34501395c31Smrg	fi
34601395c31Smrg	AC_SUBST(FC_CONFDIR)
34701395c31Smrg	AC_MSG_RESULT([${FC_CONFDIR}])
3488255a313Smrg])
3498255a313Smrg
3508255a313Smrg
3518255a313Smrg
35201395c31Smrg# XORG_FONTROOTDIR()
35301395c31Smrg# --------------------
35401395c31Smrg# Minimum version: 1.1.0
35592bb16f8Smrg#
35601395c31Smrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
35701395c31Smrg# found from:
35801395c31Smrg#	--with-fontrootdir
35901395c31Smrg#	pkg-config --variable=fontrootdir fontutil
36001395c31Smrg#	${datadir}/fonts/X11
3618255a313Smrg
36201395c31SmrgAC_DEFUN([XORG_FONTROOTDIR],[
36301395c31Smrg	dnl Ensure $PKG_CONFIG is set first
36401395c31Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
3658255a313Smrg
36601395c31Smrg	AC_MSG_CHECKING([for root directory for font files])
36701395c31Smrg	AC_ARG_WITH(fontrootdir,
36801395c31Smrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
36901395c31Smrg			   [Path to root directory for font files]),
37001395c31Smrg		    [FONTROOTDIR="$withval"])
37101395c31Smrg	# if --with-fontrootdir not specified...
37201395c31Smrg	if test "x${FONTROOTDIR}" = "x"; then
37301395c31Smrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
37401395c31Smrg	fi
37501395c31Smrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
37601395c31Smrg	if test "x${FONTROOTDIR}" = "x"; then
37701395c31Smrg		FONTROOTDIR="${datadir}/fonts/X11"
37801395c31Smrg	fi
37901395c31Smrg	AC_SUBST(FONTROOTDIR)
38001395c31Smrg	AC_MSG_RESULT([${FONTROOTDIR}])
38101395c31Smrg])
3828255a313Smrg
38301395c31Smrg# XORG_FONTSUBDIR(variable, flag, subdir)
38401395c31Smrg# ---------------------------------------
38501395c31Smrg# Minimum version: 1.1.0
3868255a313Smrg#
38701395c31Smrg# Offer a --with-<flag> flag to control directory for font installation
38801395c31Smrg# Default is the specified <subdir> of the font root directory.
38901395c31Smrg# Sets <variable> to the selected directory
3908255a313Smrg
39101395c31SmrgAC_DEFUN([XORG_FONTSUBDIR],[
39201395c31Smrg	AC_REQUIRE([XORG_FONTROOTDIR])
39301395c31Smrg
39401395c31Smrg	AC_MSG_CHECKING([for directory for $3 files])
39501395c31Smrg	AC_ARG_WITH($2,
39601395c31Smrg		    [AS_HELP_STRING([--with-$2=DIR],
39701395c31Smrg				    [Path to $3 files [FONTROOTDIR/$3]])],
39801395c31Smrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
39901395c31Smrg	AC_SUBST($1)
40001395c31Smrg	AC_MSG_RESULT([${$1}])
40101395c31Smrg]) # XORG_FONTSUBDIR
4028255a313Smrg
40301395c31Smrg# XORG_FONTDIR(subdir)
40401395c31Smrg# --------------------
40501395c31Smrg# Minimum version: 1.1.0
4068255a313Smrg#
40701395c31Smrg# Offer a --with-fontdir flag to control directory for font installation
40801395c31Smrg# Default is the specified subdir of the font root directory.
40901395c31Smrg# Sets FONTDIR to the selected directory
4108255a313Smrg
41101395c31SmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
41292bb16f8Smrg
41301395c31Smrg# pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
41401395c31Smrg# serial 11 (pkg-config-0.29.1)
41592bb16f8Smrg
41601395c31Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
41701395c31Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
41801395c31Smrgdnl
41901395c31Smrgdnl This program is free software; you can redistribute it and/or modify
42001395c31Smrgdnl it under the terms of the GNU General Public License as published by
42101395c31Smrgdnl the Free Software Foundation; either version 2 of the License, or
42201395c31Smrgdnl (at your option) any later version.
42301395c31Smrgdnl
42401395c31Smrgdnl This program is distributed in the hope that it will be useful, but
42501395c31Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
42601395c31Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
42701395c31Smrgdnl General Public License for more details.
42801395c31Smrgdnl
42901395c31Smrgdnl You should have received a copy of the GNU General Public License
43001395c31Smrgdnl along with this program; if not, write to the Free Software
43101395c31Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
43201395c31Smrgdnl 02111-1307, USA.
43301395c31Smrgdnl
43401395c31Smrgdnl As a special exception to the GNU General Public License, if you
43501395c31Smrgdnl distribute this file as part of a program that contains a
43601395c31Smrgdnl configuration script generated by Autoconf, you may include it under
43701395c31Smrgdnl the same distribution terms that you use for the rest of that
43801395c31Smrgdnl program.
43901395c31Smrg
44001395c31Smrgdnl PKG_PREREQ(MIN-VERSION)
44101395c31Smrgdnl -----------------------
44201395c31Smrgdnl Since: 0.29
44301395c31Smrgdnl
44401395c31Smrgdnl Verify that the version of the pkg-config macros are at least
44501395c31Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
44601395c31Smrgdnl installed version of pkg-config, this checks the developer's version
44701395c31Smrgdnl of pkg.m4 when generating configure.
44801395c31Smrgdnl
44901395c31Smrgdnl To ensure that this macro is defined, also add:
45001395c31Smrgdnl m4_ifndef([PKG_PREREQ],
45101395c31Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
45201395c31Smrgdnl
45301395c31Smrgdnl See the "Since" comment for each macro you use to see what version
45401395c31Smrgdnl of the macros you require.
45501395c31Smrgm4_defun([PKG_PREREQ],
45601395c31Smrg[m4_define([PKG_MACROS_VERSION], [0.29.1])
45701395c31Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
45801395c31Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
45901395c31Smrg])dnl PKG_PREREQ
46001395c31Smrg
46101395c31Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
46201395c31Smrgdnl ----------------------------------
46301395c31Smrgdnl Since: 0.16
46401395c31Smrgdnl
46501395c31Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
46601395c31Smrgdnl first found in the path. Checks that the version of pkg-config found
46701395c31Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
46801395c31Smrgdnl used since that's the first version where most current features of
46901395c31Smrgdnl pkg-config existed.
47001395c31SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
47101395c31Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
47201395c31Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
47301395c31Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
47401395c31SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
47501395c31SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
47601395c31SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
47792bb16f8Smrg
47801395c31Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
47901395c31Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
48092bb16f8Smrgfi
48101395c31Smrgif test -n "$PKG_CONFIG"; then
48201395c31Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
48301395c31Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
48401395c31Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
48501395c31Smrg		AC_MSG_RESULT([yes])
48601395c31Smrg	else
48701395c31Smrg		AC_MSG_RESULT([no])
48801395c31Smrg		PKG_CONFIG=""
48901395c31Smrg	fi
49001395c31Smrgfi[]dnl
49101395c31Smrg])dnl PKG_PROG_PKG_CONFIG
49292bb16f8Smrg
49301395c31Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
49401395c31Smrgdnl -------------------------------------------------------------------
49501395c31Smrgdnl Since: 0.18
49601395c31Smrgdnl
49701395c31Smrgdnl Check to see whether a particular set of modules exists. Similar to
49801395c31Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
49901395c31Smrgdnl
50001395c31Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
50101395c31Smrgdnl only at the first occurence in configure.ac, so if the first place
50201395c31Smrgdnl it's called might be skipped (such as if it is within an "if", you
50301395c31Smrgdnl have to call PKG_CHECK_EXISTS manually
50401395c31SmrgAC_DEFUN([PKG_CHECK_EXISTS],
50501395c31Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
50601395c31Smrgif test -n "$PKG_CONFIG" && \
50701395c31Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
50801395c31Smrg  m4_default([$2], [:])
50901395c31Smrgm4_ifvaln([$3], [else
51001395c31Smrg  $3])dnl
51101395c31Smrgfi])
51292bb16f8Smrg
51301395c31Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
51401395c31Smrgdnl ---------------------------------------------
51501395c31Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
51601395c31Smrgdnl pkg_failed based on the result.
51701395c31Smrgm4_define([_PKG_CONFIG],
51801395c31Smrg[if test -n "$$1"; then
51901395c31Smrg    pkg_cv_[]$1="$$1"
52001395c31Smrg elif test -n "$PKG_CONFIG"; then
52101395c31Smrg    PKG_CHECK_EXISTS([$3],
52201395c31Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
52301395c31Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
52401395c31Smrg		     [pkg_failed=yes])
52501395c31Smrg else
52601395c31Smrg    pkg_failed=untried
52701395c31Smrgfi[]dnl
52801395c31Smrg])dnl _PKG_CONFIG
52992bb16f8Smrg
53001395c31Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
53101395c31Smrgdnl ---------------------------
53201395c31Smrgdnl Internal check to see if pkg-config supports short errors.
53301395c31SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
53401395c31Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
53501395c31Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
53601395c31Smrg        _pkg_short_errors_supported=yes
53701395c31Smrgelse
53801395c31Smrg        _pkg_short_errors_supported=no
53901395c31Smrgfi[]dnl
54001395c31Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
54192bb16f8Smrg
5428255a313Smrg
54301395c31Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
54401395c31Smrgdnl   [ACTION-IF-NOT-FOUND])
54501395c31Smrgdnl --------------------------------------------------------------
54601395c31Smrgdnl Since: 0.4.0
54701395c31Smrgdnl
54801395c31Smrgdnl Note that if there is a possibility the first call to
54901395c31Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
55001395c31Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
55101395c31SmrgAC_DEFUN([PKG_CHECK_MODULES],
55201395c31Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
55301395c31SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
55401395c31SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
55592bb16f8Smrg
55601395c31Smrgpkg_failed=no
55701395c31SmrgAC_MSG_CHECKING([for $1])
55892bb16f8Smrg
55901395c31Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
56001395c31Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
56192bb16f8Smrg
56201395c31Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
56301395c31Smrgand $1[]_LIBS to avoid the need to call pkg-config.
56401395c31SmrgSee the pkg-config man page for more details.])
56592bb16f8Smrg
56601395c31Smrgif test $pkg_failed = yes; then
56701395c31Smrg   	AC_MSG_RESULT([no])
56801395c31Smrg        _PKG_SHORT_ERRORS_SUPPORTED
56901395c31Smrg        if test $_pkg_short_errors_supported = yes; then
57001395c31Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
57101395c31Smrg        else 
57201395c31Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
57301395c31Smrg        fi
57401395c31Smrg	# Put the nasty error message in config.log where it belongs
57501395c31Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
57692bb16f8Smrg
57701395c31Smrg	m4_default([$4], [AC_MSG_ERROR(
57801395c31Smrg[Package requirements ($2) were not met:
57992bb16f8Smrg
58001395c31Smrg$$1_PKG_ERRORS
58192bb16f8Smrg
58201395c31SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
58301395c31Smrginstalled software in a non-standard prefix.
584de7ed6e8Smrg
58501395c31Smrg_PKG_TEXT])[]dnl
58601395c31Smrg        ])
58701395c31Smrgelif test $pkg_failed = untried; then
58801395c31Smrg     	AC_MSG_RESULT([no])
58901395c31Smrg	m4_default([$4], [AC_MSG_FAILURE(
59001395c31Smrg[The pkg-config script could not be found or is too old.  Make sure it
59101395c31Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
59201395c31Smrgpath to pkg-config.
593de7ed6e8Smrg
59401395c31Smrg_PKG_TEXT
595de7ed6e8Smrg
59601395c31SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
59701395c31Smrg        ])
59801395c31Smrgelse
59901395c31Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
60001395c31Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
60101395c31Smrg        AC_MSG_RESULT([yes])
60201395c31Smrg	$3
60301395c31Smrgfi[]dnl
60401395c31Smrg])dnl PKG_CHECK_MODULES
605de7ed6e8Smrg
606de7ed6e8Smrg
60701395c31Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
60801395c31Smrgdnl   [ACTION-IF-NOT-FOUND])
60901395c31Smrgdnl ---------------------------------------------------------------------
61001395c31Smrgdnl Since: 0.29
61101395c31Smrgdnl
61201395c31Smrgdnl Checks for existence of MODULES and gathers its build flags with
61301395c31Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
61401395c31Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
61501395c31Smrgdnl
61601395c31Smrgdnl Note that if there is a possibility the first call to
61701395c31Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
61801395c31Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
61901395c31Smrgdnl configure.ac.
62001395c31SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
62101395c31Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
62201395c31Smrg_save_PKG_CONFIG=$PKG_CONFIG
62301395c31SmrgPKG_CONFIG="$PKG_CONFIG --static"
62401395c31SmrgPKG_CHECK_MODULES($@)
62501395c31SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
62601395c31Smrg])dnl PKG_CHECK_MODULES_STATIC
6278255a313Smrg
6288255a313Smrg
62901395c31Smrgdnl PKG_INSTALLDIR([DIRECTORY])
63001395c31Smrgdnl -------------------------
63101395c31Smrgdnl Since: 0.27
63201395c31Smrgdnl
63301395c31Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
63401395c31Smrgdnl should install pkg-config .pc files. By default the directory is
63501395c31Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
63601395c31Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
63701395c31Smrgdnl parameter.
63801395c31SmrgAC_DEFUN([PKG_INSTALLDIR],
63901395c31Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
64001395c31Smrgm4_pushdef([pkg_description],
64101395c31Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
64201395c31SmrgAC_ARG_WITH([pkgconfigdir],
64301395c31Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
64401395c31Smrg    [with_pkgconfigdir=]pkg_default)
64501395c31SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
64601395c31Smrgm4_popdef([pkg_default])
64701395c31Smrgm4_popdef([pkg_description])
64801395c31Smrg])dnl PKG_INSTALLDIR
64901395c31Smrg
65001395c31Smrg
65101395c31Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
65201395c31Smrgdnl --------------------------------
65301395c31Smrgdnl Since: 0.27
65401395c31Smrgdnl
65501395c31Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
65601395c31Smrgdnl module should install arch-independent pkg-config .pc files. By
65701395c31Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
65801395c31Smrgdnl changed by passing DIRECTORY. The user can override through the
65901395c31Smrgdnl --with-noarch-pkgconfigdir parameter.
66001395c31SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
66101395c31Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
66201395c31Smrgm4_pushdef([pkg_description],
66301395c31Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
66401395c31SmrgAC_ARG_WITH([noarch-pkgconfigdir],
66501395c31Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
66601395c31Smrg    [with_noarch_pkgconfigdir=]pkg_default)
66701395c31SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
66801395c31Smrgm4_popdef([pkg_default])
66901395c31Smrgm4_popdef([pkg_description])
67001395c31Smrg])dnl PKG_NOARCH_INSTALLDIR
67101395c31Smrg
67201395c31Smrg
67301395c31Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
67401395c31Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
67501395c31Smrgdnl -------------------------------------------
67601395c31Smrgdnl Since: 0.28
67701395c31Smrgdnl
67801395c31Smrgdnl Retrieves the value of the pkg-config variable for the given module.
67901395c31SmrgAC_DEFUN([PKG_CHECK_VAR],
68001395c31Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
68101395c31SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
6828255a313Smrg
68301395c31Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
68401395c31SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
6858255a313Smrg
68601395c31SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
68701395c31Smrg])dnl PKG_CHECK_VAR
68892bb16f8Smrg
68901395c31Smrgdnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
69001395c31Smrgdnl   [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
69101395c31Smrgdnl   [DESCRIPTION], [DEFAULT])
69201395c31Smrgdnl ------------------------------------------
69301395c31Smrgdnl
69401395c31Smrgdnl Prepare a "--with-" configure option using the lowercase
69501395c31Smrgdnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
69601395c31Smrgdnl PKG_CHECK_MODULES in a single macro.
69701395c31SmrgAC_DEFUN([PKG_WITH_MODULES],
69801395c31Smrg[
69901395c31Smrgm4_pushdef([with_arg], m4_tolower([$1]))
70001395c31Smrg
70101395c31Smrgm4_pushdef([description],
70201395c31Smrg           [m4_default([$5], [build with ]with_arg[ support])])
70301395c31Smrg
70401395c31Smrgm4_pushdef([def_arg], [m4_default([$6], [auto])])
70501395c31Smrgm4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
70601395c31Smrgm4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
70701395c31Smrg
70801395c31Smrgm4_case(def_arg,
70901395c31Smrg            [yes],[m4_pushdef([with_without], [--without-]with_arg)],
71001395c31Smrg            [m4_pushdef([with_without],[--with-]with_arg)])
71101395c31Smrg
71201395c31SmrgAC_ARG_WITH(with_arg,
71301395c31Smrg     AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
71401395c31Smrg    [AS_TR_SH([with_]with_arg)=def_arg])
71501395c31Smrg
71601395c31SmrgAS_CASE([$AS_TR_SH([with_]with_arg)],
71701395c31Smrg            [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
71801395c31Smrg            [auto],[PKG_CHECK_MODULES([$1],[$2],
71901395c31Smrg                                        [m4_n([def_action_if_found]) $3],
72001395c31Smrg                                        [m4_n([def_action_if_not_found]) $4])])
72101395c31Smrg
72201395c31Smrgm4_popdef([with_arg])
72301395c31Smrgm4_popdef([description])
72401395c31Smrgm4_popdef([def_arg])
72501395c31Smrg
72601395c31Smrg])dnl PKG_WITH_MODULES
72701395c31Smrg
72801395c31Smrgdnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
72901395c31Smrgdnl   [DESCRIPTION], [DEFAULT])
73001395c31Smrgdnl -----------------------------------------------
73101395c31Smrgdnl
73201395c31Smrgdnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
73301395c31Smrgdnl check._[VARIABLE-PREFIX] is exported as make variable.
73401395c31SmrgAC_DEFUN([PKG_HAVE_WITH_MODULES],
73501395c31Smrg[
73601395c31SmrgPKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
73701395c31Smrg
73801395c31SmrgAM_CONDITIONAL([HAVE_][$1],
73901395c31Smrg               [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
74001395c31Smrg])dnl PKG_HAVE_WITH_MODULES
74101395c31Smrg
74201395c31Smrgdnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
74301395c31Smrgdnl   [DESCRIPTION], [DEFAULT])
74401395c31Smrgdnl ------------------------------------------------------
74501395c31Smrgdnl
74601395c31Smrgdnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
74701395c31Smrgdnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
74801395c31Smrgdnl and preprocessor variable.
74901395c31SmrgAC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
75001395c31Smrg[
75101395c31SmrgPKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
75292bb16f8Smrg
75301395c31SmrgAS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
75401395c31Smrg        [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
75501395c31Smrg])dnl PKG_HAVE_DEFINE_WITH_MODULES
75692bb16f8Smrg
75701395c31Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
75801395c31Smrgdnl
75901395c31Smrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
76001395c31Smrgdnl
76101395c31Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
76201395c31Smrgdnl copy of this software and associated documentation files (the "Software"),
76301395c31Smrgdnl to deal in the Software without restriction, including without limitation
76401395c31Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
76501395c31Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
76601395c31Smrgdnl Software is furnished to do so, subject to the following conditions:
76701395c31Smrgdnl
76801395c31Smrgdnl The above copyright notice and this permission notice (including the next
76901395c31Smrgdnl paragraph) shall be included in all copies or substantial portions of the
77001395c31Smrgdnl Software.
77101395c31Smrgdnl
77201395c31Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
77301395c31Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
77401395c31Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
77501395c31Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
77601395c31Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
77701395c31Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
77801395c31Smrgdnl DEALINGS IN THE SOFTWARE.
77992bb16f8Smrg
78001395c31Smrg# XORG_MACROS_VERSION(required-version)
78101395c31Smrg# -------------------------------------
78201395c31Smrg# Minimum version: 1.1.0
78301395c31Smrg#
78401395c31Smrg# If you're using a macro added in Version 1.1 or newer, include this in
78501395c31Smrg# your configure.ac with the minimum required version, such as:
78601395c31Smrg# XORG_MACROS_VERSION(1.1)
78701395c31Smrg#
78801395c31Smrg# To ensure that this macro is defined, also add:
78901395c31Smrg# m4_ifndef([XORG_MACROS_VERSION],
79001395c31Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
79101395c31Smrg#
79201395c31Smrg#
79301395c31Smrg# See the "minimum version" comment for each macro you use to see what
79401395c31Smrg# version you require.
79501395c31Smrgm4_defun([XORG_MACROS_VERSION],[
79601395c31Smrgm4_define([vers_have], [1.19.2])
79701395c31Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
79801395c31Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
79901395c31Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
80001395c31Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
80101395c31Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
80201395c31Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
80301395c31Smrgm4_undefine([vers_have])
80401395c31Smrgm4_undefine([maj_have])
80501395c31Smrgm4_undefine([maj_needed])
80601395c31Smrg]) # XORG_MACROS_VERSION
80792bb16f8Smrg
80801395c31Smrg# XORG_PROG_RAWCPP()
80992bb16f8Smrg# ------------------
81001395c31Smrg# Minimum version: 1.0.0
81101395c31Smrg#
81201395c31Smrg# Find cpp program and necessary flags for use in pre-processing text files
81301395c31Smrg# such as man pages and config files
81401395c31SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
81501395c31SmrgAC_REQUIRE([AC_PROG_CPP])
81601395c31SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
81701395c31Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
81801395c31Smrg
81901395c31Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
82001395c31Smrg# which is not the best choice for supporting other OS'es, but covers most
82101395c31Smrg# of the ones we need for now.
82201395c31SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
82301395c31SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
82401395c31Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
82501395c31Smrg	AC_MSG_RESULT([no])
82601395c31Smrgelse
82701395c31Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
82801395c31Smrg		RAWCPPFLAGS=-undef
82901395c31Smrg		AC_MSG_RESULT([yes])
83001395c31Smrg	# under Cygwin unix is still defined even with -undef
83101395c31Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
83201395c31Smrg		RAWCPPFLAGS="-undef -ansi"
83301395c31Smrg		AC_MSG_RESULT([yes, with -ansi])
83401395c31Smrg	else
83501395c31Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
83601395c31Smrg	fi
8378255a313Smrgfi
83801395c31Smrgrm -f conftest.$ac_ext
83901395c31Smrg
84001395c31SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
84101395c31SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
84201395c31Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
84301395c31Smrg	AC_MSG_RESULT([no])
84492bb16f8Smrgelse
84501395c31Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
84601395c31Smrg		TRADITIONALCPPFLAGS="-traditional"
84701395c31Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
84801395c31Smrg		AC_MSG_RESULT([yes])
84901395c31Smrg	else
85001395c31Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
85101395c31Smrg	fi
85292bb16f8Smrgfi
85301395c31Smrgrm -f conftest.$ac_ext
85401395c31SmrgAC_SUBST(RAWCPPFLAGS)
85501395c31SmrgAC_SUBST(TRADITIONALCPPFLAGS)
85601395c31Smrg]) # XORG_PROG_RAWCPP
85792bb16f8Smrg
85801395c31Smrg# XORG_MANPAGE_SECTIONS()
85901395c31Smrg# -----------------------
86001395c31Smrg# Minimum version: 1.0.0
86192bb16f8Smrg#
86201395c31Smrg# Determine which sections man pages go in for the different man page types
86301395c31Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
86401395c31Smrg# Not sure if there's any better way than just hardcoding by OS name.
86501395c31Smrg# Override default settings by setting environment variables
86601395c31Smrg# Added MAN_SUBSTS in version 1.8
86701395c31Smrg# Added AC_PROG_SED in version 1.8
86892bb16f8Smrg
86901395c31SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
87001395c31SmrgAC_REQUIRE([AC_CANONICAL_HOST])
87101395c31SmrgAC_REQUIRE([AC_PROG_SED])
87201395c31Smrg
87301395c31Smrgcase $host_os in
87401395c31Smrg    solaris*)
87501395c31Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
87601395c31Smrg        # check for a man page file found in later versions that use
87701395c31Smrg        # traditional section numbers instead
87801395c31Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
87901395c31Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
88001395c31Smrg        ;;
88101395c31Smrg    *) SYSV_MAN_SECTIONS=false ;;
8828255a313Smrgesac
88392bb16f8Smrg
88401395c31Smrgif test x$APP_MAN_SUFFIX = x    ; then
88501395c31Smrg    APP_MAN_SUFFIX=1
88601395c31Smrgfi
88701395c31Smrgif test x$APP_MAN_DIR = x    ; then
88801395c31Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
88901395c31Smrgfi
89092bb16f8Smrg
89101395c31Smrgif test x$LIB_MAN_SUFFIX = x    ; then
89201395c31Smrg    LIB_MAN_SUFFIX=3
89301395c31Smrgfi
89401395c31Smrgif test x$LIB_MAN_DIR = x    ; then
89501395c31Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
89601395c31Smrgfi
89792bb16f8Smrg
89801395c31Smrgif test x$FILE_MAN_SUFFIX = x    ; then
89901395c31Smrg    case $SYSV_MAN_SECTIONS in
90001395c31Smrg	true)				FILE_MAN_SUFFIX=4  ;;
90101395c31Smrg	*)				FILE_MAN_SUFFIX=5  ;;
90201395c31Smrg    esac
90301395c31Smrgfi
90401395c31Smrgif test x$FILE_MAN_DIR = x    ; then
90501395c31Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
90601395c31Smrgfi
90792bb16f8Smrg
90801395c31Smrgif test x$MISC_MAN_SUFFIX = x    ; then
90901395c31Smrg    case $SYSV_MAN_SECTIONS in
91001395c31Smrg	true)				MISC_MAN_SUFFIX=5  ;;
91101395c31Smrg	*)				MISC_MAN_SUFFIX=7  ;;
91201395c31Smrg    esac
91301395c31Smrgfi
91401395c31Smrgif test x$MISC_MAN_DIR = x    ; then
91501395c31Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
91601395c31Smrgfi
91792bb16f8Smrg
91801395c31Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
91901395c31Smrg    case $SYSV_MAN_SECTIONS in
92001395c31Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
92101395c31Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
92201395c31Smrg    esac
92301395c31Smrgfi
92401395c31Smrgif test x$DRIVER_MAN_DIR = x    ; then
92501395c31Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
92601395c31Smrgfi
92792bb16f8Smrg
92801395c31Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
92901395c31Smrg    case $SYSV_MAN_SECTIONS in
93001395c31Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
93101395c31Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
93201395c31Smrg    esac
93301395c31Smrgfi
93401395c31Smrgif test x$ADMIN_MAN_DIR = x    ; then
93501395c31Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
93601395c31Smrgfi
93792bb16f8Smrg
93892bb16f8Smrg
93901395c31SmrgAC_SUBST([APP_MAN_SUFFIX])
94001395c31SmrgAC_SUBST([LIB_MAN_SUFFIX])
94101395c31SmrgAC_SUBST([FILE_MAN_SUFFIX])
94201395c31SmrgAC_SUBST([MISC_MAN_SUFFIX])
94301395c31SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
94401395c31SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
94501395c31SmrgAC_SUBST([APP_MAN_DIR])
94601395c31SmrgAC_SUBST([LIB_MAN_DIR])
94701395c31SmrgAC_SUBST([FILE_MAN_DIR])
94801395c31SmrgAC_SUBST([MISC_MAN_DIR])
94901395c31SmrgAC_SUBST([DRIVER_MAN_DIR])
95001395c31SmrgAC_SUBST([ADMIN_MAN_DIR])
95192bb16f8Smrg
95201395c31SmrgXORG_MAN_PAGE="X Version 11"
95301395c31SmrgAC_SUBST([XORG_MAN_PAGE])
95401395c31SmrgMAN_SUBSTS="\
95501395c31Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
95601395c31Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
95701395c31Smrg	-e 's|__xservername__|Xorg|g' \
95801395c31Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
95901395c31Smrg	-e 's|__projectroot__|\$(prefix)|g' \
96001395c31Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
96101395c31Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
96201395c31Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
96301395c31Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
96401395c31Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
96501395c31Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
96601395c31Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
96701395c31SmrgAC_SUBST([MAN_SUBSTS])
96892bb16f8Smrg
96901395c31Smrg]) # XORG_MANPAGE_SECTIONS
9708255a313Smrg
97101395c31Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
97201395c31Smrg# ------------------------
97301395c31Smrg# Minimum version: 1.7.0
97401395c31Smrg#
97501395c31Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
97601395c31Smrg# provided by xorg-sgml-doctools, if installed.
97701395c31SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
97801395c31SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
97901395c31SmrgXORG_SGML_PATH=
98001395c31SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
98101395c31Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
98201395c31Smrg    [m4_ifval([$1],[:],
98301395c31Smrg        [if test x"$cross_compiling" != x"yes" ; then
98401395c31Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
98501395c31Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
98601395c31Smrg         fi])
98701395c31Smrg    ])
98892bb16f8Smrg
98901395c31Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
99001395c31Smrg# the path and the name of the doc stylesheet
99101395c31Smrgif test "x$XORG_SGML_PATH" != "x" ; then
99201395c31Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
99301395c31Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
99401395c31Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
99592bb16f8Smrgelse
99601395c31Smrg   AC_MSG_RESULT([no])
99792bb16f8Smrgfi
99892bb16f8Smrg
99901395c31SmrgAC_SUBST(XORG_SGML_PATH)
100001395c31SmrgAC_SUBST(STYLESHEET_SRCDIR)
100101395c31SmrgAC_SUBST(XSL_STYLESHEET)
100201395c31SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
100301395c31Smrg]) # XORG_CHECK_SGML_DOCTOOLS
10048255a313Smrg
100501395c31Smrg# XORG_CHECK_LINUXDOC
100601395c31Smrg# -------------------
100701395c31Smrg# Minimum version: 1.0.0
100801395c31Smrg#
100901395c31Smrg# Defines the variable MAKE_TEXT if the necessary tools and
101001395c31Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
101101395c31Smrg# Whether or not the necessary tools and files are found can be checked
101201395c31Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
101301395c31SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
101401395c31SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
101501395c31SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
10168255a313Smrg
101701395c31SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
10188255a313Smrg
101901395c31SmrgAC_MSG_CHECKING([whether to build documentation])
102092bb16f8Smrg
102101395c31Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
102201395c31Smrg   BUILDDOC=yes
102301395c31Smrgelse
102401395c31Smrg   BUILDDOC=no
102592bb16f8Smrgfi
102692bb16f8Smrg
102701395c31SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
10288255a313Smrg
102901395c31SmrgAC_MSG_RESULT([$BUILDDOC])
10308255a313Smrg
103101395c31SmrgAC_MSG_CHECKING([whether to build pdf documentation])
10328255a313Smrg
103301395c31Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
103401395c31Smrg   BUILDPDFDOC=yes
103501395c31Smrgelse
103601395c31Smrg   BUILDPDFDOC=no
103701395c31Smrgfi
10388255a313Smrg
103901395c31SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
104092bb16f8Smrg
104101395c31SmrgAC_MSG_RESULT([$BUILDPDFDOC])
104292bb16f8Smrg
104301395c31SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
104401395c31SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
104501395c31SmrgMAKE_PDF="$PS2PDF"
104601395c31SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
104792bb16f8Smrg
104801395c31SmrgAC_SUBST(MAKE_TEXT)
104901395c31SmrgAC_SUBST(MAKE_PS)
105001395c31SmrgAC_SUBST(MAKE_PDF)
105101395c31SmrgAC_SUBST(MAKE_HTML)
105201395c31Smrg]) # XORG_CHECK_LINUXDOC
105301395c31Smrg
105401395c31Smrg# XORG_CHECK_DOCBOOK
105501395c31Smrg# -------------------
105601395c31Smrg# Minimum version: 1.0.0
105792bb16f8Smrg#
105801395c31Smrg# Checks for the ability to build output formats from SGML DocBook source.
105901395c31Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
106001395c31Smrg# indicates whether the necessary tools and files are found and, if set,
106101395c31Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
106201395c31SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
106301395c31SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
106492bb16f8Smrg
106501395c31SmrgBUILDTXTDOC=no
106601395c31SmrgBUILDPDFDOC=no
106701395c31SmrgBUILDPSDOC=no
106801395c31SmrgBUILDHTMLDOC=no
106992bb16f8Smrg
107001395c31SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
107101395c31SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
107201395c31SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
107301395c31SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
107492bb16f8Smrg
107501395c31SmrgAC_MSG_CHECKING([whether to build text documentation])
107601395c31Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
107701395c31Smrg   test x$BUILD_TXTDOC != xno; then
107801395c31Smrg	BUILDTXTDOC=yes
107901395c31Smrgfi
108001395c31SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
108101395c31SmrgAC_MSG_RESULT([$BUILDTXTDOC])
108292bb16f8Smrg
108301395c31SmrgAC_MSG_CHECKING([whether to build PDF documentation])
108401395c31Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
108501395c31Smrg   test x$BUILD_PDFDOC != xno; then
108601395c31Smrg	BUILDPDFDOC=yes
108701395c31Smrgfi
108801395c31SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
108901395c31SmrgAC_MSG_RESULT([$BUILDPDFDOC])
10908255a313Smrg
109101395c31SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
109201395c31Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
109301395c31Smrg   test x$BUILD_PSDOC != xno; then
109401395c31Smrg	BUILDPSDOC=yes
109501395c31Smrgfi
109601395c31SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
109701395c31SmrgAC_MSG_RESULT([$BUILDPSDOC])
109801395c31Smrg
109901395c31SmrgAC_MSG_CHECKING([whether to build HTML documentation])
110001395c31Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
110101395c31Smrg   test x$BUILD_HTMLDOC != xno; then
110201395c31Smrg	BUILDHTMLDOC=yes
110301395c31Smrgfi
110401395c31SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
110501395c31SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
110601395c31Smrg
110701395c31SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
110801395c31SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
110901395c31SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
111001395c31SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
111101395c31Smrg
111201395c31SmrgAC_SUBST(MAKE_TEXT)
111301395c31SmrgAC_SUBST(MAKE_PS)
111401395c31SmrgAC_SUBST(MAKE_PDF)
111501395c31SmrgAC_SUBST(MAKE_HTML)
111601395c31Smrg]) # XORG_CHECK_DOCBOOK
111701395c31Smrg
111801395c31Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
111901395c31Smrg# ----------------
112001395c31Smrg# Minimum version: 1.5.0
112101395c31Smrg# Minimum version for optional DEFAULT argument: 1.11.0
11228255a313Smrg#
112301395c31Smrg# Documentation tools are not always available on all platforms and sometimes
112401395c31Smrg# not at the appropriate level. This macro enables a module to test for the
112501395c31Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
112601395c31Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
112701395c31Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
112801395c31Smrg# --with-xmlto assumes 'auto'.
11298255a313Smrg#
113001395c31Smrg# Interface to module:
113101395c31Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
113201395c31Smrg# XMLTO:	returns the path of the xmlto program found
113301395c31Smrg#		returns the path set by the user in the environment
113401395c31Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
113501395c31Smrg#		'no' user instructs the module not to use xmlto
11368255a313Smrg#
113701395c31Smrg# Added in version 1.10.0
113801395c31Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
113901395c31Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
11408255a313Smrg#
114101395c31Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
114201395c31Smrg#
114301395c31SmrgAC_DEFUN([XORG_WITH_XMLTO],[
114401395c31SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
114501395c31Smrgm4_define([_defopt], m4_default([$2], [auto]))
114601395c31SmrgAC_ARG_WITH(xmlto,
114701395c31Smrg	AS_HELP_STRING([--with-xmlto],
114801395c31Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
114901395c31Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
115001395c31Smrgm4_undefine([_defopt])
11518255a313Smrg
115201395c31Smrgif test "x$use_xmlto" = x"auto"; then
115301395c31Smrg   AC_PATH_PROG([XMLTO], [xmlto])
115401395c31Smrg   if test "x$XMLTO" = "x"; then
115501395c31Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
115601395c31Smrg	have_xmlto=no
115701395c31Smrg   else
115801395c31Smrg        have_xmlto=yes
115901395c31Smrg   fi
116001395c31Smrgelif test "x$use_xmlto" = x"yes" ; then
116101395c31Smrg   AC_PATH_PROG([XMLTO], [xmlto])
116201395c31Smrg   if test "x$XMLTO" = "x"; then
116301395c31Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
116401395c31Smrg   fi
116501395c31Smrg   have_xmlto=yes
116601395c31Smrgelif test "x$use_xmlto" = x"no" ; then
116701395c31Smrg   if test "x$XMLTO" != "x"; then
116801395c31Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
116901395c31Smrg   fi
117001395c31Smrg   have_xmlto=no
117101395c31Smrgelse
117201395c31Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
117301395c31Smrgfi
11748255a313Smrg
117501395c31Smrg# Test for a minimum version of xmlto, if provided.
117601395c31Smrgm4_ifval([$1],
117701395c31Smrg[if test "$have_xmlto" = yes; then
117801395c31Smrg    # scrape the xmlto version
117901395c31Smrg    AC_MSG_CHECKING([the xmlto version])
118001395c31Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
118101395c31Smrg    AC_MSG_RESULT([$xmlto_version])
118201395c31Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
118301395c31Smrg        [if test "x$use_xmlto" = xauto; then
118401395c31Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
118501395c31Smrg            have_xmlto=no
118601395c31Smrg        else
118701395c31Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
118801395c31Smrg        fi])
118901395c31Smrgfi])
11908255a313Smrg
119101395c31Smrg# Test for the ability of xmlto to generate a text target
119201395c31Smrg#
119301395c31Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
119401395c31Smrg# following test for empty XML docbook files.
119501395c31Smrg# For compatibility reasons use the following empty XML docbook file and if
119601395c31Smrg# it fails try it again with a non-empty XML file.
119701395c31Smrghave_xmlto_text=no
119801395c31Smrgcat > conftest.xml << "EOF"
119901395c31SmrgEOF
120001395c31SmrgAS_IF([test "$have_xmlto" = yes],
120101395c31Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
120201395c31Smrg             [have_xmlto_text=yes],
120301395c31Smrg             [# Try it again with a non-empty XML file.
120401395c31Smrg              cat > conftest.xml << "EOF"
120501395c31Smrg<x></x>
120601395c31SmrgEOF
120701395c31Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
120801395c31Smrg                    [have_xmlto_text=yes],
120901395c31Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
121001395c31Smrgrm -f conftest.xml
121101395c31SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
121201395c31SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
121301395c31Smrg]) # XORG_WITH_XMLTO
12148255a313Smrg
121501395c31Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
121601395c31Smrg# --------------------------------------------
121701395c31Smrg# Minimum version: 1.12.0
121801395c31Smrg# Minimum version for optional DEFAULT argument: 1.12.0
12198255a313Smrg#
122001395c31Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
122101395c31Smrg# XML-based language used for the transformation of XML documents.
122201395c31Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
122301395c31Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
122401395c31Smrg# The XSLT processor is often used as a standalone tool for transformations.
122501395c31Smrg# It should not be assumed that this tool is used only to work with documnetation.
122601395c31Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
122701395c31Smrg#
122801395c31Smrg# Interface to module:
122901395c31Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
123001395c31Smrg# XSLTPROC:	 returns the path of the xsltproc program found
123101395c31Smrg#		 returns the path set by the user in the environment
123201395c31Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
123301395c31Smrg#		  'no' user instructs the module not to use xsltproc
123401395c31Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
12358255a313Smrg#
123601395c31Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
123701395c31Smrg#
123801395c31SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
123901395c31SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
124001395c31Smrg# Preserves the interface, should it be implemented later
124101395c31Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
124201395c31Smrgm4_define([_defopt], m4_default([$2], [auto]))
124301395c31SmrgAC_ARG_WITH(xsltproc,
124401395c31Smrg	AS_HELP_STRING([--with-xsltproc],
124501395c31Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
124601395c31Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
124701395c31Smrgm4_undefine([_defopt])
12488255a313Smrg
124901395c31Smrgif test "x$use_xsltproc" = x"auto"; then
125001395c31Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
125101395c31Smrg   if test "x$XSLTPROC" = "x"; then
125201395c31Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
125301395c31Smrg	have_xsltproc=no
125401395c31Smrg   else
125501395c31Smrg        have_xsltproc=yes
125601395c31Smrg   fi
125701395c31Smrgelif test "x$use_xsltproc" = x"yes" ; then
125801395c31Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
125901395c31Smrg   if test "x$XSLTPROC" = "x"; then
126001395c31Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
126101395c31Smrg   fi
126201395c31Smrg   have_xsltproc=yes
126301395c31Smrgelif test "x$use_xsltproc" = x"no" ; then
126401395c31Smrg   if test "x$XSLTPROC" != "x"; then
126501395c31Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
126601395c31Smrg   fi
126701395c31Smrg   have_xsltproc=no
126801395c31Smrgelse
126901395c31Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
127001395c31Smrgfi
12718255a313Smrg
127201395c31SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
127301395c31Smrg]) # XORG_WITH_XSLTPROC
12748255a313Smrg
127501395c31Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
127601395c31Smrg# ----------------------------------------
127701395c31Smrg# Minimum version: 1.15.0
12788255a313Smrg#
127901395c31Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
128001395c31Smrg# scanning arbitrary text files, extracting information from those text files,
128101395c31Smrg# and printing reports based on that information.
12828255a313Smrg#
128301395c31Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
12848255a313Smrg#
128501395c31Smrg# Interface to module:
128601395c31Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
128701395c31Smrg# PERL:	     returns the path of the perl program found
128801395c31Smrg#	     returns the path set by the user in the environment
128901395c31Smrg# --with-perl: 'yes' user instructs the module to use perl
129001395c31Smrg#	       'no' user instructs the module not to use perl
129101395c31Smrg# have_perl: returns yes if perl found in PATH or no
129201395c31Smrg#
129301395c31Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
129401395c31Smrg#
129501395c31SmrgAC_DEFUN([XORG_WITH_PERL],[
129601395c31SmrgAC_ARG_VAR([PERL], [Path to perl command])
129701395c31Smrg# Preserves the interface, should it be implemented later
129801395c31Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
129901395c31Smrgm4_define([_defopt], m4_default([$2], [auto]))
130001395c31SmrgAC_ARG_WITH(perl,
130101395c31Smrg	AS_HELP_STRING([--with-perl],
130201395c31Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
130301395c31Smrg	   [use_perl=$withval], [use_perl=]_defopt)
130401395c31Smrgm4_undefine([_defopt])
13058255a313Smrg
130601395c31Smrgif test "x$use_perl" = x"auto"; then
130701395c31Smrg   AC_PATH_PROG([PERL], [perl])
130801395c31Smrg   if test "x$PERL" = "x"; then
130901395c31Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
131001395c31Smrg	have_perl=no
131101395c31Smrg   else
131201395c31Smrg        have_perl=yes
131301395c31Smrg   fi
131401395c31Smrgelif test "x$use_perl" = x"yes" ; then
131501395c31Smrg   AC_PATH_PROG([PERL], [perl])
131601395c31Smrg   if test "x$PERL" = "x"; then
131701395c31Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
131801395c31Smrg   fi
131901395c31Smrg   have_perl=yes
132001395c31Smrgelif test "x$use_perl" = x"no" ; then
132101395c31Smrg   if test "x$PERL" != "x"; then
132201395c31Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
132301395c31Smrg   fi
132401395c31Smrg   have_perl=no
132501395c31Smrgelse
132601395c31Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
132701395c31Smrgfi
13288255a313Smrg
132901395c31SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
133001395c31Smrg]) # XORG_WITH_PERL
13318255a313Smrg
133201395c31Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
133301395c31Smrg# ----------------
133401395c31Smrg# Minimum version: 1.5.0
133501395c31Smrg# Minimum version for optional DEFAULT argument: 1.11.0
13368255a313Smrg#
133701395c31Smrg# Documentation tools are not always available on all platforms and sometimes
133801395c31Smrg# not at the appropriate level. This macro enables a module to test for the
133901395c31Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
134001395c31Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
134101395c31Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
134201395c31Smrg# --with-asciidoc assumes 'auto'.
13438255a313Smrg#
134401395c31Smrg# Interface to module:
134501395c31Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
134601395c31Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
134701395c31Smrg#		 returns the path set by the user in the environment
134801395c31Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
134901395c31Smrg#		  'no' user instructs the module not to use asciidoc
13508255a313Smrg#
135101395c31Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
13528255a313Smrg#
135301395c31SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
135401395c31SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
135501395c31Smrgm4_define([_defopt], m4_default([$2], [auto]))
135601395c31SmrgAC_ARG_WITH(asciidoc,
135701395c31Smrg	AS_HELP_STRING([--with-asciidoc],
135801395c31Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
135901395c31Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
136001395c31Smrgm4_undefine([_defopt])
13618255a313Smrg
136201395c31Smrgif test "x$use_asciidoc" = x"auto"; then
136301395c31Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
136401395c31Smrg   if test "x$ASCIIDOC" = "x"; then
136501395c31Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
136601395c31Smrg	have_asciidoc=no
136701395c31Smrg   else
136801395c31Smrg        have_asciidoc=yes
136901395c31Smrg   fi
137001395c31Smrgelif test "x$use_asciidoc" = x"yes" ; then
137101395c31Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
137201395c31Smrg   if test "x$ASCIIDOC" = "x"; then
137301395c31Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
137401395c31Smrg   fi
137501395c31Smrg   have_asciidoc=yes
137601395c31Smrgelif test "x$use_asciidoc" = x"no" ; then
137701395c31Smrg   if test "x$ASCIIDOC" != "x"; then
137801395c31Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
137901395c31Smrg   fi
138001395c31Smrg   have_asciidoc=no
138101395c31Smrgelse
138201395c31Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
138301395c31Smrgfi
138401395c31Smrgm4_ifval([$1],
138501395c31Smrg[if test "$have_asciidoc" = yes; then
138601395c31Smrg    # scrape the asciidoc version
138701395c31Smrg    AC_MSG_CHECKING([the asciidoc version])
138801395c31Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
138901395c31Smrg    AC_MSG_RESULT([$asciidoc_version])
139001395c31Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
139101395c31Smrg        [if test "x$use_asciidoc" = xauto; then
139201395c31Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
139301395c31Smrg            have_asciidoc=no
139401395c31Smrg        else
139501395c31Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
139601395c31Smrg        fi])
139701395c31Smrgfi])
139801395c31SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
139901395c31Smrg]) # XORG_WITH_ASCIIDOC
14008255a313Smrg
140101395c31Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
140201395c31Smrg# -------------------------------------------
140301395c31Smrg# Minimum version: 1.5.0
140401395c31Smrg# Minimum version for optional DEFAULT argument: 1.11.0
140501395c31Smrg# Minimum version for optional DOT checking: 1.18.0
1406de7ed6e8Smrg#
140701395c31Smrg# Documentation tools are not always available on all platforms and sometimes
140801395c31Smrg# not at the appropriate level. This macro enables a module to test for the
140901395c31Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
141001395c31Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
141101395c31Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
141201395c31Smrg# --with-doxygen assumes 'auto'.
141301395c31Smrg#
141401395c31Smrg# Interface to module:
141501395c31Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
141601395c31Smrg# DOXYGEN:	 returns the path of the doxygen program found
141701395c31Smrg#		 returns the path set by the user in the environment
141801395c31Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
141901395c31Smrg#		  'no' user instructs the module not to use doxygen
142001395c31Smrg#
142101395c31Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
142201395c31Smrg#
142301395c31SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
142401395c31SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
142501395c31SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
142601395c31Smrgm4_define([_defopt], m4_default([$2], [auto]))
142701395c31SmrgAC_ARG_WITH(doxygen,
142801395c31Smrg	AS_HELP_STRING([--with-doxygen],
142901395c31Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
143001395c31Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
143101395c31Smrgm4_undefine([_defopt])
1432de7ed6e8Smrg
143301395c31Smrgif test "x$use_doxygen" = x"auto"; then
143401395c31Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
143501395c31Smrg   if test "x$DOXYGEN" = "x"; then
143601395c31Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
143701395c31Smrg	have_doxygen=no
143801395c31Smrg   else
143901395c31Smrg        have_doxygen=yes
144001395c31Smrg   fi
144101395c31Smrgelif test "x$use_doxygen" = x"yes" ; then
144201395c31Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
144301395c31Smrg   if test "x$DOXYGEN" = "x"; then
144401395c31Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
144501395c31Smrg   fi
144601395c31Smrg   have_doxygen=yes
144701395c31Smrgelif test "x$use_doxygen" = x"no" ; then
144801395c31Smrg   if test "x$DOXYGEN" != "x"; then
144901395c31Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
145001395c31Smrg   fi
145101395c31Smrg   have_doxygen=no
145201395c31Smrgelse
145301395c31Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
145401395c31Smrgfi
145501395c31Smrgm4_ifval([$1],
145601395c31Smrg[if test "$have_doxygen" = yes; then
145701395c31Smrg    # scrape the doxygen version
145801395c31Smrg    AC_MSG_CHECKING([the doxygen version])
145901395c31Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
146001395c31Smrg    AC_MSG_RESULT([$doxygen_version])
146101395c31Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
146201395c31Smrg        [if test "x$use_doxygen" = xauto; then
146301395c31Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
146401395c31Smrg            have_doxygen=no
146501395c31Smrg        else
146601395c31Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
146701395c31Smrg        fi])
146801395c31Smrgfi])
1469de7ed6e8Smrg
147001395c31Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
147101395c31Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
147201395c31Smrgdnl 	HAVE_DOT = @HAVE_DOT@
147301395c31SmrgHAVE_DOT=no
147401395c31Smrgif test "x$have_doxygen" = "xyes"; then
147501395c31Smrg  AC_PATH_PROG([DOT], [dot])
147601395c31Smrg    if test "x$DOT" != "x"; then
147701395c31Smrg      HAVE_DOT=yes
147801395c31Smrg    fi
147901395c31Smrgfi
1480de7ed6e8Smrg
148101395c31SmrgAC_SUBST([HAVE_DOT])
148201395c31SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
148301395c31SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
148401395c31Smrg]) # XORG_WITH_DOXYGEN
1485de7ed6e8Smrg
148601395c31Smrg# XORG_WITH_GROFF([DEFAULT])
148701395c31Smrg# ----------------
148801395c31Smrg# Minimum version: 1.6.0
148901395c31Smrg# Minimum version for optional DEFAULT argument: 1.11.0
14908255a313Smrg#
149101395c31Smrg# Documentation tools are not always available on all platforms and sometimes
149201395c31Smrg# not at the appropriate level. This macro enables a module to test for the
149301395c31Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
149401395c31Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
149501395c31Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
149601395c31Smrg# --with-groff assumes 'auto'.
14978255a313Smrg#
149801395c31Smrg# Interface to module:
149901395c31Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
150001395c31Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
150101395c31Smrg# HAVE_GROFF_MS: the -ms macros package
150201395c31Smrg# GROFF:	 returns the path of the groff program found
150301395c31Smrg#		 returns the path set by the user in the environment
150401395c31Smrg# --with-groff:	 'yes' user instructs the module to use groff
150501395c31Smrg#		 'no' user instructs the module not to use groff
15068255a313Smrg#
150701395c31Smrg# Added in version 1.9.0:
150801395c31Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
150901395c31Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
151001395c31Smrg#		   psselect from the psutils package.
151101395c31Smrg#		   the ghostcript package. Refer to the grohtml man pages
15128255a313Smrg#
151301395c31Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
15148255a313Smrg#
151501395c31Smrg# OS and distros often splits groff in a basic and full package, the former
151601395c31Smrg# having the groff program and the later having devices, fonts and macros
151701395c31Smrg# Checking for the groff executable is not enough.
15188255a313Smrg#
151901395c31Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
152001395c31Smrg# unset HAVE_GROFF or GROFF env variables.
152101395c31Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
15228255a313Smrg#
152301395c31SmrgAC_DEFUN([XORG_WITH_GROFF],[
152401395c31SmrgAC_ARG_VAR([GROFF], [Path to groff command])
152501395c31Smrgm4_define([_defopt], m4_default([$1], [auto]))
152601395c31SmrgAC_ARG_WITH(groff,
152701395c31Smrg	AS_HELP_STRING([--with-groff],
152801395c31Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
152901395c31Smrg	   [use_groff=$withval], [use_groff=]_defopt)
153001395c31Smrgm4_undefine([_defopt])
15318255a313Smrg
153201395c31Smrgif test "x$use_groff" = x"auto"; then
153301395c31Smrg   AC_PATH_PROG([GROFF], [groff])
153401395c31Smrg   if test "x$GROFF" = "x"; then
153501395c31Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
153601395c31Smrg	have_groff=no
153701395c31Smrg   else
153801395c31Smrg        have_groff=yes
153901395c31Smrg   fi
154001395c31Smrgelif test "x$use_groff" = x"yes" ; then
154101395c31Smrg   AC_PATH_PROG([GROFF], [groff])
154201395c31Smrg   if test "x$GROFF" = "x"; then
154301395c31Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
154401395c31Smrg   fi
154501395c31Smrg   have_groff=yes
154601395c31Smrgelif test "x$use_groff" = x"no" ; then
154701395c31Smrg   if test "x$GROFF" != "x"; then
154801395c31Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
154901395c31Smrg   fi
155001395c31Smrg   have_groff=no
15518255a313Smrgelse
155201395c31Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
15538255a313Smrgfi
15548255a313Smrg
155501395c31Smrg# We have groff, test for the presence of the macro packages
155601395c31Smrgif test "x$have_groff" = x"yes"; then
155701395c31Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
155801395c31Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
155901395c31Smrg        groff_ms_works=yes
156001395c31Smrg    else
156101395c31Smrg        groff_ms_works=no
156201395c31Smrg    fi
156301395c31Smrg    AC_MSG_RESULT([$groff_ms_works])
156401395c31Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
156501395c31Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
156601395c31Smrg        groff_mm_works=yes
156701395c31Smrg    else
156801395c31Smrg        groff_mm_works=no
156901395c31Smrg    fi
157001395c31Smrg    AC_MSG_RESULT([$groff_mm_works])
15718255a313Smrgfi
15728255a313Smrg
157301395c31Smrg# We have groff, test for HTML dependencies, one command per package
157401395c31Smrgif test "x$have_groff" = x"yes"; then
157501395c31Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
157601395c31Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
157701395c31Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
157801395c31Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
157901395c31Smrg      have_groff_html=yes
158001395c31Smrg   else
158101395c31Smrg      have_groff_html=no
158201395c31Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
158301395c31Smrg   fi
15848255a313Smrgfi
15858255a313Smrg
158601395c31Smrg# Set Automake conditionals for Makefiles
158701395c31SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
158801395c31SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
158901395c31SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
159001395c31SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
159101395c31Smrg]) # XORG_WITH_GROFF
15928255a313Smrg
159301395c31Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
159401395c31Smrg# ---------------------------------------
159501395c31Smrg# Minimum version: 1.6.0
159601395c31Smrg# Minimum version for optional DEFAULT argument: 1.11.0
159701395c31Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
159801395c31Smrg#
159901395c31Smrg# Documentation tools are not always available on all platforms and sometimes
160001395c31Smrg# not at the appropriate level. This macro enables a module to test for the
160101395c31Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
160201395c31Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
160301395c31Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
160401395c31Smrg# --with-fop assumes 'auto'.
160501395c31Smrg#
160601395c31Smrg# Interface to module:
160701395c31Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
160801395c31Smrg# FOP:	 	returns the path of the fop program found
160901395c31Smrg#		returns the path set by the user in the environment
161001395c31Smrg# --with-fop: 	'yes' user instructs the module to use fop
161101395c31Smrg#		'no' user instructs the module not to use fop
161201395c31Smrg#
161301395c31Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
161401395c31Smrg#
161501395c31SmrgAC_DEFUN([XORG_WITH_FOP],[
161601395c31SmrgAC_ARG_VAR([FOP], [Path to fop command])
161701395c31Smrgm4_define([_defopt], m4_default([$2], [auto]))
161801395c31SmrgAC_ARG_WITH(fop,
161901395c31Smrg	AS_HELP_STRING([--with-fop],
162001395c31Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
162101395c31Smrg	   [use_fop=$withval], [use_fop=]_defopt)
162201395c31Smrgm4_undefine([_defopt])
16238255a313Smrg
162401395c31Smrgif test "x$use_fop" = x"auto"; then
162501395c31Smrg   AC_PATH_PROG([FOP], [fop])
162601395c31Smrg   if test "x$FOP" = "x"; then
162701395c31Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
162801395c31Smrg	have_fop=no
162901395c31Smrg   else
163001395c31Smrg        have_fop=yes
163101395c31Smrg   fi
163201395c31Smrgelif test "x$use_fop" = x"yes" ; then
163301395c31Smrg   AC_PATH_PROG([FOP], [fop])
163401395c31Smrg   if test "x$FOP" = "x"; then
163501395c31Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
163601395c31Smrg   fi
163701395c31Smrg   have_fop=yes
163801395c31Smrgelif test "x$use_fop" = x"no" ; then
163901395c31Smrg   if test "x$FOP" != "x"; then
164001395c31Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
164101395c31Smrg   fi
164201395c31Smrg   have_fop=no
164301395c31Smrgelse
164401395c31Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
164501395c31Smrgfi
16468255a313Smrg
164701395c31Smrg# Test for a minimum version of fop, if provided.
164801395c31Smrgm4_ifval([$1],
164901395c31Smrg[if test "$have_fop" = yes; then
165001395c31Smrg    # scrape the fop version
165101395c31Smrg    AC_MSG_CHECKING([for fop minimum version])
165201395c31Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
165301395c31Smrg    AC_MSG_RESULT([$fop_version])
165401395c31Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
165501395c31Smrg        [if test "x$use_fop" = xauto; then
165601395c31Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
165701395c31Smrg            have_fop=no
165801395c31Smrg        else
165901395c31Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
166001395c31Smrg        fi])
166101395c31Smrgfi])
166201395c31SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
166301395c31Smrg]) # XORG_WITH_FOP
1664de7ed6e8Smrg
166501395c31Smrg# XORG_WITH_M4([MIN-VERSION])
166601395c31Smrg# ---------------------------
166701395c31Smrg# Minimum version: 1.19.0
166801395c31Smrg#
166901395c31Smrg# This macro attempts to locate an m4 macro processor which supports
167001395c31Smrg# -I option and is only useful for modules relying on M4 in order to
167101395c31Smrg# expand macros in source code files.
167201395c31Smrg#
167301395c31Smrg# Interface to module:
167401395c31Smrg# M4:	 	returns the path of the m4 program found
167501395c31Smrg#		returns the path set by the user in the environment
167601395c31Smrg#
167701395c31SmrgAC_DEFUN([XORG_WITH_M4], [
167801395c31SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
167901395c31Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
168001395c31Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
168101395c31Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
168201395c31Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
168301395c31Smrg   [$PATH:/usr/gnu/bin])])
1684de7ed6e8Smrg
168501395c31SmrgAC_SUBST([M4], [$ac_cv_path_M4])
168601395c31Smrg]) # XORG_WITH_M4
16878255a313Smrg
168801395c31Smrg# XORG_WITH_PS2PDF([DEFAULT])
168901395c31Smrg# ----------------
169001395c31Smrg# Minimum version: 1.6.0
169101395c31Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1692de7ed6e8Smrg#
169301395c31Smrg# Documentation tools are not always available on all platforms and sometimes
169401395c31Smrg# not at the appropriate level. This macro enables a module to test for the
169501395c31Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
169601395c31Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
169701395c31Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
169801395c31Smrg# --with-ps2pdf assumes 'auto'.
169901395c31Smrg#
170001395c31Smrg# Interface to module:
170101395c31Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
170201395c31Smrg# PS2PDF:	returns the path of the ps2pdf program found
170301395c31Smrg#		returns the path set by the user in the environment
170401395c31Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
170501395c31Smrg#		 'no' user instructs the module not to use ps2pdf
170601395c31Smrg#
170701395c31Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
170801395c31Smrg#
170901395c31SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
171001395c31SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
171101395c31Smrgm4_define([_defopt], m4_default([$1], [auto]))
171201395c31SmrgAC_ARG_WITH(ps2pdf,
171301395c31Smrg	AS_HELP_STRING([--with-ps2pdf],
171401395c31Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
171501395c31Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
171601395c31Smrgm4_undefine([_defopt])
1717de7ed6e8Smrg
171801395c31Smrgif test "x$use_ps2pdf" = x"auto"; then
171901395c31Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
172001395c31Smrg   if test "x$PS2PDF" = "x"; then
172101395c31Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
172201395c31Smrg	have_ps2pdf=no
172301395c31Smrg   else
172401395c31Smrg        have_ps2pdf=yes
172501395c31Smrg   fi
172601395c31Smrgelif test "x$use_ps2pdf" = x"yes" ; then
172701395c31Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
172801395c31Smrg   if test "x$PS2PDF" = "x"; then
172901395c31Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
173001395c31Smrg   fi
173101395c31Smrg   have_ps2pdf=yes
173201395c31Smrgelif test "x$use_ps2pdf" = x"no" ; then
173301395c31Smrg   if test "x$PS2PDF" != "x"; then
173401395c31Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
173501395c31Smrg   fi
173601395c31Smrg   have_ps2pdf=no
1737de7ed6e8Smrgelse
173801395c31Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
1739de7ed6e8Smrgfi
174001395c31SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
174101395c31Smrg]) # XORG_WITH_PS2PDF
1742de7ed6e8Smrg
174301395c31Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
174401395c31Smrg# ----------------
174501395c31Smrg# Minimum version: 1.6.0
174601395c31Smrg#
174701395c31Smrg# Documentation tools are not always available on all platforms and sometimes
174801395c31Smrg# not at the appropriate level. This macro enables a builder to skip all
174901395c31Smrg# documentation targets except traditional man pages.
175001395c31Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
175101395c31Smrg# maximum flexibilty in controlling documentation building.
175201395c31Smrg# Refer to:
175301395c31Smrg# XORG_WITH_XMLTO         --with-xmlto
175401395c31Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
175501395c31Smrg# XORG_WITH_DOXYGEN       --with-doxygen
175601395c31Smrg# XORG_WITH_FOP           --with-fop
175701395c31Smrg# XORG_WITH_GROFF         --with-groff
175801395c31Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
175901395c31Smrg#
176001395c31Smrg# Interface to module:
176101395c31Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
176201395c31Smrg# --enable-docs: 'yes' user instructs the module to generate docs
176301395c31Smrg#		 'no' user instructs the module not to generate docs
176401395c31Smrg# parm1:	specify the default value, yes or no.
176501395c31Smrg#
176601395c31SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
176701395c31Smrgm4_define([docs_default], m4_default([$1], [yes]))
176801395c31SmrgAC_ARG_ENABLE(docs,
176901395c31Smrg	AS_HELP_STRING([--enable-docs],
177001395c31Smrg	   [Enable building the documentation (default: ]docs_default[)]),
177101395c31Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
177201395c31Smrgm4_undefine([docs_default])
177301395c31SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
177401395c31SmrgAC_MSG_CHECKING([whether to build documentation])
177501395c31SmrgAC_MSG_RESULT([$build_docs])
177601395c31Smrg]) # XORG_ENABLE_DOCS
177701395c31Smrg
177801395c31Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
177901395c31Smrg# ----------------
178001395c31Smrg# Minimum version: 1.6.0
178101395c31Smrg#
178201395c31Smrg# This macro enables a builder to skip all developer documentation.
178301395c31Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
178401395c31Smrg# maximum flexibilty in controlling documentation building.
178501395c31Smrg# Refer to:
178601395c31Smrg# XORG_WITH_XMLTO         --with-xmlto
178701395c31Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
178801395c31Smrg# XORG_WITH_DOXYGEN       --with-doxygen
178901395c31Smrg# XORG_WITH_FOP           --with-fop
179001395c31Smrg# XORG_WITH_GROFF         --with-groff
179101395c31Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
179201395c31Smrg#
179301395c31Smrg# Interface to module:
179401395c31Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
179501395c31Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
179601395c31Smrg#			'no' user instructs the module not to generate developer docs
179701395c31Smrg# parm1:		specify the default value, yes or no.
179801395c31Smrg#
179901395c31SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
180001395c31Smrgm4_define([devel_default], m4_default([$1], [yes]))
180101395c31SmrgAC_ARG_ENABLE(devel-docs,
180201395c31Smrg	AS_HELP_STRING([--enable-devel-docs],
180301395c31Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
180401395c31Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
180501395c31Smrgm4_undefine([devel_default])
180601395c31SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
180701395c31SmrgAC_MSG_CHECKING([whether to build developer documentation])
180801395c31SmrgAC_MSG_RESULT([$build_devel_docs])
180901395c31Smrg]) # XORG_ENABLE_DEVEL_DOCS
181001395c31Smrg
181101395c31Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
181201395c31Smrg# ----------------
181301395c31Smrg# Minimum version: 1.6.0
181401395c31Smrg#
181501395c31Smrg# This macro enables a builder to skip all functional specification targets.
181601395c31Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
181701395c31Smrg# maximum flexibilty in controlling documentation building.
181801395c31Smrg# Refer to:
181901395c31Smrg# XORG_WITH_XMLTO         --with-xmlto
182001395c31Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
182101395c31Smrg# XORG_WITH_DOXYGEN       --with-doxygen
182201395c31Smrg# XORG_WITH_FOP           --with-fop
182301395c31Smrg# XORG_WITH_GROFF         --with-groff
182401395c31Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
182501395c31Smrg#
182601395c31Smrg# Interface to module:
182701395c31Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
182801395c31Smrg# --enable-specs:	'yes' user instructs the module to generate specs
182901395c31Smrg#			'no' user instructs the module not to generate specs
183001395c31Smrg# parm1:		specify the default value, yes or no.
183101395c31Smrg#
183201395c31SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
183301395c31Smrgm4_define([spec_default], m4_default([$1], [yes]))
183401395c31SmrgAC_ARG_ENABLE(specs,
183501395c31Smrg	AS_HELP_STRING([--enable-specs],
183601395c31Smrg	   [Enable building the specs (default: ]spec_default[)]),
183701395c31Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
183801395c31Smrgm4_undefine([spec_default])
183901395c31SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
184001395c31SmrgAC_MSG_CHECKING([whether to build functional specifications])
184101395c31SmrgAC_MSG_RESULT([$build_specs])
184201395c31Smrg]) # XORG_ENABLE_SPECS
1843de7ed6e8Smrg
184401395c31Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
184501395c31Smrg# ----------------------------------------------
184601395c31Smrg# Minimum version: 1.13.0
18478255a313Smrg#
184801395c31Smrg# This macro enables a builder to enable/disable unit testing
184901395c31Smrg# It makes no assumption about the test cases implementation
185001395c31Smrg# Test cases may or may not use Automake "Support for test suites"
185101395c31Smrg# They may or may not use the software utility library GLib
185201395c31Smrg#
185301395c31Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
185401395c31Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
185501395c31Smrg# The variable enable_unit_tests is used by other macros in this file.
185601395c31Smrg#
185701395c31Smrg# Interface to module:
185801395c31Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
185901395c31Smrg# enable_unit_tests:    used in configure.ac for additional configuration
186001395c31Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
186101395c31Smrg#			'no' user instructs the module not to build tests
186201395c31Smrg# parm1:		specify the default value, yes or no.
186301395c31Smrg#
186401395c31SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
186501395c31SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
186601395c31SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
186701395c31SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
186801395c31Smrgm4_define([_defopt], m4_default([$1], [auto]))
186901395c31SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
187001395c31Smrg	[Enable building unit test cases (default: ]_defopt[)]),
187101395c31Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
187201395c31Smrgm4_undefine([_defopt])
187301395c31SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
187401395c31SmrgAC_MSG_CHECKING([whether to build unit test cases])
187501395c31SmrgAC_MSG_RESULT([$enable_unit_tests])
187601395c31Smrg]) # XORG_ENABLE_UNIT_TESTS
18778255a313Smrg
187801395c31Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
187901395c31Smrg# ------------------------------------------------------
188001395c31Smrg# Minimum version: 1.17.0
188101395c31Smrg#
188201395c31Smrg# This macro enables a builder to enable/disable integration testing
188301395c31Smrg# It makes no assumption about the test cases' implementation
188401395c31Smrg# Test cases may or may not use Automake "Support for test suites"
188501395c31Smrg#
188601395c31Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
188701395c31Smrg# usually requires less dependencies and may be built and run under less
188801395c31Smrg# stringent environments than integration tests.
188901395c31Smrg#
189001395c31Smrg# Interface to module:
189101395c31Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
189201395c31Smrg# enable_integration_tests:   used in configure.ac for additional configuration
189301395c31Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
189401395c31Smrg#                             'no' user instructs the module not to build tests
189501395c31Smrg# parm1:                      specify the default value, yes or no.
189601395c31Smrg#
189701395c31SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
189801395c31SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
189901395c31Smrgm4_define([_defopt], m4_default([$1], [auto]))
190001395c31SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
190101395c31Smrg	[Enable building integration test cases (default: ]_defopt[)]),
190201395c31Smrg	[enable_integration_tests=$enableval],
190301395c31Smrg	[enable_integration_tests=]_defopt)
190401395c31Smrgm4_undefine([_defopt])
190501395c31SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
190601395c31Smrg	[test "x$enable_integration_tests" != xno])
190701395c31SmrgAC_MSG_CHECKING([whether to build unit test cases])
190801395c31SmrgAC_MSG_RESULT([$enable_integration_tests])
190901395c31Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
19108255a313Smrg
191101395c31Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
191201395c31Smrg# ----------------------------------------
191301395c31Smrg# Minimum version: 1.13.0
191401395c31Smrg#
191501395c31Smrg# GLib is a library which provides advanced data structures and functions.
191601395c31Smrg# This macro enables a module to test for the presence of Glib.
191701395c31Smrg#
191801395c31Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
191901395c31Smrg# Otherwise the value of $enable_unit_tests is blank.
192001395c31Smrg#
192101395c31Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
192201395c31Smrg# test support usually requires less dependencies and may be built and run under
192301395c31Smrg# less stringent environments than integration tests.
192401395c31Smrg#
192501395c31Smrg# Interface to module:
192601395c31Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
192701395c31Smrg# with_glib: used in configure.ac to know if GLib has been found
192801395c31Smrg# --with-glib:	'yes' user instructs the module to use glib
192901395c31Smrg#		'no' user instructs the module not to use glib
193001395c31Smrg#
193101395c31SmrgAC_DEFUN([XORG_WITH_GLIB],[
193201395c31SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
193301395c31Smrgm4_define([_defopt], m4_default([$2], [auto]))
193401395c31SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
193501395c31Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
193601395c31Smrg	[with_glib=$withval], [with_glib=]_defopt)
193701395c31Smrgm4_undefine([_defopt])
19388255a313Smrg
193901395c31Smrghave_glib=no
194001395c31Smrg# Do not probe GLib if user explicitly disabled unit testing
194101395c31Smrgif test "x$enable_unit_tests" != x"no"; then
194201395c31Smrg  # Do not probe GLib if user explicitly disabled it
194301395c31Smrg  if test "x$with_glib" != x"no"; then
194401395c31Smrg    m4_ifval(
194501395c31Smrg      [$1],
194601395c31Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
194701395c31Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
194801395c31Smrg    )
194901395c31Smrg  fi
19508255a313Smrgfi
19518255a313Smrg
195201395c31Smrg# Not having GLib when unit testing has been explicitly requested is an error
195301395c31Smrgif test "x$enable_unit_tests" = x"yes"; then
195401395c31Smrg  if test "x$have_glib" = x"no"; then
195501395c31Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
195601395c31Smrg  fi
19578255a313Smrgfi
19588255a313Smrg
195901395c31Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
196001395c31Smrgif test "x$enable_unit_tests" = x"no"; then
196101395c31Smrg  if test "x$with_glib" = x"yes"; then
196201395c31Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
196301395c31Smrg  fi
19648255a313Smrgfi
19658255a313Smrg
196601395c31Smrg# Not having GLib when it has been explicitly requested is an error
196701395c31Smrgif test "x$with_glib" = x"yes"; then
196801395c31Smrg  if test "x$have_glib" = x"no"; then
196901395c31Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
197001395c31Smrg  fi
19718255a313Smrgfi
19728255a313Smrg
197301395c31SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
197401395c31Smrg]) # XORG_WITH_GLIB
19758255a313Smrg
197601395c31Smrg# XORG_LD_WRAP([required|optional])
197701395c31Smrg# ---------------------------------
197801395c31Smrg# Minimum version: 1.13.0
197901395c31Smrg#
198001395c31Smrg# Check if linker supports -wrap, passed via compiler flags
198101395c31Smrg#
198201395c31Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
198301395c31Smrg# Otherwise the value of $enable_unit_tests is blank.
198401395c31Smrg#
198501395c31Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
198601395c31Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
198701395c31Smrg# available, an argument of "optional" allows use when some unit tests require
198801395c31Smrg# ld -wrap and others do not.
198901395c31Smrg#
199001395c31SmrgAC_DEFUN([XORG_LD_WRAP],[
199101395c31SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
199201395c31Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
199301395c31Smrg                      void __wrap_exit(int status) { return; }],
199401395c31Smrg                     [exit(0);])])
199501395c31Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
199601395c31Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
199701395c31Smrg  if test "x$have_ld_wrap" = x"no"; then
199801395c31Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
199901395c31Smrg  fi
20008255a313Smrgfi
200101395c31SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
200201395c31Smrg#
200301395c31Smrg]) # XORG_LD_WRAP
20048255a313Smrg
200501395c31Smrg# XORG_CHECK_LINKER_FLAGS
200601395c31Smrg# -----------------------
200701395c31Smrg# SYNOPSIS
200801395c31Smrg#
200901395c31Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
201001395c31Smrg#
201101395c31Smrg# DESCRIPTION
201201395c31Smrg#
201301395c31Smrg#   Check whether the given linker FLAGS work with the current language's
201401395c31Smrg#   linker, or whether they give an error.
201501395c31Smrg#
201601395c31Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
201701395c31Smrg#   success/failure.
201801395c31Smrg#
201901395c31Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
202001395c31Smrg#
202101395c31Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
202201395c31Smrg#
202301395c31Smrg# LICENSE
202401395c31Smrg#
202501395c31Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
202601395c31Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
202701395c31Smrg#   Copyright (c) 2009 Matteo Frigo
202801395c31Smrg#
202901395c31Smrg#   This program is free software: you can redistribute it and/or modify it
203001395c31Smrg#   under the terms of the GNU General Public License as published by the
203101395c31Smrg#   Free Software Foundation, either version 3 of the License, or (at your
203201395c31Smrg#   option) any later version.
203301395c31Smrg#
203401395c31Smrg#   This program is distributed in the hope that it will be useful, but
203501395c31Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
203601395c31Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
203701395c31Smrg#   Public License for more details.
203801395c31Smrg#
203901395c31Smrg#   You should have received a copy of the GNU General Public License along
204001395c31Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
204101395c31Smrg#
204201395c31Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
204301395c31Smrg#   gives unlimited permission to copy, distribute and modify the configure
204401395c31Smrg#   scripts that are the output of Autoconf when processing the Macro. You
204501395c31Smrg#   need not follow the terms of the GNU General Public License when using
204601395c31Smrg#   or distributing such scripts, even though portions of the text of the
204701395c31Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
204801395c31Smrg#   all other use of the material that constitutes the Autoconf Macro.
204901395c31Smrg#
205001395c31Smrg#   This special exception to the GPL applies to versions of the Autoconf
205101395c31Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
205201395c31Smrg#   modified version of the Autoconf Macro, you may extend this special
205301395c31Smrg#   exception to the GPL to apply to your modified version as well.#
205401395c31SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
205501395c31Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
205601395c31Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
205701395c31SmrgAS_LITERAL_IF([$1],
205801395c31Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
205901395c31Smrg      ax_save_FLAGS=$LDFLAGS
206001395c31Smrg      LDFLAGS="$1"
206101395c31Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
206201395c31Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
206301395c31Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
206401395c31Smrg      LDFLAGS=$ax_save_FLAGS])],
206501395c31Smrg  [ax_save_FLAGS=$LDFLAGS
206601395c31Smrg   LDFLAGS="$1"
206701395c31Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
206801395c31Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
206901395c31Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
207001395c31Smrg   LDFLAGS=$ax_save_FLAGS])
207101395c31Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
207201395c31SmrgAC_MSG_RESULT($xorg_check_linker_flags)
207301395c31Smrgif test "x$xorg_check_linker_flags" = xyes; then
207401395c31Smrg	m4_default([$2], :)
207501395c31Smrgelse
207601395c31Smrg	m4_default([$3], :)
207701395c31Smrgfi
207801395c31Smrg]) # XORG_CHECK_LINKER_FLAGS
20798255a313Smrg
208001395c31Smrg# XORG_MEMORY_CHECK_FLAGS
208101395c31Smrg# -----------------------
208201395c31Smrg# Minimum version: 1.16.0
2083de7ed6e8Smrg#
208401395c31Smrg# This macro attempts to find appropriate memory checking functionality
208501395c31Smrg# for various platforms which unit testing code may use to catch various
208601395c31Smrg# forms of memory allocation and access errors in testing.
2087de7ed6e8Smrg#
2088de7ed6e8Smrg# Interface to module:
208901395c31Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
209001395c31Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2091de7ed6e8Smrg#
209201395c31Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2093de7ed6e8Smrg#
209401395c31SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
209501395c31Smrg
209601395c31SmrgAC_REQUIRE([AC_CANONICAL_HOST])
209701395c31SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
209801395c31Smrg           [Environment variables to enable memory checking in tests])
209901395c31Smrg
210001395c31Smrg# Check for different types of support on different platforms
210101395c31Smrgcase $host_os in
210201395c31Smrg    solaris*)
210301395c31Smrg        AC_CHECK_LIB([umem], [umem_alloc],
210401395c31Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
210501395c31Smrg        ;;
210601395c31Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
210701395c31Smrg        # both directly and inverted, so should not be 0 or 255.
210801395c31Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
210901395c31Smrg        ;;
211001395c31Smrg    darwin*)
211101395c31Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
211201395c31Smrg        ;;
211301395c31Smrg    *bsd*)
211401395c31Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
211501395c31Smrg        ;;
211601395c31Smrgesac
211701395c31Smrg
211801395c31Smrg# User supplied flags override default flags
211901395c31Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
212001395c31Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
212101395c31Smrgfi
212201395c31Smrg
212301395c31SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
212401395c31Smrg]) # XORG_WITH_LINT
212501395c31Smrg
212601395c31Smrg# XORG_CHECK_MALLOC_ZERO
212701395c31Smrg# ----------------------
212801395c31Smrg# Minimum version: 1.0.0
2129de7ed6e8Smrg#
213001395c31Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
213101395c31Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
213201395c31Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
213301395c31SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
213401395c31SmrgAC_ARG_ENABLE(malloc0returnsnull,
213501395c31Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
213601395c31Smrg		       [malloc(0) returns NULL (default: auto)]),
213701395c31Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
213801395c31Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2139de7ed6e8Smrg
214001395c31SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
214101395c31Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
214201395c31SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
214301395c31Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
214401395c31Smrg#include <stdlib.h>
214501395c31Smrg],[
214601395c31Smrg    char *m0, *r0, *c0, *p;
214701395c31Smrg    m0 = malloc(0);
214801395c31Smrg    p = malloc(10);
214901395c31Smrg    r0 = realloc(p,0);
215001395c31Smrg    c0 = calloc(0,10);
215101395c31Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
215201395c31Smrg])],
215301395c31Smrg		[xorg_cv_malloc0_returns_null=yes],
215401395c31Smrg		[xorg_cv_malloc0_returns_null=no])])
215501395c31SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2156de7ed6e8Smrgfi
215701395c31SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2158de7ed6e8Smrg
215901395c31Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
216001395c31Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
216101395c31Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
216201395c31Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
216301395c31Smrgelse
216401395c31Smrg	MALLOC_ZERO_CFLAGS=""
216501395c31Smrg	XMALLOC_ZERO_CFLAGS=""
216601395c31Smrg	XTMALLOC_ZERO_CFLAGS=""
216701395c31Smrgfi
2168de7ed6e8Smrg
216901395c31SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
217001395c31SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
217101395c31SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
217201395c31Smrg]) # XORG_CHECK_MALLOC_ZERO
2173de7ed6e8Smrg
217401395c31Smrg# XORG_WITH_LINT()
2175de7ed6e8Smrg# ----------------
217601395c31Smrg# Minimum version: 1.1.0
2177de7ed6e8Smrg#
217801395c31Smrg# This macro enables the use of a tool that flags some suspicious and
217901395c31Smrg# non-portable constructs (likely to be bugs) in C language source code.
218001395c31Smrg# It will attempt to locate the tool and use appropriate options.
218101395c31Smrg# There are various lint type tools on different platforms.
2182de7ed6e8Smrg#
2183de7ed6e8Smrg# Interface to module:
218401395c31Smrg# LINT:		returns the path to the tool found on the platform
218501395c31Smrg#		or the value set to LINT on the configure cmd line
218601395c31Smrg#		also an Automake conditional
218701395c31Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
2188de7ed6e8Smrg#
218901395c31Smrg# --with-lint:	'yes' user instructs the module to use lint
219001395c31Smrg#		'no' user instructs the module not to use lint (default)
2191de7ed6e8Smrg#
219201395c31Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
219301395c31Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
219401395c31Smrg#
219501395c31SmrgAC_DEFUN([XORG_WITH_LINT],[
2196de7ed6e8Smrg
219701395c31SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
219801395c31SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
219901395c31SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
220001395c31Smrg		[Use a lint-style source code checker (default: disabled)])],
220101395c31Smrg		[use_lint=$withval], [use_lint=no])
220201395c31Smrg
220301395c31Smrg# Obtain platform specific info like program name and options
220401395c31Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
220501395c31Smrgcase $host_os in
220601395c31Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
220701395c31Smrg	lint_name=splint
220801395c31Smrg	lint_options="-badflag"
220901395c31Smrg	;;
221001395c31Smrg  *freebsd* | *netbsd*)
221101395c31Smrg	lint_name=lint
221201395c31Smrg	lint_options="-u -b"
221301395c31Smrg	;;
221401395c31Smrg  *solaris*)
221501395c31Smrg	lint_name=lint
221601395c31Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
221701395c31Smrg	;;
221801395c31Smrgesac
221901395c31Smrg
222001395c31Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
222101395c31Smrgif test "x$use_lint" = x"yes" ; then
222201395c31Smrg   AC_PATH_PROG([LINT], [$lint_name])
222301395c31Smrg   if test "x$LINT" = "x"; then
222401395c31Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2225de7ed6e8Smrg   fi
222601395c31Smrgelif test "x$use_lint" = x"no" ; then
222701395c31Smrg   if test "x$LINT" != "x"; then
222801395c31Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2229de7ed6e8Smrg   fi
2230de7ed6e8Smrgelse
223101395c31Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2232de7ed6e8Smrgfi
2233de7ed6e8Smrg
223401395c31Smrg# User supplied flags override default flags
223501395c31Smrgif test "x$LINT_FLAGS" != "x"; then
223601395c31Smrg   lint_options=$LINT_FLAGS
223701395c31Smrgfi
223801395c31Smrg
223901395c31SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
224001395c31SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
224101395c31Smrg
224201395c31Smrg]) # XORG_WITH_LINT
224301395c31Smrg
224401395c31Smrg# XORG_LINT_LIBRARY(LIBNAME)
224501395c31Smrg# --------------------------
224601395c31Smrg# Minimum version: 1.1.0
2247de7ed6e8Smrg#
224801395c31Smrg# Sets up flags for building lint libraries for checking programs that call
224901395c31Smrg# functions in the library.
2250de7ed6e8Smrg#
2251de7ed6e8Smrg# Interface to module:
225201395c31Smrg# LINTLIB		- Automake variable with the name of lint library file to make
225301395c31Smrg# MAKE_LINT_LIB		- Automake conditional
2254de7ed6e8Smrg#
225501395c31Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
225601395c31Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2257de7ed6e8Smrg
225801395c31SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
225901395c31SmrgAC_REQUIRE([XORG_WITH_LINT])
226001395c31SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
226101395c31Smrg	[Create lint library (default: disabled)])],
226201395c31Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
226301395c31Smrg
226401395c31Smrgif test "x$make_lint_lib" = x"yes" ; then
226501395c31Smrg   LINTLIB=llib-l$1.ln
226601395c31Smrg   if test "x$LINT" = "x"; then
226701395c31Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2268de7ed6e8Smrg   fi
226901395c31Smrgelif test "x$make_lint_lib" != x"no" ; then
227001395c31Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2271de7ed6e8Smrgfi
2272de7ed6e8Smrg
227301395c31SmrgAC_SUBST(LINTLIB)
227401395c31SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
227501395c31Smrg
227601395c31Smrg]) # XORG_LINT_LIBRARY
227701395c31Smrg
227801395c31Smrg# XORG_COMPILER_BRAND
227901395c31Smrg# -------------------
228001395c31Smrg# Minimum version: 1.14.0
228101395c31Smrg#
228201395c31Smrg# Checks for various brands of compilers and sets flags as appropriate:
228301395c31Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
228401395c31Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
228501395c31Smrg#   clang compiler - sets CLANGCC to "yes"
228601395c31Smrg#   Intel compiler - sets INTELCC to "yes"
228701395c31Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
228801395c31Smrg#
228901395c31SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
229001395c31SmrgAC_LANG_CASE(
229101395c31Smrg	[C], [
229201395c31Smrg		AC_REQUIRE([AC_PROG_CC_C99])
229301395c31Smrg	],
229401395c31Smrg	[C++], [
229501395c31Smrg		AC_REQUIRE([AC_PROG_CXX])
229601395c31Smrg	]
229701395c31Smrg)
229801395c31SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
229901395c31SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
230001395c31SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
230101395c31Smrg]) # XORG_COMPILER_BRAND
230201395c31Smrg
230301395c31Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
230401395c31Smrg# ---------------
230501395c31Smrg# Minimum version: 1.16.0
230601395c31Smrg#
230701395c31Smrg# Test if the compiler works when passed the given flag as a command line argument.
230801395c31Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
230901395c31Smrg# next flag in the list until there are no more options.
231001395c31Smrg#
231101395c31Smrg# Note that this does not guarantee that the compiler supports the flag as some
231201395c31Smrg# compilers will simply ignore arguments that they do not understand, but we do
231301395c31Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
231401395c31Smrg# -Werror=unused-command-line-argument
231501395c31Smrg#
231601395c31SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
231701395c31Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
231801395c31Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
231901395c31Smrg
232001395c31SmrgAC_LANG_COMPILER_REQUIRE
232101395c31Smrg
232201395c31SmrgAC_LANG_CASE(
232301395c31Smrg	[C], [
232401395c31Smrg		AC_REQUIRE([AC_PROG_CC_C99])
232501395c31Smrg		define([PREFIX], [C])
232601395c31Smrg		define([CACHE_PREFIX], [cc])
232701395c31Smrg		define([COMPILER], [$CC])
232801395c31Smrg	],
232901395c31Smrg	[C++], [
233001395c31Smrg		define([PREFIX], [CXX])
233101395c31Smrg		define([CACHE_PREFIX], [cxx])
233201395c31Smrg		define([COMPILER], [$CXX])
233301395c31Smrg	]
233401395c31Smrg)
233501395c31Smrg
233601395c31Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
233701395c31Smrg
233801395c31Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
233901395c31Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
234001395c31Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
234101395c31Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
234201395c31Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
234301395c31Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
234401395c31Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
234501395c31Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
234601395c31Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
234701395c31Smrgfi
234801395c31Smrg
234901395c31Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
235001395c31Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
235101395c31Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
235201395c31Smrg	fi
235301395c31Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
235401395c31Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
235501395c31Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
235601395c31Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
235701395c31Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
235801395c31Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
235901395c31Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
236001395c31Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
236101395c31Smrgfi
2362de7ed6e8Smrg
236301395c31Smrgfound="no"
236401395c31Smrgm4_foreach([flag], m4_cdr($@), [
236501395c31Smrg	if test $found = "no" ; then
236601395c31Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
236701395c31Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
236801395c31Smrg		fi
236901395c31Smrg
237001395c31Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
237101395c31Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
237201395c31Smrg		fi
237301395c31Smrg
237401395c31Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
237501395c31Smrg
237601395c31Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
237701395c31Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
237801395c31Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
237901395c31Smrg		AC_CACHE_VAL($cacheid,
238001395c31Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
238101395c31Smrg					     [eval $cacheid=yes],
238201395c31Smrg					     [eval $cacheid=no])])
238301395c31Smrg
238401395c31Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
238501395c31Smrg
238601395c31Smrg		eval supported=\$$cacheid
238701395c31Smrg		AC_MSG_RESULT([$supported])
238801395c31Smrg		if test "$supported" = "yes" ; then
238901395c31Smrg			$1="$$1 ]flag["
239001395c31Smrg			found="yes"
239101395c31Smrg		fi
239201395c31Smrg	fi
239301395c31Smrg])
239401395c31Smrg]) # XORG_TESTSET_CFLAG
239501395c31Smrg
239601395c31Smrg# XORG_COMPILER_FLAGS
239701395c31Smrg# ---------------
239801395c31Smrg# Minimum version: 1.16.0
239901395c31Smrg#
240001395c31Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
240101395c31Smrg# arguments supported by the selected compiler which do NOT alter the generated
240201395c31Smrg# code.  These arguments will cause the compiler to print various warnings
240301395c31Smrg# during compilation AND turn a conservative set of warnings into errors.
240401395c31Smrg#
240501395c31Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
240601395c31Smrg# future versions of util-macros as options are added to new compilers.
240701395c31Smrg#
240801395c31SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
240901395c31SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
241001395c31Smrg
241101395c31SmrgAC_ARG_ENABLE(selective-werror,
241201395c31Smrg              AS_HELP_STRING([--disable-selective-werror],
241301395c31Smrg                             [Turn off selective compiler errors. (default: enabled)]),
241401395c31Smrg              [SELECTIVE_WERROR=$enableval],
241501395c31Smrg              [SELECTIVE_WERROR=yes])
241601395c31Smrg
241701395c31SmrgAC_LANG_CASE(
241801395c31Smrg        [C], [
241901395c31Smrg                define([PREFIX], [C])
242001395c31Smrg        ],
242101395c31Smrg        [C++], [
242201395c31Smrg                define([PREFIX], [CXX])
242301395c31Smrg        ]
242401395c31Smrg)
242501395c31Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
242601395c31Smrgif test "x$SUNCC" = "xyes"; then
242701395c31Smrg    [BASE_]PREFIX[FLAGS]="-v"
2428de7ed6e8Smrgelse
242901395c31Smrg    [BASE_]PREFIX[FLAGS]=""
2430de7ed6e8Smrgfi
2431de7ed6e8Smrg
243201395c31Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
243301395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
243401395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
243501395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
243601395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
243701395c31Smrg
243801395c31SmrgAC_LANG_CASE(
243901395c31Smrg	[C], [
244001395c31Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
244101395c31Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
244201395c31Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
244301395c31Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
244401395c31Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
244501395c31Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
244601395c31Smrg	]
244701395c31Smrg)
2448de7ed6e8Smrg
244901395c31Smrg# This chunk adds additional warnings that could catch undesired effects.
245001395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
245101395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
245201395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
245301395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
245401395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
245501395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
245601395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
245701395c31Smrg
245801395c31Smrg# These are currently disabled because they are noisy.  They will be enabled
245901395c31Smrg# in the future once the codebase is sufficiently modernized to silence
246001395c31Smrg# them.  For now, I don't want them to drown out the other warnings.
246101395c31Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
246201395c31Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
246301395c31Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
246401395c31Smrg
246501395c31Smrg# Turn some warnings into errors, so we don't accidently get successful builds
246601395c31Smrg# when there are problems that should be fixed.
246701395c31Smrg
246801395c31Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
246901395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
247001395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
247101395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
247201395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
247301395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
247401395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
247501395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
247601395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
247701395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
247801395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
247901395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
248001395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
248101395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
248201395c31Smrgelse
248301395c31SmrgAC_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])
248401395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
248501395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
248601395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
248701395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
248801395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
248901395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
249001395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
249101395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
249201395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
249301395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
249401395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
249501395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
249601395c31SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
2497de7ed6e8Smrgfi
2498de7ed6e8Smrg
249901395c31SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
250001395c31Smrg]) # XORG_COMPILER_FLAGS
2501de7ed6e8Smrg
250201395c31Smrg# XORG_CWARNFLAGS
250301395c31Smrg# ---------------
250401395c31Smrg# Minimum version: 1.2.0
250501395c31Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2506de7ed6e8Smrg#
250701395c31Smrg# Defines CWARNFLAGS to enable C compiler warnings.
2508de7ed6e8Smrg#
250901395c31Smrg# This function is deprecated because it defines -fno-strict-aliasing
251001395c31Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
251101395c31Smrg# is needed, then it should be added explicitly in the module when
251201395c31Smrg# it is updated to use BASE_CFLAGS.
2513de7ed6e8Smrg#
251401395c31SmrgAC_DEFUN([XORG_CWARNFLAGS], [
251501395c31SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
251601395c31SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
251701395c31SmrgAC_LANG_CASE(
251801395c31Smrg	[C], [
251901395c31Smrg		CWARNFLAGS="$BASE_CFLAGS"
252001395c31Smrg		if  test "x$GCC" = xyes ; then
252101395c31Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
252201395c31Smrg		fi
252301395c31Smrg		AC_SUBST(CWARNFLAGS)
252401395c31Smrg	]
252501395c31Smrg)
252601395c31Smrg]) # XORG_CWARNFLAGS
252701395c31Smrg
252801395c31Smrg# XORG_STRICT_OPTION
252901395c31Smrg# -----------------------
253001395c31Smrg# Minimum version: 1.3.0
2531de7ed6e8Smrg#
253201395c31Smrg# Add configure option to enable strict compilation flags, such as treating
253301395c31Smrg# warnings as fatal errors.
253401395c31Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
253501395c31Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
253601395c31Smrg#
253701395c31Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
253801395c31Smrg# when strict compilation is unconditionally desired.
253901395c31SmrgAC_DEFUN([XORG_STRICT_OPTION], [
254001395c31SmrgAC_REQUIRE([XORG_CWARNFLAGS])
254101395c31SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2542de7ed6e8Smrg
254301395c31SmrgAC_ARG_ENABLE(strict-compilation,
254401395c31Smrg			  AS_HELP_STRING([--enable-strict-compilation],
254501395c31Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
254601395c31Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
254701395c31Smrg
254801395c31SmrgAC_LANG_CASE(
254901395c31Smrg        [C], [
255001395c31Smrg                define([PREFIX], [C])
255101395c31Smrg        ],
255201395c31Smrg        [C++], [
255301395c31Smrg                define([PREFIX], [CXX])
255401395c31Smrg        ]
255501395c31Smrg)
255601395c31Smrg
255701395c31Smrg[STRICT_]PREFIX[FLAGS]=""
255801395c31SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
255901395c31SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
256001395c31Smrg
256101395c31Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
256201395c31Smrg# activate it with -Werror, so we add it here explicitly.
256301395c31SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
256401395c31Smrg
256501395c31Smrgif test "x$STRICT_COMPILE" = "xyes"; then
256601395c31Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
256701395c31Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
2568de7ed6e8Smrgfi
256901395c31SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
257001395c31SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
257101395c31SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
257201395c31Smrg]) # XORG_STRICT_OPTION
2573de7ed6e8Smrg
257401395c31Smrg# XORG_DEFAULT_OPTIONS
257501395c31Smrg# --------------------
257601395c31Smrg# Minimum version: 1.3.0
2577de7ed6e8Smrg#
257801395c31Smrg# Defines default options for X.Org modules.
2579de7ed6e8Smrg#
258001395c31SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
258101395c31SmrgAC_REQUIRE([AC_PROG_INSTALL])
258201395c31SmrgXORG_COMPILER_FLAGS
258301395c31SmrgXORG_CWARNFLAGS
258401395c31SmrgXORG_STRICT_OPTION
258501395c31SmrgXORG_RELEASE_VERSION
258601395c31SmrgXORG_CHANGELOG
258701395c31SmrgXORG_INSTALL
258801395c31SmrgXORG_MANPAGE_SECTIONS
258901395c31Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
259001395c31Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
259101395c31Smrg]) # XORG_DEFAULT_OPTIONS
259201395c31Smrg
259301395c31Smrg# XORG_INSTALL()
259401395c31Smrg# ----------------
259501395c31Smrg# Minimum version: 1.4.0
2596de7ed6e8Smrg#
259701395c31Smrg# Defines the variable INSTALL_CMD as the command to copy
259801395c31Smrg# INSTALL from $prefix/share/util-macros.
2599de7ed6e8Smrg#
260001395c31SmrgAC_DEFUN([XORG_INSTALL], [
260101395c31SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
260201395c31Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
260301395c31SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
260401395c31Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
260501395c31Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
260601395c31Smrgtouch \$(top_srcdir)/INSTALL; \
260701395c31Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
260801395c31SmrgAC_SUBST([INSTALL_CMD])
260901395c31Smrg]) # XORG_INSTALL
261001395c31Smrgdnl Copyright 2005 Red Hat, Inc
261101395c31Smrgdnl
261201395c31Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
261301395c31Smrgdnl documentation for any purpose is hereby granted without fee, provided that
261401395c31Smrgdnl the above copyright notice appear in all copies and that both that
261501395c31Smrgdnl copyright notice and this permission notice appear in supporting
261601395c31Smrgdnl documentation.
261701395c31Smrgdnl
261801395c31Smrgdnl The above copyright notice and this permission notice shall be included
261901395c31Smrgdnl in all copies or substantial portions of the Software.
262001395c31Smrgdnl
262101395c31Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
262201395c31Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
262301395c31Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
262401395c31Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
262501395c31Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
262601395c31Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
262701395c31Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
262801395c31Smrgdnl
262901395c31Smrgdnl Except as contained in this notice, the name of the copyright holders shall
263001395c31Smrgdnl not be used in advertising or otherwise to promote the sale, use or
263101395c31Smrgdnl other dealings in this Software without prior written authorization
263201395c31Smrgdnl from the copyright holders.
263301395c31Smrgdnl
2634de7ed6e8Smrg
263501395c31Smrg# XORG_RELEASE_VERSION
263601395c31Smrg# --------------------
263701395c31Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
263801395c31Smrg
263901395c31SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
264001395c31Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
264101395c31Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
264201395c31Smrg		[Major version of this package])
264301395c31Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
264401395c31Smrg	if test "x$PVM" = "x"; then
264501395c31Smrg		PVM="0"
264601395c31Smrg	fi
264701395c31Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
264801395c31Smrg		[$PVM],
264901395c31Smrg		[Minor version of this package])
265001395c31Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
265101395c31Smrg	if test "x$PVP" = "x"; then
265201395c31Smrg		PVP="0"
265301395c31Smrg	fi
265401395c31Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
265501395c31Smrg		[$PVP],
265601395c31Smrg		[Patch version of this package])
265701395c31Smrg])
2658de7ed6e8Smrg
265901395c31Smrg# XORG_CHANGELOG()
2660de7ed6e8Smrg# ----------------
266101395c31Smrg# Minimum version: 1.2.0
2662de7ed6e8Smrg#
266301395c31Smrg# Defines the variable CHANGELOG_CMD as the command to generate
266401395c31Smrg# ChangeLog from git.
2665de7ed6e8Smrg#
2666de7ed6e8Smrg#
266701395c31SmrgAC_DEFUN([XORG_CHANGELOG], [
266801395c31SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
266901395c31Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
267001395c31Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
267101395c31Smrgtouch \$(top_srcdir)/ChangeLog; \
267201395c31Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
267301395c31SmrgAC_SUBST([CHANGELOG_CMD])
267401395c31Smrg]) # XORG_CHANGELOG
2675de7ed6e8Smrg
267601395c31Smrg# Copyright (C) 2002-2018 Free Software Foundation, Inc.
2677de7ed6e8Smrg#
267801395c31Smrg# This file is free software; the Free Software Foundation
267901395c31Smrg# gives unlimited permission to copy and/or distribute it,
268001395c31Smrg# with or without modifications, as long as this notice is preserved.
268101395c31Smrg
268201395c31Smrg# AM_AUTOMAKE_VERSION(VERSION)
268301395c31Smrg# ----------------------------
268401395c31Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
268501395c31Smrg# generated from the m4 files accompanying Automake X.Y.
268601395c31Smrg# (This private macro should not be called outside this file.)
268701395c31SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
268801395c31Smrg[am__api_version='1.16'
268901395c31Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
269001395c31Smrgdnl require some minimum version.  Point them to the right macro.
269101395c31Smrgm4_if([$1], [1.16.1], [],
269201395c31Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
269301395c31Smrg])
269401395c31Smrg
269501395c31Smrg# _AM_AUTOCONF_VERSION(VERSION)
269601395c31Smrg# -----------------------------
269701395c31Smrg# aclocal traces this macro to find the Autoconf version.
269801395c31Smrg# This is a private macro too.  Using m4_define simplifies
269901395c31Smrg# the logic in aclocal, which can simply ignore this definition.
270001395c31Smrgm4_define([_AM_AUTOCONF_VERSION], [])
270101395c31Smrg
270201395c31Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
270301395c31Smrg# -------------------------------
270401395c31Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
270501395c31Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
270601395c31SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
270701395c31Smrg[AM_AUTOMAKE_VERSION([1.16.1])dnl
270801395c31Smrgm4_ifndef([AC_AUTOCONF_VERSION],
270901395c31Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
271001395c31Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
271101395c31Smrg
271201395c31Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
271301395c31Smrg
271401395c31Smrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
2715de7ed6e8Smrg#
271601395c31Smrg# This file is free software; the Free Software Foundation
271701395c31Smrg# gives unlimited permission to copy and/or distribute it,
271801395c31Smrg# with or without modifications, as long as this notice is preserved.
271901395c31Smrg
272001395c31Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
272101395c31Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
272201395c31Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
2723de7ed6e8Smrg#
272401395c31Smrg# Of course, Automake must honor this variable whenever it calls a
272501395c31Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
272601395c31Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
272701395c31Smrg# depending on how configure is run.  This is pretty annoying, since
272801395c31Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
272901395c31Smrg# source directory, any form will work fine, but in subdirectories a
273001395c31Smrg# relative path needs to be adjusted first.
273101395c31Smrg#
273201395c31Smrg# $ac_aux_dir/missing
273301395c31Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
273401395c31Smrg# $top_srcdir/$ac_aux_dir/missing
273501395c31Smrg#    fails if $ac_aux_dir is absolute,
273601395c31Smrg#    fails when called from a subdirectory in a VPATH build with
273701395c31Smrg#          a relative $ac_aux_dir
273801395c31Smrg#
273901395c31Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
274001395c31Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
274101395c31Smrg# harmless because $srcdir is '.', but things will broke when you
274201395c31Smrg# start a VPATH build or use an absolute $srcdir.
274301395c31Smrg#
274401395c31Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
274501395c31Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
274601395c31Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
274701395c31Smrg# and then we would define $MISSING as
274801395c31Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
274901395c31Smrg# This will work as long as MISSING is not called from configure, because
275001395c31Smrg# unfortunately $(top_srcdir) has no meaning in configure.
275101395c31Smrg# However there are other variables, like CC, which are often used in
275201395c31Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
275301395c31Smrg#
275401395c31Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
275501395c31Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
275601395c31Smrg# configured tree to be moved without reconfiguration.
2757de7ed6e8Smrg
275801395c31SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
275901395c31Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
276001395c31Smrg# Expand $ac_aux_dir to an absolute path.
276101395c31Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
276201395c31Smrg])
276301395c31Smrg
276401395c31Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
276501395c31Smrg
276601395c31Smrg# Copyright (C) 1997-2018 Free Software Foundation, Inc.
2767de7ed6e8Smrg#
276801395c31Smrg# This file is free software; the Free Software Foundation
276901395c31Smrg# gives unlimited permission to copy and/or distribute it,
277001395c31Smrg# with or without modifications, as long as this notice is preserved.
277101395c31Smrg
277201395c31Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
277301395c31Smrg# -------------------------------------
277401395c31Smrg# Define a conditional.
277501395c31SmrgAC_DEFUN([AM_CONDITIONAL],
277601395c31Smrg[AC_PREREQ([2.52])dnl
277701395c31Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
277801395c31Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
277901395c31SmrgAC_SUBST([$1_TRUE])dnl
278001395c31SmrgAC_SUBST([$1_FALSE])dnl
278101395c31Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
278201395c31Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
278301395c31Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
278401395c31Smrgif $2; then
278501395c31Smrg  $1_TRUE=
278601395c31Smrg  $1_FALSE='#'
278701395c31Smrgelse
278801395c31Smrg  $1_TRUE='#'
278901395c31Smrg  $1_FALSE=
279001395c31Smrgfi
279101395c31SmrgAC_CONFIG_COMMANDS_PRE(
279201395c31Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
279301395c31Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
279401395c31SmrgUsually this means the macro was only invoked conditionally.]])
279501395c31Smrgfi])])
279601395c31Smrg
279701395c31Smrg# Copyright (C) 1999-2018 Free Software Foundation, Inc.
2798de7ed6e8Smrg#
279901395c31Smrg# This file is free software; the Free Software Foundation
280001395c31Smrg# gives unlimited permission to copy and/or distribute it,
280101395c31Smrg# with or without modifications, as long as this notice is preserved.
280201395c31Smrg
280301395c31Smrg
280401395c31Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
280501395c31Smrg# written in clear, in which case automake, when reading aclocal.m4,
280601395c31Smrg# will think it sees a *use*, and therefore will trigger all it's
280701395c31Smrg# C support machinery.  Also note that it means that autoscan, seeing
280801395c31Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
280901395c31Smrg
281001395c31Smrg
281101395c31Smrg# _AM_DEPENDENCIES(NAME)
281201395c31Smrg# ----------------------
281301395c31Smrg# See how the compiler implements dependency checking.
281401395c31Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
281501395c31Smrg# We try a few techniques and use that to set a single cache variable.
2816de7ed6e8Smrg#
281701395c31Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
281801395c31Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
281901395c31Smrg# dependency, and given that the user is not expected to run this macro,
282001395c31Smrg# just rely on AC_PROG_CC.
282101395c31SmrgAC_DEFUN([_AM_DEPENDENCIES],
282201395c31Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
282301395c31SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
282401395c31SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
282501395c31SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
282601395c31Smrg
282701395c31Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
282801395c31Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
282901395c31Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
283001395c31Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
283101395c31Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
283201395c31Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
283301395c31Smrg                    [depcc="$$1"   am_compiler_list=])
283401395c31Smrg
283501395c31SmrgAC_CACHE_CHECK([dependency style of $depcc],
283601395c31Smrg               [am_cv_$1_dependencies_compiler_type],
283701395c31Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
283801395c31Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
283901395c31Smrg  # making bogus files that we don't know about and never remove.  For
284001395c31Smrg  # instance it was reported that on HP-UX the gcc test will end up
284101395c31Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
284201395c31Smrg  # in D".
284301395c31Smrg  rm -rf conftest.dir
284401395c31Smrg  mkdir conftest.dir
284501395c31Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
284601395c31Smrg  # using a relative directory.
284701395c31Smrg  cp "$am_depcomp" conftest.dir
284801395c31Smrg  cd conftest.dir
284901395c31Smrg  # We will build objects and dependencies in a subdirectory because
285001395c31Smrg  # it helps to detect inapplicable dependency modes.  For instance
285101395c31Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
285201395c31Smrg  # side effect of compilation, but ICC will put the dependencies in
285301395c31Smrg  # the current directory while Tru64 will put them in the object
285401395c31Smrg  # directory.
285501395c31Smrg  mkdir sub
285601395c31Smrg
285701395c31Smrg  am_cv_$1_dependencies_compiler_type=none
285801395c31Smrg  if test "$am_compiler_list" = ""; then
285901395c31Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
286001395c31Smrg  fi
286101395c31Smrg  am__universal=false
286201395c31Smrg  m4_case([$1], [CC],
286301395c31Smrg    [case " $depcc " in #(
286401395c31Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
286501395c31Smrg     esac],
286601395c31Smrg    [CXX],
286701395c31Smrg    [case " $depcc " in #(
286801395c31Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
286901395c31Smrg     esac])
287001395c31Smrg
287101395c31Smrg  for depmode in $am_compiler_list; do
287201395c31Smrg    # Setup a source with many dependencies, because some compilers
287301395c31Smrg    # like to wrap large dependency lists on column 80 (with \), and
287401395c31Smrg    # we should not choose a depcomp mode which is confused by this.
287501395c31Smrg    #
287601395c31Smrg    # We need to recreate these files for each test, as the compiler may
287701395c31Smrg    # overwrite some of them when testing with obscure command lines.
287801395c31Smrg    # This happens at least with the AIX C compiler.
287901395c31Smrg    : > sub/conftest.c
288001395c31Smrg    for i in 1 2 3 4 5 6; do
288101395c31Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
288201395c31Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
288301395c31Smrg      # Solaris 10 /bin/sh.
288401395c31Smrg      echo '/* dummy */' > sub/conftst$i.h
288501395c31Smrg    done
288601395c31Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2887de7ed6e8Smrg
288801395c31Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
288901395c31Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
289001395c31Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
289101395c31Smrg    # versions had trouble with output in subdirs.
289201395c31Smrg    am__obj=sub/conftest.${OBJEXT-o}
289301395c31Smrg    am__minus_obj="-o $am__obj"
289401395c31Smrg    case $depmode in
289501395c31Smrg    gcc)
289601395c31Smrg      # This depmode causes a compiler race in universal mode.
289701395c31Smrg      test "$am__universal" = false || continue
289801395c31Smrg      ;;
289901395c31Smrg    nosideeffect)
290001395c31Smrg      # After this tag, mechanisms are not by side-effect, so they'll
290101395c31Smrg      # only be used when explicitly requested.
290201395c31Smrg      if test "x$enable_dependency_tracking" = xyes; then
290301395c31Smrg	continue
290401395c31Smrg      else
290501395c31Smrg	break
290601395c31Smrg      fi
290701395c31Smrg      ;;
290801395c31Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
290901395c31Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
291001395c31Smrg      # not run yet.  These depmodes are late enough in the game, and
291101395c31Smrg      # so weak that their functioning should not be impacted.
291201395c31Smrg      am__obj=conftest.${OBJEXT-o}
291301395c31Smrg      am__minus_obj=
291401395c31Smrg      ;;
291501395c31Smrg    none) break ;;
291601395c31Smrg    esac
291701395c31Smrg    if depmode=$depmode \
291801395c31Smrg       source=sub/conftest.c object=$am__obj \
291901395c31Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
292001395c31Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
292101395c31Smrg         >/dev/null 2>conftest.err &&
292201395c31Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
292301395c31Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
292401395c31Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
292501395c31Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
292601395c31Smrg      # icc doesn't choke on unknown options, it will just issue warnings
292701395c31Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
292801395c31Smrg      # that says an option was ignored or not supported.
292901395c31Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
293001395c31Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
293101395c31Smrg      # The diagnosis changed in icc 8.0:
293201395c31Smrg      #   icc: Command line remark: option '-MP' not supported
293301395c31Smrg      if (grep 'ignoring option' conftest.err ||
293401395c31Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
293501395c31Smrg        am_cv_$1_dependencies_compiler_type=$depmode
293601395c31Smrg        break
293701395c31Smrg      fi
293801395c31Smrg    fi
293901395c31Smrg  done
29408255a313Smrg
294101395c31Smrg  cd ..
294201395c31Smrg  rm -rf conftest.dir
294301395c31Smrgelse
294401395c31Smrg  am_cv_$1_dependencies_compiler_type=none
29458255a313Smrgfi
294601395c31Smrg])
294701395c31SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
294801395c31SmrgAM_CONDITIONAL([am__fastdep$1], [
294901395c31Smrg  test "x$enable_dependency_tracking" != xno \
295001395c31Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
295101395c31Smrg])
29528255a313Smrg
295301395c31Smrg
295401395c31Smrg# AM_SET_DEPDIR
295501395c31Smrg# -------------
295601395c31Smrg# Choose a directory name for dependency files.
295701395c31Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
295801395c31SmrgAC_DEFUN([AM_SET_DEPDIR],
295901395c31Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
296001395c31SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
296101395c31Smrg])
296201395c31Smrg
296301395c31Smrg
296401395c31Smrg# AM_DEP_TRACK
296501395c31Smrg# ------------
296601395c31SmrgAC_DEFUN([AM_DEP_TRACK],
296701395c31Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
296801395c31SmrgAS_HELP_STRING(
296901395c31Smrg  [--enable-dependency-tracking],
297001395c31Smrg  [do not reject slow dependency extractors])
297101395c31SmrgAS_HELP_STRING(
297201395c31Smrg  [--disable-dependency-tracking],
297301395c31Smrg  [speeds up one-time build])])
297401395c31Smrgif test "x$enable_dependency_tracking" != xno; then
297501395c31Smrg  am_depcomp="$ac_aux_dir/depcomp"
297601395c31Smrg  AMDEPBACKSLASH='\'
297701395c31Smrg  am__nodep='_no'
29788255a313Smrgfi
297901395c31SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
298001395c31SmrgAC_SUBST([AMDEPBACKSLASH])dnl
298101395c31Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
298201395c31SmrgAC_SUBST([am__nodep])dnl
298301395c31Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
298401395c31Smrg])
29858255a313Smrg
298601395c31Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
29878255a313Smrg
298801395c31Smrg# Copyright (C) 1999-2018 Free Software Foundation, Inc.
2989de7ed6e8Smrg#
299001395c31Smrg# This file is free software; the Free Software Foundation
299101395c31Smrg# gives unlimited permission to copy and/or distribute it,
299201395c31Smrg# with or without modifications, as long as this notice is preserved.
299301395c31Smrg
299401395c31Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
299501395c31Smrg# ------------------------------
299601395c31SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
299701395c31Smrg[{
299801395c31Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
299901395c31Smrg  # are listed without --file.  Let's play safe and only enable the eval
300001395c31Smrg  # if we detect the quoting.
300101395c31Smrg  # TODO: see whether this extra hack can be removed once we start
300201395c31Smrg  # requiring Autoconf 2.70 or later.
300301395c31Smrg  AS_CASE([$CONFIG_FILES],
300401395c31Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
300501395c31Smrg          [*], [set x $CONFIG_FILES])
300601395c31Smrg  shift
300701395c31Smrg  # Used to flag and report bootstrapping failures.
300801395c31Smrg  am_rc=0
300901395c31Smrg  for am_mf
301001395c31Smrg  do
301101395c31Smrg    # Strip MF so we end up with the name of the file.
301201395c31Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
301301395c31Smrg    # Check whether this is an Automake generated Makefile which includes
301401395c31Smrg    # dependency-tracking related rules and includes.
301501395c31Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
301601395c31Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
301701395c31Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
301801395c31Smrg      || continue
301901395c31Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
302001395c31Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
302101395c31Smrg    AM_RUN_LOG([cd "$am_dirpart" \
302201395c31Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
302301395c31Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
302401395c31Smrg  done
302501395c31Smrg  if test $am_rc -ne 0; then
302601395c31Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
302701395c31Smrg    for automatic dependency tracking.  Try re-running configure with the
302801395c31Smrg    '--disable-dependency-tracking' option to at least be able to build
302901395c31Smrg    the package (albeit without support for automatic dependency tracking).])
303001395c31Smrg  fi
303101395c31Smrg  AS_UNSET([am_dirpart])
303201395c31Smrg  AS_UNSET([am_filepart])
303301395c31Smrg  AS_UNSET([am_mf])
303401395c31Smrg  AS_UNSET([am_rc])
303501395c31Smrg  rm -f conftest-deps.mk
303601395c31Smrg}
303701395c31Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
303801395c31Smrg
303901395c31Smrg
304001395c31Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
304101395c31Smrg# -----------------------------
304201395c31Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
3043de7ed6e8Smrg#
304401395c31Smrg# This code is only required when automatic dependency tracking is enabled.
304501395c31Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
304601395c31Smrg# order to bootstrap the dependency handling code.
304701395c31SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
304801395c31Smrg[AC_CONFIG_COMMANDS([depfiles],
304901395c31Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
305001395c31Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
305101395c31Smrg
305201395c31Smrg# Do all the work for Automake.                             -*- Autoconf -*-
305301395c31Smrg
305401395c31Smrg# Copyright (C) 1996-2018 Free Software Foundation, Inc.
30558255a313Smrg#
305601395c31Smrg# This file is free software; the Free Software Foundation
305701395c31Smrg# gives unlimited permission to copy and/or distribute it,
305801395c31Smrg# with or without modifications, as long as this notice is preserved.
30598255a313Smrg
306001395c31Smrg# This macro actually does too much.  Some checks are only needed if
306101395c31Smrg# your package does certain things.  But this isn't really a big deal.
3062de7ed6e8Smrg
306301395c31Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
306401395c31Smrgm4_define([AC_PROG_CC],
306501395c31Smrgm4_defn([AC_PROG_CC])
306601395c31Smrg[_AM_PROG_CC_C_O
306701395c31Smrg])
3068de7ed6e8Smrg
306901395c31Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
307001395c31Smrg# AM_INIT_AUTOMAKE([OPTIONS])
307101395c31Smrg# -----------------------------------------------
307201395c31Smrg# The call with PACKAGE and VERSION arguments is the old style
307301395c31Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
307401395c31Smrg# and VERSION should now be passed to AC_INIT and removed from
307501395c31Smrg# the call to AM_INIT_AUTOMAKE.
307601395c31Smrg# We support both call styles for the transition.  After
307701395c31Smrg# the next Automake release, Autoconf can make the AC_INIT
307801395c31Smrg# arguments mandatory, and then we can depend on a new Autoconf
307901395c31Smrg# release and drop the old call support.
308001395c31SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
308101395c31Smrg[AC_PREREQ([2.65])dnl
308201395c31Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
308301395c31Smrgdnl the ones we care about.
308401395c31Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
308501395c31SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
308601395c31SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
308701395c31Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
308801395c31Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
308901395c31Smrg  # is not polluted with repeated "-I."
309001395c31Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
309101395c31Smrg  # test to see if srcdir already configured
309201395c31Smrg  if test -f $srcdir/config.status; then
309301395c31Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
309401395c31Smrg  fi
30958255a313Smrgfi
3096de7ed6e8Smrg
309701395c31Smrg# test whether we have cygpath
309801395c31Smrgif test -z "$CYGPATH_W"; then
309901395c31Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
310001395c31Smrg    CYGPATH_W='cygpath -w'
310101395c31Smrg  else
310201395c31Smrg    CYGPATH_W=echo
310301395c31Smrg  fi
31048255a313Smrgfi
310501395c31SmrgAC_SUBST([CYGPATH_W])
310601395c31Smrg
310701395c31Smrg# Define the identity of the package.
310801395c31Smrgdnl Distinguish between old-style and new-style calls.
310901395c31Smrgm4_ifval([$2],
311001395c31Smrg[AC_DIAGNOSE([obsolete],
311101395c31Smrg             [$0: two- and three-arguments forms are deprecated.])
311201395c31Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
311301395c31Smrg AC_SUBST([PACKAGE], [$1])dnl
311401395c31Smrg AC_SUBST([VERSION], [$2])],
311501395c31Smrg[_AM_SET_OPTIONS([$1])dnl
311601395c31Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
311701395c31Smrgm4_if(
311801395c31Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
311901395c31Smrg  [ok:ok],,
312001395c31Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
312101395c31Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
312201395c31Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
312301395c31Smrg
312401395c31Smrg_AM_IF_OPTION([no-define],,
312501395c31Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
312601395c31Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
312701395c31Smrg
312801395c31Smrg# Some tools Automake needs.
312901395c31SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
313001395c31SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
313101395c31SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
313201395c31SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
313301395c31SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
313401395c31SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
313501395c31SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
313601395c31SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
313701395c31SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
313801395c31SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
313901395c31Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
314001395c31Smrg# dies out for good.  For more background, see:
314101395c31Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
314201395c31Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
314301395c31SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
314401395c31Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
314501395c31Smrg# system "awk" is bad on some platforms.
314601395c31SmrgAC_REQUIRE([AC_PROG_AWK])dnl
314701395c31SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
314801395c31SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
314901395c31Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
315001395c31Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
315101395c31Smrg			     [_AM_PROG_TAR([v7])])])
315201395c31Smrg_AM_IF_OPTION([no-dependencies],,
315301395c31Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
315401395c31Smrg		  [_AM_DEPENDENCIES([CC])],
315501395c31Smrg		  [m4_define([AC_PROG_CC],
315601395c31Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
315701395c31SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
315801395c31Smrg		  [_AM_DEPENDENCIES([CXX])],
315901395c31Smrg		  [m4_define([AC_PROG_CXX],
316001395c31Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
316101395c31SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
316201395c31Smrg		  [_AM_DEPENDENCIES([OBJC])],
316301395c31Smrg		  [m4_define([AC_PROG_OBJC],
316401395c31Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
316501395c31SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
316601395c31Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
316701395c31Smrg		  [m4_define([AC_PROG_OBJCXX],
316801395c31Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
316901395c31Smrg])
317001395c31SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
317101395c31Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
317201395c31Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
317301395c31Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
317401395c31SmrgAC_CONFIG_COMMANDS_PRE(dnl
317501395c31Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
317601395c31Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
31778255a313Smrg
317801395c31Smrg# POSIX will say in a future version that running "rm -f" with no argument
317901395c31Smrg# is OK; and we want to be able to make that assumption in our Makefile
318001395c31Smrg# recipes.  So use an aggressive probe to check that the usage we want is
318101395c31Smrg# actually supported "in the wild" to an acceptable degree.
318201395c31Smrg# See automake bug#10828.
318301395c31Smrg# To make any issue more visible, cause the running configure to be aborted
318401395c31Smrg# by default if the 'rm' program in use doesn't match our expectations; the
318501395c31Smrg# user can still override this though.
318601395c31Smrgif rm -f && rm -fr && rm -rf; then : OK; else
318701395c31Smrg  cat >&2 <<'END'
318801395c31SmrgOops!
318901395c31Smrg
319001395c31SmrgYour 'rm' program seems unable to run without file operands specified
319101395c31Smrgon the command line, even when the '-f' option is present.  This is contrary
319201395c31Smrgto the behaviour of most rm programs out there, and not conforming with
319301395c31Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
319401395c31Smrg
319501395c31SmrgPlease tell bug-automake@gnu.org about your system, including the value
319601395c31Smrgof your $PATH and any error possibly output before this message.  This
319701395c31Smrgcan help us improve future automake versions.
31988255a313Smrg
319901395c31SmrgEND
320001395c31Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
320101395c31Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
320201395c31Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
320301395c31Smrg    echo >&2
320401395c31Smrg  else
320501395c31Smrg    cat >&2 <<'END'
320601395c31SmrgAborting the configuration process, to ensure you take notice of the issue.
32078255a313Smrg
320801395c31SmrgYou can download and install GNU coreutils to get an 'rm' implementation
320901395c31Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
32108255a313Smrg
321101395c31SmrgIf you want to complete the configuration process using your problematic
321201395c31Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
321301395c31Smrgto "yes", and re-run configure.
3214de7ed6e8Smrg
321501395c31SmrgEND
321601395c31Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
321701395c31Smrg  fi
32188255a313Smrgfi
321901395c31Smrgdnl The trailing newline in this macro's definition is deliberate, for
322001395c31Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
322101395c31Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
322201395c31Smrg])
3223de7ed6e8Smrg
322401395c31Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
322501395c31Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
322601395c31Smrgdnl mangled by Autoconf and run in a shell conditional statement.
322701395c31Smrgm4_define([_AC_COMPILER_EXEEXT],
322801395c31Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
32298255a313Smrg
323001395c31Smrg# When config.status generates a header, we must update the stamp-h file.
323101395c31Smrg# This file resides in the same directory as the config header
323201395c31Smrg# that is generated.  The stamp files are numbered to have different names.
32338255a313Smrg
323401395c31Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
323501395c31Smrg# loop where config.status creates the headers, so we can generate
323601395c31Smrg# our stamp files there.
323701395c31SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
323801395c31Smrg[# Compute $1's index in $config_headers.
323901395c31Smrg_am_arg=$1
324001395c31Smrg_am_stamp_count=1
324101395c31Smrgfor _am_header in $config_headers :; do
324201395c31Smrg  case $_am_header in
324301395c31Smrg    $_am_arg | $_am_arg:* )
324401395c31Smrg      break ;;
324501395c31Smrg    * )
324601395c31Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
324701395c31Smrg  esac
324801395c31Smrgdone
324901395c31Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
325001395c31Smrg
325101395c31Smrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
32528255a313Smrg#
325301395c31Smrg# This file is free software; the Free Software Foundation
325401395c31Smrg# gives unlimited permission to copy and/or distribute it,
325501395c31Smrg# with or without modifications, as long as this notice is preserved.
325601395c31Smrg
325701395c31Smrg# AM_PROG_INSTALL_SH
325801395c31Smrg# ------------------
325901395c31Smrg# Define $install_sh.
326001395c31SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
326101395c31Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
326201395c31Smrgif test x"${install_sh+set}" != xset; then
326301395c31Smrg  case $am_aux_dir in
326401395c31Smrg  *\ * | *\	*)
326501395c31Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
326601395c31Smrg  *)
326701395c31Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
326801395c31Smrg  esac
32698255a313Smrgfi
327001395c31SmrgAC_SUBST([install_sh])])
32718255a313Smrg
327201395c31Smrg# Copyright (C) 2003-2018 Free Software Foundation, Inc.
32738255a313Smrg#
327401395c31Smrg# This file is free software; the Free Software Foundation
327501395c31Smrg# gives unlimited permission to copy and/or distribute it,
327601395c31Smrg# with or without modifications, as long as this notice is preserved.
32778255a313Smrg
327801395c31Smrg# Check whether the underlying file-system supports filenames
327901395c31Smrg# with a leading dot.  For instance MS-DOS doesn't.
328001395c31SmrgAC_DEFUN([AM_SET_LEADING_DOT],
328101395c31Smrg[rm -rf .tst 2>/dev/null
328201395c31Smrgmkdir .tst 2>/dev/null
328301395c31Smrgif test -d .tst; then
328401395c31Smrg  am__leading_dot=.
328501395c31Smrgelse
328601395c31Smrg  am__leading_dot=_
32878255a313Smrgfi
328801395c31Smrgrmdir .tst 2>/dev/null
328901395c31SmrgAC_SUBST([am__leading_dot])])
32908255a313Smrg
329101395c31Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
3292de7ed6e8Smrg
329301395c31Smrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
3294de7ed6e8Smrg#
329501395c31Smrg# This file is free software; the Free Software Foundation
329601395c31Smrg# gives unlimited permission to copy and/or distribute it,
329701395c31Smrg# with or without modifications, as long as this notice is preserved.
32988255a313Smrg
329901395c31Smrg# AM_MAKE_INCLUDE()
330001395c31Smrg# -----------------
330101395c31Smrg# Check whether make has an 'include' directive that can support all
330201395c31Smrg# the idioms we need for our automatic dependency tracking code.
330301395c31SmrgAC_DEFUN([AM_MAKE_INCLUDE],
330401395c31Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
330501395c31Smrgcat > confinc.mk << 'END'
330601395c31Smrgam__doit:
330701395c31Smrg	@echo this is the am__doit target >confinc.out
330801395c31Smrg.PHONY: am__doit
330901395c31SmrgEND
331001395c31Smrgam__include="#"
331101395c31Smrgam__quote=
331201395c31Smrg# BSD make does it like this.
331301395c31Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
331401395c31Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
331501395c31Smrgecho 'include confinc.mk # ignored' > confmf.GNU
331601395c31Smrg_am_result=no
331701395c31Smrgfor s in GNU BSD; do
331801395c31Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
331901395c31Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
332001395c31Smrg      ['0:this is the am__doit target'],
332101395c31Smrg      [AS_CASE([$s],
332201395c31Smrg          [BSD], [am__include='.include' am__quote='"'],
332301395c31Smrg          [am__include='include' am__quote=''])])
332401395c31Smrg  if test "$am__include" != "#"; then
332501395c31Smrg    _am_result="yes ($s style)"
332601395c31Smrg    break
332701395c31Smrg  fi
332801395c31Smrgdone
332901395c31Smrgrm -f confinc.* confmf.*
333001395c31SmrgAC_MSG_RESULT([${_am_result}])
333101395c31SmrgAC_SUBST([am__include])])
333201395c31SmrgAC_SUBST([am__quote])])
33338255a313Smrg
333401395c31Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
333501395c31Smrg
333601395c31Smrg# Copyright (C) 1997-2018 Free Software Foundation, Inc.
33378255a313Smrg#
333801395c31Smrg# This file is free software; the Free Software Foundation
333901395c31Smrg# gives unlimited permission to copy and/or distribute it,
334001395c31Smrg# with or without modifications, as long as this notice is preserved.
334101395c31Smrg
334201395c31Smrg# AM_MISSING_PROG(NAME, PROGRAM)
334301395c31Smrg# ------------------------------
334401395c31SmrgAC_DEFUN([AM_MISSING_PROG],
334501395c31Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
334601395c31Smrg$1=${$1-"${am_missing_run}$2"}
334701395c31SmrgAC_SUBST($1)])
334801395c31Smrg
334901395c31Smrg# AM_MISSING_HAS_RUN
335001395c31Smrg# ------------------
335101395c31Smrg# Define MISSING if not defined so far and test if it is modern enough.
335201395c31Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
335301395c31SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
335401395c31Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
335501395c31SmrgAC_REQUIRE_AUX_FILE([missing])dnl
335601395c31Smrgif test x"${MISSING+set}" != xset; then
335701395c31Smrg  case $am_aux_dir in
335801395c31Smrg  *\ * | *\	*)
335901395c31Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
336001395c31Smrg  *)
336101395c31Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
336201395c31Smrg  esac
336301395c31Smrgfi
336401395c31Smrg# Use eval to expand $SHELL
336501395c31Smrgif eval "$MISSING --is-lightweight"; then
336601395c31Smrg  am_missing_run="$MISSING "
336701395c31Smrgelse
336801395c31Smrg  am_missing_run=
336901395c31Smrg  AC_MSG_WARN(['missing' script is too old or missing])
337001395c31Smrgfi
337101395c31Smrg])
33728255a313Smrg
337301395c31Smrg# Helper functions for option handling.                     -*- Autoconf -*-
337401395c31Smrg
337501395c31Smrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
33768255a313Smrg#
337701395c31Smrg# This file is free software; the Free Software Foundation
337801395c31Smrg# gives unlimited permission to copy and/or distribute it,
337901395c31Smrg# with or without modifications, as long as this notice is preserved.
338001395c31Smrg
338101395c31Smrg# _AM_MANGLE_OPTION(NAME)
338201395c31Smrg# -----------------------
338301395c31SmrgAC_DEFUN([_AM_MANGLE_OPTION],
338401395c31Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
338501395c31Smrg
338601395c31Smrg# _AM_SET_OPTION(NAME)
338701395c31Smrg# --------------------
338801395c31Smrg# Set option NAME.  Presently that only means defining a flag for this option.
338901395c31SmrgAC_DEFUN([_AM_SET_OPTION],
339001395c31Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
339101395c31Smrg
339201395c31Smrg# _AM_SET_OPTIONS(OPTIONS)
339301395c31Smrg# ------------------------
339401395c31Smrg# OPTIONS is a space-separated list of Automake options.
339501395c31SmrgAC_DEFUN([_AM_SET_OPTIONS],
339601395c31Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
339701395c31Smrg
339801395c31Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
339901395c31Smrg# -------------------------------------------
340001395c31Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
340101395c31SmrgAC_DEFUN([_AM_IF_OPTION],
340201395c31Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
340301395c31Smrg
340401395c31Smrg# Copyright (C) 1999-2018 Free Software Foundation, Inc.
34058255a313Smrg#
340601395c31Smrg# This file is free software; the Free Software Foundation
340701395c31Smrg# gives unlimited permission to copy and/or distribute it,
340801395c31Smrg# with or without modifications, as long as this notice is preserved.
34098255a313Smrg
341001395c31Smrg# _AM_PROG_CC_C_O
341101395c31Smrg# ---------------
341201395c31Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
341301395c31Smrg# to automatically call this.
341401395c31SmrgAC_DEFUN([_AM_PROG_CC_C_O],
341501395c31Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
341601395c31SmrgAC_REQUIRE_AUX_FILE([compile])dnl
341701395c31SmrgAC_LANG_PUSH([C])dnl
341801395c31SmrgAC_CACHE_CHECK(
341901395c31Smrg  [whether $CC understands -c and -o together],
342001395c31Smrg  [am_cv_prog_cc_c_o],
342101395c31Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
342201395c31Smrg  # Make sure it works both with $CC and with simple cc.
342301395c31Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
342401395c31Smrg  # compilers refuse to overwrite an existing .o file with -o,
342501395c31Smrg  # though they will create one.
342601395c31Smrg  am_cv_prog_cc_c_o=yes
342701395c31Smrg  for am_i in 1 2; do
342801395c31Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
342901395c31Smrg         && test -f conftest2.$ac_objext; then
343001395c31Smrg      : OK
343101395c31Smrg    else
343201395c31Smrg      am_cv_prog_cc_c_o=no
343301395c31Smrg      break
343401395c31Smrg    fi
343501395c31Smrg  done
343601395c31Smrg  rm -f core conftest*
343701395c31Smrg  unset am_i])
343801395c31Smrgif test "$am_cv_prog_cc_c_o" != yes; then
343901395c31Smrg   # Losing compiler, so override with the script.
344001395c31Smrg   # FIXME: It is wrong to rewrite CC.
344101395c31Smrg   # But if we don't then we get into trouble of one sort or another.
344201395c31Smrg   # A longer-term fix would be to have automake use am__CC in this case,
344301395c31Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
344401395c31Smrg   CC="$am_aux_dir/compile $CC"
34458255a313Smrgfi
344601395c31SmrgAC_LANG_POP([C])])
34478255a313Smrg
344801395c31Smrg# For backward compatibility.
344901395c31SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
345001395c31Smrg
345101395c31Smrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
34528255a313Smrg#
345301395c31Smrg# This file is free software; the Free Software Foundation
345401395c31Smrg# gives unlimited permission to copy and/or distribute it,
345501395c31Smrg# with or without modifications, as long as this notice is preserved.
34568255a313Smrg
345701395c31Smrg# AM_RUN_LOG(COMMAND)
345801395c31Smrg# -------------------
345901395c31Smrg# Run COMMAND, save the exit status in ac_status, and log it.
346001395c31Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
346101395c31SmrgAC_DEFUN([AM_RUN_LOG],
346201395c31Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
346301395c31Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
346401395c31Smrg   ac_status=$?
346501395c31Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
346601395c31Smrg   (exit $ac_status); }])
34678255a313Smrg
346801395c31Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
34698255a313Smrg
347001395c31Smrg# Copyright (C) 1996-2018 Free Software Foundation, Inc.
347101395c31Smrg#
347201395c31Smrg# This file is free software; the Free Software Foundation
347301395c31Smrg# gives unlimited permission to copy and/or distribute it,
347401395c31Smrg# with or without modifications, as long as this notice is preserved.
34758255a313Smrg
347601395c31Smrg# AM_SANITY_CHECK
347701395c31Smrg# ---------------
347801395c31SmrgAC_DEFUN([AM_SANITY_CHECK],
347901395c31Smrg[AC_MSG_CHECKING([whether build environment is sane])
348001395c31Smrg# Reject unsafe characters in $srcdir or the absolute working directory
348101395c31Smrg# name.  Accept space and tab only in the latter.
348201395c31Smrgam_lf='
348301395c31Smrg'
348401395c31Smrgcase `pwd` in
348501395c31Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
348601395c31Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
348701395c31Smrgesac
348801395c31Smrgcase $srcdir in
348901395c31Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
349001395c31Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
349101395c31Smrgesac
34928255a313Smrg
349301395c31Smrg# Do 'set' in a subshell so we don't clobber the current shell's
349401395c31Smrg# arguments.  Must try -L first in case configure is actually a
349501395c31Smrg# symlink; some systems play weird games with the mod time of symlinks
349601395c31Smrg# (eg FreeBSD returns the mod time of the symlink's containing
349701395c31Smrg# directory).
349801395c31Smrgif (
349901395c31Smrg   am_has_slept=no
350001395c31Smrg   for am_try in 1 2; do
350101395c31Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
350201395c31Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
350301395c31Smrg     if test "$[*]" = "X"; then
350401395c31Smrg	# -L didn't work.
350501395c31Smrg	set X `ls -t "$srcdir/configure" conftest.file`
350601395c31Smrg     fi
350701395c31Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
350801395c31Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
350901395c31Smrg
351001395c31Smrg	# If neither matched, then we have a broken ls.  This can happen
351101395c31Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
351201395c31Smrg	# broken ls alias from the environment.  This has actually
351301395c31Smrg	# happened.  Such a system could not be considered "sane".
351401395c31Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
351501395c31Smrg  alias in your environment])
351601395c31Smrg     fi
351701395c31Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
351801395c31Smrg       break
351901395c31Smrg     fi
352001395c31Smrg     # Just in case.
352101395c31Smrg     sleep 1
352201395c31Smrg     am_has_slept=yes
352301395c31Smrg   done
352401395c31Smrg   test "$[2]" = conftest.file
352501395c31Smrg   )
352601395c31Smrgthen
352701395c31Smrg   # Ok.
352801395c31Smrg   :
352901395c31Smrgelse
353001395c31Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
353101395c31SmrgCheck your system clock])
353201395c31Smrgfi
353301395c31SmrgAC_MSG_RESULT([yes])
353401395c31Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
353501395c31Smrg# generated files are strictly newer.
353601395c31Smrgam_sleep_pid=
353701395c31Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
353801395c31Smrg  ( sleep 1 ) &
353901395c31Smrg  am_sleep_pid=$!
354001395c31Smrgfi
354101395c31SmrgAC_CONFIG_COMMANDS_PRE(
354201395c31Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
354301395c31Smrg   if test -n "$am_sleep_pid"; then
354401395c31Smrg     # Hide warnings about reused PIDs.
354501395c31Smrg     wait $am_sleep_pid 2>/dev/null
354601395c31Smrg   fi
354701395c31Smrg   AC_MSG_RESULT([done])])
354801395c31Smrgrm -f conftest.file
354901395c31Smrg])
355001395c31Smrg
355101395c31Smrg# Copyright (C) 2009-2018 Free Software Foundation, Inc.
35528255a313Smrg#
355301395c31Smrg# This file is free software; the Free Software Foundation
355401395c31Smrg# gives unlimited permission to copy and/or distribute it,
355501395c31Smrg# with or without modifications, as long as this notice is preserved.
355601395c31Smrg
355701395c31Smrg# AM_SILENT_RULES([DEFAULT])
355801395c31Smrg# --------------------------
355901395c31Smrg# Enable less verbose build rules; with the default set to DEFAULT
356001395c31Smrg# ("yes" being less verbose, "no" or empty being verbose).
356101395c31SmrgAC_DEFUN([AM_SILENT_RULES],
356201395c31Smrg[AC_ARG_ENABLE([silent-rules], [dnl
356301395c31SmrgAS_HELP_STRING(
356401395c31Smrg  [--enable-silent-rules],
356501395c31Smrg  [less verbose build output (undo: "make V=1")])
356601395c31SmrgAS_HELP_STRING(
356701395c31Smrg  [--disable-silent-rules],
356801395c31Smrg  [verbose build output (undo: "make V=0")])dnl
356901395c31Smrg])
357001395c31Smrgcase $enable_silent_rules in @%:@ (((
357101395c31Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
357201395c31Smrg   no) AM_DEFAULT_VERBOSITY=1;;
357301395c31Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
357401395c31Smrgesac
357501395c31Smrgdnl
357601395c31Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
357701395c31Smrgdnl do not support nested variable expansions.
357801395c31Smrgdnl See automake bug#9928 and bug#10237.
357901395c31Smrgam_make=${MAKE-make}
358001395c31SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
358101395c31Smrg   [am_cv_make_support_nested_variables],
358201395c31Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
358301395c31SmrgBAR0=false
358401395c31SmrgBAR1=true
358501395c31SmrgV=1
358601395c31Smrgam__doit:
358701395c31Smrg	@$(TRUE)
358801395c31Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
358901395c31Smrg  am_cv_make_support_nested_variables=yes
359001395c31Smrgelse
359101395c31Smrg  am_cv_make_support_nested_variables=no
359201395c31Smrgfi])
359301395c31Smrgif test $am_cv_make_support_nested_variables = yes; then
359401395c31Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
359501395c31Smrg  AM_V='$(V)'
359601395c31Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
359701395c31Smrgelse
359801395c31Smrg  AM_V=$AM_DEFAULT_VERBOSITY
359901395c31Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
360001395c31Smrgfi
360101395c31SmrgAC_SUBST([AM_V])dnl
360201395c31SmrgAM_SUBST_NOTMAKE([AM_V])dnl
360301395c31SmrgAC_SUBST([AM_DEFAULT_V])dnl
360401395c31SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
360501395c31SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
360601395c31SmrgAM_BACKSLASH='\'
360701395c31SmrgAC_SUBST([AM_BACKSLASH])dnl
360801395c31Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
360901395c31Smrg])
361001395c31Smrg
361101395c31Smrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
36128255a313Smrg#
361301395c31Smrg# This file is free software; the Free Software Foundation
361401395c31Smrg# gives unlimited permission to copy and/or distribute it,
361501395c31Smrg# with or without modifications, as long as this notice is preserved.
361601395c31Smrg
361701395c31Smrg# AM_PROG_INSTALL_STRIP
361801395c31Smrg# ---------------------
361901395c31Smrg# One issue with vendor 'install' (even GNU) is that you can't
362001395c31Smrg# specify the program used to strip binaries.  This is especially
362101395c31Smrg# annoying in cross-compiling environments, where the build's strip
362201395c31Smrg# is unlikely to handle the host's binaries.
362301395c31Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
362401395c31Smrg# always use install-sh in "make install-strip", and initialize
362501395c31Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
362601395c31SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
362701395c31Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
362801395c31Smrg# Installed binaries are usually stripped using 'strip' when the user
362901395c31Smrg# run "make install-strip".  However 'strip' might not be the right
363001395c31Smrg# tool to use in cross-compilation environments, therefore Automake
363101395c31Smrg# will honor the 'STRIP' environment variable to overrule this program.
363201395c31Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
363301395c31Smrgif test "$cross_compiling" != no; then
363401395c31Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
363501395c31Smrgfi
363601395c31SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
363701395c31SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
363801395c31Smrg
363901395c31Smrg# Copyright (C) 2006-2018 Free Software Foundation, Inc.
36408255a313Smrg#
364101395c31Smrg# This file is free software; the Free Software Foundation
364201395c31Smrg# gives unlimited permission to copy and/or distribute it,
364301395c31Smrg# with or without modifications, as long as this notice is preserved.
36448255a313Smrg
364501395c31Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
364601395c31Smrg# ---------------------------
364701395c31Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
364801395c31Smrg# This macro is traced by Automake.
364901395c31SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
36508255a313Smrg
365101395c31Smrg# AM_SUBST_NOTMAKE(VARIABLE)
365201395c31Smrg# --------------------------
365301395c31Smrg# Public sister of _AM_SUBST_NOTMAKE.
365401395c31SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
36558255a313Smrg
365601395c31Smrg# Check how to create a tarball.                            -*- Autoconf -*-
36578255a313Smrg
365801395c31Smrg# Copyright (C) 2004-2018 Free Software Foundation, Inc.
365901395c31Smrg#
366001395c31Smrg# This file is free software; the Free Software Foundation
366101395c31Smrg# gives unlimited permission to copy and/or distribute it,
366201395c31Smrg# with or without modifications, as long as this notice is preserved.
36638255a313Smrg
366401395c31Smrg# _AM_PROG_TAR(FORMAT)
366501395c31Smrg# --------------------
366601395c31Smrg# Check how to create a tarball in format FORMAT.
366701395c31Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
366801395c31Smrg#
366901395c31Smrg# Substitute a variable $(am__tar) that is a command
367001395c31Smrg# writing to stdout a FORMAT-tarball containing the directory
367101395c31Smrg# $tardir.
367201395c31Smrg#     tardir=directory && $(am__tar) > result.tar
367301395c31Smrg#
367401395c31Smrg# Substitute a variable $(am__untar) that extract such
367501395c31Smrg# a tarball read from stdin.
367601395c31Smrg#     $(am__untar) < result.tar
367701395c31Smrg#
367801395c31SmrgAC_DEFUN([_AM_PROG_TAR],
367901395c31Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
368001395c31Smrg# in the wild :-(  We should find a proper way to deprecate it ...
368101395c31SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
36828255a313Smrg
368301395c31Smrg# We'll loop over all known methods to create a tar archive until one works.
368401395c31Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
36858255a313Smrg
368601395c31Smrgm4_if([$1], [v7],
368701395c31Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
368801395c31Smrg
368901395c31Smrg  [m4_case([$1],
369001395c31Smrg    [ustar],
369101395c31Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
369201395c31Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
369301395c31Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
369401395c31Smrg      # and bug#13588).
369501395c31Smrg      am_max_uid=2097151 # 2^21 - 1
369601395c31Smrg      am_max_gid=$am_max_uid
369701395c31Smrg      # The $UID and $GID variables are not portable, so we need to resort
369801395c31Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
369901395c31Smrg      # below are definitely unexpected, so allow the users to see them
370001395c31Smrg      # (that is, avoid stderr redirection).
370101395c31Smrg      am_uid=`id -u || echo unknown`
370201395c31Smrg      am_gid=`id -g || echo unknown`
370301395c31Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
370401395c31Smrg      if test $am_uid -le $am_max_uid; then
370501395c31Smrg         AC_MSG_RESULT([yes])
370601395c31Smrg      else
370701395c31Smrg         AC_MSG_RESULT([no])
370801395c31Smrg         _am_tools=none
370901395c31Smrg      fi
371001395c31Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
371101395c31Smrg      if test $am_gid -le $am_max_gid; then
371201395c31Smrg         AC_MSG_RESULT([yes])
371301395c31Smrg      else
371401395c31Smrg        AC_MSG_RESULT([no])
371501395c31Smrg        _am_tools=none
371601395c31Smrg      fi],
371701395c31Smrg
371801395c31Smrg  [pax],
371901395c31Smrg    [],
372001395c31Smrg
372101395c31Smrg  [m4_fatal([Unknown tar format])])
372201395c31Smrg
372301395c31Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
372401395c31Smrg
372501395c31Smrg  # Go ahead even if we have the value already cached.  We do so because we
372601395c31Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
372701395c31Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
372801395c31Smrg
372901395c31Smrg  for _am_tool in $_am_tools; do
373001395c31Smrg    case $_am_tool in
373101395c31Smrg    gnutar)
373201395c31Smrg      for _am_tar in tar gnutar gtar; do
373301395c31Smrg        AM_RUN_LOG([$_am_tar --version]) && break
373401395c31Smrg      done
373501395c31Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
373601395c31Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
373701395c31Smrg      am__untar="$_am_tar -xf -"
373801395c31Smrg      ;;
373901395c31Smrg    plaintar)
374001395c31Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
374101395c31Smrg      # ustar tarball either.
374201395c31Smrg      (tar --version) >/dev/null 2>&1 && continue
374301395c31Smrg      am__tar='tar chf - "$$tardir"'
374401395c31Smrg      am__tar_='tar chf - "$tardir"'
374501395c31Smrg      am__untar='tar xf -'
374601395c31Smrg      ;;
374701395c31Smrg    pax)
374801395c31Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
374901395c31Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
375001395c31Smrg      am__untar='pax -r'
375101395c31Smrg      ;;
375201395c31Smrg    cpio)
375301395c31Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
375401395c31Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
375501395c31Smrg      am__untar='cpio -i -H $1 -d'
375601395c31Smrg      ;;
375701395c31Smrg    none)
375801395c31Smrg      am__tar=false
375901395c31Smrg      am__tar_=false
376001395c31Smrg      am__untar=false
376101395c31Smrg      ;;
376201395c31Smrg    esac
37638255a313Smrg
376401395c31Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
376501395c31Smrg    # and am__untar set.
376601395c31Smrg    test -n "${am_cv_prog_tar_$1}" && break
376701395c31Smrg
376801395c31Smrg    # tar/untar a dummy directory, and stop if the command works.
376901395c31Smrg    rm -rf conftest.dir
377001395c31Smrg    mkdir conftest.dir
377101395c31Smrg    echo GrepMe > conftest.dir/file
377201395c31Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
377301395c31Smrg    rm -rf conftest.dir
377401395c31Smrg    if test -s conftest.tar; then
377501395c31Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
377601395c31Smrg      AM_RUN_LOG([cat conftest.dir/file])
377701395c31Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
377801395c31Smrg    fi
377901395c31Smrg  done
378001395c31Smrg  rm -rf conftest.dir
37818255a313Smrg
378201395c31Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
378301395c31Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
37848255a313Smrg
378501395c31SmrgAC_SUBST([am__tar])
378601395c31SmrgAC_SUBST([am__untar])
378701395c31Smrg]) # _AM_PROG_TAR
37888255a313Smrg
3789