154b5899cSmrg# generated automatically by aclocal 1.17 -*- Autoconf -*-
235c4bbdfSmrg
354b5899cSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
405b261ecSmrg
505b261ecSmrg# This file is free software; the Free Software Foundation
605b261ecSmrg# gives unlimited permission to copy and/or distribute it,
705b261ecSmrg# with or without modifications, as long as this notice is preserved.
805b261ecSmrg
905b261ecSmrg# This program is distributed in the hope that it will be useful,
1005b261ecSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1105b261ecSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1205b261ecSmrg# PARTICULAR PURPOSE.
1305b261ecSmrg
1435c4bbdfSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
1535c4bbdfSmrgm4_ifndef([AC_AUTOCONF_VERSION],
1635c4bbdfSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1758cf2af7Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
1858cf2af7Smrg[m4_warning([this file was generated for autoconf 2.72.
1935c4bbdfSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
2035c4bbdfSmrgIf you have problems, you may need to regenerate the build system entirely.
2135c4bbdfSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2235c4bbdfSmrg
2335c4bbdfSmrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
2435c4bbdfSmrgdnl
25d9252ffbSmrgdnl This file comes from X.Org's font-util 1.4.1
2635c4bbdfSmrgdnl
27d9252ffbSmrgdnl Copyright (c) 2009, 2023, Oracle and/or its affiliates.
2835c4bbdfSmrgdnl
2935c4bbdfSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
3035c4bbdfSmrgdnl copy of this software and associated documentation files (the "Software"),
3135c4bbdfSmrgdnl to deal in the Software without restriction, including without limitation
3235c4bbdfSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3335c4bbdfSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
3435c4bbdfSmrgdnl Software is furnished to do so, subject to the following conditions:
3535c4bbdfSmrgdnl
3635c4bbdfSmrgdnl The above copyright notice and this permission notice (including the next
3735c4bbdfSmrgdnl paragraph) shall be included in all copies or substantial portions of the
3835c4bbdfSmrgdnl Software.
3935c4bbdfSmrgdnl
4035c4bbdfSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4135c4bbdfSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4235c4bbdfSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
4335c4bbdfSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4435c4bbdfSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
4535c4bbdfSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
4635c4bbdfSmrgdnl DEALINGS IN THE SOFTWARE.
4735c4bbdfSmrgdnl
4835c4bbdfSmrgdnl --------------------------------------------------------------------
4935c4bbdfSmrgdnl
5035c4bbdfSmrgdnl Copyright 2005 Red Hat, Inc
5135c4bbdfSmrgdnl
5235c4bbdfSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
5335c4bbdfSmrgdnl documentation for any purpose is hereby granted without fee, provided that
5435c4bbdfSmrgdnl the above copyright notice appear in all copies and that both that
5535c4bbdfSmrgdnl copyright notice and this permission notice appear in supporting
5635c4bbdfSmrgdnl documentation.
5735c4bbdfSmrgdnl
5835c4bbdfSmrgdnl The above copyright notice and this permission notice shall be included
5935c4bbdfSmrgdnl in all copies or substantial portions of the Software.
6035c4bbdfSmrgdnl
6135c4bbdfSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
6235c4bbdfSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
6335c4bbdfSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
6435c4bbdfSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
6535c4bbdfSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
6635c4bbdfSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
6735c4bbdfSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
6835c4bbdfSmrgdnl
6935c4bbdfSmrgdnl Except as contained in this notice, the name of the copyright holders shall
7035c4bbdfSmrgdnl not be used in advertising or otherwise to promote the sale, use or
7135c4bbdfSmrgdnl other dealings in this Software without prior written authorization
7235c4bbdfSmrgdnl from the copyright holders.
7305b261ecSmrg
7435c4bbdfSmrg# XORG_FONT_MACROS_VERSION(required-version)
7535c4bbdfSmrg# ------------------------------------------
7635c4bbdfSmrg# Minimum version: 1.1.0
774642e01fSmrg#
7835c4bbdfSmrg# If you're using a macro added in Version 1.1 or newer, include this in
7935c4bbdfSmrg# your configure.ac with the minimum required version, such as:
8035c4bbdfSmrg# XORG_FONT_MACROS_VERSION(1.1)
8135c4bbdfSmrg#
8235c4bbdfSmrg# To ensure that this macro is defined, also add:
8335c4bbdfSmrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
8435c4bbdfSmrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
8535c4bbdfSmrg#
8635c4bbdfSmrg#
8735c4bbdfSmrg# See the "minimum version" comment for each macro you use to see what
8835c4bbdfSmrg# version you require.
8935c4bbdfSmrgm4_defun([XORG_FONT_MACROS_VERSION],[
90d9252ffbSmrgm4_define([vers_have], [1.4.1])
9135c4bbdfSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
9235c4bbdfSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
9335c4bbdfSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
9435c4bbdfSmrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
9535c4bbdfSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
9635c4bbdfSmrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
9735c4bbdfSmrgm4_undefine([vers_have])
9835c4bbdfSmrgm4_undefine([maj_have])
9935c4bbdfSmrgm4_undefine([maj_needed])
10035c4bbdfSmrg]) # XORG_FONT_MACROS_VERSION
1014642e01fSmrg
10235c4bbdfSmrg# XORG_FONT_CHECK_{maps}()
10335c4bbdfSmrg# ------------------------
10435c4bbdfSmrg# Minimum version: 1.0.0
10535c4bbdfSmrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
10635c4bbdfSmrg# JISX0201 or KOI8_R.  By default, they are all enabled.
10705b261ecSmrg
10835c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
10935c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
11035c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
11135c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
11235c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
11335c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
11435c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
11535c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
11635c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
11735c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
11835c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
11935c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
12035c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
12135c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
12235c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
12335c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
12435c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
12535c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
12605b261ecSmrg
12735c4bbdfSmrg# XORG_FONT_CHECK_ENCODING(encoding)
12835c4bbdfSmrg# ----------------------------------
12935c4bbdfSmrg# Minimum version: 1.1.0
13035c4bbdfSmrg# This macro adds --enable/disable-<encoding>, enabled by default.
13135c4bbdfSmrg# It replaced individual copies of this code in the above macros in 1.1.
13235c4bbdfSmrg# Currently assumes encoding names will be all upper-case - add m4_toupper
13335c4bbdfSmrg# calls if this is not true in the future.
13405b261ecSmrg
13535c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
13635c4bbdfSmrg	AC_ARG_ENABLE(m4_tolower($1),
13735c4bbdfSmrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
13835c4bbdfSmrg				[Build $1 fonts (default: yes)]),
13935c4bbdfSmrg		[AS_TR_SH($1)=$enableval])
14035c4bbdfSmrg	AC_MSG_CHECKING([whether to build $1 fonts])
14135c4bbdfSmrg	AC_MSG_RESULT($[AS_TR_SH($1)])
14235c4bbdfSmrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
14335c4bbdfSmrg]) # XORG_FONT_CHECK_ENCODING
14405b261ecSmrg
14535c4bbdfSmrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
14635c4bbdfSmrg# -----------------------------------------------------
14735c4bbdfSmrg# Minimum version: 1.1.0
14835c4bbdfSmrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
14935c4bbdfSmrg# Add a shorthand --enable/disable-all-encodings option.
15035c4bbdfSmrg
15135c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
15235c4bbdfSmrg	AC_ARG_ENABLE([all-encodings],
15335c4bbdfSmrg		AS_HELP_STRING([--disable-all-encodings],
15435c4bbdfSmrg				[Disable building of all font encodings]),
15535c4bbdfSmrg		[m4_foreach_w([enc], [$1], [
15635c4bbdfSmrg			AS_TR_SH(enc)=$enableval
15735c4bbdfSmrg		])],
15835c4bbdfSmrg		[m4_foreach_w([enc], [$1], [
15935c4bbdfSmrg			AS_TR_SH(enc)=yes
16035c4bbdfSmrg		])])
16135c4bbdfSmrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
16235c4bbdfSmrg]) # XORG_FONT_CHECK_ENCODING_LIST
16305b261ecSmrg
16435c4bbdfSmrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
16535c4bbdfSmrg# ------------------------------------------
16635c4bbdfSmrg# Minimum version: 1.1.0
16735c4bbdfSmrg#
16835c4bbdfSmrg# Simple wrapper around AC_PATH_PROG that errors if not found
16935c4bbdfSmrg#
1706747b715Smrg
17135c4bbdfSmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
17235c4bbdfSmrg	AC_PATH_PROG($1, $2)
17335c4bbdfSmrg	if test x"$$1" = x; then
17435c4bbdfSmrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
17535c4bbdfSmrg	fi
1764642e01fSmrg])
1774642e01fSmrg
1784642e01fSmrg
17935c4bbdfSmrg# XORG_FONT_FCCACHE()
18035c4bbdfSmrg# -------------------
18135c4bbdfSmrg# Minimum version: 1.1.0
1826747b715Smrg#
18335c4bbdfSmrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
18435c4bbdfSmrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
18535c4bbdfSmrg# to run fc-cache if found and not installing to $DESTDIR and not
18635c4bbdfSmrg# cross-compiling
1876747b715Smrg#
18835c4bbdfSmrg# fc-cache is optional, not required, and should be skipped when making
18935c4bbdfSmrg# packages (installing to $DESTDIR) or cross-compiling
1906747b715Smrg#
19135c4bbdfSmrgAC_DEFUN([XORG_FONT_FCCACHE],[
19235c4bbdfSmrg	AC_PATH_PROG(FCCACHE, fc-cache)
19335c4bbdfSmrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
19435c4bbdfSmrg	if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then
19535c4bbdfSmrg		RUN_FCCACHE="${FCCACHE_WARN}"
19635c4bbdfSmrg	else
19735c4bbdfSmrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
19835c4bbdfSmrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
19935c4bbdfSmrg	fi
20035c4bbdfSmrg	AC_SUBST([RUN_FCCACHE])
20135c4bbdfSmrg])
20235c4bbdfSmrg
20335c4bbdfSmrg# XORG_FONT_MKFONTDIR()
20435c4bbdfSmrg# -------------------
20535c4bbdfSmrg# Minimum version: 1.3.0
2066747b715Smrg#
20735c4bbdfSmrg# Set MKFONTDIR to path to mkfontdir.
2086747b715Smrg#
20935c4bbdfSmrg# If cross-compiling, and if mkdir is not found, use a shell command
21035c4bbdfSmrg# which warns mkfontdir needs to be run on the target
2116747b715Smrg#
21235c4bbdfSmrg# If not cross-compiling, mkfontdir must be found
21335c4bbdfSmrg#
21435c4bbdfSmrgAC_DEFUN([XORG_FONT_MKFONTDIR],[
21535c4bbdfSmrg	if test x"$cross_compiling" != x"no" ; then
21635c4bbdfSmrg		AC_PATH_PROG(MKFONTDIR, mkfontdir, "")
21735c4bbdfSmrg		MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run mkfontdir manually on host system"'
2184642e01fSmrg
21935c4bbdfSmrg		if test x"$MKFONTDIR" = x; then
22035c4bbdfSmrg			MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'"
22135c4bbdfSmrg		fi
22235c4bbdfSmrg	else
22335c4bbdfSmrg		XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
22435c4bbdfSmrg	fi
22505b261ecSmrg
22635c4bbdfSmrg	AC_SUBST([MKFONTDIR])
22735c4bbdfSmrg])
22805b261ecSmrg
22935c4bbdfSmrg# XORG_FONT_COMMON_UTILS()
23035c4bbdfSmrg# ------------------------
23135c4bbdfSmrg# Minimum version: 1.1.0
2326747b715Smrg#
23335c4bbdfSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
23405b261ecSmrg
23535c4bbdfSmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
23635c4bbdfSmrg	XORG_FONT_FCCACHE
23735c4bbdfSmrg	XORG_FONT_MKFONTDIR
23835c4bbdfSmrg])
23905b261ecSmrg
24035c4bbdfSmrg# XORG_FONT_SCALED_UTILS()
24135c4bbdfSmrg# ------------------------
24235c4bbdfSmrg# Minimum version: 1.1.0
2436747b715Smrg#
24435c4bbdfSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
24535c4bbdfSmrg# (TrueType, OpenType, Type1)
2464642e01fSmrg
24735c4bbdfSmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
24835c4bbdfSmrg	XORG_FONT_COMMON_UTILS
24935c4bbdfSmrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
25035c4bbdfSmrg])
2514642e01fSmrg
25235c4bbdfSmrg# XORG_FONT_BDF_UTILS()
25335c4bbdfSmrg# ---------------------
25435c4bbdfSmrg# Minimum version: 1.1.0
2556747b715Smrg#
25635c4bbdfSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
25735c4bbdfSmrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
25835c4bbdfSmrg# PCF output files created by bdftopcf
25905b261ecSmrg
26035c4bbdfSmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
26135c4bbdfSmrg	XORG_FONT_COMMON_UTILS
26235c4bbdfSmrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
26335c4bbdfSmrg	XORG_FONT_CHECK_COMPRESSION
2646747b715Smrg])
26505b261ecSmrg
26635c4bbdfSmrg# XORG_FONT_CHECK_COMPRESSION()
26735c4bbdfSmrg# -----------------------------
26835c4bbdfSmrg# Minimum version: 1.1.0
26935c4bbdfSmrg#
27035c4bbdfSmrg# Offer a --with-compression flag to control what compression method is
27135c4bbdfSmrg# used for pcf font files.   Offers all the methods currently supported
27235c4bbdfSmrg# by libXfont, including no compression.
273d9252ffbSmrg#
274d9252ffbSmrg# If COMPRESS_FLAGS is not set, and the compression method has flags needed
275d9252ffbSmrg# for reproducible builds, such as gzip -n to not record timestamp, will
276d9252ffbSmrg# set COMPRESS_FLAGS to those options.
27705b261ecSmrg
27835c4bbdfSmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
27935c4bbdfSmrg	AC_MSG_CHECKING([font compression method])
28035c4bbdfSmrg	AC_ARG_WITH(compression,
28135c4bbdfSmrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
28235c4bbdfSmrg			 [compression method to use on pcf fonts])],
28335c4bbdfSmrg         [compression="$withval"], [compression="yes"])
28435c4bbdfSmrg	if test x"$compression" = "xyes" ; then
28535c4bbdfSmrg		compression="gzip"
28635c4bbdfSmrg	fi
28735c4bbdfSmrg	AC_MSG_RESULT([${compression}])
28835c4bbdfSmrg	case ${compression} in
28935c4bbdfSmrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
290d9252ffbSmrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;
291d9252ffbSmrg			COMPRESS_FLAGS="${COMPRESS_FLAGS--n}" ;;
29235c4bbdfSmrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
29335c4bbdfSmrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
29435c4bbdfSmrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
29535c4bbdfSmrg	esac
29635c4bbdfSmrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
29735c4bbdfSmrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
29835c4bbdfSmrg	fi
299d9252ffbSmrg	AC_MSG_CHECKING([options to font compression command])
300d9252ffbSmrg	AC_MSG_RESULT([${COMPRESS_FLAGS:-none}])
301d9252ffbSmrg	AC_SUBST([COMPRESS_FLAGS])
30235c4bbdfSmrg	AC_SUBST([COMPRESS_SUFFIX])
3036747b715Smrg])
30405b261ecSmrg
30535c4bbdfSmrg# XORG_FONT_UCS2ANY()
30635c4bbdfSmrg# -------------------
30735c4bbdfSmrg# Minimum version: 1.1.0
30835c4bbdfSmrg#
30935c4bbdfSmrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
31035c4bbdfSmrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
31135c4bbdfSmrg# Also call pkg-config to find the directory with the encoding files needed
31235c4bbdfSmrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
31305b261ecSmrg
31435c4bbdfSmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
31535c4bbdfSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
31635c4bbdfSmrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
31735c4bbdfSmrg	PKG_CHECK_MODULES(MAPS, [fontutil])
31835c4bbdfSmrg	AC_MSG_CHECKING([for ucs2any encoding data files])
31935c4bbdfSmrg	MAPFILES_PATH=`$PKG_CONFIG --variable=mapdir fontutil`
32035c4bbdfSmrg	AC_SUBST(MAPFILES_PATH)
32135c4bbdfSmrg	AC_MSG_RESULT([${MAPFILES_PATH}])
3226747b715Smrg])
32305b261ecSmrg
32405b261ecSmrg
32505b261ecSmrg
32635c4bbdfSmrg# XORG_FONT_FC_CONFDIR()
32735c4bbdfSmrg# --------------------
32835c4bbdfSmrg# Minimum version: 1.2.0
32935c4bbdfSmrg#
33035c4bbdfSmrg# Sets FC_CONFDIR to the fontconfig config directory
33135c4bbdfSmrg# (which should be --with-confdir=... when building fontconfig)
33235c4bbdfSmrg# found from:
33335c4bbdfSmrg#	--with-fc-confdir=...
33435c4bbdfSmrg#	pkg-config --variable=confdir fontconfig
33535c4bbdfSmrg#	${sysconfdir}/fonts
33605b261ecSmrg
33735c4bbdfSmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
33835c4bbdfSmrg	dnl Ensure $PKG_CONFIG is set first
33935c4bbdfSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
34005b261ecSmrg
34135c4bbdfSmrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
34235c4bbdfSmrg	AC_ARG_WITH(fc-confdir,
34335c4bbdfSmrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
34435c4bbdfSmrg			   [Path to fontconfig's configuration directory]),
34535c4bbdfSmrg		    [FC_CONFDIR="$withval"])
34635c4bbdfSmrg	# if --with-fc-confdir was not specified
34735c4bbdfSmrg	if test "x${FC_CONFDIR}" = "x"; then
34835c4bbdfSmrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
34935c4bbdfSmrg	fi
35035c4bbdfSmrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
35135c4bbdfSmrg	if test "x${FC_CONFDIR}" = "x"; then
35235c4bbdfSmrg		FC_CONFDIR="${sysconfdir}/fonts"
35335c4bbdfSmrg	fi
35435c4bbdfSmrg	AC_SUBST(FC_CONFDIR)
35535c4bbdfSmrg	AC_MSG_RESULT([${FC_CONFDIR}])
3566747b715Smrg])
3574642e01fSmrg
3584642e01fSmrg
3594642e01fSmrg
36035c4bbdfSmrg# XORG_FONTROOTDIR()
36135c4bbdfSmrg# --------------------
36235c4bbdfSmrg# Minimum version: 1.1.0
36335c4bbdfSmrg#
36435c4bbdfSmrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
36535c4bbdfSmrg# found from:
36635c4bbdfSmrg#	--with-fontrootdir
36735c4bbdfSmrg#	pkg-config --variable=fontrootdir fontutil
36835c4bbdfSmrg#	${datadir}/fonts/X11
3694642e01fSmrg
37035c4bbdfSmrgAC_DEFUN([XORG_FONTROOTDIR],[
37135c4bbdfSmrg	dnl Ensure $PKG_CONFIG is set first
37235c4bbdfSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
3734642e01fSmrg
37435c4bbdfSmrg	AC_MSG_CHECKING([for root directory for font files])
37535c4bbdfSmrg	AC_ARG_WITH(fontrootdir,
37635c4bbdfSmrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
37735c4bbdfSmrg			   [Path to root directory for font files]),
37835c4bbdfSmrg		    [FONTROOTDIR="$withval"])
37935c4bbdfSmrg	# if --with-fontrootdir not specified...
38035c4bbdfSmrg	if test "x${FONTROOTDIR}" = "x"; then
38135c4bbdfSmrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
38235c4bbdfSmrg	fi
38335c4bbdfSmrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
38435c4bbdfSmrg	if test "x${FONTROOTDIR}" = "x"; then
38535c4bbdfSmrg		FONTROOTDIR="${datadir}/fonts/X11"
38635c4bbdfSmrg	fi
38735c4bbdfSmrg	AC_SUBST(FONTROOTDIR)
38835c4bbdfSmrg	AC_MSG_RESULT([${FONTROOTDIR}])
3894642e01fSmrg])
3904642e01fSmrg
39135c4bbdfSmrg# XORG_FONTSUBDIR(variable, flag, subdir)
39235c4bbdfSmrg# ---------------------------------------
39335c4bbdfSmrg# Minimum version: 1.1.0
39435c4bbdfSmrg#
39535c4bbdfSmrg# Offer a --with-<flag> flag to control directory for font installation
39635c4bbdfSmrg# Default is the specified <subdir> of the font root directory.
39735c4bbdfSmrg# Sets <variable> to the selected directory
3984642e01fSmrg
39935c4bbdfSmrgAC_DEFUN([XORG_FONTSUBDIR],[
40035c4bbdfSmrg	AC_REQUIRE([XORG_FONTROOTDIR])
4014642e01fSmrg
40235c4bbdfSmrg	AC_MSG_CHECKING([for directory for $3 files])
40335c4bbdfSmrg	AC_ARG_WITH($2,
40435c4bbdfSmrg		    [AS_HELP_STRING([--with-$2=DIR],
40535c4bbdfSmrg				    [Path to $3 files [FONTROOTDIR/$3]])],
40635c4bbdfSmrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
40735c4bbdfSmrg	AC_SUBST($1)
40835c4bbdfSmrg	AC_MSG_RESULT([${$1}])
40935c4bbdfSmrg]) # XORG_FONTSUBDIR
4104642e01fSmrg
41135c4bbdfSmrg# XORG_FONTDIR(subdir)
41235c4bbdfSmrg# --------------------
41335c4bbdfSmrg# Minimum version: 1.1.0
4146747b715Smrg#
41535c4bbdfSmrg# Offer a --with-fontdir flag to control directory for font installation
41635c4bbdfSmrg# Default is the specified subdir of the font root directory.
41735c4bbdfSmrg# Sets FONTDIR to the selected directory
4184642e01fSmrg
41935c4bbdfSmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
4204642e01fSmrg
421eee80088Smrg# pkg.m4 - Macros to locate and use pkg-config.   -*- Autoconf -*-
422eee80088Smrg# serial 12 (pkg-config-0.29.2)
4231b5d61b8Smrg
42435c4bbdfSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
42535c4bbdfSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
42635c4bbdfSmrgdnl
42735c4bbdfSmrgdnl This program is free software; you can redistribute it and/or modify
42835c4bbdfSmrgdnl it under the terms of the GNU General Public License as published by
42935c4bbdfSmrgdnl the Free Software Foundation; either version 2 of the License, or
43035c4bbdfSmrgdnl (at your option) any later version.
43135c4bbdfSmrgdnl
43235c4bbdfSmrgdnl This program is distributed in the hope that it will be useful, but
43335c4bbdfSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
43435c4bbdfSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
43535c4bbdfSmrgdnl General Public License for more details.
43635c4bbdfSmrgdnl
43735c4bbdfSmrgdnl You should have received a copy of the GNU General Public License
43835c4bbdfSmrgdnl along with this program; if not, write to the Free Software
43935c4bbdfSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
44035c4bbdfSmrgdnl 02111-1307, USA.
44135c4bbdfSmrgdnl
44235c4bbdfSmrgdnl As a special exception to the GNU General Public License, if you
44335c4bbdfSmrgdnl distribute this file as part of a program that contains a
44435c4bbdfSmrgdnl configuration script generated by Autoconf, you may include it under
44535c4bbdfSmrgdnl the same distribution terms that you use for the rest of that
44635c4bbdfSmrgdnl program.
44735c4bbdfSmrg
44835c4bbdfSmrgdnl PKG_PREREQ(MIN-VERSION)
44935c4bbdfSmrgdnl -----------------------
45035c4bbdfSmrgdnl Since: 0.29
45135c4bbdfSmrgdnl
45235c4bbdfSmrgdnl Verify that the version of the pkg-config macros are at least
45335c4bbdfSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
45435c4bbdfSmrgdnl installed version of pkg-config, this checks the developer's version
45535c4bbdfSmrgdnl of pkg.m4 when generating configure.
45635c4bbdfSmrgdnl
45735c4bbdfSmrgdnl To ensure that this macro is defined, also add:
45835c4bbdfSmrgdnl m4_ifndef([PKG_PREREQ],
45935c4bbdfSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
46035c4bbdfSmrgdnl
46135c4bbdfSmrgdnl See the "Since" comment for each macro you use to see what version
46235c4bbdfSmrgdnl of the macros you require.
46335c4bbdfSmrgm4_defun([PKG_PREREQ],
464eee80088Smrg[m4_define([PKG_MACROS_VERSION], [0.29.2])
46535c4bbdfSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
46635c4bbdfSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
46735c4bbdfSmrg])dnl PKG_PREREQ
46835c4bbdfSmrg
46958cf2af7Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION], [ACTION-IF-NOT-FOUND])
47058cf2af7Smrgdnl ---------------------------------------------------------
47135c4bbdfSmrgdnl Since: 0.16
47235c4bbdfSmrgdnl
47335c4bbdfSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
47435c4bbdfSmrgdnl first found in the path. Checks that the version of pkg-config found
47535c4bbdfSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
47635c4bbdfSmrgdnl used since that's the first version where most current features of
47735c4bbdfSmrgdnl pkg-config existed.
47858cf2af7Smrgdnl
47958cf2af7Smrgdnl If pkg-config is not found or older than specified, it will result
48058cf2af7Smrgdnl in an empty PKG_CONFIG variable. To avoid widespread issues with
48158cf2af7Smrgdnl scripts not checking it, ACTION-IF-NOT-FOUND defaults to aborting.
48258cf2af7Smrgdnl You can specify [PKG_CONFIG=false] as an action instead, which would
48358cf2af7Smrgdnl result in pkg-config tests failing, but no bogus error messages.
48435c4bbdfSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
48535c4bbdfSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
48635c4bbdfSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
48735c4bbdfSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
48835c4bbdfSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
48935c4bbdfSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
49035c4bbdfSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
4914642e01fSmrg
49235c4bbdfSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
49335c4bbdfSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
4946747b715Smrgfi
49535c4bbdfSmrgif test -n "$PKG_CONFIG"; then
49635c4bbdfSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
49735c4bbdfSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
49835c4bbdfSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
49935c4bbdfSmrg		AC_MSG_RESULT([yes])
50035c4bbdfSmrg	else
50135c4bbdfSmrg		AC_MSG_RESULT([no])
50235c4bbdfSmrg		PKG_CONFIG=""
50335c4bbdfSmrg	fi
50458cf2af7Smrgfi
50558cf2af7Smrgif test -z "$PKG_CONFIG"; then
50658cf2af7Smrg	m4_default([$2], [AC_MSG_ERROR([pkg-config not found])])
50735c4bbdfSmrgfi[]dnl
50835c4bbdfSmrg])dnl PKG_PROG_PKG_CONFIG
5094642e01fSmrg
51035c4bbdfSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
51135c4bbdfSmrgdnl -------------------------------------------------------------------
51235c4bbdfSmrgdnl Since: 0.18
51335c4bbdfSmrgdnl
51435c4bbdfSmrgdnl Check to see whether a particular set of modules exists. Similar to
51535c4bbdfSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
51635c4bbdfSmrgdnl
51735c4bbdfSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
518eee80088Smrgdnl only at the first occurrence in configure.ac, so if the first place
51935c4bbdfSmrgdnl it's called might be skipped (such as if it is within an "if", you
52035c4bbdfSmrgdnl have to call PKG_CHECK_EXISTS manually
52135c4bbdfSmrgAC_DEFUN([PKG_CHECK_EXISTS],
52235c4bbdfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
52335c4bbdfSmrgif test -n "$PKG_CONFIG" && \
52435c4bbdfSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
52535c4bbdfSmrg  m4_default([$2], [:])
52635c4bbdfSmrgm4_ifvaln([$3], [else
52735c4bbdfSmrg  $3])dnl
52835c4bbdfSmrgfi])
5294642e01fSmrg
53035c4bbdfSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
53135c4bbdfSmrgdnl ---------------------------------------------
53235c4bbdfSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
53335c4bbdfSmrgdnl pkg_failed based on the result.
53435c4bbdfSmrgm4_define([_PKG_CONFIG],
53535c4bbdfSmrg[if test -n "$$1"; then
53635c4bbdfSmrg    pkg_cv_[]$1="$$1"
53735c4bbdfSmrg elif test -n "$PKG_CONFIG"; then
53835c4bbdfSmrg    PKG_CHECK_EXISTS([$3],
53935c4bbdfSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
54035c4bbdfSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
54135c4bbdfSmrg		     [pkg_failed=yes])
54235c4bbdfSmrg else
54335c4bbdfSmrg    pkg_failed=untried
54435c4bbdfSmrgfi[]dnl
54535c4bbdfSmrg])dnl _PKG_CONFIG
5464642e01fSmrg
54735c4bbdfSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
54835c4bbdfSmrgdnl ---------------------------
54935c4bbdfSmrgdnl Internal check to see if pkg-config supports short errors.
55035c4bbdfSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
55135c4bbdfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
55235c4bbdfSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
55335c4bbdfSmrg        _pkg_short_errors_supported=yes
55435c4bbdfSmrgelse
55535c4bbdfSmrg        _pkg_short_errors_supported=no
55635c4bbdfSmrgfi[]dnl
55735c4bbdfSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
5584642e01fSmrg
5594642e01fSmrg
56035c4bbdfSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
56135c4bbdfSmrgdnl   [ACTION-IF-NOT-FOUND])
56235c4bbdfSmrgdnl --------------------------------------------------------------
56335c4bbdfSmrgdnl Since: 0.4.0
56435c4bbdfSmrgdnl
56535c4bbdfSmrgdnl Note that if there is a possibility the first call to
56635c4bbdfSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
56735c4bbdfSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
56835c4bbdfSmrgAC_DEFUN([PKG_CHECK_MODULES],
56935c4bbdfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
57035c4bbdfSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
57135c4bbdfSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
5724642e01fSmrg
57335c4bbdfSmrgpkg_failed=no
574eee80088SmrgAC_MSG_CHECKING([for $2])
5754642e01fSmrg
57635c4bbdfSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
57735c4bbdfSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
5784642e01fSmrg
57935c4bbdfSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
58035c4bbdfSmrgand $1[]_LIBS to avoid the need to call pkg-config.
58135c4bbdfSmrgSee the pkg-config man page for more details.])
582475c125cSmrg
583475c125cSmrgif test $pkg_failed = yes; then
584eee80088Smrg        AC_MSG_RESULT([no])
585475c125cSmrg        _PKG_SHORT_ERRORS_SUPPORTED
586475c125cSmrg        if test $_pkg_short_errors_supported = yes; then
587eee80088Smrg                $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
588eee80088Smrg        else
589eee80088Smrg                $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
590475c125cSmrg        fi
591eee80088Smrg        # Put the nasty error message in config.log where it belongs
592eee80088Smrg        echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
593475c125cSmrg
594eee80088Smrg        m4_default([$4], [AC_MSG_ERROR(
595475c125cSmrg[Package requirements ($2) were not met:
596475c125cSmrg
597475c125cSmrg$$1_PKG_ERRORS
598475c125cSmrg
599475c125cSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
600475c125cSmrginstalled software in a non-standard prefix.
601475c125cSmrg
602475c125cSmrg_PKG_TEXT])[]dnl
603475c125cSmrg        ])
604475c125cSmrgelif test $pkg_failed = untried; then
605eee80088Smrg        AC_MSG_RESULT([no])
606eee80088Smrg        m4_default([$4], [AC_MSG_FAILURE(
607475c125cSmrg[The pkg-config script could not be found or is too old.  Make sure it
608475c125cSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
609475c125cSmrgpath to pkg-config.
610475c125cSmrg
611475c125cSmrg_PKG_TEXT
612475c125cSmrg
61335c4bbdfSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
614475c125cSmrg        ])
615475c125cSmrgelse
616eee80088Smrg        $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
617eee80088Smrg        $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
618475c125cSmrg        AC_MSG_RESULT([yes])
619eee80088Smrg        $3
620475c125cSmrgfi[]dnl
62135c4bbdfSmrg])dnl PKG_CHECK_MODULES
622475c125cSmrg
62335c4bbdfSmrg
62435c4bbdfSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
62535c4bbdfSmrgdnl   [ACTION-IF-NOT-FOUND])
62635c4bbdfSmrgdnl ---------------------------------------------------------------------
62735c4bbdfSmrgdnl Since: 0.29
6286747b715Smrgdnl
62935c4bbdfSmrgdnl Checks for existence of MODULES and gathers its build flags with
63035c4bbdfSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
63135c4bbdfSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
6326747b715Smrgdnl
63335c4bbdfSmrgdnl Note that if there is a possibility the first call to
63435c4bbdfSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
63535c4bbdfSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
63635c4bbdfSmrgdnl configure.ac.
63735c4bbdfSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
63835c4bbdfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
63935c4bbdfSmrg_save_PKG_CONFIG=$PKG_CONFIG
64035c4bbdfSmrgPKG_CONFIG="$PKG_CONFIG --static"
64135c4bbdfSmrgPKG_CHECK_MODULES($@)
64235c4bbdfSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
64335c4bbdfSmrg])dnl PKG_CHECK_MODULES_STATIC
64435c4bbdfSmrg
64535c4bbdfSmrg
64635c4bbdfSmrgdnl PKG_INSTALLDIR([DIRECTORY])
64735c4bbdfSmrgdnl -------------------------
64835c4bbdfSmrgdnl Since: 0.27
64935c4bbdfSmrgdnl
65035c4bbdfSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
65135c4bbdfSmrgdnl should install pkg-config .pc files. By default the directory is
65235c4bbdfSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
65335c4bbdfSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
65435c4bbdfSmrgdnl parameter.
65535c4bbdfSmrgAC_DEFUN([PKG_INSTALLDIR],
65635c4bbdfSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
65735c4bbdfSmrgm4_pushdef([pkg_description],
65835c4bbdfSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
65935c4bbdfSmrgAC_ARG_WITH([pkgconfigdir],
66035c4bbdfSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
66135c4bbdfSmrg    [with_pkgconfigdir=]pkg_default)
66235c4bbdfSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
66335c4bbdfSmrgm4_popdef([pkg_default])
66435c4bbdfSmrgm4_popdef([pkg_description])
66535c4bbdfSmrg])dnl PKG_INSTALLDIR
66635c4bbdfSmrg
66735c4bbdfSmrg
66835c4bbdfSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
66935c4bbdfSmrgdnl --------------------------------
67035c4bbdfSmrgdnl Since: 0.27
67135c4bbdfSmrgdnl
67235c4bbdfSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
67335c4bbdfSmrgdnl module should install arch-independent pkg-config .pc files. By
67435c4bbdfSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
67535c4bbdfSmrgdnl changed by passing DIRECTORY. The user can override through the
67635c4bbdfSmrgdnl --with-noarch-pkgconfigdir parameter.
67735c4bbdfSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
67835c4bbdfSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
67935c4bbdfSmrgm4_pushdef([pkg_description],
68035c4bbdfSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
68135c4bbdfSmrgAC_ARG_WITH([noarch-pkgconfigdir],
68235c4bbdfSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
68335c4bbdfSmrg    [with_noarch_pkgconfigdir=]pkg_default)
68435c4bbdfSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
68535c4bbdfSmrgm4_popdef([pkg_default])
68635c4bbdfSmrgm4_popdef([pkg_description])
68735c4bbdfSmrg])dnl PKG_NOARCH_INSTALLDIR
68835c4bbdfSmrg
68935c4bbdfSmrg
69035c4bbdfSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
69135c4bbdfSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
69235c4bbdfSmrgdnl -------------------------------------------
69335c4bbdfSmrgdnl Since: 0.28
69435c4bbdfSmrgdnl
69535c4bbdfSmrgdnl Retrieves the value of the pkg-config variable for the given module.
69635c4bbdfSmrgAC_DEFUN([PKG_CHECK_VAR],
69735c4bbdfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
69835c4bbdfSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
69935c4bbdfSmrg
70035c4bbdfSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
70135c4bbdfSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
70235c4bbdfSmrg
70335c4bbdfSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
70435c4bbdfSmrg])dnl PKG_CHECK_VAR
70535c4bbdfSmrg
7061b5d61b8Smrgdnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
7071b5d61b8Smrgdnl   [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
7081b5d61b8Smrgdnl   [DESCRIPTION], [DEFAULT])
7091b5d61b8Smrgdnl ------------------------------------------
7101b5d61b8Smrgdnl
7111b5d61b8Smrgdnl Prepare a "--with-" configure option using the lowercase
7121b5d61b8Smrgdnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
7131b5d61b8Smrgdnl PKG_CHECK_MODULES in a single macro.
7141b5d61b8SmrgAC_DEFUN([PKG_WITH_MODULES],
7151b5d61b8Smrg[
7161b5d61b8Smrgm4_pushdef([with_arg], m4_tolower([$1]))
7171b5d61b8Smrg
7181b5d61b8Smrgm4_pushdef([description],
7191b5d61b8Smrg           [m4_default([$5], [build with ]with_arg[ support])])
7201b5d61b8Smrg
7211b5d61b8Smrgm4_pushdef([def_arg], [m4_default([$6], [auto])])
7221b5d61b8Smrgm4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
7231b5d61b8Smrgm4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
7241b5d61b8Smrg
7251b5d61b8Smrgm4_case(def_arg,
7261b5d61b8Smrg            [yes],[m4_pushdef([with_without], [--without-]with_arg)],
7271b5d61b8Smrg            [m4_pushdef([with_without],[--with-]with_arg)])
7281b5d61b8Smrg
7291b5d61b8SmrgAC_ARG_WITH(with_arg,
7301b5d61b8Smrg     AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
7311b5d61b8Smrg    [AS_TR_SH([with_]with_arg)=def_arg])
7321b5d61b8Smrg
7331b5d61b8SmrgAS_CASE([$AS_TR_SH([with_]with_arg)],
7341b5d61b8Smrg            [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
7351b5d61b8Smrg            [auto],[PKG_CHECK_MODULES([$1],[$2],
7361b5d61b8Smrg                                        [m4_n([def_action_if_found]) $3],
7371b5d61b8Smrg                                        [m4_n([def_action_if_not_found]) $4])])
7381b5d61b8Smrg
7391b5d61b8Smrgm4_popdef([with_arg])
7401b5d61b8Smrgm4_popdef([description])
7411b5d61b8Smrgm4_popdef([def_arg])
7421b5d61b8Smrg
7431b5d61b8Smrg])dnl PKG_WITH_MODULES
7441b5d61b8Smrg
7451b5d61b8Smrgdnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
7461b5d61b8Smrgdnl   [DESCRIPTION], [DEFAULT])
7471b5d61b8Smrgdnl -----------------------------------------------
7481b5d61b8Smrgdnl
7491b5d61b8Smrgdnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
7501b5d61b8Smrgdnl check._[VARIABLE-PREFIX] is exported as make variable.
7511b5d61b8SmrgAC_DEFUN([PKG_HAVE_WITH_MODULES],
7521b5d61b8Smrg[
7531b5d61b8SmrgPKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
7541b5d61b8Smrg
7551b5d61b8SmrgAM_CONDITIONAL([HAVE_][$1],
7561b5d61b8Smrg               [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
7571b5d61b8Smrg])dnl PKG_HAVE_WITH_MODULES
7581b5d61b8Smrg
7591b5d61b8Smrgdnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
7601b5d61b8Smrgdnl   [DESCRIPTION], [DEFAULT])
7611b5d61b8Smrgdnl ------------------------------------------------------
7621b5d61b8Smrgdnl
7631b5d61b8Smrgdnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
7641b5d61b8Smrgdnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
7651b5d61b8Smrgdnl and preprocessor variable.
7661b5d61b8SmrgAC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
7671b5d61b8Smrg[
7681b5d61b8SmrgPKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
7691b5d61b8Smrg
7701b5d61b8SmrgAS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
7711b5d61b8Smrg        [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
7721b5d61b8Smrg])dnl PKG_HAVE_DEFINE_WITH_MODULES
7731b5d61b8Smrg
77435c4bbdfSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
77535c4bbdfSmrgdnl
776eee80088Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
7776747b715Smrgdnl
7786747b715Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
7796747b715Smrgdnl copy of this software and associated documentation files (the "Software"),
7806747b715Smrgdnl to deal in the Software without restriction, including without limitation
7816747b715Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
7826747b715Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
7836747b715Smrgdnl Software is furnished to do so, subject to the following conditions:
7846747b715Smrgdnl
7856747b715Smrgdnl The above copyright notice and this permission notice (including the next
7866747b715Smrgdnl paragraph) shall be included in all copies or substantial portions of the
7876747b715Smrgdnl Software.
7886747b715Smrgdnl
7896747b715Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
7906747b715Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
7916747b715Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
7926747b715Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
7936747b715Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
7946747b715Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
7956747b715Smrgdnl DEALINGS IN THE SOFTWARE.
7964642e01fSmrg
79735c4bbdfSmrg# XORG_MACROS_VERSION(required-version)
79835c4bbdfSmrg# -------------------------------------
7996747b715Smrg# Minimum version: 1.1.0
8006747b715Smrg#
8016747b715Smrg# If you're using a macro added in Version 1.1 or newer, include this in
8026747b715Smrg# your configure.ac with the minimum required version, such as:
80335c4bbdfSmrg# XORG_MACROS_VERSION(1.1)
8046747b715Smrg#
8056747b715Smrg# To ensure that this macro is defined, also add:
80635c4bbdfSmrg# m4_ifndef([XORG_MACROS_VERSION],
80735c4bbdfSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
8086747b715Smrg#
8096747b715Smrg#
8106747b715Smrg# See the "minimum version" comment for each macro you use to see what
8116747b715Smrg# version you require.
81235c4bbdfSmrgm4_defun([XORG_MACROS_VERSION],[
81354b5899cSmrgm4_define([vers_have], [1.20.2])
8146747b715Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
8156747b715Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
8166747b715Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
81735c4bbdfSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
8186747b715Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
81935c4bbdfSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
8206747b715Smrgm4_undefine([vers_have])
8216747b715Smrgm4_undefine([maj_have])
8226747b715Smrgm4_undefine([maj_needed])
82335c4bbdfSmrg]) # XORG_MACROS_VERSION
8244642e01fSmrg
82535c4bbdfSmrg# XORG_PROG_RAWCPP()
82635c4bbdfSmrg# ------------------
8276747b715Smrg# Minimum version: 1.0.0
8286747b715Smrg#
82935c4bbdfSmrg# Find cpp program and necessary flags for use in pre-processing text files
83035c4bbdfSmrg# such as man pages and config files
83135c4bbdfSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
83235c4bbdfSmrgAC_REQUIRE([AC_PROG_CPP])
833c82838c1SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
83435c4bbdfSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
8354642e01fSmrg
83635c4bbdfSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
83735c4bbdfSmrg# which is not the best choice for supporting other OS'es, but covers most
83835c4bbdfSmrg# of the ones we need for now.
83935c4bbdfSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
84035c4bbdfSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
84135c4bbdfSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
84235c4bbdfSmrg	AC_MSG_RESULT([no])
84335c4bbdfSmrgelse
84435c4bbdfSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
84535c4bbdfSmrg		RAWCPPFLAGS=-undef
84635c4bbdfSmrg		AC_MSG_RESULT([yes])
84735c4bbdfSmrg	# under Cygwin unix is still defined even with -undef
84835c4bbdfSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
84935c4bbdfSmrg		RAWCPPFLAGS="-undef -ansi"
85035c4bbdfSmrg		AC_MSG_RESULT([yes, with -ansi])
85135c4bbdfSmrg	else
85235c4bbdfSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
8536747b715Smrg	fi
85435c4bbdfSmrgfi
85535c4bbdfSmrgrm -f conftest.$ac_ext
8564642e01fSmrg
85735c4bbdfSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
85835c4bbdfSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
85958cf2af7Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
86035c4bbdfSmrg	AC_MSG_RESULT([no])
86135c4bbdfSmrgelse
86258cf2af7Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
86335c4bbdfSmrg		TRADITIONALCPPFLAGS="-traditional"
86435c4bbdfSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
86535c4bbdfSmrg		AC_MSG_RESULT([yes])
8666747b715Smrg	else
86735c4bbdfSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
8686747b715Smrg	fi
86935c4bbdfSmrgfi
87035c4bbdfSmrgrm -f conftest.$ac_ext
87135c4bbdfSmrgAC_SUBST(RAWCPPFLAGS)
87235c4bbdfSmrgAC_SUBST(TRADITIONALCPPFLAGS)
87335c4bbdfSmrg]) # XORG_PROG_RAWCPP
8744642e01fSmrg
87535c4bbdfSmrg# XORG_MANPAGE_SECTIONS()
87635c4bbdfSmrg# -----------------------
87735c4bbdfSmrg# Minimum version: 1.0.0
8784642e01fSmrg#
87935c4bbdfSmrg# Determine which sections man pages go in for the different man page types
88035c4bbdfSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
88135c4bbdfSmrg# Not sure if there's any better way than just hardcoding by OS name.
88235c4bbdfSmrg# Override default settings by setting environment variables
88335c4bbdfSmrg# Added MAN_SUBSTS in version 1.8
88435c4bbdfSmrg# Added AC_PROG_SED in version 1.8
8854642e01fSmrg
88635c4bbdfSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
88735c4bbdfSmrgAC_REQUIRE([AC_CANONICAL_HOST])
88835c4bbdfSmrgAC_REQUIRE([AC_PROG_SED])
8894642e01fSmrg
890c82838c1Smrgcase $host_os in
891c82838c1Smrg    solaris*)
892c82838c1Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
893c82838c1Smrg        # check for a man page file found in later versions that use
894c82838c1Smrg        # traditional section numbers instead
895c82838c1Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
896c82838c1Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
897c82838c1Smrg        ;;
898c82838c1Smrg    *) SYSV_MAN_SECTIONS=false ;;
899c82838c1Smrgesac
900c82838c1Smrg
90135c4bbdfSmrgif test x$APP_MAN_SUFFIX = x    ; then
90235c4bbdfSmrg    APP_MAN_SUFFIX=1
90335c4bbdfSmrgfi
90435c4bbdfSmrgif test x$APP_MAN_DIR = x    ; then
90535c4bbdfSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
90635c4bbdfSmrgfi
9074642e01fSmrg
90835c4bbdfSmrgif test x$LIB_MAN_SUFFIX = x    ; then
90935c4bbdfSmrg    LIB_MAN_SUFFIX=3
91035c4bbdfSmrgfi
91135c4bbdfSmrgif test x$LIB_MAN_DIR = x    ; then
91235c4bbdfSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
91335c4bbdfSmrgfi
9146747b715Smrg
91535c4bbdfSmrgif test x$FILE_MAN_SUFFIX = x    ; then
916c82838c1Smrg    case $SYSV_MAN_SECTIONS in
917c82838c1Smrg	true)				FILE_MAN_SUFFIX=4  ;;
918c82838c1Smrg	*)				FILE_MAN_SUFFIX=5  ;;
91935c4bbdfSmrg    esac
92035c4bbdfSmrgfi
92135c4bbdfSmrgif test x$FILE_MAN_DIR = x    ; then
92235c4bbdfSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
92335c4bbdfSmrgfi
9244642e01fSmrg
92535c4bbdfSmrgif test x$MISC_MAN_SUFFIX = x    ; then
926c82838c1Smrg    case $SYSV_MAN_SECTIONS in
927c82838c1Smrg	true)				MISC_MAN_SUFFIX=5  ;;
928c82838c1Smrg	*)				MISC_MAN_SUFFIX=7  ;;
92935c4bbdfSmrg    esac
93035c4bbdfSmrgfi
93135c4bbdfSmrgif test x$MISC_MAN_DIR = x    ; then
93235c4bbdfSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
93335c4bbdfSmrgfi
9346747b715Smrg
93535c4bbdfSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
936c82838c1Smrg    case $SYSV_MAN_SECTIONS in
937c82838c1Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
938c82838c1Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
93935c4bbdfSmrg    esac
94035c4bbdfSmrgfi
94135c4bbdfSmrgif test x$DRIVER_MAN_DIR = x    ; then
94235c4bbdfSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
94335c4bbdfSmrgfi
9444642e01fSmrg
94535c4bbdfSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
946c82838c1Smrg    case $SYSV_MAN_SECTIONS in
947c82838c1Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
948c82838c1Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
94935c4bbdfSmrg    esac
95035c4bbdfSmrgfi
95135c4bbdfSmrgif test x$ADMIN_MAN_DIR = x    ; then
95235c4bbdfSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
95335c4bbdfSmrgfi
95405b261ecSmrg
95505b261ecSmrg
95635c4bbdfSmrgAC_SUBST([APP_MAN_SUFFIX])
95735c4bbdfSmrgAC_SUBST([LIB_MAN_SUFFIX])
95835c4bbdfSmrgAC_SUBST([FILE_MAN_SUFFIX])
95935c4bbdfSmrgAC_SUBST([MISC_MAN_SUFFIX])
96035c4bbdfSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
96135c4bbdfSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
96235c4bbdfSmrgAC_SUBST([APP_MAN_DIR])
96335c4bbdfSmrgAC_SUBST([LIB_MAN_DIR])
96435c4bbdfSmrgAC_SUBST([FILE_MAN_DIR])
96535c4bbdfSmrgAC_SUBST([MISC_MAN_DIR])
96635c4bbdfSmrgAC_SUBST([DRIVER_MAN_DIR])
96735c4bbdfSmrgAC_SUBST([ADMIN_MAN_DIR])
96835c4bbdfSmrg
96935c4bbdfSmrgXORG_MAN_PAGE="X Version 11"
97035c4bbdfSmrgAC_SUBST([XORG_MAN_PAGE])
97135c4bbdfSmrgMAN_SUBSTS="\
97235c4bbdfSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
97335c4bbdfSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
97435c4bbdfSmrg	-e 's|__xservername__|Xorg|g' \
97535c4bbdfSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
97635c4bbdfSmrg	-e 's|__projectroot__|\$(prefix)|g' \
97735c4bbdfSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
97835c4bbdfSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
97935c4bbdfSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
98035c4bbdfSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
98135c4bbdfSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
98235c4bbdfSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
98335c4bbdfSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
98435c4bbdfSmrgAC_SUBST([MAN_SUBSTS])
98505b261ecSmrg
98635c4bbdfSmrg]) # XORG_MANPAGE_SECTIONS
98705b261ecSmrg
98835c4bbdfSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
98935c4bbdfSmrg# ------------------------
99035c4bbdfSmrg# Minimum version: 1.7.0
9916747b715Smrg#
99235c4bbdfSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
99335c4bbdfSmrg# provided by xorg-sgml-doctools, if installed.
99435c4bbdfSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
99535c4bbdfSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
99635c4bbdfSmrgXORG_SGML_PATH=
99735c4bbdfSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
99835c4bbdfSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
99935c4bbdfSmrg    [m4_ifval([$1],[:],
100035c4bbdfSmrg        [if test x"$cross_compiling" != x"yes" ; then
100135c4bbdfSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
100235c4bbdfSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
100335c4bbdfSmrg         fi])
100435c4bbdfSmrg    ])
100505b261ecSmrg
100635c4bbdfSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
100735c4bbdfSmrg# the path and the name of the doc stylesheet
100835c4bbdfSmrgif test "x$XORG_SGML_PATH" != "x" ; then
100935c4bbdfSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
101035c4bbdfSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
101135c4bbdfSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
101235c4bbdfSmrgelse
101335c4bbdfSmrg   AC_MSG_RESULT([no])
101435c4bbdfSmrgfi
1015b1d344b3Smrg
101635c4bbdfSmrgAC_SUBST(XORG_SGML_PATH)
101735c4bbdfSmrgAC_SUBST(STYLESHEET_SRCDIR)
101835c4bbdfSmrgAC_SUBST(XSL_STYLESHEET)
101935c4bbdfSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
102035c4bbdfSmrg]) # XORG_CHECK_SGML_DOCTOOLS
102105b261ecSmrg
102235c4bbdfSmrg# XORG_CHECK_LINUXDOC
102335c4bbdfSmrg# -------------------
102435c4bbdfSmrg# Minimum version: 1.0.0
102535c4bbdfSmrg#
102635c4bbdfSmrg# Defines the variable MAKE_TEXT if the necessary tools and
102735c4bbdfSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
102835c4bbdfSmrg# Whether or not the necessary tools and files are found can be checked
102935c4bbdfSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
103035c4bbdfSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
103135c4bbdfSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
103235c4bbdfSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1033b1d344b3Smrg
103435c4bbdfSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
103505b261ecSmrg
103635c4bbdfSmrgAC_MSG_CHECKING([whether to build documentation])
103705b261ecSmrg
103835c4bbdfSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
103935c4bbdfSmrg   BUILDDOC=yes
104035c4bbdfSmrgelse
104135c4bbdfSmrg   BUILDDOC=no
104235c4bbdfSmrgfi
104305b261ecSmrg
104435c4bbdfSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
104505b261ecSmrg
104635c4bbdfSmrgAC_MSG_RESULT([$BUILDDOC])
104705b261ecSmrg
104835c4bbdfSmrgAC_MSG_CHECKING([whether to build pdf documentation])
104905b261ecSmrg
105035c4bbdfSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
105135c4bbdfSmrg   BUILDPDFDOC=yes
105235c4bbdfSmrgelse
105335c4bbdfSmrg   BUILDPDFDOC=no
105435c4bbdfSmrgfi
1055475c125cSmrg
105635c4bbdfSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1057475c125cSmrg
105835c4bbdfSmrgAC_MSG_RESULT([$BUILDPDFDOC])
105905b261ecSmrg
106035c4bbdfSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
106135c4bbdfSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
106235c4bbdfSmrgMAKE_PDF="$PS2PDF"
106335c4bbdfSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
10644642e01fSmrg
10654642e01fSmrgAC_SUBST(MAKE_TEXT)
10664642e01fSmrgAC_SUBST(MAKE_PS)
10674642e01fSmrgAC_SUBST(MAKE_PDF)
10684642e01fSmrgAC_SUBST(MAKE_HTML)
10694642e01fSmrg]) # XORG_CHECK_LINUXDOC
10704642e01fSmrg
10714642e01fSmrg# XORG_CHECK_DOCBOOK
10724642e01fSmrg# -------------------
10734642e01fSmrg# Minimum version: 1.0.0
10744642e01fSmrg#
10754642e01fSmrg# Checks for the ability to build output formats from SGML DocBook source.
10764642e01fSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
10774642e01fSmrg# indicates whether the necessary tools and files are found and, if set,
10784642e01fSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
10794642e01fSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
10806747b715SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
10816747b715Smrg
10824642e01fSmrgBUILDTXTDOC=no
10834642e01fSmrgBUILDPDFDOC=no
10844642e01fSmrgBUILDPSDOC=no
10854642e01fSmrgBUILDHTMLDOC=no
10864642e01fSmrg
10874642e01fSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
10884642e01fSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
10894642e01fSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
10904642e01fSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
10914642e01fSmrg
10926747b715SmrgAC_MSG_CHECKING([whether to build text documentation])
10936747b715Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
10944642e01fSmrg   test x$BUILD_TXTDOC != xno; then
10954642e01fSmrg	BUILDTXTDOC=yes
10964642e01fSmrgfi
10974642e01fSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
10984642e01fSmrgAC_MSG_RESULT([$BUILDTXTDOC])
10994642e01fSmrg
11006747b715SmrgAC_MSG_CHECKING([whether to build PDF documentation])
11016747b715Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
11024642e01fSmrg   test x$BUILD_PDFDOC != xno; then
11034642e01fSmrg	BUILDPDFDOC=yes
11044642e01fSmrgfi
11054642e01fSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
11064642e01fSmrgAC_MSG_RESULT([$BUILDPDFDOC])
11074642e01fSmrg
11086747b715SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
11096747b715Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
11104642e01fSmrg   test x$BUILD_PSDOC != xno; then
11114642e01fSmrg	BUILDPSDOC=yes
11124642e01fSmrgfi
11134642e01fSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
11144642e01fSmrgAC_MSG_RESULT([$BUILDPSDOC])
11154642e01fSmrg
11166747b715SmrgAC_MSG_CHECKING([whether to build HTML documentation])
11176747b715Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
11184642e01fSmrg   test x$BUILD_HTMLDOC != xno; then
11194642e01fSmrg	BUILDHTMLDOC=yes
11204642e01fSmrgfi
11214642e01fSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
11224642e01fSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
11234642e01fSmrg
11244642e01fSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
11254642e01fSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
11264642e01fSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
11274642e01fSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
11284642e01fSmrg
11294642e01fSmrgAC_SUBST(MAKE_TEXT)
11304642e01fSmrgAC_SUBST(MAKE_PS)
11314642e01fSmrgAC_SUBST(MAKE_PDF)
11324642e01fSmrgAC_SUBST(MAKE_HTML)
11334642e01fSmrg]) # XORG_CHECK_DOCBOOK
11344642e01fSmrg
11356747b715Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
11366747b715Smrg# ----------------
11376747b715Smrg# Minimum version: 1.5.0
11386747b715Smrg# Minimum version for optional DEFAULT argument: 1.11.0
11396747b715Smrg#
11406747b715Smrg# Documentation tools are not always available on all platforms and sometimes
11416747b715Smrg# not at the appropriate level. This macro enables a module to test for the
11426747b715Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1143eee80088Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
11446747b715Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
11456747b715Smrg# --with-xmlto assumes 'auto'.
11466747b715Smrg#
11476747b715Smrg# Interface to module:
11486747b715Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
11496747b715Smrg# XMLTO:	returns the path of the xmlto program found
11506747b715Smrg#		returns the path set by the user in the environment
11516747b715Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
11526747b715Smrg#		'no' user instructs the module not to use xmlto
11536747b715Smrg#
11546747b715Smrg# Added in version 1.10.0
11556747b715Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
11566747b715Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
11576747b715Smrg#
11586747b715Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
11596747b715Smrg#
11606747b715SmrgAC_DEFUN([XORG_WITH_XMLTO],[
11616747b715SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
11626747b715Smrgm4_define([_defopt], m4_default([$2], [auto]))
11636747b715SmrgAC_ARG_WITH(xmlto,
11646747b715Smrg	AS_HELP_STRING([--with-xmlto],
11656747b715Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
11666747b715Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
11676747b715Smrgm4_undefine([_defopt])
11686747b715Smrg
11696747b715Smrgif test "x$use_xmlto" = x"auto"; then
11706747b715Smrg   AC_PATH_PROG([XMLTO], [xmlto])
11716747b715Smrg   if test "x$XMLTO" = "x"; then
11726747b715Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
11736747b715Smrg	have_xmlto=no
11746747b715Smrg   else
11756747b715Smrg        have_xmlto=yes
11766747b715Smrg   fi
11776747b715Smrgelif test "x$use_xmlto" = x"yes" ; then
11786747b715Smrg   AC_PATH_PROG([XMLTO], [xmlto])
11796747b715Smrg   if test "x$XMLTO" = "x"; then
11806747b715Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
11816747b715Smrg   fi
11826747b715Smrg   have_xmlto=yes
11836747b715Smrgelif test "x$use_xmlto" = x"no" ; then
11846747b715Smrg   if test "x$XMLTO" != "x"; then
11856747b715Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
11866747b715Smrg   fi
11876747b715Smrg   have_xmlto=no
11886747b715Smrgelse
11896747b715Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
11906747b715Smrgfi
11916747b715Smrg
11926747b715Smrg# Test for a minimum version of xmlto, if provided.
11936747b715Smrgm4_ifval([$1],
11946747b715Smrg[if test "$have_xmlto" = yes; then
11956747b715Smrg    # scrape the xmlto version
11966747b715Smrg    AC_MSG_CHECKING([the xmlto version])
11976747b715Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
11986747b715Smrg    AC_MSG_RESULT([$xmlto_version])
11996747b715Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
12006747b715Smrg        [if test "x$use_xmlto" = xauto; then
12016747b715Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
12026747b715Smrg            have_xmlto=no
12036747b715Smrg        else
12046747b715Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
12056747b715Smrg        fi])
12066747b715Smrgfi])
12076747b715Smrg
12086747b715Smrg# Test for the ability of xmlto to generate a text target
1209e23ec014Smrg#
1210e23ec014Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
1211e23ec014Smrg# following test for empty XML docbook files.
1212e23ec014Smrg# For compatibility reasons use the following empty XML docbook file and if
1213e23ec014Smrg# it fails try it again with a non-empty XML file.
12146747b715Smrghave_xmlto_text=no
12156747b715Smrgcat > conftest.xml << "EOF"
12166747b715SmrgEOF
12176747b715SmrgAS_IF([test "$have_xmlto" = yes],
12186747b715Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
12196747b715Smrg             [have_xmlto_text=yes],
1220e23ec014Smrg             [# Try it again with a non-empty XML file.
1221e23ec014Smrg              cat > conftest.xml << "EOF"
1222e23ec014Smrg<x></x>
1223e23ec014SmrgEOF
1224e23ec014Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1225e23ec014Smrg                    [have_xmlto_text=yes],
1226e23ec014Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
12276747b715Smrgrm -f conftest.xml
12286747b715SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
12296747b715SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
12306747b715Smrg]) # XORG_WITH_XMLTO
12316747b715Smrg
12328223e2f2Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
12338223e2f2Smrg# --------------------------------------------
12348223e2f2Smrg# Minimum version: 1.12.0
12358223e2f2Smrg# Minimum version for optional DEFAULT argument: 1.12.0
12368223e2f2Smrg#
12378223e2f2Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
12388223e2f2Smrg# XML-based language used for the transformation of XML documents.
12398223e2f2Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
12408223e2f2Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
12418223e2f2Smrg# The XSLT processor is often used as a standalone tool for transformations.
12428223e2f2Smrg# It should not be assumed that this tool is used only to work with documnetation.
12438223e2f2Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
12448223e2f2Smrg#
12458223e2f2Smrg# Interface to module:
12468223e2f2Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
12478223e2f2Smrg# XSLTPROC:	 returns the path of the xsltproc program found
12488223e2f2Smrg#		 returns the path set by the user in the environment
12498223e2f2Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
12508223e2f2Smrg#		  'no' user instructs the module not to use xsltproc
12518223e2f2Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
12528223e2f2Smrg#
12538223e2f2Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
12548223e2f2Smrg#
12558223e2f2SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
12568223e2f2SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1257475c125cSmrg# Preserves the interface, should it be implemented later
1258475c125cSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
12598223e2f2Smrgm4_define([_defopt], m4_default([$2], [auto]))
12608223e2f2SmrgAC_ARG_WITH(xsltproc,
12618223e2f2Smrg	AS_HELP_STRING([--with-xsltproc],
12628223e2f2Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
12638223e2f2Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
12648223e2f2Smrgm4_undefine([_defopt])
12658223e2f2Smrg
12668223e2f2Smrgif test "x$use_xsltproc" = x"auto"; then
12678223e2f2Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
12688223e2f2Smrg   if test "x$XSLTPROC" = "x"; then
12698223e2f2Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
12708223e2f2Smrg	have_xsltproc=no
12718223e2f2Smrg   else
12728223e2f2Smrg        have_xsltproc=yes
12738223e2f2Smrg   fi
12748223e2f2Smrgelif test "x$use_xsltproc" = x"yes" ; then
12758223e2f2Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
12768223e2f2Smrg   if test "x$XSLTPROC" = "x"; then
12778223e2f2Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
12788223e2f2Smrg   fi
12798223e2f2Smrg   have_xsltproc=yes
12808223e2f2Smrgelif test "x$use_xsltproc" = x"no" ; then
12818223e2f2Smrg   if test "x$XSLTPROC" != "x"; then
12828223e2f2Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
12838223e2f2Smrg   fi
12848223e2f2Smrg   have_xsltproc=no
12858223e2f2Smrgelse
12868223e2f2Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
12878223e2f2Smrgfi
12888223e2f2Smrg
12898223e2f2SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
12908223e2f2Smrg]) # XORG_WITH_XSLTPROC
12918223e2f2Smrg
1292475c125cSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1293475c125cSmrg# ----------------------------------------
1294475c125cSmrg# Minimum version: 1.15.0
1295475c125cSmrg#
1296475c125cSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
1297475c125cSmrg# scanning arbitrary text files, extracting information from those text files,
1298475c125cSmrg# and printing reports based on that information.
1299475c125cSmrg#
1300475c125cSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1301475c125cSmrg#
1302475c125cSmrg# Interface to module:
1303475c125cSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
1304475c125cSmrg# PERL:	     returns the path of the perl program found
1305475c125cSmrg#	     returns the path set by the user in the environment
1306475c125cSmrg# --with-perl: 'yes' user instructs the module to use perl
1307475c125cSmrg#	       'no' user instructs the module not to use perl
1308475c125cSmrg# have_perl: returns yes if perl found in PATH or no
1309475c125cSmrg#
1310475c125cSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1311475c125cSmrg#
1312475c125cSmrgAC_DEFUN([XORG_WITH_PERL],[
1313475c125cSmrgAC_ARG_VAR([PERL], [Path to perl command])
1314475c125cSmrg# Preserves the interface, should it be implemented later
1315475c125cSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1316475c125cSmrgm4_define([_defopt], m4_default([$2], [auto]))
1317475c125cSmrgAC_ARG_WITH(perl,
1318475c125cSmrg	AS_HELP_STRING([--with-perl],
1319475c125cSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1320475c125cSmrg	   [use_perl=$withval], [use_perl=]_defopt)
1321475c125cSmrgm4_undefine([_defopt])
1322475c125cSmrg
1323475c125cSmrgif test "x$use_perl" = x"auto"; then
1324475c125cSmrg   AC_PATH_PROG([PERL], [perl])
1325475c125cSmrg   if test "x$PERL" = "x"; then
1326475c125cSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1327475c125cSmrg	have_perl=no
1328475c125cSmrg   else
1329475c125cSmrg        have_perl=yes
1330475c125cSmrg   fi
1331475c125cSmrgelif test "x$use_perl" = x"yes" ; then
1332475c125cSmrg   AC_PATH_PROG([PERL], [perl])
1333475c125cSmrg   if test "x$PERL" = "x"; then
1334475c125cSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1335475c125cSmrg   fi
1336475c125cSmrg   have_perl=yes
1337475c125cSmrgelif test "x$use_perl" = x"no" ; then
1338475c125cSmrg   if test "x$PERL" != "x"; then
1339475c125cSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1340475c125cSmrg   fi
1341475c125cSmrg   have_perl=no
1342475c125cSmrgelse
1343475c125cSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1344475c125cSmrgfi
1345475c125cSmrg
1346475c125cSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1347475c125cSmrg]) # XORG_WITH_PERL
13488223e2f2Smrg
13496747b715Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
13506747b715Smrg# ----------------
13516747b715Smrg# Minimum version: 1.5.0
13526747b715Smrg# Minimum version for optional DEFAULT argument: 1.11.0
13536747b715Smrg#
13546747b715Smrg# Documentation tools are not always available on all platforms and sometimes
13556747b715Smrg# not at the appropriate level. This macro enables a module to test for the
13566747b715Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1357eee80088Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
13586747b715Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
13596747b715Smrg# --with-asciidoc assumes 'auto'.
13606747b715Smrg#
13616747b715Smrg# Interface to module:
13626747b715Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
13636747b715Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
13646747b715Smrg#		 returns the path set by the user in the environment
13656747b715Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
13666747b715Smrg#		  'no' user instructs the module not to use asciidoc
13676747b715Smrg#
13686747b715Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
13696747b715Smrg#
13706747b715SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
13716747b715SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
13726747b715Smrgm4_define([_defopt], m4_default([$2], [auto]))
13736747b715SmrgAC_ARG_WITH(asciidoc,
13746747b715Smrg	AS_HELP_STRING([--with-asciidoc],
13756747b715Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
13766747b715Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
13776747b715Smrgm4_undefine([_defopt])
13786747b715Smrg
13796747b715Smrgif test "x$use_asciidoc" = x"auto"; then
13806747b715Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
13816747b715Smrg   if test "x$ASCIIDOC" = "x"; then
13826747b715Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
13836747b715Smrg	have_asciidoc=no
13846747b715Smrg   else
13856747b715Smrg        have_asciidoc=yes
13866747b715Smrg   fi
13876747b715Smrgelif test "x$use_asciidoc" = x"yes" ; then
13886747b715Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
13896747b715Smrg   if test "x$ASCIIDOC" = "x"; then
13906747b715Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
13916747b715Smrg   fi
13926747b715Smrg   have_asciidoc=yes
13936747b715Smrgelif test "x$use_asciidoc" = x"no" ; then
13946747b715Smrg   if test "x$ASCIIDOC" != "x"; then
13956747b715Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
13966747b715Smrg   fi
13976747b715Smrg   have_asciidoc=no
13986747b715Smrgelse
13996747b715Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
14006747b715Smrgfi
14016747b715Smrgm4_ifval([$1],
14026747b715Smrg[if test "$have_asciidoc" = yes; then
14036747b715Smrg    # scrape the asciidoc version
14046747b715Smrg    AC_MSG_CHECKING([the asciidoc version])
14056747b715Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
14066747b715Smrg    AC_MSG_RESULT([$asciidoc_version])
14076747b715Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
14086747b715Smrg        [if test "x$use_asciidoc" = xauto; then
14096747b715Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
14106747b715Smrg            have_asciidoc=no
14116747b715Smrg        else
14126747b715Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
14136747b715Smrg        fi])
14146747b715Smrgfi])
14156747b715SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
14166747b715Smrg]) # XORG_WITH_ASCIIDOC
14176747b715Smrg
14186747b715Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
141935c4bbdfSmrg# -------------------------------------------
14206747b715Smrg# Minimum version: 1.5.0
14216747b715Smrg# Minimum version for optional DEFAULT argument: 1.11.0
142235c4bbdfSmrg# Minimum version for optional DOT checking: 1.18.0
14236747b715Smrg#
14246747b715Smrg# Documentation tools are not always available on all platforms and sometimes
14256747b715Smrg# not at the appropriate level. This macro enables a module to test for the
14266747b715Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1427eee80088Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
14286747b715Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
14296747b715Smrg# --with-doxygen assumes 'auto'.
14306747b715Smrg#
14316747b715Smrg# Interface to module:
14326747b715Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
14336747b715Smrg# DOXYGEN:	 returns the path of the doxygen program found
14346747b715Smrg#		 returns the path set by the user in the environment
14356747b715Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
14366747b715Smrg#		  'no' user instructs the module not to use doxygen
14376747b715Smrg#
14386747b715Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
14396747b715Smrg#
14406747b715SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
14416747b715SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
144235c4bbdfSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
14436747b715Smrgm4_define([_defopt], m4_default([$2], [auto]))
14446747b715SmrgAC_ARG_WITH(doxygen,
14456747b715Smrg	AS_HELP_STRING([--with-doxygen],
14466747b715Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
14476747b715Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
14486747b715Smrgm4_undefine([_defopt])
14496747b715Smrg
14506747b715Smrgif test "x$use_doxygen" = x"auto"; then
14516747b715Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
14526747b715Smrg   if test "x$DOXYGEN" = "x"; then
14536747b715Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
14546747b715Smrg	have_doxygen=no
14556747b715Smrg   else
14566747b715Smrg        have_doxygen=yes
14576747b715Smrg   fi
14586747b715Smrgelif test "x$use_doxygen" = x"yes" ; then
14596747b715Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
14606747b715Smrg   if test "x$DOXYGEN" = "x"; then
14616747b715Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
14626747b715Smrg   fi
14636747b715Smrg   have_doxygen=yes
14646747b715Smrgelif test "x$use_doxygen" = x"no" ; then
14656747b715Smrg   if test "x$DOXYGEN" != "x"; then
14666747b715Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
14676747b715Smrg   fi
14686747b715Smrg   have_doxygen=no
14696747b715Smrgelse
14706747b715Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
14716747b715Smrgfi
14726747b715Smrgm4_ifval([$1],
14736747b715Smrg[if test "$have_doxygen" = yes; then
14746747b715Smrg    # scrape the doxygen version
14756747b715Smrg    AC_MSG_CHECKING([the doxygen version])
14766747b715Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
14776747b715Smrg    AC_MSG_RESULT([$doxygen_version])
14786747b715Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
14796747b715Smrg        [if test "x$use_doxygen" = xauto; then
14806747b715Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
14816747b715Smrg            have_doxygen=no
14826747b715Smrg        else
14836747b715Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
14846747b715Smrg        fi])
14856747b715Smrgfi])
148635c4bbdfSmrg
148735c4bbdfSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
148835c4bbdfSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
148935c4bbdfSmrgdnl 	HAVE_DOT = @HAVE_DOT@
149035c4bbdfSmrgHAVE_DOT=no
149135c4bbdfSmrgif test "x$have_doxygen" = "xyes"; then
149235c4bbdfSmrg  AC_PATH_PROG([DOT], [dot])
149335c4bbdfSmrg    if test "x$DOT" != "x"; then
149435c4bbdfSmrg      HAVE_DOT=yes
149535c4bbdfSmrg    fi
149635c4bbdfSmrgfi
149735c4bbdfSmrg
149835c4bbdfSmrgAC_SUBST([HAVE_DOT])
149935c4bbdfSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
15006747b715SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
15016747b715Smrg]) # XORG_WITH_DOXYGEN
15026747b715Smrg
15036747b715Smrg# XORG_WITH_GROFF([DEFAULT])
15046747b715Smrg# ----------------
15056747b715Smrg# Minimum version: 1.6.0
15066747b715Smrg# Minimum version for optional DEFAULT argument: 1.11.0
15076747b715Smrg#
15086747b715Smrg# Documentation tools are not always available on all platforms and sometimes
15096747b715Smrg# not at the appropriate level. This macro enables a module to test for the
15106747b715Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1511eee80088Smrg# the --with-groff option, it allows maximum flexibility in making decisions
15126747b715Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
15136747b715Smrg# --with-groff assumes 'auto'.
15146747b715Smrg#
15156747b715Smrg# Interface to module:
15166747b715Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
15176747b715Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
15186747b715Smrg# HAVE_GROFF_MS: the -ms macros package
15196747b715Smrg# GROFF:	 returns the path of the groff program found
15206747b715Smrg#		 returns the path set by the user in the environment
15216747b715Smrg# --with-groff:	 'yes' user instructs the module to use groff
15226747b715Smrg#		 'no' user instructs the module not to use groff
15236747b715Smrg#
15246747b715Smrg# Added in version 1.9.0:
15256747b715Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
15266747b715Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
15276747b715Smrg#		   psselect from the psutils package.
15286747b715Smrg#		   the ghostcript package. Refer to the grohtml man pages
15296747b715Smrg#
15306747b715Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
15316747b715Smrg#
15326747b715Smrg# OS and distros often splits groff in a basic and full package, the former
15336747b715Smrg# having the groff program and the later having devices, fonts and macros
15346747b715Smrg# Checking for the groff executable is not enough.
15356747b715Smrg#
15366747b715Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
15376747b715Smrg# unset HAVE_GROFF or GROFF env variables.
15386747b715Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
15396747b715Smrg#
15406747b715SmrgAC_DEFUN([XORG_WITH_GROFF],[
15416747b715SmrgAC_ARG_VAR([GROFF], [Path to groff command])
15426747b715Smrgm4_define([_defopt], m4_default([$1], [auto]))
15436747b715SmrgAC_ARG_WITH(groff,
15446747b715Smrg	AS_HELP_STRING([--with-groff],
15456747b715Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
15466747b715Smrg	   [use_groff=$withval], [use_groff=]_defopt)
15476747b715Smrgm4_undefine([_defopt])
15486747b715Smrg
15496747b715Smrgif test "x$use_groff" = x"auto"; then
15506747b715Smrg   AC_PATH_PROG([GROFF], [groff])
15516747b715Smrg   if test "x$GROFF" = "x"; then
15526747b715Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
15536747b715Smrg	have_groff=no
15546747b715Smrg   else
15556747b715Smrg        have_groff=yes
15566747b715Smrg   fi
15576747b715Smrgelif test "x$use_groff" = x"yes" ; then
15586747b715Smrg   AC_PATH_PROG([GROFF], [groff])
15596747b715Smrg   if test "x$GROFF" = "x"; then
15606747b715Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
15616747b715Smrg   fi
15626747b715Smrg   have_groff=yes
15636747b715Smrgelif test "x$use_groff" = x"no" ; then
15646747b715Smrg   if test "x$GROFF" != "x"; then
15656747b715Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
15666747b715Smrg   fi
15676747b715Smrg   have_groff=no
15686747b715Smrgelse
15696747b715Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
15706747b715Smrgfi
15716747b715Smrg
15726747b715Smrg# We have groff, test for the presence of the macro packages
15736747b715Smrgif test "x$have_groff" = x"yes"; then
15746747b715Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
15756747b715Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
15766747b715Smrg        groff_ms_works=yes
15776747b715Smrg    else
15786747b715Smrg        groff_ms_works=no
15796747b715Smrg    fi
15806747b715Smrg    AC_MSG_RESULT([$groff_ms_works])
15816747b715Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
15826747b715Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
15836747b715Smrg        groff_mm_works=yes
15846747b715Smrg    else
15856747b715Smrg        groff_mm_works=no
15866747b715Smrg    fi
15876747b715Smrg    AC_MSG_RESULT([$groff_mm_works])
15886747b715Smrgfi
15896747b715Smrg
15906747b715Smrg# We have groff, test for HTML dependencies, one command per package
15916747b715Smrgif test "x$have_groff" = x"yes"; then
15926747b715Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
15936747b715Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
15946747b715Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
15956747b715Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
15966747b715Smrg      have_groff_html=yes
15976747b715Smrg   else
15986747b715Smrg      have_groff_html=no
15996747b715Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
16006747b715Smrg   fi
16016747b715Smrgfi
16026747b715Smrg
16036747b715Smrg# Set Automake conditionals for Makefiles
16046747b715SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
16056747b715SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
16066747b715SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
16076747b715SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
16086747b715Smrg]) # XORG_WITH_GROFF
16096747b715Smrg
1610475c125cSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
1611475c125cSmrg# ---------------------------------------
16126747b715Smrg# Minimum version: 1.6.0
16136747b715Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1614475c125cSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
16156747b715Smrg#
16166747b715Smrg# Documentation tools are not always available on all platforms and sometimes
16176747b715Smrg# not at the appropriate level. This macro enables a module to test for the
16186747b715Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1619eee80088Smrg# the --with-fop option, it allows maximum flexibility in making decisions
16206747b715Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
16216747b715Smrg# --with-fop assumes 'auto'.
16226747b715Smrg#
16236747b715Smrg# Interface to module:
16246747b715Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
16256747b715Smrg# FOP:	 	returns the path of the fop program found
16266747b715Smrg#		returns the path set by the user in the environment
16276747b715Smrg# --with-fop: 	'yes' user instructs the module to use fop
16286747b715Smrg#		'no' user instructs the module not to use fop
16296747b715Smrg#
16306747b715Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
16316747b715Smrg#
16326747b715SmrgAC_DEFUN([XORG_WITH_FOP],[
16336747b715SmrgAC_ARG_VAR([FOP], [Path to fop command])
1634475c125cSmrgm4_define([_defopt], m4_default([$2], [auto]))
16356747b715SmrgAC_ARG_WITH(fop,
16366747b715Smrg	AS_HELP_STRING([--with-fop],
16376747b715Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
16386747b715Smrg	   [use_fop=$withval], [use_fop=]_defopt)
16396747b715Smrgm4_undefine([_defopt])
16406747b715Smrg
16416747b715Smrgif test "x$use_fop" = x"auto"; then
16426747b715Smrg   AC_PATH_PROG([FOP], [fop])
16436747b715Smrg   if test "x$FOP" = "x"; then
16446747b715Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
16456747b715Smrg	have_fop=no
16466747b715Smrg   else
16476747b715Smrg        have_fop=yes
16486747b715Smrg   fi
16496747b715Smrgelif test "x$use_fop" = x"yes" ; then
16506747b715Smrg   AC_PATH_PROG([FOP], [fop])
16516747b715Smrg   if test "x$FOP" = "x"; then
16526747b715Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
16536747b715Smrg   fi
16546747b715Smrg   have_fop=yes
16556747b715Smrgelif test "x$use_fop" = x"no" ; then
16566747b715Smrg   if test "x$FOP" != "x"; then
16576747b715Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
16586747b715Smrg   fi
16596747b715Smrg   have_fop=no
16606747b715Smrgelse
16616747b715Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
16626747b715Smrgfi
1663475c125cSmrg
1664475c125cSmrg# Test for a minimum version of fop, if provided.
1665475c125cSmrgm4_ifval([$1],
1666475c125cSmrg[if test "$have_fop" = yes; then
1667475c125cSmrg    # scrape the fop version
1668475c125cSmrg    AC_MSG_CHECKING([for fop minimum version])
1669475c125cSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
1670475c125cSmrg    AC_MSG_RESULT([$fop_version])
1671475c125cSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
1672475c125cSmrg        [if test "x$use_fop" = xauto; then
1673475c125cSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
1674475c125cSmrg            have_fop=no
1675475c125cSmrg        else
1676475c125cSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
1677475c125cSmrg        fi])
1678475c125cSmrgfi])
16796747b715SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
16806747b715Smrg]) # XORG_WITH_FOP
16816747b715Smrg
168235c4bbdfSmrg# XORG_WITH_M4([MIN-VERSION])
168335c4bbdfSmrg# ---------------------------
168435c4bbdfSmrg# Minimum version: 1.19.0
168535c4bbdfSmrg#
168635c4bbdfSmrg# This macro attempts to locate an m4 macro processor which supports
168735c4bbdfSmrg# -I option and is only useful for modules relying on M4 in order to
168835c4bbdfSmrg# expand macros in source code files.
168935c4bbdfSmrg#
169035c4bbdfSmrg# Interface to module:
169135c4bbdfSmrg# M4:	 	returns the path of the m4 program found
169235c4bbdfSmrg#		returns the path set by the user in the environment
169335c4bbdfSmrg#
169435c4bbdfSmrgAC_DEFUN([XORG_WITH_M4], [
169535c4bbdfSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
169635c4bbdfSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
169735c4bbdfSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
169835c4bbdfSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
169935c4bbdfSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
170035c4bbdfSmrg   [$PATH:/usr/gnu/bin])])
170135c4bbdfSmrg
170235c4bbdfSmrgAC_SUBST([M4], [$ac_cv_path_M4])
170335c4bbdfSmrg]) # XORG_WITH_M4
170435c4bbdfSmrg
17056747b715Smrg# XORG_WITH_PS2PDF([DEFAULT])
17066747b715Smrg# ----------------
17076747b715Smrg# Minimum version: 1.6.0
17086747b715Smrg# Minimum version for optional DEFAULT argument: 1.11.0
17096747b715Smrg#
17106747b715Smrg# Documentation tools are not always available on all platforms and sometimes
17116747b715Smrg# not at the appropriate level. This macro enables a module to test for the
17126747b715Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1713eee80088Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
17146747b715Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
17156747b715Smrg# --with-ps2pdf assumes 'auto'.
17166747b715Smrg#
17176747b715Smrg# Interface to module:
17186747b715Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
17196747b715Smrg# PS2PDF:	returns the path of the ps2pdf program found
17206747b715Smrg#		returns the path set by the user in the environment
17216747b715Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
17226747b715Smrg#		 'no' user instructs the module not to use ps2pdf
17236747b715Smrg#
17246747b715Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
17256747b715Smrg#
17266747b715SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
17276747b715SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
17286747b715Smrgm4_define([_defopt], m4_default([$1], [auto]))
17296747b715SmrgAC_ARG_WITH(ps2pdf,
17306747b715Smrg	AS_HELP_STRING([--with-ps2pdf],
17316747b715Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
17326747b715Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
17336747b715Smrgm4_undefine([_defopt])
17346747b715Smrg
17356747b715Smrgif test "x$use_ps2pdf" = x"auto"; then
17366747b715Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
17376747b715Smrg   if test "x$PS2PDF" = "x"; then
17386747b715Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
17396747b715Smrg	have_ps2pdf=no
17406747b715Smrg   else
17416747b715Smrg        have_ps2pdf=yes
17426747b715Smrg   fi
17436747b715Smrgelif test "x$use_ps2pdf" = x"yes" ; then
17446747b715Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
17456747b715Smrg   if test "x$PS2PDF" = "x"; then
17466747b715Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
17476747b715Smrg   fi
17486747b715Smrg   have_ps2pdf=yes
17496747b715Smrgelif test "x$use_ps2pdf" = x"no" ; then
17506747b715Smrg   if test "x$PS2PDF" != "x"; then
17516747b715Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
17526747b715Smrg   fi
17536747b715Smrg   have_ps2pdf=no
17546747b715Smrgelse
17556747b715Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
17566747b715Smrgfi
17576747b715SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
17586747b715Smrg]) # XORG_WITH_PS2PDF
17596747b715Smrg
17606747b715Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
17616747b715Smrg# ----------------
17626747b715Smrg# Minimum version: 1.6.0
17636747b715Smrg#
17646747b715Smrg# Documentation tools are not always available on all platforms and sometimes
17656747b715Smrg# not at the appropriate level. This macro enables a builder to skip all
17666747b715Smrg# documentation targets except traditional man pages.
17676747b715Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1768eee80088Smrg# maximum flexibility in controlling documentation building.
17696747b715Smrg# Refer to:
17706747b715Smrg# XORG_WITH_XMLTO         --with-xmlto
17716747b715Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
17726747b715Smrg# XORG_WITH_DOXYGEN       --with-doxygen
17736747b715Smrg# XORG_WITH_FOP           --with-fop
17746747b715Smrg# XORG_WITH_GROFF         --with-groff
17756747b715Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
17766747b715Smrg#
17776747b715Smrg# Interface to module:
17786747b715Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
17796747b715Smrg# --enable-docs: 'yes' user instructs the module to generate docs
17806747b715Smrg#		 'no' user instructs the module not to generate docs
17816747b715Smrg# parm1:	specify the default value, yes or no.
17826747b715Smrg#
17836747b715SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
17848223e2f2Smrgm4_define([docs_default], m4_default([$1], [yes]))
17856747b715SmrgAC_ARG_ENABLE(docs,
17866747b715Smrg	AS_HELP_STRING([--enable-docs],
17878223e2f2Smrg	   [Enable building the documentation (default: ]docs_default[)]),
17888223e2f2Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
17898223e2f2Smrgm4_undefine([docs_default])
17906747b715SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
17916747b715SmrgAC_MSG_CHECKING([whether to build documentation])
17926747b715SmrgAC_MSG_RESULT([$build_docs])
17936747b715Smrg]) # XORG_ENABLE_DOCS
17946747b715Smrg
17956747b715Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
17966747b715Smrg# ----------------
17976747b715Smrg# Minimum version: 1.6.0
17986747b715Smrg#
17996747b715Smrg# This macro enables a builder to skip all developer documentation.
18006747b715Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1801eee80088Smrg# maximum flexibility in controlling documentation building.
18026747b715Smrg# Refer to:
18036747b715Smrg# XORG_WITH_XMLTO         --with-xmlto
18046747b715Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
18056747b715Smrg# XORG_WITH_DOXYGEN       --with-doxygen
18066747b715Smrg# XORG_WITH_FOP           --with-fop
18076747b715Smrg# XORG_WITH_GROFF         --with-groff
18086747b715Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
18096747b715Smrg#
18106747b715Smrg# Interface to module:
18116747b715Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
18126747b715Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
18136747b715Smrg#			'no' user instructs the module not to generate developer docs
18146747b715Smrg# parm1:		specify the default value, yes or no.
18156747b715Smrg#
18166747b715SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
18176747b715Smrgm4_define([devel_default], m4_default([$1], [yes]))
18186747b715SmrgAC_ARG_ENABLE(devel-docs,
18196747b715Smrg	AS_HELP_STRING([--enable-devel-docs],
18206747b715Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
18216747b715Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
18226747b715Smrgm4_undefine([devel_default])
18236747b715SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
18246747b715SmrgAC_MSG_CHECKING([whether to build developer documentation])
18256747b715SmrgAC_MSG_RESULT([$build_devel_docs])
18266747b715Smrg]) # XORG_ENABLE_DEVEL_DOCS
18276747b715Smrg
18286747b715Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
18296747b715Smrg# ----------------
18306747b715Smrg# Minimum version: 1.6.0
18316747b715Smrg#
18326747b715Smrg# This macro enables a builder to skip all functional specification targets.
18336747b715Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1834eee80088Smrg# maximum flexibility in controlling documentation building.
18356747b715Smrg# Refer to:
18366747b715Smrg# XORG_WITH_XMLTO         --with-xmlto
18376747b715Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
18386747b715Smrg# XORG_WITH_DOXYGEN       --with-doxygen
18396747b715Smrg# XORG_WITH_FOP           --with-fop
18406747b715Smrg# XORG_WITH_GROFF         --with-groff
18416747b715Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
18426747b715Smrg#
18436747b715Smrg# Interface to module:
18446747b715Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
18456747b715Smrg# --enable-specs:	'yes' user instructs the module to generate specs
18466747b715Smrg#			'no' user instructs the module not to generate specs
18476747b715Smrg# parm1:		specify the default value, yes or no.
18486747b715Smrg#
18496747b715SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
18506747b715Smrgm4_define([spec_default], m4_default([$1], [yes]))
18516747b715SmrgAC_ARG_ENABLE(specs,
18526747b715Smrg	AS_HELP_STRING([--enable-specs],
18536747b715Smrg	   [Enable building the specs (default: ]spec_default[)]),
18546747b715Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
18556747b715Smrgm4_undefine([spec_default])
18566747b715SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
18576747b715SmrgAC_MSG_CHECKING([whether to build functional specifications])
18586747b715SmrgAC_MSG_RESULT([$build_specs])
18596747b715Smrg]) # XORG_ENABLE_SPECS
18606747b715Smrg
18619ace9065Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
18629ace9065Smrg# ----------------------------------------------
18639ace9065Smrg# Minimum version: 1.13.0
18649ace9065Smrg#
18659ace9065Smrg# This macro enables a builder to enable/disable unit testing
18669ace9065Smrg# It makes no assumption about the test cases implementation
18679ace9065Smrg# Test cases may or may not use Automake "Support for test suites"
18689ace9065Smrg# They may or may not use the software utility library GLib
18699ace9065Smrg#
18709ace9065Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
18719ace9065Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
18729ace9065Smrg# The variable enable_unit_tests is used by other macros in this file.
18739ace9065Smrg#
18749ace9065Smrg# Interface to module:
18759ace9065Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
18769ace9065Smrg# enable_unit_tests:    used in configure.ac for additional configuration
18779ace9065Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
18789ace9065Smrg#			'no' user instructs the module not to build tests
18799ace9065Smrg# parm1:		specify the default value, yes or no.
18809ace9065Smrg#
18819ace9065SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
18829ace9065SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
18839ace9065SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
1884475c125cSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
18859ace9065Smrgm4_define([_defopt], m4_default([$1], [auto]))
18869ace9065SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
18879ace9065Smrg	[Enable building unit test cases (default: ]_defopt[)]),
18889ace9065Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
18899ace9065Smrgm4_undefine([_defopt])
18909ace9065SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
18919ace9065SmrgAC_MSG_CHECKING([whether to build unit test cases])
18929ace9065SmrgAC_MSG_RESULT([$enable_unit_tests])
18939ace9065Smrg]) # XORG_ENABLE_UNIT_TESTS
18949ace9065Smrg
189535c4bbdfSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
189635c4bbdfSmrg# ------------------------------------------------------
189735c4bbdfSmrg# Minimum version: 1.17.0
189835c4bbdfSmrg#
189935c4bbdfSmrg# This macro enables a builder to enable/disable integration testing
190035c4bbdfSmrg# It makes no assumption about the test cases' implementation
190135c4bbdfSmrg# Test cases may or may not use Automake "Support for test suites"
190235c4bbdfSmrg#
190335c4bbdfSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
190435c4bbdfSmrg# usually requires less dependencies and may be built and run under less
190535c4bbdfSmrg# stringent environments than integration tests.
190635c4bbdfSmrg#
190735c4bbdfSmrg# Interface to module:
190835c4bbdfSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
190935c4bbdfSmrg# enable_integration_tests:   used in configure.ac for additional configuration
191035c4bbdfSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
191135c4bbdfSmrg#                             'no' user instructs the module not to build tests
191235c4bbdfSmrg# parm1:                      specify the default value, yes or no.
191335c4bbdfSmrg#
191435c4bbdfSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
191535c4bbdfSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
191635c4bbdfSmrgm4_define([_defopt], m4_default([$1], [auto]))
191735c4bbdfSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
191835c4bbdfSmrg	[Enable building integration test cases (default: ]_defopt[)]),
191935c4bbdfSmrg	[enable_integration_tests=$enableval],
192035c4bbdfSmrg	[enable_integration_tests=]_defopt)
192135c4bbdfSmrgm4_undefine([_defopt])
192235c4bbdfSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
192335c4bbdfSmrg	[test "x$enable_integration_tests" != xno])
192435c4bbdfSmrgAC_MSG_CHECKING([whether to build unit test cases])
192535c4bbdfSmrgAC_MSG_RESULT([$enable_integration_tests])
192635c4bbdfSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
192735c4bbdfSmrg
192835c4bbdfSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
192935c4bbdfSmrg# ----------------------------------------
19309ace9065Smrg# Minimum version: 1.13.0
19319ace9065Smrg#
19329ace9065Smrg# GLib is a library which provides advanced data structures and functions.
19339ace9065Smrg# This macro enables a module to test for the presence of Glib.
19349ace9065Smrg#
19359ace9065Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
19369ace9065Smrg# Otherwise the value of $enable_unit_tests is blank.
19379ace9065Smrg#
193835c4bbdfSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
193935c4bbdfSmrg# test support usually requires less dependencies and may be built and run under
194035c4bbdfSmrg# less stringent environments than integration tests.
194135c4bbdfSmrg#
19429ace9065Smrg# Interface to module:
19439ace9065Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
19449ace9065Smrg# with_glib: used in configure.ac to know if GLib has been found
19459ace9065Smrg# --with-glib:	'yes' user instructs the module to use glib
19469ace9065Smrg#		'no' user instructs the module not to use glib
19479ace9065Smrg#
19489ace9065SmrgAC_DEFUN([XORG_WITH_GLIB],[
19499ace9065SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
19509ace9065Smrgm4_define([_defopt], m4_default([$2], [auto]))
19519ace9065SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
19529ace9065Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
19539ace9065Smrg	[with_glib=$withval], [with_glib=]_defopt)
19549ace9065Smrgm4_undefine([_defopt])
19559ace9065Smrg
19569ace9065Smrghave_glib=no
19579ace9065Smrg# Do not probe GLib if user explicitly disabled unit testing
19589ace9065Smrgif test "x$enable_unit_tests" != x"no"; then
19599ace9065Smrg  # Do not probe GLib if user explicitly disabled it
19609ace9065Smrg  if test "x$with_glib" != x"no"; then
19619ace9065Smrg    m4_ifval(
19629ace9065Smrg      [$1],
19639ace9065Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
19649ace9065Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
19659ace9065Smrg    )
19669ace9065Smrg  fi
19679ace9065Smrgfi
19689ace9065Smrg
19699ace9065Smrg# Not having GLib when unit testing has been explicitly requested is an error
19709ace9065Smrgif test "x$enable_unit_tests" = x"yes"; then
19719ace9065Smrg  if test "x$have_glib" = x"no"; then
19729ace9065Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
19739ace9065Smrg  fi
19749ace9065Smrgfi
19759ace9065Smrg
19769ace9065Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
19779ace9065Smrgif test "x$enable_unit_tests" = x"no"; then
19789ace9065Smrg  if test "x$with_glib" = x"yes"; then
19799ace9065Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
19809ace9065Smrg  fi
19819ace9065Smrgfi
19829ace9065Smrg
19839ace9065Smrg# Not having GLib when it has been explicitly requested is an error
19849ace9065Smrgif test "x$with_glib" = x"yes"; then
19859ace9065Smrg  if test "x$have_glib" = x"no"; then
19869ace9065Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
19879ace9065Smrg  fi
19889ace9065Smrgfi
19899ace9065Smrg
19909ace9065SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
19919ace9065Smrg]) # XORG_WITH_GLIB
19929ace9065Smrg
1993475c125cSmrg# XORG_LD_WRAP([required|optional])
1994475c125cSmrg# ---------------------------------
19959ace9065Smrg# Minimum version: 1.13.0
19969ace9065Smrg#
19979ace9065Smrg# Check if linker supports -wrap, passed via compiler flags
19989ace9065Smrg#
19999ace9065Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
20009ace9065Smrg# Otherwise the value of $enable_unit_tests is blank.
20019ace9065Smrg#
2002475c125cSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2003475c125cSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2004475c125cSmrg# available, an argument of "optional" allows use when some unit tests require
2005475c125cSmrg# ld -wrap and others do not.
2006475c125cSmrg#
20079ace9065SmrgAC_DEFUN([XORG_LD_WRAP],[
2008475c125cSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2009475c125cSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2010475c125cSmrg                      void __wrap_exit(int status) { return; }],
2011475c125cSmrg                     [exit(0);])])
20129ace9065Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2013475c125cSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
20149ace9065Smrg  if test "x$have_ld_wrap" = x"no"; then
20159ace9065Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
20169ace9065Smrg  fi
20179ace9065Smrgfi
20189ace9065SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
20199ace9065Smrg#
20209ace9065Smrg]) # XORG_LD_WRAP
20219ace9065Smrg
20229ace9065Smrg# XORG_CHECK_LINKER_FLAGS
20239ace9065Smrg# -----------------------
20249ace9065Smrg# SYNOPSIS
20259ace9065Smrg#
2026475c125cSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
20279ace9065Smrg#
20289ace9065Smrg# DESCRIPTION
20299ace9065Smrg#
20309ace9065Smrg#   Check whether the given linker FLAGS work with the current language's
20319ace9065Smrg#   linker, or whether they give an error.
20329ace9065Smrg#
20339ace9065Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
20349ace9065Smrg#   success/failure.
20359ace9065Smrg#
2036475c125cSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
2037475c125cSmrg#
20389ace9065Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
20399ace9065Smrg#
20409ace9065Smrg# LICENSE
20419ace9065Smrg#
20429ace9065Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
20439ace9065Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
20449ace9065Smrg#   Copyright (c) 2009 Matteo Frigo
20459ace9065Smrg#
20469ace9065Smrg#   This program is free software: you can redistribute it and/or modify it
20479ace9065Smrg#   under the terms of the GNU General Public License as published by the
20489ace9065Smrg#   Free Software Foundation, either version 3 of the License, or (at your
20499ace9065Smrg#   option) any later version.
20509ace9065Smrg#
20519ace9065Smrg#   This program is distributed in the hope that it will be useful, but
20529ace9065Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
20539ace9065Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
20549ace9065Smrg#   Public License for more details.
20559ace9065Smrg#
20569ace9065Smrg#   You should have received a copy of the GNU General Public License along
20579ace9065Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
20589ace9065Smrg#
20599ace9065Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
20609ace9065Smrg#   gives unlimited permission to copy, distribute and modify the configure
20619ace9065Smrg#   scripts that are the output of Autoconf when processing the Macro. You
20629ace9065Smrg#   need not follow the terms of the GNU General Public License when using
20639ace9065Smrg#   or distributing such scripts, even though portions of the text of the
20649ace9065Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
20659ace9065Smrg#   all other use of the material that constitutes the Autoconf Macro.
20669ace9065Smrg#
20679ace9065Smrg#   This special exception to the GPL applies to versions of the Autoconf
20689ace9065Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
20699ace9065Smrg#   modified version of the Autoconf Macro, you may extend this special
20709ace9065Smrg#   exception to the GPL to apply to your modified version as well.#
20719ace9065SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
20729ace9065Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
20739ace9065Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
20749ace9065SmrgAS_LITERAL_IF([$1],
20759ace9065Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
20769ace9065Smrg      ax_save_FLAGS=$LDFLAGS
20779ace9065Smrg      LDFLAGS="$1"
2078475c125cSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
20799ace9065Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
20809ace9065Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
20819ace9065Smrg      LDFLAGS=$ax_save_FLAGS])],
20829ace9065Smrg  [ax_save_FLAGS=$LDFLAGS
20839ace9065Smrg   LDFLAGS="$1"
20849ace9065Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
20859ace9065Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
20869ace9065Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
20879ace9065Smrg   LDFLAGS=$ax_save_FLAGS])
20889ace9065Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
20899ace9065SmrgAC_MSG_RESULT($xorg_check_linker_flags)
20909ace9065Smrgif test "x$xorg_check_linker_flags" = xyes; then
20919ace9065Smrg	m4_default([$2], :)
20929ace9065Smrgelse
20939ace9065Smrg	m4_default([$3], :)
20949ace9065Smrgfi
20959ace9065Smrg]) # XORG_CHECK_LINKER_FLAGS
20969ace9065Smrg
2097475c125cSmrg# XORG_MEMORY_CHECK_FLAGS
2098475c125cSmrg# -----------------------
2099475c125cSmrg# Minimum version: 1.16.0
2100475c125cSmrg#
2101475c125cSmrg# This macro attempts to find appropriate memory checking functionality
2102475c125cSmrg# for various platforms which unit testing code may use to catch various
2103475c125cSmrg# forms of memory allocation and access errors in testing.
2104475c125cSmrg#
2105475c125cSmrg# Interface to module:
2106475c125cSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2107475c125cSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2108475c125cSmrg#
2109475c125cSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2110475c125cSmrg#
2111475c125cSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2112475c125cSmrg
2113475c125cSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2114475c125cSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2115475c125cSmrg           [Environment variables to enable memory checking in tests])
2116475c125cSmrg
2117475c125cSmrg# Check for different types of support on different platforms
2118475c125cSmrgcase $host_os in
2119475c125cSmrg    solaris*)
2120475c125cSmrg        AC_CHECK_LIB([umem], [umem_alloc],
2121475c125cSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2122475c125cSmrg        ;;
2123475c125cSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2124475c125cSmrg        # both directly and inverted, so should not be 0 or 255.
2125475c125cSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
2126475c125cSmrg        ;;
2127475c125cSmrg    darwin*)
2128475c125cSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2129475c125cSmrg        ;;
2130475c125cSmrg    *bsd*)
2131475c125cSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2132475c125cSmrg        ;;
2133475c125cSmrgesac
2134475c125cSmrg
2135475c125cSmrg# User supplied flags override default flags
2136475c125cSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2137475c125cSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2138475c125cSmrgfi
2139475c125cSmrg
2140475c125cSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2141475c125cSmrg]) # XORG_WITH_LINT
2142475c125cSmrg
21434642e01fSmrg# XORG_CHECK_MALLOC_ZERO
21444642e01fSmrg# ----------------------
21454642e01fSmrg# Minimum version: 1.0.0
21464642e01fSmrg#
21474642e01fSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
21484642e01fSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
21494642e01fSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
215054b5899cSmrg#
215154b5899cSmrg# No longer actually tests since there is no guarantee applications will
215254b5899cSmrg# run with the same malloc implementation we tested against, and the cost
215354b5899cSmrg# of always ensuring the size passed to malloc is non-zero is minimal now.
215454b5899cSmrg# Still allows builders to override when they have complete control over
215554b5899cSmrg# which malloc implementation will be used.
21564642e01fSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
21574642e01fSmrgAC_ARG_ENABLE(malloc0returnsnull,
2158b1d344b3Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
215954b5899cSmrg		       [assume malloc(0) can return NULL (default: yes)]),
21604642e01fSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
216154b5899cSmrg	[MALLOC_ZERO_RETURNS_NULL=yes])
216254b5899cSmrg
216354b5899cSmrgAC_MSG_CHECKING([whether to act as if malloc(0) can return NULL])
21644642e01fSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
21654642e01fSmrg
21664642e01fSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
21674642e01fSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
21684642e01fSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
21694642e01fSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
21704642e01fSmrgelse
21714642e01fSmrg	MALLOC_ZERO_CFLAGS=""
21724642e01fSmrg	XMALLOC_ZERO_CFLAGS=""
21734642e01fSmrg	XTMALLOC_ZERO_CFLAGS=""
21744642e01fSmrgfi
21754642e01fSmrg
21764642e01fSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
21774642e01fSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
21784642e01fSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
21794642e01fSmrg]) # XORG_CHECK_MALLOC_ZERO
21804642e01fSmrg
21814642e01fSmrg# XORG_WITH_LINT()
21824642e01fSmrg# ----------------
21834642e01fSmrg# Minimum version: 1.1.0
21844642e01fSmrg#
21856747b715Smrg# This macro enables the use of a tool that flags some suspicious and
21866747b715Smrg# non-portable constructs (likely to be bugs) in C language source code.
21876747b715Smrg# It will attempt to locate the tool and use appropriate options.
21886747b715Smrg# There are various lint type tools on different platforms.
21896747b715Smrg#
21906747b715Smrg# Interface to module:
21916747b715Smrg# LINT:		returns the path to the tool found on the platform
21926747b715Smrg#		or the value set to LINT on the configure cmd line
21936747b715Smrg#		also an Automake conditional
21946747b715Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
21956747b715Smrg#
21966747b715Smrg# --with-lint:	'yes' user instructs the module to use lint
21976747b715Smrg#		'no' user instructs the module not to use lint (default)
21986747b715Smrg#
21996747b715Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
22006747b715Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
22014642e01fSmrg#
22024642e01fSmrgAC_DEFUN([XORG_WITH_LINT],[
22034642e01fSmrg
22046747b715SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
22056747b715SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2206b1d344b3SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
22074642e01fSmrg		[Use a lint-style source code checker (default: disabled)])],
22084642e01fSmrg		[use_lint=$withval], [use_lint=no])
22096747b715Smrg
22106747b715Smrg# Obtain platform specific info like program name and options
22116747b715Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
22126747b715Smrgcase $host_os in
22136747b715Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
22146747b715Smrg	lint_name=splint
22156747b715Smrg	lint_options="-badflag"
22166747b715Smrg	;;
22176747b715Smrg  *freebsd* | *netbsd*)
22186747b715Smrg	lint_name=lint
22196747b715Smrg	lint_options="-u -b"
22206747b715Smrg	;;
22216747b715Smrg  *solaris*)
22226747b715Smrg	lint_name=lint
22236747b715Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
22246747b715Smrg	;;
22256747b715Smrgesac
22266747b715Smrg
22276747b715Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
22286747b715Smrgif test "x$use_lint" = x"yes" ; then
22296747b715Smrg   AC_PATH_PROG([LINT], [$lint_name])
22306747b715Smrg   if test "x$LINT" = "x"; then
22316747b715Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
22326747b715Smrg   fi
22336747b715Smrgelif test "x$use_lint" = x"no" ; then
22346747b715Smrg   if test "x$LINT" != "x"; then
22356747b715Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
22366747b715Smrg   fi
22374642e01fSmrgelse
22386747b715Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
22394642e01fSmrgfi
22406747b715Smrg
22416747b715Smrg# User supplied flags override default flags
22426747b715Smrgif test "x$LINT_FLAGS" != "x"; then
22436747b715Smrg   lint_options=$LINT_FLAGS
22444642e01fSmrgfi
22454642e01fSmrg
22466747b715SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
22476747b715SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
22484642e01fSmrg
22494642e01fSmrg]) # XORG_WITH_LINT
22504642e01fSmrg
22514642e01fSmrg# XORG_LINT_LIBRARY(LIBNAME)
22524642e01fSmrg# --------------------------
22534642e01fSmrg# Minimum version: 1.1.0
22544642e01fSmrg#
22554642e01fSmrg# Sets up flags for building lint libraries for checking programs that call
22564642e01fSmrg# functions in the library.
22574642e01fSmrg#
22586747b715Smrg# Interface to module:
22596747b715Smrg# LINTLIB		- Automake variable with the name of lint library file to make
22606747b715Smrg# MAKE_LINT_LIB		- Automake conditional
22616747b715Smrg#
22626747b715Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
22636747b715Smrg#			  - 'no' user instructs the module not to create a lint library (default)
22644642e01fSmrg
22654642e01fSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
22664642e01fSmrgAC_REQUIRE([XORG_WITH_LINT])
2267b1d344b3SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
22684642e01fSmrg	[Create lint library (default: disabled)])],
22694642e01fSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
22706747b715Smrg
22716747b715Smrgif test "x$make_lint_lib" = x"yes" ; then
22726747b715Smrg   LINTLIB=llib-l$1.ln
22736747b715Smrg   if test "x$LINT" = "x"; then
22746747b715Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
22756747b715Smrg   fi
22766747b715Smrgelif test "x$make_lint_lib" != x"no" ; then
22776747b715Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
22784642e01fSmrgfi
22796747b715Smrg
22804642e01fSmrgAC_SUBST(LINTLIB)
22814642e01fSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
22824642e01fSmrg
22834642e01fSmrg]) # XORG_LINT_LIBRARY
22844642e01fSmrg
22859ace9065Smrg# XORG_COMPILER_BRAND
22869ace9065Smrg# -------------------
22879ace9065Smrg# Minimum version: 1.14.0
22889ace9065Smrg#
22899ace9065Smrg# Checks for various brands of compilers and sets flags as appropriate:
22909ace9065Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
229135c4bbdfSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
22929ace9065Smrg#   clang compiler - sets CLANGCC to "yes"
22939ace9065Smrg#   Intel compiler - sets INTELCC to "yes"
22949ace9065Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
22959ace9065Smrg#
22969ace9065SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
229735c4bbdfSmrgAC_LANG_CASE(
229835c4bbdfSmrg	[C], [
2299eee80088Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
2300eee80088Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
2301eee80088Smrg		m4_version_prereq([2.70],
2302eee80088Smrg			[AC_REQUIRE([AC_PROG_CC])],
2303eee80088Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
230435c4bbdfSmrg	],
230535c4bbdfSmrg	[C++], [
230635c4bbdfSmrg		AC_REQUIRE([AC_PROG_CXX])
230735c4bbdfSmrg	]
230835c4bbdfSmrg)
23099ace9065SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
23109ace9065SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
23119ace9065SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
23129ace9065Smrg]) # XORG_COMPILER_BRAND
23139ace9065Smrg
2314475c125cSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2315475c125cSmrg# ---------------
2316475c125cSmrg# Minimum version: 1.16.0
2317475c125cSmrg#
2318475c125cSmrg# Test if the compiler works when passed the given flag as a command line argument.
2319eee80088Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
2320475c125cSmrg# next flag in the list until there are no more options.
2321475c125cSmrg#
2322475c125cSmrg# Note that this does not guarantee that the compiler supports the flag as some
2323475c125cSmrg# compilers will simply ignore arguments that they do not understand, but we do
2324475c125cSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2325475c125cSmrg# -Werror=unused-command-line-argument
2326475c125cSmrg#
2327475c125cSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2328475c125cSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2329475c125cSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2330475c125cSmrg
233135c4bbdfSmrgAC_LANG_COMPILER_REQUIRE
233235c4bbdfSmrg
233335c4bbdfSmrgAC_LANG_CASE(
233435c4bbdfSmrg	[C], [
2335eee80088Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
2336eee80088Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
2337eee80088Smrg		m4_version_prereq([2.70],
2338eee80088Smrg			[AC_REQUIRE([AC_PROG_CC])],
2339eee80088Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
234035c4bbdfSmrg		define([PREFIX], [C])
234135c4bbdfSmrg		define([CACHE_PREFIX], [cc])
234235c4bbdfSmrg		define([COMPILER], [$CC])
234335c4bbdfSmrg	],
234435c4bbdfSmrg	[C++], [
234535c4bbdfSmrg		define([PREFIX], [CXX])
234635c4bbdfSmrg		define([CACHE_PREFIX], [cxx])
234735c4bbdfSmrg		define([COMPILER], [$CXX])
234835c4bbdfSmrg	]
234935c4bbdfSmrg)
2350475c125cSmrg
235135c4bbdfSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
235235c4bbdfSmrg
235335c4bbdfSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
235435c4bbdfSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
235535c4bbdfSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
235635c4bbdfSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
235735c4bbdfSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
235835c4bbdfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
235935c4bbdfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
236035c4bbdfSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
236135c4bbdfSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2362475c125cSmrgfi
2363475c125cSmrg
236435c4bbdfSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
236535c4bbdfSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
236635c4bbdfSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2367475c125cSmrg	fi
236835c4bbdfSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
236935c4bbdfSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
237035c4bbdfSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
237135c4bbdfSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
237235c4bbdfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
237335c4bbdfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
237435c4bbdfSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
237535c4bbdfSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2376475c125cSmrgfi
2377475c125cSmrg
2378475c125cSmrgfound="no"
2379475c125cSmrgm4_foreach([flag], m4_cdr($@), [
2380475c125cSmrg	if test $found = "no" ; then
238135c4bbdfSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
238235c4bbdfSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2383475c125cSmrg		fi
2384475c125cSmrg
238535c4bbdfSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
238635c4bbdfSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2387475c125cSmrg		fi
2388475c125cSmrg
238935c4bbdfSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2390475c125cSmrg
239135c4bbdfSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
239235c4bbdfSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
239335c4bbdfSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
239435c4bbdfSmrg		AC_CACHE_VAL($cacheid,
239535c4bbdfSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
239635c4bbdfSmrg					     [eval $cacheid=yes],
239735c4bbdfSmrg					     [eval $cacheid=no])])
239835c4bbdfSmrg
239935c4bbdfSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2400475c125cSmrg
240135c4bbdfSmrg		eval supported=\$$cacheid
240235c4bbdfSmrg		AC_MSG_RESULT([$supported])
2403475c125cSmrg		if test "$supported" = "yes" ; then
2404475c125cSmrg			$1="$$1 ]flag["
2405475c125cSmrg			found="yes"
2406475c125cSmrg		fi
2407475c125cSmrg	fi
2408475c125cSmrg])
2409475c125cSmrg]) # XORG_TESTSET_CFLAG
2410475c125cSmrg
2411475c125cSmrg# XORG_COMPILER_FLAGS
2412475c125cSmrg# ---------------
2413475c125cSmrg# Minimum version: 1.16.0
2414475c125cSmrg#
241535c4bbdfSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
241635c4bbdfSmrg# arguments supported by the selected compiler which do NOT alter the generated
241735c4bbdfSmrg# code.  These arguments will cause the compiler to print various warnings
241835c4bbdfSmrg# during compilation AND turn a conservative set of warnings into errors.
2419475c125cSmrg#
242035c4bbdfSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
242135c4bbdfSmrg# future versions of util-macros as options are added to new compilers.
2422475c125cSmrg#
2423475c125cSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2424475c125cSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2425475c125cSmrg
2426475c125cSmrgAC_ARG_ENABLE(selective-werror,
2427475c125cSmrg              AS_HELP_STRING([--disable-selective-werror],
2428475c125cSmrg                             [Turn off selective compiler errors. (default: enabled)]),
2429475c125cSmrg              [SELECTIVE_WERROR=$enableval],
2430475c125cSmrg              [SELECTIVE_WERROR=yes])
2431475c125cSmrg
243235c4bbdfSmrgAC_LANG_CASE(
243335c4bbdfSmrg        [C], [
243435c4bbdfSmrg                define([PREFIX], [C])
243535c4bbdfSmrg        ],
243635c4bbdfSmrg        [C++], [
243735c4bbdfSmrg                define([PREFIX], [CXX])
243835c4bbdfSmrg        ]
243935c4bbdfSmrg)
2440475c125cSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2441475c125cSmrgif test "x$SUNCC" = "xyes"; then
244235c4bbdfSmrg    [BASE_]PREFIX[FLAGS]="-v"
2443475c125cSmrgelse
244435c4bbdfSmrg    [BASE_]PREFIX[FLAGS]=""
2445475c125cSmrgfi
2446475c125cSmrg
2447475c125cSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
244835c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
244935c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
245035c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
245135c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
245235c4bbdfSmrg
245335c4bbdfSmrgAC_LANG_CASE(
245435c4bbdfSmrg	[C], [
245535c4bbdfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
245635c4bbdfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
245735c4bbdfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
245835c4bbdfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
245935c4bbdfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
246035c4bbdfSmrg	]
246135c4bbdfSmrg)
2462475c125cSmrg
2463475c125cSmrg# This chunk adds additional warnings that could catch undesired effects.
246435c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
246535c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
246635c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
246735c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
246835c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
246935c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
247035c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2471475c125cSmrg
2472475c125cSmrg# These are currently disabled because they are noisy.  They will be enabled
2473475c125cSmrg# in the future once the codebase is sufficiently modernized to silence
2474475c125cSmrg# them.  For now, I don't want them to drown out the other warnings.
247535c4bbdfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
247635c4bbdfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
247735c4bbdfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2478475c125cSmrg
2479eee80088Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
2480475c125cSmrg# when there are problems that should be fixed.
2481475c125cSmrg
2482475c125cSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
248335c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
248435c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
248535c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
248635c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
248735c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
248835c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
248935c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
249035c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
249135c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
249235c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
249335c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
249435c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
249535c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
2496475c125cSmrgelse
2497475c125cSmrgAC_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])
249835c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
249935c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
250035c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
250135c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
250235c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
250335c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
250435c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
250535c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
250635c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
250735c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
250835c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
250935c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
251035c4bbdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
251135c4bbdfSmrgfi
251235c4bbdfSmrg
251335c4bbdfSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2514475c125cSmrg]) # XORG_COMPILER_FLAGS
2515475c125cSmrg
25164642e01fSmrg# XORG_CWARNFLAGS
25174642e01fSmrg# ---------------
25184642e01fSmrg# Minimum version: 1.2.0
2519475c125cSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
25204642e01fSmrg#
25214642e01fSmrg# Defines CWARNFLAGS to enable C compiler warnings.
25224642e01fSmrg#
2523475c125cSmrg# This function is deprecated because it defines -fno-strict-aliasing
2524475c125cSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
2525475c125cSmrg# is needed, then it should be added explicitly in the module when
2526475c125cSmrg# it is updated to use BASE_CFLAGS.
2527475c125cSmrg#
25284642e01fSmrgAC_DEFUN([XORG_CWARNFLAGS], [
2529475c125cSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
25309ace9065SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
253135c4bbdfSmrgAC_LANG_CASE(
253235c4bbdfSmrg	[C], [
253335c4bbdfSmrg		CWARNFLAGS="$BASE_CFLAGS"
253435c4bbdfSmrg		if  test "x$GCC" = xyes ; then
253535c4bbdfSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
253635c4bbdfSmrg		fi
253735c4bbdfSmrg		AC_SUBST(CWARNFLAGS)
253835c4bbdfSmrg	]
253935c4bbdfSmrg)
25404642e01fSmrg]) # XORG_CWARNFLAGS
2541b1d344b3Smrg
2542b1d344b3Smrg# XORG_STRICT_OPTION
2543b1d344b3Smrg# -----------------------
2544b1d344b3Smrg# Minimum version: 1.3.0
2545b1d344b3Smrg#
25469ace9065Smrg# Add configure option to enable strict compilation flags, such as treating
25479ace9065Smrg# warnings as fatal errors.
25489ace9065Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
254935c4bbdfSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
25509ace9065Smrg#
25519ace9065Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
25529ace9065Smrg# when strict compilation is unconditionally desired.
2553b1d344b3SmrgAC_DEFUN([XORG_STRICT_OPTION], [
2554b1d344b3SmrgAC_REQUIRE([XORG_CWARNFLAGS])
2555475c125cSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2556b1d344b3Smrg
2557b1d344b3SmrgAC_ARG_ENABLE(strict-compilation,
2558b1d344b3Smrg			  AS_HELP_STRING([--enable-strict-compilation],
2559b1d344b3Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2560b1d344b3Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2561475c125cSmrg
256235c4bbdfSmrgAC_LANG_CASE(
256335c4bbdfSmrg        [C], [
256435c4bbdfSmrg                define([PREFIX], [C])
256535c4bbdfSmrg        ],
256635c4bbdfSmrg        [C++], [
256735c4bbdfSmrg                define([PREFIX], [CXX])
256835c4bbdfSmrg        ]
256935c4bbdfSmrg)
257035c4bbdfSmrg
257135c4bbdfSmrg[STRICT_]PREFIX[FLAGS]=""
257235c4bbdfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
257335c4bbdfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
2574475c125cSmrg
2575475c125cSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
2576475c125cSmrg# activate it with -Werror, so we add it here explicitly.
257735c4bbdfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
2578475c125cSmrg
2579b1d344b3Smrgif test "x$STRICT_COMPILE" = "xyes"; then
258035c4bbdfSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
258135c4bbdfSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
2582b1d344b3Smrgfi
258335c4bbdfSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
258435c4bbdfSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
258535c4bbdfSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
2586b1d344b3Smrg]) # XORG_STRICT_OPTION
2587b1d344b3Smrg
2588eee80088Smrg# XORG_DEFAULT_NOCODE_OPTIONS
2589eee80088Smrg# ---------------------------
2590eee80088Smrg# Minimum version: 1.20.0
2591eee80088Smrg#
2592eee80088Smrg# Defines default options for X.Org modules which don't compile code,
2593eee80088Smrg# such as fonts, bitmaps, cursors, and docs.
2594eee80088Smrg#
2595eee80088SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
2596eee80088SmrgAC_REQUIRE([AC_PROG_INSTALL])
2597eee80088SmrgXORG_RELEASE_VERSION
2598eee80088SmrgXORG_CHANGELOG
2599eee80088SmrgXORG_INSTALL
2600eee80088SmrgXORG_MANPAGE_SECTIONS
2601eee80088Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
2602eee80088Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
2603eee80088Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
2604eee80088Smrg
2605b1d344b3Smrg# XORG_DEFAULT_OPTIONS
2606b1d344b3Smrg# --------------------
2607b1d344b3Smrg# Minimum version: 1.3.0
2608b1d344b3Smrg#
2609eee80088Smrg# Defines default options for X.Org modules which compile code.
2610b1d344b3Smrg#
2611b1d344b3SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
26126747b715SmrgAC_REQUIRE([AC_PROG_INSTALL])
2613475c125cSmrgXORG_COMPILER_FLAGS
2614b1d344b3SmrgXORG_CWARNFLAGS
2615b1d344b3SmrgXORG_STRICT_OPTION
2616eee80088SmrgXORG_DEFAULT_NOCODE_OPTIONS
2617b1d344b3Smrg]) # XORG_DEFAULT_OPTIONS
26186747b715Smrg
26196747b715Smrg# XORG_INSTALL()
26206747b715Smrg# ----------------
26216747b715Smrg# Minimum version: 1.4.0
26226747b715Smrg#
26236747b715Smrg# Defines the variable INSTALL_CMD as the command to copy
26246747b715Smrg# INSTALL from $prefix/share/util-macros.
26256747b715Smrg#
26266747b715SmrgAC_DEFUN([XORG_INSTALL], [
26276747b715SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
26286747b715Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
26296747b715SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
26306747b715Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
2631c82838c1Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
2632c82838c1Smrgtouch \$(top_srcdir)/INSTALL; \
2633c82838c1Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
26346747b715SmrgAC_SUBST([INSTALL_CMD])
26356747b715Smrg]) # XORG_INSTALL
26364642e01fSmrgdnl Copyright 2005 Red Hat, Inc
26374642e01fSmrgdnl
26384642e01fSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
26394642e01fSmrgdnl documentation for any purpose is hereby granted without fee, provided that
26404642e01fSmrgdnl the above copyright notice appear in all copies and that both that
26414642e01fSmrgdnl copyright notice and this permission notice appear in supporting
26424642e01fSmrgdnl documentation.
26434642e01fSmrgdnl
26444642e01fSmrgdnl The above copyright notice and this permission notice shall be included
26454642e01fSmrgdnl in all copies or substantial portions of the Software.
26464642e01fSmrgdnl
26474642e01fSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
26484642e01fSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26494642e01fSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
26504642e01fSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
26514642e01fSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26524642e01fSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26534642e01fSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
26544642e01fSmrgdnl
26554642e01fSmrgdnl Except as contained in this notice, the name of the copyright holders shall
26564642e01fSmrgdnl not be used in advertising or otherwise to promote the sale, use or
26574642e01fSmrgdnl other dealings in this Software without prior written authorization
26584642e01fSmrgdnl from the copyright holders.
26594642e01fSmrgdnl
26604642e01fSmrg
26614642e01fSmrg# XORG_RELEASE_VERSION
26624642e01fSmrg# --------------------
26636747b715Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
266435c4bbdfSmrg
26654642e01fSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
26664642e01fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
26674642e01fSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
26684642e01fSmrg		[Major version of this package])
26694642e01fSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
26704642e01fSmrg	if test "x$PVM" = "x"; then
26714642e01fSmrg		PVM="0"
26724642e01fSmrg	fi
26734642e01fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
26744642e01fSmrg		[$PVM],
26754642e01fSmrg		[Minor version of this package])
26764642e01fSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
26774642e01fSmrg	if test "x$PVP" = "x"; then
26784642e01fSmrg		PVP="0"
26794642e01fSmrg	fi
26804642e01fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
26814642e01fSmrg		[$PVP],
26824642e01fSmrg		[Patch version of this package])
26834642e01fSmrg])
26844642e01fSmrg
26854642e01fSmrg# XORG_CHANGELOG()
26864642e01fSmrg# ----------------
26874642e01fSmrg# Minimum version: 1.2.0
26884642e01fSmrg#
26894642e01fSmrg# Defines the variable CHANGELOG_CMD as the command to generate
26904642e01fSmrg# ChangeLog from git.
26914642e01fSmrg#
269252397711Smrg#
26934642e01fSmrgAC_DEFUN([XORG_CHANGELOG], [
2694c82838c1SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
26956747b715Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
2696c82838c1Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
2697c82838c1Smrgtouch \$(top_srcdir)/ChangeLog; \
2698c82838c1Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
26994642e01fSmrgAC_SUBST([CHANGELOG_CMD])
27004642e01fSmrg]) # XORG_CHANGELOG
27014642e01fSmrg
27024642e01fSmrgdnl
2703d9252ffbSmrgdnl Copyright (c) 2005, Oracle and/or its affiliates.
27048223e2f2Smrgdnl
27058223e2f2Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
27068223e2f2Smrgdnl copy of this software and associated documentation files (the "Software"),
27078223e2f2Smrgdnl to deal in the Software without restriction, including without limitation
27088223e2f2Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
27098223e2f2Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
27108223e2f2Smrgdnl Software is furnished to do so, subject to the following conditions:
27118223e2f2Smrgdnl
27128223e2f2Smrgdnl The above copyright notice and this permission notice (including the next
27138223e2f2Smrgdnl paragraph) shall be included in all copies or substantial portions of the
27148223e2f2Smrgdnl Software.
27158223e2f2Smrgdnl
27168223e2f2Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27178223e2f2Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27188223e2f2Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
27198223e2f2Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27208223e2f2Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27218223e2f2Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27228223e2f2Smrgdnl DEALINGS IN THE SOFTWARE.
27238223e2f2Smrgdnl
27244642e01fSmrg
27254642e01fSmrg# XTRANS_TCP_FLAGS()
27264642e01fSmrg# ------------------
27274642e01fSmrg# Find needed libraries for TCP sockets, and check for IPv6 support
27284642e01fSmrgAC_DEFUN([XTRANS_TCP_FLAGS],[
27294642e01fSmrg # SVR4 hides these in libraries other than libc
27304642e01fSmrg AC_SEARCH_LIBS(socket, [socket])
27314642e01fSmrg AC_SEARCH_LIBS(gethostbyname, [nsl])
27326747b715Smrg if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then
273335c4bbdfSmrg   AC_CHECK_LIB([ws2_32],[main])
27346747b715Smrg fi
27354642e01fSmrg
27364642e01fSmrg # Needs to come after above checks for libsocket & libnsl for SVR4 systems
273735c4bbdfSmrg AC_ARG_ENABLE(ipv6,
273835c4bbdfSmrg	AS_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),
273935c4bbdfSmrg	[IPV6CONN=$enableval],
27404642e01fSmrg	[AC_CHECK_FUNC(getaddrinfo,[IPV6CONN=yes],[IPV6CONN=no])])
27414642e01fSmrg AC_MSG_CHECKING([if IPv6 support should be built])
27424642e01fSmrg if test "$IPV6CONN" = "yes"; then
27434642e01fSmrg	AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections])
27444642e01fSmrg fi
27454642e01fSmrg AC_MSG_RESULT($IPV6CONN)
27464642e01fSmrg
27474642e01fSmrg # 4.3BSD-Reno added a new member to struct sockaddr_in
274835c4bbdfSmrg AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
27494642e01fSmrg	AC_DEFINE([BSD44SOCKETS],1,
27504642e01fSmrg 	    [Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [
27514642e01fSmrg#include <sys/types.h>
27524642e01fSmrg#include <sys/socket.h>
27534642e01fSmrg#include <netinet/in.h>
27544642e01fSmrg ])
27554642e01fSmrg
27564642e01fSmrg # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc.
27574642e01fSmrg AC_CHECK_TYPES([socklen_t], [], [], [
27584642e01fSmrgAC_INCLUDES_DEFAULT
27594642e01fSmrg#include <sys/socket.h>])
276035c4bbdfSmrg
276135c4bbdfSmrg # XPG4v2/UNIX95 added msg_control - check to see if we need to define
276235c4bbdfSmrg # _XOPEN_SOURCE to get it (such as on Solaris)
276335c4bbdfSmrg AC_CHECK_MEMBER([struct msghdr.msg_control], [], [],
276435c4bbdfSmrg                 [
276535c4bbdfSmrgAC_INCLUDES_DEFAULT
276635c4bbdfSmrg#include <sys/socket.h>
276735c4bbdfSmrg                 ])
276835c4bbdfSmrg # First try for Solaris in C99 compliant mode, which requires XPG6/UNIX03
276935c4bbdfSmrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
277035c4bbdfSmrg     unset ac_cv_member_struct_msghdr_msg_control
277135c4bbdfSmrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=600])
277235c4bbdfSmrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
277335c4bbdfSmrg                     [AC_DEFINE([_XOPEN_SOURCE], [600],
277435c4bbdfSmrg                       [Defined if needed to expose struct msghdr.msg_control])
277535c4bbdfSmrg                     ], [], [
277635c4bbdfSmrg#define _XOPEN_SOURCE 600
277735c4bbdfSmrgAC_INCLUDES_DEFAULT
277835c4bbdfSmrg#include <sys/socket.h>
277935c4bbdfSmrg                     ])
278035c4bbdfSmrg fi
278135c4bbdfSmrg # If that didn't work, fall back to XPG5/UNIX98 with C89
278235c4bbdfSmrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
278335c4bbdfSmrg     unset ac_cv_member_struct_msghdr_msg_control
278435c4bbdfSmrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=500])
278535c4bbdfSmrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
278635c4bbdfSmrg                     [AC_DEFINE([_XOPEN_SOURCE], [500],
278735c4bbdfSmrg                       [Defined if needed to expose struct msghdr.msg_control])
278835c4bbdfSmrg                     ], [], [
278935c4bbdfSmrg#define _XOPEN_SOURCE 500
279035c4bbdfSmrgAC_INCLUDES_DEFAULT
279135c4bbdfSmrg#include <sys/socket.h>
279235c4bbdfSmrg                     ])
279335c4bbdfSmrg fi
279435c4bbdfSmrg
279535c4bbdfSmrg
27964642e01fSmrg]) # XTRANS_TCP_FLAGS
27974642e01fSmrg
27984642e01fSmrg# XTRANS_CONNECTION_FLAGS()
27994642e01fSmrg# -------------------------
28004642e01fSmrg# Standard checks for which Xtrans transports to use by the Xorg packages
28014642e01fSmrg# that use Xtrans functions
28024642e01fSmrgAC_DEFUN([XTRANS_CONNECTION_FLAGS],[
28034642e01fSmrg AC_REQUIRE([AC_CANONICAL_HOST])
28044642e01fSmrg [case $host_os in
28054642e01fSmrg	mingw*)	unixdef="no"   ;;
28064642e01fSmrg	*)	unixdef="yes"  ;;
28074642e01fSmrg esac]
28084642e01fSmrg AC_ARG_ENABLE(unix-transport,
280935c4bbdfSmrg	AS_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]),
28104642e01fSmrg	[UNIXCONN=$enableval], [UNIXCONN=$unixdef])
28114642e01fSmrg AC_MSG_CHECKING([if Xtrans should support UNIX socket connections])
28124642e01fSmrg if test "$UNIXCONN" = "yes"; then
28134642e01fSmrg	AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
28144642e01fSmrg fi
28154642e01fSmrg AC_MSG_RESULT($UNIXCONN)
281635c4bbdfSmrg AC_ARG_ENABLE(tcp-transport,
281735c4bbdfSmrg	AS_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]),
28184642e01fSmrg	[TCPCONN=$enableval], [TCPCONN=yes])
28194642e01fSmrg AC_MSG_CHECKING([if Xtrans should support TCP socket connections])
28204642e01fSmrg AC_MSG_RESULT($TCPCONN)
28214642e01fSmrg if test "$TCPCONN" = "yes"; then
28224642e01fSmrg	AC_DEFINE(TCPCONN,1,[Support TCP socket connections])
28234642e01fSmrg	XTRANS_TCP_FLAGS
28244642e01fSmrg fi
28254642e01fSmrg [case $host_os in
2826d9252ffbSmrg	solaris*)		localdef="yes" ;;
28274642e01fSmrg	*)			localdef="no"  ;;
28284642e01fSmrg esac]
28294642e01fSmrg AC_ARG_ENABLE(local-transport,
283035c4bbdfSmrg	AS_HELP_STRING([--enable-local-transport],[Enable os-specific local transport]),
28314642e01fSmrg	[LOCALCONN=$enableval], [LOCALCONN=$localdef])
28324642e01fSmrg AC_MSG_CHECKING([if Xtrans should support os-specific local connections])
28334642e01fSmrg AC_MSG_RESULT($LOCALCONN)
28344642e01fSmrg if test "$LOCALCONN" = "yes"; then
28354642e01fSmrg	AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
28364642e01fSmrg fi
283735c4bbdfSmrg
283825da500fSmrg # Other functions Xtrans may need
283925da500fSmrg AC_CHECK_FUNCS([strcasecmp strlcpy])
284025da500fSmrg
28414642e01fSmrg]) # XTRANS_CONNECTION_FLAGS
28424642e01fSmrg
28434642e01fSmrg
28444642e01fSmrg# XTRANS_SECURE_RPC_FLAGS()
28454642e01fSmrg# -------------------------
28464642e01fSmrg# Check for Secure RPC functions - must come after XTRANS_TCP_FLAGS
28474642e01fSmrg# so that any necessary networking libraries are already found
28484642e01fSmrgAC_DEFUN([XTRANS_SECURE_RPC_FLAGS],
28494642e01fSmrg[AC_REQUIRE([XTRANS_TCP_FLAGS])
285035c4bbdfSmrg AC_ARG_ENABLE(secure-rpc,
285135c4bbdfSmrg	AS_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]),
28524642e01fSmrg        [SECURE_RPC=$enableval], [SECURE_RPC="try"])
28534642e01fSmrg
28544642e01fSmrg if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then
28554642e01fSmrg	FOUND_SECURE_RPC="no"
28564642e01fSmrg	AC_CHECK_FUNCS([authdes_seccreate authdes_create],
28574642e01fSmrg			[FOUND_SECURE_RPC="yes"])
28584642e01fSmrg	if test "x$FOUND_SECURE_RPC" = "xno" ; then
28594642e01fSmrg		if test "x$SECURE_RPC" = "xyes" ; then
28604642e01fSmrg	AC_MSG_ERROR([Secure RPC requested, but required functions not found])
286135c4bbdfSmrg		fi
28624642e01fSmrg		SECURE_RPC="no"
28634642e01fSmrg	else
28644642e01fSmrg		dnl FreeBSD keeps getsecretkey in librpcsvc
28654642e01fSmrg		AC_SEARCH_LIBS(getsecretkey, [rpcsvc])
28664642e01fSmrg		SECURE_RPC="yes"
28674642e01fSmrg	fi
28684642e01fSmrg fi
28694642e01fSmrg AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported])
28704642e01fSmrg if test "x$SECURE_RPC" = "xyes" ; then
28714642e01fSmrg	AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients])
28724642e01fSmrg fi
28734642e01fSmrg AC_MSG_RESULT($SECURE_RPC)
28744642e01fSmrg]) # XTRANS_SECURE_RPC_FLAGS
28754642e01fSmrg
28764642e01fSmrg
287754b5899cSmrg# Copyright (C) 2002-2024 Free Software Foundation, Inc.
287835c4bbdfSmrg#
287935c4bbdfSmrg# This file is free software; the Free Software Foundation
288035c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
288135c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
288235c4bbdfSmrg
288335c4bbdfSmrg# AM_AUTOMAKE_VERSION(VERSION)
288435c4bbdfSmrg# ----------------------------
288535c4bbdfSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
288635c4bbdfSmrg# generated from the m4 files accompanying Automake X.Y.
288735c4bbdfSmrg# (This private macro should not be called outside this file.)
288835c4bbdfSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
288954b5899cSmrg[am__api_version='1.17'
289035c4bbdfSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
289135c4bbdfSmrgdnl require some minimum version.  Point them to the right macro.
289254b5899cSmrgm4_if([$1], [1.17], [],
289335c4bbdfSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
289435c4bbdfSmrg])
289535c4bbdfSmrg
289635c4bbdfSmrg# _AM_AUTOCONF_VERSION(VERSION)
289735c4bbdfSmrg# -----------------------------
289835c4bbdfSmrg# aclocal traces this macro to find the Autoconf version.
289935c4bbdfSmrg# This is a private macro too.  Using m4_define simplifies
290035c4bbdfSmrg# the logic in aclocal, which can simply ignore this definition.
290135c4bbdfSmrgm4_define([_AM_AUTOCONF_VERSION], [])
290235c4bbdfSmrg
290335c4bbdfSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
290435c4bbdfSmrg# -------------------------------
290535c4bbdfSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
290635c4bbdfSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
290735c4bbdfSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
290854b5899cSmrg[AM_AUTOMAKE_VERSION([1.17])dnl
290935c4bbdfSmrgm4_ifndef([AC_AUTOCONF_VERSION],
291035c4bbdfSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
291135c4bbdfSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
291235c4bbdfSmrg
291335c4bbdfSmrg# Figure out how to run the assembler.                      -*- Autoconf -*-
291435c4bbdfSmrg
291554b5899cSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
291635c4bbdfSmrg#
291735c4bbdfSmrg# This file is free software; the Free Software Foundation
291835c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
291935c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
292035c4bbdfSmrg
292135c4bbdfSmrg# AM_PROG_AS
292235c4bbdfSmrg# ----------
292335c4bbdfSmrgAC_DEFUN([AM_PROG_AS],
292435c4bbdfSmrg[# By default we simply use the C compiler to build assembly code.
292535c4bbdfSmrgAC_REQUIRE([AC_PROG_CC])
292635c4bbdfSmrgtest "${CCAS+set}" = set || CCAS=$CC
292735c4bbdfSmrgtest "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS
292835c4bbdfSmrgAC_ARG_VAR([CCAS],      [assembler compiler command (defaults to CC)])
292935c4bbdfSmrgAC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)])
293035c4bbdfSmrg_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl
293135c4bbdfSmrg])
293235c4bbdfSmrg
293335c4bbdfSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
293435c4bbdfSmrg
293554b5899cSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
293635c4bbdfSmrg#
293735c4bbdfSmrg# This file is free software; the Free Software Foundation
293835c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
293935c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
294035c4bbdfSmrg
294135c4bbdfSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
294235c4bbdfSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
294335c4bbdfSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
294435c4bbdfSmrg#
294535c4bbdfSmrg# Of course, Automake must honor this variable whenever it calls a
294635c4bbdfSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
294735c4bbdfSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
294835c4bbdfSmrg# depending on how configure is run.  This is pretty annoying, since
294935c4bbdfSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
295035c4bbdfSmrg# source directory, any form will work fine, but in subdirectories a
295135c4bbdfSmrg# relative path needs to be adjusted first.
295235c4bbdfSmrg#
295335c4bbdfSmrg# $ac_aux_dir/missing
295435c4bbdfSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
295535c4bbdfSmrg# $top_srcdir/$ac_aux_dir/missing
295635c4bbdfSmrg#    fails if $ac_aux_dir is absolute,
295735c4bbdfSmrg#    fails when called from a subdirectory in a VPATH build with
295835c4bbdfSmrg#          a relative $ac_aux_dir
295935c4bbdfSmrg#
296035c4bbdfSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
296135c4bbdfSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
296235c4bbdfSmrg# harmless because $srcdir is '.', but things will broke when you
296335c4bbdfSmrg# start a VPATH build or use an absolute $srcdir.
296435c4bbdfSmrg#
296535c4bbdfSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
296635c4bbdfSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
296735c4bbdfSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
296835c4bbdfSmrg# and then we would define $MISSING as
296935c4bbdfSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
297035c4bbdfSmrg# This will work as long as MISSING is not called from configure, because
297135c4bbdfSmrg# unfortunately $(top_srcdir) has no meaning in configure.
297235c4bbdfSmrg# However there are other variables, like CC, which are often used in
297335c4bbdfSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
297435c4bbdfSmrg#
297535c4bbdfSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
297635c4bbdfSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
297735c4bbdfSmrg# configured tree to be moved without reconfiguration.
297835c4bbdfSmrg
297935c4bbdfSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
298035c4bbdfSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
298135c4bbdfSmrg# Expand $ac_aux_dir to an absolute path.
298235c4bbdfSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
298335c4bbdfSmrg])
298435c4bbdfSmrg
298535c4bbdfSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
298635c4bbdfSmrg
298754b5899cSmrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
298835c4bbdfSmrg#
298935c4bbdfSmrg# This file is free software; the Free Software Foundation
299035c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
299135c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
299235c4bbdfSmrg
299335c4bbdfSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
299435c4bbdfSmrg# -------------------------------------
299535c4bbdfSmrg# Define a conditional.
299635c4bbdfSmrgAC_DEFUN([AM_CONDITIONAL],
299735c4bbdfSmrg[AC_PREREQ([2.52])dnl
299835c4bbdfSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
299935c4bbdfSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
300035c4bbdfSmrgAC_SUBST([$1_TRUE])dnl
300135c4bbdfSmrgAC_SUBST([$1_FALSE])dnl
300235c4bbdfSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
300335c4bbdfSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
300435c4bbdfSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
300535c4bbdfSmrgif $2; then
300635c4bbdfSmrg  $1_TRUE=
300735c4bbdfSmrg  $1_FALSE='#'
300835c4bbdfSmrgelse
300935c4bbdfSmrg  $1_TRUE='#'
301035c4bbdfSmrg  $1_FALSE=
301135c4bbdfSmrgfi
301235c4bbdfSmrgAC_CONFIG_COMMANDS_PRE(
301335c4bbdfSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
301435c4bbdfSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
301535c4bbdfSmrgUsually this means the macro was only invoked conditionally.]])
301635c4bbdfSmrgfi])])
301735c4bbdfSmrg
301854b5899cSmrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
301935c4bbdfSmrg#
302035c4bbdfSmrg# This file is free software; the Free Software Foundation
302135c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
302235c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
302335c4bbdfSmrg
302435c4bbdfSmrg
302535c4bbdfSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
302635c4bbdfSmrg# written in clear, in which case automake, when reading aclocal.m4,
302735c4bbdfSmrg# will think it sees a *use*, and therefore will trigger all it's
302835c4bbdfSmrg# C support machinery.  Also note that it means that autoscan, seeing
302935c4bbdfSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
303035c4bbdfSmrg
303135c4bbdfSmrg
303235c4bbdfSmrg# _AM_DEPENDENCIES(NAME)
303335c4bbdfSmrg# ----------------------
303435c4bbdfSmrg# See how the compiler implements dependency checking.
303535c4bbdfSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
303635c4bbdfSmrg# We try a few techniques and use that to set a single cache variable.
303735c4bbdfSmrg#
303835c4bbdfSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
303935c4bbdfSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
304035c4bbdfSmrg# dependency, and given that the user is not expected to run this macro,
304135c4bbdfSmrg# just rely on AC_PROG_CC.
304235c4bbdfSmrgAC_DEFUN([_AM_DEPENDENCIES],
304335c4bbdfSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
304435c4bbdfSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
304535c4bbdfSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
304635c4bbdfSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
304735c4bbdfSmrg
304835c4bbdfSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
304935c4bbdfSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
305035c4bbdfSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
305135c4bbdfSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
305235c4bbdfSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
305335c4bbdfSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
305435c4bbdfSmrg                    [depcc="$$1"   am_compiler_list=])
305535c4bbdfSmrg
305635c4bbdfSmrgAC_CACHE_CHECK([dependency style of $depcc],
305735c4bbdfSmrg               [am_cv_$1_dependencies_compiler_type],
305835c4bbdfSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
305935c4bbdfSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
306035c4bbdfSmrg  # making bogus files that we don't know about and never remove.  For
306135c4bbdfSmrg  # instance it was reported that on HP-UX the gcc test will end up
306235c4bbdfSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
306335c4bbdfSmrg  # in D".
306435c4bbdfSmrg  rm -rf conftest.dir
306535c4bbdfSmrg  mkdir conftest.dir
306635c4bbdfSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
306735c4bbdfSmrg  # using a relative directory.
306835c4bbdfSmrg  cp "$am_depcomp" conftest.dir
306935c4bbdfSmrg  cd conftest.dir
307035c4bbdfSmrg  # We will build objects and dependencies in a subdirectory because
307135c4bbdfSmrg  # it helps to detect inapplicable dependency modes.  For instance
307235c4bbdfSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
307335c4bbdfSmrg  # side effect of compilation, but ICC will put the dependencies in
307435c4bbdfSmrg  # the current directory while Tru64 will put them in the object
307535c4bbdfSmrg  # directory.
307635c4bbdfSmrg  mkdir sub
307735c4bbdfSmrg
307835c4bbdfSmrg  am_cv_$1_dependencies_compiler_type=none
307935c4bbdfSmrg  if test "$am_compiler_list" = ""; then
308035c4bbdfSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
308135c4bbdfSmrg  fi
308235c4bbdfSmrg  am__universal=false
308335c4bbdfSmrg  m4_case([$1], [CC],
308435c4bbdfSmrg    [case " $depcc " in #(
308535c4bbdfSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
308635c4bbdfSmrg     esac],
308735c4bbdfSmrg    [CXX],
308835c4bbdfSmrg    [case " $depcc " in #(
308935c4bbdfSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
309035c4bbdfSmrg     esac])
309135c4bbdfSmrg
309235c4bbdfSmrg  for depmode in $am_compiler_list; do
309335c4bbdfSmrg    # Setup a source with many dependencies, because some compilers
309435c4bbdfSmrg    # like to wrap large dependency lists on column 80 (with \), and
309535c4bbdfSmrg    # we should not choose a depcomp mode which is confused by this.
309635c4bbdfSmrg    #
309735c4bbdfSmrg    # We need to recreate these files for each test, as the compiler may
309835c4bbdfSmrg    # overwrite some of them when testing with obscure command lines.
309935c4bbdfSmrg    # This happens at least with the AIX C compiler.
310035c4bbdfSmrg    : > sub/conftest.c
310135c4bbdfSmrg    for i in 1 2 3 4 5 6; do
310235c4bbdfSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
310335c4bbdfSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
310435c4bbdfSmrg      # Solaris 10 /bin/sh.
310535c4bbdfSmrg      echo '/* dummy */' > sub/conftst$i.h
310635c4bbdfSmrg    done
310735c4bbdfSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
310835c4bbdfSmrg
310935c4bbdfSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
311035c4bbdfSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
311135c4bbdfSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
311235c4bbdfSmrg    # versions had trouble with output in subdirs.
311335c4bbdfSmrg    am__obj=sub/conftest.${OBJEXT-o}
311435c4bbdfSmrg    am__minus_obj="-o $am__obj"
311535c4bbdfSmrg    case $depmode in
311635c4bbdfSmrg    gcc)
311735c4bbdfSmrg      # This depmode causes a compiler race in universal mode.
311835c4bbdfSmrg      test "$am__universal" = false || continue
311935c4bbdfSmrg      ;;
312035c4bbdfSmrg    nosideeffect)
312135c4bbdfSmrg      # After this tag, mechanisms are not by side-effect, so they'll
312235c4bbdfSmrg      # only be used when explicitly requested.
312335c4bbdfSmrg      if test "x$enable_dependency_tracking" = xyes; then
312435c4bbdfSmrg	continue
312535c4bbdfSmrg      else
312635c4bbdfSmrg	break
312735c4bbdfSmrg      fi
312835c4bbdfSmrg      ;;
312935c4bbdfSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
313035c4bbdfSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
313135c4bbdfSmrg      # not run yet.  These depmodes are late enough in the game, and
313235c4bbdfSmrg      # so weak that their functioning should not be impacted.
313335c4bbdfSmrg      am__obj=conftest.${OBJEXT-o}
313435c4bbdfSmrg      am__minus_obj=
313535c4bbdfSmrg      ;;
313635c4bbdfSmrg    none) break ;;
313735c4bbdfSmrg    esac
313835c4bbdfSmrg    if depmode=$depmode \
313935c4bbdfSmrg       source=sub/conftest.c object=$am__obj \
314035c4bbdfSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
314135c4bbdfSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
314235c4bbdfSmrg         >/dev/null 2>conftest.err &&
314335c4bbdfSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
314435c4bbdfSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
314535c4bbdfSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
314635c4bbdfSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
314735c4bbdfSmrg      # icc doesn't choke on unknown options, it will just issue warnings
314835c4bbdfSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
314935c4bbdfSmrg      # that says an option was ignored or not supported.
315054b5899cSmrg      # When given -MP, icc 7.0 and 7.1 complain thus:
315135c4bbdfSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
315235c4bbdfSmrg      # The diagnosis changed in icc 8.0:
315335c4bbdfSmrg      #   icc: Command line remark: option '-MP' not supported
315435c4bbdfSmrg      if (grep 'ignoring option' conftest.err ||
315535c4bbdfSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
315635c4bbdfSmrg        am_cv_$1_dependencies_compiler_type=$depmode
315735c4bbdfSmrg        break
315835c4bbdfSmrg      fi
315935c4bbdfSmrg    fi
316035c4bbdfSmrg  done
316135c4bbdfSmrg
316235c4bbdfSmrg  cd ..
316335c4bbdfSmrg  rm -rf conftest.dir
316435c4bbdfSmrgelse
316535c4bbdfSmrg  am_cv_$1_dependencies_compiler_type=none
316635c4bbdfSmrgfi
316735c4bbdfSmrg])
316835c4bbdfSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
316935c4bbdfSmrgAM_CONDITIONAL([am__fastdep$1], [
317035c4bbdfSmrg  test "x$enable_dependency_tracking" != xno \
317135c4bbdfSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
317235c4bbdfSmrg])
317335c4bbdfSmrg
317435c4bbdfSmrg
317535c4bbdfSmrg# AM_SET_DEPDIR
317635c4bbdfSmrg# -------------
317735c4bbdfSmrg# Choose a directory name for dependency files.
317835c4bbdfSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
317935c4bbdfSmrgAC_DEFUN([AM_SET_DEPDIR],
318035c4bbdfSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
318135c4bbdfSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
318235c4bbdfSmrg])
318335c4bbdfSmrg
318435c4bbdfSmrg
318535c4bbdfSmrg# AM_DEP_TRACK
318635c4bbdfSmrg# ------------
318735c4bbdfSmrgAC_DEFUN([AM_DEP_TRACK],
318835c4bbdfSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
318935c4bbdfSmrgAS_HELP_STRING(
319035c4bbdfSmrg  [--enable-dependency-tracking],
319135c4bbdfSmrg  [do not reject slow dependency extractors])
319235c4bbdfSmrgAS_HELP_STRING(
319335c4bbdfSmrg  [--disable-dependency-tracking],
319435c4bbdfSmrg  [speeds up one-time build])])
319535c4bbdfSmrgif test "x$enable_dependency_tracking" != xno; then
319635c4bbdfSmrg  am_depcomp="$ac_aux_dir/depcomp"
319735c4bbdfSmrg  AMDEPBACKSLASH='\'
319835c4bbdfSmrg  am__nodep='_no'
319935c4bbdfSmrgfi
320035c4bbdfSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
320135c4bbdfSmrgAC_SUBST([AMDEPBACKSLASH])dnl
320235c4bbdfSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
320335c4bbdfSmrgAC_SUBST([am__nodep])dnl
320435c4bbdfSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
320535c4bbdfSmrg])
320635c4bbdfSmrg
320735c4bbdfSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
320835c4bbdfSmrg
320954b5899cSmrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
321035c4bbdfSmrg#
321135c4bbdfSmrg# This file is free software; the Free Software Foundation
321235c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
321335c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
321435c4bbdfSmrg
321535c4bbdfSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
321635c4bbdfSmrg# ------------------------------
321735c4bbdfSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
321835c4bbdfSmrg[{
321935c4bbdfSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
322035c4bbdfSmrg  # are listed without --file.  Let's play safe and only enable the eval
322135c4bbdfSmrg  # if we detect the quoting.
3222e23ec014Smrg  # TODO: see whether this extra hack can be removed once we start
3223e23ec014Smrg  # requiring Autoconf 2.70 or later.
3224e23ec014Smrg  AS_CASE([$CONFIG_FILES],
3225e23ec014Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
3226e23ec014Smrg          [*], [set x $CONFIG_FILES])
322735c4bbdfSmrg  shift
3228e23ec014Smrg  # Used to flag and report bootstrapping failures.
3229e23ec014Smrg  am_rc=0
3230e23ec014Smrg  for am_mf
323135c4bbdfSmrg  do
323235c4bbdfSmrg    # Strip MF so we end up with the name of the file.
3233e23ec014Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
3234e23ec014Smrg    # Check whether this is an Automake generated Makefile which includes
3235e23ec014Smrg    # dependency-tracking related rules and includes.
3236e23ec014Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
323735c4bbdfSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
3238e23ec014Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
3239e23ec014Smrg      || continue
3240e23ec014Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
3241e23ec014Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
3242e23ec014Smrg    AM_RUN_LOG([cd "$am_dirpart" \
3243e23ec014Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
3244e23ec014Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
324535c4bbdfSmrg  done
3246e23ec014Smrg  if test $am_rc -ne 0; then
3247e23ec014Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
3248dc61d50dSmrg    for automatic dependency tracking.  If GNU make was not used, consider
3249dc61d50dSmrg    re-running the configure script with MAKE="gmake" (or whatever is
3250dc61d50dSmrg    necessary).  You can also try re-running configure with the
3251e23ec014Smrg    '--disable-dependency-tracking' option to at least be able to build
3252e23ec014Smrg    the package (albeit without support for automatic dependency tracking).])
3253e23ec014Smrg  fi
3254e23ec014Smrg  AS_UNSET([am_dirpart])
3255e23ec014Smrg  AS_UNSET([am_filepart])
3256e23ec014Smrg  AS_UNSET([am_mf])
3257e23ec014Smrg  AS_UNSET([am_rc])
3258e23ec014Smrg  rm -f conftest-deps.mk
325935c4bbdfSmrg}
326035c4bbdfSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
326135c4bbdfSmrg
326235c4bbdfSmrg
326335c4bbdfSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
326435c4bbdfSmrg# -----------------------------
326535c4bbdfSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
326635c4bbdfSmrg#
3267e23ec014Smrg# This code is only required when automatic dependency tracking is enabled.
3268e23ec014Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
3269e23ec014Smrg# order to bootstrap the dependency handling code.
327035c4bbdfSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
327135c4bbdfSmrg[AC_CONFIG_COMMANDS([depfiles],
327235c4bbdfSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
3273e23ec014Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
327435c4bbdfSmrg
327535c4bbdfSmrg# Do all the work for Automake.                             -*- Autoconf -*-
327635c4bbdfSmrg
327754b5899cSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
327835c4bbdfSmrg#
327935c4bbdfSmrg# This file is free software; the Free Software Foundation
328035c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
328135c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
328235c4bbdfSmrg
328335c4bbdfSmrg# This macro actually does too much.  Some checks are only needed if
328435c4bbdfSmrg# your package does certain things.  But this isn't really a big deal.
328535c4bbdfSmrg
328635c4bbdfSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
328735c4bbdfSmrgm4_define([AC_PROG_CC],
328835c4bbdfSmrgm4_defn([AC_PROG_CC])
328935c4bbdfSmrg[_AM_PROG_CC_C_O
329035c4bbdfSmrg])
329135c4bbdfSmrg
329235c4bbdfSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
329335c4bbdfSmrg# AM_INIT_AUTOMAKE([OPTIONS])
329435c4bbdfSmrg# -----------------------------------------------
329535c4bbdfSmrg# The call with PACKAGE and VERSION arguments is the old style
329635c4bbdfSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
329735c4bbdfSmrg# and VERSION should now be passed to AC_INIT and removed from
329835c4bbdfSmrg# the call to AM_INIT_AUTOMAKE.
329935c4bbdfSmrg# We support both call styles for the transition.  After
330035c4bbdfSmrg# the next Automake release, Autoconf can make the AC_INIT
330135c4bbdfSmrg# arguments mandatory, and then we can depend on a new Autoconf
330235c4bbdfSmrg# release and drop the old call support.
330335c4bbdfSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
330435c4bbdfSmrg[AC_PREREQ([2.65])dnl
3305c82838c1Smrgm4_ifdef([_$0_ALREADY_INIT],
3306c82838c1Smrg  [m4_fatal([$0 expanded multiple times
3307c82838c1Smrg]m4_defn([_$0_ALREADY_INIT]))],
3308c82838c1Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
330935c4bbdfSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
331035c4bbdfSmrgdnl the ones we care about.
331135c4bbdfSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
331235c4bbdfSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
331335c4bbdfSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
331435c4bbdfSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
331535c4bbdfSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
331635c4bbdfSmrg  # is not polluted with repeated "-I."
331735c4bbdfSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
331835c4bbdfSmrg  # test to see if srcdir already configured
331935c4bbdfSmrg  if test -f $srcdir/config.status; then
332035c4bbdfSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
332135c4bbdfSmrg  fi
332235c4bbdfSmrgfi
332335c4bbdfSmrg
332435c4bbdfSmrg# test whether we have cygpath
332535c4bbdfSmrgif test -z "$CYGPATH_W"; then
332635c4bbdfSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
332735c4bbdfSmrg    CYGPATH_W='cygpath -w'
332835c4bbdfSmrg  else
332935c4bbdfSmrg    CYGPATH_W=echo
333035c4bbdfSmrg  fi
333135c4bbdfSmrgfi
333235c4bbdfSmrgAC_SUBST([CYGPATH_W])
333335c4bbdfSmrg
333435c4bbdfSmrg# Define the identity of the package.
333535c4bbdfSmrgdnl Distinguish between old-style and new-style calls.
333635c4bbdfSmrgm4_ifval([$2],
333735c4bbdfSmrg[AC_DIAGNOSE([obsolete],
333835c4bbdfSmrg             [$0: two- and three-arguments forms are deprecated.])
333935c4bbdfSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
334035c4bbdfSmrg AC_SUBST([PACKAGE], [$1])dnl
334135c4bbdfSmrg AC_SUBST([VERSION], [$2])],
334235c4bbdfSmrg[_AM_SET_OPTIONS([$1])dnl
334335c4bbdfSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
334435c4bbdfSmrgm4_if(
3345c82838c1Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
334635c4bbdfSmrg  [ok:ok],,
334735c4bbdfSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
334835c4bbdfSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
334935c4bbdfSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
335035c4bbdfSmrg
335135c4bbdfSmrg_AM_IF_OPTION([no-define],,
335235c4bbdfSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
335335c4bbdfSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
335435c4bbdfSmrg
335535c4bbdfSmrg# Some tools Automake needs.
335635c4bbdfSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
335735c4bbdfSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
335835c4bbdfSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
335935c4bbdfSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
336035c4bbdfSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
336135c4bbdfSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
336235c4bbdfSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
336335c4bbdfSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
336435c4bbdfSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
336535c4bbdfSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
336635c4bbdfSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
336735c4bbdfSmrg# dies out for good.  For more background, see:
3368e23ec014Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
3369e23ec014Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
337035c4bbdfSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
337135c4bbdfSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
337235c4bbdfSmrg# system "awk" is bad on some platforms.
337335c4bbdfSmrgAC_REQUIRE([AC_PROG_AWK])dnl
337435c4bbdfSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
337535c4bbdfSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
337635c4bbdfSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
337735c4bbdfSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
337835c4bbdfSmrg			     [_AM_PROG_TAR([v7])])])
337935c4bbdfSmrg_AM_IF_OPTION([no-dependencies],,
338035c4bbdfSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
338135c4bbdfSmrg		  [_AM_DEPENDENCIES([CC])],
338235c4bbdfSmrg		  [m4_define([AC_PROG_CC],
338335c4bbdfSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
338435c4bbdfSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
338535c4bbdfSmrg		  [_AM_DEPENDENCIES([CXX])],
338635c4bbdfSmrg		  [m4_define([AC_PROG_CXX],
338735c4bbdfSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
338835c4bbdfSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
338935c4bbdfSmrg		  [_AM_DEPENDENCIES([OBJC])],
339035c4bbdfSmrg		  [m4_define([AC_PROG_OBJC],
339135c4bbdfSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
339235c4bbdfSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
339335c4bbdfSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
339435c4bbdfSmrg		  [m4_define([AC_PROG_OBJCXX],
339535c4bbdfSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
339635c4bbdfSmrg])
3397c82838c1Smrg# Variables for tags utilities; see am/tags.am
3398c82838c1Smrgif test -z "$CTAGS"; then
3399c82838c1Smrg  CTAGS=ctags
3400c82838c1Smrgfi
3401c82838c1SmrgAC_SUBST([CTAGS])
3402c82838c1Smrgif test -z "$ETAGS"; then
3403c82838c1Smrg  ETAGS=etags
3404c82838c1Smrgfi
3405c82838c1SmrgAC_SUBST([ETAGS])
3406c82838c1Smrgif test -z "$CSCOPE"; then
3407c82838c1Smrg  CSCOPE=cscope
3408c82838c1Smrgfi
3409c82838c1SmrgAC_SUBST([CSCOPE])
3410c82838c1Smrg
341154b5899cSmrgAC_REQUIRE([_AM_SILENT_RULES])dnl
341235c4bbdfSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
341335c4bbdfSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
341435c4bbdfSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
341535c4bbdfSmrgAC_CONFIG_COMMANDS_PRE(dnl
341635c4bbdfSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
341735c4bbdfSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
341835c4bbdfSmrg
341954b5899cSmrgAC_REQUIRE([_AM_PROG_RM_F])
342054b5899cSmrgAC_REQUIRE([_AM_PROG_XARGS_N])
342135c4bbdfSmrg
342235c4bbdfSmrgdnl The trailing newline in this macro's definition is deliberate, for
342335c4bbdfSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
342435c4bbdfSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
342535c4bbdfSmrg])
342635c4bbdfSmrg
342735c4bbdfSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
342835c4bbdfSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
342935c4bbdfSmrgdnl mangled by Autoconf and run in a shell conditional statement.
343035c4bbdfSmrgm4_define([_AC_COMPILER_EXEEXT],
343135c4bbdfSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
343235c4bbdfSmrg
343335c4bbdfSmrg# When config.status generates a header, we must update the stamp-h file.
343435c4bbdfSmrg# This file resides in the same directory as the config header
343535c4bbdfSmrg# that is generated.  The stamp files are numbered to have different names.
343635c4bbdfSmrg
343735c4bbdfSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
343835c4bbdfSmrg# loop where config.status creates the headers, so we can generate
343935c4bbdfSmrg# our stamp files there.
344035c4bbdfSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
344135c4bbdfSmrg[# Compute $1's index in $config_headers.
344235c4bbdfSmrg_am_arg=$1
344335c4bbdfSmrg_am_stamp_count=1
344435c4bbdfSmrgfor _am_header in $config_headers :; do
344535c4bbdfSmrg  case $_am_header in
344635c4bbdfSmrg    $_am_arg | $_am_arg:* )
344735c4bbdfSmrg      break ;;
344835c4bbdfSmrg    * )
344935c4bbdfSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
345035c4bbdfSmrg  esac
345135c4bbdfSmrgdone
345235c4bbdfSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
345335c4bbdfSmrg
345454b5899cSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
345535c4bbdfSmrg#
345635c4bbdfSmrg# This file is free software; the Free Software Foundation
345735c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
345835c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
345935c4bbdfSmrg
346035c4bbdfSmrg# AM_PROG_INSTALL_SH
346135c4bbdfSmrg# ------------------
346235c4bbdfSmrg# Define $install_sh.
346335c4bbdfSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
346435c4bbdfSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
346535c4bbdfSmrgif test x"${install_sh+set}" != xset; then
346635c4bbdfSmrg  case $am_aux_dir in
346735c4bbdfSmrg  *\ * | *\	*)
346835c4bbdfSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
346935c4bbdfSmrg  *)
347035c4bbdfSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
347135c4bbdfSmrg  esac
347235c4bbdfSmrgfi
347335c4bbdfSmrgAC_SUBST([install_sh])])
347435c4bbdfSmrg
347554b5899cSmrg# Copyright (C) 2003-2024 Free Software Foundation, Inc.
347635c4bbdfSmrg#
347735c4bbdfSmrg# This file is free software; the Free Software Foundation
347835c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
347935c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
348035c4bbdfSmrg
348135c4bbdfSmrg# Check whether the underlying file-system supports filenames
348235c4bbdfSmrg# with a leading dot.  For instance MS-DOS doesn't.
348335c4bbdfSmrgAC_DEFUN([AM_SET_LEADING_DOT],
348435c4bbdfSmrg[rm -rf .tst 2>/dev/null
348535c4bbdfSmrgmkdir .tst 2>/dev/null
348635c4bbdfSmrgif test -d .tst; then
348735c4bbdfSmrg  am__leading_dot=.
348835c4bbdfSmrgelse
348935c4bbdfSmrg  am__leading_dot=_
349035c4bbdfSmrgfi
349135c4bbdfSmrgrmdir .tst 2>/dev/null
349235c4bbdfSmrgAC_SUBST([am__leading_dot])])
349335c4bbdfSmrg
349435c4bbdfSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
349535c4bbdfSmrg
349654b5899cSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
349735c4bbdfSmrg#
349835c4bbdfSmrg# This file is free software; the Free Software Foundation
349935c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
350035c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
350135c4bbdfSmrg
350235c4bbdfSmrg# AM_MAKE_INCLUDE()
350335c4bbdfSmrg# -----------------
3504e23ec014Smrg# Check whether make has an 'include' directive that can support all
3505e23ec014Smrg# the idioms we need for our automatic dependency tracking code.
350635c4bbdfSmrgAC_DEFUN([AM_MAKE_INCLUDE],
3507e23ec014Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
3508e23ec014Smrgcat > confinc.mk << 'END'
350935c4bbdfSmrgam__doit:
3510e23ec014Smrg	@echo this is the am__doit target >confinc.out
351135c4bbdfSmrg.PHONY: am__doit
351235c4bbdfSmrgEND
351335c4bbdfSmrgam__include="#"
351435c4bbdfSmrgam__quote=
3515e23ec014Smrg# BSD make does it like this.
3516e23ec014Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
3517e23ec014Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
3518e23ec014Smrgecho 'include confinc.mk # ignored' > confmf.GNU
3519e23ec014Smrg_am_result=no
3520e23ec014Smrgfor s in GNU BSD; do
3521e23ec014Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
3522e23ec014Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
3523e23ec014Smrg      ['0:this is the am__doit target'],
3524e23ec014Smrg      [AS_CASE([$s],
3525e23ec014Smrg          [BSD], [am__include='.include' am__quote='"'],
3526e23ec014Smrg          [am__include='include' am__quote=''])])
3527e23ec014Smrg  if test "$am__include" != "#"; then
3528e23ec014Smrg    _am_result="yes ($s style)"
3529e23ec014Smrg    break
3530e23ec014Smrg  fi
3531e23ec014Smrgdone
3532e23ec014Smrgrm -f confinc.* confmf.*
3533e23ec014SmrgAC_MSG_RESULT([${_am_result}])
3534e23ec014SmrgAC_SUBST([am__include])])
3535e23ec014SmrgAC_SUBST([am__quote])])
353635c4bbdfSmrg
353735c4bbdfSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
353835c4bbdfSmrg
353954b5899cSmrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
354035c4bbdfSmrg#
354135c4bbdfSmrg# This file is free software; the Free Software Foundation
354235c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
354335c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
354435c4bbdfSmrg
354535c4bbdfSmrg# AM_MISSING_PROG(NAME, PROGRAM)
354635c4bbdfSmrg# ------------------------------
354735c4bbdfSmrgAC_DEFUN([AM_MISSING_PROG],
354835c4bbdfSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
354935c4bbdfSmrg$1=${$1-"${am_missing_run}$2"}
355035c4bbdfSmrgAC_SUBST($1)])
355135c4bbdfSmrg
355235c4bbdfSmrg# AM_MISSING_HAS_RUN
355335c4bbdfSmrg# ------------------
355435c4bbdfSmrg# Define MISSING if not defined so far and test if it is modern enough.
355535c4bbdfSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
355635c4bbdfSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
355735c4bbdfSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
355835c4bbdfSmrgAC_REQUIRE_AUX_FILE([missing])dnl
355935c4bbdfSmrgif test x"${MISSING+set}" != xset; then
3560dc61d50dSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
356135c4bbdfSmrgfi
356235c4bbdfSmrg# Use eval to expand $SHELL
356335c4bbdfSmrgif eval "$MISSING --is-lightweight"; then
356435c4bbdfSmrg  am_missing_run="$MISSING "
356535c4bbdfSmrgelse
356635c4bbdfSmrg  am_missing_run=
356735c4bbdfSmrg  AC_MSG_WARN(['missing' script is too old or missing])
356835c4bbdfSmrgfi
356935c4bbdfSmrg])
357035c4bbdfSmrg
357135c4bbdfSmrg# Helper functions for option handling.                     -*- Autoconf -*-
357235c4bbdfSmrg
357354b5899cSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
357435c4bbdfSmrg#
357535c4bbdfSmrg# This file is free software; the Free Software Foundation
357635c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
357735c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
357835c4bbdfSmrg
357935c4bbdfSmrg# _AM_MANGLE_OPTION(NAME)
358035c4bbdfSmrg# -----------------------
358135c4bbdfSmrgAC_DEFUN([_AM_MANGLE_OPTION],
358235c4bbdfSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
358335c4bbdfSmrg
358435c4bbdfSmrg# _AM_SET_OPTION(NAME)
358535c4bbdfSmrg# --------------------
358635c4bbdfSmrg# Set option NAME.  Presently that only means defining a flag for this option.
358735c4bbdfSmrgAC_DEFUN([_AM_SET_OPTION],
358835c4bbdfSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
358935c4bbdfSmrg
359035c4bbdfSmrg# _AM_SET_OPTIONS(OPTIONS)
359135c4bbdfSmrg# ------------------------
359235c4bbdfSmrg# OPTIONS is a space-separated list of Automake options.
359335c4bbdfSmrgAC_DEFUN([_AM_SET_OPTIONS],
359435c4bbdfSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
359535c4bbdfSmrg
359635c4bbdfSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
359735c4bbdfSmrg# -------------------------------------------
359835c4bbdfSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
359935c4bbdfSmrgAC_DEFUN([_AM_IF_OPTION],
360035c4bbdfSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
360135c4bbdfSmrg
360254b5899cSmrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
360335c4bbdfSmrg#
360435c4bbdfSmrg# This file is free software; the Free Software Foundation
360535c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
360635c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
360735c4bbdfSmrg
360835c4bbdfSmrg# _AM_PROG_CC_C_O
360935c4bbdfSmrg# ---------------
361035c4bbdfSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
361135c4bbdfSmrg# to automatically call this.
361235c4bbdfSmrgAC_DEFUN([_AM_PROG_CC_C_O],
361335c4bbdfSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
361435c4bbdfSmrgAC_REQUIRE_AUX_FILE([compile])dnl
361535c4bbdfSmrgAC_LANG_PUSH([C])dnl
361635c4bbdfSmrgAC_CACHE_CHECK(
361735c4bbdfSmrg  [whether $CC understands -c and -o together],
361835c4bbdfSmrg  [am_cv_prog_cc_c_o],
361935c4bbdfSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
362035c4bbdfSmrg  # Make sure it works both with $CC and with simple cc.
362135c4bbdfSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
362235c4bbdfSmrg  # compilers refuse to overwrite an existing .o file with -o,
362335c4bbdfSmrg  # though they will create one.
362435c4bbdfSmrg  am_cv_prog_cc_c_o=yes
362535c4bbdfSmrg  for am_i in 1 2; do
362635c4bbdfSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
362735c4bbdfSmrg         && test -f conftest2.$ac_objext; then
362835c4bbdfSmrg      : OK
362935c4bbdfSmrg    else
363035c4bbdfSmrg      am_cv_prog_cc_c_o=no
363135c4bbdfSmrg      break
363235c4bbdfSmrg    fi
363335c4bbdfSmrg  done
363435c4bbdfSmrg  rm -f core conftest*
363535c4bbdfSmrg  unset am_i])
363635c4bbdfSmrgif test "$am_cv_prog_cc_c_o" != yes; then
363735c4bbdfSmrg   # Losing compiler, so override with the script.
363835c4bbdfSmrg   # FIXME: It is wrong to rewrite CC.
363935c4bbdfSmrg   # But if we don't then we get into trouble of one sort or another.
364035c4bbdfSmrg   # A longer-term fix would be to have automake use am__CC in this case,
364135c4bbdfSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
364235c4bbdfSmrg   CC="$am_aux_dir/compile $CC"
364335c4bbdfSmrgfi
364435c4bbdfSmrgAC_LANG_POP([C])])
364535c4bbdfSmrg
364635c4bbdfSmrg# For backward compatibility.
364735c4bbdfSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
364835c4bbdfSmrg
364954b5899cSmrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
365054b5899cSmrg#
365154b5899cSmrg# This file is free software; the Free Software Foundation
365254b5899cSmrg# gives unlimited permission to copy and/or distribute it,
365354b5899cSmrg# with or without modifications, as long as this notice is preserved.
365454b5899cSmrg
365554b5899cSmrg# _AM_PROG_RM_F
365654b5899cSmrg# ---------------
365754b5899cSmrg# Check whether 'rm -f' without any arguments works.
365854b5899cSmrg# https://bugs.gnu.org/10828
365954b5899cSmrgAC_DEFUN([_AM_PROG_RM_F],
366054b5899cSmrg[am__rm_f_notfound=
366154b5899cSmrgAS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""'])
366254b5899cSmrgAC_SUBST(am__rm_f_notfound)
366354b5899cSmrg])
366454b5899cSmrg
366554b5899cSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
366635c4bbdfSmrg#
366735c4bbdfSmrg# This file is free software; the Free Software Foundation
366835c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
366935c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
367035c4bbdfSmrg
367135c4bbdfSmrg# AM_RUN_LOG(COMMAND)
367235c4bbdfSmrg# -------------------
367335c4bbdfSmrg# Run COMMAND, save the exit status in ac_status, and log it.
367435c4bbdfSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
367535c4bbdfSmrgAC_DEFUN([AM_RUN_LOG],
367635c4bbdfSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
367735c4bbdfSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
367835c4bbdfSmrg   ac_status=$?
367935c4bbdfSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
368035c4bbdfSmrg   (exit $ac_status); }])
368135c4bbdfSmrg
368235c4bbdfSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
368335c4bbdfSmrg
368454b5899cSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
368535c4bbdfSmrg#
368635c4bbdfSmrg# This file is free software; the Free Software Foundation
368735c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
368835c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
368935c4bbdfSmrg
369054b5899cSmrg# _AM_SLEEP_FRACTIONAL_SECONDS
369154b5899cSmrg# ----------------------------
369254b5899cSmrgAC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl
369354b5899cSmrgAC_CACHE_CHECK([whether sleep supports fractional seconds],
369454b5899cSmrg               am_cv_sleep_fractional_seconds, [dnl
369554b5899cSmrgAS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes],
369654b5899cSmrg                                 [am_cv_sleep_fractional_seconds=no])
369754b5899cSmrg])])
369854b5899cSmrg
369954b5899cSmrg# _AM_FILESYSTEM_TIMESTAMP_RESOLUTION
370054b5899cSmrg# -----------------------------------
370154b5899cSmrg# Determine the filesystem's resolution for file modification
370254b5899cSmrg# timestamps.  The coarsest we know of is FAT, with a resolution
370354b5899cSmrg# of only two seconds, even with the most recent "exFAT" extensions.
370454b5899cSmrg# The finest (e.g. ext4 with large inodes, XFS, ZFS) is one
370554b5899cSmrg# nanosecond, matching clock_gettime.  However, it is probably not
370654b5899cSmrg# possible to delay execution of a shell script for less than one
370754b5899cSmrg# millisecond, due to process creation overhead and scheduling
370854b5899cSmrg# granularity, so we don't check for anything finer than that. (See below.)
370954b5899cSmrgAC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl
371054b5899cSmrgAC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS])
371154b5899cSmrgAC_CACHE_CHECK([filesystem timestamp resolution],
371254b5899cSmrg               am_cv_filesystem_timestamp_resolution, [dnl
371354b5899cSmrg# Default to the worst case.
371454b5899cSmrgam_cv_filesystem_timestamp_resolution=2
371554b5899cSmrg
371654b5899cSmrg# Only try to go finer than 1 sec if sleep can do it.
371754b5899cSmrg# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work,
371854b5899cSmrg# - 1 sec is not much of a win compared to 2 sec, and
371954b5899cSmrg# - it takes 2 seconds to perform the test whether 1 sec works.
372054b5899cSmrg# 
372154b5899cSmrg# Instead, just use the default 2s on platforms that have 1s resolution,
372254b5899cSmrg# accept the extra 1s delay when using $sleep in the Automake tests, in
372354b5899cSmrg# exchange for not incurring the 2s delay for running the test for all
372454b5899cSmrg# packages.
372554b5899cSmrg#
372654b5899cSmrgam_try_resolutions=
372754b5899cSmrgif test "$am_cv_sleep_fractional_seconds" = yes; then
372854b5899cSmrg  # Even a millisecond often causes a bunch of false positives,
372954b5899cSmrg  # so just try a hundredth of a second. The time saved between .001 and
373054b5899cSmrg  # .01 is not terribly consequential.
373154b5899cSmrg  am_try_resolutions="0.01 0.1 $am_try_resolutions"
373254b5899cSmrgfi
373354b5899cSmrg
373454b5899cSmrg# In order to catch current-generation FAT out, we must *modify* files
373554b5899cSmrg# that already exist; the *creation* timestamp is finer.  Use names
373654b5899cSmrg# that make ls -t sort them differently when they have equal
373754b5899cSmrg# timestamps than when they have distinct timestamps, keeping
373854b5899cSmrg# in mind that ls -t prints the *newest* file first.
373954b5899cSmrgrm -f conftest.ts?
374054b5899cSmrg: > conftest.ts1
374154b5899cSmrg: > conftest.ts2
374254b5899cSmrg: > conftest.ts3
374354b5899cSmrg
374454b5899cSmrg# Make sure ls -t actually works.  Do 'set' in a subshell so we don't
374554b5899cSmrg# clobber the current shell's arguments. (Outer-level square brackets
374654b5899cSmrg# are removed by m4; they're present so that m4 does not expand
374754b5899cSmrg# <dollar><star>; be careful, easy to get confused.)
374854b5899cSmrgif (
374954b5899cSmrg     set X `[ls -t conftest.ts[12]]` &&
375054b5899cSmrg     {
375154b5899cSmrg       test "$[]*" != "X conftest.ts1 conftest.ts2" ||
375254b5899cSmrg       test "$[]*" != "X conftest.ts2 conftest.ts1";
375354b5899cSmrg     }
375454b5899cSmrg); then :; else
375554b5899cSmrg  # If neither matched, then we have a broken ls.  This can happen
375654b5899cSmrg  # if, for instance, CONFIG_SHELL is bash and it inherits a
375754b5899cSmrg  # broken ls alias from the environment.  This has actually
375854b5899cSmrg  # happened.  Such a system could not be considered "sane".
375954b5899cSmrg  _AS_ECHO_UNQUOTED(
376054b5899cSmrg    ["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""],
376154b5899cSmrg    [AS_MESSAGE_LOG_FD])
376254b5899cSmrg  AC_MSG_FAILURE([ls -t produces unexpected output.
376354b5899cSmrgMake sure there is not a broken ls alias in your environment.])
376454b5899cSmrgfi
376554b5899cSmrg
376654b5899cSmrgfor am_try_res in $am_try_resolutions; do
376754b5899cSmrg  # Any one fine-grained sleep might happen to cross the boundary
376854b5899cSmrg  # between two values of a coarser actual resolution, but if we do
376954b5899cSmrg  # two fine-grained sleeps in a row, at least one of them will fall
377054b5899cSmrg  # entirely within a coarse interval.
377154b5899cSmrg  echo alpha > conftest.ts1
377254b5899cSmrg  sleep $am_try_res
377354b5899cSmrg  echo beta > conftest.ts2
377454b5899cSmrg  sleep $am_try_res
377554b5899cSmrg  echo gamma > conftest.ts3
377654b5899cSmrg
377754b5899cSmrg  # We assume that 'ls -t' will make use of high-resolution
377854b5899cSmrg  # timestamps if the operating system supports them at all.
377954b5899cSmrg  if (set X `ls -t conftest.ts?` &&
378054b5899cSmrg      test "$[]2" = conftest.ts3 &&
378154b5899cSmrg      test "$[]3" = conftest.ts2 &&
378254b5899cSmrg      test "$[]4" = conftest.ts1); then
378354b5899cSmrg    #
378454b5899cSmrg    # Ok, ls -t worked. If we're at a resolution of 1 second, we're done,
378554b5899cSmrg    # because we don't need to test make.
378654b5899cSmrg    make_ok=true
378754b5899cSmrg    if test $am_try_res != 1; then
378854b5899cSmrg      # But if we've succeeded so far with a subsecond resolution, we
378954b5899cSmrg      # have one more thing to check: make. It can happen that
379054b5899cSmrg      # everything else supports the subsecond mtimes, but make doesn't;
379154b5899cSmrg      # notably on macOS, which ships make 3.81 from 2006 (the last one
379254b5899cSmrg      # released under GPLv2). https://bugs.gnu.org/68808
379354b5899cSmrg      # 
379454b5899cSmrg      # We test $MAKE if it is defined in the environment, else "make".
379554b5899cSmrg      # It might get overridden later, but our hope is that in practice
379654b5899cSmrg      # it does not matter: it is the system "make" which is (by far)
379754b5899cSmrg      # the most likely to be broken, whereas if the user overrides it,
379854b5899cSmrg      # probably they did so with a better, or at least not worse, make.
379954b5899cSmrg      # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html
380054b5899cSmrg      #
380154b5899cSmrg      # Create a Makefile (real tab character here):
380254b5899cSmrg      rm -f conftest.mk
380354b5899cSmrg      echo 'conftest.ts1: conftest.ts2' >conftest.mk
380454b5899cSmrg      echo '	touch conftest.ts2' >>conftest.mk
380554b5899cSmrg      #
380654b5899cSmrg      # Now, running
380754b5899cSmrg      #   touch conftest.ts1; touch conftest.ts2; make
380854b5899cSmrg      # should touch ts1 because ts2 is newer. This could happen by luck,
380954b5899cSmrg      # but most often, it will fail if make's support is insufficient. So
381054b5899cSmrg      # test for several consecutive successes.
381154b5899cSmrg      #
381254b5899cSmrg      # (We reuse conftest.ts[12] because we still want to modify existing
381354b5899cSmrg      # files, not create new ones, per above.)
381454b5899cSmrg      n=0
381554b5899cSmrg      make=${MAKE-make}
381654b5899cSmrg      until test $n -eq 3; do
381754b5899cSmrg        echo one > conftest.ts1
381854b5899cSmrg        sleep $am_try_res
381954b5899cSmrg        echo two > conftest.ts2 # ts2 should now be newer than ts1
382054b5899cSmrg        if $make -f conftest.mk | grep 'up to date' >/dev/null; then
382154b5899cSmrg          make_ok=false
382254b5899cSmrg          break # out of $n loop
382354b5899cSmrg        fi
382454b5899cSmrg        n=`expr $n + 1`
382554b5899cSmrg      done
382654b5899cSmrg    fi
382754b5899cSmrg    #
382854b5899cSmrg    if $make_ok; then
382954b5899cSmrg      # Everything we know to check worked out, so call this resolution good.
383054b5899cSmrg      am_cv_filesystem_timestamp_resolution=$am_try_res
383154b5899cSmrg      break # out of $am_try_res loop
383254b5899cSmrg    fi
383354b5899cSmrg    # Otherwise, we'll go on to check the next resolution.
383454b5899cSmrg  fi
383554b5899cSmrgdone
383654b5899cSmrgrm -f conftest.ts?
383754b5899cSmrg# (end _am_filesystem_timestamp_resolution)
383854b5899cSmrg])])
383954b5899cSmrg
384035c4bbdfSmrg# AM_SANITY_CHECK
384135c4bbdfSmrg# ---------------
384235c4bbdfSmrgAC_DEFUN([AM_SANITY_CHECK],
384354b5899cSmrg[AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION])
384454b5899cSmrg# This check should not be cached, as it may vary across builds of
384554b5899cSmrg# different projects.
384654b5899cSmrgAC_MSG_CHECKING([whether build environment is sane])
384735c4bbdfSmrg# Reject unsafe characters in $srcdir or the absolute working directory
384835c4bbdfSmrg# name.  Accept space and tab only in the latter.
384935c4bbdfSmrgam_lf='
385035c4bbdfSmrg'
385135c4bbdfSmrgcase `pwd` in
385235c4bbdfSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
385335c4bbdfSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
385435c4bbdfSmrgesac
385535c4bbdfSmrgcase $srcdir in
385635c4bbdfSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
385735c4bbdfSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
385835c4bbdfSmrgesac
385935c4bbdfSmrg
386035c4bbdfSmrg# Do 'set' in a subshell so we don't clobber the current shell's
386135c4bbdfSmrg# arguments.  Must try -L first in case configure is actually a
386235c4bbdfSmrg# symlink; some systems play weird games with the mod time of symlinks
386335c4bbdfSmrg# (eg FreeBSD returns the mod time of the symlink's containing
386435c4bbdfSmrg# directory).
386554b5899cSmrgam_build_env_is_sane=no
386654b5899cSmrgam_has_slept=no
386754b5899cSmrgrm -f conftest.file
386854b5899cSmrgfor am_try in 1 2; do
386954b5899cSmrg  echo "timestamp, slept: $am_has_slept" > conftest.file
387054b5899cSmrg  if (
387154b5899cSmrg    set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
387254b5899cSmrg    if test "$[]*" = "X"; then
387354b5899cSmrg      # -L didn't work.
387454b5899cSmrg      set X `ls -t "$srcdir/configure" conftest.file`
387554b5899cSmrg    fi
387654b5899cSmrg    test "$[]2" = conftest.file
387754b5899cSmrg  ); then
387854b5899cSmrg    am_build_env_is_sane=yes
387954b5899cSmrg    break
388054b5899cSmrg  fi
388154b5899cSmrg  # Just in case.
388254b5899cSmrg  sleep "$am_cv_filesystem_timestamp_resolution"
388354b5899cSmrg  am_has_slept=yes
388454b5899cSmrgdone
388554b5899cSmrg
388654b5899cSmrgAC_MSG_RESULT([$am_build_env_is_sane])
388754b5899cSmrgif test "$am_build_env_is_sane" = no; then
388854b5899cSmrg  AC_MSG_ERROR([newly created file is older than distributed files!
388935c4bbdfSmrgCheck your system clock])
389035c4bbdfSmrgfi
389154b5899cSmrg
389235c4bbdfSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
389335c4bbdfSmrg# generated files are strictly newer.
389435c4bbdfSmrgam_sleep_pid=
389554b5899cSmrgAS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl
389654b5899cSmrg  ( sleep "$am_cv_filesystem_timestamp_resolution" ) &
389735c4bbdfSmrg  am_sleep_pid=$!
389854b5899cSmrg])
389935c4bbdfSmrgAC_CONFIG_COMMANDS_PRE(
390035c4bbdfSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
390135c4bbdfSmrg   if test -n "$am_sleep_pid"; then
390235c4bbdfSmrg     # Hide warnings about reused PIDs.
390335c4bbdfSmrg     wait $am_sleep_pid 2>/dev/null
390435c4bbdfSmrg   fi
390535c4bbdfSmrg   AC_MSG_RESULT([done])])
390635c4bbdfSmrgrm -f conftest.file
390735c4bbdfSmrg])
390835c4bbdfSmrg
390954b5899cSmrg# Copyright (C) 2009-2024 Free Software Foundation, Inc.
391035c4bbdfSmrg#
391135c4bbdfSmrg# This file is free software; the Free Software Foundation
391235c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
391335c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
391435c4bbdfSmrg
391554b5899cSmrg# _AM_SILENT_RULES
391654b5899cSmrg# ----------------
391754b5899cSmrg# Enable less verbose build rules support.
391854b5899cSmrgAC_DEFUN([_AM_SILENT_RULES],
391954b5899cSmrg[AM_DEFAULT_VERBOSITY=1
392054b5899cSmrgAC_ARG_ENABLE([silent-rules], [dnl
392135c4bbdfSmrgAS_HELP_STRING(
392235c4bbdfSmrg  [--enable-silent-rules],
392335c4bbdfSmrg  [less verbose build output (undo: "make V=1")])
392435c4bbdfSmrgAS_HELP_STRING(
392535c4bbdfSmrg  [--disable-silent-rules],
392635c4bbdfSmrg  [verbose build output (undo: "make V=0")])dnl
392735c4bbdfSmrg])
392835c4bbdfSmrgdnl
392935c4bbdfSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
393035c4bbdfSmrgdnl do not support nested variable expansions.
393135c4bbdfSmrgdnl See automake bug#9928 and bug#10237.
393235c4bbdfSmrgam_make=${MAKE-make}
393335c4bbdfSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
393435c4bbdfSmrg   [am_cv_make_support_nested_variables],
393535c4bbdfSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
393635c4bbdfSmrgBAR0=false
393735c4bbdfSmrgBAR1=true
393835c4bbdfSmrgV=1
393935c4bbdfSmrgam__doit:
394035c4bbdfSmrg	@$(TRUE)
394135c4bbdfSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
394235c4bbdfSmrg  am_cv_make_support_nested_variables=yes
394335c4bbdfSmrgelse
394435c4bbdfSmrg  am_cv_make_support_nested_variables=no
394535c4bbdfSmrgfi])
394635c4bbdfSmrgAC_SUBST([AM_V])dnl
394735c4bbdfSmrgAM_SUBST_NOTMAKE([AM_V])dnl
394835c4bbdfSmrgAC_SUBST([AM_DEFAULT_V])dnl
394935c4bbdfSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
395035c4bbdfSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
395135c4bbdfSmrgAM_BACKSLASH='\'
395235c4bbdfSmrgAC_SUBST([AM_BACKSLASH])dnl
395335c4bbdfSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
395454b5899cSmrgdnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls
395554b5899cSmrgdnl to AM_SILENT_RULES to change the default value.
395654b5899cSmrgAC_CONFIG_COMMANDS_PRE([dnl
395754b5899cSmrgcase $enable_silent_rules in @%:@ (((
395854b5899cSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
395954b5899cSmrg   no) AM_DEFAULT_VERBOSITY=1;;
396054b5899cSmrgesac
396154b5899cSmrgif test $am_cv_make_support_nested_variables = yes; then
396254b5899cSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
396354b5899cSmrg  AM_V='$(V)'
396454b5899cSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
396554b5899cSmrgelse
396654b5899cSmrg  AM_V=$AM_DEFAULT_VERBOSITY
396754b5899cSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
396854b5899cSmrgfi
396954b5899cSmrg])dnl
397035c4bbdfSmrg])
397135c4bbdfSmrg
397254b5899cSmrg# AM_SILENT_RULES([DEFAULT])
397354b5899cSmrg# --------------------------
397454b5899cSmrg# Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or
397554b5899cSmrg# empty being verbose).
397654b5899cSmrgAC_DEFUN([AM_SILENT_RULES],
397754b5899cSmrg[AC_REQUIRE([_AM_SILENT_RULES])
397854b5899cSmrgAM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])])
397954b5899cSmrg
398054b5899cSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
398135c4bbdfSmrg#
398235c4bbdfSmrg# This file is free software; the Free Software Foundation
398335c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
398435c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
398535c4bbdfSmrg
398635c4bbdfSmrg# AM_PROG_INSTALL_STRIP
398735c4bbdfSmrg# ---------------------
398835c4bbdfSmrg# One issue with vendor 'install' (even GNU) is that you can't
398935c4bbdfSmrg# specify the program used to strip binaries.  This is especially
399035c4bbdfSmrg# annoying in cross-compiling environments, where the build's strip
399135c4bbdfSmrg# is unlikely to handle the host's binaries.
399235c4bbdfSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
399335c4bbdfSmrg# always use install-sh in "make install-strip", and initialize
399435c4bbdfSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
399535c4bbdfSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
399635c4bbdfSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
399735c4bbdfSmrg# Installed binaries are usually stripped using 'strip' when the user
399835c4bbdfSmrg# run "make install-strip".  However 'strip' might not be the right
399935c4bbdfSmrg# tool to use in cross-compilation environments, therefore Automake
400035c4bbdfSmrg# will honor the 'STRIP' environment variable to overrule this program.
400135c4bbdfSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
400235c4bbdfSmrgif test "$cross_compiling" != no; then
400335c4bbdfSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
400435c4bbdfSmrgfi
400535c4bbdfSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
400635c4bbdfSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
400735c4bbdfSmrg
400854b5899cSmrg# Copyright (C) 2006-2024 Free Software Foundation, Inc.
400935c4bbdfSmrg#
401035c4bbdfSmrg# This file is free software; the Free Software Foundation
401135c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
401235c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
401335c4bbdfSmrg
401435c4bbdfSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
401535c4bbdfSmrg# ---------------------------
401635c4bbdfSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
401735c4bbdfSmrg# This macro is traced by Automake.
401835c4bbdfSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
401935c4bbdfSmrg
402035c4bbdfSmrg# AM_SUBST_NOTMAKE(VARIABLE)
402135c4bbdfSmrg# --------------------------
402235c4bbdfSmrg# Public sister of _AM_SUBST_NOTMAKE.
402335c4bbdfSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
402435c4bbdfSmrg
402535c4bbdfSmrg# Check how to create a tarball.                            -*- Autoconf -*-
402635c4bbdfSmrg
402754b5899cSmrg# Copyright (C) 2004-2024 Free Software Foundation, Inc.
402835c4bbdfSmrg#
402935c4bbdfSmrg# This file is free software; the Free Software Foundation
403035c4bbdfSmrg# gives unlimited permission to copy and/or distribute it,
403135c4bbdfSmrg# with or without modifications, as long as this notice is preserved.
403235c4bbdfSmrg
403335c4bbdfSmrg# _AM_PROG_TAR(FORMAT)
403435c4bbdfSmrg# --------------------
403535c4bbdfSmrg# Check how to create a tarball in format FORMAT.
403635c4bbdfSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
403735c4bbdfSmrg#
403835c4bbdfSmrg# Substitute a variable $(am__tar) that is a command
403935c4bbdfSmrg# writing to stdout a FORMAT-tarball containing the directory
404035c4bbdfSmrg# $tardir.
404135c4bbdfSmrg#     tardir=directory && $(am__tar) > result.tar
404235c4bbdfSmrg#
404335c4bbdfSmrg# Substitute a variable $(am__untar) that extract such
404435c4bbdfSmrg# a tarball read from stdin.
404535c4bbdfSmrg#     $(am__untar) < result.tar
404635c4bbdfSmrg#
404735c4bbdfSmrgAC_DEFUN([_AM_PROG_TAR],
404835c4bbdfSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
404935c4bbdfSmrg# in the wild :-(  We should find a proper way to deprecate it ...
405035c4bbdfSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
405135c4bbdfSmrg
405235c4bbdfSmrg# We'll loop over all known methods to create a tar archive until one works.
405335c4bbdfSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
405435c4bbdfSmrg
405535c4bbdfSmrgm4_if([$1], [v7],
405635c4bbdfSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
405735c4bbdfSmrg
405835c4bbdfSmrg  [m4_case([$1],
405935c4bbdfSmrg    [ustar],
406035c4bbdfSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
406135c4bbdfSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
406235c4bbdfSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
406335c4bbdfSmrg      # and bug#13588).
406435c4bbdfSmrg      am_max_uid=2097151 # 2^21 - 1
406535c4bbdfSmrg      am_max_gid=$am_max_uid
406635c4bbdfSmrg      # The $UID and $GID variables are not portable, so we need to resort
406735c4bbdfSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
406835c4bbdfSmrg      # below are definitely unexpected, so allow the users to see them
406935c4bbdfSmrg      # (that is, avoid stderr redirection).
407035c4bbdfSmrg      am_uid=`id -u || echo unknown`
407135c4bbdfSmrg      am_gid=`id -g || echo unknown`
407235c4bbdfSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
407354b5899cSmrg      if test x$am_uid = xunknown; then
407454b5899cSmrg        AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work])
407554b5899cSmrg      elif test $am_uid -le $am_max_uid; then
407654b5899cSmrg        AC_MSG_RESULT([yes])
407735c4bbdfSmrg      else
407854b5899cSmrg        AC_MSG_RESULT([no])
407954b5899cSmrg        _am_tools=none
408035c4bbdfSmrg      fi
408135c4bbdfSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
408254b5899cSmrg      if test x$gm_gid = xunknown; then
408354b5899cSmrg        AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work])
408454b5899cSmrg      elif test $am_gid -le $am_max_gid; then
408554b5899cSmrg        AC_MSG_RESULT([yes])
408635c4bbdfSmrg      else
408735c4bbdfSmrg        AC_MSG_RESULT([no])
408835c4bbdfSmrg        _am_tools=none
408935c4bbdfSmrg      fi],
409035c4bbdfSmrg
409135c4bbdfSmrg  [pax],
409235c4bbdfSmrg    [],
409335c4bbdfSmrg
409435c4bbdfSmrg  [m4_fatal([Unknown tar format])])
409535c4bbdfSmrg
409635c4bbdfSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
409735c4bbdfSmrg
409835c4bbdfSmrg  # Go ahead even if we have the value already cached.  We do so because we
409935c4bbdfSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
410035c4bbdfSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
410135c4bbdfSmrg
410235c4bbdfSmrg  for _am_tool in $_am_tools; do
410335c4bbdfSmrg    case $_am_tool in
410435c4bbdfSmrg    gnutar)
410535c4bbdfSmrg      for _am_tar in tar gnutar gtar; do
410635c4bbdfSmrg        AM_RUN_LOG([$_am_tar --version]) && break
410735c4bbdfSmrg      done
410835c4bbdfSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
410935c4bbdfSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
411035c4bbdfSmrg      am__untar="$_am_tar -xf -"
411135c4bbdfSmrg      ;;
411235c4bbdfSmrg    plaintar)
411335c4bbdfSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
411435c4bbdfSmrg      # ustar tarball either.
411535c4bbdfSmrg      (tar --version) >/dev/null 2>&1 && continue
411635c4bbdfSmrg      am__tar='tar chf - "$$tardir"'
411735c4bbdfSmrg      am__tar_='tar chf - "$tardir"'
411835c4bbdfSmrg      am__untar='tar xf -'
411935c4bbdfSmrg      ;;
412035c4bbdfSmrg    pax)
412135c4bbdfSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
412235c4bbdfSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
412335c4bbdfSmrg      am__untar='pax -r'
412435c4bbdfSmrg      ;;
412535c4bbdfSmrg    cpio)
412635c4bbdfSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
412735c4bbdfSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
412835c4bbdfSmrg      am__untar='cpio -i -H $1 -d'
412935c4bbdfSmrg      ;;
413035c4bbdfSmrg    none)
413135c4bbdfSmrg      am__tar=false
413235c4bbdfSmrg      am__tar_=false
413335c4bbdfSmrg      am__untar=false
413435c4bbdfSmrg      ;;
413535c4bbdfSmrg    esac
413635c4bbdfSmrg
413735c4bbdfSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
413835c4bbdfSmrg    # and am__untar set.
413935c4bbdfSmrg    test -n "${am_cv_prog_tar_$1}" && break
414035c4bbdfSmrg
414135c4bbdfSmrg    # tar/untar a dummy directory, and stop if the command works.
414235c4bbdfSmrg    rm -rf conftest.dir
414335c4bbdfSmrg    mkdir conftest.dir
414435c4bbdfSmrg    echo GrepMe > conftest.dir/file
414535c4bbdfSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
414635c4bbdfSmrg    rm -rf conftest.dir
414735c4bbdfSmrg    if test -s conftest.tar; then
414835c4bbdfSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
414935c4bbdfSmrg      AM_RUN_LOG([cat conftest.dir/file])
415035c4bbdfSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
415135c4bbdfSmrg    fi
415235c4bbdfSmrg  done
415335c4bbdfSmrg  rm -rf conftest.dir
415435c4bbdfSmrg
415535c4bbdfSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
415635c4bbdfSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
415735c4bbdfSmrg
415835c4bbdfSmrgAC_SUBST([am__tar])
415935c4bbdfSmrgAC_SUBST([am__untar])
416035c4bbdfSmrg]) # _AM_PROG_TAR
416135c4bbdfSmrg
416254b5899cSmrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
416354b5899cSmrg#
416454b5899cSmrg# This file is free software; the Free Software Foundation
416554b5899cSmrg# gives unlimited permission to copy and/or distribute it,
416654b5899cSmrg# with or without modifications, as long as this notice is preserved.
416754b5899cSmrg
416854b5899cSmrg# _AM_PROG_XARGS_N
416954b5899cSmrg# ----------------
417054b5899cSmrg# Check whether 'xargs -n' works.  It should work everywhere, so the fallback
417154b5899cSmrg# is not optimized at all as we never expect to use it.
417254b5899cSmrgAC_DEFUN([_AM_PROG_XARGS_N],
417354b5899cSmrg[AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl
417454b5899cSmrgAS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2
417554b5899cSmrg3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])])
417654b5899cSmrgAS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl
417754b5899cSmrg  am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }'
417854b5899cSmrg])dnl
417954b5899cSmrgAC_SUBST(am__xargs_n)
418054b5899cSmrg])
418154b5899cSmrg
418235c4bbdfSmrgm4_include([m4/ac_define_dir.m4])
41831b5d61b8Smrgm4_include([m4/ax_pthread.m4])
4184d36a1693Smrgm4_include([m4/libtool.m4])
418535c4bbdfSmrgm4_include([m4/ltoptions.m4])
418635c4bbdfSmrgm4_include([m4/ltsugar.m4])
4187d36a1693Smrgm4_include([m4/ltversion.m4])
418835c4bbdfSmrgm4_include([m4/lt~obsolete.m4])
4189