aclocal.m4 revision a3bd7f05
1a3bd7f05Smrg# generated automatically by aclocal 1.16.2 -*- Autoconf -*-
29e7bcd65Smrg
3a3bd7f05Smrg# Copyright (C) 1996-2020 Free Software Foundation, Inc.
4444c061aSmrg
5444c061aSmrg# This file is free software; the Free Software Foundation
6444c061aSmrg# gives unlimited permission to copy and/or distribute it,
7444c061aSmrg# with or without modifications, as long as this notice is preserved.
8444c061aSmrg
9444c061aSmrg# This program is distributed in the hope that it will be useful,
10444c061aSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11444c061aSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12444c061aSmrg# PARTICULAR PURPOSE.
13444c061aSmrg
149e7bcd65Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
152265a131Smrgm4_ifndef([AC_AUTOCONF_VERSION],
162265a131Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17339a7c43Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
18339a7c43Smrg[m4_warning([this file was generated for autoconf 2.69.
192265a131SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
202265a131SmrgIf you have problems, you may need to regenerate the build system entirely.
219e7bcd65SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22444c061aSmrg
23a3bd7f05Smrg# pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
24a3bd7f05Smrg# serial 11 (pkg-config-0.29.1)
25a3bd7f05Smrg
260568f49bSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
270568f49bSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
280568f49bSmrgdnl
290568f49bSmrgdnl This program is free software; you can redistribute it and/or modify
300568f49bSmrgdnl it under the terms of the GNU General Public License as published by
310568f49bSmrgdnl the Free Software Foundation; either version 2 of the License, or
320568f49bSmrgdnl (at your option) any later version.
330568f49bSmrgdnl
340568f49bSmrgdnl This program is distributed in the hope that it will be useful, but
350568f49bSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
360568f49bSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
370568f49bSmrgdnl General Public License for more details.
380568f49bSmrgdnl
390568f49bSmrgdnl You should have received a copy of the GNU General Public License
400568f49bSmrgdnl along with this program; if not, write to the Free Software
410568f49bSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
420568f49bSmrgdnl 02111-1307, USA.
430568f49bSmrgdnl
440568f49bSmrgdnl As a special exception to the GNU General Public License, if you
450568f49bSmrgdnl distribute this file as part of a program that contains a
460568f49bSmrgdnl configuration script generated by Autoconf, you may include it under
470568f49bSmrgdnl the same distribution terms that you use for the rest of that
480568f49bSmrgdnl program.
490568f49bSmrg
500568f49bSmrgdnl PKG_PREREQ(MIN-VERSION)
510568f49bSmrgdnl -----------------------
520568f49bSmrgdnl Since: 0.29
530568f49bSmrgdnl
540568f49bSmrgdnl Verify that the version of the pkg-config macros are at least
550568f49bSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
560568f49bSmrgdnl installed version of pkg-config, this checks the developer's version
570568f49bSmrgdnl of pkg.m4 when generating configure.
580568f49bSmrgdnl
590568f49bSmrgdnl To ensure that this macro is defined, also add:
600568f49bSmrgdnl m4_ifndef([PKG_PREREQ],
610568f49bSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
620568f49bSmrgdnl
630568f49bSmrgdnl See the "Since" comment for each macro you use to see what version
640568f49bSmrgdnl of the macros you require.
650568f49bSmrgm4_defun([PKG_PREREQ],
66a3bd7f05Smrg[m4_define([PKG_MACROS_VERSION], [0.29.1])
670568f49bSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
680568f49bSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
690568f49bSmrg])dnl PKG_PREREQ
700568f49bSmrg
710568f49bSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
720568f49bSmrgdnl ----------------------------------
730568f49bSmrgdnl Since: 0.16
740568f49bSmrgdnl
750568f49bSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
760568f49bSmrgdnl first found in the path. Checks that the version of pkg-config found
770568f49bSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
780568f49bSmrgdnl used since that's the first version where most current features of
790568f49bSmrgdnl pkg-config existed.
800568f49bSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
810568f49bSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
820568f49bSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
830568f49bSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
840568f49bSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
850568f49bSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
860568f49bSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
87249c3046Smrg
880568f49bSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
890568f49bSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
900568f49bSmrgfi
910568f49bSmrgif test -n "$PKG_CONFIG"; then
920568f49bSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
930568f49bSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
940568f49bSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
950568f49bSmrg		AC_MSG_RESULT([yes])
960568f49bSmrg	else
970568f49bSmrg		AC_MSG_RESULT([no])
980568f49bSmrg		PKG_CONFIG=""
990568f49bSmrg	fi
1000568f49bSmrgfi[]dnl
1010568f49bSmrg])dnl PKG_PROG_PKG_CONFIG
102249c3046Smrg
1030568f49bSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1040568f49bSmrgdnl -------------------------------------------------------------------
1050568f49bSmrgdnl Since: 0.18
1060568f49bSmrgdnl
1070568f49bSmrgdnl Check to see whether a particular set of modules exists. Similar to
1080568f49bSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1090568f49bSmrgdnl
1100568f49bSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1110568f49bSmrgdnl only at the first occurence in configure.ac, so if the first place
1120568f49bSmrgdnl it's called might be skipped (such as if it is within an "if", you
1130568f49bSmrgdnl have to call PKG_CHECK_EXISTS manually
1140568f49bSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1150568f49bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1160568f49bSmrgif test -n "$PKG_CONFIG" && \
1170568f49bSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1180568f49bSmrg  m4_default([$2], [:])
1190568f49bSmrgm4_ifvaln([$3], [else
1200568f49bSmrg  $3])dnl
1210568f49bSmrgfi])
122249c3046Smrg
1230568f49bSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1240568f49bSmrgdnl ---------------------------------------------
1250568f49bSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1260568f49bSmrgdnl pkg_failed based on the result.
1270568f49bSmrgm4_define([_PKG_CONFIG],
1280568f49bSmrg[if test -n "$$1"; then
1290568f49bSmrg    pkg_cv_[]$1="$$1"
1300568f49bSmrg elif test -n "$PKG_CONFIG"; then
1310568f49bSmrg    PKG_CHECK_EXISTS([$3],
1320568f49bSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1330568f49bSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
1340568f49bSmrg		     [pkg_failed=yes])
1350568f49bSmrg else
1360568f49bSmrg    pkg_failed=untried
1370568f49bSmrgfi[]dnl
1380568f49bSmrg])dnl _PKG_CONFIG
139249c3046Smrg
1400568f49bSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1410568f49bSmrgdnl ---------------------------
1420568f49bSmrgdnl Internal check to see if pkg-config supports short errors.
1430568f49bSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1440568f49bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1450568f49bSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1460568f49bSmrg        _pkg_short_errors_supported=yes
1470568f49bSmrgelse
1480568f49bSmrg        _pkg_short_errors_supported=no
1490568f49bSmrgfi[]dnl
1500568f49bSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1511477040fSmrg
152bdf0f55dSmrg
1530568f49bSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1540568f49bSmrgdnl   [ACTION-IF-NOT-FOUND])
1550568f49bSmrgdnl --------------------------------------------------------------
1560568f49bSmrgdnl Since: 0.4.0
1570568f49bSmrgdnl
1580568f49bSmrgdnl Note that if there is a possibility the first call to
1590568f49bSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1600568f49bSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1610568f49bSmrgAC_DEFUN([PKG_CHECK_MODULES],
1620568f49bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1630568f49bSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1640568f49bSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1651477040fSmrg
1660568f49bSmrgpkg_failed=no
1670568f49bSmrgAC_MSG_CHECKING([for $1])
168444c061aSmrg
1690568f49bSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1700568f49bSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
171444c061aSmrg
1720568f49bSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1730568f49bSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1740568f49bSmrgSee the pkg-config man page for more details.])
175444c061aSmrg
1760568f49bSmrgif test $pkg_failed = yes; then
1770568f49bSmrg   	AC_MSG_RESULT([no])
1780568f49bSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1790568f49bSmrg        if test $_pkg_short_errors_supported = yes; then
1800568f49bSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1810568f49bSmrg        else 
1820568f49bSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1830568f49bSmrg        fi
1840568f49bSmrg	# Put the nasty error message in config.log where it belongs
1850568f49bSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
186444c061aSmrg
1870568f49bSmrg	m4_default([$4], [AC_MSG_ERROR(
1880568f49bSmrg[Package requirements ($2) were not met:
189444c061aSmrg
1900568f49bSmrg$$1_PKG_ERRORS
191444c061aSmrg
1920568f49bSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1930568f49bSmrginstalled software in a non-standard prefix.
1942265a131Smrg
1950568f49bSmrg_PKG_TEXT])[]dnl
1960568f49bSmrg        ])
1970568f49bSmrgelif test $pkg_failed = untried; then
1980568f49bSmrg     	AC_MSG_RESULT([no])
1990568f49bSmrg	m4_default([$4], [AC_MSG_FAILURE(
2000568f49bSmrg[The pkg-config script could not be found or is too old.  Make sure it
2010568f49bSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
2020568f49bSmrgpath to pkg-config.
2031477040fSmrg
2040568f49bSmrg_PKG_TEXT
2051477040fSmrg
2060568f49bSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
2070568f49bSmrg        ])
2080568f49bSmrgelse
2090568f49bSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2100568f49bSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2110568f49bSmrg        AC_MSG_RESULT([yes])
2120568f49bSmrg	$3
2130568f49bSmrgfi[]dnl
2140568f49bSmrg])dnl PKG_CHECK_MODULES
2151477040fSmrg
2161477040fSmrg
2170568f49bSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2180568f49bSmrgdnl   [ACTION-IF-NOT-FOUND])
2190568f49bSmrgdnl ---------------------------------------------------------------------
2200568f49bSmrgdnl Since: 0.29
2210568f49bSmrgdnl
2220568f49bSmrgdnl Checks for existence of MODULES and gathers its build flags with
2230568f49bSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
2240568f49bSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
2250568f49bSmrgdnl
2260568f49bSmrgdnl Note that if there is a possibility the first call to
2270568f49bSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
2280568f49bSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
2290568f49bSmrgdnl configure.ac.
2300568f49bSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
2310568f49bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2320568f49bSmrg_save_PKG_CONFIG=$PKG_CONFIG
2330568f49bSmrgPKG_CONFIG="$PKG_CONFIG --static"
2340568f49bSmrgPKG_CHECK_MODULES($@)
2350568f49bSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
2360568f49bSmrg])dnl PKG_CHECK_MODULES_STATIC
2371477040fSmrg
2381477040fSmrg
2390568f49bSmrgdnl PKG_INSTALLDIR([DIRECTORY])
2400568f49bSmrgdnl -------------------------
2410568f49bSmrgdnl Since: 0.27
2420568f49bSmrgdnl
2430568f49bSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
2440568f49bSmrgdnl should install pkg-config .pc files. By default the directory is
2450568f49bSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
2460568f49bSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
2470568f49bSmrgdnl parameter.
2480568f49bSmrgAC_DEFUN([PKG_INSTALLDIR],
2490568f49bSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
2500568f49bSmrgm4_pushdef([pkg_description],
2510568f49bSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
2520568f49bSmrgAC_ARG_WITH([pkgconfigdir],
2530568f49bSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
2540568f49bSmrg    [with_pkgconfigdir=]pkg_default)
2550568f49bSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
2560568f49bSmrgm4_popdef([pkg_default])
2570568f49bSmrgm4_popdef([pkg_description])
2580568f49bSmrg])dnl PKG_INSTALLDIR
2590568f49bSmrg
2600568f49bSmrg
2610568f49bSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
2620568f49bSmrgdnl --------------------------------
2630568f49bSmrgdnl Since: 0.27
2640568f49bSmrgdnl
2650568f49bSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
2660568f49bSmrgdnl module should install arch-independent pkg-config .pc files. By
2670568f49bSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
2680568f49bSmrgdnl changed by passing DIRECTORY. The user can override through the
2690568f49bSmrgdnl --with-noarch-pkgconfigdir parameter.
2700568f49bSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
2710568f49bSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
2720568f49bSmrgm4_pushdef([pkg_description],
2730568f49bSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
2740568f49bSmrgAC_ARG_WITH([noarch-pkgconfigdir],
2750568f49bSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
2760568f49bSmrg    [with_noarch_pkgconfigdir=]pkg_default)
2770568f49bSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
2780568f49bSmrgm4_popdef([pkg_default])
2790568f49bSmrgm4_popdef([pkg_description])
2800568f49bSmrg])dnl PKG_NOARCH_INSTALLDIR
2810568f49bSmrg
2820568f49bSmrg
2830568f49bSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
2840568f49bSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2850568f49bSmrgdnl -------------------------------------------
2860568f49bSmrgdnl Since: 0.28
2870568f49bSmrgdnl
2880568f49bSmrgdnl Retrieves the value of the pkg-config variable for the given module.
2890568f49bSmrgAC_DEFUN([PKG_CHECK_VAR],
2900568f49bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2910568f49bSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
2921477040fSmrg
2930568f49bSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
2940568f49bSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
2951477040fSmrg
2960568f49bSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
2970568f49bSmrg])dnl PKG_CHECK_VAR
2981477040fSmrg
299a3bd7f05Smrgdnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
300a3bd7f05Smrgdnl   [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
301a3bd7f05Smrgdnl   [DESCRIPTION], [DEFAULT])
302a3bd7f05Smrgdnl ------------------------------------------
303a3bd7f05Smrgdnl
304a3bd7f05Smrgdnl Prepare a "--with-" configure option using the lowercase
305a3bd7f05Smrgdnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
306a3bd7f05Smrgdnl PKG_CHECK_MODULES in a single macro.
307a3bd7f05SmrgAC_DEFUN([PKG_WITH_MODULES],
308a3bd7f05Smrg[
309a3bd7f05Smrgm4_pushdef([with_arg], m4_tolower([$1]))
310a3bd7f05Smrg
311a3bd7f05Smrgm4_pushdef([description],
312a3bd7f05Smrg           [m4_default([$5], [build with ]with_arg[ support])])
313a3bd7f05Smrg
314a3bd7f05Smrgm4_pushdef([def_arg], [m4_default([$6], [auto])])
315a3bd7f05Smrgm4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
316a3bd7f05Smrgm4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
317a3bd7f05Smrg
318a3bd7f05Smrgm4_case(def_arg,
319a3bd7f05Smrg            [yes],[m4_pushdef([with_without], [--without-]with_arg)],
320a3bd7f05Smrg            [m4_pushdef([with_without],[--with-]with_arg)])
321a3bd7f05Smrg
322a3bd7f05SmrgAC_ARG_WITH(with_arg,
323a3bd7f05Smrg     AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
324a3bd7f05Smrg    [AS_TR_SH([with_]with_arg)=def_arg])
325a3bd7f05Smrg
326a3bd7f05SmrgAS_CASE([$AS_TR_SH([with_]with_arg)],
327a3bd7f05Smrg            [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
328a3bd7f05Smrg            [auto],[PKG_CHECK_MODULES([$1],[$2],
329a3bd7f05Smrg                                        [m4_n([def_action_if_found]) $3],
330a3bd7f05Smrg                                        [m4_n([def_action_if_not_found]) $4])])
331a3bd7f05Smrg
332a3bd7f05Smrgm4_popdef([with_arg])
333a3bd7f05Smrgm4_popdef([description])
334a3bd7f05Smrgm4_popdef([def_arg])
335a3bd7f05Smrg
336a3bd7f05Smrg])dnl PKG_WITH_MODULES
337a3bd7f05Smrg
338a3bd7f05Smrgdnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
339a3bd7f05Smrgdnl   [DESCRIPTION], [DEFAULT])
340a3bd7f05Smrgdnl -----------------------------------------------
341a3bd7f05Smrgdnl
342a3bd7f05Smrgdnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
343a3bd7f05Smrgdnl check._[VARIABLE-PREFIX] is exported as make variable.
344a3bd7f05SmrgAC_DEFUN([PKG_HAVE_WITH_MODULES],
345a3bd7f05Smrg[
346a3bd7f05SmrgPKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
347a3bd7f05Smrg
348a3bd7f05SmrgAM_CONDITIONAL([HAVE_][$1],
349a3bd7f05Smrg               [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
350a3bd7f05Smrg])dnl PKG_HAVE_WITH_MODULES
351a3bd7f05Smrg
352a3bd7f05Smrgdnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
353a3bd7f05Smrgdnl   [DESCRIPTION], [DEFAULT])
354a3bd7f05Smrgdnl ------------------------------------------------------
355a3bd7f05Smrgdnl
356a3bd7f05Smrgdnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
357a3bd7f05Smrgdnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
358a3bd7f05Smrgdnl and preprocessor variable.
359a3bd7f05SmrgAC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
360a3bd7f05Smrg[
361a3bd7f05SmrgPKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
362a3bd7f05Smrg
363a3bd7f05SmrgAS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
364a3bd7f05Smrg        [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
365a3bd7f05Smrg])dnl PKG_HAVE_DEFINE_WITH_MODULES
366a3bd7f05Smrg
3670568f49bSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
3680568f49bSmrgdnl
3690568f49bSmrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
3700568f49bSmrgdnl
3710568f49bSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
3720568f49bSmrgdnl copy of this software and associated documentation files (the "Software"),
3730568f49bSmrgdnl to deal in the Software without restriction, including without limitation
3740568f49bSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3750568f49bSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
3760568f49bSmrgdnl Software is furnished to do so, subject to the following conditions:
3770568f49bSmrgdnl
3780568f49bSmrgdnl The above copyright notice and this permission notice (including the next
3790568f49bSmrgdnl paragraph) shall be included in all copies or substantial portions of the
3800568f49bSmrgdnl Software.
3810568f49bSmrgdnl
3820568f49bSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3830568f49bSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3840568f49bSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
3850568f49bSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3860568f49bSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3870568f49bSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3880568f49bSmrgdnl DEALINGS IN THE SOFTWARE.
3891477040fSmrg
3900568f49bSmrg# XORG_MACROS_VERSION(required-version)
3910568f49bSmrg# -------------------------------------
3920568f49bSmrg# Minimum version: 1.1.0
3939e7bcd65Smrg#
3940568f49bSmrg# If you're using a macro added in Version 1.1 or newer, include this in
3950568f49bSmrg# your configure.ac with the minimum required version, such as:
3960568f49bSmrg# XORG_MACROS_VERSION(1.1)
3970568f49bSmrg#
3980568f49bSmrg# To ensure that this macro is defined, also add:
3990568f49bSmrg# m4_ifndef([XORG_MACROS_VERSION],
4000568f49bSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
4010568f49bSmrg#
4020568f49bSmrg#
4030568f49bSmrg# See the "minimum version" comment for each macro you use to see what
4040568f49bSmrg# version you require.
4050568f49bSmrgm4_defun([XORG_MACROS_VERSION],[
406a3bd7f05Smrgm4_define([vers_have], [1.19.3])
4070568f49bSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
4080568f49bSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
4090568f49bSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
4100568f49bSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
4110568f49bSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
4120568f49bSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
4130568f49bSmrgm4_undefine([vers_have])
4140568f49bSmrgm4_undefine([maj_have])
4150568f49bSmrgm4_undefine([maj_needed])
4160568f49bSmrg]) # XORG_MACROS_VERSION
4171477040fSmrg
4180568f49bSmrg# XORG_PROG_RAWCPP()
4190568f49bSmrg# ------------------
4200568f49bSmrg# Minimum version: 1.0.0
4210568f49bSmrg#
4220568f49bSmrg# Find cpp program and necessary flags for use in pre-processing text files
4230568f49bSmrg# such as man pages and config files
4240568f49bSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
4250568f49bSmrgAC_REQUIRE([AC_PROG_CPP])
4260568f49bSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
4270568f49bSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
4281477040fSmrg
4290568f49bSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
4300568f49bSmrg# which is not the best choice for supporting other OS'es, but covers most
4310568f49bSmrg# of the ones we need for now.
4320568f49bSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
4330568f49bSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
4340568f49bSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
4350568f49bSmrg	AC_MSG_RESULT([no])
4360568f49bSmrgelse
4370568f49bSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
4380568f49bSmrg		RAWCPPFLAGS=-undef
4390568f49bSmrg		AC_MSG_RESULT([yes])
4400568f49bSmrg	# under Cygwin unix is still defined even with -undef
4410568f49bSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
4420568f49bSmrg		RAWCPPFLAGS="-undef -ansi"
4430568f49bSmrg		AC_MSG_RESULT([yes, with -ansi])
4440568f49bSmrg	else
4450568f49bSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
4460568f49bSmrg	fi
4470568f49bSmrgfi
4480568f49bSmrgrm -f conftest.$ac_ext
4491477040fSmrg
4500568f49bSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
4510568f49bSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
4520568f49bSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
4530568f49bSmrg	AC_MSG_RESULT([no])
4540568f49bSmrgelse
4550568f49bSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
4560568f49bSmrg		TRADITIONALCPPFLAGS="-traditional"
4570568f49bSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
4580568f49bSmrg		AC_MSG_RESULT([yes])
4590568f49bSmrg	else
4600568f49bSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
4610568f49bSmrg	fi
4620568f49bSmrgfi
4630568f49bSmrgrm -f conftest.$ac_ext
4640568f49bSmrgAC_SUBST(RAWCPPFLAGS)
4650568f49bSmrgAC_SUBST(TRADITIONALCPPFLAGS)
4660568f49bSmrg]) # XORG_PROG_RAWCPP
4671477040fSmrg
4680568f49bSmrg# XORG_MANPAGE_SECTIONS()
4690568f49bSmrg# -----------------------
4700568f49bSmrg# Minimum version: 1.0.0
471bdf0f55dSmrg#
4720568f49bSmrg# Determine which sections man pages go in for the different man page types
4730568f49bSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
4740568f49bSmrg# Not sure if there's any better way than just hardcoding by OS name.
4750568f49bSmrg# Override default settings by setting environment variables
4760568f49bSmrg# Added MAN_SUBSTS in version 1.8
4770568f49bSmrg# Added AC_PROG_SED in version 1.8
4781477040fSmrg
4790568f49bSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
4800568f49bSmrgAC_REQUIRE([AC_CANONICAL_HOST])
4810568f49bSmrgAC_REQUIRE([AC_PROG_SED])
482bdf0f55dSmrg
4830568f49bSmrgcase $host_os in
4840568f49bSmrg    solaris*)
4850568f49bSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
4860568f49bSmrg        # check for a man page file found in later versions that use
4870568f49bSmrg        # traditional section numbers instead
4880568f49bSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
4890568f49bSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
4900568f49bSmrg        ;;
4910568f49bSmrg    *) SYSV_MAN_SECTIONS=false ;;
4920568f49bSmrgesac
4932265a131Smrg
4940568f49bSmrgif test x$APP_MAN_SUFFIX = x    ; then
4950568f49bSmrg    APP_MAN_SUFFIX=1
4960568f49bSmrgfi
4970568f49bSmrgif test x$APP_MAN_DIR = x    ; then
4980568f49bSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
4990568f49bSmrgfi
5002265a131Smrg
5010568f49bSmrgif test x$LIB_MAN_SUFFIX = x    ; then
5020568f49bSmrg    LIB_MAN_SUFFIX=3
5030568f49bSmrgfi
5040568f49bSmrgif test x$LIB_MAN_DIR = x    ; then
5050568f49bSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
5060568f49bSmrgfi
507339a7c43Smrg
5080568f49bSmrgif test x$FILE_MAN_SUFFIX = x    ; then
5090568f49bSmrg    case $SYSV_MAN_SECTIONS in
5100568f49bSmrg	true)				FILE_MAN_SUFFIX=4  ;;
5110568f49bSmrg	*)				FILE_MAN_SUFFIX=5  ;;
5120568f49bSmrg    esac
5130568f49bSmrgfi
5140568f49bSmrgif test x$FILE_MAN_DIR = x    ; then
5150568f49bSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
516249c3046Smrgfi
5171477040fSmrg
5180568f49bSmrgif test x$MISC_MAN_SUFFIX = x    ; then
5190568f49bSmrg    case $SYSV_MAN_SECTIONS in
5200568f49bSmrg	true)				MISC_MAN_SUFFIX=5  ;;
5210568f49bSmrg	*)				MISC_MAN_SUFFIX=7  ;;
5220568f49bSmrg    esac
5230568f49bSmrgfi
5240568f49bSmrgif test x$MISC_MAN_DIR = x    ; then
5250568f49bSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
5269e7bcd65Smrgfi
527bdf0f55dSmrg
5280568f49bSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
5290568f49bSmrg    case $SYSV_MAN_SECTIONS in
5300568f49bSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
5310568f49bSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
5320568f49bSmrg    esac
5330568f49bSmrgfi
5340568f49bSmrgif test x$DRIVER_MAN_DIR = x    ; then
5350568f49bSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
5360568f49bSmrgfi
537bdf0f55dSmrg
5380568f49bSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
5390568f49bSmrg    case $SYSV_MAN_SECTIONS in
5400568f49bSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
5410568f49bSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
5420568f49bSmrg    esac
5430568f49bSmrgfi
5440568f49bSmrgif test x$ADMIN_MAN_DIR = x    ; then
5450568f49bSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
5460568f49bSmrgfi
547bdf0f55dSmrg
548339a7c43Smrg
5490568f49bSmrgAC_SUBST([APP_MAN_SUFFIX])
5500568f49bSmrgAC_SUBST([LIB_MAN_SUFFIX])
5510568f49bSmrgAC_SUBST([FILE_MAN_SUFFIX])
5520568f49bSmrgAC_SUBST([MISC_MAN_SUFFIX])
5530568f49bSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
5540568f49bSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
5550568f49bSmrgAC_SUBST([APP_MAN_DIR])
5560568f49bSmrgAC_SUBST([LIB_MAN_DIR])
5570568f49bSmrgAC_SUBST([FILE_MAN_DIR])
5580568f49bSmrgAC_SUBST([MISC_MAN_DIR])
5590568f49bSmrgAC_SUBST([DRIVER_MAN_DIR])
5600568f49bSmrgAC_SUBST([ADMIN_MAN_DIR])
561339a7c43Smrg
5620568f49bSmrgXORG_MAN_PAGE="X Version 11"
5630568f49bSmrgAC_SUBST([XORG_MAN_PAGE])
5640568f49bSmrgMAN_SUBSTS="\
5650568f49bSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
5660568f49bSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
5670568f49bSmrg	-e 's|__xservername__|Xorg|g' \
5680568f49bSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
5690568f49bSmrg	-e 's|__projectroot__|\$(prefix)|g' \
5700568f49bSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
5710568f49bSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
5720568f49bSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
5730568f49bSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
5740568f49bSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
5750568f49bSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
5760568f49bSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
5770568f49bSmrgAC_SUBST([MAN_SUBSTS])
578339a7c43Smrg
5790568f49bSmrg]) # XORG_MANPAGE_SECTIONS
580339a7c43Smrg
5810568f49bSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
5820568f49bSmrg# ------------------------
5830568f49bSmrg# Minimum version: 1.7.0
5840568f49bSmrg#
5850568f49bSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
5860568f49bSmrg# provided by xorg-sgml-doctools, if installed.
5870568f49bSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
5880568f49bSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
5890568f49bSmrgXORG_SGML_PATH=
5900568f49bSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
5910568f49bSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
5920568f49bSmrg    [m4_ifval([$1],[:],
5930568f49bSmrg        [if test x"$cross_compiling" != x"yes" ; then
5940568f49bSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
5950568f49bSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
5960568f49bSmrg         fi])
5970568f49bSmrg    ])
598339a7c43Smrg
5990568f49bSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
6000568f49bSmrg# the path and the name of the doc stylesheet
6010568f49bSmrgif test "x$XORG_SGML_PATH" != "x" ; then
6020568f49bSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
6030568f49bSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
6040568f49bSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
6050568f49bSmrgelse
6060568f49bSmrg   AC_MSG_RESULT([no])
6070568f49bSmrgfi
608339a7c43Smrg
6090568f49bSmrgAC_SUBST(XORG_SGML_PATH)
6100568f49bSmrgAC_SUBST(STYLESHEET_SRCDIR)
6110568f49bSmrgAC_SUBST(XSL_STYLESHEET)
6120568f49bSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
6130568f49bSmrg]) # XORG_CHECK_SGML_DOCTOOLS
614339a7c43Smrg
6150568f49bSmrg# XORG_CHECK_LINUXDOC
6160568f49bSmrg# -------------------
6170568f49bSmrg# Minimum version: 1.0.0
6180568f49bSmrg#
6190568f49bSmrg# Defines the variable MAKE_TEXT if the necessary tools and
6200568f49bSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
6210568f49bSmrg# Whether or not the necessary tools and files are found can be checked
6220568f49bSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
6230568f49bSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
6240568f49bSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
6250568f49bSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
6261477040fSmrg
6270568f49bSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
6281477040fSmrg
6290568f49bSmrgAC_MSG_CHECKING([whether to build documentation])
6301477040fSmrg
6310568f49bSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
6320568f49bSmrg   BUILDDOC=yes
6330568f49bSmrgelse
6340568f49bSmrg   BUILDDOC=no
6350568f49bSmrgfi
6361477040fSmrg
6370568f49bSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
6381477040fSmrg
6390568f49bSmrgAC_MSG_RESULT([$BUILDDOC])
6402265a131Smrg
6410568f49bSmrgAC_MSG_CHECKING([whether to build pdf documentation])
6422265a131Smrg
6430568f49bSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
6440568f49bSmrg   BUILDPDFDOC=yes
6459e7bcd65Smrgelse
6460568f49bSmrg   BUILDPDFDOC=no
647249c3046Smrgfi
6482265a131Smrg
6490568f49bSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
6502265a131Smrg
6510568f49bSmrgAC_MSG_RESULT([$BUILDPDFDOC])
6522265a131Smrg
6530568f49bSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
6540568f49bSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
6550568f49bSmrgMAKE_PDF="$PS2PDF"
6560568f49bSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
6571477040fSmrg
6580568f49bSmrgAC_SUBST(MAKE_TEXT)
6590568f49bSmrgAC_SUBST(MAKE_PS)
6600568f49bSmrgAC_SUBST(MAKE_PDF)
6610568f49bSmrgAC_SUBST(MAKE_HTML)
6620568f49bSmrg]) # XORG_CHECK_LINUXDOC
663444c061aSmrg
6640568f49bSmrg# XORG_CHECK_DOCBOOK
6650568f49bSmrg# -------------------
6660568f49bSmrg# Minimum version: 1.0.0
667bdf0f55dSmrg#
6680568f49bSmrg# Checks for the ability to build output formats from SGML DocBook source.
6690568f49bSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
6700568f49bSmrg# indicates whether the necessary tools and files are found and, if set,
6710568f49bSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
6720568f49bSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
6730568f49bSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
674444c061aSmrg
6750568f49bSmrgBUILDTXTDOC=no
6760568f49bSmrgBUILDPDFDOC=no
6770568f49bSmrgBUILDPSDOC=no
6780568f49bSmrgBUILDHTMLDOC=no
6799e7bcd65Smrg
6800568f49bSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
6810568f49bSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
6820568f49bSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
6830568f49bSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
684444c061aSmrg
6850568f49bSmrgAC_MSG_CHECKING([whether to build text documentation])
6860568f49bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
6870568f49bSmrg   test x$BUILD_TXTDOC != xno; then
6880568f49bSmrg	BUILDTXTDOC=yes
6890568f49bSmrgfi
6900568f49bSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
6910568f49bSmrgAC_MSG_RESULT([$BUILDTXTDOC])
692444c061aSmrg
6930568f49bSmrgAC_MSG_CHECKING([whether to build PDF documentation])
6940568f49bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
6950568f49bSmrg   test x$BUILD_PDFDOC != xno; then
6960568f49bSmrg	BUILDPDFDOC=yes
6970568f49bSmrgfi
6980568f49bSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
6990568f49bSmrgAC_MSG_RESULT([$BUILDPDFDOC])
7001477040fSmrg
7010568f49bSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
7020568f49bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
7030568f49bSmrg   test x$BUILD_PSDOC != xno; then
7040568f49bSmrg	BUILDPSDOC=yes
7050568f49bSmrgfi
7060568f49bSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
7070568f49bSmrgAC_MSG_RESULT([$BUILDPSDOC])
7089e7bcd65Smrg
7090568f49bSmrgAC_MSG_CHECKING([whether to build HTML documentation])
7100568f49bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
7110568f49bSmrg   test x$BUILD_HTMLDOC != xno; then
7120568f49bSmrg	BUILDHTMLDOC=yes
7130568f49bSmrgfi
7140568f49bSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
7150568f49bSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
7169e7bcd65Smrg
7170568f49bSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
7180568f49bSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
7190568f49bSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
7200568f49bSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
7219e7bcd65Smrg
7220568f49bSmrgAC_SUBST(MAKE_TEXT)
7230568f49bSmrgAC_SUBST(MAKE_PS)
7240568f49bSmrgAC_SUBST(MAKE_PDF)
7250568f49bSmrgAC_SUBST(MAKE_HTML)
7260568f49bSmrg]) # XORG_CHECK_DOCBOOK
7279e7bcd65Smrg
7280568f49bSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
7290568f49bSmrg# ----------------
7300568f49bSmrg# Minimum version: 1.5.0
7310568f49bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
732339a7c43Smrg#
7330568f49bSmrg# Documentation tools are not always available on all platforms and sometimes
7340568f49bSmrg# not at the appropriate level. This macro enables a module to test for the
7350568f49bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
7360568f49bSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
7370568f49bSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
7380568f49bSmrg# --with-xmlto assumes 'auto'.
739339a7c43Smrg#
7400568f49bSmrg# Interface to module:
7410568f49bSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
7420568f49bSmrg# XMLTO:	returns the path of the xmlto program found
7430568f49bSmrg#		returns the path set by the user in the environment
7440568f49bSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
7450568f49bSmrg#		'no' user instructs the module not to use xmlto
7460568f49bSmrg#
7470568f49bSmrg# Added in version 1.10.0
7480568f49bSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
7490568f49bSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
7500568f49bSmrg#
7510568f49bSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
7520568f49bSmrg#
7530568f49bSmrgAC_DEFUN([XORG_WITH_XMLTO],[
7540568f49bSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
7550568f49bSmrgm4_define([_defopt], m4_default([$2], [auto]))
7560568f49bSmrgAC_ARG_WITH(xmlto,
7570568f49bSmrg	AS_HELP_STRING([--with-xmlto],
7580568f49bSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
7590568f49bSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
7600568f49bSmrgm4_undefine([_defopt])
761339a7c43Smrg
7620568f49bSmrgif test "x$use_xmlto" = x"auto"; then
7630568f49bSmrg   AC_PATH_PROG([XMLTO], [xmlto])
7640568f49bSmrg   if test "x$XMLTO" = "x"; then
7650568f49bSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
7660568f49bSmrg	have_xmlto=no
7670568f49bSmrg   else
7680568f49bSmrg        have_xmlto=yes
7690568f49bSmrg   fi
7700568f49bSmrgelif test "x$use_xmlto" = x"yes" ; then
7710568f49bSmrg   AC_PATH_PROG([XMLTO], [xmlto])
7720568f49bSmrg   if test "x$XMLTO" = "x"; then
7730568f49bSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
7740568f49bSmrg   fi
7750568f49bSmrg   have_xmlto=yes
7760568f49bSmrgelif test "x$use_xmlto" = x"no" ; then
7770568f49bSmrg   if test "x$XMLTO" != "x"; then
7780568f49bSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
7790568f49bSmrg   fi
7800568f49bSmrg   have_xmlto=no
7810568f49bSmrgelse
7820568f49bSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
7830568f49bSmrgfi
784339a7c43Smrg
7850568f49bSmrg# Test for a minimum version of xmlto, if provided.
7860568f49bSmrgm4_ifval([$1],
7870568f49bSmrg[if test "$have_xmlto" = yes; then
7880568f49bSmrg    # scrape the xmlto version
7890568f49bSmrg    AC_MSG_CHECKING([the xmlto version])
7900568f49bSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
7910568f49bSmrg    AC_MSG_RESULT([$xmlto_version])
7920568f49bSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
7930568f49bSmrg        [if test "x$use_xmlto" = xauto; then
7940568f49bSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
7950568f49bSmrg            have_xmlto=no
7960568f49bSmrg        else
7970568f49bSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
7980568f49bSmrg        fi])
7990568f49bSmrgfi])
8009e7bcd65Smrg
8010568f49bSmrg# Test for the ability of xmlto to generate a text target
8029e7bcd65Smrg#
8030568f49bSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
8040568f49bSmrg# following test for empty XML docbook files.
8050568f49bSmrg# For compatibility reasons use the following empty XML docbook file and if
8060568f49bSmrg# it fails try it again with a non-empty XML file.
8070568f49bSmrghave_xmlto_text=no
8080568f49bSmrgcat > conftest.xml << "EOF"
8090568f49bSmrgEOF
8100568f49bSmrgAS_IF([test "$have_xmlto" = yes],
8110568f49bSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
8120568f49bSmrg             [have_xmlto_text=yes],
8130568f49bSmrg             [# Try it again with a non-empty XML file.
8140568f49bSmrg              cat > conftest.xml << "EOF"
8150568f49bSmrg<x></x>
8160568f49bSmrgEOF
8170568f49bSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
8180568f49bSmrg                    [have_xmlto_text=yes],
8190568f49bSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
8200568f49bSmrgrm -f conftest.xml
8210568f49bSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
8220568f49bSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
8230568f49bSmrg]) # XORG_WITH_XMLTO
8249e7bcd65Smrg
8250568f49bSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
8260568f49bSmrg# --------------------------------------------
8270568f49bSmrg# Minimum version: 1.12.0
8280568f49bSmrg# Minimum version for optional DEFAULT argument: 1.12.0
8290568f49bSmrg#
8300568f49bSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
8310568f49bSmrg# XML-based language used for the transformation of XML documents.
8320568f49bSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
8330568f49bSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
8340568f49bSmrg# The XSLT processor is often used as a standalone tool for transformations.
8350568f49bSmrg# It should not be assumed that this tool is used only to work with documnetation.
8360568f49bSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
8370568f49bSmrg#
8380568f49bSmrg# Interface to module:
8390568f49bSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
8400568f49bSmrg# XSLTPROC:	 returns the path of the xsltproc program found
8410568f49bSmrg#		 returns the path set by the user in the environment
8420568f49bSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
8430568f49bSmrg#		  'no' user instructs the module not to use xsltproc
8440568f49bSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
8450568f49bSmrg#
8460568f49bSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
8470568f49bSmrg#
8480568f49bSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
8490568f49bSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
8500568f49bSmrg# Preserves the interface, should it be implemented later
8510568f49bSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
8520568f49bSmrgm4_define([_defopt], m4_default([$2], [auto]))
8530568f49bSmrgAC_ARG_WITH(xsltproc,
8540568f49bSmrg	AS_HELP_STRING([--with-xsltproc],
8550568f49bSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
8560568f49bSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
8570568f49bSmrgm4_undefine([_defopt])
8589e7bcd65Smrg
8590568f49bSmrgif test "x$use_xsltproc" = x"auto"; then
8600568f49bSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
8610568f49bSmrg   if test "x$XSLTPROC" = "x"; then
8620568f49bSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
8630568f49bSmrg	have_xsltproc=no
8640568f49bSmrg   else
8650568f49bSmrg        have_xsltproc=yes
8660568f49bSmrg   fi
8670568f49bSmrgelif test "x$use_xsltproc" = x"yes" ; then
8680568f49bSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
8690568f49bSmrg   if test "x$XSLTPROC" = "x"; then
8700568f49bSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
8710568f49bSmrg   fi
8720568f49bSmrg   have_xsltproc=yes
8730568f49bSmrgelif test "x$use_xsltproc" = x"no" ; then
8740568f49bSmrg   if test "x$XSLTPROC" != "x"; then
8750568f49bSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
8760568f49bSmrg   fi
8770568f49bSmrg   have_xsltproc=no
878249c3046Smrgelse
8790568f49bSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
8809e7bcd65Smrgfi
8819e7bcd65Smrg
8820568f49bSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
8830568f49bSmrg]) # XORG_WITH_XSLTPROC
8840568f49bSmrg
8850568f49bSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
8860568f49bSmrg# ----------------------------------------
8870568f49bSmrg# Minimum version: 1.15.0
8889e7bcd65Smrg#
8890568f49bSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
8900568f49bSmrg# scanning arbitrary text files, extracting information from those text files,
8910568f49bSmrg# and printing reports based on that information.
8920568f49bSmrg#
8930568f49bSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
8940568f49bSmrg#
8950568f49bSmrg# Interface to module:
8960568f49bSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
8970568f49bSmrg# PERL:	     returns the path of the perl program found
8980568f49bSmrg#	     returns the path set by the user in the environment
8990568f49bSmrg# --with-perl: 'yes' user instructs the module to use perl
9000568f49bSmrg#	       'no' user instructs the module not to use perl
9010568f49bSmrg# have_perl: returns yes if perl found in PATH or no
9020568f49bSmrg#
9030568f49bSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
9040568f49bSmrg#
9050568f49bSmrgAC_DEFUN([XORG_WITH_PERL],[
9060568f49bSmrgAC_ARG_VAR([PERL], [Path to perl command])
9070568f49bSmrg# Preserves the interface, should it be implemented later
9080568f49bSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
9090568f49bSmrgm4_define([_defopt], m4_default([$2], [auto]))
9100568f49bSmrgAC_ARG_WITH(perl,
9110568f49bSmrg	AS_HELP_STRING([--with-perl],
9120568f49bSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
9130568f49bSmrg	   [use_perl=$withval], [use_perl=]_defopt)
9140568f49bSmrgm4_undefine([_defopt])
9159e7bcd65Smrg
9160568f49bSmrgif test "x$use_perl" = x"auto"; then
9170568f49bSmrg   AC_PATH_PROG([PERL], [perl])
9180568f49bSmrg   if test "x$PERL" = "x"; then
9190568f49bSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
9200568f49bSmrg	have_perl=no
9210568f49bSmrg   else
9220568f49bSmrg        have_perl=yes
9230568f49bSmrg   fi
9240568f49bSmrgelif test "x$use_perl" = x"yes" ; then
9250568f49bSmrg   AC_PATH_PROG([PERL], [perl])
9260568f49bSmrg   if test "x$PERL" = "x"; then
9270568f49bSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
9280568f49bSmrg   fi
9290568f49bSmrg   have_perl=yes
9300568f49bSmrgelif test "x$use_perl" = x"no" ; then
9310568f49bSmrg   if test "x$PERL" != "x"; then
9320568f49bSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
9330568f49bSmrg   fi
9340568f49bSmrg   have_perl=no
9359e7bcd65Smrgelse
9360568f49bSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
9379e7bcd65Smrgfi
9389e7bcd65Smrg
9390568f49bSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
9400568f49bSmrg]) # XORG_WITH_PERL
9419e7bcd65Smrg
9420568f49bSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
9430568f49bSmrg# ----------------
9440568f49bSmrg# Minimum version: 1.5.0
9450568f49bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
946249c3046Smrg#
9470568f49bSmrg# Documentation tools are not always available on all platforms and sometimes
9480568f49bSmrg# not at the appropriate level. This macro enables a module to test for the
9490568f49bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
9500568f49bSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
9510568f49bSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
9520568f49bSmrg# --with-asciidoc assumes 'auto'.
9530568f49bSmrg#
9540568f49bSmrg# Interface to module:
9550568f49bSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
9560568f49bSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
9570568f49bSmrg#		 returns the path set by the user in the environment
9580568f49bSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
9590568f49bSmrg#		  'no' user instructs the module not to use asciidoc
9600568f49bSmrg#
9610568f49bSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
9620568f49bSmrg#
9630568f49bSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
9640568f49bSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
9650568f49bSmrgm4_define([_defopt], m4_default([$2], [auto]))
9660568f49bSmrgAC_ARG_WITH(asciidoc,
9670568f49bSmrg	AS_HELP_STRING([--with-asciidoc],
9680568f49bSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
9690568f49bSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
9700568f49bSmrgm4_undefine([_defopt])
9719e7bcd65Smrg
9720568f49bSmrgif test "x$use_asciidoc" = x"auto"; then
9730568f49bSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9740568f49bSmrg   if test "x$ASCIIDOC" = "x"; then
9750568f49bSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
9760568f49bSmrg	have_asciidoc=no
9770568f49bSmrg   else
9780568f49bSmrg        have_asciidoc=yes
9790568f49bSmrg   fi
9800568f49bSmrgelif test "x$use_asciidoc" = x"yes" ; then
9810568f49bSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9820568f49bSmrg   if test "x$ASCIIDOC" = "x"; then
9830568f49bSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
9840568f49bSmrg   fi
9850568f49bSmrg   have_asciidoc=yes
9860568f49bSmrgelif test "x$use_asciidoc" = x"no" ; then
9870568f49bSmrg   if test "x$ASCIIDOC" != "x"; then
9880568f49bSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
9890568f49bSmrg   fi
9900568f49bSmrg   have_asciidoc=no
9910568f49bSmrgelse
9920568f49bSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
9930568f49bSmrgfi
9940568f49bSmrgm4_ifval([$1],
9950568f49bSmrg[if test "$have_asciidoc" = yes; then
9960568f49bSmrg    # scrape the asciidoc version
9970568f49bSmrg    AC_MSG_CHECKING([the asciidoc version])
9980568f49bSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
9990568f49bSmrg    AC_MSG_RESULT([$asciidoc_version])
10000568f49bSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
10010568f49bSmrg        [if test "x$use_asciidoc" = xauto; then
10020568f49bSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
10030568f49bSmrg            have_asciidoc=no
10040568f49bSmrg        else
10050568f49bSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
10060568f49bSmrg        fi])
10070568f49bSmrgfi])
10080568f49bSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
10090568f49bSmrg]) # XORG_WITH_ASCIIDOC
10109e7bcd65Smrg
10110568f49bSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
10120568f49bSmrg# -------------------------------------------
10130568f49bSmrg# Minimum version: 1.5.0
10140568f49bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
10150568f49bSmrg# Minimum version for optional DOT checking: 1.18.0
1016249c3046Smrg#
10170568f49bSmrg# Documentation tools are not always available on all platforms and sometimes
10180568f49bSmrg# not at the appropriate level. This macro enables a module to test for the
10190568f49bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
10200568f49bSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
10210568f49bSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
10220568f49bSmrg# --with-doxygen assumes 'auto'.
1023bdf0f55dSmrg#
10240568f49bSmrg# Interface to module:
10250568f49bSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
10260568f49bSmrg# DOXYGEN:	 returns the path of the doxygen program found
10270568f49bSmrg#		 returns the path set by the user in the environment
10280568f49bSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
10290568f49bSmrg#		  'no' user instructs the module not to use doxygen
10309e7bcd65Smrg#
10310568f49bSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
10329e7bcd65Smrg#
10330568f49bSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
10340568f49bSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
10350568f49bSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
10360568f49bSmrgm4_define([_defopt], m4_default([$2], [auto]))
10370568f49bSmrgAC_ARG_WITH(doxygen,
10380568f49bSmrg	AS_HELP_STRING([--with-doxygen],
10390568f49bSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
10400568f49bSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
10410568f49bSmrgm4_undefine([_defopt])
10421477040fSmrg
10430568f49bSmrgif test "x$use_doxygen" = x"auto"; then
10440568f49bSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
10450568f49bSmrg   if test "x$DOXYGEN" = "x"; then
10460568f49bSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
10470568f49bSmrg	have_doxygen=no
10480568f49bSmrg   else
10490568f49bSmrg        have_doxygen=yes
10500568f49bSmrg   fi
10510568f49bSmrgelif test "x$use_doxygen" = x"yes" ; then
10520568f49bSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
10530568f49bSmrg   if test "x$DOXYGEN" = "x"; then
10540568f49bSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
10550568f49bSmrg   fi
10560568f49bSmrg   have_doxygen=yes
10570568f49bSmrgelif test "x$use_doxygen" = x"no" ; then
10580568f49bSmrg   if test "x$DOXYGEN" != "x"; then
10590568f49bSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
10600568f49bSmrg   fi
10610568f49bSmrg   have_doxygen=no
10620568f49bSmrgelse
10630568f49bSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
10640568f49bSmrgfi
10650568f49bSmrgm4_ifval([$1],
10660568f49bSmrg[if test "$have_doxygen" = yes; then
10670568f49bSmrg    # scrape the doxygen version
10680568f49bSmrg    AC_MSG_CHECKING([the doxygen version])
10690568f49bSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
10700568f49bSmrg    AC_MSG_RESULT([$doxygen_version])
10710568f49bSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
10720568f49bSmrg        [if test "x$use_doxygen" = xauto; then
10730568f49bSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
10740568f49bSmrg            have_doxygen=no
10750568f49bSmrg        else
10760568f49bSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
10770568f49bSmrg        fi])
10780568f49bSmrgfi])
10799e7bcd65Smrg
10800568f49bSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
10810568f49bSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
10820568f49bSmrgdnl 	HAVE_DOT = @HAVE_DOT@
10830568f49bSmrgHAVE_DOT=no
10840568f49bSmrgif test "x$have_doxygen" = "xyes"; then
10850568f49bSmrg  AC_PATH_PROG([DOT], [dot])
10860568f49bSmrg    if test "x$DOT" != "x"; then
10870568f49bSmrg      HAVE_DOT=yes
10889e7bcd65Smrg    fi
10899e7bcd65Smrgfi
10909e7bcd65Smrg
10910568f49bSmrgAC_SUBST([HAVE_DOT])
10920568f49bSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
10930568f49bSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
10940568f49bSmrg]) # XORG_WITH_DOXYGEN
10959e7bcd65Smrg
10960568f49bSmrg# XORG_WITH_GROFF([DEFAULT])
10979e7bcd65Smrg# ----------------
10980568f49bSmrg# Minimum version: 1.6.0
10990568f49bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
11000568f49bSmrg#
11010568f49bSmrg# Documentation tools are not always available on all platforms and sometimes
11020568f49bSmrg# not at the appropriate level. This macro enables a module to test for the
11030568f49bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
11040568f49bSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
11050568f49bSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
11060568f49bSmrg# --with-groff assumes 'auto'.
11070568f49bSmrg#
11080568f49bSmrg# Interface to module:
11090568f49bSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
11100568f49bSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
11110568f49bSmrg# HAVE_GROFF_MS: the -ms macros package
11120568f49bSmrg# GROFF:	 returns the path of the groff program found
11130568f49bSmrg#		 returns the path set by the user in the environment
11140568f49bSmrg# --with-groff:	 'yes' user instructs the module to use groff
11150568f49bSmrg#		 'no' user instructs the module not to use groff
11160568f49bSmrg#
11170568f49bSmrg# Added in version 1.9.0:
11180568f49bSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
11190568f49bSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
11200568f49bSmrg#		   psselect from the psutils package.
11210568f49bSmrg#		   the ghostcript package. Refer to the grohtml man pages
11220568f49bSmrg#
11230568f49bSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
11240568f49bSmrg#
11250568f49bSmrg# OS and distros often splits groff in a basic and full package, the former
11260568f49bSmrg# having the groff program and the later having devices, fonts and macros
11270568f49bSmrg# Checking for the groff executable is not enough.
11280568f49bSmrg#
11290568f49bSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
11300568f49bSmrg# unset HAVE_GROFF or GROFF env variables.
11310568f49bSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
11320568f49bSmrg#
11330568f49bSmrgAC_DEFUN([XORG_WITH_GROFF],[
11340568f49bSmrgAC_ARG_VAR([GROFF], [Path to groff command])
11350568f49bSmrgm4_define([_defopt], m4_default([$1], [auto]))
11360568f49bSmrgAC_ARG_WITH(groff,
11370568f49bSmrg	AS_HELP_STRING([--with-groff],
11380568f49bSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
11390568f49bSmrg	   [use_groff=$withval], [use_groff=]_defopt)
11400568f49bSmrgm4_undefine([_defopt])
11419e7bcd65Smrg
11420568f49bSmrgif test "x$use_groff" = x"auto"; then
11430568f49bSmrg   AC_PATH_PROG([GROFF], [groff])
11440568f49bSmrg   if test "x$GROFF" = "x"; then
11450568f49bSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
11460568f49bSmrg	have_groff=no
11470568f49bSmrg   else
11480568f49bSmrg        have_groff=yes
11490568f49bSmrg   fi
11500568f49bSmrgelif test "x$use_groff" = x"yes" ; then
11510568f49bSmrg   AC_PATH_PROG([GROFF], [groff])
11520568f49bSmrg   if test "x$GROFF" = "x"; then
11530568f49bSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
11540568f49bSmrg   fi
11550568f49bSmrg   have_groff=yes
11560568f49bSmrgelif test "x$use_groff" = x"no" ; then
11570568f49bSmrg   if test "x$GROFF" != "x"; then
11580568f49bSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
11590568f49bSmrg   fi
11600568f49bSmrg   have_groff=no
11619e7bcd65Smrgelse
11620568f49bSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
11639e7bcd65Smrgfi
11649e7bcd65Smrg
11650568f49bSmrg# We have groff, test for the presence of the macro packages
11660568f49bSmrgif test "x$have_groff" = x"yes"; then
11670568f49bSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
11680568f49bSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
11690568f49bSmrg        groff_ms_works=yes
11700568f49bSmrg    else
11710568f49bSmrg        groff_ms_works=no
11720568f49bSmrg    fi
11730568f49bSmrg    AC_MSG_RESULT([$groff_ms_works])
11740568f49bSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
11750568f49bSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
11760568f49bSmrg        groff_mm_works=yes
11770568f49bSmrg    else
11780568f49bSmrg        groff_mm_works=no
11790568f49bSmrg    fi
11800568f49bSmrg    AC_MSG_RESULT([$groff_mm_works])
11810568f49bSmrgfi
11829e7bcd65Smrg
11830568f49bSmrg# We have groff, test for HTML dependencies, one command per package
11840568f49bSmrgif test "x$have_groff" = x"yes"; then
11850568f49bSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
11860568f49bSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
11870568f49bSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
11880568f49bSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
11890568f49bSmrg      have_groff_html=yes
11900568f49bSmrg   else
11910568f49bSmrg      have_groff_html=no
11920568f49bSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
11930568f49bSmrg   fi
11949e7bcd65Smrgfi
11959e7bcd65Smrg
11960568f49bSmrg# Set Automake conditionals for Makefiles
11970568f49bSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
11980568f49bSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
11990568f49bSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
12000568f49bSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
12010568f49bSmrg]) # XORG_WITH_GROFF
12029e7bcd65Smrg
12030568f49bSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
12040568f49bSmrg# ---------------------------------------
12050568f49bSmrg# Minimum version: 1.6.0
12060568f49bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
12070568f49bSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
12080568f49bSmrg#
12090568f49bSmrg# Documentation tools are not always available on all platforms and sometimes
12100568f49bSmrg# not at the appropriate level. This macro enables a module to test for the
12110568f49bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
12120568f49bSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
12130568f49bSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
12140568f49bSmrg# --with-fop assumes 'auto'.
12150568f49bSmrg#
12160568f49bSmrg# Interface to module:
12170568f49bSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
12180568f49bSmrg# FOP:	 	returns the path of the fop program found
12190568f49bSmrg#		returns the path set by the user in the environment
12200568f49bSmrg# --with-fop: 	'yes' user instructs the module to use fop
12210568f49bSmrg#		'no' user instructs the module not to use fop
12220568f49bSmrg#
12230568f49bSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
12240568f49bSmrg#
12250568f49bSmrgAC_DEFUN([XORG_WITH_FOP],[
12260568f49bSmrgAC_ARG_VAR([FOP], [Path to fop command])
12270568f49bSmrgm4_define([_defopt], m4_default([$2], [auto]))
12280568f49bSmrgAC_ARG_WITH(fop,
12290568f49bSmrg	AS_HELP_STRING([--with-fop],
12300568f49bSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
12310568f49bSmrg	   [use_fop=$withval], [use_fop=]_defopt)
12320568f49bSmrgm4_undefine([_defopt])
12339e7bcd65Smrg
12340568f49bSmrgif test "x$use_fop" = x"auto"; then
12350568f49bSmrg   AC_PATH_PROG([FOP], [fop])
12360568f49bSmrg   if test "x$FOP" = "x"; then
12370568f49bSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
12380568f49bSmrg	have_fop=no
12390568f49bSmrg   else
12400568f49bSmrg        have_fop=yes
12410568f49bSmrg   fi
12420568f49bSmrgelif test "x$use_fop" = x"yes" ; then
12430568f49bSmrg   AC_PATH_PROG([FOP], [fop])
12440568f49bSmrg   if test "x$FOP" = "x"; then
12450568f49bSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
12460568f49bSmrg   fi
12470568f49bSmrg   have_fop=yes
12480568f49bSmrgelif test "x$use_fop" = x"no" ; then
12490568f49bSmrg   if test "x$FOP" != "x"; then
12500568f49bSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
12510568f49bSmrg   fi
12520568f49bSmrg   have_fop=no
12539e7bcd65Smrgelse
12540568f49bSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
12559e7bcd65Smrgfi
12569e7bcd65Smrg
12570568f49bSmrg# Test for a minimum version of fop, if provided.
12580568f49bSmrgm4_ifval([$1],
12590568f49bSmrg[if test "$have_fop" = yes; then
12600568f49bSmrg    # scrape the fop version
12610568f49bSmrg    AC_MSG_CHECKING([for fop minimum version])
12620568f49bSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
12630568f49bSmrg    AC_MSG_RESULT([$fop_version])
12640568f49bSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
12650568f49bSmrg        [if test "x$use_fop" = xauto; then
12660568f49bSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
12670568f49bSmrg            have_fop=no
12680568f49bSmrg        else
12690568f49bSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
12700568f49bSmrg        fi])
12710568f49bSmrgfi])
12720568f49bSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
12730568f49bSmrg]) # XORG_WITH_FOP
12749e7bcd65Smrg
12750568f49bSmrg# XORG_WITH_M4([MIN-VERSION])
12760568f49bSmrg# ---------------------------
12770568f49bSmrg# Minimum version: 1.19.0
12789e7bcd65Smrg#
12790568f49bSmrg# This macro attempts to locate an m4 macro processor which supports
12800568f49bSmrg# -I option and is only useful for modules relying on M4 in order to
12810568f49bSmrg# expand macros in source code files.
12829e7bcd65Smrg#
12830568f49bSmrg# Interface to module:
12840568f49bSmrg# M4:	 	returns the path of the m4 program found
12850568f49bSmrg#		returns the path set by the user in the environment
12860568f49bSmrg#
12870568f49bSmrgAC_DEFUN([XORG_WITH_M4], [
12880568f49bSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
12890568f49bSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
12900568f49bSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
12910568f49bSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
12920568f49bSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
12930568f49bSmrg   [$PATH:/usr/gnu/bin])])
12949e7bcd65Smrg
12950568f49bSmrgAC_SUBST([M4], [$ac_cv_path_M4])
12960568f49bSmrg]) # XORG_WITH_M4
12979e7bcd65Smrg
12980568f49bSmrg# XORG_WITH_PS2PDF([DEFAULT])
12990568f49bSmrg# ----------------
13000568f49bSmrg# Minimum version: 1.6.0
13010568f49bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
13020568f49bSmrg#
13030568f49bSmrg# Documentation tools are not always available on all platforms and sometimes
13040568f49bSmrg# not at the appropriate level. This macro enables a module to test for the
13050568f49bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
13060568f49bSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
13070568f49bSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
13080568f49bSmrg# --with-ps2pdf assumes 'auto'.
13090568f49bSmrg#
13100568f49bSmrg# Interface to module:
13110568f49bSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
13120568f49bSmrg# PS2PDF:	returns the path of the ps2pdf program found
13130568f49bSmrg#		returns the path set by the user in the environment
13140568f49bSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
13150568f49bSmrg#		 'no' user instructs the module not to use ps2pdf
13169e7bcd65Smrg#
13170568f49bSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
13189e7bcd65Smrg#
13190568f49bSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
13200568f49bSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
13210568f49bSmrgm4_define([_defopt], m4_default([$1], [auto]))
13220568f49bSmrgAC_ARG_WITH(ps2pdf,
13230568f49bSmrg	AS_HELP_STRING([--with-ps2pdf],
13240568f49bSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
13250568f49bSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
13260568f49bSmrgm4_undefine([_defopt])
13279e7bcd65Smrg
13280568f49bSmrgif test "x$use_ps2pdf" = x"auto"; then
13290568f49bSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
13300568f49bSmrg   if test "x$PS2PDF" = "x"; then
13310568f49bSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
13320568f49bSmrg	have_ps2pdf=no
13330568f49bSmrg   else
13340568f49bSmrg        have_ps2pdf=yes
13350568f49bSmrg   fi
13360568f49bSmrgelif test "x$use_ps2pdf" = x"yes" ; then
13370568f49bSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
13380568f49bSmrg   if test "x$PS2PDF" = "x"; then
13390568f49bSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
13400568f49bSmrg   fi
13410568f49bSmrg   have_ps2pdf=yes
13420568f49bSmrgelif test "x$use_ps2pdf" = x"no" ; then
13430568f49bSmrg   if test "x$PS2PDF" != "x"; then
13440568f49bSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
13450568f49bSmrg   fi
13460568f49bSmrg   have_ps2pdf=no
13470568f49bSmrgelse
13480568f49bSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
13490568f49bSmrgfi
13500568f49bSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
13510568f49bSmrg]) # XORG_WITH_PS2PDF
13529e7bcd65Smrg
13530568f49bSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
13540568f49bSmrg# ----------------
13550568f49bSmrg# Minimum version: 1.6.0
13560568f49bSmrg#
13570568f49bSmrg# Documentation tools are not always available on all platforms and sometimes
13580568f49bSmrg# not at the appropriate level. This macro enables a builder to skip all
13590568f49bSmrg# documentation targets except traditional man pages.
13600568f49bSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13610568f49bSmrg# maximum flexibilty in controlling documentation building.
13620568f49bSmrg# Refer to:
13630568f49bSmrg# XORG_WITH_XMLTO         --with-xmlto
13640568f49bSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13650568f49bSmrg# XORG_WITH_DOXYGEN       --with-doxygen
13660568f49bSmrg# XORG_WITH_FOP           --with-fop
13670568f49bSmrg# XORG_WITH_GROFF         --with-groff
13680568f49bSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
13690568f49bSmrg#
13700568f49bSmrg# Interface to module:
13710568f49bSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
13720568f49bSmrg# --enable-docs: 'yes' user instructs the module to generate docs
13730568f49bSmrg#		 'no' user instructs the module not to generate docs
13740568f49bSmrg# parm1:	specify the default value, yes or no.
13750568f49bSmrg#
13760568f49bSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
13770568f49bSmrgm4_define([docs_default], m4_default([$1], [yes]))
13780568f49bSmrgAC_ARG_ENABLE(docs,
13790568f49bSmrg	AS_HELP_STRING([--enable-docs],
13800568f49bSmrg	   [Enable building the documentation (default: ]docs_default[)]),
13810568f49bSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
13820568f49bSmrgm4_undefine([docs_default])
13830568f49bSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
13840568f49bSmrgAC_MSG_CHECKING([whether to build documentation])
13850568f49bSmrgAC_MSG_RESULT([$build_docs])
13860568f49bSmrg]) # XORG_ENABLE_DOCS
13879e7bcd65Smrg
13880568f49bSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
13890568f49bSmrg# ----------------
13900568f49bSmrg# Minimum version: 1.6.0
13910568f49bSmrg#
13920568f49bSmrg# This macro enables a builder to skip all developer documentation.
13930568f49bSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13940568f49bSmrg# maximum flexibilty in controlling documentation building.
13950568f49bSmrg# Refer to:
13960568f49bSmrg# XORG_WITH_XMLTO         --with-xmlto
13970568f49bSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13980568f49bSmrg# XORG_WITH_DOXYGEN       --with-doxygen
13990568f49bSmrg# XORG_WITH_FOP           --with-fop
14000568f49bSmrg# XORG_WITH_GROFF         --with-groff
14010568f49bSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
14020568f49bSmrg#
14030568f49bSmrg# Interface to module:
14040568f49bSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
14050568f49bSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
14060568f49bSmrg#			'no' user instructs the module not to generate developer docs
14070568f49bSmrg# parm1:		specify the default value, yes or no.
14080568f49bSmrg#
14090568f49bSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
14100568f49bSmrgm4_define([devel_default], m4_default([$1], [yes]))
14110568f49bSmrgAC_ARG_ENABLE(devel-docs,
14120568f49bSmrg	AS_HELP_STRING([--enable-devel-docs],
14130568f49bSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
14140568f49bSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
14150568f49bSmrgm4_undefine([devel_default])
14160568f49bSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
14170568f49bSmrgAC_MSG_CHECKING([whether to build developer documentation])
14180568f49bSmrgAC_MSG_RESULT([$build_devel_docs])
14190568f49bSmrg]) # XORG_ENABLE_DEVEL_DOCS
14209e7bcd65Smrg
14210568f49bSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
14220568f49bSmrg# ----------------
14230568f49bSmrg# Minimum version: 1.6.0
14240568f49bSmrg#
14250568f49bSmrg# This macro enables a builder to skip all functional specification targets.
14260568f49bSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
14270568f49bSmrg# maximum flexibilty in controlling documentation building.
14280568f49bSmrg# Refer to:
14290568f49bSmrg# XORG_WITH_XMLTO         --with-xmlto
14300568f49bSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
14310568f49bSmrg# XORG_WITH_DOXYGEN       --with-doxygen
14320568f49bSmrg# XORG_WITH_FOP           --with-fop
14330568f49bSmrg# XORG_WITH_GROFF         --with-groff
14340568f49bSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
14350568f49bSmrg#
14360568f49bSmrg# Interface to module:
14370568f49bSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
14380568f49bSmrg# --enable-specs:	'yes' user instructs the module to generate specs
14390568f49bSmrg#			'no' user instructs the module not to generate specs
14400568f49bSmrg# parm1:		specify the default value, yes or no.
14410568f49bSmrg#
14420568f49bSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
14430568f49bSmrgm4_define([spec_default], m4_default([$1], [yes]))
14440568f49bSmrgAC_ARG_ENABLE(specs,
14450568f49bSmrg	AS_HELP_STRING([--enable-specs],
14460568f49bSmrg	   [Enable building the specs (default: ]spec_default[)]),
14470568f49bSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
14480568f49bSmrgm4_undefine([spec_default])
14490568f49bSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
14500568f49bSmrgAC_MSG_CHECKING([whether to build functional specifications])
14510568f49bSmrgAC_MSG_RESULT([$build_specs])
14520568f49bSmrg]) # XORG_ENABLE_SPECS
14539e7bcd65Smrg
14540568f49bSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
14550568f49bSmrg# ----------------------------------------------
14560568f49bSmrg# Minimum version: 1.13.0
14570568f49bSmrg#
14580568f49bSmrg# This macro enables a builder to enable/disable unit testing
14590568f49bSmrg# It makes no assumption about the test cases implementation
14600568f49bSmrg# Test cases may or may not use Automake "Support for test suites"
14610568f49bSmrg# They may or may not use the software utility library GLib
14620568f49bSmrg#
14630568f49bSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
14640568f49bSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
14650568f49bSmrg# The variable enable_unit_tests is used by other macros in this file.
14660568f49bSmrg#
14670568f49bSmrg# Interface to module:
14680568f49bSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
14690568f49bSmrg# enable_unit_tests:    used in configure.ac for additional configuration
14700568f49bSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
14710568f49bSmrg#			'no' user instructs the module not to build tests
14720568f49bSmrg# parm1:		specify the default value, yes or no.
14730568f49bSmrg#
14740568f49bSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
14750568f49bSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
14760568f49bSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
14770568f49bSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14780568f49bSmrgm4_define([_defopt], m4_default([$1], [auto]))
14790568f49bSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
14800568f49bSmrg	[Enable building unit test cases (default: ]_defopt[)]),
14810568f49bSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
14820568f49bSmrgm4_undefine([_defopt])
14830568f49bSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
14840568f49bSmrgAC_MSG_CHECKING([whether to build unit test cases])
14850568f49bSmrgAC_MSG_RESULT([$enable_unit_tests])
14860568f49bSmrg]) # XORG_ENABLE_UNIT_TESTS
14879e7bcd65Smrg
14880568f49bSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
14890568f49bSmrg# ------------------------------------------------------
14900568f49bSmrg# Minimum version: 1.17.0
14910568f49bSmrg#
14920568f49bSmrg# This macro enables a builder to enable/disable integration testing
14930568f49bSmrg# It makes no assumption about the test cases' implementation
14940568f49bSmrg# Test cases may or may not use Automake "Support for test suites"
14950568f49bSmrg#
14960568f49bSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
14970568f49bSmrg# usually requires less dependencies and may be built and run under less
14980568f49bSmrg# stringent environments than integration tests.
14990568f49bSmrg#
15000568f49bSmrg# Interface to module:
15010568f49bSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
15020568f49bSmrg# enable_integration_tests:   used in configure.ac for additional configuration
15030568f49bSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
15040568f49bSmrg#                             'no' user instructs the module not to build tests
15050568f49bSmrg# parm1:                      specify the default value, yes or no.
15060568f49bSmrg#
15070568f49bSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
15080568f49bSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
15090568f49bSmrgm4_define([_defopt], m4_default([$1], [auto]))
15100568f49bSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
15110568f49bSmrg	[Enable building integration test cases (default: ]_defopt[)]),
15120568f49bSmrg	[enable_integration_tests=$enableval],
15130568f49bSmrg	[enable_integration_tests=]_defopt)
15140568f49bSmrgm4_undefine([_defopt])
15150568f49bSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
15160568f49bSmrg	[test "x$enable_integration_tests" != xno])
15170568f49bSmrgAC_MSG_CHECKING([whether to build unit test cases])
15180568f49bSmrgAC_MSG_RESULT([$enable_integration_tests])
15190568f49bSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
15209e7bcd65Smrg
15210568f49bSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
15220568f49bSmrg# ----------------------------------------
15230568f49bSmrg# Minimum version: 1.13.0
15240568f49bSmrg#
15250568f49bSmrg# GLib is a library which provides advanced data structures and functions.
15260568f49bSmrg# This macro enables a module to test for the presence of Glib.
15270568f49bSmrg#
15280568f49bSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
15290568f49bSmrg# Otherwise the value of $enable_unit_tests is blank.
15300568f49bSmrg#
15310568f49bSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
15320568f49bSmrg# test support usually requires less dependencies and may be built and run under
15330568f49bSmrg# less stringent environments than integration tests.
15340568f49bSmrg#
15350568f49bSmrg# Interface to module:
15360568f49bSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
15370568f49bSmrg# with_glib: used in configure.ac to know if GLib has been found
15380568f49bSmrg# --with-glib:	'yes' user instructs the module to use glib
15390568f49bSmrg#		'no' user instructs the module not to use glib
15400568f49bSmrg#
15410568f49bSmrgAC_DEFUN([XORG_WITH_GLIB],[
15420568f49bSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
15430568f49bSmrgm4_define([_defopt], m4_default([$2], [auto]))
15440568f49bSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
15450568f49bSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
15460568f49bSmrg	[with_glib=$withval], [with_glib=]_defopt)
15470568f49bSmrgm4_undefine([_defopt])
15489e7bcd65Smrg
15490568f49bSmrghave_glib=no
15500568f49bSmrg# Do not probe GLib if user explicitly disabled unit testing
15510568f49bSmrgif test "x$enable_unit_tests" != x"no"; then
15520568f49bSmrg  # Do not probe GLib if user explicitly disabled it
15530568f49bSmrg  if test "x$with_glib" != x"no"; then
15540568f49bSmrg    m4_ifval(
15550568f49bSmrg      [$1],
15560568f49bSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
15570568f49bSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
15580568f49bSmrg    )
15590568f49bSmrg  fi
15600568f49bSmrgfi
15619e7bcd65Smrg
15620568f49bSmrg# Not having GLib when unit testing has been explicitly requested is an error
15630568f49bSmrgif test "x$enable_unit_tests" = x"yes"; then
15640568f49bSmrg  if test "x$have_glib" = x"no"; then
15650568f49bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
15660568f49bSmrg  fi
15670568f49bSmrgfi
15689e7bcd65Smrg
15690568f49bSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
15700568f49bSmrgif test "x$enable_unit_tests" = x"no"; then
15710568f49bSmrg  if test "x$with_glib" = x"yes"; then
15720568f49bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
15730568f49bSmrg  fi
15740568f49bSmrgfi
15759e7bcd65Smrg
15760568f49bSmrg# Not having GLib when it has been explicitly requested is an error
15770568f49bSmrgif test "x$with_glib" = x"yes"; then
15780568f49bSmrg  if test "x$have_glib" = x"no"; then
15790568f49bSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
15800568f49bSmrg  fi
15810568f49bSmrgfi
15829e7bcd65Smrg
15830568f49bSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
15840568f49bSmrg]) # XORG_WITH_GLIB
15859e7bcd65Smrg
15860568f49bSmrg# XORG_LD_WRAP([required|optional])
15870568f49bSmrg# ---------------------------------
15880568f49bSmrg# Minimum version: 1.13.0
15899e7bcd65Smrg#
15900568f49bSmrg# Check if linker supports -wrap, passed via compiler flags
15919e7bcd65Smrg#
15920568f49bSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
15930568f49bSmrg# Otherwise the value of $enable_unit_tests is blank.
15940568f49bSmrg#
15950568f49bSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
15960568f49bSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
15970568f49bSmrg# available, an argument of "optional" allows use when some unit tests require
15980568f49bSmrg# ld -wrap and others do not.
15990568f49bSmrg#
16000568f49bSmrgAC_DEFUN([XORG_LD_WRAP],[
16010568f49bSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
16020568f49bSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
16030568f49bSmrg                      void __wrap_exit(int status) { return; }],
16040568f49bSmrg                     [exit(0);])])
16050568f49bSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
16060568f49bSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
16070568f49bSmrg  if test "x$have_ld_wrap" = x"no"; then
16080568f49bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
16090568f49bSmrg  fi
16109e7bcd65Smrgfi
16110568f49bSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
16120568f49bSmrg#
16130568f49bSmrg]) # XORG_LD_WRAP
16149e7bcd65Smrg
16150568f49bSmrg# XORG_CHECK_LINKER_FLAGS
16160568f49bSmrg# -----------------------
16170568f49bSmrg# SYNOPSIS
16189e7bcd65Smrg#
16190568f49bSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
16209e7bcd65Smrg#
16210568f49bSmrg# DESCRIPTION
16229e7bcd65Smrg#
16230568f49bSmrg#   Check whether the given linker FLAGS work with the current language's
16240568f49bSmrg#   linker, or whether they give an error.
16259e7bcd65Smrg#
16260568f49bSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
16270568f49bSmrg#   success/failure.
16289e7bcd65Smrg#
16290568f49bSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
16309e7bcd65Smrg#
16310568f49bSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
16329e7bcd65Smrg#
16330568f49bSmrg# LICENSE
16349e7bcd65Smrg#
16350568f49bSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
16360568f49bSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
16370568f49bSmrg#   Copyright (c) 2009 Matteo Frigo
16389e7bcd65Smrg#
16390568f49bSmrg#   This program is free software: you can redistribute it and/or modify it
16400568f49bSmrg#   under the terms of the GNU General Public License as published by the
16410568f49bSmrg#   Free Software Foundation, either version 3 of the License, or (at your
16420568f49bSmrg#   option) any later version.
16439e7bcd65Smrg#
16440568f49bSmrg#   This program is distributed in the hope that it will be useful, but
16450568f49bSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
16460568f49bSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
16470568f49bSmrg#   Public License for more details.
16489e7bcd65Smrg#
16490568f49bSmrg#   You should have received a copy of the GNU General Public License along
16500568f49bSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
16519e7bcd65Smrg#
16520568f49bSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
16530568f49bSmrg#   gives unlimited permission to copy, distribute and modify the configure
16540568f49bSmrg#   scripts that are the output of Autoconf when processing the Macro. You
16550568f49bSmrg#   need not follow the terms of the GNU General Public License when using
16560568f49bSmrg#   or distributing such scripts, even though portions of the text of the
16570568f49bSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
16580568f49bSmrg#   all other use of the material that constitutes the Autoconf Macro.
16590568f49bSmrg#
16600568f49bSmrg#   This special exception to the GPL applies to versions of the Autoconf
16610568f49bSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
16620568f49bSmrg#   modified version of the Autoconf Macro, you may extend this special
16630568f49bSmrg#   exception to the GPL to apply to your modified version as well.#
16640568f49bSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
16650568f49bSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
16660568f49bSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
16670568f49bSmrgAS_LITERAL_IF([$1],
16680568f49bSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
16690568f49bSmrg      ax_save_FLAGS=$LDFLAGS
16700568f49bSmrg      LDFLAGS="$1"
16710568f49bSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
16720568f49bSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16730568f49bSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16740568f49bSmrg      LDFLAGS=$ax_save_FLAGS])],
16750568f49bSmrg  [ax_save_FLAGS=$LDFLAGS
16760568f49bSmrg   LDFLAGS="$1"
16770568f49bSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
16780568f49bSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16790568f49bSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16800568f49bSmrg   LDFLAGS=$ax_save_FLAGS])
16810568f49bSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
16820568f49bSmrgAC_MSG_RESULT($xorg_check_linker_flags)
16830568f49bSmrgif test "x$xorg_check_linker_flags" = xyes; then
16840568f49bSmrg	m4_default([$2], :)
16859e7bcd65Smrgelse
16860568f49bSmrg	m4_default([$3], :)
16879e7bcd65Smrgfi
16880568f49bSmrg]) # XORG_CHECK_LINKER_FLAGS
16899e7bcd65Smrg
16900568f49bSmrg# XORG_MEMORY_CHECK_FLAGS
16919e7bcd65Smrg# -----------------------
16920568f49bSmrg# Minimum version: 1.16.0
16939e7bcd65Smrg#
16940568f49bSmrg# This macro attempts to find appropriate memory checking functionality
16950568f49bSmrg# for various platforms which unit testing code may use to catch various
16960568f49bSmrg# forms of memory allocation and access errors in testing.
16970568f49bSmrg#
16980568f49bSmrg# Interface to module:
16990568f49bSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
17000568f49bSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
17010568f49bSmrg#
17020568f49bSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
17030568f49bSmrg#
17040568f49bSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
17059e7bcd65Smrg
17069e7bcd65SmrgAC_REQUIRE([AC_CANONICAL_HOST])
17070568f49bSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
17080568f49bSmrg           [Environment variables to enable memory checking in tests])
17099e7bcd65Smrg
17100568f49bSmrg# Check for different types of support on different platforms
17110568f49bSmrgcase $host_os in
17120568f49bSmrg    solaris*)
17130568f49bSmrg        AC_CHECK_LIB([umem], [umem_alloc],
17140568f49bSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
17150568f49bSmrg        ;;
17160568f49bSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
17170568f49bSmrg        # both directly and inverted, so should not be 0 or 255.
17180568f49bSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
17190568f49bSmrg        ;;
17200568f49bSmrg    darwin*)
17210568f49bSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
17220568f49bSmrg        ;;
17230568f49bSmrg    *bsd*)
17240568f49bSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
17250568f49bSmrg        ;;
17260568f49bSmrgesac
17279e7bcd65Smrg
17280568f49bSmrg# User supplied flags override default flags
17290568f49bSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
17300568f49bSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
17319e7bcd65Smrgfi
17329e7bcd65Smrg
17330568f49bSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
17340568f49bSmrg]) # XORG_WITH_LINT
17359e7bcd65Smrg
17360568f49bSmrg# XORG_CHECK_MALLOC_ZERO
17370568f49bSmrg# ----------------------
17380568f49bSmrg# Minimum version: 1.0.0
17390568f49bSmrg#
17400568f49bSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
17410568f49bSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
17420568f49bSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
17430568f49bSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
17440568f49bSmrgAC_ARG_ENABLE(malloc0returnsnull,
17450568f49bSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
17460568f49bSmrg		       [malloc(0) returns NULL (default: auto)]),
17470568f49bSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
17480568f49bSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
17499e7bcd65Smrg
17500568f49bSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
17510568f49bSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
17520568f49bSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
17530568f49bSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
17540568f49bSmrg#include <stdlib.h>
17550568f49bSmrg],[
17560568f49bSmrg    char *m0, *r0, *c0, *p;
17570568f49bSmrg    m0 = malloc(0);
17580568f49bSmrg    p = malloc(10);
17590568f49bSmrg    r0 = realloc(p,0);
17600568f49bSmrg    c0 = calloc(0,10);
17610568f49bSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
17620568f49bSmrg])],
17630568f49bSmrg		[xorg_cv_malloc0_returns_null=yes],
17640568f49bSmrg		[xorg_cv_malloc0_returns_null=no])])
17650568f49bSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
17669e7bcd65Smrgfi
17670568f49bSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
17689e7bcd65Smrg
17690568f49bSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
17700568f49bSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
17710568f49bSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
17720568f49bSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
17739e7bcd65Smrgelse
17740568f49bSmrg	MALLOC_ZERO_CFLAGS=""
17750568f49bSmrg	XMALLOC_ZERO_CFLAGS=""
17760568f49bSmrg	XTMALLOC_ZERO_CFLAGS=""
17779e7bcd65Smrgfi
17789e7bcd65Smrg
17790568f49bSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
17800568f49bSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
17810568f49bSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
17820568f49bSmrg]) # XORG_CHECK_MALLOC_ZERO
17839e7bcd65Smrg
17840568f49bSmrg# XORG_WITH_LINT()
17850568f49bSmrg# ----------------
17860568f49bSmrg# Minimum version: 1.1.0
17879e7bcd65Smrg#
17880568f49bSmrg# This macro enables the use of a tool that flags some suspicious and
17890568f49bSmrg# non-portable constructs (likely to be bugs) in C language source code.
17900568f49bSmrg# It will attempt to locate the tool and use appropriate options.
17910568f49bSmrg# There are various lint type tools on different platforms.
17920568f49bSmrg#
17930568f49bSmrg# Interface to module:
17940568f49bSmrg# LINT:		returns the path to the tool found on the platform
17950568f49bSmrg#		or the value set to LINT on the configure cmd line
17960568f49bSmrg#		also an Automake conditional
17970568f49bSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
17980568f49bSmrg#
17990568f49bSmrg# --with-lint:	'yes' user instructs the module to use lint
18000568f49bSmrg#		'no' user instructs the module not to use lint (default)
18010568f49bSmrg#
18020568f49bSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
18030568f49bSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
18040568f49bSmrg#
18050568f49bSmrgAC_DEFUN([XORG_WITH_LINT],[
18069e7bcd65Smrg
18070568f49bSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
18080568f49bSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
18090568f49bSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
18100568f49bSmrg		[Use a lint-style source code checker (default: disabled)])],
18110568f49bSmrg		[use_lint=$withval], [use_lint=no])
18129e7bcd65Smrg
18130568f49bSmrg# Obtain platform specific info like program name and options
18140568f49bSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
18150568f49bSmrgcase $host_os in
18160568f49bSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
18170568f49bSmrg	lint_name=splint
18180568f49bSmrg	lint_options="-badflag"
18190568f49bSmrg	;;
18200568f49bSmrg  *freebsd* | *netbsd*)
18210568f49bSmrg	lint_name=lint
18220568f49bSmrg	lint_options="-u -b"
18230568f49bSmrg	;;
18240568f49bSmrg  *solaris*)
18250568f49bSmrg	lint_name=lint
18260568f49bSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
18270568f49bSmrg	;;
18280568f49bSmrgesac
18299e7bcd65Smrg
18300568f49bSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
18310568f49bSmrgif test "x$use_lint" = x"yes" ; then
18320568f49bSmrg   AC_PATH_PROG([LINT], [$lint_name])
18330568f49bSmrg   if test "x$LINT" = "x"; then
18340568f49bSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
18350568f49bSmrg   fi
18360568f49bSmrgelif test "x$use_lint" = x"no" ; then
18370568f49bSmrg   if test "x$LINT" != "x"; then
18380568f49bSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
18390568f49bSmrg   fi
18409e7bcd65Smrgelse
18410568f49bSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
18429e7bcd65Smrgfi
18439e7bcd65Smrg
18440568f49bSmrg# User supplied flags override default flags
18450568f49bSmrgif test "x$LINT_FLAGS" != "x"; then
18460568f49bSmrg   lint_options=$LINT_FLAGS
18479e7bcd65Smrgfi
18489e7bcd65Smrg
18490568f49bSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
18500568f49bSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
18519e7bcd65Smrg
18520568f49bSmrg]) # XORG_WITH_LINT
18539e7bcd65Smrg
18540568f49bSmrg# XORG_LINT_LIBRARY(LIBNAME)
18550568f49bSmrg# --------------------------
18560568f49bSmrg# Minimum version: 1.1.0
18579e7bcd65Smrg#
18580568f49bSmrg# Sets up flags for building lint libraries for checking programs that call
18590568f49bSmrg# functions in the library.
18600568f49bSmrg#
18610568f49bSmrg# Interface to module:
18620568f49bSmrg# LINTLIB		- Automake variable with the name of lint library file to make
18630568f49bSmrg# MAKE_LINT_LIB		- Automake conditional
18640568f49bSmrg#
18650568f49bSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
18660568f49bSmrg#			  - 'no' user instructs the module not to create a lint library (default)
18679e7bcd65Smrg
18680568f49bSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
18690568f49bSmrgAC_REQUIRE([XORG_WITH_LINT])
18700568f49bSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
18710568f49bSmrg	[Create lint library (default: disabled)])],
18720568f49bSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
18739e7bcd65Smrg
18740568f49bSmrgif test "x$make_lint_lib" = x"yes" ; then
18750568f49bSmrg   LINTLIB=llib-l$1.ln
18760568f49bSmrg   if test "x$LINT" = "x"; then
18770568f49bSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
18780568f49bSmrg   fi
18790568f49bSmrgelif test "x$make_lint_lib" != x"no" ; then
18800568f49bSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
18819e7bcd65Smrgfi
18829e7bcd65Smrg
18830568f49bSmrgAC_SUBST(LINTLIB)
18840568f49bSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
18859e7bcd65Smrg
18860568f49bSmrg]) # XORG_LINT_LIBRARY
18879e7bcd65Smrg
18880568f49bSmrg# XORG_COMPILER_BRAND
18890568f49bSmrg# -------------------
18900568f49bSmrg# Minimum version: 1.14.0
18919e7bcd65Smrg#
18920568f49bSmrg# Checks for various brands of compilers and sets flags as appropriate:
18930568f49bSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
18940568f49bSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
18950568f49bSmrg#   clang compiler - sets CLANGCC to "yes"
18960568f49bSmrg#   Intel compiler - sets INTELCC to "yes"
18970568f49bSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
18989e7bcd65Smrg#
18990568f49bSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
19000568f49bSmrgAC_LANG_CASE(
19010568f49bSmrg	[C], [
19020568f49bSmrg		AC_REQUIRE([AC_PROG_CC_C99])
19030568f49bSmrg	],
19040568f49bSmrg	[C++], [
19050568f49bSmrg		AC_REQUIRE([AC_PROG_CXX])
19060568f49bSmrg	]
19070568f49bSmrg)
19080568f49bSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
19090568f49bSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
19100568f49bSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
19110568f49bSmrg]) # XORG_COMPILER_BRAND
19120568f49bSmrg
19130568f49bSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
19140568f49bSmrg# ---------------
19150568f49bSmrg# Minimum version: 1.16.0
19169e7bcd65Smrg#
19170568f49bSmrg# Test if the compiler works when passed the given flag as a command line argument.
19180568f49bSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
19190568f49bSmrg# next flag in the list until there are no more options.
19209e7bcd65Smrg#
19210568f49bSmrg# Note that this does not guarantee that the compiler supports the flag as some
19220568f49bSmrg# compilers will simply ignore arguments that they do not understand, but we do
19230568f49bSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
19240568f49bSmrg# -Werror=unused-command-line-argument
19259e7bcd65Smrg#
19260568f49bSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
19270568f49bSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
19280568f49bSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
19299e7bcd65Smrg
19300568f49bSmrgAC_LANG_COMPILER_REQUIRE
19310568f49bSmrg
19320568f49bSmrgAC_LANG_CASE(
19330568f49bSmrg	[C], [
19340568f49bSmrg		AC_REQUIRE([AC_PROG_CC_C99])
19350568f49bSmrg		define([PREFIX], [C])
19360568f49bSmrg		define([CACHE_PREFIX], [cc])
19370568f49bSmrg		define([COMPILER], [$CC])
19380568f49bSmrg	],
19390568f49bSmrg	[C++], [
19400568f49bSmrg		define([PREFIX], [CXX])
19410568f49bSmrg		define([CACHE_PREFIX], [cxx])
19420568f49bSmrg		define([COMPILER], [$CXX])
19430568f49bSmrg	]
19440568f49bSmrg)
19450568f49bSmrg
19460568f49bSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
19470568f49bSmrg
19480568f49bSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
19490568f49bSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19500568f49bSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
19510568f49bSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
19520568f49bSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
19530568f49bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
19540568f49bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
19550568f49bSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
19560568f49bSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19579e7bcd65Smrgfi
19589e7bcd65Smrg
19590568f49bSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
19600568f49bSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
19610568f49bSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19620568f49bSmrg	fi
19630568f49bSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
19640568f49bSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
19650568f49bSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
19660568f49bSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
19670568f49bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
19680568f49bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
19690568f49bSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
19700568f49bSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19710568f49bSmrgfi
19729e7bcd65Smrg
19730568f49bSmrgfound="no"
19740568f49bSmrgm4_foreach([flag], m4_cdr($@), [
19750568f49bSmrg	if test $found = "no" ; then
19760568f49bSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
19770568f49bSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19780568f49bSmrg		fi
19799e7bcd65Smrg
19800568f49bSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
19810568f49bSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
19820568f49bSmrg		fi
19830568f49bSmrg
19840568f49bSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
19850568f49bSmrg
19860568f49bSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
19870568f49bSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
19880568f49bSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
19890568f49bSmrg		AC_CACHE_VAL($cacheid,
19900568f49bSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
19910568f49bSmrg					     [eval $cacheid=yes],
19920568f49bSmrg					     [eval $cacheid=no])])
19930568f49bSmrg
19940568f49bSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19950568f49bSmrg
19960568f49bSmrg		eval supported=\$$cacheid
19970568f49bSmrg		AC_MSG_RESULT([$supported])
19980568f49bSmrg		if test "$supported" = "yes" ; then
19990568f49bSmrg			$1="$$1 ]flag["
20000568f49bSmrg			found="yes"
20010568f49bSmrg		fi
20020568f49bSmrg	fi
20030568f49bSmrg])
20040568f49bSmrg]) # XORG_TESTSET_CFLAG
20050568f49bSmrg
20060568f49bSmrg# XORG_COMPILER_FLAGS
20070568f49bSmrg# ---------------
20080568f49bSmrg# Minimum version: 1.16.0
20099e7bcd65Smrg#
20100568f49bSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
20110568f49bSmrg# arguments supported by the selected compiler which do NOT alter the generated
20120568f49bSmrg# code.  These arguments will cause the compiler to print various warnings
20130568f49bSmrg# during compilation AND turn a conservative set of warnings into errors.
20149e7bcd65Smrg#
20150568f49bSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
20160568f49bSmrg# future versions of util-macros as options are added to new compilers.
20179e7bcd65Smrg#
20180568f49bSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
20190568f49bSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
20209e7bcd65Smrg
20210568f49bSmrgAC_ARG_ENABLE(selective-werror,
20220568f49bSmrg              AS_HELP_STRING([--disable-selective-werror],
20230568f49bSmrg                             [Turn off selective compiler errors. (default: enabled)]),
20240568f49bSmrg              [SELECTIVE_WERROR=$enableval],
20250568f49bSmrg              [SELECTIVE_WERROR=yes])
20260568f49bSmrg
20270568f49bSmrgAC_LANG_CASE(
20280568f49bSmrg        [C], [
20290568f49bSmrg                define([PREFIX], [C])
20300568f49bSmrg        ],
20310568f49bSmrg        [C++], [
20320568f49bSmrg                define([PREFIX], [CXX])
20330568f49bSmrg        ]
20340568f49bSmrg)
20350568f49bSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
20360568f49bSmrgif test "x$SUNCC" = "xyes"; then
20370568f49bSmrg    [BASE_]PREFIX[FLAGS]="-v"
20389e7bcd65Smrgelse
20390568f49bSmrg    [BASE_]PREFIX[FLAGS]=""
20409e7bcd65Smrgfi
20419e7bcd65Smrg
20420568f49bSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
20430568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
20440568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
20450568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
20460568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
20479e7bcd65Smrg
20480568f49bSmrgAC_LANG_CASE(
20490568f49bSmrg	[C], [
20500568f49bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
20510568f49bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
20520568f49bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
20530568f49bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
20540568f49bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
20550568f49bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
20560568f49bSmrg	]
20570568f49bSmrg)
20589e7bcd65Smrg
20590568f49bSmrg# This chunk adds additional warnings that could catch undesired effects.
20600568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
20610568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
20620568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
20630568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
20640568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
20650568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
20660568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
20670568f49bSmrg
20680568f49bSmrg# These are currently disabled because they are noisy.  They will be enabled
20690568f49bSmrg# in the future once the codebase is sufficiently modernized to silence
20700568f49bSmrg# them.  For now, I don't want them to drown out the other warnings.
20710568f49bSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
20720568f49bSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
20730568f49bSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
20740568f49bSmrg
20750568f49bSmrg# Turn some warnings into errors, so we don't accidently get successful builds
20760568f49bSmrg# when there are problems that should be fixed.
20770568f49bSmrg
20780568f49bSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
20790568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
20800568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
20810568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
20820568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
20830568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
20840568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
20850568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
20860568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
20870568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
20880568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
20890568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
20900568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
20910568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
20929e7bcd65Smrgelse
20930568f49bSmrgAC_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])
20940568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
20950568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
20960568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
20970568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
20980568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
20990568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
21000568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
21010568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
21020568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
21030568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
21040568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
21050568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
21060568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
21079e7bcd65Smrgfi
21089e7bcd65Smrg
21090568f49bSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
21100568f49bSmrg]) # XORG_COMPILER_FLAGS
21119e7bcd65Smrg
21120568f49bSmrg# XORG_CWARNFLAGS
21130568f49bSmrg# ---------------
21140568f49bSmrg# Minimum version: 1.2.0
21150568f49bSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
21169e7bcd65Smrg#
21170568f49bSmrg# Defines CWARNFLAGS to enable C compiler warnings.
21189e7bcd65Smrg#
21190568f49bSmrg# This function is deprecated because it defines -fno-strict-aliasing
21200568f49bSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
21210568f49bSmrg# is needed, then it should be added explicitly in the module when
21220568f49bSmrg# it is updated to use BASE_CFLAGS.
21239e7bcd65Smrg#
21240568f49bSmrgAC_DEFUN([XORG_CWARNFLAGS], [
21250568f49bSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
21260568f49bSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
21270568f49bSmrgAC_LANG_CASE(
21280568f49bSmrg	[C], [
21290568f49bSmrg		CWARNFLAGS="$BASE_CFLAGS"
21300568f49bSmrg		if  test "x$GCC" = xyes ; then
21310568f49bSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
21320568f49bSmrg		fi
21330568f49bSmrg		AC_SUBST(CWARNFLAGS)
21340568f49bSmrg	]
21350568f49bSmrg)
21360568f49bSmrg]) # XORG_CWARNFLAGS
21370568f49bSmrg
21380568f49bSmrg# XORG_STRICT_OPTION
21390568f49bSmrg# -----------------------
21400568f49bSmrg# Minimum version: 1.3.0
21419e7bcd65Smrg#
21420568f49bSmrg# Add configure option to enable strict compilation flags, such as treating
21430568f49bSmrg# warnings as fatal errors.
21440568f49bSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
21450568f49bSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
21460568f49bSmrg#
21470568f49bSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
21480568f49bSmrg# when strict compilation is unconditionally desired.
21490568f49bSmrgAC_DEFUN([XORG_STRICT_OPTION], [
21500568f49bSmrgAC_REQUIRE([XORG_CWARNFLAGS])
21510568f49bSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
21529e7bcd65Smrg
21530568f49bSmrgAC_ARG_ENABLE(strict-compilation,
21540568f49bSmrg			  AS_HELP_STRING([--enable-strict-compilation],
21550568f49bSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
21560568f49bSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
21570568f49bSmrg
21580568f49bSmrgAC_LANG_CASE(
21590568f49bSmrg        [C], [
21600568f49bSmrg                define([PREFIX], [C])
21610568f49bSmrg        ],
21620568f49bSmrg        [C++], [
21630568f49bSmrg                define([PREFIX], [CXX])
21640568f49bSmrg        ]
21650568f49bSmrg)
21660568f49bSmrg
21670568f49bSmrg[STRICT_]PREFIX[FLAGS]=""
21680568f49bSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
21690568f49bSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
21700568f49bSmrg
21710568f49bSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
21720568f49bSmrg# activate it with -Werror, so we add it here explicitly.
21730568f49bSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
21740568f49bSmrg
21750568f49bSmrgif test "x$STRICT_COMPILE" = "xyes"; then
21760568f49bSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
21770568f49bSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
21789e7bcd65Smrgfi
21790568f49bSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
21800568f49bSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
21810568f49bSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
21820568f49bSmrg]) # XORG_STRICT_OPTION
21839e7bcd65Smrg
21840568f49bSmrg# XORG_DEFAULT_OPTIONS
21850568f49bSmrg# --------------------
21860568f49bSmrg# Minimum version: 1.3.0
21879e7bcd65Smrg#
21880568f49bSmrg# Defines default options for X.Org modules.
21899e7bcd65Smrg#
21900568f49bSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
21910568f49bSmrgAC_REQUIRE([AC_PROG_INSTALL])
21920568f49bSmrgXORG_COMPILER_FLAGS
21930568f49bSmrgXORG_CWARNFLAGS
21940568f49bSmrgXORG_STRICT_OPTION
21950568f49bSmrgXORG_RELEASE_VERSION
21960568f49bSmrgXORG_CHANGELOG
21970568f49bSmrgXORG_INSTALL
21980568f49bSmrgXORG_MANPAGE_SECTIONS
21990568f49bSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
22000568f49bSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
22010568f49bSmrg]) # XORG_DEFAULT_OPTIONS
22020568f49bSmrg
22030568f49bSmrg# XORG_INSTALL()
22040568f49bSmrg# ----------------
22050568f49bSmrg# Minimum version: 1.4.0
22069e7bcd65Smrg#
22070568f49bSmrg# Defines the variable INSTALL_CMD as the command to copy
22080568f49bSmrg# INSTALL from $prefix/share/util-macros.
22099e7bcd65Smrg#
22100568f49bSmrgAC_DEFUN([XORG_INSTALL], [
22110568f49bSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
22120568f49bSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
22130568f49bSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
22140568f49bSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
22150568f49bSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
22160568f49bSmrgtouch \$(top_srcdir)/INSTALL; \
22170568f49bSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
22180568f49bSmrgAC_SUBST([INSTALL_CMD])
22190568f49bSmrg]) # XORG_INSTALL
22200568f49bSmrgdnl Copyright 2005 Red Hat, Inc
22210568f49bSmrgdnl
22220568f49bSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
22230568f49bSmrgdnl documentation for any purpose is hereby granted without fee, provided that
22240568f49bSmrgdnl the above copyright notice appear in all copies and that both that
22250568f49bSmrgdnl copyright notice and this permission notice appear in supporting
22260568f49bSmrgdnl documentation.
22270568f49bSmrgdnl
22280568f49bSmrgdnl The above copyright notice and this permission notice shall be included
22290568f49bSmrgdnl in all copies or substantial portions of the Software.
22300568f49bSmrgdnl
22310568f49bSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22320568f49bSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22330568f49bSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22340568f49bSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
22350568f49bSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22360568f49bSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22370568f49bSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
22380568f49bSmrgdnl
22390568f49bSmrgdnl Except as contained in this notice, the name of the copyright holders shall
22400568f49bSmrgdnl not be used in advertising or otherwise to promote the sale, use or
22410568f49bSmrgdnl other dealings in this Software without prior written authorization
22420568f49bSmrgdnl from the copyright holders.
22430568f49bSmrgdnl
2244339a7c43Smrg
22450568f49bSmrg# XORG_RELEASE_VERSION
22460568f49bSmrg# --------------------
22470568f49bSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
2248339a7c43Smrg
22490568f49bSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
22500568f49bSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
22510568f49bSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
22520568f49bSmrg		[Major version of this package])
22530568f49bSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
22540568f49bSmrg	if test "x$PVM" = "x"; then
22550568f49bSmrg		PVM="0"
22560568f49bSmrg	fi
22570568f49bSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
22580568f49bSmrg		[$PVM],
22590568f49bSmrg		[Minor version of this package])
22600568f49bSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
22610568f49bSmrg	if test "x$PVP" = "x"; then
22620568f49bSmrg		PVP="0"
22630568f49bSmrg	fi
22640568f49bSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
22650568f49bSmrg		[$PVP],
22660568f49bSmrg		[Patch version of this package])
22670568f49bSmrg])
22689e7bcd65Smrg
22690568f49bSmrg# XORG_CHANGELOG()
22709e7bcd65Smrg# ----------------
22710568f49bSmrg# Minimum version: 1.2.0
22729e7bcd65Smrg#
22730568f49bSmrg# Defines the variable CHANGELOG_CMD as the command to generate
22740568f49bSmrg# ChangeLog from git.
22759e7bcd65Smrg#
22769e7bcd65Smrg#
22770568f49bSmrgAC_DEFUN([XORG_CHANGELOG], [
22780568f49bSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
22790568f49bSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
22800568f49bSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
22810568f49bSmrgtouch \$(top_srcdir)/ChangeLog; \
22820568f49bSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
22830568f49bSmrgAC_SUBST([CHANGELOG_CMD])
22840568f49bSmrg]) # XORG_CHANGELOG
22850568f49bSmrg
2286a3bd7f05Smrg# Copyright (C) 2002-2020 Free Software Foundation, Inc.
22879e7bcd65Smrg#
22880568f49bSmrg# This file is free software; the Free Software Foundation
22890568f49bSmrg# gives unlimited permission to copy and/or distribute it,
22900568f49bSmrg# with or without modifications, as long as this notice is preserved.
22919e7bcd65Smrg
22920568f49bSmrg# AM_AUTOMAKE_VERSION(VERSION)
22930568f49bSmrg# ----------------------------
22940568f49bSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
22950568f49bSmrg# generated from the m4 files accompanying Automake X.Y.
22960568f49bSmrg# (This private macro should not be called outside this file.)
22970568f49bSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
22980568f49bSmrg[am__api_version='1.16'
22990568f49bSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
23000568f49bSmrgdnl require some minimum version.  Point them to the right macro.
2301a3bd7f05Smrgm4_if([$1], [1.16.2], [],
23020568f49bSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
23030568f49bSmrg])
23049e7bcd65Smrg
23050568f49bSmrg# _AM_AUTOCONF_VERSION(VERSION)
23060568f49bSmrg# -----------------------------
23070568f49bSmrg# aclocal traces this macro to find the Autoconf version.
23080568f49bSmrg# This is a private macro too.  Using m4_define simplifies
23090568f49bSmrg# the logic in aclocal, which can simply ignore this definition.
23100568f49bSmrgm4_define([_AM_AUTOCONF_VERSION], [])
23119e7bcd65Smrg
23120568f49bSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
23130568f49bSmrg# -------------------------------
23140568f49bSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
23150568f49bSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
23160568f49bSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
2317a3bd7f05Smrg[AM_AUTOMAKE_VERSION([1.16.2])dnl
23180568f49bSmrgm4_ifndef([AC_AUTOCONF_VERSION],
23190568f49bSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
23200568f49bSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
23219e7bcd65Smrg
23220568f49bSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
23239e7bcd65Smrg
2324a3bd7f05Smrg# Copyright (C) 2001-2020 Free Software Foundation, Inc.
23259e7bcd65Smrg#
23260568f49bSmrg# This file is free software; the Free Software Foundation
23270568f49bSmrg# gives unlimited permission to copy and/or distribute it,
23280568f49bSmrg# with or without modifications, as long as this notice is preserved.
23299e7bcd65Smrg
23300568f49bSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
23310568f49bSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
23320568f49bSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
23330568f49bSmrg#
23340568f49bSmrg# Of course, Automake must honor this variable whenever it calls a
23350568f49bSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
23360568f49bSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
23370568f49bSmrg# depending on how configure is run.  This is pretty annoying, since
23380568f49bSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
23390568f49bSmrg# source directory, any form will work fine, but in subdirectories a
23400568f49bSmrg# relative path needs to be adjusted first.
2341339a7c43Smrg#
23420568f49bSmrg# $ac_aux_dir/missing
23430568f49bSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
23440568f49bSmrg# $top_srcdir/$ac_aux_dir/missing
23450568f49bSmrg#    fails if $ac_aux_dir is absolute,
23460568f49bSmrg#    fails when called from a subdirectory in a VPATH build with
23470568f49bSmrg#          a relative $ac_aux_dir
2348339a7c43Smrg#
23490568f49bSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
23500568f49bSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
23510568f49bSmrg# harmless because $srcdir is '.', but things will broke when you
23520568f49bSmrg# start a VPATH build or use an absolute $srcdir.
2353339a7c43Smrg#
23540568f49bSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
23550568f49bSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
23560568f49bSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
23570568f49bSmrg# and then we would define $MISSING as
23580568f49bSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
23590568f49bSmrg# This will work as long as MISSING is not called from configure, because
23600568f49bSmrg# unfortunately $(top_srcdir) has no meaning in configure.
23610568f49bSmrg# However there are other variables, like CC, which are often used in
23620568f49bSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
23630568f49bSmrg#
23640568f49bSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
23650568f49bSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
23660568f49bSmrg# configured tree to be moved without reconfiguration.
2367339a7c43Smrg
23680568f49bSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
23690568f49bSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
23700568f49bSmrg# Expand $ac_aux_dir to an absolute path.
23710568f49bSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
23720568f49bSmrg])
2373339a7c43Smrg
23740568f49bSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
23750568f49bSmrg
2376a3bd7f05Smrg# Copyright (C) 1997-2020 Free Software Foundation, Inc.
23779e7bcd65Smrg#
23780568f49bSmrg# This file is free software; the Free Software Foundation
23790568f49bSmrg# gives unlimited permission to copy and/or distribute it,
23800568f49bSmrg# with or without modifications, as long as this notice is preserved.
23810568f49bSmrg
23820568f49bSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
23830568f49bSmrg# -------------------------------------
23840568f49bSmrg# Define a conditional.
23850568f49bSmrgAC_DEFUN([AM_CONDITIONAL],
23860568f49bSmrg[AC_PREREQ([2.52])dnl
23870568f49bSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
23880568f49bSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
23890568f49bSmrgAC_SUBST([$1_TRUE])dnl
23900568f49bSmrgAC_SUBST([$1_FALSE])dnl
23910568f49bSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
23920568f49bSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
23930568f49bSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
23940568f49bSmrgif $2; then
23950568f49bSmrg  $1_TRUE=
23960568f49bSmrg  $1_FALSE='#'
23970568f49bSmrgelse
23980568f49bSmrg  $1_TRUE='#'
23990568f49bSmrg  $1_FALSE=
24000568f49bSmrgfi
24010568f49bSmrgAC_CONFIG_COMMANDS_PRE(
24020568f49bSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
24030568f49bSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
24040568f49bSmrgUsually this means the macro was only invoked conditionally.]])
24050568f49bSmrgfi])])
24060568f49bSmrg
2407a3bd7f05Smrg# Copyright (C) 1999-2020 Free Software Foundation, Inc.
24089e7bcd65Smrg#
24090568f49bSmrg# This file is free software; the Free Software Foundation
24100568f49bSmrg# gives unlimited permission to copy and/or distribute it,
24110568f49bSmrg# with or without modifications, as long as this notice is preserved.
24120568f49bSmrg
24130568f49bSmrg
24140568f49bSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
24150568f49bSmrg# written in clear, in which case automake, when reading aclocal.m4,
24160568f49bSmrg# will think it sees a *use*, and therefore will trigger all it's
24170568f49bSmrg# C support machinery.  Also note that it means that autoscan, seeing
24180568f49bSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
24190568f49bSmrg
24200568f49bSmrg
24210568f49bSmrg# _AM_DEPENDENCIES(NAME)
24220568f49bSmrg# ----------------------
24230568f49bSmrg# See how the compiler implements dependency checking.
24240568f49bSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
24250568f49bSmrg# We try a few techniques and use that to set a single cache variable.
24269e7bcd65Smrg#
24270568f49bSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
24280568f49bSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
24290568f49bSmrg# dependency, and given that the user is not expected to run this macro,
24300568f49bSmrg# just rely on AC_PROG_CC.
24310568f49bSmrgAC_DEFUN([_AM_DEPENDENCIES],
24320568f49bSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
24330568f49bSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
24340568f49bSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
24350568f49bSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
2436444c061aSmrg
24370568f49bSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
24380568f49bSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
24390568f49bSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
24400568f49bSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
24410568f49bSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
24420568f49bSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
24430568f49bSmrg                    [depcc="$$1"   am_compiler_list=])
24440568f49bSmrg
24450568f49bSmrgAC_CACHE_CHECK([dependency style of $depcc],
24460568f49bSmrg               [am_cv_$1_dependencies_compiler_type],
24470568f49bSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
24480568f49bSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
24490568f49bSmrg  # making bogus files that we don't know about and never remove.  For
24500568f49bSmrg  # instance it was reported that on HP-UX the gcc test will end up
24510568f49bSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
24520568f49bSmrg  # in D".
24530568f49bSmrg  rm -rf conftest.dir
24540568f49bSmrg  mkdir conftest.dir
24550568f49bSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
24560568f49bSmrg  # using a relative directory.
24570568f49bSmrg  cp "$am_depcomp" conftest.dir
24580568f49bSmrg  cd conftest.dir
24590568f49bSmrg  # We will build objects and dependencies in a subdirectory because
24600568f49bSmrg  # it helps to detect inapplicable dependency modes.  For instance
24610568f49bSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
24620568f49bSmrg  # side effect of compilation, but ICC will put the dependencies in
24630568f49bSmrg  # the current directory while Tru64 will put them in the object
24640568f49bSmrg  # directory.
24650568f49bSmrg  mkdir sub
24660568f49bSmrg
24670568f49bSmrg  am_cv_$1_dependencies_compiler_type=none
24680568f49bSmrg  if test "$am_compiler_list" = ""; then
24690568f49bSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
24700568f49bSmrg  fi
24710568f49bSmrg  am__universal=false
24720568f49bSmrg  m4_case([$1], [CC],
24730568f49bSmrg    [case " $depcc " in #(
24740568f49bSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
24750568f49bSmrg     esac],
24760568f49bSmrg    [CXX],
24770568f49bSmrg    [case " $depcc " in #(
24780568f49bSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
24790568f49bSmrg     esac])
24800568f49bSmrg
24810568f49bSmrg  for depmode in $am_compiler_list; do
24820568f49bSmrg    # Setup a source with many dependencies, because some compilers
24830568f49bSmrg    # like to wrap large dependency lists on column 80 (with \), and
24840568f49bSmrg    # we should not choose a depcomp mode which is confused by this.
24850568f49bSmrg    #
24860568f49bSmrg    # We need to recreate these files for each test, as the compiler may
24870568f49bSmrg    # overwrite some of them when testing with obscure command lines.
24880568f49bSmrg    # This happens at least with the AIX C compiler.
24890568f49bSmrg    : > sub/conftest.c
24900568f49bSmrg    for i in 1 2 3 4 5 6; do
24910568f49bSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
24920568f49bSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
24930568f49bSmrg      # Solaris 10 /bin/sh.
24940568f49bSmrg      echo '/* dummy */' > sub/conftst$i.h
24950568f49bSmrg    done
24960568f49bSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
24970568f49bSmrg
24980568f49bSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
24990568f49bSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
25000568f49bSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
25010568f49bSmrg    # versions had trouble with output in subdirs.
25020568f49bSmrg    am__obj=sub/conftest.${OBJEXT-o}
25030568f49bSmrg    am__minus_obj="-o $am__obj"
25040568f49bSmrg    case $depmode in
25050568f49bSmrg    gcc)
25060568f49bSmrg      # This depmode causes a compiler race in universal mode.
25070568f49bSmrg      test "$am__universal" = false || continue
25080568f49bSmrg      ;;
25090568f49bSmrg    nosideeffect)
25100568f49bSmrg      # After this tag, mechanisms are not by side-effect, so they'll
25110568f49bSmrg      # only be used when explicitly requested.
25120568f49bSmrg      if test "x$enable_dependency_tracking" = xyes; then
25130568f49bSmrg	continue
25140568f49bSmrg      else
25150568f49bSmrg	break
25160568f49bSmrg      fi
25170568f49bSmrg      ;;
25180568f49bSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25190568f49bSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
25200568f49bSmrg      # not run yet.  These depmodes are late enough in the game, and
25210568f49bSmrg      # so weak that their functioning should not be impacted.
25220568f49bSmrg      am__obj=conftest.${OBJEXT-o}
25230568f49bSmrg      am__minus_obj=
25240568f49bSmrg      ;;
25250568f49bSmrg    none) break ;;
25260568f49bSmrg    esac
25270568f49bSmrg    if depmode=$depmode \
25280568f49bSmrg       source=sub/conftest.c object=$am__obj \
25290568f49bSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
25300568f49bSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
25310568f49bSmrg         >/dev/null 2>conftest.err &&
25320568f49bSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
25330568f49bSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
25340568f49bSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
25350568f49bSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
25360568f49bSmrg      # icc doesn't choke on unknown options, it will just issue warnings
25370568f49bSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
25380568f49bSmrg      # that says an option was ignored or not supported.
25390568f49bSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
25400568f49bSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
25410568f49bSmrg      # The diagnosis changed in icc 8.0:
25420568f49bSmrg      #   icc: Command line remark: option '-MP' not supported
25430568f49bSmrg      if (grep 'ignoring option' conftest.err ||
25440568f49bSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
25450568f49bSmrg        am_cv_$1_dependencies_compiler_type=$depmode
25460568f49bSmrg        break
25470568f49bSmrg      fi
25480568f49bSmrg    fi
25490568f49bSmrg  done
25500568f49bSmrg
25510568f49bSmrg  cd ..
25520568f49bSmrg  rm -rf conftest.dir
25539e7bcd65Smrgelse
25540568f49bSmrg  am_cv_$1_dependencies_compiler_type=none
25559e7bcd65Smrgfi
25560568f49bSmrg])
25570568f49bSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
25580568f49bSmrgAM_CONDITIONAL([am__fastdep$1], [
25590568f49bSmrg  test "x$enable_dependency_tracking" != xno \
25600568f49bSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
25610568f49bSmrg])
2562444c061aSmrg
25631477040fSmrg
25640568f49bSmrg# AM_SET_DEPDIR
25650568f49bSmrg# -------------
25660568f49bSmrg# Choose a directory name for dependency files.
25670568f49bSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
25680568f49bSmrgAC_DEFUN([AM_SET_DEPDIR],
25690568f49bSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
25700568f49bSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
25710568f49bSmrg])
2572444c061aSmrg
2573444c061aSmrg
25740568f49bSmrg# AM_DEP_TRACK
25750568f49bSmrg# ------------
25760568f49bSmrgAC_DEFUN([AM_DEP_TRACK],
25770568f49bSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
25780568f49bSmrgAS_HELP_STRING(
25790568f49bSmrg  [--enable-dependency-tracking],
25800568f49bSmrg  [do not reject slow dependency extractors])
25810568f49bSmrgAS_HELP_STRING(
25820568f49bSmrg  [--disable-dependency-tracking],
25830568f49bSmrg  [speeds up one-time build])])
25840568f49bSmrgif test "x$enable_dependency_tracking" != xno; then
25850568f49bSmrg  am_depcomp="$ac_aux_dir/depcomp"
25860568f49bSmrg  AMDEPBACKSLASH='\'
25870568f49bSmrg  am__nodep='_no'
25880568f49bSmrgfi
25890568f49bSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
25900568f49bSmrgAC_SUBST([AMDEPBACKSLASH])dnl
25910568f49bSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
25920568f49bSmrgAC_SUBST([am__nodep])dnl
25930568f49bSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
25940568f49bSmrg])
25959e7bcd65Smrg
25960568f49bSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
25979e7bcd65Smrg
2598a3bd7f05Smrg# Copyright (C) 1999-2020 Free Software Foundation, Inc.
25999e7bcd65Smrg#
26000568f49bSmrg# This file is free software; the Free Software Foundation
26010568f49bSmrg# gives unlimited permission to copy and/or distribute it,
26020568f49bSmrg# with or without modifications, as long as this notice is preserved.
26030568f49bSmrg
26040568f49bSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
26050568f49bSmrg# ------------------------------
26060568f49bSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
26070568f49bSmrg[{
26080568f49bSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
26090568f49bSmrg  # are listed without --file.  Let's play safe and only enable the eval
26100568f49bSmrg  # if we detect the quoting.
26110568f49bSmrg  # TODO: see whether this extra hack can be removed once we start
26120568f49bSmrg  # requiring Autoconf 2.70 or later.
26130568f49bSmrg  AS_CASE([$CONFIG_FILES],
26140568f49bSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
26150568f49bSmrg          [*], [set x $CONFIG_FILES])
26160568f49bSmrg  shift
26170568f49bSmrg  # Used to flag and report bootstrapping failures.
26180568f49bSmrg  am_rc=0
26190568f49bSmrg  for am_mf
26200568f49bSmrg  do
26210568f49bSmrg    # Strip MF so we end up with the name of the file.
26220568f49bSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
26230568f49bSmrg    # Check whether this is an Automake generated Makefile which includes
26240568f49bSmrg    # dependency-tracking related rules and includes.
26250568f49bSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
26260568f49bSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
26270568f49bSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
26280568f49bSmrg      || continue
26290568f49bSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
26300568f49bSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
26310568f49bSmrg    AM_RUN_LOG([cd "$am_dirpart" \
26320568f49bSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
26330568f49bSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
26340568f49bSmrg  done
26350568f49bSmrg  if test $am_rc -ne 0; then
26360568f49bSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
2637a3bd7f05Smrg    for automatic dependency tracking.  If GNU make was not used, consider
2638a3bd7f05Smrg    re-running the configure script with MAKE="gmake" (or whatever is
2639a3bd7f05Smrg    necessary).  You can also try re-running configure with the
26400568f49bSmrg    '--disable-dependency-tracking' option to at least be able to build
26410568f49bSmrg    the package (albeit without support for automatic dependency tracking).])
26420568f49bSmrg  fi
26430568f49bSmrg  AS_UNSET([am_dirpart])
26440568f49bSmrg  AS_UNSET([am_filepart])
26450568f49bSmrg  AS_UNSET([am_mf])
26460568f49bSmrg  AS_UNSET([am_rc])
26470568f49bSmrg  rm -f conftest-deps.mk
26480568f49bSmrg}
26490568f49bSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
26500568f49bSmrg
26510568f49bSmrg
26520568f49bSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
26530568f49bSmrg# -----------------------------
26540568f49bSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
26559e7bcd65Smrg#
26560568f49bSmrg# This code is only required when automatic dependency tracking is enabled.
26570568f49bSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
26580568f49bSmrg# order to bootstrap the dependency handling code.
26590568f49bSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
26600568f49bSmrg[AC_CONFIG_COMMANDS([depfiles],
26610568f49bSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
26620568f49bSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
26630568f49bSmrg
26640568f49bSmrg# Do all the work for Automake.                             -*- Autoconf -*-
26650568f49bSmrg
2666a3bd7f05Smrg# Copyright (C) 1996-2020 Free Software Foundation, Inc.
26679e7bcd65Smrg#
26680568f49bSmrg# This file is free software; the Free Software Foundation
26690568f49bSmrg# gives unlimited permission to copy and/or distribute it,
26700568f49bSmrg# with or without modifications, as long as this notice is preserved.
26719e7bcd65Smrg
26720568f49bSmrg# This macro actually does too much.  Some checks are only needed if
26730568f49bSmrg# your package does certain things.  But this isn't really a big deal.
2674444c061aSmrg
26750568f49bSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
26760568f49bSmrgm4_define([AC_PROG_CC],
26770568f49bSmrgm4_defn([AC_PROG_CC])
26780568f49bSmrg[_AM_PROG_CC_C_O
26790568f49bSmrg])
26802ae83157Smrg
26810568f49bSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
26820568f49bSmrg# AM_INIT_AUTOMAKE([OPTIONS])
26830568f49bSmrg# -----------------------------------------------
26840568f49bSmrg# The call with PACKAGE and VERSION arguments is the old style
26850568f49bSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
26860568f49bSmrg# and VERSION should now be passed to AC_INIT and removed from
26870568f49bSmrg# the call to AM_INIT_AUTOMAKE.
26880568f49bSmrg# We support both call styles for the transition.  After
26890568f49bSmrg# the next Automake release, Autoconf can make the AC_INIT
26900568f49bSmrg# arguments mandatory, and then we can depend on a new Autoconf
26910568f49bSmrg# release and drop the old call support.
26920568f49bSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
26930568f49bSmrg[AC_PREREQ([2.65])dnl
26940568f49bSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
26950568f49bSmrgdnl the ones we care about.
26960568f49bSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
26970568f49bSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
26980568f49bSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
26990568f49bSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
27000568f49bSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
27010568f49bSmrg  # is not polluted with repeated "-I."
27020568f49bSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
27030568f49bSmrg  # test to see if srcdir already configured
27040568f49bSmrg  if test -f $srcdir/config.status; then
27050568f49bSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
27069e7bcd65Smrg  fi
27079e7bcd65Smrgfi
27082ae83157Smrg
27090568f49bSmrg# test whether we have cygpath
27100568f49bSmrgif test -z "$CYGPATH_W"; then
27110568f49bSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
27120568f49bSmrg    CYGPATH_W='cygpath -w'
27130568f49bSmrg  else
27140568f49bSmrg    CYGPATH_W=echo
27159e7bcd65Smrg  fi
27169e7bcd65Smrgfi
27170568f49bSmrgAC_SUBST([CYGPATH_W])
27182ae83157Smrg
27190568f49bSmrg# Define the identity of the package.
27200568f49bSmrgdnl Distinguish between old-style and new-style calls.
27210568f49bSmrgm4_ifval([$2],
27220568f49bSmrg[AC_DIAGNOSE([obsolete],
27230568f49bSmrg             [$0: two- and three-arguments forms are deprecated.])
27240568f49bSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
27250568f49bSmrg AC_SUBST([PACKAGE], [$1])dnl
27260568f49bSmrg AC_SUBST([VERSION], [$2])],
27270568f49bSmrg[_AM_SET_OPTIONS([$1])dnl
27280568f49bSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
27290568f49bSmrgm4_if(
27300568f49bSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
27310568f49bSmrg  [ok:ok],,
27320568f49bSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
27330568f49bSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
27340568f49bSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2735444c061aSmrg
27360568f49bSmrg_AM_IF_OPTION([no-define],,
27370568f49bSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
27380568f49bSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
2739444c061aSmrg
27400568f49bSmrg# Some tools Automake needs.
27410568f49bSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
27420568f49bSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
27430568f49bSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
27440568f49bSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
27450568f49bSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
27460568f49bSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
27470568f49bSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
27480568f49bSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
27490568f49bSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
27500568f49bSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
27510568f49bSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
27520568f49bSmrg# dies out for good.  For more background, see:
27530568f49bSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
27540568f49bSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
27550568f49bSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
27560568f49bSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
27570568f49bSmrg# system "awk" is bad on some platforms.
27580568f49bSmrgAC_REQUIRE([AC_PROG_AWK])dnl
27590568f49bSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
27600568f49bSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
27610568f49bSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
27620568f49bSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
27630568f49bSmrg			     [_AM_PROG_TAR([v7])])])
27640568f49bSmrg_AM_IF_OPTION([no-dependencies],,
27650568f49bSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
27660568f49bSmrg		  [_AM_DEPENDENCIES([CC])],
27670568f49bSmrg		  [m4_define([AC_PROG_CC],
27680568f49bSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
27690568f49bSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
27700568f49bSmrg		  [_AM_DEPENDENCIES([CXX])],
27710568f49bSmrg		  [m4_define([AC_PROG_CXX],
27720568f49bSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
27730568f49bSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
27740568f49bSmrg		  [_AM_DEPENDENCIES([OBJC])],
27750568f49bSmrg		  [m4_define([AC_PROG_OBJC],
27760568f49bSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
27770568f49bSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
27780568f49bSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
27790568f49bSmrg		  [m4_define([AC_PROG_OBJCXX],
27800568f49bSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
27810568f49bSmrg])
27820568f49bSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
27830568f49bSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
27840568f49bSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
27850568f49bSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
27860568f49bSmrgAC_CONFIG_COMMANDS_PRE(dnl
27870568f49bSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
27880568f49bSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
27890568f49bSmrg
27900568f49bSmrg# POSIX will say in a future version that running "rm -f" with no argument
27910568f49bSmrg# is OK; and we want to be able to make that assumption in our Makefile
27920568f49bSmrg# recipes.  So use an aggressive probe to check that the usage we want is
27930568f49bSmrg# actually supported "in the wild" to an acceptable degree.
27940568f49bSmrg# See automake bug#10828.
27950568f49bSmrg# To make any issue more visible, cause the running configure to be aborted
27960568f49bSmrg# by default if the 'rm' program in use doesn't match our expectations; the
27970568f49bSmrg# user can still override this though.
27980568f49bSmrgif rm -f && rm -fr && rm -rf; then : OK; else
27990568f49bSmrg  cat >&2 <<'END'
28000568f49bSmrgOops!
2801444c061aSmrg
28020568f49bSmrgYour 'rm' program seems unable to run without file operands specified
28030568f49bSmrgon the command line, even when the '-f' option is present.  This is contrary
28040568f49bSmrgto the behaviour of most rm programs out there, and not conforming with
28050568f49bSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
2806444c061aSmrg
28070568f49bSmrgPlease tell bug-automake@gnu.org about your system, including the value
28080568f49bSmrgof your $PATH and any error possibly output before this message.  This
28090568f49bSmrgcan help us improve future automake versions.
2810444c061aSmrg
28110568f49bSmrgEND
28120568f49bSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
28130568f49bSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
28140568f49bSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
28150568f49bSmrg    echo >&2
28160568f49bSmrg  else
28170568f49bSmrg    cat >&2 <<'END'
28180568f49bSmrgAborting the configuration process, to ensure you take notice of the issue.
2819444c061aSmrg
28200568f49bSmrgYou can download and install GNU coreutils to get an 'rm' implementation
28210568f49bSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
28220568f49bSmrg
28230568f49bSmrgIf you want to complete the configuration process using your problematic
28240568f49bSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
28250568f49bSmrgto "yes", and re-run configure.
28260568f49bSmrg
28270568f49bSmrgEND
28280568f49bSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
28290568f49bSmrg  fi
28309e7bcd65Smrgfi
28310568f49bSmrgdnl The trailing newline in this macro's definition is deliberate, for
28320568f49bSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
28330568f49bSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
28340568f49bSmrg])
2835444c061aSmrg
28360568f49bSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
28370568f49bSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
28380568f49bSmrgdnl mangled by Autoconf and run in a shell conditional statement.
28390568f49bSmrgm4_define([_AC_COMPILER_EXEEXT],
28400568f49bSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
28412ae83157Smrg
28420568f49bSmrg# When config.status generates a header, we must update the stamp-h file.
28430568f49bSmrg# This file resides in the same directory as the config header
28440568f49bSmrg# that is generated.  The stamp files are numbered to have different names.
28450568f49bSmrg
28460568f49bSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
28470568f49bSmrg# loop where config.status creates the headers, so we can generate
28480568f49bSmrg# our stamp files there.
28490568f49bSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
28500568f49bSmrg[# Compute $1's index in $config_headers.
28510568f49bSmrg_am_arg=$1
28520568f49bSmrg_am_stamp_count=1
28530568f49bSmrgfor _am_header in $config_headers :; do
28540568f49bSmrg  case $_am_header in
28550568f49bSmrg    $_am_arg | $_am_arg:* )
28560568f49bSmrg      break ;;
28570568f49bSmrg    * )
28580568f49bSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
28590568f49bSmrg  esac
28600568f49bSmrgdone
28610568f49bSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
28620568f49bSmrg
2863a3bd7f05Smrg# Copyright (C) 2001-2020 Free Software Foundation, Inc.
2864bdf0f55dSmrg#
28650568f49bSmrg# This file is free software; the Free Software Foundation
28660568f49bSmrg# gives unlimited permission to copy and/or distribute it,
28670568f49bSmrg# with or without modifications, as long as this notice is preserved.
28682ae83157Smrg
28690568f49bSmrg# AM_PROG_INSTALL_SH
28700568f49bSmrg# ------------------
28710568f49bSmrg# Define $install_sh.
28720568f49bSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
28730568f49bSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
28740568f49bSmrgif test x"${install_sh+set}" != xset; then
28750568f49bSmrg  case $am_aux_dir in
28760568f49bSmrg  *\ * | *\	*)
28770568f49bSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
28780568f49bSmrg  *)
28790568f49bSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
28800568f49bSmrg  esac
28819e7bcd65Smrgfi
28820568f49bSmrgAC_SUBST([install_sh])])
2883444c061aSmrg
2884a3bd7f05Smrg# Copyright (C) 2003-2020 Free Software Foundation, Inc.
28850568f49bSmrg#
28860568f49bSmrg# This file is free software; the Free Software Foundation
28870568f49bSmrg# gives unlimited permission to copy and/or distribute it,
28880568f49bSmrg# with or without modifications, as long as this notice is preserved.
28890568f49bSmrg
28900568f49bSmrg# Check whether the underlying file-system supports filenames
28910568f49bSmrg# with a leading dot.  For instance MS-DOS doesn't.
28920568f49bSmrgAC_DEFUN([AM_SET_LEADING_DOT],
28930568f49bSmrg[rm -rf .tst 2>/dev/null
28940568f49bSmrgmkdir .tst 2>/dev/null
28950568f49bSmrgif test -d .tst; then
28960568f49bSmrg  am__leading_dot=.
28979e7bcd65Smrgelse
28980568f49bSmrg  am__leading_dot=_
2899bdf0f55dSmrgfi
29000568f49bSmrgrmdir .tst 2>/dev/null
29010568f49bSmrgAC_SUBST([am__leading_dot])])
29022ae83157Smrg
29030568f49bSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
2904444c061aSmrg
2905a3bd7f05Smrg# Copyright (C) 2001-2020 Free Software Foundation, Inc.
29069e7bcd65Smrg#
29070568f49bSmrg# This file is free software; the Free Software Foundation
29080568f49bSmrg# gives unlimited permission to copy and/or distribute it,
29090568f49bSmrg# with or without modifications, as long as this notice is preserved.
2910249c3046Smrg
29110568f49bSmrg# AM_MAKE_INCLUDE()
29120568f49bSmrg# -----------------
29130568f49bSmrg# Check whether make has an 'include' directive that can support all
29140568f49bSmrg# the idioms we need for our automatic dependency tracking code.
29150568f49bSmrgAC_DEFUN([AM_MAKE_INCLUDE],
29160568f49bSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
29170568f49bSmrgcat > confinc.mk << 'END'
29180568f49bSmrgam__doit:
29190568f49bSmrg	@echo this is the am__doit target >confinc.out
29200568f49bSmrg.PHONY: am__doit
29210568f49bSmrgEND
29220568f49bSmrgam__include="#"
29230568f49bSmrgam__quote=
29240568f49bSmrg# BSD make does it like this.
29250568f49bSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
29260568f49bSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
29270568f49bSmrgecho 'include confinc.mk # ignored' > confmf.GNU
29280568f49bSmrg_am_result=no
29290568f49bSmrgfor s in GNU BSD; do
29300568f49bSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
29310568f49bSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
29320568f49bSmrg      ['0:this is the am__doit target'],
29330568f49bSmrg      [AS_CASE([$s],
29340568f49bSmrg          [BSD], [am__include='.include' am__quote='"'],
29350568f49bSmrg          [am__include='include' am__quote=''])])
29360568f49bSmrg  if test "$am__include" != "#"; then
29370568f49bSmrg    _am_result="yes ($s style)"
29380568f49bSmrg    break
29390568f49bSmrg  fi
29400568f49bSmrgdone
29410568f49bSmrgrm -f confinc.* confmf.*
29420568f49bSmrgAC_MSG_RESULT([${_am_result}])
29430568f49bSmrgAC_SUBST([am__include])])
29440568f49bSmrgAC_SUBST([am__quote])])
2945249c3046Smrg
29460568f49bSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
2947444c061aSmrg
2948a3bd7f05Smrg# Copyright (C) 1997-2020 Free Software Foundation, Inc.
29490568f49bSmrg#
29500568f49bSmrg# This file is free software; the Free Software Foundation
29510568f49bSmrg# gives unlimited permission to copy and/or distribute it,
29520568f49bSmrg# with or without modifications, as long as this notice is preserved.
29530568f49bSmrg
29540568f49bSmrg# AM_MISSING_PROG(NAME, PROGRAM)
29550568f49bSmrg# ------------------------------
29560568f49bSmrgAC_DEFUN([AM_MISSING_PROG],
29570568f49bSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
29580568f49bSmrg$1=${$1-"${am_missing_run}$2"}
29590568f49bSmrgAC_SUBST($1)])
29600568f49bSmrg
29610568f49bSmrg# AM_MISSING_HAS_RUN
29620568f49bSmrg# ------------------
29630568f49bSmrg# Define MISSING if not defined so far and test if it is modern enough.
29640568f49bSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
29650568f49bSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
29660568f49bSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
29670568f49bSmrgAC_REQUIRE_AUX_FILE([missing])dnl
29680568f49bSmrgif test x"${MISSING+set}" != xset; then
29690568f49bSmrg  case $am_aux_dir in
29700568f49bSmrg  *\ * | *\	*)
29710568f49bSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
29720568f49bSmrg  *)
29730568f49bSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
29740568f49bSmrg  esac
2975bdf0f55dSmrgfi
29760568f49bSmrg# Use eval to expand $SHELL
29770568f49bSmrgif eval "$MISSING --is-lightweight"; then
29780568f49bSmrg  am_missing_run="$MISSING "
29790568f49bSmrgelse
29800568f49bSmrg  am_missing_run=
29810568f49bSmrg  AC_MSG_WARN(['missing' script is too old or missing])
29829e7bcd65Smrgfi
29830568f49bSmrg])
2984249c3046Smrg
29850568f49bSmrg# Helper functions for option handling.                     -*- Autoconf -*-
29862ae83157Smrg
2987a3bd7f05Smrg# Copyright (C) 2001-2020 Free Software Foundation, Inc.
29889e7bcd65Smrg#
29890568f49bSmrg# This file is free software; the Free Software Foundation
29900568f49bSmrg# gives unlimited permission to copy and/or distribute it,
29910568f49bSmrg# with or without modifications, as long as this notice is preserved.
2992249c3046Smrg
29930568f49bSmrg# _AM_MANGLE_OPTION(NAME)
29940568f49bSmrg# -----------------------
29950568f49bSmrgAC_DEFUN([_AM_MANGLE_OPTION],
29960568f49bSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
29972265a131Smrg
29980568f49bSmrg# _AM_SET_OPTION(NAME)
29990568f49bSmrg# --------------------
30000568f49bSmrg# Set option NAME.  Presently that only means defining a flag for this option.
30010568f49bSmrgAC_DEFUN([_AM_SET_OPTION],
30020568f49bSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
3003444c061aSmrg
30040568f49bSmrg# _AM_SET_OPTIONS(OPTIONS)
30050568f49bSmrg# ------------------------
30060568f49bSmrg# OPTIONS is a space-separated list of Automake options.
30070568f49bSmrgAC_DEFUN([_AM_SET_OPTIONS],
30080568f49bSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
3009444c061aSmrg
30100568f49bSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
30110568f49bSmrg# -------------------------------------------
30120568f49bSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
30130568f49bSmrgAC_DEFUN([_AM_IF_OPTION],
30140568f49bSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
30152265a131Smrg
3016a3bd7f05Smrg# Copyright (C) 1999-2020 Free Software Foundation, Inc.
30179e7bcd65Smrg#
30180568f49bSmrg# This file is free software; the Free Software Foundation
30190568f49bSmrg# gives unlimited permission to copy and/or distribute it,
30200568f49bSmrg# with or without modifications, as long as this notice is preserved.
3021249c3046Smrg
30220568f49bSmrg# _AM_PROG_CC_C_O
3023bdf0f55dSmrg# ---------------
30240568f49bSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
30250568f49bSmrg# to automatically call this.
30260568f49bSmrgAC_DEFUN([_AM_PROG_CC_C_O],
30270568f49bSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
30280568f49bSmrgAC_REQUIRE_AUX_FILE([compile])dnl
30290568f49bSmrgAC_LANG_PUSH([C])dnl
30300568f49bSmrgAC_CACHE_CHECK(
30310568f49bSmrg  [whether $CC understands -c and -o together],
30320568f49bSmrg  [am_cv_prog_cc_c_o],
30330568f49bSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
30340568f49bSmrg  # Make sure it works both with $CC and with simple cc.
30350568f49bSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
30360568f49bSmrg  # compilers refuse to overwrite an existing .o file with -o,
30370568f49bSmrg  # though they will create one.
30380568f49bSmrg  am_cv_prog_cc_c_o=yes
30390568f49bSmrg  for am_i in 1 2; do
30400568f49bSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
30410568f49bSmrg         && test -f conftest2.$ac_objext; then
30420568f49bSmrg      : OK
30430568f49bSmrg    else
30440568f49bSmrg      am_cv_prog_cc_c_o=no
30450568f49bSmrg      break
30460568f49bSmrg    fi
30470568f49bSmrg  done
30480568f49bSmrg  rm -f core conftest*
30490568f49bSmrg  unset am_i])
30500568f49bSmrgif test "$am_cv_prog_cc_c_o" != yes; then
30510568f49bSmrg   # Losing compiler, so override with the script.
30520568f49bSmrg   # FIXME: It is wrong to rewrite CC.
30530568f49bSmrg   # But if we don't then we get into trouble of one sort or another.
30540568f49bSmrg   # A longer-term fix would be to have automake use am__CC in this case,
30550568f49bSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
30560568f49bSmrg   CC="$am_aux_dir/compile $CC"
3057bdf0f55dSmrgfi
30580568f49bSmrgAC_LANG_POP([C])])
30592265a131Smrg
30600568f49bSmrg# For backward compatibility.
30610568f49bSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
3062444c061aSmrg
3063a3bd7f05Smrg# Copyright (C) 2001-2020 Free Software Foundation, Inc.
30640568f49bSmrg#
30650568f49bSmrg# This file is free software; the Free Software Foundation
30660568f49bSmrg# gives unlimited permission to copy and/or distribute it,
30670568f49bSmrg# with or without modifications, as long as this notice is preserved.
30689e7bcd65Smrg
30690568f49bSmrg# AM_RUN_LOG(COMMAND)
30700568f49bSmrg# -------------------
30710568f49bSmrg# Run COMMAND, save the exit status in ac_status, and log it.
30720568f49bSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
30730568f49bSmrgAC_DEFUN([AM_RUN_LOG],
30740568f49bSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
30750568f49bSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
30760568f49bSmrg   ac_status=$?
30770568f49bSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
30780568f49bSmrg   (exit $ac_status); }])
30799e7bcd65Smrg
30800568f49bSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
30819e7bcd65Smrg
3082a3bd7f05Smrg# Copyright (C) 1996-2020 Free Software Foundation, Inc.
30830568f49bSmrg#
30840568f49bSmrg# This file is free software; the Free Software Foundation
30850568f49bSmrg# gives unlimited permission to copy and/or distribute it,
30860568f49bSmrg# with or without modifications, as long as this notice is preserved.
30879e7bcd65Smrg
30880568f49bSmrg# AM_SANITY_CHECK
30890568f49bSmrg# ---------------
30900568f49bSmrgAC_DEFUN([AM_SANITY_CHECK],
30910568f49bSmrg[AC_MSG_CHECKING([whether build environment is sane])
30920568f49bSmrg# Reject unsafe characters in $srcdir or the absolute working directory
30930568f49bSmrg# name.  Accept space and tab only in the latter.
30940568f49bSmrgam_lf='
30950568f49bSmrg'
30960568f49bSmrgcase `pwd` in
30970568f49bSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
30980568f49bSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
30990568f49bSmrgesac
31000568f49bSmrgcase $srcdir in
31010568f49bSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
31020568f49bSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
31030568f49bSmrgesac
31040568f49bSmrg
31050568f49bSmrg# Do 'set' in a subshell so we don't clobber the current shell's
31060568f49bSmrg# arguments.  Must try -L first in case configure is actually a
31070568f49bSmrg# symlink; some systems play weird games with the mod time of symlinks
31080568f49bSmrg# (eg FreeBSD returns the mod time of the symlink's containing
31090568f49bSmrg# directory).
31100568f49bSmrgif (
31110568f49bSmrg   am_has_slept=no
31120568f49bSmrg   for am_try in 1 2; do
31130568f49bSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
31140568f49bSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
31150568f49bSmrg     if test "$[*]" = "X"; then
31160568f49bSmrg	# -L didn't work.
31170568f49bSmrg	set X `ls -t "$srcdir/configure" conftest.file`
31180568f49bSmrg     fi
31190568f49bSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
31200568f49bSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
31219e7bcd65Smrg
31220568f49bSmrg	# If neither matched, then we have a broken ls.  This can happen
31230568f49bSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
31240568f49bSmrg	# broken ls alias from the environment.  This has actually
31250568f49bSmrg	# happened.  Such a system could not be considered "sane".
31260568f49bSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
31270568f49bSmrg  alias in your environment])
31280568f49bSmrg     fi
31290568f49bSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
31300568f49bSmrg       break
31310568f49bSmrg     fi
31320568f49bSmrg     # Just in case.
31330568f49bSmrg     sleep 1
31340568f49bSmrg     am_has_slept=yes
31350568f49bSmrg   done
31360568f49bSmrg   test "$[2]" = conftest.file
31370568f49bSmrg   )
31380568f49bSmrgthen
31390568f49bSmrg   # Ok.
31400568f49bSmrg   :
31410568f49bSmrgelse
31420568f49bSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
31430568f49bSmrgCheck your system clock])
31440568f49bSmrgfi
31450568f49bSmrgAC_MSG_RESULT([yes])
31460568f49bSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
31470568f49bSmrg# generated files are strictly newer.
31480568f49bSmrgam_sleep_pid=
31490568f49bSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
31500568f49bSmrg  ( sleep 1 ) &
31510568f49bSmrg  am_sleep_pid=$!
31520568f49bSmrgfi
31530568f49bSmrgAC_CONFIG_COMMANDS_PRE(
31540568f49bSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
31550568f49bSmrg   if test -n "$am_sleep_pid"; then
31560568f49bSmrg     # Hide warnings about reused PIDs.
31570568f49bSmrg     wait $am_sleep_pid 2>/dev/null
31580568f49bSmrg   fi
31590568f49bSmrg   AC_MSG_RESULT([done])])
31600568f49bSmrgrm -f conftest.file
3161249c3046Smrg])
31622ae83157Smrg
3163a3bd7f05Smrg# Copyright (C) 2009-2020 Free Software Foundation, Inc.
31649e7bcd65Smrg#
31650568f49bSmrg# This file is free software; the Free Software Foundation
31660568f49bSmrg# gives unlimited permission to copy and/or distribute it,
31670568f49bSmrg# with or without modifications, as long as this notice is preserved.
31689e7bcd65Smrg
31690568f49bSmrg# AM_SILENT_RULES([DEFAULT])
31700568f49bSmrg# --------------------------
31710568f49bSmrg# Enable less verbose build rules; with the default set to DEFAULT
31720568f49bSmrg# ("yes" being less verbose, "no" or empty being verbose).
31730568f49bSmrgAC_DEFUN([AM_SILENT_RULES],
31740568f49bSmrg[AC_ARG_ENABLE([silent-rules], [dnl
31750568f49bSmrgAS_HELP_STRING(
31760568f49bSmrg  [--enable-silent-rules],
31770568f49bSmrg  [less verbose build output (undo: "make V=1")])
31780568f49bSmrgAS_HELP_STRING(
31790568f49bSmrg  [--disable-silent-rules],
31800568f49bSmrg  [verbose build output (undo: "make V=0")])dnl
31810568f49bSmrg])
31820568f49bSmrgcase $enable_silent_rules in @%:@ (((
31830568f49bSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
31840568f49bSmrg   no) AM_DEFAULT_VERBOSITY=1;;
31850568f49bSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
31860568f49bSmrgesac
31870568f49bSmrgdnl
31880568f49bSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
31890568f49bSmrgdnl do not support nested variable expansions.
31900568f49bSmrgdnl See automake bug#9928 and bug#10237.
31910568f49bSmrgam_make=${MAKE-make}
31920568f49bSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
31930568f49bSmrg   [am_cv_make_support_nested_variables],
31940568f49bSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
31950568f49bSmrgBAR0=false
31960568f49bSmrgBAR1=true
31970568f49bSmrgV=1
31980568f49bSmrgam__doit:
31990568f49bSmrg	@$(TRUE)
32000568f49bSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
32010568f49bSmrg  am_cv_make_support_nested_variables=yes
32029e7bcd65Smrgelse
32030568f49bSmrg  am_cv_make_support_nested_variables=no
32040568f49bSmrgfi])
32050568f49bSmrgif test $am_cv_make_support_nested_variables = yes; then
32060568f49bSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
32070568f49bSmrg  AM_V='$(V)'
32080568f49bSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
32090568f49bSmrgelse
32100568f49bSmrg  AM_V=$AM_DEFAULT_VERBOSITY
32110568f49bSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
32129e7bcd65Smrgfi
32130568f49bSmrgAC_SUBST([AM_V])dnl
32140568f49bSmrgAM_SUBST_NOTMAKE([AM_V])dnl
32150568f49bSmrgAC_SUBST([AM_DEFAULT_V])dnl
32160568f49bSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
32170568f49bSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
32180568f49bSmrgAM_BACKSLASH='\'
32190568f49bSmrgAC_SUBST([AM_BACKSLASH])dnl
32200568f49bSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
32210568f49bSmrg])
3222bdf0f55dSmrg
3223a3bd7f05Smrg# Copyright (C) 2001-2020 Free Software Foundation, Inc.
32240568f49bSmrg#
32250568f49bSmrg# This file is free software; the Free Software Foundation
32260568f49bSmrg# gives unlimited permission to copy and/or distribute it,
32270568f49bSmrg# with or without modifications, as long as this notice is preserved.
32289e7bcd65Smrg
32290568f49bSmrg# AM_PROG_INSTALL_STRIP
32300568f49bSmrg# ---------------------
32310568f49bSmrg# One issue with vendor 'install' (even GNU) is that you can't
32320568f49bSmrg# specify the program used to strip binaries.  This is especially
32330568f49bSmrg# annoying in cross-compiling environments, where the build's strip
32340568f49bSmrg# is unlikely to handle the host's binaries.
32350568f49bSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
32360568f49bSmrg# always use install-sh in "make install-strip", and initialize
32370568f49bSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
32380568f49bSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
32390568f49bSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
32400568f49bSmrg# Installed binaries are usually stripped using 'strip' when the user
32410568f49bSmrg# run "make install-strip".  However 'strip' might not be the right
32420568f49bSmrg# tool to use in cross-compilation environments, therefore Automake
32430568f49bSmrg# will honor the 'STRIP' environment variable to overrule this program.
32440568f49bSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
32450568f49bSmrgif test "$cross_compiling" != no; then
32460568f49bSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
32470568f49bSmrgfi
32480568f49bSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
32490568f49bSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
32509e7bcd65Smrg
3251a3bd7f05Smrg# Copyright (C) 2006-2020 Free Software Foundation, Inc.
32520568f49bSmrg#
32530568f49bSmrg# This file is free software; the Free Software Foundation
32540568f49bSmrg# gives unlimited permission to copy and/or distribute it,
32550568f49bSmrg# with or without modifications, as long as this notice is preserved.
32569e7bcd65Smrg
32570568f49bSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
32580568f49bSmrg# ---------------------------
32590568f49bSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
32600568f49bSmrg# This macro is traced by Automake.
32610568f49bSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
32629e7bcd65Smrg
32630568f49bSmrg# AM_SUBST_NOTMAKE(VARIABLE)
32640568f49bSmrg# --------------------------
32650568f49bSmrg# Public sister of _AM_SUBST_NOTMAKE.
32660568f49bSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
32679e7bcd65Smrg
32680568f49bSmrg# Check how to create a tarball.                            -*- Autoconf -*-
3269bdf0f55dSmrg
3270a3bd7f05Smrg# Copyright (C) 2004-2020 Free Software Foundation, Inc.
32710568f49bSmrg#
32720568f49bSmrg# This file is free software; the Free Software Foundation
32730568f49bSmrg# gives unlimited permission to copy and/or distribute it,
32740568f49bSmrg# with or without modifications, as long as this notice is preserved.
32759e7bcd65Smrg
32760568f49bSmrg# _AM_PROG_TAR(FORMAT)
32770568f49bSmrg# --------------------
32780568f49bSmrg# Check how to create a tarball in format FORMAT.
32790568f49bSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
3280249c3046Smrg#
32810568f49bSmrg# Substitute a variable $(am__tar) that is a command
32820568f49bSmrg# writing to stdout a FORMAT-tarball containing the directory
32830568f49bSmrg# $tardir.
32840568f49bSmrg#     tardir=directory && $(am__tar) > result.tar
32859e7bcd65Smrg#
32860568f49bSmrg# Substitute a variable $(am__untar) that extract such
32870568f49bSmrg# a tarball read from stdin.
32880568f49bSmrg#     $(am__untar) < result.tar
32899e7bcd65Smrg#
32900568f49bSmrgAC_DEFUN([_AM_PROG_TAR],
32910568f49bSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
32920568f49bSmrg# in the wild :-(  We should find a proper way to deprecate it ...
32930568f49bSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
32942265a131Smrg
32950568f49bSmrg# We'll loop over all known methods to create a tar archive until one works.
32960568f49bSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
32972265a131Smrg
32980568f49bSmrgm4_if([$1], [v7],
32990568f49bSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
3300444c061aSmrg
33010568f49bSmrg  [m4_case([$1],
33020568f49bSmrg    [ustar],
33030568f49bSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
33040568f49bSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
33050568f49bSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
33060568f49bSmrg      # and bug#13588).
33070568f49bSmrg      am_max_uid=2097151 # 2^21 - 1
33080568f49bSmrg      am_max_gid=$am_max_uid
33090568f49bSmrg      # The $UID and $GID variables are not portable, so we need to resort
33100568f49bSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
33110568f49bSmrg      # below are definitely unexpected, so allow the users to see them
33120568f49bSmrg      # (that is, avoid stderr redirection).
33130568f49bSmrg      am_uid=`id -u || echo unknown`
33140568f49bSmrg      am_gid=`id -g || echo unknown`
33150568f49bSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
33160568f49bSmrg      if test $am_uid -le $am_max_uid; then
33170568f49bSmrg         AC_MSG_RESULT([yes])
33180568f49bSmrg      else
33190568f49bSmrg         AC_MSG_RESULT([no])
33200568f49bSmrg         _am_tools=none
33210568f49bSmrg      fi
33220568f49bSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
33230568f49bSmrg      if test $am_gid -le $am_max_gid; then
33240568f49bSmrg         AC_MSG_RESULT([yes])
33250568f49bSmrg      else
33260568f49bSmrg        AC_MSG_RESULT([no])
33270568f49bSmrg        _am_tools=none
33280568f49bSmrg      fi],
3329444c061aSmrg
33300568f49bSmrg  [pax],
33310568f49bSmrg    [],
3332444c061aSmrg
33330568f49bSmrg  [m4_fatal([Unknown tar format])])
3334444c061aSmrg
33350568f49bSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
3336444c061aSmrg
33370568f49bSmrg  # Go ahead even if we have the value already cached.  We do so because we
33380568f49bSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
33390568f49bSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
3340bdf0f55dSmrg
33410568f49bSmrg  for _am_tool in $_am_tools; do
33420568f49bSmrg    case $_am_tool in
33430568f49bSmrg    gnutar)
33440568f49bSmrg      for _am_tar in tar gnutar gtar; do
33450568f49bSmrg        AM_RUN_LOG([$_am_tar --version]) && break
33460568f49bSmrg      done
33470568f49bSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
33480568f49bSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
33490568f49bSmrg      am__untar="$_am_tar -xf -"
33500568f49bSmrg      ;;
33510568f49bSmrg    plaintar)
33520568f49bSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
33530568f49bSmrg      # ustar tarball either.
33540568f49bSmrg      (tar --version) >/dev/null 2>&1 && continue
33550568f49bSmrg      am__tar='tar chf - "$$tardir"'
33560568f49bSmrg      am__tar_='tar chf - "$tardir"'
33570568f49bSmrg      am__untar='tar xf -'
33580568f49bSmrg      ;;
33590568f49bSmrg    pax)
33600568f49bSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
33610568f49bSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
33620568f49bSmrg      am__untar='pax -r'
33630568f49bSmrg      ;;
33640568f49bSmrg    cpio)
33650568f49bSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
33660568f49bSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
33670568f49bSmrg      am__untar='cpio -i -H $1 -d'
33680568f49bSmrg      ;;
33690568f49bSmrg    none)
33700568f49bSmrg      am__tar=false
33710568f49bSmrg      am__tar_=false
33720568f49bSmrg      am__untar=false
33730568f49bSmrg      ;;
33740568f49bSmrg    esac
3375bdf0f55dSmrg
33760568f49bSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
33770568f49bSmrg    # and am__untar set.
33780568f49bSmrg    test -n "${am_cv_prog_tar_$1}" && break
3379339a7c43Smrg
33800568f49bSmrg    # tar/untar a dummy directory, and stop if the command works.
33810568f49bSmrg    rm -rf conftest.dir
33820568f49bSmrg    mkdir conftest.dir
33830568f49bSmrg    echo GrepMe > conftest.dir/file
33840568f49bSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
33850568f49bSmrg    rm -rf conftest.dir
33860568f49bSmrg    if test -s conftest.tar; then
33870568f49bSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
33880568f49bSmrg      AM_RUN_LOG([cat conftest.dir/file])
33890568f49bSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
33900568f49bSmrg    fi
33910568f49bSmrg  done
33920568f49bSmrg  rm -rf conftest.dir
3393bdf0f55dSmrg
33940568f49bSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
33950568f49bSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
33960568f49bSmrg
33970568f49bSmrgAC_SUBST([am__tar])
33980568f49bSmrgAC_SUBST([am__untar])
33990568f49bSmrg]) # _AM_PROG_TAR
3400444c061aSmrg
34010568f49bSmrgm4_include([m4/ax_define_dir.m4])
34020568f49bSmrgm4_include([m4/libtool.m4])
34030568f49bSmrgm4_include([m4/ltoptions.m4])
34040568f49bSmrgm4_include([m4/ltsugar.m4])
34050568f49bSmrgm4_include([m4/ltversion.m4])
34060568f49bSmrgm4_include([m4/lt~obsolete.m4])
3407